/* Bistouri web logger. Phone-first (360–412 px), plain CSS.
   Colour and type tokens are the dashboard's (dashboard/styles.css); keep them in step. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #f0f4f3;
  --border: #dfe5e3;
  --border-strong: #c5cfcc;

  --ink: #14201e;
  --ink-2: #4a5755;
  --ink-3: #66726f;

  --brand: #0f766e;
  --brand-strong: #0b5e58;
  --brand-ink: #0f766e;
  --brand-soft: #e2f2ef;
  --accent: #f9735b;
  --accent-soft: #fdebe6;
  --accent-ink: #b8432d;

  --warn: #a45a06;
  --warn-soft: #fcf0dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --gold: #a5560a;
  --gold-soft: #fdf1dc;

  /* Progress rings and the achievement panels (Theme.swift) */
  --ring-1: #0f766e;
  --ring-2: #f9735b;
  --ring-3: #6366f2;
  --ring-4: #f59e0b;
  --amber: #f59e0b;
  --panel: #0f1714;
  --panel-ink: #ffffff;
  --panel-mint: #59d9bf;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 30, .05), 0 1px 1px rgba(16, 32, 30, .03);
  --shadow-lg: 0 18px 50px rgba(16, 32, 30, .25);
  --bar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1312;
    --surface: #141c1b;
    --surface-2: #1e2928;
    --border: #283432;
    --border-strong: #3a4845;

    --ink: #e6eeec;
    --ink-2: #aab7b4;
    --ink-3: #8b9895;

    --brand: #0f766e;
    --brand-strong: #13877e;
    --brand-ink: #5ec4b8;
    --brand-soft: #16332f;
    --accent: #f9735b;
    --accent-soft: #3a211b;
    --accent-ink: #ff9a85;

    --warn: #f0b35a;
    --warn-soft: #33281a;
    --bad: #ff8a7d;
    --bad-soft: #3a1d1a;
    --gold: #f5a524;
    --gold-soft: #33281a;

    --ring-1: #3fb2a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font: 16px/1.45 var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--brand-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.icon { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.err { color: var(--bad); font-size: 13px; }
.ok-text { color: var(--brand-ink); font-size: 13px; }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
[hidden] { display: none !important; }

.boot { display: grid; place-items: center; gap: 14px; min-height: 70vh; color: var(--ink-3); padding: 24px; text-align: center; }

/* ---------- Layout ---------- */
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  min-height: 52px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 17px; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .left { justify-self: start; display: flex; gap: 4px; align-items: center; }
.topbar .right { justify-self: end; display: flex; gap: 4px; align-items: center; }
.big-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; padding: 6px 16px 2px; }

.content { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 16px calc(var(--bar-h) + 104px + env(safe-area-inset-bottom)); }
.content.form { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* Bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); text-decoration: none; font-size: 11.5px; font-weight: 600;
}
.tabbar a.active { color: var(--brand-ink); }

/* Floating action bar above the tab bar (Log case / Repeat) and the form's save bar */
.actionbar {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: 18px 16px 10px;
  background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}
.actionbar .inner, .savebar .inner { max-width: 528px; margin: 0 auto; display: flex; gap: 12px; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; min-height: 54px; font-size: 17px; font-weight: 700; border-radius: 16px; }
.btn-primary:active:not(:disabled) { background: var(--brand-strong); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #1b1300; }
.btn-secondary { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); min-height: 48px; }
.btn-danger { color: var(--bad); border-color: transparent; background: var(--bad-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; }
.btn-icon { min-width: 44px; padding: 0 10px; }
.btn-repeat {
  flex: none; width: 76px; flex-direction: column; gap: 0; min-height: 56px; border-radius: 16px;
  background: var(--surface); border-color: var(--border); color: var(--brand-ink); font-size: 12px; font-weight: 700;
}
.btn-log { flex: 1; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 35%, transparent); }
.link { border: 0; background: none; padding: 6px 0; color: var(--brand-ink); font-weight: 600; font-size: 15px; }
.link.danger { color: var(--bad); }
.toplink { border: 0; background: none; padding: 8px 6px; color: var(--brand-ink); font-size: 16px; font-weight: 500; }
.toplink.strong { font-weight: 700; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.card-head .icon { color: var(--brand-ink); }
.card-head .acc { margin-left: auto; font-weight: 500; font-size: 14px; color: var(--ink-3); }
.hint { font-size: 13px; color: var(--ink-3); }
.sub-head { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Inputs ---------- */
.field { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; background: var(--surface-2); font-size: 16px; }
.field:focus { outline: none; border-color: var(--brand-ink); background: var(--surface); }
.field.invalid { border-color: var(--bad); }
select.field { appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366726f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9l5-5 5 5M7 15l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
select.field.placeholder { color: var(--ink-3); }
.field.num-input { width: 104px; text-align: right; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.code-input { text-align: center; font-size: 30px; font-weight: 700; letter-spacing: .25em; font-variant-numeric: tabular-nums; }
label.lbl { font-weight: 600; font-size: 15px; }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .field { padding-left: 40px; }

/* Toggle switch */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* One sideways-scrolling row that bleeds to the screen edges (procedure picker). */
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 10px 16px 0; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 99px; border: 1px solid transparent; background: var(--surface-2); font-size: 15px; font-weight: 600; text-align: left;
}
.chip.large { min-height: 48px; padding: 10px 18px; font-size: 16px; }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; }
.chip.coral[aria-pressed="true"] { background: var(--accent); color: #fff; }
.chip .icon { color: var(--ink-3); }
.chip.fav .icon { color: var(--accent); }
.token { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; font-size: 15px; }
.token button { border: 0; background: none; color: inherit; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; }

/* ---------- Task rows ---------- */
.tasklist { display: flex; flex-direction: column; }
.taskrow { display: flex; align-items: center; gap: 10px; min-height: 52px; border-bottom: 1px solid var(--border); }
.taskrow:last-child { border-bottom: 0; }
.taskrow .tick { flex: 1; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 8px 0; text-align: left; min-height: 48px; font-size: 16px; }
.tickmark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: #fff; }
[aria-pressed="true"] > .tickmark, .tickmark.on { background: var(--brand); border-color: var(--brand); }
.stepper { display: flex; align-items: center; background: var(--brand-soft); border-radius: 99px; color: var(--brand-ink); }
.stepper button { width: 44px; height: 44px; border: 0; background: none; color: inherit; font-size: 22px; font-weight: 700; line-height: 1; }
.stepper output { min-width: 26px; text-align: center; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; color: var(--ink); }
.section-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; border: 0; background: none; padding: 0; text-align: left; font-weight: 650; font-size: 15px; }
.section-toggle .chev { transition: transform .15s; color: var(--ink-3); }
.section-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.section-toggle .count { margin-left: auto; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.section-body { padding-left: 10px; }
.section-summary { font-size: 13px; color: var(--ink-3); padding: 0 0 8px 30px; }
.task-group + .task-group { border-top: 1px solid var(--border); }
.suggested-head { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 15px; color: var(--brand-ink); }

/* ---------- EPA rows ---------- */
.epa { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.epa:last-child { border-bottom: 0; }
.epa-code { font-weight: 800; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.epa-detail { font-size: 13px; color: var(--ink-3); }
.fold { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 0; color: var(--ink-3); font-weight: 650; font-size: 14px; }
.fold .icon { transition: transform .15s; }
.fold[aria-expanded="true"] .icon { transform: rotate(90deg); }

/* ---------- Case list ---------- */
.month-head { display: flex; justify-content: space-between; padding: 14px 4px 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.case-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.case-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 8px 12px 14px; border-bottom: 1px solid var(--border); }
.case-row:last-child { border-bottom: 0; }
.case-main { flex: 1; min-width: 0; display: flex; gap: 12px; border: 0; background: none; padding: 0; text-align: left; }
.daytile { flex: none; width: 46px; padding: 6px 0; border-radius: 12px; background: var(--brand-soft); text-align: center; line-height: 1.1; }
.daytile b { display: block; font-size: 21px; font-weight: 800; }
.daytile span { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.case-title { font-weight: 700; font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.case-detail { font-size: 14px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-sync { color: var(--warn); }
.case-sync.err { color: var(--bad); }
.menu-btn { flex: none; width: 40px; height: 40px; border: 0; background: none; color: var(--ink-3); border-radius: 50%; display: grid; place-items: center; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); }
.banner .icon { color: var(--warn); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.empty { text-align: center; padding: 40px 16px; display: grid; justify-items: center; gap: 12px; }
.empty h2 { font-size: 24px; font-weight: 800; }

/* Sync badge */
.syncbadge { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 8px; font-weight: 700; font-size: 13px; color: var(--brand-ink); }
.syncbadge.pending, .syncbadge.offline { color: var(--warn); }
.syncbadge.error { color: var(--bad); }
.syncbadge.syncing { color: var(--ink-3); }

/* ---------- Progress ---------- */
.summary { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 24px; background: linear-gradient(135deg, var(--brand-soft), var(--surface)); box-shadow: var(--shadow); }
.summary .total { font-size: 56px; font-weight: 800; line-height: 1; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.pills { display: flex; flex-direction: column; gap: 10px; margin-left: auto; }
.pill { display: flex; align-items: center; gap: 8px; }
.pill b { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pill .icon { color: var(--brand-ink); }
.pill.coral .icon { color: var(--accent); }
.rings { display: flex; gap: 16px; align-items: center; }
.rings svg { flex: none; }
.legend { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.legend .item { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex: none; }
.ring-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ring-card { display: grid; justify-items: center; gap: 6px; padding: 10px; border-radius: 16px; background: var(--surface-2); text-align: center; font-size: 13px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row .row-between { font-size: 15px; }
.bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--bar-c) 18%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--bar-c); min-width: 8px; }

/* ---------- Achievements ---------- */
.medal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 2px; min-height: 130px; text-align: center; }
.tile .t { font-size: 13px; font-weight: 650; line-height: 1.25; }
.tile.locked .t { color: var(--ink-3); }
.medal { position: relative; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); flex: none; }
.medal.earned { background: linear-gradient(to bottom, var(--accent), color-mix(in srgb, var(--accent) 75%, transparent)); color: #fff; box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 40%, transparent); }
.medal.major.earned { background: linear-gradient(to bottom, var(--amber), color-mix(in srgb, var(--amber) 75%, transparent)); box-shadow: 0 3px 8px color-mix(in srgb, var(--amber) 40%, transparent); }
.medal.major::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--amber) 50%, transparent); }
.medal.major.earned::after { border-color: rgba(255, 255, 255, .7); }
.medal .q { font-weight: 800; font-size: 20px; }
.ann { display: flex; gap: 12px; align-items: flex-start; border: 0; background: none; padding: 0; text-align: left; width: 100%; }
.ann .dot { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--amber); color: #fff; display: grid; place-items: center; }
.ann .you { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 99px; background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--gold); margin-left: 6px; }
.section-title { font-size: 17px; font-weight: 700; margin: 6px 0 2px; }

/* "System" panel: achievement notifications and details (dark in both themes) */
.scrim { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .55); animation: fade .2s ease-out; }
.sys {
  width: 100%; max-width: 380px; max-height: calc(100dvh - 40px); overflow: auto;
  background: var(--panel); color: var(--panel-ink); border-radius: 24px; padding: 22px;
  border: 1.5px solid color-mix(in srgb, var(--brand-ink) 80%, transparent);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 14px;
  animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.sys.major { border-color: color-mix(in srgb, var(--amber) 80%, transparent); }
.sys-head { display: flex; align-items: center; gap: 14px; }
.sys-label { font: 700 12px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--panel-mint); }
.sys.major .sys-label { color: var(--amber); }
.sys-title { font-size: 22px; font-weight: 800; line-height: 1.2; }
.sys-text { color: rgba(255, 255, 255, .86); font-size: 15px; }
.sys-dim { color: rgba(255, 255, 255, .55); font-size: 13px; }
.reward { font: 13px/1.45 var(--mono); color: #f9735b; }
.reward b { font-weight: 800; }
.announced { display: flex; gap: 8px; align-items: center; color: var(--amber); font-weight: 700; font-size: 14px; }
.sys hr { border: 0; height: 1px; background: rgba(255, 255, 255, .15); margin: 0; width: 100%; }
.sys .link { color: rgba(255, 255, 255, .6); text-align: center; }
.sys .medal { background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .6); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 61; }

/* ---------- Full-screen sheets (pickers, EPAs after saving) ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: slideup .22s ease-out; }
.sheet .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.sheet .savebar { position: absolute; }
/* Search and category chips above a picker's list; they stay put while the list scrolls. */
.sheet .picker-bar { flex: none; width: 100%; max-width: 560px; margin: 0 auto; padding: 12px 16px 0; }
.sheet .picker-bar + .content { padding-top: 0; }
@keyframes slideup { from { transform: translateY(24px); opacity: 0; } }
.list-group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-head { padding: 16px 4px 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; }
.pick-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); padding-left: 14px; }
.pick-row:last-child { border-bottom: 0; }
.pick-row .tick { flex: 1; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 10px 0; min-height: 52px; text-align: left; font-size: 16px; }
.star { width: 48px; height: 48px; border: 0; background: none; color: var(--ink-3); display: grid; place-items: center; }
.star[aria-pressed="true"] { color: var(--accent); }

/* ---------- Settings ---------- */
.group { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.group-label { padding: 18px 4px 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.group-foot { padding: 6px 4px 0; font-size: 13px; color: var(--ink-3); }
.cell { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border-bottom: 1px solid var(--border); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; text-decoration: none; color: inherit; font-size: 16px; }
.cell:last-child { border-bottom: 0; }
.cell .val { margin-left: auto; color: var(--ink-3); }
.cell .icon { color: var(--brand-ink); }
.cell.danger, .cell.danger .icon { color: var(--bad); }
.cell select.field, .cell input.field { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
.cell .field.inline { margin-left: auto; width: auto; }
.profile { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.logo { display: inline-block; flex: none; }
.logo svg { display: block; }

/* ---------- Sign-in and onboarding ---------- */
.auth { min-height: 100dvh; padding: calc(40px + env(safe-area-inset-top)) 20px 40px; background: linear-gradient(to bottom, var(--brand-soft), var(--bg) 50%); }
.auth-inner { max-width: 420px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.auth-brand { display: grid; justify-items: center; gap: 8px; text-align: center; }
.auth-brand h1 { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.tagline { font-size: 19px; font-weight: 700; color: var(--brand-ink); }
.notice { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; font-size: 15px; }
details.dev { background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: var(--radius); padding: 14px 16px; }
details.dev summary { font-weight: 650; cursor: pointer; }
.program-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; min-height: 56px; border-radius: 14px; border: 2px solid transparent; background: var(--surface-2); text-align: left; }
.program-row[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); }
.program-row:disabled { opacity: .55; cursor: default; }
.program-row .soon { margin-left: auto; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--surface); color: var(--ink-3); }
.pgy-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.pgy-row button { min-height: 48px; border-radius: 12px; border: 0; background: var(--surface-2); font-size: 19px; font-weight: 700; padding: 0; }
.pgy-row button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.pgy-row .pgy-fellow { grid-column: 1 / -1; font-size: 17px; }

/* ---------- Dialogs and toasts (util.dialog / util.toast) ---------- */
dialog.modal { border: 0; border-radius: 22px; padding: 22px; width: min(92vw, 380px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .45); }
dialog.modal h2 { font-size: 19px; margin-bottom: 8px; }
.modal-body { color: var(--ink-2); font-size: 15px; white-space: pre-line; }
.modal-actions { display: flex; flex-direction: column-reverse; gap: 8px; margin-top: 18px; }
.modal-actions .btn { width: 100%; min-height: 48px; }
.modal-actions .btn-primary { min-height: 48px; font-size: 16px; }
.btn-danger.btn { background: var(--bad); color: #fff; }
.action-sheet { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .4); display: flex; align-items: flex-end; animation: fade .15s; }
.action-sheet .panel { width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; animation: slideup .2s ease-out; }
.action-sheet .opts { background: var(--surface); border-radius: 16px; overflow: hidden; }
.action-sheet .opts button { width: 100%; min-height: 56px; border: 0; border-bottom: 1px solid var(--border); background: none; font-size: 17px; color: var(--brand-ink); font-weight: 500; }
.action-sheet .opts button:last-child { border-bottom: 0; }
.action-sheet .opts button.danger { color: var(--bad); }
.action-sheet .cancel { min-height: 56px; border: 0; border-radius: 16px; background: var(--surface); font-weight: 700; font-size: 17px; color: var(--brand-ink); }
#toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--bar-h) + 90px + env(safe-area-inset-bottom)); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 420px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px; box-shadow: var(--shadow-lg); transition: opacity .4s; }
.toast-error { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; }

@media (min-width: 700px) {
  .content { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
