/* ============================================================================
   Pickup Pricing Lab
   - 색은 역할 이름으로만 쓴다. 밝은 화면이 기본이고 html[data-theme="dark"] 가 어두운 화면이다.
   - 차트 색(--s*, --o*)은 색각 이상 구분 검증을 통과한 순서라서 순서를 바꾸지 않는다.
   ============================================================================ */

:root {
    color-scheme: light;
    --plane: #f6f6f4;
    --surface: #ffffff;
    --surface-2: #f3f3f1;
    --surface-3: #ebebe8;
    --ink: #191919;
    --ink-2: #666666;
    --ink-3: #8f8f8f;
    --line: rgba(11, 11, 11, 0.10);
    --line-strong: rgba(11, 11, 11, 0.18);
    --grid: #e7e7e7;
    --axis: #c2c2c2;
    --accent: #257de0;
    --accent-ink: #1757ac;
    --accent-wash: rgba(37, 125, 224, 0.10);
    --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.05);

    /* 범주형: 배달앱, 앱 포장, 직접 포장, 매장 식사 순서로 고정 */
    --s1: #257de0;
    --s2: #f47230;
    --s3: #00b894;
    --s4: #f2a600;
    /* 순서형 (가까움 → 멂): 한 색상의 밝기 단계 */
    --o1: #84b9f3;
    --o2: #519ced;
    --o3: #257de0;
    --o4: #1757ac;
    --o5: #0e3d7e;
    /* 방향: 이득과 손실 */
    --pos: #257de0;
    --neg: #ec4647;
    --neutral: #9a9a9a;
    --neutral-2: #d0d0d0;
    --good: #0aac23;
    --good-ink: #006c10;
    --warning: #fbb315;
    --critical: #dc3c3d;

    --radius: 14px;
    --radius-sm: 9px;
    --sidebar: 252px;
    --font: 'Inter', 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --plane: #0b0b0b;
    --surface: #191919;
    --surface-2: #212121;
    --surface-3: #2b2b2b;
    --ink: #efefef;
    --ink-2: #9c9c9c;
    --ink-3: #737373;
    --line: rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.18);
    --grid: #303030;
    --axis: #474747;
    --accent: #338ced;
    --accent-ink: #84b9f3;
    --accent-wash: rgba(51, 140, 237, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);

    --s1: #338ced;
    --s2: #e76624;
    --s3: #00a888;
    --s4: #d28e05;
    --o1: #1757ac;
    --o2: #257de0;
    --o3: #519ced;
    --o4: #84b9f3;
    --o5: #cce3fd;
    --pos: #338ced;
    --neg: #eb6263;
    --neutral: #7d7d7d;
    --neutral-2: #4a4a4a;
    --good-ink: #53c556;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--plane);
    -webkit-font-smoothing: antialiased;
    word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-2); }
[hidden] { display: none !important; }

/* ── 뼈대 ─────────────────────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 18px 14px 14px;
    overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--ink); color: var(--surface); font-size: 15px;
}
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--ink-2); margin-top: 2px; }

.nav-group { margin-top: 10px; }
.nav-title {
    padding: 8px 10px 6px; font-size: 11px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.04em;
}
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--ink-2); font-weight: 500;
    transition: background 120ms, color 120ms;
}
.nav-link i { width: 18px; text-align: center; font-size: 13px; opacity: 0.85; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.nav-link.active i { opacity: 1; }

.sidebar-foot { margin-top: auto; padding-top: 16px; }
.synthetic-note {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); padding: 11px 12px; font-size: 12px; color: var(--ink-2); line-height: 1.5;
}
.synthetic-note strong { display: flex; align-items: center; gap: 7px; color: var(--ink); font-size: 12px; margin-bottom: 4px; }
.synthetic-note strong i { color: var(--warning); }
.foot-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 0 2px; }
.foot-meta { font-size: 11px; color: var(--ink-3); }

.icon-btn {
    width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2); cursor: pointer;
    display: inline-grid; place-items: center; transition: background 120ms, color 120ms;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 28px;
    background: color-mix(in srgb, var(--plane) 86%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar .crumb { font-size: 13px; color: var(--ink-2); }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 9px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--surface);
    font-size: 11.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.badge i { font-size: 10px; }
.badge.warn i { color: var(--warning); }

.content { padding: 26px 28px 56px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.page-head p { margin-top: 6px; color: var(--ink-2); max-width: 720px; }

/* ── 필터 줄 ──────────────────────────────────────────────────────────── */
.filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.select, .input {
    height: 34px; padding: 0 30px 0 11px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--surface); min-width: 132px;
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
}
.input { background-image: none; padding-right: 11px; cursor: text; }
.select:focus-visible, .input:focus-visible, .seg button:focus-visible, .icon-btn:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 1px;
}
.seg { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-3); gap: 2px; }
.seg button {
    height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
    color: var(--ink-2); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.btn {
    height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
    background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.88; background: var(--ink); }

/* ── 카드와 격자 ──────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px 20px 18px; min-width: 0; display: flex; flex-direction: column;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.35; }
.card-head p { margin-top: 3px; font-size: 12.5px; color: var(--ink-2); }
.card-tools { display: flex; gap: 6px; flex-shrink: 0; }
.tool-btn {
    height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line);
    background: transparent; color: var(--ink-2); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.tool-btn:hover, .tool-btn[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }
.card-note { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.card-note b { color: var(--ink); font-weight: 600; }
.chart { position: relative; height: 290px; }
.chart.tall { height: 360px; }
.chart.short { height: 220px; }
.chart.map-h { height: 420px; }
.chart-table { max-height: 360px; overflow: auto; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -2px 0 10px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.legend i.dash { height: 0; width: 14px; border-top: 2px dashed; background: none !important; }
.legend i.ring { background: transparent !important; border: 2px solid; border-radius: 50%; }
.legend i.dot { border-radius: 50%; }

/* ── 숫자 타일 ────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 18px; }
.kpi-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi-value { margin-top: 5px; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-left: 3px; letter-spacing: 0; }
.kpi-sub { margin-top: 5px; font-size: 12px; color: var(--ink-2); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical); }

/* ── 결론 영역 ────────────────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; margin-bottom: 16px; }
.hero-figure { justify-content: space-between; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.hero-number { font-size: 52px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; margin-top: 10px; }
.hero-number small { font-size: 20px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-left: 4px; }
.hero-text { margin-top: 12px; font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.hero-text b { color: var(--ink); font-weight: 600; }
.bounds { margin-top: 20px; display: grid; gap: 10px; }
.bound { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.bound i { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); }
.bound .t { font-size: 12px; color: var(--ink-2); }
.bound .v { font-weight: 600; }
.bound .n { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }

.findings { display: grid; gap: 0; counter-reset: f; }
.finding { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.finding:first-child { border-top: 0; padding-top: 2px; }
.finding::before {
    counter-increment: f; content: counter(f);
    width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line);
    display: grid; place-items: center; font-size: 12px; font-weight: 650; color: var(--ink-2);
}
.finding h4 { font-size: 14px; font-weight: 600; }
.finding p { margin-top: 2px; font-size: 13px; color: var(--ink-2); }
.finding a { color: var(--accent-ink); font-weight: 600; white-space: nowrap; }

/* ── 표 ───────────────────────────────────────────────────────────────── */
.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 9px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data thead th {
    position: sticky; top: 0; z-index: 1; background: var(--surface-2);
    font-size: 12px; font-weight: 600; color: var(--ink-2);
}
table.data th.r, table.data td.r { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.selected { background: var(--accent-wash); }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--ink); }
table.data th .arrow { margin-left: 4px; font-size: 9px; opacity: 0.7; }
table.data td.wrap { white-space: normal; min-width: 220px; }
.plain td, .plain th { border-bottom: 1px solid var(--line); }
.chip {
    display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
.chip.ok { color: var(--good-ink); }
.chip.bad { color: var(--critical); }
.chip i { font-size: 9px; }
.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-cell .track { display: block; flex-shrink: 0; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar-cell .fill { display: block; height: 100%; border-radius: 3px; background: var(--s1); }
.comp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }

/* ── 히트맵 ───────────────────────────────────────────────────────────── */
.heatmap { display: grid; gap: 2px; font-size: 11.5px; color: var(--ink-2); align-items: center; }
.heatmap .hm-cell { height: 30px; border-radius: 4px; }
.heatmap .hm-head { text-align: center; font-variant-numeric: tabular-nums; }
.heatmap .hm-row { padding-right: 8px; text-align: right; font-weight: 600; }
.hm-scale { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 11.5px; color: var(--ink-2); }
.hm-scale .steps { display: flex; gap: 2px; }
.hm-scale .steps i { width: 22px; height: 10px; border-radius: 2px; display: block; }

/* ── 시뮬레이터 ───────────────────────────────────────────────────────── */
.sim { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { position: sticky; top: 72px; }
.panel h3 { font-size: 13px; font-weight: 650; margin-bottom: 10px; }
.panel .field { margin-bottom: 14px; }
.panel .select { width: 100%; }
.panel hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.slider-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.slider-row label { color: var(--ink-2); font-weight: 600; font-size: 11.5px; }
.slider-row output { font-weight: 650; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 6px 0 2px; }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.radio-list { display: grid; gap: 6px; }
.radio {
    display: grid; grid-template-columns: 16px 1fr; gap: 9px; align-items: start; padding: 9px 10px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer;
}
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.radio input { margin: 3px 0 0; accent-color: var(--accent); }
.radio b { font-size: 13px; font-weight: 600; display: block; }
.radio span { font-size: 11.5px; color: var(--ink-2); }
.store-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: 12px; }
.store-facts dt { color: var(--ink-2); }
.store-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.reco { display: grid; grid-template-columns: minmax(0, 1.25fr) repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; margin-bottom: 16px; }
.reco > div { padding: 18px 20px; border-left: 1px solid var(--line); }
.reco > div:first-child { border-left: 0; background: var(--surface-2); }
.reco .big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; }
.reco .big small { font-size: 15px; color: var(--ink-2); font-weight: 600; margin-left: 3px; }
.reco .mid { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; margin-top: 6px; }
.reco .mid small { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-left: 2px; }
.reco p { font-size: 12px; color: var(--ink-2); margin-top: 5px; }

/* ── 거리별 최적 할인 ─────────────────────────────────────────────────── */
.num-field { display: grid; grid-template-columns: 1fr 116px; gap: 10px; align-items: center; margin-bottom: 9px; }
.num-field label { font-size: 12.5px; color: var(--ink-2); }
.num-field label small { display: block; font-size: 11px; color: var(--ink-3); }
.num-field .unit { position: relative; }
.num-field .unit::after { content: attr(data-unit); position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink-3); pointer-events: none; }
.num-field input { width: 100%; min-width: 0; text-align: right; padding-right: 26px; font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 5px 0; color: var(--ink-2); }
.calc-line b { color: var(--ink); font-variant-numeric: tabular-nums; }
.calc-line.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; }
.answers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; margin-bottom: 16px; }
.answer { padding: 20px 22px; border-left: 1px solid var(--line); }
.answer:first-child { border-left: 0; }
.answer .q { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.answer .q i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.answer .x { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px; }
.answer .x small { font-size: 16px; color: var(--ink-2); font-weight: 600; margin-left: 3px; letter-spacing: 0; }
.answer p { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.answer p b { color: var(--ink); font-weight: 600; }
.formula { font-family: var(--mono); font-size: 13px; line-height: 1.9; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; white-space: nowrap; }
.formula .k { color: var(--ink-2); font-family: var(--font); font-size: 12px; font-weight: 600; display: inline-block; min-width: 86px; }
.formula b { font-weight: 700; }
.question { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.question h4 { font-size: 14px; font-weight: 650; }
.question p { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.question table { margin-top: 10px; }
.question table.data th, .question table.data td { padding: 7px 8px; }
.question .excluded td { color: var(--ink-3); text-decoration: line-through; }
@media (max-width: 900px) {
    .answers { grid-template-columns: 1fr; }
    .answer { border-left: 0; border-top: 1px solid var(--line); }
    .answer:first-child { border-top: 0; }
}

/* ── 데이터 화면 ──────────────────────────────────────────────────────── */
.data-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.table-list { display: grid; gap: 2px; padding: 8px; }
.table-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%; }
.table-item:hover { background: var(--surface-2); }
.table-item.active { background: var(--accent-wash); }
.table-item b { font-size: 13px; font-weight: 600; display: block; }
.table-item > span { min-width: 0; }
.table-item span span { display: block; font-size: 11px; color: var(--ink-2); font-family: var(--mono); }
.table-item em { font-style: normal; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.pager .group { display: flex; align-items: center; gap: 6px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { height: 34px; padding: 0 12px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ── 말풍선 ───────────────────────────────────────────────────────────── */
.tip {
    position: fixed; z-index: 100; pointer-events: none; max-width: 280px;
    background: var(--ink); color: var(--surface); border-radius: 9px; padding: 9px 11px;
    font-size: 12px; line-height: 1.5; box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0; transform: translateY(4px); transition: opacity 100ms, transform 100ms;
}
.tip.show { opacity: 1; transform: none; }
.tip b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; }
.tip .row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.error-box { padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--critical); color: var(--critical); background: var(--surface); margin-bottom: 16px; }
.empty { padding: 40px 0; text-align: center; color: var(--ink-2); }

.scrim { display: none; }

/* ── 좁은 화면 ────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
    .col-3 { grid-column: span 6; }
    .col-4, .col-5, .col-7, .col-8 { grid-column: span 12; }
    .col-6 { grid-column: span 12; }
    .hero { grid-template-columns: 1fr; }
    .sim { grid-template-columns: 1fr; }
    .panel { position: static; }
    .reco { grid-template-columns: 1fr 1fr; }
    .reco > div:nth-child(odd) { border-left: 0; }
    .reco > div:nth-child(n+3) { border-top: 1px solid var(--line); }
    .data-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(82vw, 280px); z-index: 60;
        transform: translateX(-100%); transition: transform 200ms ease;
    }
    body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,0.3); }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,0.4); }
    .menu-btn { display: inline-grid; }
    .topbar { padding: 0 16px; }
    .content { padding: 18px 16px 48px; }
    .page-head h1 { font-size: 21px; }
    .col-3 { grid-column: span 12; }
    .hero-number { font-size: 42px; }
    .badge.hide-sm { display: none; }
    .reco { grid-template-columns: 1fr; }
    .reco > div { border-left: 0; border-top: 1px solid var(--line); }
    .reco > div:first-child { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── 지도 화면 ────────────────────────────────────────────────────────── */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 16px; align-items: stretch; }
.map-card { padding: 0; overflow: hidden; position: relative; min-height: 640px; height: calc(100vh - 250px); }
.leaflet-map { position: absolute; inset: 0; background: var(--surface-2); font-family: var(--font); z-index: 0; }
.map-legend {
    position: absolute; right: 14px; top: 14px; z-index: 5; max-width: 300px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px);
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow);
    font-size: 12px; color: var(--ink-2);
}
.map-legend b { display: block; color: var(--ink); font-size: 12px; margin-bottom: 6px; }
.map-legend .legend { margin: 0; flex-direction: column; gap: 4px; }
.map-legend .size-note { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 11.5px; }
.map-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; height: calc(100vh - 250px); min-height: 640px; }
.map-side .card { overflow: auto; }
.map-side .card.grow { flex: 1; min-height: 0; }
.store-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.store-head .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.verdict { margin-top: 14px; padding: 12px 13px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--v, var(--neutral)); }
.verdict b { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.verdict b i { color: var(--v, var(--neutral)); font-size: 12px; }
.verdict p { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.cmp { margin-top: 16px; display: grid; gap: 9px; }
.cmp-title { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cmp-row { display: grid; grid-template-columns: 104px 1fr 64px; gap: 10px; align-items: center; font-size: 12.5px; }
.cmp-row .lbl { color: var(--ink-2); }
.cmp-row .val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.cmp-track { height: 12px; border-radius: 3px; background: var(--surface-2); position: relative; }
.cmp-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; min-width: 2px; }
.side-facts { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-facts dt { font-size: 11.5px; color: var(--ink-2); }
.side-facts dd { margin: 1px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.side-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.rank-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 8px 6px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.rank-item:first-child { border-top: 0; }
.rank-item:hover { background: var(--surface-2); }
.rank-item i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.rank-item b { font-weight: 600; font-size: 13px; display: block; }
.rank-item span { font-size: 11.5px; color: var(--ink-2); }
.rank-item em { font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }

.ring-chip {
    transform: translate(-50%, -50%); white-space: nowrap; display: inline-block;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 9px;
    font: 600 11.5px var(--font); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.ring-chip span { color: var(--ink-2); font-weight: 500; }
.origin-pin {
    transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    background: var(--ink); color: var(--surface); border-radius: 999px; padding: 4px 10px 4px 8px;
    font: 600 12px var(--font); box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.leaflet-container a { color: var(--accent-ink); }
.leaflet-tooltip.store-tip {
    background: var(--ink); color: var(--surface); border: 0; border-radius: 9px; padding: 8px 10px;
    font: 500 12px/1.5 var(--font); box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.leaflet-tooltip.store-tip::before { display: none; }
.leaflet-tooltip.store-tip b { display: block; font-size: 12.5px; }
.leaflet-control-attribution { font-size: 10px !important; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--ink-2) !important; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
/* 배경은 한 걸음 물러나게: 채도를 낮춰 가게 점이 먼저 읽히게 한다 */
.leaflet-tile-pane { filter: saturate(0.45) contrast(0.94) brightness(1.03); }
html[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) saturate(0.35) brightness(0.92) contrast(0.88); }
.mini-map { position: relative; height: 420px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }

@media (max-width: 1180px) {
    .map-layout { grid-template-columns: 1fr; }
    .map-card { height: 62vh; min-height: 440px; }
    .map-side { height: auto; min-height: 0; }
}

/* ── 설명 말풍선과 안내 창 ────────────────────────────────────────────── */
.help-tip {
    position: fixed; z-index: 3000; width: max-content; max-width: min(340px, calc(100vw - 16px));
    padding: 10px 13px; border-radius: 10px; pointer-events: none;
    background: var(--ink); color: var(--surface); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    font-size: 12.5px; font-weight: 400; line-height: 1.6; text-wrap: pretty; white-space: pre-line;
}
.help-tip[hidden] { display: none; }
[data-tooltip]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h3.has-info { cursor: help; }
h3.has-info::after, .kpi.has-info .kpi-label::after {
    content: 'i'; display: inline-grid; place-items: center; width: 14px; height: 14px; margin-left: 6px;
    border-radius: 50%; border: 1px solid var(--line-strong); color: var(--ink-3);
    font: 600 9.5px/1 var(--font); vertical-align: 2px; font-style: normal;
}
.kpi.has-info { cursor: help; }
table.data th[data-tooltip] { text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px; cursor: help; }
.help-overlay { position: fixed; inset: 0; z-index: 2500; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; padding: 20px; }
.help-dialog { width: min(680px, 100%); max-height: min(82vh, 760px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3); }
.help-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.help-head h2 { font-size: 16px; font-weight: 700; margin: 0; }
.help-head p { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.help-list { margin: 0; padding: 6px 20px 16px; overflow-y: auto; }
.help-list > div { display: grid; grid-template-columns: 170px 1fr; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.help-list > div:first-child { border-top: 0; }
.help-list dt { font-weight: 600; font-size: 13px; }
.help-list dd { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
@media (max-width: 640px) { .help-list > div { grid-template-columns: 1fr; gap: 3px; } }
