/* tokens.css */
/* =====================================================================
   Design tokens, ported 1:1 from the design prototype (css/tokens.css).
   ---------------------------------------------------------------------
   Every colour, size and duration used by components lives here.
   Components never use raw hex values.

   Theme engine: <html data-theme="light|dark" data-accent="clay|pine|ink|honey">
   - no data-theme  -> follows the OS (boot.ts sets it from the saved choice or the OS)
   - no data-accent -> clay (default)
   ===================================================================== */

@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-var.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---------- Type ---------- */
  --font-sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-money: "Fraunces", ui-serif, Georgia, "Times New Roman", serif; /* prices only */
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;      /* IDs and tokens only */

  --text-xs: 0.75rem;    /* 12  tags, fine print            */
  --text-sm: 0.875rem;   /* 14  meta, card titles on phone  */
  --text-base: 1rem;     /* 16  body, inputs                */
  --text-md: 1.125rem;   /* 18  section headings            */
  --text-lg: 1.375rem;   /* 22  dialog titles               */
  --text-xl: 1.75rem;    /* 28  page titles (phone)         */
  --text-2xl: 2.25rem;   /* 36  page titles (desktop)       */
  --text-3xl: 3.25rem;   /* 52  landing headline            */

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-body: 1.55;

  --weight-regular: 420;
  --weight-medium: 540;
  --weight-semibold: 630;
  --weight-bold: 720;

  /* ---------- Space (4 pt grid) ---------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px;

  --page-max: 1200px;
  --page-pad: 16px;
  --tap: 44px;            /* minimum touch target */

  /* ---------- Shape: one radius for the whole app ---------- */
  --radius: 14px;         /* cards, dialogs, sheets, buttons, inputs, image tiles */
  --radius-half: 7px;     /* only for small things inside a 14px shape: tags, logo tile, thumbs */
  --radius-round: 999px;  /* avatars and switches only */

  /* ---------- Motion: subtle ---------- */
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 260ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* ---------- Layers ---------- */
  --z-sticky: 10;
  --z-drawer: 40;
  --z-dialog: 50;
  --z-lightbox: 60;
  --z-toast: 70;
}

@media (min-width: 640px) { :root { --page-pad: 24px; } }
@media (min-width: 960px) { :root { --page-pad: 32px; } }

/* ---------- Light (default) ---------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FDFCF9;            /* warm cream (Sam default) */
  --surface: #FFFFFF;       /* cards */
  --surface-2: #F6F2EB;     /* tinted fills, table header, quiet panels */
  --surface-3: #EFEAE1;     /* hover / pressed fills */
  --plinth: #F4F0E9;        /* product image tile (images multiply onto it) */
  --on-plinth: #6A655C;     /* text sitting on the plinth, 4.9:1 */
  --line: #E8E2D7;          /* hairlines */
  --line-strong: #D6CEC1;   /* input borders, dividers that must be seen */

  --ink: #1B1A16;           /* 17.0:1 on bg */
  --ink-2: #5C574E;         /*  7.0:1 on bg: secondary text */
  --ink-3: #6F6A61;         /*  5.2:1 on bg: meta, hints */

  --ok: #2E7048;            /* 5.9:1 on white */
  --ok-soft: #E7F1EA;
  --warn: #8A5A00;          /* 5.9:1 on white */
  --warn-soft: #F8EFDC;
  --danger: #B42318;        /* 6.6:1 on white */
  --danger-soft: #FBE9E7;

  --scrim: rgba(27, 26, 22, 0.42);
  --lightbox-bg: rgba(20, 18, 15, 0.96);
  --shadow-card: 0 1px 2px rgba(70, 50, 25, 0.05), 0 6px 18px -10px rgba(70, 50, 25, 0.16);
  --shadow-lift: 0 2px 4px rgba(70, 50, 25, 0.06), 0 14px 30px -14px rgba(70, 50, 25, 0.26);
  --shadow-overlay: 0 24px 60px -20px rgba(70, 50, 25, 0.38), 0 2px 6px rgba(70, 50, 25, 0.08);
}

/* ---------- Dark: a real theme, warm, no neon ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171512;
  --surface: #211E1A;
  --surface-2: #2A2621;
  --surface-3: #332E28;
  --plinth: #E4DFD6;        /* product photos stay on a lit tile: white-ground shots look wrong on black */
  --on-plinth: #57524A;     /* plinth stays light in dark mode, so its text stays dark: 5.6:1 */
  --line: #36312A;
  --line-strong: #4A443B;

  --ink: #F2EEE6;           /* 15.8:1 on bg */
  --ink-2: #B9B2A6;         /*  7.9:1 on surface */
  --ink-3: #9D968A;         /*  5.7:1 on surface */

  --ok: #7CC496;
  --ok-soft: #1F2E24;
  --warn: #E2B04A;
  --warn-soft: #33291A;
  --danger: #F08A7E;
  --danger-soft: #3A211D;

  --scrim: rgba(0, 0, 0, 0.55);
  --lightbox-bg: rgba(8, 7, 6, 0.94);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lift: 0 10px 28px -12px rgba(0, 0, 0, 0.6);
  --shadow-overlay: 0 24px 60px -16px rgba(0, 0, 0, 0.7);
}

/* ---------- Accent: one accent per theme (theme engine) ---------- */
/* Clay (default): warm, gift-wrap brown-red. Not Christmas red, and distinct from error red. */
:root {
  --accent: #A64B2A;         /* white on it 5.7:1; it on bg 5.6:1 */
  --accent-hover: #8F3F22;
  --on-accent: #FFFFFF;
  --accent-soft: #F8EBE3;
  --accent-ink: #9A4526;     /* accent text on accent-soft 5.5:1 */
  --focus: #A64B2A;
}
:root[data-theme="dark"] {
  --accent: #E58C68;          /* ink on it 7.2:1 */
  --accent-hover: #EFA083;
  --on-accent: #1B1A16;
  --accent-soft: #3A261D;
  --accent-ink: #F0A385;
  --focus: #E58C68;
}

:root[data-accent="pine"] { --accent: #2F6B4F; --accent-hover: #255A41; --on-accent: #FFFFFF; --accent-soft: #E5F0EA; --accent-ink: #285E45; --focus: #2F6B4F; }
:root[data-accent="ink"]  { --accent: #2C5A88; --accent-hover: #234B73; --on-accent: #FFFFFF; --accent-soft: #E6EEF6; --accent-ink: #264F78; --focus: #2C5A88; }
:root[data-accent="honey"]{ --accent: #D9A441; --accent-hover: #C8932F; --on-accent: #1B1A16; --accent-soft: #F8EED8; --accent-ink: #7A5200; --focus: #A8771C; }

:root[data-theme="dark"][data-accent="pine"] { --accent: #7FBF9C; --accent-hover: #95CDAE; --on-accent: #1B1A16; --accent-soft: #1F3027; --accent-ink: #9AD1B2; --focus: #7FBF9C; }
:root[data-theme="dark"][data-accent="ink"]  { --accent: #8DB4DE; --accent-hover: #A3C3E6; --on-accent: #1B1A16; --accent-soft: #1E2935; --accent-ink: #A8C7E8; --focus: #8DB4DE; }
:root[data-theme="dark"][data-accent="honey"]{ --accent: #E2B04A; --accent-hover: #EBC066; --on-accent: #1B1A16; --accent-soft: #33291A; --accent-ink: #EBC066; --focus: #E2B04A; }

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
}

/* components.css */
/* =====================================================================
   Components, ported from the design prototype (css/components.css).
   Mobile-first; breakpoints 640 / 960 / 1200. Class names map to the
   Preact components in src/web/components. App-only additions live in
   app.css so this file stays diffable against the prototype.
   ===================================================================== */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-weight: var(--weight-semibold); letter-spacing: -0.012em; line-height: var(--leading-tight); text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:root[data-theme="dark"] a.link, :root[data-theme="dark"] .link { color: var(--accent); }
button { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--ink); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: calc(var(--page-max) + 2 * var(--page-pad)); margin-inline: auto; padding-inline: var(--page-pad); }
.container--narrow { max-width: calc(760px + 2 * var(--page-pad)); }
.stack > * + * { margin-top: var(--s-4); }
.muted { color: var(--ink-2); }
.meta { color: var(--ink-3); font-size: var(--text-sm); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.dot-sep > * + *::before { content: "·"; margin-inline: 0.45em; color: var(--ink-3); }

/* Icons: inline SVG sprite, stroke inherits currentColor */
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }
.icon--fill { fill: currentColor; stroke: none; }

/* ---------- Money: the only serif in the app ---------- */
.price {
  font-family: var(--font-money);
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  font-optical-sizing: auto;
  letter-spacing: -0.005em;
  color: var(--ink);
  white-space: nowrap;
}
.price--any { font-style: normal; color: var(--ink-2); }
.price--big { font-size: 2.25rem; font-weight: 400; line-height: 1; letter-spacing: -0.02em; }
.price-was { font-family: var(--font-money); color: var(--ink-3); text-decoration: line-through; font-size: var(--text-sm); }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: var(--weight-bold); font-size: 1.125rem; letter-spacing: -0.02em; min-height: var(--tap); }
.brand__tile {
  width: 30px; height: 30px; border-radius: var(--radius-half);
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center;
  font-size: 17px; font-weight: 760; letter-spacing: -0.03em; line-height: 1;
}
.brand--lg .brand__tile { width: 44px; height: 44px; font-size: 24px; border-radius: 10px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); background: color-mix(in srgb, var(--bg) 94%, transparent); border-bottom: 1px solid var(--line); }
.topbar__inner { display: flex; align-items: center; gap: var(--s-4); height: 60px; }
.topbar__nav { display: none; gap: var(--s-1); margin-left: var(--s-4); }
.topbar__nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--ink-2); font-weight: var(--weight-medium); font-size: var(--text-sm); min-height: 40px; display: inline-flex; align-items: center; }
.topbar__nav a:hover { color: var(--ink); background: var(--surface-2); }
.topbar__nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
@media (min-width: 640px) { .topbar__nav { display: flex; } .topbar__inner { height: 64px; } }

/* ---------- Avatars ---------- */
.avatar {
  --size: 32px;
  width: var(--size); height: var(--size); border-radius: var(--radius-round);
  display: inline-grid; place-items: center; flex: none;
  font-size: calc(var(--size) * 0.4); font-weight: var(--weight-semibold);
  background: var(--surface-3); color: var(--ink);
  border: 2px solid var(--bg);
}
.avatar--accent { background: var(--accent-soft); color: var(--accent-ink); }
.avatar--sm { --size: 26px; }
.avatar--lg { --size: 40px; }
.avatar-btn { border: 0; background: none; padding: 6px; border-radius: var(--radius-round); cursor: pointer; min-width: var(--tap); min-height: var(--tap); display: grid; place-items: center; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-weight: var(--weight-semibold); font-size: 0.9375rem; line-height: 1.2; letter-spacing: -0.005em;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--claim { background: var(--surface); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
:root[data-theme="dark"] .btn--claim { color: var(--accent); }
.btn--claim:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--danger { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--block { width: 100%; }
.btn--lg { min-height: 52px; padding: 0 24px; font-size: 1rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  width: var(--tap); height: var(--tap); flex: none;
  display: inline-grid; place-items: center;
  border-radius: var(--radius); border: 1px solid transparent; background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn--bordered { border-color: var(--line-strong); background: var(--surface); }
@media (hover: none) { .icon-btn--on-media { width: 40px !important; height: 40px !important; } }
.icon-btn--on-media { width: 36px; height: 36px; background: color-mix(in srgb, var(--surface) 92%, transparent); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-card); }

.text-btn { background: none; border: 0; padding: 10px 4px; min-height: var(--tap); color: var(--accent-ink); font-weight: var(--weight-semibold); font-size: var(--text-sm); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:root[data-theme="dark"] .text-btn { color: var(--accent); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--ink); }
.label .optional { font-weight: var(--weight-regular); color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--text-base);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.textarea { min-height: 96px; resize: vertical; line-height: var(--leading-body); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.select--sm { min-height: 40px; padding: 8px 36px 8px 12px; font-size: var(--text-sm); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; }
.hint { font-size: var(--text-sm); color: var(--ink-3); line-height: var(--leading-snug); }
.error-text { font-size: var(--text-sm); color: var(--danger); display: flex; gap: 6px; align-items: flex-start; line-height: var(--leading-snug); }
.form-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: var(--text-sm); font-weight: var(--weight-medium); }

.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-wrap > .input { padding-left: 44px; }
.input-wrap > .input-trail { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* Switch */
.switch { position: relative; display: inline-flex; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch__track { position: absolute; inset: 0; border-radius: var(--radius-round); background: var(--line-strong); transition: background-color var(--dur) var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform var(--dur) var(--ease); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: 0.45; }

.setting { display: flex; gap: var(--s-4); align-items: flex-start; justify-content: space-between; padding: var(--s-4) 0; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting__text { display: grid; gap: 2px; }
.setting__title { font-weight: var(--weight-semibold); font-size: 0.9375rem; }
.setting__desc { font-size: var(--text-sm); color: var(--ink-3); line-height: var(--leading-snug); }
.setting--nested { padding-left: var(--s-4); border-left: 2px solid var(--line); margin-left: 2px; }
.setting.is-disabled .setting__title { color: var(--ink-3); }

/* Item options: "No limit" and "Any amount" under the quantity stepper and the price field. */
.option-check { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }
.option-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* Stepper (quantity) */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.stepper button { width: var(--tap); height: 46px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); border-radius: var(--radius); }
.stepper button:hover { background: var(--surface-2); color: var(--ink); }
.stepper output { min-width: 40px; text-align: center; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-5); }
.panel--quiet { background: var(--surface-2); border-color: transparent; }
@media (min-width: 640px) { .panel { padding: var(--s-6); } }
.panel__title { font-size: var(--text-md); font-weight: var(--weight-semibold); }

/* Plain-sentence notice ("Since your last visit ...") */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-size: 0.9375rem; line-height: var(--leading-snug); }
.notice .icon { color: var(--accent-ink); margin-top: 1px; }

/* "Save from your browser": what the bookmarklet is about to save, shown before anything is saved. */
.save-check { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.save-check__host { margin: 0; font-size: 1.25rem; font-weight: var(--weight-bold); color: var(--ink); overflow-wrap: anywhere; }
.save-check__url { margin: 0; font-size: var(--text-sm); color: var(--ink-2); overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.save-check__item { display: flex; gap: 12px; align-items: center; }
.save-check__img { width: 72px; height: 72px; object-fit: contain; border-radius: var(--radius); background: var(--surface); flex: none; }
.save-check__title { margin: 0; font-weight: var(--weight-semibold); color: var(--ink); overflow-wrap: anywhere; }
:root[data-theme="dark"] .notice .icon { color: var(--accent); }
.notice--accent { background: var(--accent-soft); }
.notice strong { font-weight: var(--weight-semibold); }

/* ---------- Status: outline tags (Sam: read fastest) ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 7px;
  border: 1px solid currentColor; border-radius: var(--radius-half);
  font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.055em; text-transform: uppercase; line-height: 1;
  white-space: nowrap; color: var(--ink-2); background: var(--surface);
}
.tag .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.tag--ok { color: var(--ok); }
.tag--warn { color: var(--warn); }
.tag--danger { color: var(--danger); }
.tag--accent { color: var(--accent-ink); }
:root[data-theme="dark"] .tag--accent { color: var(--accent); }
.tag--quiet { color: var(--ink-3); border-color: var(--line-strong); }

/* ---------- Rating: "how much I want it", 1-5 hearts ---------- */
.hearts { display: inline-flex; gap: 2px; color: var(--accent); align-items: center; }
.hearts .icon { width: 14px; height: 14px; }
.hearts .is-off { color: var(--line-strong); }
.hearts--lg .icon { width: 22px; height: 22px; }
.hearts--input { gap: 0; }
.hearts--input button { background: none; border: 0; padding: 0; width: 36px; height: 40px; display: grid; place-items: center; cursor: pointer; color: inherit; border-radius: var(--radius-half); }
.hearts--input button:hover { background: var(--accent-soft); }

/* ---------- Segmented filter ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: var(--radius); }
.segmented button, .segmented a { min-height: 40px; padding: 0 14px; border: 0; background: transparent; border-radius: 11px; font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented [aria-pressed="true"], .segmented [aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.segmented .count { color: var(--ink-3); font-weight: var(--weight-medium); }

/* ---------- Page header ---------- */
.page-head { padding-top: var(--s-4); padding-bottom: var(--s-5); display: grid; gap: var(--s-3); }
.page-head__bar { display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
@media (min-width: 960px) { .page-head { padding-top: var(--s-6); padding-bottom: var(--s-6); } }
.page-title { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: -0.022em; }
@media (min-width: 960px) { .page-title { font-size: var(--text-2xl); } }
.page-sub { color: var(--ink-2); font-size: var(--text-base); max-width: 60ch; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); min-height: 36px; margin-left: -6px; padding-right: 8px; border-radius: var(--radius-half); }
.back-link:hover { color: var(--ink); }

.section-head { display: flex; align-items: baseline; gap: 10px; margin: var(--s-8) 0 var(--s-3); }
.section-head h2 { font-size: var(--text-md); font-weight: var(--weight-bold); letter-spacing: -0.01em; }
.section-head .count { color: var(--ink-3); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.section-head .spacer { flex: 1; }

/* ---------- Item grid + item card ---------- */
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .item-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1200px) { .item-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.item-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
@media (hover: hover) {
  .item-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); border-color: var(--line-strong); }
}
.item-card__media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--plinth); }
.item-card__media img { width: 100%; height: 100%; object-fit: contain; padding: 10%; mix-blend-mode: multiply; }
.item-card__media img.is-photo { object-fit: cover; padding: 0; mix-blend-mode: normal; }
.item-card__badge { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; }
.item-card__tools { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; z-index: 2; }
@media (hover: hover) {
  .item-card__tools { opacity: 0; transition: opacity var(--dur) var(--ease); }
  .item-card:hover .item-card__tools, .item-card:focus-within .item-card__tools { opacity: 1; }
}
.item-card__body { display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 12px; flex: 1; }
@media (min-width: 640px) { .item-card__body { padding: 14px 16px 14px; } }
.item-card__title { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-snug); letter-spacing: 0; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; min-height: calc(2 * var(--leading-snug) * 1em); }
@media (min-width: 640px) { .item-card__title { font-size: 0.9375rem; } }
/* Stretched link: whole card opens the item, buttons sit above it */
.item-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.item-card__title a:focus-visible { outline: none; }
.item-card__title a:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
.item-card__meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; row-gap: 2px; }
.item-card__meta .price { font-size: 1.0625rem; }
.item-card__meta .store { font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); }
.item-card__line { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); min-height: 18px; }
.item-card__line .hearts { margin-right: auto; }
.item-card__foot { padding: 0 12px 12px; position: relative; z-index: 2; }
@media (min-width: 640px) { .item-card__foot { padding: 0 16px 16px; } }
.item-card__foot .btn { min-height: var(--tap); }
.item-card__done { min-height: 42px; display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; line-height: 1.3; font-weight: var(--weight-semibold); color: var(--ink-3); }
.item-card__mine { min-height: 42px; display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--accent-ink); flex-wrap: wrap; }
:root[data-theme="dark"] .item-card__mine { color: var(--accent); }
.item-card__mine .text-btn { margin-left: auto; padding-right: 0; color: var(--ink-2); }

/* Fully claimed: still visible, clearly done, sinks visually */
.item-card.is-claimed .item-card__media img { opacity: 0.5; filter: grayscale(0.4); }
.item-card.is-claimed .item-card__title { color: var(--ink-2); }
.item-card.is-mine { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

/* Pending fetch and failed fetch */
.item-card.is-pending .item-card__media { display: grid; place-items: center; }
.reading { display: grid; justify-items: center; gap: 10px; color: var(--on-plinth); font-size: var(--text-xs); font-weight: var(--weight-semibold); text-align: center; padding: 12px; }
.reading .spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.item-card.is-failed .item-card__media { display: grid; place-items: center; color: var(--on-plinth); }
.media-fallback { display: grid; justify-items: center; gap: 8px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--on-plinth); padding: 12px; text-align: center; word-break: break-all; }
.media-fallback .icon { width: 28px; height: 28px; stroke-width: 1.5; }

/* Drag handle (owner, desktop) */
.drag-handle { cursor: grab; }

/* ---------- Skeleton ---------- */
.skel { background: var(--surface-2); border-radius: var(--radius-half); position: relative; overflow: hidden; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent); animation: shimmer 1.4s var(--ease) infinite; }
.skel--line { height: 12px; }
.skel--title { height: 28px; border-radius: 8px; }
.skel--media { aspect-ratio: 1 / 1; border-radius: 0; background: var(--surface-2); }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .skel::after, .reading .spinner { animation: none; } }

/* ---------- Empty state: one plain line ---------- */
.empty { padding: var(--s-10) var(--s-4); text-align: center; color: var(--ink-2); font-size: var(--text-base); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty .text-btn { font-size: var(--text-base); }

/* ---------- Dashboard: list cards ---------- */
.list-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 960px) { .list-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
.list-card { position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
@media (min-width: 640px) { .list-card { grid-template-columns: 1fr; } }
@media (hover: hover) { .list-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); } }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; background: var(--line); aspect-ratio: 1 / 1; }
@media (min-width: 640px) { .mosaic { aspect-ratio: 16 / 10; } }
.mosaic > * { background: var(--plinth); overflow: hidden; display: grid; place-items: center; }
.mosaic img { width: 100%; height: 100%; object-fit: contain; padding: 10%; mix-blend-mode: multiply; }
.mosaic img.is-photo { object-fit: cover; padding: 0; mix-blend-mode: normal; }
.mosaic--3 > :first-child { grid-row: span 2; }
.mosaic--empty { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.mosaic--empty > * { color: var(--on-plinth); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.list-card__body { padding: 14px 16px; display: grid; gap: 6px; align-content: start; }
@media (min-width: 640px) { .list-card__body { padding: 16px 18px 18px; } }
.list-card__title { font-size: 1.0625rem; font-weight: var(--weight-bold); letter-spacing: -0.01em; }
.list-card__title a::after { content: ""; position: absolute; inset: 0; }
.list-card__facts { font-size: var(--text-sm); color: var(--ink-2); }
.list-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: var(--text-sm); color: var(--ink-3); flex-wrap: wrap; }
.list-card__foot .icon { width: 16px; height: 16px; }

/* Templates */
.template-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .template-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .template-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; } }
.template { position: relative; display: grid; gap: 10px; align-content: start; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left; min-height: 112px; transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.template:hover { border-color: var(--line-strong); background: var(--surface-2); }
.template__icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
:root[data-theme="dark"] .template__icon { color: var(--accent); }
.template__name { font-weight: var(--weight-semibold); font-size: 0.9375rem; }
.template__desc { font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); line-height: 1.35; }
.template input { position: absolute; opacity: 0; }
.template:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--surface); }
.template:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Add by URL ---------- */
.add-bar { display: grid; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.add-bar__row { display: flex; gap: 8px; }
.add-bar__row .input-wrap { flex: 1; }
.add-bar__row .input { border-color: var(--line); background: var(--surface-2); }
.add-bar__row .input:focus { background: var(--surface); }
.add-bar__help .hide-phone { display: none; }
@media (min-width: 640px) { .add-bar__help .hide-phone { display: inline; } }
.add-bar__help { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: var(--text-sm); color: var(--ink-3); padding: 0 4px; }
.add-preview { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); }
@media (min-width: 640px) { .add-preview { grid-template-columns: 132px 1fr auto; align-items: start; gap: 18px; } }
.add-preview .skel { background: var(--surface-3); }
.add-preview__media { aspect-ratio: 1; border-radius: var(--radius-half); background: var(--plinth); overflow: hidden; }
.add-preview__media img { width: 100%; height: 100%; object-fit: scale-down; padding: 8%; mix-blend-mode: multiply; }
.add-preview__fields { display: grid; gap: 10px; min-width: 0; }
.add-preview__title { font-weight: var(--weight-semibold); line-height: var(--leading-snug); }
.add-preview__actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (min-width: 640px) { .add-preview__actions { grid-column: auto; flex-direction: column; align-items: stretch; } }
.found { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-semibold); }
.found span { display: inline-flex; align-items: center; gap: 4px; }
.found .icon { width: 14px; height: 14px; color: var(--ok); stroke-width: 2.4; }

/* ---------- Overlays: scrim, dialog, sheet, drawer ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-dialog); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease); }
.overlay-open .scrim { opacity: 1; pointer-events: auto; }

.dialog {
  position: fixed; z-index: calc(var(--z-dialog) + 1);
  left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto;
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow-overlay);
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(16px); opacity: 0; pointer-events: none; visibility: hidden;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease), visibility 0s linear var(--dur-slow);
}
.dialog.is-open { transform: none; opacity: 1; pointer-events: auto; visibility: visible; transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease); }
.dialog__grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 4px auto 12px; }
@media (min-width: 640px) {
  .dialog { left: 50%; top: 50%; bottom: auto; right: auto; width: min(520px, calc(100vw - 48px)); border-radius: var(--radius); padding: 24px 28px 28px; transform: translate(-50%, calc(-50% + 12px)); }
  .dialog.is-open { transform: translate(-50%, -50%); }
  .dialog--wide { width: min(760px, calc(100vw - 48px)); }
  .dialog__grip { display: none; }
}
.dialog__head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dialog__title { font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: -0.015em; flex: 1; padding-top: 6px; }
.dialog__head .icon-btn { margin: -2px -10px 0 0; }
.dialog__actions { display: flex; gap: 10px; margin-top: 20px; }
.dialog__actions .btn { flex: 1; }
@media (min-width: 640px) { .dialog__actions { justify-content: flex-end; } .dialog__actions .btn { flex: none; } }

.drawer {
  position: fixed; z-index: calc(var(--z-drawer) + 20); inset: 0;
  background: var(--bg); overflow: auto;
  transform: translateY(24px); opacity: 0; pointer-events: none; visibility: hidden;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease), visibility 0s linear var(--dur-slow);
}
.drawer.is-open { transform: none; opacity: 1; pointer-events: auto; visibility: visible; transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease); }
@media (min-width: 960px) {
  .drawer { left: auto; width: 460px; border-left: 1px solid var(--line); box-shadow: var(--shadow-overlay); transform: translateX(24px); }
}
.drawer__head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.drawer__head h2 { flex: 1; font-size: var(--text-md); font-weight: var(--weight-bold); }
.drawer__body { padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.drawer__section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; }
.drawer__section > h3 { font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 14px 0 0; }

.share-link { contain: inline-size; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.share-link__url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--ink-2); }
.share-link__url b { color: var(--ink); font-weight: var(--weight-semibold); }

.people { display: grid; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.person + .person { border-top: 1px solid var(--line); }
.person__name { font-weight: var(--weight-semibold); font-size: 0.9375rem; line-height: 1.25; }
.person__sub { font-size: var(--text-sm); color: var(--ink-3); line-height: 1.3; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: var(--z-lightbox); background: var(--lightbox-bg); display: grid; grid-template-rows: auto 1fr auto; opacity: 0; pointer-events: none; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility 0s linear var(--dur); color: #F2EEE6; }
.lightbox.is-open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity var(--dur) var(--ease); }
.lightbox__bar { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 20px; }
.lightbox__bar p { flex: 1; font-size: var(--text-sm); color: rgba(242, 238, 230, 0.78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__bar .icon-btn { color: #F2EEE6; }
.lightbox__bar .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.lightbox__stage { display: grid; place-items: center; padding: 8px 16px; min-height: 0; }
.lightbox__frame { background: #F4F0E9; border-radius: var(--radius); max-width: min(980px, 100%); max-height: 100%; display: grid; place-items: center; overflow: hidden; }
.lightbox__frame img { width: min(900px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 160px); object-fit: contain; mix-blend-mode: multiply; padding: 4%; }
.lightbox__foot { display: flex; justify-content: center; gap: 10px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.lightbox__foot .btn--secondary { background: rgba(255,255,255,0.08); color: #F2EEE6; border-color: rgba(255,255,255,0.22); }
.lightbox__foot .btn--secondary:hover { background: rgba(255,255,255,0.14); }

/* ---------- Toast ---------- */
.toast { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); background: var(--ink); color: var(--bg); font-size: var(--text-sm); font-weight: var(--weight-semibold); box-shadow: var(--shadow-overlay); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); max-width: calc(100vw - 32px); }
.toast.is-open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .text-btn { color: var(--bg); padding: 0 0 0 8px; min-height: 0; }
.toast .icon { color: color-mix(in srgb, var(--ok) 60%, var(--bg)); }

/* ---------- Item detail ---------- */
.detail { display: grid; gap: var(--s-6); padding-bottom: 120px; }
@media (min-width: 960px) { .detail { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: start; padding-bottom: 64px; } }
.detail__media { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; border: 0; padding: 0; background: var(--plinth); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; }
@media (min-width: 960px) { .detail__media { position: sticky; top: 88px; aspect-ratio: 1; } }
.detail__media img { width: 100%; height: 100%; object-fit: contain; padding: 8%; mix-blend-mode: multiply; transition: transform var(--dur-slow) var(--ease); }
@media (hover: hover) { .detail__media:hover img { transform: scale(1.02); } }
.detail__zoom { position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 34px; border-radius: var(--radius-half); background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); font-size: var(--text-xs); font-weight: var(--weight-semibold); border: 1px solid var(--line); }
.detail__info { display: grid; gap: var(--s-5); align-content: start; }
.detail__eyebrow { font-size: var(--text-sm); color: var(--ink-3); font-weight: var(--weight-medium); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail__title { font-size: 1.5rem; font-weight: var(--weight-bold); letter-spacing: -0.018em; line-height: 1.2; }
@media (min-width: 960px) { .detail__title { font-size: 1.75rem; } }
.detail__price-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.detail__actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* On phones the primary action lives in the sticky bar instead */
.detail__actions .btn--primary { display: none; }
@media (min-width: 960px) { .detail__actions .btn--primary { display: inline-flex; } }

.claim-box { display: grid; gap: 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.claim-box__status { display: flex; align-items: center; gap: 10px; font-weight: var(--weight-semibold); }
.meter { display: flex; gap: 4px; }
.meter span { width: 28px; height: 6px; border-radius: 3px; background: var(--line-strong); }
.meter span.is-on { background: var(--ok); }

.note { padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); font-size: 0.9375rem; line-height: var(--leading-snug); display: grid; gap: 4px; }
.note__who { font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-ink); }
:root[data-theme="dark"] .note__who { color: var(--accent); }

.specs { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.specs th, .specs td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.specs th { width: 34%; color: var(--ink-3); font-weight: var(--weight-medium); padding-right: 12px; }
.specs td { color: var(--ink); font-weight: var(--weight-medium); }
.specs tr:last-child th, .specs tr:last-child td { border-bottom: 0; }
.subhead { font-size: var(--text-xs); font-weight: var(--weight-bold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }

.sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky); display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 96%, transparent); border-top: 1px solid var(--line); }
.sticky-actions .btn { flex: 1; }
@media (min-width: 960px) { .sticky-actions { display: none; } }

/* Comments */
.comments { display: grid; gap: 14px; }
.comment { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.comment__bubble { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.comment__who { font-size: var(--text-sm); font-weight: var(--weight-semibold); display: flex; gap: 8px; align-items: baseline; }
.comment__who time { font-weight: var(--weight-regular); color: var(--ink-3); font-size: var(--text-xs); }
.comment__text { font-size: 0.9375rem; line-height: var(--leading-snug); margin-top: 2px; }
.composer { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.composer__box { display: grid; gap: 8px; }
.composer__box .textarea { min-height: 52px; }

/* ---------- Admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 960px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.kpi { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 4px; }
.kpi__num { font-size: 2.25rem; font-weight: 340; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: var(--text-sm); color: var(--ink-3); font-weight: var(--weight-medium); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table-tools { display: flex; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-tools .input-wrap { flex: 1; min-width: 200px; }
.table-tools .input { min-height: 40px; padding-top: 8px; padding-bottom: 8px; background: var(--surface-2); border-color: var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-3); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .who { display: flex; align-items: center; gap: 10px; }
.table .who b { font-weight: var(--weight-semibold); display: block; line-height: 1.25; }
.table .who > div > span { color: var(--ink-3); font-size: var(--text-xs); }
.table .icon-btn { width: 36px; height: 36px; }
.hide-sm { display: none; }
@media (min-width: 760px) { .hide-sm { display: table-cell; } }

/* Admin: user rows become cards on phones */
@media (max-width: 759px) {
  .table--stack thead { display: none; }
  .table--stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table--stack tr:last-child { border-bottom: 0; }
  .table--stack td { padding: 0; border: 0; }
  .table--stack td.stack-meta { grid-column: 1 / 2; color: var(--ink-3); font-size: var(--text-xs); padding-left: 36px; }
  .table--stack td.stack-action { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
}

.issue { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.issue + .issue { border-top: 1px solid var(--line); }
.issue__main { flex: 1; min-width: 0; }
.issue__title { font-weight: var(--weight-semibold); font-size: 0.9375rem; }
.issue__sub { font-size: var(--text-sm); color: var(--ink-3); }

/* ---------- Landing ---------- */
.hero { padding-block: var(--s-10) var(--s-10); text-align: center; display: grid; justify-items: center; gap: var(--s-5); }
@media (min-width: 960px) { .hero { padding-block: 88px 56px; gap: var(--s-6); } }
.hero__title { font-size: 2.375rem; font-weight: var(--weight-bold); letter-spacing: -0.035em; line-height: 1.04; max-width: 15ch; }
@media (min-width: 960px) { .hero__title { font-size: 4rem; } }
.hero__sub { font-size: 1.0625rem; color: var(--ink-2); max-width: 46ch; line-height: var(--leading-body); }
@media (min-width: 960px) { .hero__sub { font-size: 1.25rem; } }
.signup { width: 100%; max-width: 480px; display: grid; gap: 10px; text-align: left; }
.signup__row { display: grid; gap: 10px; }
@media (min-width: 640px) { .signup__row { grid-template-columns: 1fr auto; } }
.signup .hint { text-align: center; }
.showcase { position: relative; padding: 20px; border-radius: calc(var(--radius) + 6px); background: var(--surface-2); border: 1px solid var(--line); }
@media (min-width: 960px) { .showcase { padding: 28px; } }
.showcase__head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.showcase__head h2 { font-size: var(--text-md); font-weight: var(--weight-bold); }
.steps { display: grid; gap: 14px; padding-block: var(--s-12) var(--s-8); }
@media (min-width: 960px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; padding-block: 72px 48px; } }
.step { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 10px; align-content: start; }
.step__num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: var(--weight-bold); }
:root[data-theme="dark"] .step__num { color: var(--accent); }
.step h3 { font-size: var(--text-md); font-weight: var(--weight-bold); }
.step p { color: var(--ink-2); font-size: 0.9375rem; line-height: var(--leading-snug); }
.site-foot { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink-3); font-size: var(--text-sm); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px 48px; }
.auth__card { width: 100%; max-width: 420px; display: grid; gap: 20px; }
.auth__panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 24px 20px; display: grid; gap: 16px; }
@media (min-width: 640px) { .auth__panel { padding: 32px; } }
.auth__title { font-size: 1.625rem; font-weight: var(--weight-bold); letter-spacing: -0.02em; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: var(--text-sm); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-size: var(--text-sm); }

/* ---------- Share page (visitor) ---------- */
.owner-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.share-summary { display: grid; gap: 14px; }
@media (min-width: 960px) { .share-summary { grid-template-columns: 1fr auto; align-items: center; } }
.mine-strip { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: var(--radius); background: var(--accent-soft); }
.mine-strip__thumb { width: 44px; height: 44px; border-radius: var(--radius-half); background: var(--plinth); overflow: hidden; flex: none; }
.mine-strip__thumb img { width: 100%; height: 100%; object-fit: scale-down; padding: 4px; mix-blend-mode: multiply; }
.mine-strip__text { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: 1.3; }
.mine-strip__text b { display: block; font-weight: var(--weight-semibold); }
.mine-strip__text span { color: var(--ink-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.claim-item { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 10px; border-radius: var(--radius); background: var(--surface-2); }
.claim-item__media { width: 64px; height: 64px; border-radius: var(--radius-half); background: var(--plinth); overflow: hidden; }
.claim-item__media img { width: 100%; height: 100%; object-fit: scale-down; padding: 6px; mix-blend-mode: multiply; }
.claim-item__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Theme picker (account sheet) ---------- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.swatch i { width: 18px; height: 18px; border-radius: 50%; display: block; }
.swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }

/* app.css */
/* =====================================================================
   App-only additions. The prototype used inline style attributes; the
   server's CSP (style-src 'self') forbids those, so each one became a
   class here. Same tokens, no new colours.
   ===================================================================== */

/* ---------- Layout helpers ---------- */
.page { padding-bottom: var(--s-16); }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.row--between { justify-content: space-between; }
.row--baseline { align-items: baseline; }
.pre-line { white-space: pre-line; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ink { color: var(--ink); }
.ok-text { color: var(--ok); font-weight: var(--weight-semibold); }
.accent-text { color: var(--accent-ink); }
:root[data-theme="dark"] .accent-text { color: var(--accent); }
.meta--strong { font-weight: var(--weight-medium); }
.meta--xs { font-size: var(--text-xs); }

/* Skeleton widths (the prototype set these inline) */
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-60 { width: 60%; }
.w-90 { width: 90%; }
.skel--price { height: 16px; margin-top: 4px; }
.skel--w90px { width: 90px; }
.skel--w120px { width: 120px; height: 16px; }
.skel--page-title { width: min(320px, 70%); height: 34px; }
.skel--max520 { max-width: 520px; }
.skel--max300 { max-width: 300px; }

/* ---------- Buttons and links ---------- */
.link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.text-btn--inline { padding: 0; min-height: 0; }
.text-btn--quiet { justify-self: start; padding-left: 0; color: var(--ink-3); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-weight: var(--weight-medium); }
:root[data-theme="dark"] .text-btn--quiet { color: var(--ink-3); }
.text-btn--quiet:hover { color: var(--ink); }
.text-btn--tiny { padding: 0 0 0 4px; min-height: 0; font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); margin-left: auto; }
:root[data-theme="dark"] .text-btn--tiny { color: var(--ink-3); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: var(--text-sm); }
.btn.is-danger { color: var(--danger); }
.icon-btn--lg { width: 52px; height: 52px; }
.file-btn { justify-self: start; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

/* A vertical list of ghost buttons (menus, account sheet, drawer "This list") */
.menu-list { display: grid; gap: 2px; margin: -6px -8px 0; }
.menu-list .btn { justify-content: flex-start; }
.menu-list--drawer { margin: 6px -10px 12px; }

/* ---------- Top bar, brand, auth ---------- */
.topbar--flat { border-bottom-color: transparent; }
.brand__name--lg { font-size: 1.375rem; }
.auth__brand { justify-self: center; }
.auth__panel--center { text-align: center; justify-items: center; }
.hint--center { text-align: center; }
.icon-gh { fill: currentColor; stroke: none; }
.input--trail { padding-left: 14px; padding-right: 52px; }
.input-wrap > .input.input--trail { padding-left: 14px; }
.input--lg { min-height: 52px; }
.input--money { font-family: var(--font-money); font-variant-numeric: lining-nums tabular-nums; }
.account-pw { padding: var(--s-4); border-radius: var(--radius); background: var(--surface-2); }

/* Accent swatches in the account sheet: fixed colours so each dot shows its own accent */
.swatch__dot { width: 18px; height: 18px; border-radius: 50%; display: block; }
.swatch__dot--clay { background: #A64B2A; }
.swatch__dot--pine { background: #2F6B4F; }
.swatch__dot--ink { background: #2C5A88; }
.swatch__dot--honey { background: #D9A441; }
:root[data-theme="dark"] .swatch__dot--clay { background: #E58C68; }
:root[data-theme="dark"] .swatch__dot--pine { background: #7FBF9C; }
:root[data-theme="dark"] .swatch__dot--ink { background: #8DB4DE; }
:root[data-theme="dark"] .swatch__dot--honey { background: #E2B04A; }

/* ---------- Forms ---------- */
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
.fieldset > legend { margin-bottom: 8px; padding: 0; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.field--price { flex: 0 0 130px; }
.field--grow { flex: 1; min-width: 150px; }
.form-error__icon { margin-top: 2px; }
.select--auto { width: auto; flex: none; }

/* ---------- Panels, notices ---------- */
.panel--center { display: grid; gap: 12px; justify-items: center; text-align: center; }
.panel__heading { font-size: var(--text-lg); font-weight: var(--weight-bold); letter-spacing: -0.015em; }
.template__icon--lg { width: 44px; height: 44px; }
.notice--link { margin-bottom: var(--s-6); align-items: center; transition: background-color var(--dur-fast) var(--ease); }
.notice--link:hover { background: var(--surface-3); }
.notice__chev { color: var(--ink-3); }
.notice .text-btn--inline { flex: none; align-self: center; }
.list-notice, .share-notice { margin-bottom: var(--s-4); align-items: center; }
.gone { max-width: 520px; margin: var(--s-12) auto 0; }

/* ---------- Dashboard ---------- */
.page-head__top { padding-top: 8px; }
.archived { margin-top: var(--s-8); display: grid; gap: var(--s-4); }
.archived > .text-btn { justify-self: start; padding-left: 0; }
.template-row--fill { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (min-width: 960px) { .template-row--fill { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* ---------- List page ---------- */
.list-meta { gap: 10px 16px; margin-top: 2px; }
.list-meta .dot-sep > span { white-space: nowrap; } /* wrap between facts, never inside "Edit link on" */
.member-line { gap: 8px; }
.avatar--icon { color: var(--ink-2); }
.section-gap { height: var(--s-6); }
.add-section { margin-top: 28px; }
.list-empty { margin-top: var(--s-6); }
.add-bar + .section-head, .add-bar + section .section-head { margin-top: var(--s-8); }
.item-card__note { font-size: var(--text-xs); line-height: 1.4; }
.item-card__comments { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.item-card__line .hearts + .item-card__comments { margin-left: 0; }

/* Add-by-link preview */
.add-preview__media--center { display: grid; place-items: center; }
.add-preview__media .media-fallback, .item-card__media > .media-fallback { height: 100%; place-content: center; }
.add-preview__reading { font-weight: var(--weight-semibold); }
.preview-row { gap: 10px; align-items: flex-end; }
.found--warn { color: var(--warn); align-items: flex-start; font-size: var(--text-sm); gap: 8px; line-height: var(--leading-snug); }
.found--warn .icon { color: var(--warn); width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* Share dialog and settings */
.share-block { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.share-foot { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 14px; }
.link-tools { padding-bottom: 16px; display: grid; gap: 10px; }
.dialog--narrow { --w: 380px; }
@media (min-width: 640px) { .dialog--narrow { width: min(380px, calc(100vw - 48px)); } }
.dialog__title--sm { font-size: 1rem; line-height: var(--leading-snug); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Item page ---------- */
.page-head--tight { padding-bottom: var(--s-4); }
.detail__head { display: grid; gap: 10px; }
.detail__media--static { cursor: default; display: grid; place-items: center; }
.detail__media--skel { cursor: default; }
.detail__media img { display: block; }
.rating-row { gap: 14px; }
.details-foot { margin-top: 10px; }
.subhead--flush { margin: 0; }
.comments-block { display: grid; gap: 14px; }
.comment__who { flex-wrap: wrap; }
.claim-box--mine { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
/* On phones the sticky bar holds Go to listing; don't show it twice */
.detail__actions .on-wide { display: none; }
@media (min-width: 960px) { .detail__actions .on-wide { display: inline-flex; } }

/* ---------- Share page ---------- */
.share-summary__text { display: grid; gap: 4px; }
.add-bar + .share-summary { margin-top: var(--s-8); }
.share-summary__lead { font-size: 1.25rem; font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.share-summary + .mine-strip { margin-top: 16px; }
.mine-strip { margin-top: 16px; }
.mine-strip .icon { color: var(--ink-2); flex: none; }
.share-foot-page { margin-top: 56px; }
.site-foot__row { gap: 8px 24px; }

/* ---------- Landing ---------- */
.showcase__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 960px) { .showcase__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.glyph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--on-plinth); }
.glyph .icon { width: 38%; height: 38%; stroke-width: 1.2; }
.item-card.is-claimed .glyph { opacity: 0.5; }

/* ---------- Admin ---------- */
.page-title--pad { padding-top: 8px; }
.admin-cols { display: grid; gap: 20px; margin-top: 20px; }
@media (min-width: 1100px) { .admin-cols { grid-template-columns: 360px minmax(0, 1fr); align-items: start; } }
.admin-side { display: grid; gap: 16px; }
.panel--settings { padding-top: 8px; padding-bottom: 8px; }
.admin-notice { margin-top: var(--s-4); }

/* ---------- Toast ---------- */
.toast .toast__icon--error { color: color-mix(in srgb, var(--danger) 55%, var(--bg)); }
/* The last message stays in the pill while it fades; hide it once the fade ends so its button can't take focus. */
.toast:not(.is-open) { visibility: hidden; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur); }
