/* 머니마블 스튜디오 — 어드민(웹) 화면.
   색 = 우아금 3색(딥블루·라이트블루·옐로) · 글꼴 = NPS(국민연금체).
   ⚠️NPS 원본 otf 는 크롬이 웹폰트로 거부한다(CFF 표 오류) → 윤곽만 트루타입으로 바꾼 woff2 를 쓴다(scripts/convert_nps_font.py). */
@font-face { font-family: 'NPS'; src: url('/fonts/NPS_regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'NPS'; src: url('/fonts/NPS_bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'NPS'; src: url('/fonts/NPS_extrabold.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --blue: #2b4bb1;
  --blue-d: #223c8f;
  --sky: #83acdd;
  --sky-l: #eaf1fa;
  --yellow: #ffd252;
  --yellow-l: #fff6d6;
  --ink: #1b2233;
  --ink-2: #4a5468;      /* 흰 바탕 대비비 7.6 */
  --ink-3: #636d80;      /* 흰 바탕 대비비 5.2 */
  --line: #dfe4ee;
  --bg: #f4f6fa;
  --white: #fff;
  --red: #c0392b;
  --green: #1e7a46;
  --row-h: 38px;
  --r: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'NPS', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  word-break: keep-all; overflow-wrap: break-word;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: Consolas, 'Courier New', monospace; font-size: 12px; }

.boot { padding: 80px 0; text-align: center; color: var(--ink-3); }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--blue); }
/* 흰 카드 안 — 로고가 제목·안내문의 왼쪽에 선다 */
.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-logo { flex: 0 0 auto; width: 72px; height: 72px; }
.login-head .login-sub { margin-bottom: 0; }
.login-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 14px; padding: 32px 28px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 800; color: var(--blue); }
.login-sub { margin: 0 0 20px; color: var(--ink-2); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-weight: 700; font-size: 13px; }
.field input, .field textarea, .field select, .input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white);
}
.field textarea { height: auto; min-height: 84px; padding: 9px 12px; line-height: 1.55; resize: vertical; }
.field input:focus, .field textarea:focus, .input:focus, .cell-in:focus { outline: 2px solid var(--sky); outline-offset: 0; border-color: var(--blue); }
.login-opts { display: flex; justify-content: space-between; gap: 12px; margin: 2px 0 10px; font-size: 13px; }
.err { min-height: 20px; margin: 0 0 10px; color: var(--red); font-size: 13px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--white); color: var(--ink);
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--sky); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-d); }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn-danger { background: var(--white); border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .45); color: var(--white); }
.btn-ghost:hover { border-color: var(--white); }
.btn-block { width: 100%; height: 42px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(255, 255, 255, .45); border-radius: var(--r); background: transparent; color: var(--white); cursor: pointer; }
.icon-btn:hover { border-color: var(--white); background: rgba(255, 255, 255, .12); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* 머리 */
.top { background: var(--blue); color: var(--white); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: 10px; max-width: 1360px; margin: 0 auto; padding: 12px 24px 8px; }
.brand { font-size: 18px; font-weight: 800; margin-right: 6px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; background: rgba(255, 255, 255, .16); font-size: 12.5px; }
.top-gap { flex: 1 1 auto; }
.who { font-size: 13px; }
.tabs { display: flex; gap: 2px; max-width: 1360px; margin: 0 auto; padding: 0 24px; }
.tabs button {
  height: 40px; padding: 0 18px; border: 0; border-radius: var(--r) var(--r) 0 0; background: transparent; color: var(--white);
  font-weight: 700; cursor: pointer;
}
.tabs button.is-on { background: var(--bg); color: var(--blue); }

.main { max-width: 1360px; margin: 0 auto; padding: 20px 24px 96px; }
.tab { min-height: 400px; }
.hint { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; }
.hint-inline { margin: 0; }

/* 알림 띠 */
.notice { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px 16px; border-radius: var(--r); background: var(--yellow-l); border: 1px solid var(--yellow); }
.notice p { margin: 0; flex: 1 1 auto; }
.notice b { font-weight: 800; }

/* 세그먼트 */
.seg { display: inline-flex; margin-bottom: 12px; padding: 3px; border-radius: 10px; background: #e3e8f2; }
.seg button { height: 34px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-weight: 700; cursor: pointer; }
.seg button.is-on { background: var(--white); color: var(--blue); box-shadow: 0 1px 2px rgba(27, 34, 51, .12); }
.seg b { font-weight: 400; font-size: 12px; margin-left: 2px; }

/* 하위 메뉴(세부 분류) — 위 세그먼트에서 고른 표 안에서 한 단계 더 들어간다 */
.subseg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.subseg:empty { display: none; }
.subseg button {
  height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); color: var(--ink-2);
  font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.subseg button:hover { border-color: var(--sky); }
.subseg button.is-on { background: var(--blue); border-color: var(--blue); color: var(--white); }
.subseg b { font-weight: 400; font-size: 12px; margin-left: 3px; }
.subseg button.has-chg::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--yellow); vertical-align: 1px; }

/* 도구줄 */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.toolbar .input { width: 240px; height: 36px; }
.toolbar select.input { width: 190px; }
.check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.count { color: var(--ink-2); font-size: 13px; white-space: nowrap; }

/* 표 — 영역 고정: 열 폭은 th 의 style, 줄 높이는 --row-h, 마지막 쪽은 빈 줄로 채운다 */
.tbl-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tbl th {
  height: 40px; padding: 0 10px; background: var(--sky-l); color: var(--ink); font-weight: 700; font-size: 13px; text-align: center;
  border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none;
}
.tbl th[data-sort] { cursor: pointer; }
.tbl th[data-sort]:hover { color: var(--blue); }
.tbl th .arrow { display: inline-block; width: 12px; color: var(--blue); }
.tbl td {
  height: var(--row-h); padding: 0 10px; border-bottom: 1px solid #edf0f6; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
/* 표 칸은 글자·숫자 모두 가운데가 기본이다(어드민 표 공통 약속). l·r 은 열의 성격 표시로만 남긴다. */
.tbl td.l, .tbl td.r { text-align: center; }
.tbl tr.tr-fill td { color: transparent; }
.tbl tbody tr:not(.tr-fill):hover td { background: #f8fafd; }
.tbl td.edit { padding: 0 4px; cursor: text; }
.tbl td.edit .cell { display: block; height: 30px; line-height: 30px; padding: 0 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; }
.tbl td.edit:hover .cell { background: var(--sky-l); }
.tbl td.chg .cell { background: var(--yellow-l); box-shadow: inset 0 0 0 1px var(--yellow); font-weight: 700; }
.cell-in { width: 100%; height: 30px; padding: 0 6px; border: 1px solid var(--blue); border-radius: 6px; background: var(--white); text-align: inherit; }
.tbl td.none { color: var(--ink-3); }
.use { margin: 0 0 6px; padding: 0; list-style: none; }
.use li { padding: 5px 0; }
.tbl .empty td { height: 160px; color: var(--ink-3); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--sky-l); color: var(--blue-d); font-size: 12px; font-weight: 700; }
.tag-y { background: var(--yellow-l); color: #6b5200; }
.tag-g { background: #e6f3ec; color: var(--green); }
.old { color: var(--ink-3); text-decoration: line-through; }
.new { font-weight: 700; }

.pager { display: flex; align-items: center; justify-content: center; gap: 4px; height: 52px; }
.pager button { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; }
.pager button:hover { border-color: var(--line); background: var(--white); }
.pager button.is-on { background: var(--blue); color: var(--white); font-weight: 700; }
.pager button:disabled { opacity: .35; cursor: default; }

/* 챗봇 설정 카드 */
.cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cfg-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.cfg-card.wide { grid-column: 1 / -1; }
.cfg-card.chg { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow-l); }
.cfg-card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 800; }
.cfg-card p { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; }
.cfg-card textarea { width: 100%; min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); line-height: 1.6; resize: vertical; }
.cfg-card.wide textarea { min-height: 220px; }

/* 변경 대기 띠 */
.dock {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 10px; width: min(720px, calc(100vw - 48px)); padding: 12px 14px 12px 20px;
  border-radius: 12px; background: var(--blue); color: var(--white); box-shadow: 0 8px 28px rgba(27, 34, 51, .28); font-weight: 700;
}

/* 팝업 */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(27, 34, 51, .5); }
.modal { width: 100%; max-width: 820px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--white); border-radius: 14px; overflow: hidden; }
.modal.narrow { max-width: 520px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px 12px; }
.modal-head h2 { margin: 0; flex: 1 1 auto; font-size: 18px; font-weight: 800; }
.modal-x { width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; font-size: 20px; cursor: pointer; }
.modal-x:hover { background: var(--sky-l); }
.modal-body { padding: 4px 22px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }
.grid2 .wide, .grid4 .wide { grid-column: 1 / -1; }
.sub-h { margin: 8px 0 10px; font-size: 14px; font-weight: 800; color: var(--blue); }
.key-line { margin: 0 0 14px; color: var(--ink-2); font-size: 13px; }

.diff { width: 100%; border-collapse: collapse; table-layout: fixed; margin-bottom: 14px; }
.diff th { padding: 8px 10px; background: var(--sky-l); font-size: 13px; text-align: left; }
.diff td { padding: 8px 10px; border-bottom: 1px solid #edf0f6; vertical-align: top; text-align: left; white-space: pre-wrap; word-break: break-all; }
.diff .sm { color: var(--ink-3); font-size: 12px; }
.warn { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r); background: #fdecea; color: #8a241a; font-size: 13px; }
.note { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r); background: var(--sky-l); color: var(--ink); font-size: 13px; }

/* 설정 팝업 — 왼쪽 메뉴 + 오른쪽 내용 */
.set { display: grid; grid-template-columns: 170px 1fr; gap: 20px; min-height: 420px; }
.set-menu { display: flex; flex-direction: column; gap: 4px; padding-right: 16px; border-right: 1px solid var(--line); }
.set-menu button { height: 38px; padding: 0 12px; border: 0; border-radius: var(--r); background: transparent; color: var(--ink-2); font-weight: 700; text-align: left; cursor: pointer; }
.set-menu button:hover { background: var(--sky-l); }
.set-menu button.is-on { background: var(--blue); color: var(--white); }
.set-pane h3 { margin: 0 0 4px; font-size: 16px; font-weight: 800; }
.set-pane .hint { margin-bottom: 14px; }
.set-pane .tbl-wrap { margin-bottom: 16px; }
.set-pane .tbl td { --row-h: 40px; }
.set-form { display: grid; grid-template-columns: 1fr 1.3fr 1fr auto; gap: 0 10px; align-items: end; }
.set-form .field { margin-bottom: 0; }
.set-form .btn { height: 38px; }
.set-info { width: 100%; border-collapse: collapse; }
.set-info th { width: 150px; padding: 9px 0; color: var(--ink-2); font-weight: 700; text-align: left; vertical-align: top; }
.set-info td { padding: 9px 0; border-bottom: 1px solid #edf0f6; word-break: break-all; }
.set-info tr:last-child td { border-bottom: 0; }
.ev { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.ev li { padding: 6px 0; border-bottom: 1px solid #edf0f6; }
.ev li:last-child { border-bottom: 0; }
@media (max-width: 900px) { .set { grid-template-columns: 1fr; } .set-menu { flex-direction: row; padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--line); } .set-form { grid-template-columns: 1fr; gap: 10px; } }

/* 태블릿 */
.tablet { display: grid; place-items: center; padding: 8px 0 24px; }
.tablet-screen { width: min(1240px, 100%); aspect-ratio: 16 / 10; padding: 14px; border-radius: 26px; background: #1b2233; box-shadow: 0 10px 32px rgba(27, 34, 51, .25); }
.tablet-screen iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; background: #5a79d2; }

.toast { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 10px; background: var(--ink); color: var(--white); font-weight: 700; box-shadow: 0 6px 20px rgba(27, 34, 51, .3); }
.toast.bad { background: var(--red); }

@media (max-width: 900px) {
  .top-in, .tabs, .main { padding-left: 12px; padding-right: 12px; }
  .toolbar { flex-wrap: wrap; }
  .tbl-wrap { overflow-x: auto; }
  .tbl { min-width: 900px; }
  .cfg, .grid2, .grid4 { grid-template-columns: 1fr; }
  .chip, .who { display: none; }
}
