/* Covered — web app.
   Style: pastel-consumer (taste-skill, seed 257700540), mapped onto Apple's system colours and type.
   Content is flat and opaque; Liquid Glass is kept to the navigation layer that floats above it
   (sidebar, tab bar, toolbar buttons, sheets), as Apple's guidelines place it.

   Grid (desktop, canvas >= 1000px): 12 columns, 16px gutter. Home: Ending soon spans 7, Value
   covered spans 5 (7 + 5 = 12), the lifeline spans 12. Canvas max 1120px, 40px side padding. */

:root {
  color-scheme: light dark;
  --ground: #f2f2f7;      /* systemGroupedBackground */
  --surface: #ffffff;
  --raised: #f5f5f8;      /* key-value well */
  --active: #e7e7ec;
  --border: #e5e5ea;
  --rule: #eeeef2;
  --control: #d1d1d6;
  --text: #111111;
  --muted: #5e5e66;       /* 6.2:1 on white, 5.6:1 on the ground */
  --faint: #6b6b72;
  --primary: #1c1c1e;
  --on-primary: #ffffff;
  --accent: #0a62d0;      /* cobalt: the data hue and links (5.6:1 on white) */
  --accent-soft: #dcebff;
  --soon: #9a4a00;        /* "ends soon" ink, 6.1:1 */
  --pill-soon-bg: #fff2d6;  --pill-soon-ink: #7a3a00;
  --pill-ok-bg: #dcf5e4;    --pill-ok-ink: #0d3d1f;
  --pill-off-bg: #ececef;   --pill-off-ink: #4a4a50;
  --negative: #c4242a;
  --track: #e9e9ee;

  /* glass */
  --glass-tint: rgba(255, 255, 255, 0.52);
  --glass-tint-strong: rgba(242, 242, 247, 0.8);
  --glass-rim: rgba(255, 255, 255, 0.9);
  --glass-rim-low: rgba(255, 255, 255, 0.35);
  --glass-shade: rgba(0, 0, 0, 0.06);
  --float-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);

  --radius-card: 20px;  --radius-inner: 10px;  --radius-chip: 999px;  --radius-tile: 10px;
  --gap: 16px;  --card-pad: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  --fs-title: 32px; --fs-h2: 17px; --fs-figure: 28px; --fs-body: 15px; --fs-small: 13px; --fs-meta: 12px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1); /* iOS sheet curve */
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #000000; --surface: #1c1c1e; --raised: #2c2c2e; --active: #2c2c2e;
    --border: #2c2c2e; --rule: #2a2a2c; --control: #48484a;
    --text: #ffffff; --muted: #b4b4b8; --faint: #98989e;
    --primary: #ffffff; --on-primary: #000000;
    --accent: #4c9bff; --accent-soft: #10284a;
    --soon: #ffb35c;
    --pill-soon-bg: #3a2608; --pill-soon-ink: #ffc47a;
    --pill-ok-bg: #12301d;   --pill-ok-ink: #6fdc96;
    --pill-off-bg: #2c2c2e;  --pill-off-ink: #b4b4b8;
    --negative: #ff6961; --track: #2c2c2e;
    --glass-tint: rgba(40, 40, 44, 0.5);
    --glass-tint-strong: rgba(30, 30, 32, 0.78);
    --glass-rim: rgba(255, 255, 255, 0.32);
    --glass-rim-low: rgba(255, 255, 255, 0.08);
    --glass-shade: rgba(0, 0, 0, 0.3);
    --float-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --ground: #000000; --surface: #1c1c1e; --raised: #2c2c2e; --active: #2c2c2e;
  --border: #2c2c2e; --rule: #2a2a2c; --control: #48484a;
  --text: #ffffff; --muted: #b4b4b8; --faint: #98989e;
  --primary: #ffffff; --on-primary: #000000;
  --accent: #4c9bff; --accent-soft: #10284a;
  --soon: #ffb35c;
  --pill-soon-bg: #3a2608; --pill-soon-ink: #ffc47a;
  --pill-ok-bg: #12301d;   --pill-ok-ink: #6fdc96;
  --pill-off-bg: #2c2c2e;  --pill-off-ink: #b4b4b8;
  --negative: #ff6961; --track: #2c2c2e;
  --glass-tint: rgba(40, 40, 44, 0.5);
  --glass-tint-strong: rgba(30, 30, 32, 0.78);
  --glass-rim: rgba(255, 255, 255, 0.32);
  --glass-rim-low: rgba(255, 255, 255, 0.08);
  --glass-shade: rgba(0, 0, 0, 0.3);
  --float-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.ico { width: 20px; height: 20px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Liquid Glass ---------- */

.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: var(--float-shadow);
}
/* Chromium: the lens bends what is behind before a light frost */
.glass.is-lens {
  -webkit-backdrop-filter: var(--lens) blur(2px) saturate(170%) brightness(1.04);
  backdrop-filter: var(--lens) blur(2px) saturate(170%) brightness(1.04);
}
/* the rim: a specular edge, brightest where light falls (top left) and again on the far edge */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--glass-rim), var(--glass-rim-low) 35%, var(--glass-rim-low) 65%, var(--glass-rim)); /* taste-skill-ignore: specular rim of the glass, asked for by the brief */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); /* taste-skill-ignore: mask that cuts the rim to 1px */
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); /* taste-skill-ignore: mask that cuts the rim to 1px */
  pointer-events: none;
  z-index: 1;
}
/* the inner light and the shade along the bottom of the material */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), inset 0 -1px 2px var(--glass-shade);
  pointer-events: none;
  z-index: 1;
}
.glass > * { position: relative; z-index: 2; }
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass.is-lens { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* round glass buttons (toolbar items) */
.gbtn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 0; color: var(--text);
  transition: transform 0.35s var(--spring);
}
.gbtn:active { transform: scale(1.12); }
.gbtn .ico { width: 22px; height: 22px; }
.gbtn.tint { background: color-mix(in srgb, var(--accent) 82%, transparent); color: #fff; }

/* ---------- Shell ---------- */

.shell { min-height: 100dvh; }

.sidebar { display: none; }
.canvas {
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(16px + var(--sat)) 16px calc(120px + var(--sab));
}

/* phone: a compact glass top bar appears once the large title scrolls away */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  padding: calc(6px + var(--sat)) 12px 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .ttl {
  position: absolute; left: 50%; top: calc(6px + var(--sat));
  transform: translate(-50%, 4px);
  height: 44px; display: grid; place-items: center; padding: 0 18px; border-radius: 22px;
  font-weight: 600; font-size: 15px;
  opacity: 0; transition: opacity 0.2s, transform 0.3s var(--ease);
  max-width: calc(100% - 140px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.scrolled .topbar .ttl { opacity: 1; transform: translate(-50%, 0); }
.topbar .spacer { width: 44px; }
.topbar .end { margin-left: auto; display: flex; gap: 8px; }

/* floating tab bar + a separate add button, iOS 26 style */
.tabbar-wrap {
  position: fixed; left: 0; right: 0; bottom: calc(14px + var(--sab)); z-index: 30;
  display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 0 16px; pointer-events: none;
}
.tabbar-wrap > * { pointer-events: auto; }
.tabbar {
  display: flex; padding: 4px; border-radius: 32px; height: 62px;
  flex: 0 1 300px;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 0; background: none; color: var(--text); border-radius: 28px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em; min-width: 72px;
}
.tab .ico { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
/* the selection is a droplet of thicker glass that slides between tabs */
.tabbar .drop {
  position: absolute; z-index: 1; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: 28px;
  background: color-mix(in srgb, var(--text) 9%, transparent);
  transition: transform 0.5s var(--spring), scale 0.3s var(--spring);
  transform: translateX(calc(var(--i, 0) * 100%));
}
.tabbar:active .drop { scale: 1.08 1.14; }
.fab { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; border: 0; color: var(--accent); transition: transform 0.35s var(--spring); }
.fab:active { transform: scale(1.1); }
.fab .ico { width: 26px; height: 26px; stroke-width: 2; }

/* desktop and tablet landscape: a floating glass sidebar, as on iPadOS */
@media (min-width: 1000px) {
  .shell { display: grid; grid-template-columns: 264px 1fr; }
  .sidebar {
    display: flex; flex-direction: column;
    position: sticky; top: 8px; margin: 8px 0 8px 8px;
    height: calc(100dvh - 16px);
    border-radius: 26px; padding: 18px 12px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); /* it rests beside the content, so it barely lifts */
  }
  .canvas { padding: 36px 40px 64px; width: 100%; }
  .topbar, .tabbar-wrap { display: none; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; }
.brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 10px;
  color: var(--text); font-size: 14px;
}
.nav a .ico { width: 18px; height: 18px; color: var(--muted); }
.nav a:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--text) 9%, transparent); font-weight: 500; }
.nav a[aria-current="page"] .ico { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--pill-soon-ink); background: var(--pill-soon-bg); border-radius: 999px; padding: 1px 8px; }
.nav-label { font-size: 12px; color: var(--muted); padding: 22px 10px 6px; }
.sidebar .foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sidebar .local { font-size: 12px; color: var(--muted); padding: 0 10px; display: flex; gap: 8px; align-items: flex-start; }
.sidebar .local .ico { width: 16px; height: 16px; margin-top: 1px; }

/* ---------- Page head ---------- */

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 44px 4px 18px; }
@media (min-width: 1000px) { .head { margin-top: 0; } }
.head h1 { margin: 0; font: 700 var(--fs-title)/1.1 var(--font-display); letter-spacing: -0.02em; }
.head .finding { margin: 6px 0 0; color: var(--muted); font-size: 15px; max-width: 60ch; }
.head .finding b { color: var(--text); font-weight: 600; }
.head .actions { display: flex; gap: 8px; flex: none; }
.back-row { margin: 0 0 8px; }

/* ---------- Buttons ---------- */

.btn {
  height: 36px; padding: 0 16px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  background: var(--active); color: var(--text);
  transition: transform 0.25s var(--spring), background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn .ico { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.plain { background: none; color: var(--accent); padding: 0 8px; }
.btn.danger { background: none; color: var(--negative); padding: 0 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.hide-phone { display: none; }
@media (min-width: 1000px) { .hide-phone { display: inline-flex; } }

/* ---------- Cards ---------- */

.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(12, 1fr); align-items: start; }
  .span-7 { grid-column: span 7; } .span-5 { grid-column: span 5; } .span-12 { grid-column: span 12; }
}
.card { background: var(--surface); border-radius: var(--radius-card); padding: var(--card-pad); }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { margin: 0; font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.01em; }
.card-h .meta { color: var(--muted); font-size: 13px; }
.card-sub { margin: -6px 0 14px; color: var(--muted); font-size: 13px; }

/* ---------- Rows ---------- */

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 44px 1fr auto 16px; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 0; color: inherit;
  border-top: 1px solid var(--rule);
}
.rows > li:first-child .row { border-top: 0; }
.row:hover .row-name { color: var(--accent); }
.row .chev { width: 16px; height: 16px; color: var(--control); }
.row-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; }
.row-end .left { font-size: 15px; font-weight: 600; white-space: nowrap; }
.row-end .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row .text { min-width: 0; }
.row-name, .row-sub, .row-end .left, .row-end .when { display: block; }
.st-soon .left { color: var(--soon); }
.st-expired .left { color: var(--muted); font-weight: 500; }
.st-expired .tile { filter: grayscale(1); opacity: 0.75; }

/* the brand's monogram on its category tint */
.tile {
  width: 44px; height: 44px; border-radius: var(--radius-tile); flex: none;
  display: grid; place-items: center;
  background: var(--cat-bg); color: var(--cat-ink);
  font: 650 17px/1 var(--font-display); letter-spacing: -0.01em;
  overflow: hidden;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 24px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tile, :root:not([data-theme="light"]) .chip-cat { background: color-mix(in srgb, var(--cat-ink) 55%, #000); color: var(--cat-bg); }
}
:root[data-theme="dark"] .tile, :root[data-theme="dark"] .chip-cat { background: color-mix(in srgb, var(--cat-ink) 55%, #000); color: var(--cat-bg); }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; flex: none; white-space: nowrap; }
.pill.soon { background: var(--pill-soon-bg); color: var(--pill-soon-ink); }
.pill.covered, .pill.lifetime { background: var(--pill-ok-bg); color: var(--pill-ok-ink); }
.pill.expired { background: var(--pill-off-bg); color: var(--pill-off-ink); }
.chip-cat { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--cat-bg); color: var(--cat-ink); }

/* cover-used track */
.track { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.st-soon .track > i { background: var(--soon); }
.st-expired .track > i { background: var(--faint); }

/* ---------- Home ---------- */

.soon-list .row { grid-template-columns: 44px 1fr auto; }
.soon-row-track { grid-column: 2 / -1; margin-top: -2px; }
.empty-line { border: 1px dashed var(--control); border-radius: 12px; padding: 12px 14px; color: var(--muted); font-size: 14px; }

.value-total { font: 600 var(--fs-figure)/1.1 var(--font-display); letter-spacing: -0.02em; margin: 2px 0 2px; }
.value-total small { font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.barlist { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.barlist li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.barlist .bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--track); }
.barlist .bar i { display: block; height: 100%; border-radius: 2px; background: var(--cat-ink); }
.barlist .v { font-weight: 600; }
.barlist .n { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 13px; }

/* the lifeline: every item's cover on one time axis, today marked in the data hue */
.life { position: relative; }
.life-axis { position: relative; height: 18px; margin-left: var(--life-label); font-size: 12px; color: var(--muted); }
.life-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.life-rows { position: relative; list-style: none; margin: 0; padding: 0; }
.life-rows li { display: grid; grid-template-columns: var(--life-label) 1fr; align-items: center; height: 34px; }
.life-rows .lbl { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 12px; color: inherit; }
.life-rows .lane { position: relative; height: 100%; }
.life-rows .lane::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--rule); }
.life-bar {
  position: absolute; top: 50%; height: 20px; transform: translateY(-50%);
  border-radius: 6px; background: var(--cat-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-ink) 22%, transparent);
  display: flex; align-items: center; justify-content: flex-end; padding: 0 6px;
  font-size: 11px; font-weight: 600; color: var(--cat-ink); white-space: nowrap; overflow: hidden;
}
.life-bar .ext { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--cat-ink) 22%, transparent) 4px 5px); } /* taste-skill-ignore: hatch marks extended cover (one mark per kind) */
.life-bar.ended { background: var(--pill-off-bg); color: var(--pill-off-ink); box-shadow: none; }
.life-today { position: absolute; top: 18px; bottom: 0; width: 0; border-left: 1.5px solid var(--accent); z-index: 2; }
.life-today span { position: absolute; top: -18px; left: 0; transform: translateX(-50%); font-size: 12px; font-weight: 600; color: var(--accent); background: var(--surface); padding: 0 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; background: var(--pill-off-bg); }
.legend i.ext { background: repeating-linear-gradient(135deg, var(--surface) 0 3px, var(--control) 3px 4px); box-shadow: inset 0 0 0 1px var(--control); } /* taste-skill-ignore: legend swatch is the hatch itself */
.legend i.cov { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .life-bar:not(.ended) { background: color-mix(in srgb, var(--cat-ink) 55%, #000); color: var(--cat-bg); }
}
:root[data-theme="dark"] .life-bar:not(.ended) { background: color-mix(in srgb, var(--cat-ink) 55%, #000); color: var(--cat-bg); }

/* ---------- Items ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border-radius: 12px; background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted);
}
.search input { flex: 1; border: 0; background: none; outline: 0; height: 100%; color: var(--text); font-size: 15px; min-width: 0; }
.search input::placeholder { color: var(--faint); }
.search .ico { width: 18px; height: 18px; }
.seg {
  display: flex; padding: 2px; border-radius: 10px; background: color-mix(in srgb, var(--text) 7%, transparent);
  overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: none; height: 34px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; white-space: nowrap;
  color: var(--text);
}
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
.seg .c { color: var(--muted); font-weight: 400; margin-left: 4px; }
.list-card { padding-top: 6px; padding-bottom: 6px; }
.total-line { color: var(--muted); font-size: 13px; margin: 0 4px 8px; }

/* ---------- Detail ---------- */

.detail-head { display: flex; align-items: center; gap: 16px; margin: 56px 4px 20px; }
@media (min-width: 1000px) { .detail-head { margin-top: 6px; } }
.detail-head h1 { margin: 0; font: 700 28px/1.15 var(--font-display); letter-spacing: -0.02em; }
.detail-head p { margin: 4px 0 0; color: var(--muted); }
.cover-figure { font: 600 var(--fs-figure)/1.1 var(--font-display); letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cover-dates { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }
.cover-card .track { height: 8px; margin-top: 16px; }
.cover-card .track { display: flex; }
.cover-card .track .seg-ext { background: repeating-linear-gradient(135deg, transparent 0 4px, color-mix(in srgb, var(--text) 18%, transparent) 4px 5px); } /* taste-skill-ignore: hatch marks extended cover */
.cover-note { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.well { background: var(--raised); border-radius: 14px; margin: 0; padding: 4px 14px; }
.well div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.well div:first-child { border-top: 0; }
.well dt { color: var(--muted); }
.well dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.receipt-box { border-radius: 14px; overflow: hidden; background: var(--raised); display: block; }
.receipt-box img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: var(--raised); }
.receipt-file { display: flex; align-items: center; gap: 12px; padding: 14px; color: var(--text); }
.notes { white-space: pre-wrap; margin: 0; font-size: 14px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.danger-zone { margin-top: 8px; display: flex; justify-content: flex-start; }

/* ---------- Sheets ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.28);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.3s var(--ease);
}
.scrim.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 620px; max-height: calc(100dvh - 12px - var(--sat));
  border-radius: 34px 34px 0 0;
  margin: 0 6px;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.45s var(--ease);
  background: var(--glass-tint-strong);
}
/* a sheet holds a form: the lens still bends its rim, but the middle is frosted enough to read over */
.sheet.glass, .sheet.glass.is-lens {
  -webkit-backdrop-filter: var(--lens, ) blur(28px) saturate(180%);
  backdrop-filter: var(--lens, ) blur(28px) saturate(180%);
}
.scrim.open .sheet { transform: none; }
@media (min-width: 700px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 34px; max-height: min(860px, calc(100dvh - 48px)); transform: translateY(24px) scale(0.98); opacity: 0; transition: transform 0.4s var(--ease), opacity 0.25s; }
  .scrim.open .sheet { opacity: 1; }
}
.sheet-h { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 12px 12px 6px; }
.sheet-h h2 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-h .gbtn { background: color-mix(in srgb, var(--text) 8%, transparent); box-shadow: none; }
.sheet-h .gbtn.tint { background: var(--accent); color: #fff; justify-self: end; }
.sheet-h .gbtn.tint[disabled] { opacity: 0.4; }
.sheet-b { overflow-y: auto; padding: 8px 16px calc(24px + var(--sab)); overscroll-behavior: contain; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 25%, transparent); margin: 6px auto 0; }
@media (min-width: 700px) { .grabber { display: none; } }

/* grouped form, the iOS Settings way */
.group-label { font-size: 13px; color: var(--muted); margin: 18px 16px 6px; }
.group { background: var(--surface); border-radius: 16px; overflow: hidden; }
.field { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px; border-top: 0.5px solid var(--border); }
.field:first-child { border-top: 0; }
.field > label, .field > .lab { flex: 0 0 auto; width: 128px; font-size: 15px; }
.field input, .field select, .field textarea {
  flex: 1; min-width: 0; border: 0; background: none; outline: 0; font-size: 15px; height: 46px; text-align: right; color: var(--text);
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field select {
  text-align-last: right; appearance: none; -webkit-appearance: none; cursor: pointer; color: var(--muted);
  padding-right: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 6 3-3 3 3M3 10l3 3 3-3'/%3E%3C/svg%3E") no-repeat right center / 10px 14px;
}
.field textarea { height: auto; min-height: 88px; text-align: left; padding: 12px 0; resize: vertical; }
.field.stack { flex-direction: column; align-items: stretch; gap: 0; padding-top: 10px; }
.field.stack > label { width: auto; font-size: 13px; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .money { display: flex; flex: 1; gap: 8px; align-items: center; justify-content: flex-end; }
.field .money select { flex: 0 0 auto; width: auto; }
.field .money input { flex: 0 1 140px; }
.group-note { font-size: 13px; color: var(--muted); margin: 6px 16px 0; }
.err { color: var(--negative); font-size: 13px; margin: 6px 16px 0; }
.terms { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 12px; border-top: 0.5px solid var(--border); }
.terms button {
  border: 0; height: 32px; padding: 0 12px; border-radius: 999px; background: color-mix(in srgb, var(--text) 7%, transparent);
  font-size: 13px; font-weight: 500;
}
.terms button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.toggle { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--active); position: relative; cursor: pointer; flex: none; transition: background 0.2s; margin: 0 0 0 auto; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform 0.3s var(--spring), width 0.2s; }
.toggle:checked { background: #34c759; }
.toggle:checked::after { transform: translateX(20px); }
.toggle:active::after { width: 33px; }
.toggle:checked:active::after { transform: translateX(14px); }
.receipt-pick { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 0.5px solid var(--border); }
.receipt-pick .thumb { width: 48px; height: 48px; border-radius: 8px; background: var(--raised); display: grid; place-items: center; overflow: hidden; color: var(--muted); flex: none; }
.receipt-pick .thumb img { width: 100%; height: 100%; object-fit: cover; }
.receipt-pick .grow { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Settings ---------- */

.set-sec { display: grid; gap: 10px 32px; padding: 28px 0; border-top: 1px solid var(--border); }
.set-sec:first-of-type { border-top: 0; padding-top: 4px; }
.set-sec h2 { margin: 0; font-size: 16px; font-weight: 600; }
.set-sec .desc { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.set-sec .group { align-self: start; }
@media (min-width: 1000px) { .set-sec { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 8px 16px; border-top: 0.5px solid var(--border); }
.set-row:first-child { border-top: 0; }
.set-row .t { font-size: 15px; }
.set-row .s { font-size: 13px; color: var(--muted); }
.preview-note { margin: 12px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--raised); display: flex; gap: 10px; font-size: 13px; }
.preview-note .ico { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }
.preview-note b { display: block; font-size: 14px; }

/* ---------- First run ---------- */

.first {
  text-align: left; padding: 28px; display: grid; gap: 18px; max-width: 640px;
}
.first h2 { margin: 0; font: 650 22px/1.2 var(--font-display); letter-spacing: -0.01em; }
.first p { margin: 0; color: var(--muted); }
.first ol { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; }
.first ol b { color: var(--text); font-weight: 600; }
.first .acts { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--sab)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0;
  padding: 0 18px; height: 44px; border-radius: 22px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; transition: opacity 0.2s, transform 0.4s var(--spring); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .ico { width: 18px; height: 18px; color: #34c759; }
@media (min-width: 1000px) { .toast { bottom: 28px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
