/* Personal Health Dashboard 스타일.
   색, 글꼴, 카드, 칩, 표, 차트 규격은 "☆ 디자인 가이드/대시보드 디자인 가이드라인.md"와 dashboard-tokens.css 를 따른다.
   색은 var(--...) 토큰으로만 쓴다. 이 파일 안에서 새로 만든 토큰(--lv1~5, --warn-bg, --safe-b)은 모두 기존 토큰에서 파생한 것이다.
   글꼴: 나눔바른고딕을 한글 2,350자 중심으로 줄인 woff2(각 약 130KB). 없는 글자는 Malgun Gothic 으로 대체된다. */
@font-face { font-family: 'NanumBarunGothic'; font-weight: 100 500; font-style: normal; font-display: swap; src: url('fonts/nanumbarun-regular.woff2') format('woff2'); }
@font-face { font-family: 'NanumBarunGothic'; font-weight: 600 900; font-style: normal; font-display: swap; src: url('fonts/nanumbarun-bold.woff2') format('woff2'); }

/* ---------- 색 토큰 (가이드 그대로) ---------- */
:root {
  color-scheme: light;
  --page: #f4f5fa; --surface-1: #ffffff; --surface-2: #ffffff;
  --text-primary: #0c1220; --text-secondary: #565f72; --text-muted: #8891a6;
  --grid: #e8e9f1; --axis: #c7cbda; --border: rgba(15,23,42,0.09);
  --good: #0fa968; --good-text: #0c8a57; --critical: #e1444b;
  --series-1: #14a19b; --series-2: #7c5cfc; --series-3: #f5a524; --series-4: #e1447f;
  --series-5: #2f80ed; --series-6: #22a559; --series-7: #ff7a45; --series-8: #64748b;
  --series-1-wash: rgba(20,161,155,0.10);
  --accent-chip-bg: rgba(20,161,155,0.10); --accent-chip-bg-soft: rgba(20,161,155,0.05); --accent-chip-border: #14a19b;
  --target-color: #f0990a; --achieve-line-color: #7c5cfc;
  --good-bg: rgba(15,169,104,0.13); --critical-bg: rgba(225,68,75,0.12);
  --card-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 18px 36px -22px rgba(15,23,42,0.16);
  --zebra-bg: rgba(15,23,42,0.022);
  --font-disp: 'NanumBarunGothic', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: var(--font-disp); --font-mono: var(--font-disp);
  /* 이 앱에서 파생한 토큰 */
  --warn-bg: rgba(240,153,10,0.14);
  --lv1: var(--critical); --lv2: var(--series-7); --lv3: var(--series-3); --lv4: var(--series-6); --lv5: var(--good);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bnav-h: 58px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #12151d; --surface-1: #191d28; --surface-2: #1e2330;
    --text-primary: #f2f3f8; --text-secondary: #a9b0c3; --text-muted: #767f95;
    --grid: #2a3040; --axis: #3a4155; --border: rgba(255,255,255,0.10);
    --good: #22c98b; --good-text: #3ddb9c; --critical: #ff6b71;
    --series-1: #2bd4cc; --series-2: #9c85ff; --series-3: #ffb74a; --series-4: #ff6fa5;
    --series-5: #5b9dff; --series-6: #4ecb82; --series-7: #ff9466; --series-8: #8b96ad;
    --series-1-wash: rgba(43,212,204,0.14);
    --accent-chip-bg: rgba(43,212,204,0.14); --accent-chip-bg-soft: rgba(43,212,204,0.07); --accent-chip-border: #2bd4cc;
    --target-color: #ffb74a; --achieve-line-color: #9c85ff;
    --good-bg: rgba(34,201,139,0.18); --critical-bg: rgba(255,107,113,0.18);
    --card-shadow: 0 1px 2px rgba(0,0,0,0.35), 0 18px 36px -22px rgba(0,0,0,0.55);
    --zebra-bg: rgba(255,255,255,0.028);
    --warn-bg: rgba(255,183,74,0.16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #12151d; --surface-1: #191d28; --surface-2: #1e2330;
  --text-primary: #f2f3f8; --text-secondary: #a9b0c3; --text-muted: #767f95;
  --grid: #2a3040; --axis: #3a4155; --border: rgba(255,255,255,0.10);
  --good: #22c98b; --good-text: #3ddb9c; --critical: #ff6b71;
  --series-1: #2bd4cc; --series-2: #9c85ff; --series-3: #ffb74a; --series-4: #ff6fa5;
  --series-5: #5b9dff; --series-6: #4ecb82; --series-7: #ff9466; --series-8: #8b96ad;
  --series-1-wash: rgba(43,212,204,0.14); --accent-chip-bg: rgba(43,212,204,0.14);
  --accent-chip-bg-soft: rgba(43,212,204,0.07); --accent-chip-border: #2bd4cc;
  --target-color: #ffb74a; --achieve-line-color: #9c85ff;
  --good-bg: rgba(34,201,139,0.18); --critical-bg: rgba(255,107,113,0.18);
  --card-shadow: 0 1px 2px rgba(0,0,0,0.35), 0 18px 36px -22px rgba(0,0,0,0.55);
  --zebra-bg: rgba(255,255,255,0.028); --warn-bg: rgba(255,183,74,0.16);
}

/* ---------- 바탕 ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; background: var(--page); color: var(--text-primary); font-family: var(--font-body); font-weight: 400; font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
body {
  background: radial-gradient(900px 480px at 6% -8%, rgba(20,161,155,0.07), transparent 60%), radial-gradient(900px 480px at 98% -4%, rgba(124,92,252,0.08), transparent 60%), var(--page);
  background-attachment: fixed; -webkit-tap-highlight-color: transparent;
}
a { color: var(--series-1); text-decoration: none; font-weight: 600; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; touch-action: manipulation; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.sub { color: var(--text-secondary); font-size: 12.5px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 22px 20px calc(var(--bnav-h) + var(--safe-b) + 40px); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.stack > * + * { margin-top: 12px; }
.sp { height: 12px; }

/* ---------- 헤더 ---------- */
.hdr { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.eyebrow { display: flex; align-items: center; gap: 9px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--series-1); box-shadow: 0 0 10px rgba(20,161,155,0.55); flex-shrink: 0; }
h1.page-h1 { font-weight: 900; letter-spacing: -0.02em; line-height: 1.08; font-size: clamp(26px, 3.6vw, 36px); margin: 0 0 8px; }
h1.page-h1 .accent { background: linear-gradient(96deg, var(--series-1) 0%, var(--series-2) 85%); -webkit-background-clip: text; background-clip: text; color: transparent; }
p.page-sub { color: var(--text-secondary); font-size: 13.5px; }
p.page-update { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.hdr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.hdr-right .row { justify-content: flex-end; }

/* ---------- 상단 탭(PC), 하단 내비게이션(모바일) ---------- */
.tabbar { position: sticky; top: 0; z-index: 30; background: var(--page); padding: 8px 0 10px; margin-bottom: 8px; box-shadow: 0 8px 12px -12px rgba(15,23,42,0.25); display: none; gap: 8px; flex-wrap: wrap; }
.brand-tab { border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; transition: all .15s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.brand-tab:hover { border-color: var(--accent-chip-border); color: var(--series-1); transform: translateY(-1px); }
.brand-tab.active { background: var(--series-1); border-color: var(--series-1); color: #fff; box-shadow: 0 2px 8px rgba(20,161,155,0.28); }
.brand-tab svg { width: 15px; height: 15px; }
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(6, 1fr); background: var(--surface-1); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); box-shadow: 0 -8px 20px -14px rgba(15,23,42,0.25); }
.bnav button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--bnav-h); color: var(--text-muted); font-size: 10.5px; font-weight: 600; cursor: pointer; padding: 0 2px; }
.bnav button svg { width: 22px; height: 22px; }
.bnav button.active { color: var(--series-1); }
@media (min-width: 900px) { .tabbar { display: flex; } .bnav { display: none; } .wrap { padding-bottom: 60px; } }
@media (max-width: 899px) { .wrap { padding: 14px 12px calc(var(--bnav-h) + var(--safe-b) + 84px); } .hdr { margin-bottom: 10px; } h1.page-h1 { font-size: 24px; } }

/* ---------- 카드 ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px; box-shadow: var(--card-shadow); }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 15px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.005em; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.card h2 .sub { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.card h3 { font-size: 13.5px; font-weight: 700; margin: 0 0 8px; }
.scope-highlight { color: var(--series-1); font-weight: 800; }
.filter-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
@media (max-width: 899px) { .card { padding: 16px 14px; border-radius: 16px; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 > *, .grid3 > * { min-width: 0; }
.grid2 > .card + .card, .grid3 > .card + .card { margin-top: 0; }
@media (max-width: 980px) { .grid2, .grid3 { grid-template-columns: 1fr; } .grid2 > .card + .card, .grid3 > .card + .card { margin-top: 16px; } }

/* ---------- 버튼, 칩, 토글 (알약) ---------- */
.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; cursor: pointer; font-weight: 600; transition: all .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--accent-chip-border); color: var(--series-1); background: var(--accent-chip-bg); }
.btn.small { padding: 4px 11px; font-size: 11.5px; font-weight: 500; }
.btn.active { background: var(--accent-chip-bg); border-color: var(--accent-chip-border); color: var(--series-1); font-weight: 700; }
.btn.pri { background: var(--series-1); border-color: var(--series-1); color: #fff; box-shadow: 0 2px 8px rgba(20,161,155,0.28); }
.btn.pri:hover { filter: brightness(1.06); color: #fff; background: var(--series-1); }
.btn.danger:hover { border-color: var(--critical); color: var(--critical); background: var(--critical-bg); }
.btn:disabled, .btn.dis { opacity: .4; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; user-select: none; transition: all .15s; white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; }
.chip:hover { border-color: var(--accent-chip-border); color: var(--series-1); transform: translateY(-1px); }
.chip.active { background: var(--accent-chip-bg); border-color: var(--accent-chip-border); color: var(--series-1); font-weight: 700; box-shadow: 0 2px 8px rgba(20,161,155,0.20); }
.chip.all.active { background: var(--text-primary); border-color: var(--text-primary); color: var(--surface-1); box-shadow: none; }
.chip.x { padding-right: 8px; } .chip.x i { font-style: normal; opacity: .6; font-size: 14px; line-height: 1; }
.geo-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.geo-b { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-1); color: var(--text-secondary); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.geo-b:hover { border-color: var(--series-1); color: var(--series-1); }
.geo-b.sel { background: var(--text-primary); border-color: var(--text-primary); color: var(--surface-1); }
.geo-b.dis { opacity: .4; cursor: not-allowed; }
.bar-sep { flex: none; display: inline-block; width: 1px; height: 22px; background: var(--axis); }
@media (max-width: 899px) { .chip, .geo-b, .btn { min-height: 36px; } .btn.small { min-height: 30px; } }

/* ---------- 입력 ---------- */
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label, .lbl { font-size: 12px; font-weight: 600; color: var(--text-muted); }
input[type=text], input[type=number], input[type=date], input[type=time], input[type=password], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; min-width: 0; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-chip-border); box-shadow: 0 0 0 3px var(--accent-chip-bg); }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
@media (max-width: 899px) { input[type=text], input[type=number], input[type=date], input[type=time], input[type=password], input[type=search], select, textarea { font-size: 16px; padding: 10px 12px; } }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .f3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .f4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.f2 > *, .f3 > *, .f4 > * { min-width: 0; }
@media (max-width: 560px) { .f3, .f4 { grid-template-columns: 1fr 1fr; } }
.unit-in { position: relative; } .unit-in input { padding-right: 38px; } .unit-in span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-muted); pointer-events: none; }

/* ---------- 5점 척도 ---------- */
.scale { display: flex; gap: 6px; }
.sc { flex: 1; max-width: 72px; min-height: 52px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--text-muted); font-size: 11.5px; font-weight: 700; padding: 4px 0; transition: all .15s; }
.sc svg { width: 24px; height: 24px; }
.sc:hover { border-color: var(--c, var(--accent-chip-border)); color: var(--c, var(--series-1)); }
.sc.on { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface-2)); box-shadow: 0 2px 8px color-mix(in srgb, var(--c) 28%, transparent); }
.sc.l1 { --c: var(--lv1); } .sc.l2 { --c: var(--lv2); } .sc.l3 { --c: var(--lv3); } .sc.l4 { --c: var(--lv4); } .sc.l5 { --c: var(--lv5); }
.scale-cap { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); margin-top: 3px; padding: 0 2px; }
.dot-lv { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-lv.l1 { background: var(--lv1); } .dot-lv.l2 { background: var(--lv2); } .dot-lv.l3 { background: var(--lv3); } .dot-lv.l4 { background: var(--lv4); } .dot-lv.l5 { background: var(--lv5); }

/* ---------- 날짜 이동, 진행률 ---------- */
.datebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.datebar .cur { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; min-width: 150px; text-align: center; }
@media (max-width: 560px) { .datebar { flex-wrap: nowrap; gap: 6px; } .datebar .cur { min-width: 0; flex: 1; font-size: 15.5px; } }
.iconbtn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.iconbtn:hover { border-color: var(--accent-chip-border); color: var(--series-1); background: var(--accent-chip-bg); }
.iconbtn svg { width: 18px; height: 18px; }
.meter { height: 8px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: var(--series-1); transition: width .3s; }
.meter.good > i { background: var(--good); }
.prog { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.prog .meter { flex: 1; min-width: 80px; }

/* ---------- 아코디언 섹션 ---------- */
.acc { background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--card-shadow); overflow: hidden; }
.acc + .acc { margin-top: 10px; }
.acc-h { width: 100%; border: 0; background: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; text-align: left; min-height: 56px; }
.acc-h .ico { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-chip-bg); color: var(--series-1); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.acc-h .ico svg { width: 19px; height: 19px; }
.acc-h .tt { font-size: 14.5px; font-weight: 700; }
.acc-h .sm { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-h .sm.has { color: var(--text-secondary); }
.acc-h .st { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--grid); color: var(--text-muted); flex-shrink: 0; }
.acc-h .st.done { background: var(--good-bg); color: var(--good-text); }
.acc-h .chev { width: 18px; height: 18px; color: var(--text-muted); transition: transform .2s; flex-shrink: 0; }
.acc.open .chev { transform: rotate(180deg); }
.acc-b { display: none; padding: 4px 16px 18px; border-top: 1px solid var(--border); }
.acc.open .acc-b { display: block; }
.sub-card { background: var(--page); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; }
.sub-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; font-size: 13px; font-weight: 700; }
.sub-h .btn { margin-left: auto; }
.food-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.food-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.food-row .nm { font-weight: 600; min-width: 64px; }
.sug { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sug .chip { font-size: 12px; padding: 3px 10px; }
.pad-b { padding-bottom: 6px; }

/* ---------- 하단 고정 저장줄 ---------- */
.savebar { position: fixed; left: 0; right: 0; bottom: calc(var(--bnav-h) + var(--safe-b)); z-index: 35; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-1); border-top: 1px solid var(--border); box-shadow: 0 -8px 20px -14px rgba(15,23,42,0.25); }
.savebar .stat { flex: 1; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.savebar .stat.ok { color: var(--good-text); } .savebar .stat.err { color: var(--critical); } .savebar .stat.wait { color: var(--target-color); }
@media (min-width: 900px) { .savebar { position: sticky; bottom: 0; left: auto; right: auto; border: 1px solid var(--border); border-radius: 14px; margin-top: 14px; } }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi-grid.c5 { grid-template-columns: repeat(5, 1fr); } .kpi-grid.c3 { grid-template-columns: repeat(3, 1fr); } .kpi-grid.c2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .kpi-grid, .kpi-grid.c5, .kpi-grid.c3 { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px 14px 18px; position: relative; overflow: hidden; transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s; min-width: 0; }
.kpi:hover { transform: translateY(-3px); box-shadow: 0 14px 26px -16px rgba(15,23,42,0.22); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--series-1); opacity: .9; }
.kpi.t2::before { background: var(--target-color); } .kpi.t3::before { background: var(--series-2); } .kpi.t4::before { background: var(--series-5); }
.kpi .label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.kpi .value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.kpi .delta { font-size: 11.5px; margin-top: 6px; font-weight: 600; color: var(--text-muted); }
.kpi .delta.up { color: var(--good-text); } .kpi .delta.down { color: var(--critical); } .kpi .delta.flat { color: var(--text-muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--grid); color: var(--text-secondary); }
.badge.up { background: var(--good-bg); color: var(--good-text); } .badge.down { background: var(--critical-bg); color: var(--critical); } .badge.warn { background: var(--warn-bg); color: var(--target-color); }

/* ---------- 표 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
th { color: var(--text-muted); font-weight: 700; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nc, th.nc { text-align: center; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; overflow-y: auto; height: 440px; border: 1px solid var(--border); border-radius: 12px; scrollbar-gutter: stable; background: var(--surface-1); }
.table-scroll.h320 { height: 320px; } .table-scroll.h260 { height: 260px; }
.table-scroll thead th { position: sticky; top: 0; background: var(--page); z-index: 2; }
.table-scroll td:first-child, .table-scroll th:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 1; }
.table-scroll thead th:first-child { background: var(--page); z-index: 3; }
table.fixed { table-layout: fixed; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--accent-chip-bg-soft); }
tr.sel td { background: var(--accent-chip-bg); }
tr.sub-row td { font-weight: 700; background: var(--accent-chip-bg-soft); border-bottom: 2px solid var(--border); }
td.up, .up { color: var(--good-text); } td.down, .down { color: var(--critical); } td.flat, .flat { color: var(--text-muted); }
td.st-high, td.st-low { color: var(--target-color); font-weight: 700; } td.st-normal { color: var(--good-text); }
.cell-sm { font-size: 11px; color: var(--text-muted); display: block; line-height: 1.2; }
tbody tr:nth-child(even) td { background-image: linear-gradient(var(--zebra-bg), var(--zebra-bg)); }

/* ---------- 차트 ---------- */
.chart-wrap { position: relative; height: 320px; }
.chart-wrap.h240 { height: 240px; }
.legend-wrap { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-secondary); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.legend-swatch.dashed { width: 16px; height: 0; border-radius: 0; background: none !important; border-top: 2px dashed; margin-bottom: 2px; }
.chart-insight { margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.7; }
.chart-insight b { color: var(--text-primary); }
.chartjs-ext-tooltip { position: absolute; pointer-events: none; z-index: 1000; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-primary); box-shadow: var(--card-shadow); line-height: 1.65; white-space: nowrap; transform: translate(-50%, -100%) translateY(-10px); }
.chartjs-ext-tooltip .tt-title { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); }
.empty { text-align: center; color: var(--text-muted); padding: 36px 12px; font-size: 13px; line-height: 1.7; }
.empty.small { padding: 18px 8px; }

/* ---------- 캘린더 ---------- */
.cal-head, .cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head div { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-muted); padding: 4px 0; }
.cal-head div:first-child { color: var(--critical); } .cal-head div:last-child { color: var(--series-5); }
.cal-cell { position: relative; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-height: 62px; padding: 5px 5px 7px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; text-align: left; transition: border-color .15s; }
.cal-cell:hover { border-color: var(--accent-chip-border); }
.cal-cell.out { opacity: .35; pointer-events: none; }
.cal-cell .dn { font-size: 12px; font-weight: 700; line-height: 1; }
.cal-cell.today .dn { background: var(--series-1); color: #fff; border-radius: 999px; padding: 3px 6px; margin: -2px 0 0 -2px; align-self: flex-start; }
.cal-cell.sel { border: 2px solid var(--accent-chip-border); background: var(--accent-chip-bg-soft); }
.cal-cell .mk { display: flex; align-items: center; gap: 3px; min-height: 14px; }
.cal-cell .mk svg { width: 13px; height: 13px; color: var(--series-1); }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-cell .mk .ok { margin-left: auto; width: 14px; height: 14px; color: var(--good-text); }
.cal-cell .pg { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--grid); } .cal-cell .pg i { display: block; height: 100%; background: var(--series-1); }
.cal-cell.m1 { background: color-mix(in srgb, var(--lv1) 14%, var(--surface-2)); } .cal-cell.m2 { background: color-mix(in srgb, var(--lv2) 14%, var(--surface-2)); }
.cal-cell.m3 { background: color-mix(in srgb, var(--lv3) 13%, var(--surface-2)); } .cal-cell.m4 { background: color-mix(in srgb, var(--lv4) 14%, var(--surface-2)); } .cal-cell.m5 { background: color-mix(in srgb, var(--lv5) 16%, var(--surface-2)); }
.cal-cell .mv { font-size: 10.5px; color: var(--text-secondary); font-weight: 700; }
.legend-line { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--text-muted); margin-top: 10px; align-items: center; }
.legend-line svg { width: 13px; height: 13px; vertical-align: -2px; color: var(--series-1); }
@media (max-width: 560px) { .cal-cell { min-height: 54px; padding: 4px 3px 7px; } .cal-cell .mv { display: none; } }

/* ---------- 상세 보기, 목록 ---------- */
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--text-muted); font-weight: 600; } .kv dd { margin: 0; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li .grow b { display: block; font-size: 13.5px; } .li .grow span { font-size: 12px; color: var(--text-muted); }
.ins { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface-2); }
.ins + .ins { margin-top: 10px; }
.ins h3 { margin-bottom: 6px; }
.ins .tx { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.ins.insuf { background: var(--page); } .ins.insuf .tx { color: var(--text-muted); }
.ins .cmp { display: flex; gap: 10px; margin: 8px 0; flex-wrap: wrap; } .ins .cmp > div { flex: 1; min-width: 120px; background: var(--page); border-radius: 10px; padding: 8px 10px; } .ins .cmp b { font-size: 18px; display: block; }
.note-box { background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.65; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--page); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }
.add-photo { width: 84px; height: 84px; border-radius: 10px; border: 1px dashed var(--axis); background: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; cursor: pointer; }
.add-photo svg { width: 22px; height: 22px; }
.ai-hl { background: var(--warn-bg); border-radius: 6px; }

/* ---------- 로그인 ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth .card { width: 100%; max-width: 380px; padding: 28px 26px; }
.auth h2 { font-size: 18px; margin-bottom: 4px; } .auth .fld + .fld { margin-top: 12px; } .auth .btn.pri { width: 100%; margin-top: 16px; border-radius: 10px; padding: 11px; font-size: 13.5px; }
.err-msg { color: var(--critical); font-size: 12.5px; margin-top: 10px; min-height: 18px; }

/* ---------- 모달, 토스트 ---------- */
.ov { position: fixed; inset: 0; background: rgba(8,12,24,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 440px; padding: 20px; box-shadow: var(--card-shadow); max-height: 86vh; overflow: auto; }
.modal.wide { max-width: 720px; }
.modal h3 { font-size: 16px; margin-bottom: 10px; } .modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal p { font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bnav-h) + var(--safe-b) + 72px); background: var(--text-primary); color: var(--surface-1); padding: 9px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 120; max-width: 92vw; box-shadow: var(--card-shadow); }
.toast.err { background: var(--critical); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 40px; } }
.offline-bar { background: var(--warn-bg); color: var(--text-secondary); text-align: center; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 10px; margin-bottom: 10px; }
.top-btn { position: fixed; right: 14px; bottom: calc(var(--bnav-h) + var(--safe-b) + 76px); width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-1); box-shadow: var(--card-shadow); cursor: pointer; z-index: 30; display: none; align-items: center; justify-content: center; color: var(--text-secondary); }
.top-btn.show { display: flex; } .top-btn svg { width: 18px; height: 18px; transform: rotate(180deg); }
