:root {
  --blue: #3182F6; --blue-press: #1B64DA; --blue-weak: #E8F3FF;
  --bg: #F2F4F6; --card: #FFFFFF; --text: #191F28; --text-2: #4E5968; --text-3: #8B95A1;
  --line: #E5E8EB; --fill: #F2F4F6; --track: #E5E8EB; --bar: #B0B8C1;
  --green: #00C471; --green-weak: #E5F8EF; --red: #F04452; --orange: #FF8A00; --orange-weak: #FFF3E0;
  --r-card: 20px; --r-btn: 16px; --gutter: 20px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17171C; --card: #212126; --text: #ECECEF; --text-2: #B0B8C1; --text-3: #7E8590; --line: #2C2C35; --fill: #2C2C35;
    --track: #2C2C35; --bar: #4E5968; --blue-weak: #1C2A40; --green-weak: #12301F; --orange-weak: #33240F; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 17px; line-height: 1.5; letter-spacing: -0.01em; word-break: keep-all; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
body.has-cta { padding-bottom: 96px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* 상단 */
.topbar { position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--blue); font-size: 15px; }
.top-link { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-size: 18px; }
.top-link:hover { background: var(--fill); }

.page { max-width: 600px; margin: 0 auto; padding: 0 var(--gutter) 40px; }
.crumbs { display: flex; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-3); overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs li + li::before { content: '›'; margin-right: 6px; }
.crumbs a:hover { color: var(--text-2); }

.hero { padding: 20px 4px 20px; }
.hero h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.35; font-weight: 700; letter-spacing: -0.02em; }
.sub { margin: 0; color: var(--text-2); font-size: 17px; }
.eyebrow { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--blue); }

/* 큰 숫자 */
.big { margin: 4px 0 2px; font-size: 34px; line-height: 1.25; font-weight: 700; letter-spacing: -0.03em; }
.big small { font-size: 20px; font-weight: 600; margin-left: 2px; }
.big-caption { margin: 0; font-size: 15px; color: var(--text-3); }

/* 카드·섹션 */
.card { margin-top: 12px; padding: 22px 20px; background: var(--card); border-radius: var(--r-card); }
.card-title { margin: 0 0 14px; font-size: 19px; font-weight: 700; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-title .more { font-size: 15px; font-weight: 500; color: var(--text-3); }
.card-desc { margin: -8px 0 14px; font-size: 15px; color: var(--text-3); }
.section-title { margin: 32px 4px 0; font-size: 21px; font-weight: 700; }
.list-card { padding: 8px 0; }
.list-card > .card-title { padding: 14px 20px 0; margin-bottom: 4px; }

/* 리스트 셀 */
.cells { list-style: none; margin: 0; padding: 0; }
.cell { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 20px; transition: background .15s; }
a.cell:hover, a.cell:active { background: var(--fill); }
.cell-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--fill); font-size: 20px; }
.cell-body { flex: 1; min-width: 0; }
.cell-title { display: block; font-size: 17px; font-weight: 600; }
.cell-sub { display: block; font-size: 13px; color: var(--text-3); margin-top: 1px; }
.cell-value { flex: none; text-align: right; font-size: 17px; font-weight: 600; }
.cell-value.free { color: var(--green); }
.chev { color: var(--text-3); font-size: 22px; line-height: 1; flex: none; }
.cell.is-current { background: var(--blue-weak); }

/* 선택 필드·검색 */
.select-field { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 0 20px; background: var(--card); border-radius: var(--r-card); text-align: left; transition: transform .15s; }
.select-field:active { transform: scale(.98); }
.select-label { font-size: 15px; color: var(--text-3); }
.select-value { flex: 1; font-weight: 600; }
.search { position: relative; margin: 12px 0 0; }
.search input { width: 100%; height: 56px; padding: 0 16px 0 48px; border: 0; border-radius: var(--r-btn); background: var(--card); color: var(--text); font: inherit; outline: none; -webkit-appearance: none; }
.search input:focus { box-shadow: 0 0 0 2px var(--blue); }
.search input::placeholder { color: var(--text-3); }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: .6; pointer-events: none; }
.ac { position: absolute; z-index: 15; left: 0; right: 0; top: 62px; margin: 0; padding: 8px 0; list-style: none; background: var(--card); border-radius: var(--r-card); box-shadow: 0 8px 28px rgba(0,0,0,.12); max-height: 60vh; overflow-y: auto; }
.ac[hidden] { display: none; }
.ac .cell { min-height: 56px; }
.ac .cell[aria-selected="true"] { background: var(--fill); }
.ac-empty { padding: 16px 20px; color: var(--text-3); font-size: 15px; }

/* 칩·타일 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px; background: var(--fill); font-size: 15px; font-weight: 500; transition: background .15s, color .15s; }
.chip:hover, .chip:active { background: var(--blue-weak); color: var(--blue); }
.chip .chip-meta { color: var(--text-3); font-size: 13px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 20px; min-height: 128px; background: var(--card); border-radius: var(--r-card); transition: transform .15s; }
.tile:active { transform: scale(.97); }
.tile-icon { font-size: 30px; margin-bottom: auto; }
.tile strong { font-size: 17px; margin-top: 12px; }
.tile-desc { font-size: 13px; color: var(--text-3); }

/* 세그먼트(카테고리 바로가기) */
.seg-wrap { position: sticky; top: 56px; z-index: 5; margin: 0 calc(var(--gutter) * -1); padding: 8px var(--gutter); background: var(--bg); }
.seg { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button { flex: none; height: 36px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 18px; background: var(--card); font-size: 15px; font-weight: 600; color: var(--text-2); }
.seg a.on, .seg button.on, .seg button[aria-selected="true"] { background: var(--text); color: var(--card); }
.tabs { display: flex; padding: 4px; border-radius: 14px; background: var(--fill); gap: 4px; }
.tabs button { flex: 1; height: 40px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--text-3); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 배지 */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--fill); color: var(--text-2); vertical-align: middle; }
.badge.blue { background: var(--blue-weak); color: var(--blue); }
.badge.green { background: var(--green-weak); color: var(--green); }
.badge.orange { background: var(--orange-weak); color: var(--orange); }

/* 비교 막대 */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px; font-size: 15px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-track { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; background: var(--bar); min-width: 4px; }
.bar-val { font-weight: 600; min-width: 68px; text-align: right; }
.bar.is-current .bar-name { color: var(--text); font-weight: 700; }
.bar.is-current .bar-fill { background: var(--blue); }
.bar.is-current .bar-val { color: var(--blue); }
a.bar:hover .bar-name { text-decoration: underline; }

/* 요약 수치 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { padding: 14px 12px; border-radius: 14px; background: var(--fill); }
.stat span { display: block; font-size: 13px; color: var(--text-3); }
.stat strong { display: block; margin-top: 2px; font-size: 17px; }

/* 주간 달력 */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.wd { padding: 10px 0 12px; border-radius: 14px; }
.wd-day { display: block; font-size: 13px; color: var(--text-3); }
.wd-num { display: block; margin-top: 2px; font-size: 17px; font-weight: 600; }
.wd-dot { display: block; width: 6px; height: 6px; margin: 6px auto 0; border-radius: 3px; background: transparent; }
.wd.on .wd-dot { background: var(--blue); }
.wd.today { background: var(--fill); }
.wd.today .wd-day { color: var(--text); font-weight: 700; }

/* 정보 목록 */
.kv { margin: 0; display: grid; gap: 14px; }
.kv div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; }
.kv dt { font-size: 15px; color: var(--text-3); }
.kv dd { margin: 0; font-size: 15px; color: var(--text); }

/* 안내 */
.notice { display: flex; gap: 14px; align-items: flex-start; background: var(--blue-weak); }
.notice.warn { background: var(--orange-weak); }
.notice-icon { font-size: 24px; line-height: 1.2; }
.notice strong { display: block; margin-bottom: 2px; }
.notice p { margin: 0; font-size: 15px; color: var(--text-2); }

/* 버튼 */
.cta { display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; border-radius: var(--r-btn); background: var(--blue); color: #fff; font-size: 17px; font-weight: 600; }
.cta:active { background: var(--blue-press); }
.cta.ghost { background: var(--blue-weak); color: var(--blue); }
.cta-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 24%); }
.cta-bar .cta { max-width: 560px; margin: 0 auto; }
.btn-row { display: flex; gap: 8px; margin-top: 16px; }
.btn-row .cta { height: 52px; font-size: 16px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 10px 4px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--text-3); font-weight: 500; font-size: 13px; }
.tbl td.num { text-align: right; white-space: nowrap; font-weight: 600; }

.footer { max-width: 600px; margin: 0 auto; padding: 8px var(--gutter) 48px; font-size: 13px; color: var(--text-3); }
.footer p { margin: 0 0 4px; }
.footer a { text-decoration: underline; }
.copy { margin-top: 12px !important; }

/* 바텀시트 */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.4); animation: fade .2s ease; }
.sheet-backdrop[hidden] { display: none; }
.sheet { width: 100%; max-width: 600px; max-height: 80vh; overflow-y: auto; padding: 12px 0 calc(24px + env(safe-area-inset-bottom)); background: var(--card); border-radius: 24px 24px 0 0; animation: up .22s cubic-bezier(.2,.8,.2,1); }
.sheet-handle { width: 40px; height: 4px; margin: 0 auto 16px; border-radius: 2px; background: var(--line); }
.sheet h2 { margin: 0 0 8px; padding: 0 24px; font-size: 21px; font-weight: 700; }
.sheet .cell { padding: 12px 24px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 340px) { .bar { grid-template-columns: 68px 1fr auto; } .stats { grid-template-columns: 1fr 1fr; } }
