/* 뼈대·판·표·꼬리표·필라멘트 계기·출처줄·차트·반응형 — 색은 tokens.css 변수만 쓴다 */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--filament); outline-offset: 2px; border-radius: 4px; }

/* ── 뼈대 ─────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--surface); border-right: 1px solid var(--line); min-width: 0; }
.nav-inner {
  position: sticky; top: 0; max-height: 100vh; overflow-y: auto;
  padding: var(--sp-5) var(--sp-3) var(--sp-6);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
/* 머리 띠: 흰 바탕 + 컬러 로고(CI 원본, 둘레 여백만 잘라 씀) — 로고는 그림으로 보고 가운데 정렬 */
.brand {
  display: block; text-decoration: none; background: var(--surface); color: var(--muted);
  margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-3)) 0; padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--line); text-align: center;
}
.brand:focus-visible { outline: 2px solid var(--filament); outline-offset: -4px; border-radius: 0; }
.brand-logo { display: block; height: 30px; width: auto; max-width: 100%; margin: 0 auto; }
.brand-sub { font-size: var(--fs-12); color: var(--muted); margin-top: 8px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { font-size: var(--fs-12); color: var(--muted); padding: 0 var(--sp-2) 2px; font-weight: 500; }
.nav-link {
  display: block; padding: 7px var(--sp-2) 7px var(--sp-3); border-radius: var(--r-btn);
  text-decoration: none; color: var(--ink-2); font-weight: 500; position: relative;
}
.nav-link:hover { background: var(--paper); color: var(--ink); }
.nav-link.active { background: var(--filament-soft); color: var(--filament-ink); font-weight: 600; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--filament); }

/* 전체 메뉴(기존 YjelEIS 메뉴 그대로, 접이식) — 길잡이보다 한 단계 작게 13px · 준비중은 붉은 점 */
.lm { border-top: 1px solid var(--line); padding-top: var(--sp-3); display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-13); }
.lm button { background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.lm-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2);
  padding: 4px var(--sp-2) 6px; font-size: var(--fs-14); font-weight: 600; color: var(--ink); border-radius: var(--r-btn);
}
.lm-title .lm-ind { font-size: var(--fs-12); font-weight: 400; color: var(--muted); }
.lm-title:hover .lm-ind { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.lm-head {
  display: flex; align-items: center; gap: 6px; padding: 6px var(--sp-2); border-radius: var(--r-btn);
  font-size: var(--fs-13); font-weight: 600; color: var(--ink); min-height: 32px;
}
.lm-head:hover { background: var(--paper); }
.lm-head .lm-ind { width: 10px; flex: 0 0 auto; color: var(--muted); font-size: var(--fs-12); }
.lm-count { margin-left: auto; font-size: var(--fs-12); font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.lm-list { list-style: none; margin: 0 0 4px; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 1px; }
.lm-list[hidden] { display: none; }
.lm-link {
  display: flex; align-items: center; gap: 6px; padding: 5px var(--sp-2); border-radius: var(--r-btn);
  text-decoration: none; color: var(--ink-2); line-height: 1.4; position: relative;
}
.lm-link:hover { background: var(--paper); color: var(--ink); }
.lm-link.active { background: var(--filament-soft); color: var(--filament-ink); font-weight: 600; }
.lm-link.active::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--filament); }
.lm-name { min-width: 0; }
.lm-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--up); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: var(--sp-4); min-height: var(--top-h); padding: var(--sp-2) var(--sp-6); max-width: calc(var(--content-max) + 48px); }
.top-title { font-size: var(--fs-20); font-weight: 700; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-date { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-13); color: var(--muted); flex: 0 0 auto; }
.top-date input {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-btn);
  padding: 5px 8px; font-variant-numeric: tabular-nums; color: var(--ink); min-height: 34px;
}
.demo-band {
  font-size: var(--fs-12); color: var(--warn-ink); background: var(--warn-bg);
  padding: 5px var(--sp-6); border-top: 1px solid var(--line);
}
.subnav { display: none; }
.content { padding: var(--sp-6); max-width: calc(var(--content-max) + 48px); width: 100%; }
.screen { display: flex; flex-direction: column; gap: var(--sp-5); }
.screen-error {
  border: 1px solid var(--warn-ink); background: var(--warn-bg); color: var(--warn-ink);
  border-radius: var(--r-panel); padding: var(--sp-4) var(--sp-5); font-weight: 500;
}
.tabbar { display: none; }

/* 판 배치 도움 */
.grid { display: grid; gap: var(--sp-5); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ── 판(panel) ─────────────────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  display: flex; flex-direction: column; min-width: 0; position: relative;
}
.panel-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) 0; flex-wrap: wrap; }
.panel-titles { flex: 1 1 240px; min-width: 0; }
.panel-title { font-size: var(--fs-16); font-weight: 600; line-height: 1.4; }
.panel-note { font-size: var(--fs-13); color: var(--muted); margin-top: 2px; }
.panel-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.panel-body { padding: var(--sp-4) var(--sp-5); flex: 1 1 auto; min-width: 0; }
.panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  border-top: 1px solid var(--line); padding: 7px var(--sp-5) 8px; font-size: var(--fs-12); color: var(--muted);
  flex-wrap: wrap;
}
.src-line {
  background: none; border: 0; padding: 2px 0; cursor: pointer; text-align: left; color: var(--muted);
  font-size: var(--fs-12); min-width: 0; text-decoration: underline dotted var(--line-strong); text-underline-offset: 3px;
}
.src-line:hover { color: var(--ink); }
.src-line b { font-weight: 500; color: var(--ink-2); }
.src-legacy { white-space: nowrap; }
.src-pop {
  position: absolute; left: var(--sp-4); right: var(--sp-4); bottom: calc(100% - 4px); z-index: 30;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-panel);
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-13); color: var(--ink); max-width: 520px;
  box-shadow: 0 8px 24px var(--shadow);
}
.panel-foot { position: relative; }
.src-pop h4 { font-size: var(--fs-13); font-weight: 600; margin-bottom: 4px; }
.src-pop ul { margin: 0 0 6px; padding-left: 18px; }
.src-pop p { color: var(--ink-2); }
.src-pop .src-close { position: absolute; right: 6px; top: 4px; border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--muted); padding: 2px 6px; }

/* ── 숫자 카드(kpi) ────────────────────────────────── */
.kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; text-decoration: none; color: inherit; }
a.kpi { border-radius: var(--r-btn); }
a.kpi:hover .kpi-value { text-decoration: underline; text-decoration-color: var(--filament); text-underline-offset: 4px; }
.kpi-label { font-size: var(--fs-13); color: var(--muted); font-weight: 500; }
.kpi-main { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.kpi-value { font-size: var(--fs-28); font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi.lg .kpi-value { font-size: var(--fs-40); }
.unit { font-size: var(--fs-12); color: var(--muted); font-weight: 400; }
.kpi-delta { font-size: var(--fs-13); color: var(--muted); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }

/* ── 증감·꼬리표·칩·묶음단추 ───────────────────────── */
.delta { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.zero { color: var(--muted); }
.tag-warn {
  display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); font-weight: 600;
  color: var(--warn-ink); background: var(--warn-bg); border-radius: var(--r-tag); padding: 2px 9px; white-space: nowrap;
}
.tag-warn::before { content: '!'; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--warn-ink); color: var(--warn-bg); font-size: 10px; font-weight: 700; }
.tag { display: inline-flex; font-size: var(--fs-12); color: var(--ink-2); background: var(--paper); border-radius: var(--r-tag); padding: 2px 9px; white-space: nowrap; }
/* VAT 기준 꼬리표 — 작은 회색, 강조색 아님(총괄 결정 D4) */
.tag.tag-vat { font-size: 11px; font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 0 6px; line-height: 16px; vertical-align: 1px; margin-left: 6px; }
.panel-title .tag-vat { position: relative; top: -1px; }
/* 거르기 칸(고르기·날짜·찾기) — 화면 공용 */
.flt { min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); font: inherit; font-size: var(--fs-13); color: var(--ink); max-width: 100%; }
.flt:focus-visible { outline: 2px solid var(--filament); outline-offset: 1px; }
.flt-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--muted); }
@media (max-width: 767px) { .tag.tag-vat { font-size: 12px; } }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-tag);
  padding: 4px 12px; font-size: var(--fs-13); cursor: pointer; color: var(--ink-2); min-height: 30px;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active { border-color: var(--filament); background: var(--filament-soft); color: var(--ink); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--paper); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; border-radius: 4px; padding: 4px 12px; font-size: var(--fs-13); cursor: pointer; color: var(--ink-2); min-height: 28px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--filament); }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-btn);
  padding: 5px 12px; font-size: var(--fs-13); cursor: pointer; color: var(--ink); min-height: 32px; text-decoration: none; display: inline-flex; align-items: center;
}
.btn:hover { border-color: var(--line-strong); }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; font-size: var(--fs-13); text-decoration: underline; text-decoration-color: var(--filament); text-underline-offset: 3px; }
.empty { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--muted); font-size: var(--fs-13); }

/* ── 필라멘트 계기 ─────────────────────────────────── */
.fil { display: flex; flex-direction: column; gap: 4px; min-width: 0; --fil-h: 3px; --fil-dot: 9px; }
.fil.sm { --fil-h: 2px; --fil-dot: 7px; }
.fil.lg { --fil-h: 4px; --fil-dot: 11px; }
.fil-head { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-12); color: var(--muted); }
.fil-head .fil-pct { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.fil.lg .fil-head { font-size: var(--fs-13); }
.fil-track { position: relative; height: 14px; }
.fil-track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--fil-h); transform: translateY(-50%); background: var(--line); border-radius: 2px; }
.fil-fill {
  position: absolute; left: 0; top: 50%; height: var(--fil-h); transform: translateY(-50%);
  width: var(--fil-w); background: var(--filament); border-radius: 2px;
}
.fil-dot {
  position: absolute; top: 50%; left: var(--fil-w); width: var(--fil-dot); height: var(--fil-dot);
  transform: translate(-50%, -50%); border-radius: 50%; background: var(--filament);
  box-shadow: 0 0 0 2px var(--surface), 0 0 8px 2px var(--filament-glow);
}
.fil-tick { position: absolute; left: var(--fil-t); top: 1px; bottom: 1px; width: 1px; background: var(--c-target); opacity: 0.85; }
.fil.zero .fil-dot { background: var(--line-strong); box-shadow: 0 0 0 2px var(--surface); }
/* 한 번만 차오르기: 컨테이너에 .fil-anim 을 붙이고, 다음 틀에 .fil-go 를 붙인다(ui.filament.animateOnce) */
.fil-anim .fil-fill { width: 0; }
.fil-anim .fil-dot { left: 0; }
.fil-anim.fil-go .fil-fill { width: var(--fil-w); transition: width 0.9s cubic-bezier(.2,.7,.2,1); }
.fil-anim.fil-go .fil-dot { left: var(--fil-w); transition: left 0.9s cubic-bezier(.2,.7,.2,1); }

/* ── 표 ────────────────────────────────────────────── */
.tbl-wrap { overflow: auto; max-width: 100%; position: relative; border: 1px solid var(--line); border-radius: 6px; }
.tbl-wrap.bare { border: 0; border-radius: 0; }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-13); }
.tbl th, .tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; background: var(--surface); }
.tbl thead th {
  position: sticky; top: 0; z-index: 2; font-weight: 500; color: var(--muted); font-size: var(--fs-12);
  background: var(--surface); border-bottom: 1px solid var(--line-strong);
}
.tbl thead tr.tbl-groups th { top: 0; text-align: center; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); }
.tbl thead tr.tbl-groups th[rowspan] { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line-strong); vertical-align: bottom; }
.tbl thead tr.tbl-groups th.num[rowspan] { text-align: right; }
.tbl thead tr.tbl-groups + tr th { top: var(--grp-h, 31px); }
.tbl thead th.g-start, .tbl td.g-start { border-left: 1px solid var(--line); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl thead th.num { text-align: right; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th.sortable .sort-ind { display: inline-block; width: 10px; margin-left: 2px; color: var(--filament-ink); font-size: 10px; }
.tbl th.sorted { color: var(--ink); box-shadow: inset 0 -2px 0 var(--filament); }
/* 몸통 줄의 첫 칸은 th(줄 머리)다 — 줄 단위 바탕·굵기는 td 만이 아니라 줄의 모든 칸(> *)에 준다 */
.tbl tbody tr:hover > * { background: var(--row-hover); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:focus { outline: none; }
.tbl tbody tr.clickable:focus-visible td, .tbl tbody tr.clickable:focus-visible th { background: var(--filament-soft); box-shadow: inset 0 2px 0 var(--filament), inset 0 -2px 0 var(--filament); }
.tbl tbody tr.clickable:focus-visible > :first-child { box-shadow: inset 2px 2px 0 var(--filament), inset 0 -2px 0 var(--filament); }
.tbl tbody tr.clickable:focus-visible > :last-child { box-shadow: inset -2px 2px 0 var(--filament), inset 0 -2px 0 var(--filament); }
.tbl tbody tr.selected > * { background: var(--filament-soft); }
.tbl tr.subtotal, .tbl tfoot tr { font-weight: 600; }
.tbl tr.subtotal > *, .tbl tfoot td { font-weight: 600; background: var(--paper); }
.tbl tfoot td { position: sticky; bottom: 0; z-index: 1; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl tr.muted-row { color: var(--muted); }
.tbl tr.muted-row td { color: var(--muted); }
.tbl .sticky-col { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--line); }
.tbl thead .sticky-col { z-index: 3; }
.tbl tfoot .sticky-col { z-index: 2; }
.tbl tbody tr:last-child > * { border-bottom: 0; }

/* ── 차트 ──────────────────────────────────────────── */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl-strong { fill: var(--ink); font-weight: 600; }
.chart .grid-line { stroke: var(--c-grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .hover-mark, .chart .hover-on { opacity: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-12); color: var(--ink-2); margin-bottom: 6px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.chart-legend i.ln { height: 2px; width: 14px; border-radius: 1px; }
.chart-legend i.dash { height: 0; width: 14px; border-top: 2px dashed; background: none !important; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 10; background: var(--ink); color: var(--surface);
  font-size: var(--fs-12); padding: 6px 9px; border-radius: 6px; line-height: 1.45; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .08s;
}
.chart-tip.on { opacity: 1; }
.chart-tip b { font-weight: 600; }
.chart-tip .tip-row { display: flex; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.spark { display: inline-block; vertical-align: middle; }
.hbar { display: flex; flex-direction: column; gap: 2px; }
.hbar-row {
  display: grid; grid-template-columns: minmax(96px, 38%) minmax(40px, 1fr) auto; align-items: center; gap: var(--sp-3);
  padding: 5px 0; border: 0; background: none; text-align: left; width: 100%; font-size: var(--fs-13); color: var(--ink);
}
button.hbar-row { cursor: pointer; border-radius: 4px; font: inherit; }
button.hbar-row:hover .hbar-name { text-decoration: underline; text-decoration-color: var(--filament); text-underline-offset: 3px; }
.hbar-label { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.hbar-sub { font-size: var(--fs-12); color: var(--muted); }
.hbar-track { height: 8px; background: var(--paper); border-radius: 2px; position: relative; overflow: hidden; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 2px 2px 0; }
.hbar-val { text-align: right; white-space: nowrap; font-weight: 500; }
@media (max-width: 767px) { .hbar-row { grid-template-columns: minmax(0, 1fr) auto; } .hbar-track { grid-column: 1 / -1; grid-row: 2; } }
.spark svg { display: block; }

/* ── 오른쪽 상세(sidePanel) ────────────────────────── */
.side-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 60; display: flex; justify-content: flex-end; }
.side {
  background: var(--surface); width: min(480px, 92vw); height: 100%; overflow-y: auto;
  border-left: 1px solid var(--line); display: flex; flex-direction: column;
  animation: side-in .18s ease-out;
}
.side-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.side-title { font-size: var(--fs-16); font-weight: 600; flex: 1; }
.side-sub { font-size: var(--fs-13); color: var(--muted); }
.side-close { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-btn); width: 32px; height: 32px; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-2); flex: 0 0 auto; }
.side-body { padding: var(--sp-4) var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
@keyframes side-in { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes sheet-in { from { transform: translateY(32px); opacity: 0.4; } to { transform: none; opacity: 1; } }

/* ── 반응형 ────────────────────────────────────────── */
@media (max-width: 1279px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  :root { --nav-w: 176px; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: var(--sp-5); }
  .top-row { padding: var(--sp-2) var(--sp-5); }
  .demo-band { padding: 5px var(--sp-5); }
}
@media (max-width: 767px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { display: none; }
  .top-row { padding: 6px var(--sp-4); min-height: 50px; gap: var(--sp-2); }
  .top-title { font-size: var(--fs-16); }
  .top-date .lbl { display: none; }
  .top-date input { padding: 4px 6px; min-height: 32px; font-size: var(--fs-13); }
  .demo-band { padding: 4px var(--sp-4); }
  .subnav { display: flex; gap: 6px; overflow-x: auto; padding: 6px var(--sp-4) 8px; border-top: 1px solid var(--line); }
  .subnav:empty { display: none; }
  .subnav a { flex: 0 0 auto; text-decoration: none; font-size: var(--fs-13); padding: 4px 12px; border-radius: var(--r-tag); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
  .subnav a.active { border-color: var(--filament); background: var(--filament-soft); color: var(--ink); font-weight: 600; }
  .content { padding: var(--sp-4) var(--sp-3) calc(var(--tab-h) + var(--sp-6)); }
  .screen { gap: var(--sp-4); }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: var(--sp-4); }
  .panel-head { padding: var(--sp-3) var(--sp-4) 0; }
  .panel-body { padding: var(--sp-3) var(--sp-4); }
  .panel-foot { padding: 7px var(--sp-4); }
  .kpi-value { font-size: var(--fs-20); }
  .kpi.lg .kpi-value { font-size: var(--fs-28); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: var(--tab-h); background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; font-size: var(--fs-12); color: var(--muted); background: none; border: 0; cursor: pointer; position: relative;
  }
  .tabbar .tab-ico { width: 18px; height: 18px; }
  .tabbar .active { color: var(--filament-ink); font-weight: 600; }
  .tabbar .active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--filament); border-radius: 0 0 2px 2px; }
  .side-overlay { align-items: flex-end; }
  .side { width: 100%; height: auto; max-height: 86vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; animation: sheet-in .2s ease-out; }
  .src-pop { left: var(--sp-2); right: var(--sp-2); }
  .tbl .sticky-col { max-width: 44vw; white-space: normal; }
  .tbl th, .tbl td { padding: 7px 8px; }
}

/* ── 로그인한 사람 · 로그아웃(길잡이 맨 아래 · 더보기 시트 맨 아래) ── */
.nav-user {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  border-top: 1px solid var(--line); padding: var(--sp-3) var(--sp-2) 0; font-size: var(--fs-13);
}
.nav-user-name { color: var(--ink-2); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { flex: 0 0 auto; }

/* ── 로그인 화면(시연용 관문) — 길잡이·윗줄·시연 띠·아래 탭은 숨긴다 ── */
.app.locked { display: block; }
.app.locked > .nav, .app.locked > .main, .app.locked > .tabbar { display: none; }
.login[hidden] { display: none; }
.login {
  min-height: 100vh; background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4);
  padding: var(--sp-8) var(--sp-4);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: var(--sp-8) var(--sp-8) var(--sp-6); display: flex; flex-direction: column; align-items: stretch;
}
.login-logo { display: block; height: 36px; width: auto; max-width: 100%; margin: 0 auto var(--sp-5); }
.login-title { font-size: var(--fs-20); font-weight: 700; text-align: center; line-height: 1.3; }
.login-sub { font-size: var(--fs-13); color: var(--muted); text-align: center; margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-6); }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label { font-size: var(--fs-13); font-weight: 500; color: var(--ink-2); }
.login-field input {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-btn);
  padding: 9px 12px; min-height: 42px; font-size: var(--fs-14); color: var(--ink); width: 100%;
}
.login-field input:focus-visible { outline: 2px solid var(--filament); outline-offset: 1px; border-color: var(--filament); }
.login-err { font-size: var(--fs-13); color: var(--warn-ink); font-weight: 500; min-height: 20px; margin: -2px 0 0; }
.login-err:empty { min-height: 0; }
.login-btn {
  border: 0; border-radius: var(--r-btn); background: var(--filament); color: var(--on-brand);
  min-height: 44px; font-size: var(--fs-14); font-weight: 600; cursor: pointer; margin-top: var(--sp-1);
}
.login-btn:hover { background: var(--yj-filament); }
.login-btn:disabled { cursor: progress; }
.login-note { font-size: var(--fs-12); color: var(--muted); text-align: center; }
@media (max-width: 767px) {
  .login { justify-content: flex-start; padding: 12vh var(--sp-4) var(--sp-6); }
  .login-card { padding: var(--sp-6) var(--sp-5) var(--sp-5); }
}

/* 더보기 시트(폰) */
.more-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.more-list .nav-link { padding: 10px var(--sp-3); }
.more-list .lm { font-size: var(--fs-14); }
.more-list .lm-head, .more-list .lm-link { min-height: 40px; }
.more-list .nav-user { padding: var(--sp-4) var(--sp-3) 0; font-size: var(--fs-14); }
.more-list .logout-btn { min-height: 40px; padding: 6px 16px; font-size: var(--fs-14); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .fil-anim .fil-fill { width: var(--fil-w); }
  .fil-anim .fil-dot { left: var(--fil-w); }
}

@media print {
  .nav, .tabbar, .demo-band { display: none; }
  .app { grid-template-columns: 1fr; }
}

/* 차트 작은 글(단위·선 이름) — 폰(390)에서는 차트 글을 모두 12px 로 */
.chart text.ch-small { font-size: 10px; }
@media (max-width: 767px) {
  .chart text, .chart text.ch-small, .chart text.lbl-strong { font-size: 12px; }
  .tbl th.sortable .sort-ind { font-size: 12px; }
}
