/* =========================================================================
   서울안심이 차세대 통합플랫폼 — 플랫폼관리 UI 공통 스타일
   Tone & Manner: 동행안심벨 업무관리시스템 UI 톤앤매너 v1.0 기준
   ========================================================================= */
:root {
  --navy-900: #0b2540; --navy-800: #15314f; --navy-700: #1f4468;
  --blue-700: #1d4ed8; --blue-600: #2563eb; --blue-100: #dbeafe; --blue-050: #eef2ff;
  --green-600: #3dbf4c; --green-700: #34a341; --green-ink: #166534; --green-050: #f0fdf4;
  --red-500: #f55d5d; --red-600: #d14f4f; --red-ink: #b91c1c; --red-050: #fef2f2;
  --amber-500: #f59e0b; --amber-ink: #92400e; --amber-050: #fffbeb;
  --teal-700: #0f766e;
  --gray-950: #111827; --gray-700: #374151; --gray-600: #4b5563; --gray-500: #6b7280;
  --gray-400: #9ca3af; --gray-300: #d1d5db; --gray-200: #e5e7eb; --gray-100: #f3f4f6;
  --gray-050: #f8fafc; --white: #ffffff;
  --label-bg: #f1f5f9; --label-bg-strong: #e8eef5; --th-bg: #fafafa;
  --page-bg: #f5f7fa;
  --radius-field: 6px; --radius-card: 8px; --radius-button: 10px; --radius-panel: 12px;
  --shadow-modal: 0 18px 48px rgba(15, 23, 42, .22);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gnb-h: 56px; --lnb-w: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { color: var(--gray-950); background: var(--page-bg); font-family: var(--font); font-size: 14px; line-height: 1.5; word-break: keep-all; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- GNB ---------- */
.gnb { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; height: var(--gnb-h); padding: 0 20px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--gray-200); backdrop-filter: blur(10px); }
.gnb-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -.02em; text-decoration: none; color: var(--gray-950); }
.gnb-brand .mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--navy-900); border-radius: 10px; }
.gnb-brand small { display: block; color: var(--gray-500); font-size: 11px; font-weight: 600; letter-spacing: 0; }
.gnb-util { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--gray-700); }
.gnb-user { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: transparent; border: 1px solid var(--gray-200); border-radius: 999px; cursor: pointer; }
.gnb-user .avatar { display: grid; place-items: center; width: 24px; height: 24px; color: #fff; background: var(--navy-800); border-radius: 50%; font-size: 11px; font-weight: 700; }
.gnb-user .role { color: var(--gray-500); font-size: 12px; }
.gnb-logout { color: var(--gray-700); font-size: 12px; text-decoration: none; }
.gnb-logout:hover { color: var(--blue-700); }

/* ---------- Layout ---------- */
.app-body { display: grid; grid-template-columns: var(--lnb-w) minmax(0, 1fr); min-height: calc(100vh - var(--gnb-h)); }
.lnb { position: sticky; top: var(--gnb-h); align-self: start; height: calc(100vh - var(--gnb-h)); overflow-y: auto; padding: 14px 12px 24px; background: #fff; border-right: 1px solid var(--gray-200); }
.lnb-group + .lnb-group { margin-top: 2px; }
.lnb-l1 { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 9px 10px; color: var(--gray-950); background: transparent; border: 0; border-radius: 10px; font-size: 14.5px; font-weight: 600; text-align: left; cursor: pointer; }
.lnb-l1:hover { background: var(--gray-100); }
.lnb-l1::after { content: ""; width: 7px; height: 7px; border-right: 1.6px solid var(--gray-400); border-bottom: 1.6px solid var(--gray-400); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.lnb-group.open > .lnb-l1::after { transform: rotate(-135deg) translateY(-1px); }
.lnb-group.active > .lnb-l1 { color: var(--blue-700); background: var(--blue-050); font-weight: 700; }
.lnb-sub { display: none; margin: 4px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--gray-200); }
.lnb-group.open > .lnb-sub { display: block; }
.lnb-l2 { display: block; padding: 6px 8px 3px; color: var(--gray-500); font-size: 12px; font-weight: 700; }
.lnb-link { display: block; padding: 6px 8px; color: var(--gray-600); border-radius: 7px; font-size: 13px; text-decoration: none; }
.lnb-link:hover { color: var(--gray-950); background: var(--gray-100); }
.lnb-link.current { color: var(--blue-700); background: var(--blue-050); font-weight: 700; }
.lnb-sub .lnb-sub2 { margin-bottom: 4px; }

.content { min-width: 0; padding: 22px 32px 48px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; padding: 0; list-style: none; color: var(--gray-500); font-size: 12px; }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--gray-400); }
.breadcrumb li:last-child { color: var(--gray-700); font-weight: 600; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-title { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.03em; }
.page-desc { margin: 4px 0 0; color: var(--gray-500); font-size: 12px; }
.page-card { padding: 22px 24px 26px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-panel); box-shadow: var(--shadow-card); }
.site-footer { padding: 14px 32px; color: var(--gray-400); border-top: 1px solid var(--gray-200); font-size: 11px; background: #fff; }

/* ---------- Flow helpers ---------- */
.stack > * + * { margin-top: 14px; }
.stack > .section-title { margin-top: 26px; }
.stack > .section-title:first-child { margin-top: 0; }
.stack > .section-title + * { margin-top: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row .grow { flex: 1 1 auto; }
.cols { display: grid; gap: 14px; align-items: stretch; }
.cols > * { min-width: 0; }
.btn-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-bar.end { justify-content: flex-end; }
.btn-bar.center { justify-content: center; }
.btn-bar.between { justify-content: space-between; }
.btn-bar .spacer { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px !important; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.form-actions.center { justify-content: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 16px; color: var(--gray-700); background: #fff; border: 1px solid var(--gray-300); border-radius: var(--radius-button); font-weight: 700; font-size: 13.5px; white-space: nowrap; cursor: pointer; text-decoration: none; transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.btn:hover { transform: translateY(-1px); background: var(--gray-050); border-color: var(--gray-400); }
.btn:focus-visible, .field:focus-visible, .lnb-link:focus-visible, .lnb-l1:focus-visible { outline: 3px solid rgba(37,99,235,.22); outline-offset: 1px; }
.btn-navy { color: #fff; background: var(--navy-900); border-color: var(--navy-900); }
.btn-navy:hover { background: var(--navy-800); border-color: var(--navy-800); }
.btn-red { color: #fff; background: var(--red-500); border-color: var(--red-500); }
.btn-red:hover { background: var(--red-600); border-color: var(--red-600); }
.btn-green { color: #fff; background: var(--green-600); border-color: var(--green-600); }
.btn-green:hover { background: var(--green-700); border-color: var(--green-700); }
.btn-gray { color: #fff; background: var(--gray-500); border-color: var(--gray-500); }
.btn-soft { color: var(--gray-700); background: #fff; border-color: var(--gray-300); }
.btn-danger { color: var(--red-ink); background: #fff; border-color: #fecaca; }
.btn-danger:hover { background: var(--red-050); border-color: var(--red-500); }
.btn-link { min-height: 0; padding: 0 2px; color: #0969da; background: transparent; border: 0; }
.btn-sm { min-height: 30px; padding: 0 12px; border-radius: 7px; font-size: 12.5px; }
.btn-xs { min-height: 26px; padding: 0 9px; border-radius: 6px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .ico { width: 14px; height: 14px; }

/* ---------- Fields ---------- */
.field { width: 100%; min-width: 0; height: 36px; padding: 0 10px; color: var(--gray-950); background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-field); font-size: 13.5px; }
.field:hover { border-color: var(--gray-300); }
.field:focus { border-color: var(--blue-600); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.field::placeholder { color: var(--gray-400); }
.field[readonly], .field:disabled { color: var(--gray-600); background: var(--gray-050); }
select.field { appearance: none; padding-right: 30px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center; }
textarea.field { height: auto; min-height: 84px; padding: 9px 10px; line-height: 1.55; resize: vertical; }
.field-date { position: relative; display: flex; align-items: center; width: 100%; }
.field-date .field { padding-right: 34px; }
.field-date::after { content: ""; position: absolute; right: 10px; width: 16px; height: 16px; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%236b7280' stroke-width='1.8'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") no-repeat center; }
.field-range { display: flex; align-items: center; gap: 6px; width: 100%; }
.field-range > .tilde { color: var(--gray-400); }
.field-with-btn { display: flex; gap: 6px; width: 100%; align-items: center; }
.field-with-btn > .field, .field-with-btn > .field-date { flex: 1; }
.field-static { display: flex; align-items: center; min-height: 36px; padding: 0 2px; color: var(--gray-700); }
.req { color: var(--red-600); margin-left: 2px; font-weight: 700; }
.check, .radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.check input, .radio input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy-900); }
.radio-group { display: inline-flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; min-height: 36px; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 38px; height: 22px; background: var(--gray-300); border-radius: 999px; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--navy-900); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(37,99,235,.22); outline-offset: 2px; }
.switch .txt { font-size: 13px; color: var(--gray-700); }
.seg { display: inline-flex; padding: 3px; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 9px; }
.seg button { min-width: 40px; min-height: 28px; padding: 0 12px; color: var(--gray-600); background: transparent; border: 0; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { color: var(--navy-900); background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.12); font-weight: 800; }
.file-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-name { display: inline-flex; align-items: center; gap: 6px; color: #0969da; font-weight: 600; text-decoration: none; }
.file-name::before { content: ""; width: 14px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230969da' stroke-width='2'%3E%3Cpath d='M21.4 11.1l-9.2 9.2a6 6 0 01-8.5-8.5l9.2-9.2a4 4 0 015.7 5.7l-9.2 9.2a2 2 0 01-2.8-2.8l8.5-8.5'/%3E%3C/svg%3E") no-repeat center/contain; }

/* ---------- Search panel ---------- */
.search-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; padding: 14px 16px; background: var(--gray-050); border: 1px solid var(--gray-200); border-radius: var(--radius-card); }
.search-item { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-width: 0; }
.search-item > label, .search-item > .lbl { flex: 0 0 auto; color: var(--gray-950); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.search-item .field { width: var(--fw, 160px); }
.search-item .field-date, .search-item .field-range { width: var(--fw, 220px); }
.search-item .field-date .field { width: 100%; }
.search-actions { display: flex; gap: 8px; margin-left: auto; }
.search-panel .note { color: var(--gray-500); font-size: 12px; }

/* ---------- Toolbar / total ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; }
.total { margin: 0; color: var(--gray-700); font-size: 13.5px; font-weight: 700; }
.total b { color: var(--blue-700); }
.sub-title { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.text { margin: 0; color: var(--gray-700); }
.text.muted { color: var(--gray-500); font-size: 12px; }
.text.notice { padding: 9px 12px; color: var(--gray-600); background: var(--gray-050); border: 1px dashed var(--gray-300); border-radius: var(--radius-field); font-size: 12.5px; }

/* ---------- Section title ---------- */
.section-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.section-title::before { content: ""; width: 4px; height: 16px; background: var(--navy-900); border-radius: 2px; }

/* ---------- Data table ---------- */
.table-wrap { overflow-x: auto; border-top: 2px solid var(--navy-900); }
.table-wrap.scroll-y { max-height: 420px; overflow-y: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 12.5px; }
.data-table caption { padding: 0 0 8px; text-align: left; font-weight: 700; color: var(--gray-700); }
.data-table th, .data-table td { padding: 10px 9px; border-bottom: 1px solid var(--gray-200); text-align: center; vertical-align: middle; }
.data-table thead th { position: sticky; top: 0; z-index: 1; background: var(--th-bg); color: var(--gray-950); font-weight: 700; white-space: nowrap; }
.data-table thead tr + tr th { top: 38px; }
.data-table thead th + th { border-left: 1px solid #f0f1f3; }
.data-table tbody tr:hover { background: var(--gray-050); }
.data-table tbody tr.is-selected { background: var(--blue-050); }
.data-table td.left, .data-table th.left { text-align: left; }
.data-table td.right { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.num { font-variant-numeric: tabular-nums; }
.data-table td.mono { font-family: var(--mono); font-size: 12px; }
.data-table .chk { width: 40px; }
.data-table td.wrap { white-space: normal; min-width: 160px; }
.data-table td.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table a.link { color: #0969da; font-weight: 600; text-decoration: none; }
.data-table a.link:hover { text-decoration: underline; }
.data-table.compact th, .data-table.compact td { padding: 7px 8px; }
.data-table.matrix td { padding: 6px; }
.data-table.matrix td.left { padding-left: 10px; }
.empty { padding: 32px 0; color: var(--gray-500); text-align: center; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 0 9px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-blue { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.badge-green { color: #166534; background: #f0fdf4; border-color: #86efac; }
.badge-amber { color: #92400e; background: #fffbeb; border-color: #fcd34d; }
.badge-gray { color: #374151; background: #f3f4f6; border-color: #d1d5db; }
.badge-red { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.badge-navy { color: #fff; background: var(--navy-900); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); vertical-align: middle; }
.dot.green { background: var(--green-600); } .dot.red { background: var(--red-500); } .dot.amber { background: var(--amber-500); } .dot.blue { background: var(--blue-600); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding-top: 4px; }
.page-btn { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; color: var(--gray-700); background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.page-btn:hover { background: var(--gray-050); }
.page-btn[aria-current="page"] { color: #3730a3; background: var(--blue-050); border-color: #6366f1; font-weight: 800; }

/* ---------- Key-value table (상세 / 등록) ---------- */
.kv { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; border-top: 2px solid var(--navy-900); }
.kv th, .kv td { padding: 8px 12px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; text-align: left; }
.kv th { color: var(--gray-950); background: var(--label-bg); font-weight: 700; font-size: 12.5px; }
.kv td { background: #fff; color: var(--gray-950); }
.kv td + th { border-left: 1px solid var(--gray-200); }
.kv th + td { border-left: 1px solid var(--gray-200); }
.kv.is-form td { padding: 6px 10px; }
.kv .val-pre { white-space: pre-wrap; line-height: 1.6; color: var(--gray-700); }
.kv .val-box { max-height: 220px; overflow: auto; white-space: pre-wrap; line-height: 1.6; color: var(--gray-700); }
.kv .val-code { font-family: var(--mono); font-size: 12px; color: var(--gray-700); white-space: pre-wrap; word-break: break-all; }

/* ---------- Inline fields row (labels outside grid) ---------- */
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.field-row .search-item .field { width: var(--fw, 180px); }

/* ---------- KPI ---------- */
.kpi { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 92px; padding: 16px 18px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-panel); }
.kpi .kpi-label { color: var(--gray-500); font-size: 12.5px; font-weight: 600; }
.kpi .kpi-value { margin-top: 6px; color: var(--gray-950); font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .kpi-value small { margin-left: 2px; color: var(--gray-500); font-size: 14px; font-weight: 700; }
.kpi.is-hl { border-color: var(--navy-900); box-shadow: inset 0 0 0 1px var(--navy-900); }
.kpi.tone-green { border-color: #86efac; } .kpi.tone-red { border-color: #fecaca; background: var(--red-050); } .kpi.tone-amber { border-color: #fcd34d; background: var(--amber-050); }

/* ---------- Panel ---------- */
.panel { position: relative; padding: 16px 18px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-panel); }
.panel.flat { padding: 0; border: 0; background: transparent; }
.panel.tint { background: var(--gray-050); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; font-size: 14.5px; font-weight: 800; letter-spacing: -.02em; }
.panel > .stack > * + * { margin-top: 10px; }
.list-plain { margin: 0; padding: 0; list-style: none; }
.list-plain li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; color: var(--gray-700); font-size: 13px; cursor: pointer; }
.list-plain li:hover { background: var(--gray-100); }
.list-plain li.current { color: var(--blue-700); background: var(--blue-050); font-weight: 700; }

/* ---------- Chart canvas (그래픽 영역) ---------- */
.chart-panel { position: relative; padding: 14px 16px 12px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-panel); }
.chart-panel .panel-title { margin-bottom: 6px; }
.canvas { position: relative; width: 100%; container-type: inline-size; }
.canvas > * { position: absolute; }
.canvas .c-text { display: flex; align-items: center; overflow: visible; line-height: 1.15; white-space: pre; color: var(--gray-700); }
.canvas .c-text.al-c { justify-content: center; text-align: center; }
.canvas .c-text.al-r { justify-content: flex-end; text-align: right; }
.canvas .c-rect { border-radius: 3px; }
.canvas .c-box { border: 1px solid var(--gray-200); border-radius: 8px; background: #fff; }
.canvas .c-dot { border-radius: 50%; }
.canvas svg { overflow: visible; }
.canvas .c-btn { display: grid; place-items: center; border: 1px solid var(--gray-300); border-radius: 6px; background: #fff; color: var(--gray-700); font-weight: 700; white-space: nowrap; }
.canvas .c-btn.primary { color: #fff; background: var(--navy-900); border-color: var(--navy-900); }
.canvas .c-table { overflow: auto; }
.canvas .c-table table { width: 100%; border-collapse: collapse; }
.canvas .c-table th, .canvas .c-table td { padding: .3em .4em; border-bottom: 1px solid var(--gray-200); text-align: center; white-space: nowrap; }
.canvas .c-table th { background: var(--th-bg); }
.placeholder { display: grid; place-items: center; min-height: 140px; color: var(--gray-400); background: repeating-linear-gradient(-45deg, var(--gray-050), var(--gray-050) 10px, #fff 10px, #fff 20px); border: 1px dashed var(--gray-300); border-radius: var(--radius-card); font-size: 12px; }

/* ---------- Modal ---------- */
.modal-stage { display: grid; place-items: center; min-height: 100vh; padding: 40px 20px; background: rgba(15, 23, 42, .48); }
.dialog { width: min(var(--dw, 640px), 100%); overflow: hidden; background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; box-shadow: var(--shadow-modal); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--gray-200); }
.dialog-head h1, .dialog-head h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.x-btn { display: grid; place-items: center; width: 32px; height: 32px; color: var(--gray-500); background: transparent; border: 0; border-radius: 8px; cursor: pointer; font-size: 16px; }
.x-btn:hover { color: var(--gray-950); background: var(--gray-100); }
.dialog-body { padding: 18px; max-height: calc(100vh - 220px); overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; background: #fafafa; border-top: 1px solid var(--gray-200); }
.dialog-foot.center { justify-content: center; }
.dialog-foot .left { margin-right: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- Login ---------- */
.login-stage { display: grid; place-items: center; min-height: 100vh; padding: 32px 16px; background: radial-gradient(circle at 85% 12%, rgba(61,191,76,.18), transparent 28%), linear-gradient(135deg, #0b2540 0%, #173b60 62%, #205a77 100%); }
.login-card { width: min(420px, 100%); padding: 36px 34px 28px; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(5, 18, 33, .35); }
.login-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: 26px; text-align: center; }
.login-brand .mark { display: grid; place-items: center; width: 52px; height: 52px; background: var(--navy-900); border-radius: 14px; }
.login-brand h1 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.login-brand p { margin: 0; color: var(--gray-500); font-size: 12.5px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 700; }
.login-form .field { height: 44px; }
.login-form .btn { width: 100%; min-height: 46px; margin-top: 6px; font-size: 15px; }
.login-help { margin: 14px 0 0; color: var(--gray-500); font-size: 12px; text-align: center; }
.login-notice { display: flex; align-items: center; gap: 10px; width: min(420px, 100%); margin-top: 16px; padding: 10px 14px; overflow: hidden; color: #d9e4ef; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); border-radius: 10px; font-size: 12.5px; }
.login-notice .tag { flex: 0 0 auto; padding: 2px 8px; color: var(--navy-900); background: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; }
.login-notice .roll { position: relative; flex: 1; height: 20px; overflow: hidden; }
.login-notice .roll ul { margin: 0; padding: 0; list-style: none; animation: roll 15s infinite; }
.login-notice .roll li { height: 20px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes roll { 0%,16% { transform: translateY(0); } 20%,36% { transform: translateY(-20px); } 40%,56% { transform: translateY(-40px); } 60%,76% { transform: translateY(-60px); } 80%,96% { transform: translateY(-80px); } 100% { transform: translateY(0); } }

/* ---------- Spec markers (기능 번호) ---------- */
.mk-host { position: relative; }
.mk { position: absolute; top: -9px; left: -9px; z-index: 5; display: none; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; color: #fff; background: #d6336c; border: 2px solid #fff; border-radius: 999px; box-shadow: 0 2px 6px rgba(214,51,108,.35); font: 800 11px/1 var(--font); font-style: normal; pointer-events: auto; cursor: help; }
.mk + .mk { left: 14px; } .mk + .mk + .mk { left: 37px; }
body.show-mk .mk { display: grid; }
body.show-mk .mk-host.mk-focus { outline: 2px dashed #d6336c; outline-offset: 3px; border-radius: 6px; }
th.mk-host .mk, td.mk-host .mk { top: 2px; left: 2px; }

/* ---------- Spec drawer (퍼블리싱 가이드 UI) ---------- */
.spec-fab { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; gap: 8px; }
.spec-fab button, .spec-fab a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; color: #fff; background: var(--navy-900); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; box-shadow: 0 8px 24px rgba(11,37,64,.3); font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; }
.spec-fab .ghost { color: var(--navy-900); background: #fff; border-color: var(--gray-300); }
.spec-fab [aria-pressed="true"] { background: #d6336c; }
.spec-drawer { position: fixed; top: 0; right: 0; z-index: 100; display: flex; flex-direction: column; width: min(420px, 100%); height: 100vh; color: var(--gray-950); background: #fff; border-left: 1px solid var(--gray-200); box-shadow: -18px 0 48px rgba(15,23,42,.16); transform: translateX(102%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
.spec-drawer.open { transform: none; visibility: visible; transition: transform .2s ease; }
.spec-drawer header { padding: 18px 20px 14px; color: #fff; background: var(--navy-900); }
.spec-drawer header .eyebrow { color: #bcd2e8; font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.spec-drawer header h2 { margin: 4px 0 2px; font-size: 18px; letter-spacing: -.02em; }
.spec-drawer header p { margin: 0; color: #c9d7e5; font-size: 12px; }
.spec-drawer .spec-close { position: absolute; top: 12px; right: 12px; color: #fff; }
.spec-drawer .spec-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.spec-body { flex: 1; overflow: auto; padding: 16px 20px 24px; }
.spec-body h3 { margin: 18px 0 8px; font-size: 13px; color: var(--gray-500); letter-spacing: .02em; }
.spec-body h3:first-child { margin-top: 0; }
.spec-meta { display: grid; grid-template-columns: 92px 1fr; gap: 6px 10px; margin: 0; font-size: 12.5px; }
.spec-meta dt { color: var(--gray-500); font-weight: 700; }
.spec-meta dd { margin: 0; word-break: break-all; }
.spec-funcs { margin: 0; padding: 0; list-style: none; }
.spec-funcs li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 8px 6px; border-bottom: 1px solid var(--gray-100); font-size: 12.5px; border-radius: 6px; cursor: pointer; }
.spec-funcs li:hover { background: #fdf2f7; }
.spec-funcs .n { display: grid; place-items: center; width: 22px; height: 22px; color: #fff; background: #d6336c; border-radius: 50%; font-size: 11px; font-weight: 800; }
.spec-rules { margin: 0; padding-left: 18px; color: var(--gray-700); font-size: 12.5px; }
.spec-rules li + li { margin-top: 5px; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.spec-chips span { padding: 2px 8px; color: var(--gray-700); background: var(--gray-100); border-radius: 999px; font-size: 11.5px; font-family: var(--mono); }
.spec-tables { color: var(--gray-600); font: 11.5px/1.7 var(--mono); word-break: break-all; }
.spec-nav { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--gray-200); }
.spec-nav a { flex: 1; min-height: 36px; font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  :root { --lnb-w: 200px; }
  .content { padding: 18px 20px 40px; }
  .cols.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 860px) {
  .app-body { grid-template-columns: 1fr; }
  .lnb { display: none; }
  .gnb-brand small, .gnb-user .role { display: none; }
  .cols { grid-template-columns: 1fr !important; }
  .content { padding: 16px 16px 72px; }
  .page-card { padding: 16px; }
  .search-item { flex: 1 1 100%; }
  .search-item .field, .search-item .field-date, .search-item .field-range { width: 100% !important; flex: 1; }
  .search-actions { width: 100%; justify-content: flex-end; }
  .kv, .kv tbody, .kv tr { display: block; width: 100%; }
  .kv colgroup { display: none; }
  .kv tr { display: grid; grid-template-columns: 110px 1fr; }
  .kv th, .kv td { border-left: 0 !important; }
  .kv td[colspan] { grid-column: auto; }
  .chart-panel .canvas { overflow-x: auto; }
}
@media print {
  .gnb, .lnb, .spec-fab, .spec-drawer { display: none !important; }
  .app-body { display: block; }
  body { background: #fff; }
}
