:root {
  --bg: #f1fbf9; --card: #ffffff; --ink: #15262b; --mute: #7b9096; --line: #e8f3f1;
  --accent: #0fb5a3; --accent-ink: #ffffff; --accent-soft: #dff8f3;
  --mint: #19d3a2; --bad: #ff6b81; --warn: #ffc83d; --soft: #eef7f6;
  --chart-a: #0fb5a3; --chart-b: #bfd3d2;
  --grad: linear-gradient(135deg, #19cfa0 0%, #22b3e6 58%, #5b9bff 100%);
  --shadow: 0 2px 6px rgba(20,90,90,.04), 0 14px 34px rgba(25,190,170,.12);
  --r: 26px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1517; --card: #132326; --ink: #eefaf8; --mute: #86a3a8; --line: #1f3639;
    --accent: #3de0c1; --accent-ink: #062320; --accent-soft: #163a3a;
    --mint: #3be0b8; --bad: #ff8aa0; --warn: #ffd166; --soft: #183032;
    --chart-a: #3de0c1; --chart-b: #43666a;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 -apple-system, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
#app { max-width: 560px; margin: 0 auto; padding: 0 18px; }
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -0.03em; }
h2 { font-size: 19px; margin: 30px 4px 12px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 800; }
.top { display: flex; align-items: flex-end; justify-content: space-between; padding: 26px 4px 8px; }
.top .hello { font-size: 14px; color: var(--mute); font-weight: 600; margin-bottom: 2px; }
.top h1 { font-size: 27px; font-weight: 900; letter-spacing: -0.04em; }
.top .who { background: var(--card); box-shadow: var(--shadow); padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 700; color: var(--accent); }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* 카드 */
.card { background: var(--card); border-radius: var(--r); padding: 22px; margin: 14px 0; box-shadow: var(--shadow); }
.card > h3:first-child { margin-bottom: 2px; }
.hero { background: var(--grad); color: #fff; position: relative; overflow: hidden; box-shadow: 0 18px 40px rgba(25,190,200,.34); }
.hero .big, .hero .pill { text-shadow: 0 1px 8px rgba(0,60,90,.18); }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 220px; height: 220px; right: -70px; top: -90px; background: rgba(255,255,255,.14); }
.hero::after { width: 140px; height: 140px; left: -50px; bottom: -70px; background: rgba(255,255,255,.1); }
.hero > * { position: relative; z-index: 1; }
.hero .muted { color: rgba(255,255,255,.78); }
.hero .big { font-size: 42px; font-weight: 900; letter-spacing: -0.04em; margin: 4px 0 8px; line-height: 1.1; }
.pill { display: inline-block; background: rgba(255,255,255,.22); backdrop-filter: blur(6px); padding: 7px 14px; border-radius: 99px; font-size: 14px; font-weight: 700; margin-top: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hero .grid2 > div { background: rgba(255,255,255,.18); border-radius: 18px; padding: 14px 16px; }
.hero .grid2 b { color: #fff; }

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; transition: transform .1s ease, opacity .15s; }
button:active { transform: scale(.96); }
.btn { background: var(--grad); color: #fff; padding: 14px 20px; border-radius: 18px; font-weight: 800; box-shadow: 0 8px 20px rgba(25,200,180,.32); }
.btn.ghost { background: var(--soft); color: var(--ink); box-shadow: none; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.sm { padding: 9px 16px; font-size: 13px; border-radius: 14px; }
.btn:disabled { opacity: .5; }
input, select, textarea { width: 100%; background: var(--soft); border: 2px solid transparent; border-radius: 16px; padding: 14px 16px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--card); }
label { display: block; font-size: 13px; color: var(--mute); margin: 16px 0 7px; font-weight: 700; }
.chk { display: flex; gap: 10px; align-items: center; margin-top: 18px; font-size: 14px; color: var(--ink); font-weight: 600; }
.chk input { width: 22px; height: 22px; accent-color: var(--accent); }

/* 목록 */
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-of-type { border-top: 0; }
.item .l { min-width: 0; }
.item .l b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.item .r { text-align: right; white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); margin-right: 5px; }
.tag.hi { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

/* 막대 */
.bar { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--soft); margin: 16px 0 12px; gap: 3px; }
.bar i { display: block; height: 100%; border-radius: 99px; }
.legend { display: flex; flex-wrap: wrap; gap: 7px 14px; font-size: 13px; color: var(--mute); font-weight: 500; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* 안내 */
.warn { padding: 14px 16px; background: color-mix(in srgb, var(--warn) 16%, var(--card)); border-radius: 20px; margin: 10px 0; font-size: 14px; font-weight: 600; line-height: 1.5; }
.warn.bad { background: color-mix(in srgb, var(--bad) 14%, var(--card)); }

.seg { display: flex; background: var(--soft); border-radius: 18px; padding: 5px; gap: 4px; }
.seg button { flex: 1; background: transparent; padding: 11px 4px; border-radius: 14px; font-size: 14px; color: var(--mute); font-weight: 700; }
.seg button.on { background: var(--card); color: var(--accent); box-shadow: 0 2px 10px rgba(20,100,100,.14); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 4px; text-align: right; border-top: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--mute); font-weight: 700; font-size: 12.5px; border-top: 0; }
tr.pick td { font-weight: 900; color: var(--accent); }
.timeline { margin: 8px 0 0; padding: 0; list-style: none; }
.timeline li { display: flex; gap: 12px; padding: 9px 0; align-items: baseline; }
.timeline .d { width: 68px; color: var(--accent); font-weight: 800; flex: none; font-size: 13px; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 10px; }
svg.chart text { fill: var(--mute); font-size: 10px; }

/* 하단 탭: 떠 있는 둥근 바 */
nav.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 536px; margin: 0 auto; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-radius: 28px; display: flex; padding: 8px 6px; z-index: 5; box-shadow: 0 10px 34px rgba(20,110,110,.18); }
nav.tabs button { flex: 1; min-width: 0; background: none; padding: 7px 0 5px; color: var(--mute); font-size: 10.5px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 18px; }
nav.tabs button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.on { color: var(--accent); background: var(--accent-soft); }
nav.tabs button.on svg { stroke-width: 2.3; }

/* 시트 */
.sheet-bg { position: fixed; inset: 0; background: rgba(8,28,30,.5); backdrop-filter: blur(3px); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; background: var(--card); border-radius: 32px 32px 0 0; padding: 26px 22px calc(24px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
.sheet h3 { font-size: 20px; margin-bottom: 4px; }
.sheet .acts { display: flex; gap: 10px; margin-top: 24px; }
.sheet .acts .btn { flex: 1; }
.ai-text { white-space: pre-wrap; word-break: keep-all; line-height: 1.75; }
.ai-text b { color: var(--accent); }
.check { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); align-items: center; cursor: pointer; font-weight: 600; }
.check:first-of-type { border-top: 0; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line); flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.dot.done { background: var(--mint); border-color: var(--mint); color: #fff; }
.auth { max-width: 380px; margin: 14vh auto 0; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 99px; font-size: 14px; font-weight: 700; z-index: 20; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }
