:root {
    --bg:           #f2f2f7;    /* iOS grouped background */
    --card:         #ffffff;    /* card / list background */
    --text:         #1a1a1a;
    --muted:        #6b7280;
    --border:       #d1d1d6;    /* iOS separator */
    --accent:       #007AFF;    /* iOS blue */
    --accent-bg:    #e8f4ff;
    --danger:       #FF3B30;    /* iOS red */
    --danger-bg:    #fff2f2;
    --success:      #34C759;    /* iOS green */
    --success-bg:   #f0fdf4;
    --warn:         #FF9500;    /* iOS orange */
    --warn-bg:      #fff8ec;
    --radius:       10px;
    --max-w:        520px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* HIG type scale
   Large Title  34px 700   — page-level title (auth card h1)
   Title 1      28px 700   — major section heading
   Title 2      22px 700   — subsection heading
   Headline     17px 600   — list row label, button
   Body         17px 400   — default prose
   Subhead      15px 400   — secondary row label, caption
   Footnote     13px 400   — section header, helper text
   Caption      12px 400   — timestamp, fine print          */

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.47;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 16px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

header {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.app-name {
    font-weight: 700;
    font-size: 17px;          /* Headline — compact nav bar title */
    letter-spacing: -0.2px;
    color: var(--text);
    text-decoration: none;
}

.nav-link {
    color: var(--accent);     /* HIG: nav actions use accent colour */
    text-decoration: none;
    font-size: 17px;          /* Body */
    padding: 6px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-link:hover { opacity: 0.75; }

/* Logout is a POST button styled as a nav link (GET logout fires on prefetch). */
.nav-btn {
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 17px;          /* Headline */
    font-weight: 600;
    letter-spacing: -0.2px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    min-height: 44px;
    width: 100%;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary  { background: var(--accent); color: #fff; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-size: 13px;          /* Footnote */
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    color: var(--muted);
}

input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 17px;          /* Body */
    min-height: 44px;
    background: var(--card);
    color: var(--text);
}

input[type="text"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: transparent;
}

/* ── Messages ────────────────────────────────────────────────────────────── */

.msg {
    padding: 12px;
    border-radius: var(--radius);
    font-size: 15px;          /* Subhead */
    margin-bottom: 16px;
    display: none;
}

.msg.visible { display: block; }
.msg-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #fecaca; }

/* ── Login page ──────────────────────────────────────────────────────────── */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 360px;
    text-align: center;
    background: var(--card);
    border-radius: 16px;
    padding: 32px 24px;
}

.auth-card h1 {
    font-size: 34px;          /* Large Title */
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.18;
    margin-bottom: 8px;
}

.auth-card .subtitle {
    color: var(--muted);
    margin-bottom: 32px;
    font-size: 17px;          /* Body */
    line-height: 1.47;
}

.auth-card .form-group { text-align: left; }


/* ── Category tree ───────────────────────────────────────────────────────── */

.tree {
    list-style: none;
    margin-top: 8px;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
}

/* Home category filter (PRD §4.1) — contracted pill, expands on focus/typing */
.cat-search { margin: 4px 0 8px; }
.cat-filter {
    width: 46%;
    max-width: 100%;
    padding: 12px 14px;        /* ≥44px tap target (PRD §8) */
    font-size: 15px;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: width .18s ease;
}
.cat-filter:focus,
.cat-filter:not(:placeholder-shown) { width: 100%; outline: none; border-color: var(--accent); }
.cat-search-none { margin: 10px 4px; color: var(--muted); font-size: 15px; }
/* explicit: .leaf/.branch set display, so [hidden] alone wouldn't hide them */
.leaf[hidden], details.branch[hidden] { display: none; }

details.branch { border-bottom: 0.5px solid var(--border); }
details.branch:last-child { border-bottom: none; }

details.branch > summary {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 17px;          /* Headline */
    list-style: none;
    user-select: none;
    gap: 10px;
    background: var(--card);
}

summary { list-style: none; }
summary::-webkit-details-marker { display: none; }

.branch-arrow {
    width: 16px;
    height: 16px;
    color: var(--muted);
    transition: transform 0.15s;
    flex-shrink: 0;
}

details.branch[open] .branch-arrow { transform: rotate(90deg); }

.subtree {
    list-style: none;
    padding-left: 16px;
    border-top: 0.5px solid var(--border);
}

.leaf {
    display: flex;
    align-items: center;
    padding: 12px 16px 12px 0;
    gap: 14px;
}
.leaf + .leaf { border-top: 0.5px solid var(--border); }

.leaf-label {
    flex: 1;
    font-size: 17px;          /* Body */
    cursor: pointer;
    color: var(--text);
    font-weight: 400;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */

.toggle {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.toggle input:checked ~ .track { background: var(--accent); }

.thumb {
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    transition: transform 0.15s;
}

.toggle input:checked ~ .thumb { transform: translateX(18px); }

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty {
    text-align: center;
    padding: 48px 0;
    color: var(--muted);
    font-size: 17px;          /* Body */
    line-height: 1.8;
}

.empty a { color: var(--accent); text-decoration: none; }

/* ── Bottom bar ──────────────────────────────────────────────────────────── */

.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 10;
}

.bottom-bar .container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.basket-info {
    flex: 1;
    font-size: 15px;          /* Subhead */
    color: var(--muted);
}

.bottom-bar .btn { width: auto; padding: 10px 20px; }

/* ── Main content spacing ────────────────────────────────────────────────── */

main.container { padding-top: 16px; padding-bottom: 96px; }

/* ── Settings: category admin ────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0 4px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;           /* Title 2 */
    font-weight: 700;
    letter-spacing: -0.3px;
}

.add-details-top { margin-bottom: 4px; }


.add-form-top { margin-top: 12px; }

.add-form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.add-name-input  { flex: 1; min-width: 140px; padding: 6px 10px; font-size: 15px; min-height: 36px; }
.add-parent-select {
    flex: 1;
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    min-height: 36px;
    background: var(--card);
    color: var(--text);
}

.acat-tree { margin-top: 0; }

.acat-row { border-bottom: 0.5px solid var(--border); }
.acat-row:last-child { border-bottom: none; }

.acat-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    gap: 8px;
    flex-wrap: wrap;            /* actions wrap below instead of clipping past the card */
}

.acat-icon {
    width: 16px;
    text-align: center;
    color: var(--muted);
    flex-shrink: 0;
    font-size: 13px;
}

.acat-name { flex: 1 1 auto; min-width: 45%; font-size: 17px; }   /* floor keeps the name on one line; long action sets wrap to a new row */

.acat-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    row-gap: 4px;
}

.acat-actions form, .prod-actions form { display: contents; }

.acat-children { padding-left: 24px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: var(--muted);
    padding: 0;
}

.btn-icon:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
}

.btn-link-danger { color: var(--danger); }
.btn-link:hover  { opacity: 0.75; }

.rename-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 8px 16px;
    flex-wrap: wrap;
}

.rename-form input[type="text"] {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 15px;
    min-height: 36px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 15px;
    min-height: 36px;
    width: auto;
}

/* ── Product approved list ───────────────────────────────────────────────── */


.prod-list { margin-top: 0; }

.prod-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 0.5px solid var(--border);
}
.prod-row:last-child { border-bottom: none; }

.prod-priority {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.prod-info  { flex: 1; min-width: 0; }

.prod-brand {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.prod-name {
    display: block;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prod-meta {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
}

.prod-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* ── Product search ──────────────────────────────────────────────────────── */

.search-section { margin-top: 28px; }

.scan-row { display: flex; gap: 8px; }
.scan-row input { flex: 1; }

.btn-scan {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-scan:active { opacity: 0.75; }

.scan-view {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.scan-view video {
    width: 100%;
    max-height: 220px;
    border-radius: var(--radius);
    object-fit: cover;
    display: block;
    background: #000;
}

.prod-results { margin-top: 8px; }

.prod-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.prod-result.prod-added { opacity: 0.45; }

.prod-result-info          { flex: 1; min-width: 0; }
.prod-result-info .prod-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.prod-added-badge {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    padding: 4px 8px;
    flex-shrink: 0;
}

/* ── Settings tab nav — iOS segmented control ────────────────────────────── */

.settings-nav {
    display: flex;
    background: rgba(116,116,128,0.12);
    border-radius: 9px;
    padding: 2px;
    margin-bottom: 20px;
}

.settings-nav a {
    flex: 1;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
    border-radius: 7px;
    text-align: center;
    border-bottom: none;
    margin-bottom: 0;
}

.settings-nav a.active {
    background: var(--card);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04);
}
.settings-nav a:hover:not(.active) { opacity: 0.7; }

/* ── Results page ────────────────────────────────────────────────────────── */

.res-group-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
}
.res-group-tab {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 15px;
    text-decoration: none;
    color: var(--muted);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.res-group-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.res-group-single {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}

/* ── /results — segmented frontier + receipt breakdown (PRD §4.2) ──────────
   Frontier = a segmented stop-count switcher; each segment links to ?plan=k
   and the receipt below breaks that plan down. The tiny tinted markers
   (stock-up / skupo / role / override) all share one .chip base.           */

.section-label {
    text-transform: uppercase; letter-spacing: 0.06em;
    font-size: 11px; color: var(--muted);
    margin: 8px 0 6px;
}

/* Segmented stop-count switcher */
.seg {
    display: flex;
    background: var(--card);
    border: 0.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.seg-opt {
    flex: 1;
    padding: 11px 8px;
    text-align: center;
    border-left: 0.5px solid var(--border);
    text-decoration: none;
    color: var(--text);
}
.seg-opt:first-child { border-left: 0; }
.seg-opt.sel-on { background: var(--accent-bg); }
.seg-opt .s { display: block; font-size: 12px; color: var(--muted); font-weight: 600; line-height: 1.3; }
.seg-opt.sel-on .s { color: var(--accent); }
.seg-opt .e { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 3px 0; }
.seg-opt .c { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-opt .c.part { color: var(--warn); font-weight: 600; }
.seg-best {
    display: inline-block; margin-top: 2px;
    padding: 0 6px; border-radius: 999px;
    background: var(--success); color: #fff;
    font-size: 10px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.plan-saving {
    text-align: center; font-size: 12px; color: var(--muted);
    margin: 8px 0 4px; line-height: 1.5;
}
.save-amt { color: var(--success); font-weight: 600; }

/* Truncated (not-worth-it) plans */
.fr-disclosure {
    background: #f9f9fb;
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    margin-top: 8px;
    overflow: hidden;
}
.fr-disclosure > summary {
    cursor: pointer; user-select: none;
    padding: 10px 16px; color: var(--muted); font-size: 12px;
    list-style: none;
}
.fr-disclosure > summary::-webkit-details-marker { display: none; }
.fr-hidden-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 8px 16px; font-size: 12px; color: var(--muted);
    border-top: 0.5px solid var(--border);
}
.fr-hidden-tot { font-variant-numeric: tabular-nums; }

/* ── Receipt (selected plan breakdown, collapsible via default_expanded) ── */

.rcpt {
    background: var(--card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.rcpt-summary {
    display: flex; align-items: baseline;
    padding: 14px 16px; cursor: pointer; user-select: none;
    list-style: none;
    font-size: 14px; font-weight: 500;
}
.rcpt-summary::-webkit-details-marker { display: none; }
.rcpt-summary::before {
    content: "▸"; color: var(--muted); margin-right: 8px;
    transition: transform 120ms;
}
.rcpt[open] > .rcpt-summary::before { transform: rotate(90deg); }
.rcpt-summary-tot { margin-left: auto; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }

.store-block { border-top: 1.5px dashed var(--border); }
.store-block:first-of-type { border-top: 0; }
.rhead {
    display: flex; align-items: baseline; gap: 8px;
    padding: 12px 16px 8px;
    background: var(--bg);
    flex-wrap: wrap;
}
.rhead-name { font-weight: 700; font-size: 15px; }
.rhead-meta { color: var(--muted); font-size: 12px; min-width: 0; }
.rhead-tot  { margin-left: auto; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

.item {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    padding: 8px 16px;
    border-top: 0.5px solid var(--border);
    align-items: baseline;
}
.item-line  { font-size: 14px; line-height: 1.5; }
.item-link  { color: inherit; text-decoration: none; }
.item-link:hover { text-decoration: underline; }
.item-right { text-align: right; }
.item-price { font-variant-numeric: tabular-nums; font-weight: 700; }
.item-unit  { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Narrow-win aggregation line (PRD §4.2) */
.agg {
    padding: 8px 16px 10px;
    font-size: 12px; color: var(--muted); font-style: italic;
    border-top: 0.5px solid var(--border);
}
.agg-names { font-size: 11px; }

/* ── Enhanced zero-JS swap selector (PRD §3.3) ──────────────────────────── */
.swap { grid-column: 1 / -1; margin-top: 5px; }
.swap > summary {
    list-style: none; cursor: pointer;
    color: var(--accent); font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 0;
}
.swap > summary::-webkit-details-marker { display: none; }
.swap > summary::after { content: "▾"; font-size: 11px; transition: transform 150ms; }
.swap[open] > summary::after { transform: rotate(180deg); }
.opts { display: flex; flex-direction: column; gap: 5px; margin: 7px 0 4px; }
.opt {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: 12px; align-items: center;
    width: 100%; min-height: 44px;
    padding: 10px 14px; border-radius: 10px;
    background: var(--bg); border: 1.5px solid transparent;
    font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.opt:active { background: var(--border); }
.opt.cur { background: var(--accent-bg); border-color: var(--accent); cursor: default; }
.opt .rd { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--muted); flex-shrink: 0; }
.opt.cur .rd { border-color: var(--accent); background: radial-gradient(var(--accent) 42%, transparent 47%); }
.opt-nm { font-size: 14px; min-width: 0; }
.opt .op { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.swap-reset {
    width: 100%; min-height: 44px;
    padding: 10px 14px; border: 0; border-radius: 10px;
    background: var(--warn-bg); color: var(--warn);
    font: inherit; font-weight: 600; cursor: pointer; text-align: left;
}

/* ── Tiny tinted chips — one base; markers, role, override, drill all reuse ─ */
.chip {
    display: inline-flex; align-items: center;
    margin-left: 6px; padding: 1px 6px;
    border-radius: 6px;
    font-size: 11px; font-weight: 600;
    vertical-align: 1px; white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.chip-stock { background: var(--success-bg); color: var(--success); }
.chip-cheap { background: var(--success-bg); color: var(--success); }
.chip-wait  { background: var(--warn-bg);    color: var(--warn); }
.chip-ovr   { background: var(--accent-bg);  color: var(--accent); }
.arr { margin-left: 5px; font-size: 13px; font-weight: 600; }
.arr-up   { color: var(--danger); }
.arr-dn   { color: var(--success); }
.arr-flat { color: var(--muted); }

/* ── Per-basket alternatives — shared with drill-down (PRD §3.2, §3.3) ──── */
.alt-row {
    display: grid; grid-template-columns: 1fr auto auto;
    column-gap: 10px; align-items: center;
    padding: 5px 8px; min-height: 44px;
    background: var(--bg); border-radius: var(--radius);
}
.alt-name    { font-size: 12px; min-width: 0; }
.alt-price   { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.alt-use {
    border: 0; background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 600;
    padding: 8px 12px; border-radius: 6px; cursor: pointer; min-height: 36px;
}
.alt-use:hover  { opacity: 0.85; }
.alt-reset      { background: var(--warn-bg); }
.alt-reset .alt-use { background: var(--muted); }
.alt-current    { outline: 1px solid var(--accent); }
.alt-cur-tag    { font-size: 11px; color: var(--accent); margin-left: 4px; }
.drill-price-col { text-align: right; }

.ovr-bar {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin: 12px 0; padding: 8px 14px; border-radius: var(--radius);
    background: var(--accent-bg); color: var(--accent);
    font-size: 13px; font-weight: 500;
}
.ovr-bar button {
    border: 0; background: var(--accent); color: #fff;
    font-size: 12px; font-weight: 600;
    padding: 8px 14px; border-radius: 6px; cursor: pointer; min-height: 36px;
}
.ovr-bar button:hover { opacity: 0.85; }

.plan-missing {
    padding: 10px 16px;
    background: var(--warn-bg); color: var(--warn);
    font-size: 12px; border-top: 0.5px solid var(--border);
}

.res-unavailable {
    margin: 12px 0; padding: 10px 14px;
    background: var(--warn-bg); color: var(--warn);
    border: 0.5px solid var(--border); border-radius: var(--radius);
    font-size: 13px;
}

.plan-explainer {
    margin-top: 20px;
    background: #f9f9fb; border: 0.5px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px;
    font-size: 12px; color: var(--muted); line-height: 1.5;
}

/* ── /settings/plan — tunable knobs form ───────────────────────────────── */
.plan-form { display: flex; flex-direction: column; gap: 18px; max-width: 480px; }
.plan-field { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.plan-field-label { font-weight: 500; font-size: 14px; }
.plan-field-help  { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.5; }
.plan-field input[type="number"] {
    grid-column: 2; min-width: 100px;
    padding: 6px 8px; border: 0.5px solid var(--border); border-radius: 6px;
    font: inherit; font-variant-numeric: tabular-nums;
    text-align: right;
}
.plan-field-bool { grid-template-columns: auto 1fr; align-items: center; }
.plan-field-bool .plan-field-label { grid-column: 2; }
.plan-field-bool input[type="checkbox"] { grid-column: 1; }

/* ── Grouped card ──────────────────────────────────────────────────────────── */

.grouped {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.grouped-label {
    font-size: 13px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-top: 24px;
    margin-bottom: 6px;
    padding: 0 4px;
}

/* ── Status page list rows ──────────────────────────────────────────────────── */

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}
.status-row + .status-row { border-top: 0.5px solid var(--border); }
.status-row-name { font-size: 15px; font-weight: 500; }

.status-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 16px;
    font-size: 15px;
}
.status-kv + .status-kv { border-top: 0.5px solid var(--border); }
.status-kv-val { font-weight: 600; font-variant-numeric: tabular-nums; }

.age-fresh { color: var(--success); font-weight: 600; }
.age-ok    { color: var(--muted); }
.age-stale { color: var(--danger); font-weight: 600; }

.dots { letter-spacing: 2px; font-size: 13px; }
.dot-ok   { color: var(--success); }
.dot-none { color: var(--border); }

/* ── Utilities ───────────────────────────────────────────────────────────── */

.text-muted  { color: var(--muted); font-size: 15px; }  /* Subhead */
.text-fine   { color: var(--muted); font-size: 13px; }  /* Footnote */

/* ── Drill-down ──────────────────────────────────────────────────────────── */

.drill-store {
    padding: 12px 16px;
    border-top: 0.5px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.drill-store:first-child { border-top: 0; }
.drill-store-name { font-weight: 600; }
.drill-store-meta { font-size: 13px; color: var(--muted); }
.drill-store-price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.drill-store-sparkline { line-height: 0; }

/* ── Disk-pressure banner ────────────────────────────────────────────────── */

.disk-banner {
    margin: 8px 0 16px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.4;
    border: 0.5px solid var(--border);
}
.disk-banner-warn     { background: var(--warn-bg);   color: var(--warn); }
.disk-banner-critical { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
