/* ============================================================
   세금 레이더 — 디자인 시스템
   원칙:
     1. 종이빛 바탕 위에 흰 카드. 항목마다 경계가 있어야 덩어리가 보인다.
     2. 숫자가 주인공. 라벨은 작고 조용하게.
     3. 상태는 색만으로 말하지 않는다 — 칩·아이콘·문장을 함께 쓴다.
     4. 모든 금액은 눌러서 산출 과정을 열 수 있다.
   데이터 계열색은 scripts/validate_palette.js 통과값 (light/dark 각각 검증).
   ============================================================ */

:root {
  color-scheme: light;
  --ground:      #f2f4f1;
  --card:        #ffffff;
  --card-2:      #e9ece8;
  --sunken:      #f7f9f6;
  --ink:         #1a1f1c;
  --ink-2:       #5a625c;
  --ink-3:       #8b938c;
  --ink-4:       #b3bbb4;
  --hair:        #e0e5df;
  --accent:      #16624a;
  --accent-soft: #d9ebe1;

  --s1: #2a78d6;   /* 사업장 1 / 매출세액 / 국내매입 */
  --s2: #eb6834;   /* 사업장 2 / 매입세액 */
  --s3: #1baf7a;   /* 수입 통관분 */
  --grid:     #e6eae5;
  --baseline: #c8cfc7;

  --good:     #0ca30c;
  --warning:  #fab219;
  --warn-ink: #8a6410;
  --critical: #d03b3b;
  --crit-bg:  #fbeceb;
  --warn-bg:  #fdf4e2;
  --good-bg:  #e6f5e6;

  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", "Segoe UI", Roboto, sans-serif;

  --pad: 18px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --ground:      #101310;
    --card:        #1b1f1d;
    --card-2:      #2b312d;
    --sunken:      #171b19;
    --ink:         #e9ede9;
    --ink-2:       #a3ada5;
    --ink-3:       #868a94;
    --ink-4:       #5d6660;
    --hair:        #2c322e;
    --accent:      #6fcfa0;
    --accent-soft: #1d3830;

    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --grid:     #262b28;
    --baseline: #39403b;

    --warn-ink: #fab219;
    --crit-bg:  #2c1817;
    --warn-bg:  #2a2113;
    --good-bg:  #12261a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #101310; --card: #1b1f1d; --card-2: #2b312d; --sunken: #171b19;
  --ink: #e9ede9; --ink-2: #a3ada5; --ink-3: #868a94; --ink-4: #5d6660;
  --hair: #2c322e; --accent: #6fcfa0; --accent-soft: #1d3830;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --grid: #262b28; --baseline: #39403b;
  --warn-ink: #fab219; --crit-bg: #2c1817; --warn-bg: #2a2113; --good-bg: #12261a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px; line-height: 1.55; letter-spacing: -0.02em;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ---------- 상단 바 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 var(--pad);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--ground);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.03em; }
.dot-mark { width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid var(--accent); position: relative; flex: none; }
.dot-mark::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: var(--accent); }

.icon-btn {
  border: none; background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  letter-spacing: -0.02em; cursor: pointer;
}
.icon-btn:active { background: var(--card-2); }

/* ---------- 레이아웃 ---------- */
main {
  padding: 4px var(--pad) calc(var(--tabbar-h) + var(--safe-b) + 40px);
  max-width: 560px; margin: 0 auto;
}
.sec { margin-top: 30px; }
.sec:first-child { margin-top: 8px; }
.sec-h {
  font-size: 18px; font-weight: 700; letter-spacing: -0.035em;
  margin: 0 0 13px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.sec-h small { font-size: 12.5px; font-weight: 500; color: var(--ink-3); letter-spacing: -0.02em; white-space: nowrap; }
.sec-h .sub { display: block; font-size: 13px; font-weight: 500; color: var(--ink-3); margin-top: 3px; }

.card {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-lg); padding: var(--pad);
}
.card + .card { margin-top: 10px; }
.card.tight { padding: 6px var(--pad); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 히어로 ---------- */
.hero-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.hero-kind { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.hero-dday {
  font-size: 50px; font-weight: 800; letter-spacing: -0.055em; line-height: 1;
  display: flex; align-items: baseline; gap: 7px;
}
.hero-dday i { font-style: normal; font-size: 16px; font-weight: 600; color: var(--ink-3); letter-spacing: -0.02em; }
.hero-when { font-size: 14.5px; color: var(--ink-3); margin-top: 9px; font-weight: 500; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.kpi {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-md); padding: 13px 14px; min-width: 0;
}
.kpi-l { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.kpi-v { font-size: 21px; font-weight: 800; letter-spacing: -0.04em; margin-top: 3px; line-height: 1.15; }
.kpi-d { font-size: 11.5px; font-weight: 600; margin-top: 4px; }
.kpi-d.up { color: var(--critical); }     /* 세금이 늘어난 방향 */
.kpi-d.down { color: var(--good); }
.kpi-d span { color: var(--ink-3); font-weight: 500; }

/* 누를 수 있는 것은 누를 수 있게 생겨야 한다 */
.drill {
  -webkit-appearance: none; appearance: none;
  border: none; font: inherit; color: inherit;
  text-align: left; width: 100%; cursor: pointer;
}
.drill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drill .kpi-v::after,
.drill .row-a::after { content: "›"; color: var(--ink-3); margin-left: 5px; font-weight: 600; }
.drill .kpi-v::after { font-size: 17px; vertical-align: 1px; }
.drill .row-a::after { font-size: 14px; }
.why {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; margin-top: 6px;
}

/* ---------- 사업장 현황 카드 ---------- */
/* 왼쪽 색띠로 어느 사업장인지 먼저 읽히게 한다 (차트 계열색과 같다) */
.bizcard {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-lg); padding: 16px 18px;
  border-left: 3px solid var(--accent-line, var(--hair));
  display: flex; flex-direction: column; gap: 12px;
}
.bizcard-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bizcard .who span { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.spark { width: 84px; height: 26px; flex: none; }

.bizcard-amt {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 12px 0 0; border-top: 1px solid var(--hair);
  background: none;   /* .drill은 UA 기본값만 지우므로 배경은 여기서 정한다 */
}
.bizcard-l { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.bizcard-v {
  font-size: 24px; font-weight: 800; letter-spacing: -0.045em;
  display: flex; align-items: baseline; gap: 3px; white-space: nowrap;
}
.bizcard-v i { font-style: normal; font-size: 17px; color: var(--ink-3); font-weight: 600; }

.bizcard-row { display: flex; gap: 26px; flex-wrap: wrap; }
.bizcard-row > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.bizcard-m { font-size: 17px; font-weight: 800; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.bizcard-m.crit { color: var(--critical); }
.bizcard-m.ok { color: var(--good); }
.bizcard-s { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
.bizcard-save { padding-top: 12px; border-top: 1px solid var(--hair); }
.bizcard-s.up { color: var(--critical); }     /* 세금이 늘어난 방향 */
.bizcard-s.down { color: var(--good); }
.meter-n.late { color: var(--warn-ink); font-weight: 600; }

/* 두 사업장 합산 한 줄 — 세무상 합산이 아니라 자금계획용 */
.sumbar {
  display: flex; gap: 10px; margin-bottom: 10px;
}
.sumbar > div {
  flex: 1; min-width: 0;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-md); padding: 11px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.sumbar span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.sumbar b {
  font-size: 16px; font-weight: 800; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 칩 ---------- */
.chip {
  display: inline-block; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--card-2); color: var(--ink-2);
  white-space: nowrap;
}
.chip.blue { background: #e8f1fd; color: #1c5cab; }
.chip.red { background: var(--crit-bg); color: var(--critical); }
.chip.orange { background: var(--warn-bg); color: var(--warn-ink); }
.chip.green { background: var(--good-bg); color: #0a7a3d; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .chip.blue { background: #16233a; color: #7fb0f5; }
  :root:where(:not([data-theme="light"])) .chip.green { background: var(--good-bg); color: #3fce9f; }
}
:root[data-theme="dark"] .chip.blue { background: #16233a; color: #7fb0f5; }
:root[data-theme="dark"] .chip.green { background: var(--good-bg); color: #3fce9f; }

/* ---------- 일정 행 ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 0; border-bottom: 1px solid var(--hair); min-height: 46px;
}
.row:last-child { border-bottom: none; }
.row-d {
  min-width: 50px; text-align: center; padding: 6px 0; border-radius: var(--r-sm);
  background: var(--card-2); color: var(--ink-2);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
}
.row-d.hot { background: var(--crit-bg); color: var(--critical); }
.row-d.soon { background: var(--warn-bg); color: var(--warn-ink); }
.row-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.row-b { flex: 1; min-width: 0; }
.row-t { font-size: 14.5px; font-weight: 600; letter-spacing: -0.03em; }
.row-s { font-size: 12px; color: var(--ink-3); margin-top: 1px; font-weight: 500; }
.row-a { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-del { border: none; background: none; color: var(--ink-4); font-size: 12.5px; font-weight: 600; padding: 8px; cursor: pointer; font-family: inherit; }

/* ---------- 키-값 ---------- */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; }
.kv-k { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.kv-k .muted { color: var(--ink-4); }
.kv-v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; letter-spacing: -0.03em; }
.kv.big { padding-top: 15px; margin-top: 7px; border-top: 1px solid var(--card-2); }
.kv.big .kv-k { font-size: 15px; font-weight: 700; color: var(--ink); }
.kv.big .kv-v { font-size: 25px; font-weight: 800; letter-spacing: -0.045em; }
.kv-note { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-top: 3px; }
.rule { height: 1px; background: var(--card-2); margin: 13px 0; border: 0; }

/* ---------- 미터 카드 ---------- */
.meters { display: flex; flex-direction: column; gap: 10px; }
.mcard {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-md); padding: 14px 15px;
  display: flex; flex-direction: column; gap: 9px;
}
.mcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.who { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); min-width: 0; }
.who i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; flex: none; }
.state.crit { background: var(--crit-bg); color: var(--critical); }
.state.warn { background: var(--warn-bg); color: var(--warn-ink); }
.state.none { background: var(--card-2); color: var(--ink-3); }
.state.ok   { background: var(--accent-soft); color: var(--accent); }
.mcard-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mcard-title b { font-size: 13.5px; font-weight: 700; letter-spacing: -0.035em; }
.mcard-title em { font-style: normal; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.track { height: 9px; border-radius: 999px; overflow: hidden; background: var(--card-2); }
.fill { height: 100%; border-radius: 999px; transition: width .45s cubic-bezier(.2,.8,.2,1); }
.meter-n { font-size: 12px; color: var(--ink-3); line-height: 1.55; font-weight: 500; }
.meter-n strong { color: var(--ink-2); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .fill { transition: none; } }

/* ---------- 안내 / 경보 ---------- */
.notice { border-radius: var(--r-md); padding: 14px 15px; }
.notice + .notice { margin-top: 10px; }
.notice b { display: block; font-size: 14px; font-weight: 700; letter-spacing: -0.035em; margin-bottom: 4px; }
.notice p { margin: 0; font-size: 13px; line-height: 1.6; font-weight: 500; }
.notice p + p { margin-top: 6px; opacity: .85; font-size: 12.5px; }
.notice.crit  { background: var(--crit-bg); color: var(--critical); }
.notice.warn  { background: var(--warn-bg); color: var(--warn-ink); }
.notice.info  { background: var(--accent-soft); color: var(--accent); }
.notice.quiet { background: var(--card); border: 1px solid var(--hair); color: var(--ink-2); }
.notice.quiet b { color: var(--ink); }
.notice-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.notice-head b { margin: 0; }
.ico { flex: none; width: 15px; height: 15px; }

/* ---------- 차트 ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); }
.ax { font-size: 9.5px; fill: var(--ink-3); font-weight: 600; }
.ax-num { font-size: 9.5px; fill: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.dlabel { font-size: 10px; fill: var(--ink); font-weight: 700; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--baseline); stroke-width: 1; }
.hit { cursor: pointer; }
.hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.legend div { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

details.tbl { margin-top: 6px; }
details.tbl summary {
  font-size: 12px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  list-style: none; padding: 5px 0;
}
details.tbl summary::-webkit-details-marker { display: none; }
details.tbl summary::before { content: "▸ "; }
details.tbl[open] summary::before { content: "▾ "; }
.tbl-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 11.5px; }
th, td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--hair); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--ink-3); font-weight: 700; }
td { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- 폼 ---------- */
.fld { margin-bottom: 16px; }
.fld:last-child { margin-bottom: 0; }
.fld label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.fld .hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; font-weight: 500; }
.fld .hint em { font-style: normal; color: var(--accent); font-weight: 700; }

input[type="text"], input[type="number"], select {
  width: 100%; height: 50px; padding: 0 15px;
  border: none; border-radius: var(--r-md);
  background: var(--sunken); color: var(--ink);
  font-size: 16px; font-weight: 600; font-family: inherit;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--hair);
}
select { -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 19px) 22px, calc(100% - 14px) 22px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
input[inputmode="numeric"] { text-align: right; }
input:focus, select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
input::placeholder { color: var(--ink-4); font-weight: 500; }

.seg { display: flex; gap: 4px; background: var(--card-2); padding: 4px; border-radius: var(--r-md); margin-bottom: 10px; }
.seg button {
  flex: 1; height: 40px; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-3);
  font-size: 14px; font-weight: 600; font-family: inherit; letter-spacing: -0.03em;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; padding: 0 8px;
}
.seg button.on { background: var(--card); color: var(--ink); font-weight: 700; }

.btn {
  width: 100%; height: 52px; border: none; border-radius: var(--r-md);
  background: var(--accent); color: #fff;
  font-size: 16px; font-weight: 700; font-family: inherit; letter-spacing: -0.03em; cursor: pointer;
}
:root[data-theme="dark"] .btn { color: #0b1a13; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .btn { color: #0b1a13; }
}
.btn.gray { background: var(--card); color: var(--ink); border: 1px solid var(--hair); }
.btn.warn { background: transparent; color: var(--critical); height: 46px; font-size: 14px; }
.btn:active { opacity: .75; }
.btn + .btn { margin-top: 8px; }

/* ---------- 산출 근거 시트 ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(8,12,9,.5);
  opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 60;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 61; left: 50%; bottom: 0;
  transform: translate(-50%, 101%);
  width: min(430px, 100%);
  /* 모바일 주소창이 접혔다 펴지면 vh가 실제 보이는 높이보다 커진다.
     dvh를 쓰면 시트 아래쪽이 화면 밖으로 밀리지 않는다 (vh는 구형 브라우저 대비). */
  max-height: 88vh;
  max-height: 85dvh;
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); color: var(--ink);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -8px 40px -10px rgba(8,12,9,.4);
  transition: transform .24s cubic-bezier(.2,.85,.25,1);
}
.sheet.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .scrim, .sheet { transition: none; } }

/* 내용이 길어도 닫기 버튼과 제목은 늘 남아 있어야 한다 */
.sheet-top {
  position: sticky; top: 0; z-index: 2;
  background: var(--card); border-radius: 22px 22px 0 0;
}
.grab { width: 38px; height: 4px; border-radius: 999px; background: var(--hair); margin: 10px auto 0; }
.sheet-head { padding: 14px 20px 12px; border-bottom: 1px solid var(--hair); }
.sheet-head h4 { font-size: 18px; font-weight: 800; letter-spacing: -0.04em; margin: 7px 0 3px; }
.sheet-sub { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.sheet-close {
  position: absolute; top: 16px; right: 16px; width: 30px; height: 30px;
  border-radius: 50%; border: none; background: var(--card-2); color: var(--ink-2);
  font-size: 15px; cursor: pointer; line-height: 1; font-family: inherit;
}
.calc { padding: 6px 20px 0; }
.crow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.crow:last-child { border-bottom: none; }
.crow-l b { display: block; font-size: 13.5px; font-weight: 700; letter-spacing: -0.03em; }
.crow-l span { display: block; font-size: 12px; color: var(--ink-3); font-weight: 500; margin-top: 2px; }
.crow-v { font-size: 14px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 1px; }
.crow-v.plus { color: var(--critical); }
.crow-v.minus { color: var(--good); }
.crow-v.zero { color: var(--ink-3); }
.crow.sub { padding-left: 14px; border-bottom: 1px dashed var(--hair); }
.crow.sub .crow-l b { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.crow.sub .crow-v { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.crow.rule { border-top: 2px solid var(--baseline); border-bottom: none; margin-top: 4px; padding: 0; }
.crow.total { padding: 14px 0 4px; border-bottom: none; align-items: baseline; }
.crow.total .crow-l b { font-size: 15px; }
.crow.total .crow-v { font-size: 24px; font-weight: 800; letter-spacing: -0.045em; }
/* 마지막 줄이 화면 끝에 붙지 않도록 — 홈 인디케이터 영역까지 확보 */
.sheet-foot { padding: 4px 20px calc(34px + env(safe-area-inset-bottom, 0px)); }
.plain { background: var(--sunken); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 13px 15px; margin-top: 14px; }
.plain b { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 5px; letter-spacing: -0.03em; }
.plain p { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.plain p + p { margin-top: 7px; }
/* 마감 전에 해야 할 일 — 날짜가 마감일과 다르다는 게 핵심이라 D-day를 앞에 둔다 */
.prep { margin-top: 16px; }
.prep-h { font-size: 13.5px; font-weight: 700; letter-spacing: -0.035em; margin-bottom: 10px; }
.prep-i { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.prep-i:last-child { border-bottom: none; }
.prep-d {
  min-width: 48px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); background: var(--card-2); color: var(--ink-2);
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; flex: none;
}
.prep-d.hot  { background: var(--crit-bg); color: var(--critical); }
.prep-d.soon { background: var(--warn-bg); color: var(--warn-ink); }
.prep-i b { display: block; font-size: 13.5px; font-weight: 700; letter-spacing: -0.03em; }
.prep-i span { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin-top: 3px; font-weight: 500; }
.prep-i em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 4px; }

.src { margin-top: 14px; font-size: 11.5px; color: var(--ink-3); line-height: 1.65; font-weight: 500; }
.src b { color: var(--ink-2); font-weight: 700; display: block; margin-bottom: 3px; }

/* ---------- 툴팁 ---------- */
#tip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  padding: 8px 11px; font-size: 12px; font-weight: 600;
  box-shadow: 0 4px 18px -6px rgba(8,12,9,.3);
  transition: opacity .12s ease; max-width: 230px;
}
#tip .tip-t { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-bottom: 3px; }
#tip .tip-r { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { #tip { transition: none; } }

/* ---------- 탭바 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--card); border-top: 1px solid var(--hair);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar-h); color: var(--ink-4);
  font-size: 10.5px; font-weight: 600; letter-spacing: -0.02em;
}
.tab span { font-size: 18px; line-height: 1; }
.tab.on { color: var(--accent); }

/* ---------- 기타 ---------- */
.foot { font-size: 12.5px; color: var(--ink-3); line-height: 1.65; font-weight: 500; margin-top: 12px; }
.foot strong { color: var(--ink-2); font-weight: 700; }
.foot.warn { color: var(--critical); }
.empty { text-align: center; color: var(--ink-4); font-size: 13.5px; padding: 30px 12px; font-weight: 500; line-height: 1.6; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 360px) { .g2, .kpis { grid-template-columns: 1fr; } }
