/* Gift Haul app styles. Tokens come from docs/SPEC.md section 13 (the approved mock-up).
   No inline styles anywhere (CSP style-src 'self', rule R5.3): every look is a class here.

   Font: system font stack. Plus Jakarta Sans is listed first so it is used if it is already
   installed on the device, but it is never downloaded (no @font-face, no external fonts),
   so the content security policy stays as it is (task 0003, see the journal).

   Contrast (WCAG ratio, checked for task 0003): ink on bg 14.7, muted on bg 7.5, white on
   primary 7.9, white on action 4.85, action on card 4.85, tinted text pairs 6.5 to 9.0.
   Action colour as text on the page background is only 4.27: use it on cards only. */

:root {
  --bg: #EEF0FA;
  --card: #FFFFFF;
  --ink: #1B1A3A;
  --muted: #4A4870;
  --primary: #4338CA;
  --primary-dark: #2F2A8F;
  --primary-tint: #E4E2FB;
  --primary-soft: #F1F0FD;
  --action: #C8451F;
  --action-tint: #FDE6DC;
  --action-text: #8A2C10;
  --claimed: #0F766E;
  --claimed-tint: #D7F1EC;
  --claimed-text: #0B5750;
  --amber-tint: #FFF0C7;
  --amber-text: #7A4B00;
  --danger: #B3261E;
  --line: #DCDDF0;
  --line-soft: #E6E7F5;
  --line-strong: #C9CAE6;
  --dashed: #9C9BD0;
  --on-primary-glass: rgba(255, 255, 255, 0.16);

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius-card: 16px;
  --radius-control: 14px;
  --radius-small: 12px;
  --radius-header: 22px;
  --touch: 44px;
  --gutter: 16px;
  --app-width: 560px;

  color-scheme: light;
  font: 400 15px/1.45 var(--font);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); }
h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { flex: none; }

:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ app frame */

/* Phone first: the frame fills the screen. On a wide screen it becomes a centred column. */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--app-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
@media (min-width: 600px) {
  html { background: #DFE2F4; }
  .app { box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(27, 26, 58, 0.12); }
}

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px var(--gutter) 16px;
}
.content.roomy { gap: 12px; padding-top: 14px; }

/* ------------------------------------------------------------------ header band */

.header-band {
  flex: none;
  background: var(--primary);
  color: #FFFFFF;
  padding: 12px var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 0 0 var(--radius-header) var(--radius-header);
}
.header-band.has-back { padding-left: 6px; padding-bottom: 14px; }
.header-row { display: flex; align-items: center; gap: 10px; min-height: var(--touch); }
.header-band.has-back .header-row { gap: 4px; }
.header-titles { flex: 1; min-width: 0; }
.header-title { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.2; overflow-wrap: anywhere; }
.header-band.has-back .header-title { font-size: 18px; letter-spacing: 0; }
.header-subtitle { font-size: 12px; font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: var(--radius-small);
  background: #FFFFFF; color: var(--action);
  display: flex; align-items: center; justify-content: center;
}

.back-button {
  width: var(--touch); height: var(--touch); flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-small);
  background: none; color: #FFFFFF; cursor: pointer; padding: 0;
}
.back-button:hover { background: var(--on-primary-glass); }

/* Pill on the header: "New list", "Chat". */
.header-pill {
  min-height: var(--touch);
  padding: 0 16px;
  border: 0; border-radius: 22px;
  background: #FFFFFF; color: var(--primary);
  font-size: 14px; font-weight: 700; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.header-pill:hover { color: var(--primary-dark); }
.count-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--action); color: #FFFFFF;
  font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Stat tiles under the header ("2 gifts to buy"). */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.header-band.has-back .tiles { padding-left: 10px; }
.tile {
  background: var(--on-primary-glass);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  color: #FFFFFF; text-decoration: none; display: block; min-width: 0;
}
a.tile:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.24); }
.tile-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.tile-value { font-size: 20px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
/* "No countdown": Home shows two tiles (task 0015). */
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile-label { font-size: 12px; font-weight: 500; }

/* ------------------------------------------------------------------ groups and cards */

.group-heading { display: flex; align-items: center; gap: 8px; min-height: 36px; margin-top: 2px; }
.group-dot {
  width: 24px; height: 24px; flex: none; border-radius: 12px;
  background: var(--primary); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
}
.group-dot.tone-action { background: var(--action); }
.group-dot.tone-claimed { background: var(--claimed); }
.group-dot.tone-amber { background: var(--amber-text); }
.group-name { font-size: 15px; font-weight: 800; }
.group-meta { font-size: 12px; color: var(--muted); flex: 1; }

.card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--card); color: var(--ink);
  border-radius: var(--radius-card);
  text-decoration: none;
}
a.card:hover { color: var(--ink); box-shadow: 0 0 0 2px var(--line-strong); }
.card.stacked { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
.card.highlight { border: 2px solid var(--action); }

.card-icon {
  width: var(--touch); height: var(--touch); flex: none;
  border-radius: var(--radius-small);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-tint); color: var(--primary);
}
.tone-action > .card-icon, .card-icon.tone-action { background: var(--action-tint); color: var(--action); }
.card-icon.tone-claimed { background: var(--claimed-tint); color: var(--claimed); }
.card-icon.tone-amber { background: var(--amber-tint); color: var(--amber-text); }

.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.card-date { font-size: 12px; font-weight: 700; color: var(--action); flex: none; }
.card-note { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card-note.tone-primary { color: var(--primary-dark); }
.card-note.tone-claimed { color: var(--claimed-text); }

/* Progress bar: the fill width is set through the CSSOM (style.width), which the CSP allows;
   no style attribute is ever written. */
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-row > .progress { flex: 1; }
.progress { flex: none; height: 6px; border-radius: 3px; background: var(--primary-tint); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--claimed); border-radius: 3px; }
.progress.tone-action { background: var(--action-tint); }
.progress.tone-action .progress-fill { background: var(--action); }
.progress.large { height: 12px; border-radius: 6px; }
.progress.large .progress-fill { border-radius: 6px; }
.progress-label { font-size: 12px; font-weight: 600; color: var(--claimed-text); flex: none; }

/* ------------------------------------------------------------------ chips and strips */

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  min-height: var(--touch);
  padding: 0 14px;
  border: 0; border-radius: 22px;
  background: var(--card); color: var(--ink);
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; font-weight: 700; }

/* Small status label ("Nana has it", "You claimed this"). Not interactive. */
.tag {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 10px;
  font-size: 12px; font-weight: 700;
  background: var(--primary-tint); color: var(--primary-dark);
}
.tag.tone-claimed { background: var(--claimed-tint); color: var(--claimed-text); }
.tag.tone-action { background: var(--action-tint); color: var(--action-text); }
.tag.tone-amber { background: var(--amber-tint); color: var(--amber-text); }

.info-strip {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px; border-radius: var(--radius-small);
  background: var(--primary-tint); color: var(--primary-dark);
  font-size: 12px; font-weight: 600; line-height: 1.45;
}
.info-strip svg { margin-top: 1px; }
.info-strip.tone-amber { background: var(--amber-tint); color: var(--amber-text); }
.info-strip.tone-action { background: var(--action-tint); color: var(--action-text); }
.info-strip.tone-claimed { background: var(--claimed-tint); color: var(--claimed-text); }
/* Task 0040: the invite link with its Copy button. */
.invite-link-box { padding: 10px 12px; border-radius: var(--radius-small); background: var(--primary-tint); }
.invite-link-box .button-row > .input { flex: 1; min-width: 0; font-size: 13px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  min-height: var(--touch);
  padding: 0 18px;
  border: 0; border-radius: var(--radius-control);
  font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: #FFFFFF;
}
.btn:hover { color: #FFFFFF; background: var(--primary-dark); }
.btn.action { background: var(--action); }
.btn.action:hover { background: #A93A1A; }
.btn.outline { background: var(--card); color: var(--primary); border: 1.5px solid var(--primary); }
.btn.outline:hover { background: var(--primary-soft); color: var(--primary-dark); }
.btn.quiet { background: var(--card); color: var(--ink); border: 1.5px solid var(--line-strong); }
.btn.quiet:hover { background: var(--primary-soft); color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #8F1E18; }
.btn.large { min-height: 52px; border-radius: var(--radius-card); font-size: 16px; font-weight: 800; }
.btn.block { display: flex; width: 100%; }
.btn.grow { flex: 1; }
.btn.square { width: 52px; min-height: 52px; padding: 0; flex: none; border-radius: var(--radius-card); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* "New group of people" style: dashed, add-something button. */
.btn-dashed {
  min-height: var(--touch); margin-top: 3px;
  border: 2px dashed var(--dashed); border-radius: var(--radius-card);
  background: none; color: var(--primary-dark);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-dashed:hover { background: var(--primary-soft); }

/* Small white pill next to a group name ("Invite"). Kept at 44px for touch. */
.btn-pill {
  min-height: var(--touch); padding: 0 14px;
  border: 0; border-radius: 22px;
  background: var(--card); color: var(--primary-dark);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-pill:hover { background: var(--primary-soft); }

.link-button {
  min-height: var(--touch); padding: 0 4px;
  border: 0; background: none; color: var(--primary);
  font-weight: 800; cursor: pointer; text-decoration: underline;
}

/* ------------------------------------------------------------------ bottom bars */

/* Bottom action bar ("Add a gift idea", "Update my pledge"). */
.action-bar {
  flex: none;
  position: sticky; bottom: 0;
  display: flex; gap: 10px; align-items: flex-end;
  padding: 10px var(--gutter) 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
}

/* Bottom tab bar: Lists, Secret Santa, Settings. */
.tab-bar {
  flex: none;
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 64px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 64px;
  text-decoration: none; color: var(--muted);
  font-size: 12px; font-weight: 600;
}
.tab:hover { color: var(--primary-dark); }
.tab[aria-current="page"] { color: var(--primary); font-weight: 700; }

/* ------------------------------------------------------------------ forms */

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.input {
  min-height: 52px; width: 100%;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-card);
  padding: 0 14px; background: var(--card); color: var(--ink);
  font-size: 16px; font-weight: 600;
}
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 1.2em; }
.link-autofill { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.field-hint { font-size: 13px; font-weight: 600; color: var(--muted); flex: 1 1 180px; }
.field-hint:empty { display: none; }

/* ------------------------------------------------------------------ simple text blocks */

.section-title { font-size: 15px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ink { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.form[aria-busy="true"] { opacity: 0.7; }
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 28px 16px; background: var(--card); border-radius: var(--radius-card);
}
.empty-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--primary-tint); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.empty-title { font-size: 16px; font-weight: 800; }
.empty-text { font-size: 13px; color: var(--muted); max-width: 34ch; }

/* ------------------------------------------------------------------ groups (task 0005) */

.stack { display: flex; flex-direction: column; gap: 8px; }
.loading { padding: 12px 4px; }
.block { display: block; }
.grow { flex: 1; min-width: 0; }

/* Home: one group with its lists. */
.group-section { display: flex; flex-direction: column; gap: 7px; }
.group-link { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--touch); }
.group-link:hover { color: var(--primary-dark); text-decoration: underline; }
.group-lists { display: flex; flex-direction: column; gap: 7px; }
.group-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 4px 4px 14px; border-radius: var(--radius-card);
  background: var(--primary-soft); color: var(--muted);
  font-size: 13px; font-weight: 600;
}
.group-empty .link-button { font-size: 13px; }

/* A card with a row inside (invitation on Home). */
.card-row { display: flex; align-items: center; gap: 12px; }

/* Management cards, after docs/design/Manage.dc.html. */
.card.tight { gap: 0; padding: 12px 12px 8px; }
.card.tight > .muted, .card.tight > .form { padding: 4px 0 10px; }
.card-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0 4px; }
.card-label-row + .card-label-row, .person-row + .card-label-row { margin-top: 10px; }
.card-label { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.card-label-meta { font-size: 12px; font-weight: 600; color: var(--muted); }

.person-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  min-height: 52px; padding: 4px 0;
  border-bottom: 1px solid var(--line-soft);
}
.person-row:last-child { border-bottom: 0; }
.person-row > .tag { align-self: center; }
.person-row > .form-error { flex-basis: 100%; min-height: 0; }
.person-row > .form-error:empty { display: none; }
.person-row .btn { min-height: var(--touch); padding: 0 12px; border-radius: var(--radius-small); font-size: 13px; }
.person-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.person-name .muted { font-weight: 600; }
.person-row.editing { padding: 8px 0; }
.person-row.confirm { border-bottom: 0; padding: 0; }

.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  background: var(--primary-tint); color: var(--primary-dark);
}
.avatar.tone-claimed { background: var(--claimed-tint); color: var(--claimed-text); }
.avatar.tone-amber { background: var(--amber-tint); color: var(--amber-text); }

/* "Remove Aunty Jo from…" confirmation, after the mock-up. */
.confirm-box {
  flex: 1; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px 10px; margin: 6px -4px; border-radius: var(--radius-control);
  background: var(--action-tint); color: var(--action-text);
}
.confirm-top { display: flex; align-items: center; gap: 10px; }
.confirm-top .avatar { background: var(--card); color: var(--action-text); }
.confirm-text { font-weight: 600; }
.button-row { display: flex; gap: 8px; }
.confirm-box .btn.quiet { border: 0; }
.form-status { color: var(--claimed-text); font-size: 13px; font-weight: 700; }
.form-status:empty { display: none; }

/* Header actions on a sub-screen: translucent pill ("Rename"), as in the mock-up. */
.glass-actions .header-pill { background: var(--on-primary-glass); color: #FFFFFF; }
.glass-actions .header-pill:hover { background: rgba(255, 255, 255, 0.24); color: #FFFFFF; }

/* ------------------------------------------------------------------ lists (task 0006) */
/* After docs/design/NewList.dc.html and Manage.dc.html. */

a.link-button { display: inline-flex; align-items: center; }

/* Name and date side by side, as in the mock-up. Equal columns: a phone's date input needs the room. */
.form-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
select.input { appearance: auto; cursor: pointer; }
input[type="date"].input { padding: 0 10px; }

/* "Me / Someone else" toggle. */
.segmented {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px; border-radius: var(--radius-small); background: var(--bg);
}
.segment {
  min-height: var(--touch); border: 0; border-radius: 10px;
  background: none; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer;
}
.segment[aria-pressed="true"] { background: var(--primary); color: #FFFFFF; font-weight: 700; }

/* "Yes, Max can add ideas" / "No, gift buyers only" radio cards. */
.choice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-control); cursor: pointer;
}
.choice.selected { border: 2px solid var(--primary); background: var(--primary-soft); }
.choice-radio { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-size: 14px; font-weight: 700; }
/* Settings: "Count down to" (task 0015, Settings.dc.html). */
.stack.tight { gap: 8px; }
.choice-wrap { display: flex; flex-direction: column; gap: 8px; }
.choice-wrap > .choice { align-items: center; min-height: 52px; }
.choice-meta { font-size: 12px; font-weight: 700; color: var(--muted); flex: none; }
.own-event-fields { display: grid; grid-template-columns: 1.6fr 1fr; gap: 8px; }

/* "Max can see" / "Hidden from Max". */
.rule-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rule-box { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: var(--radius-small); }
.rule-box.tone-claimed { background: var(--claimed-tint); color: var(--claimed-text); }
.rule-box.tone-action { background: var(--action-tint); color: var(--action-text); }
.rule-title { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; }
.rule-text { font-size: 12px; line-height: 1.45; }

/* People to tick: pill-shaped checkboxes. */
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip {
  min-height: var(--touch); padding: 0 14px 0 10px; border-radius: 22px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--ink);
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.person-chip.checked { border-color: var(--primary); background: var(--primary); color: #FFFFFF; font-weight: 700; }
.person-chip.invite { border: 1.5px dashed var(--primary); color: var(--primary); font-weight: 700; padding: 0 14px; }
.person-chip.invite:hover { background: var(--primary-soft); color: var(--primary-dark); }
.person-check { width: 16px; height: 16px; margin: 0; accent-color: var(--primary-dark); }
.add-note { padding: 8px 0 4px; }

/* Delete: red outline button, as in the mock-up. */
.danger-zone .btn.outline { color: var(--danger); border: 2px solid var(--danger); font-weight: 800; }
.danger-zone .btn.outline:hover { background: #FBEAEA; color: var(--danger); }

/* ------------------------------------------------------------------ gift ideas (task 0008) */
/* After docs/design/List.dc.html, Item.dc.html and Manage.dc.html. */

/* One idea on the list: photo, name, price, who added it. */
.idea-thumb {
  width: 64px; height: 64px; flex: none; border-radius: var(--radius-small);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-tint); color: var(--primary);
}
.idea-thumb.tone-action { background: var(--action-tint); color: var(--action); }
.idea-thumb.tone-claimed { background: var(--claimed-tint); color: var(--claimed); }
.idea-thumb.tone-amber { background: var(--amber-tint); color: var(--amber-text); }
.idea-thumb.large { width: 132px; height: 132px; }
.idea-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.idea-name { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.idea-price { font-size: 13px; font-weight: 800; color: var(--action); }
.idea-meta { font-size: 12px; color: var(--muted); }
.idea-chevron { flex: none; color: var(--muted); display: flex; }
/* Claims (task 0011, List.dc.html): the row is a card holding a link (photo + text) and the claim control. */
.card.idea-row { padding: 10px; }
.idea-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; border-radius: var(--radius-small); }
.idea-link:hover { color: var(--ink); }
.idea-link:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.idea-claim { flex: none; max-width: 42%; display: flex; align-items: center; }
.claim-error:empty { display: none; }
.idea-name.taken { color: var(--muted); text-decoration: line-through; }
.idea-price.taken { color: var(--muted); }
.idea-claimed { display: flex; }
.claim-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 12px;
  background: var(--claimed-tint); color: var(--claimed-text); font-size: 12px; font-weight: 700;
  overflow-wrap: anywhere;
}
.claim-chip > svg { flex: none; }
.claim-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.filter-empty { padding: 14px 4px; text-align: center; }

/* One idea's own screen. */
.idea-detail { align-items: stretch; padding: 10px; }
.idea-detail-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.detail-price { font-size: 26px; font-weight: 800; color: var(--action); line-height: 1; }
.idea-notes { font-size: 13px; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; flex: 1; }
.shop-link {
  min-height: var(--touch); border-radius: var(--radius-small);
  background: var(--primary-tint); color: var(--primary-dark); text-decoration: none;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.shop-link:hover { color: var(--primary-dark); background: #D8D5F8; }
/* Gift photos (task 0010). Always served by our backend (same origin). */
img.idea-thumb.photo { display: block; object-fit: cover; background: var(--primary-tint); }
.photo-box {
  position: relative; flex: none; padding: 0; border: 0; border-radius: var(--radius-small);
  background: none; cursor: pointer; font: inherit; color: inherit;
}
.photo-box:disabled { cursor: default; }
.photo-box:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.photo-count {
  position: absolute; right: 6px; bottom: 6px; padding: 2px 8px; border-radius: 10px;
  background: rgba(27, 26, 58, 0.72); color: #FFFFFF; font-size: 12px; font-weight: 700;
}
/* Task 0045: the admin page's per-row actions wrap on a phone screen. */
.admin-actions { flex-wrap: wrap; }
.admin-actions .btn.quiet { padding-left: 10px; padding-right: 10px; }
.photo-editor .button-row { flex-wrap: wrap; }
.photo-editor .button-row .btn { flex: 1 1 140px; }
@media (max-width: 359px) {
  .idea-detail { flex-direction: column; }
  .idea-thumb.large { width: 100%; height: 132px; }
  .photo-box { width: 100%; }
}

/* Notes field. */
textarea.input { min-height: 96px; padding: 12px 14px; line-height: 1.4; resize: vertical; font-weight: 500; }

/* Manage: a removal request waiting for the list creator, and short idea rows. */
.request-box {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px 10px; margin: 2px -4px 4px; border-radius: var(--radius-control);
  background: var(--amber-tint);
}
.request-who { font-size: 12px; font-weight: 800; color: var(--amber-text); }
.request-what { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.request-what .muted { font-weight: 600; }
.request-box .btn.quiet { border: 0; }
.request-box > .form-error:empty { display: none; }
.idea-line { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.idea-line:hover { color: var(--primary-dark); }
a.info-strip { text-decoration: none; }
a.info-strip:hover { color: var(--amber-text); box-shadow: 0 0 0 2px var(--line-strong); }

/* ------------------------------------------------------------------ pitch in (task 0012) */
/* After docs/design/Item.dc.html ("Pitching in together", pledge bar) and List.dc.html (pitch-in row). */
.idea-pledged { font-weight: 600; color: var(--muted); }
.idea-body > .progress { margin-top: 3px; }
.pitch-total-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pitch-total { font-size: 30px; font-weight: 800; line-height: 1; color: var(--ink); }
.pitch-of { font-size: 14px; font-weight: 600; color: var(--muted); }
.pledge-list { display: flex; flex-direction: column; }
.pledge-row .avatar { width: 36px; height: 36px; border-radius: 18px; font-size: 14px; }
.pledge-amount { flex: none; min-width: 52px; text-align: right; font-size: 15px; font-weight: 800; }
.card .button-row > select.input { flex: 1; min-width: 0; }
.pledge-bar { flex-direction: column; align-items: stretch; gap: 4px; }
.pledge-bar-inner { display: flex; flex-direction: column; gap: 4px; }
.pledge-form { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-end; }
.pledge-field { width: 112px; flex: none; display: flex; flex-direction: column; gap: 4px; }
.input.pledge-input { height: 52px; border-radius: 16px; font-size: 18px; font-weight: 800; }
.pledge-error:empty { display: none; }

/* ------------------------------------------------------------------ chat (task 0013) */
/* After docs/design/Chat.dc.html. */
.chat-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: -10px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter);
  background: var(--card); border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; min-height: var(--touch);
}
.chat-strip-text { font-size: 13px; font-weight: 600; }
.chat-strip-link { flex: none; font-size: 13px; font-weight: 700; color: var(--primary); }
.chat-strip:hover .chat-strip-link { color: var(--primary-dark); }
/* The loaded chat fills the screen so short conversations sit just above the message box. */
.stack:has(> .chat-log) { flex: 1; }
.chat-log { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; padding: 4px 0; }
.chat-day {
  align-self: center; padding: 3px 10px; border-radius: 10px;
  background: var(--line); color: var(--ink); font-size: 12px; font-weight: 600;
}
.chat-empty { align-self: center; text-align: center; padding: 24px 0; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; max-width: 84%; }
.chat-row .avatar { width: 30px; height: 30px; border-radius: 15px; }
.chat-msg {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  background: var(--card); border-radius: 16px 16px 16px 4px; padding: 8px 12px;
}
.chat-msg.mine {
  align-self: flex-end; max-width: 78%;
  background: var(--primary); color: #FFFFFF; border-radius: 16px 16px 4px 16px;
}
.chat-name { font-size: 12px; font-weight: 700; color: var(--primary-dark); }
.chat-row.tone-claimed .chat-name { color: var(--claimed-text); }
.chat-row.tone-amber .chat-name { color: var(--amber-text); }
/* Plain text: keep the line breaks people typed, break long links instead of overflowing. */
.chat-text { font-size: 14px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-time { align-self: flex-end; font-size: 11px; font-weight: 500; color: var(--muted); }
.chat-msg.mine .chat-time { color: rgba(255, 255, 255, 0.78); }
.chat-item {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px;
  background: var(--action-tint); color: var(--ink); text-decoration: none; min-height: var(--touch);
}
.chat-item:hover { color: var(--ink); box-shadow: 0 0 0 2px var(--line-strong); }
.chat-item-icon {
  width: 36px; height: 36px; flex: none; border-radius: 9px;
  background: var(--card); color: var(--action); display: flex; align-items: center; justify-content: center;
}
.chat-item-text { display: flex; flex-direction: column; min-width: 0; }
.chat-item-name { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.chat-item-detail { font-size: 12px; font-weight: 600; color: var(--action-text); }
.chat-status:empty { display: none; }
.chat-bar { flex-direction: column; align-items: stretch; gap: 6px; padding-left: 12px; padding-right: 12px; }
.chat-form { display: flex; gap: 8px; align-items: center; }
.input.chat-input { flex: 1; min-width: 0; min-height: 48px; height: 48px; font-size: 16px; font-weight: 500; }
.chat-form .btn.square { width: 48px; min-height: 48px; }
.btn.action.chat-attach { background: var(--action-tint); color: var(--action); }
.btn.action.chat-attach:hover { background: #F9D3C2; color: var(--action); }
.chat-error:empty { display: none; }
.chat-attached {
  display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; border-radius: 12px;
  background: var(--action-tint); color: var(--action-text); font-size: 13px; font-weight: 700;
}
.chat-attached[hidden] { display: none; }
.chat-attached-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chat-attached-remove {
  width: var(--touch); height: var(--touch); flex: none; border: 0; border-radius: 12px;
  background: none; color: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.chat-picker { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow-y: auto; }
.chat-picker[hidden] { display: none; }
.chat-pick {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: var(--touch); padding: 6px 12px; border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
}
.chat-pick:hover { background: var(--primary-soft); }
.chat-pick-price { flex: none; font-weight: 800; color: var(--action); }

/* Notifications (task 0014; not in the mock-up, built from its parts). */
.icon-pill { position: relative; width: var(--touch); padding: 0; justify-content: center; }
.icon-pill .count-badge { position: absolute; top: -2px; right: -4px; }
.count-badge[hidden] { display: none; }
.notif-card { flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0; }
.notif-list { display: flex; flex-direction: column; }
.notif-list > [role="listitem"] + [role="listitem"] { border-top: 1px solid var(--line); }
.notif {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: var(--touch); padding: 10px 12px;
  border: 0; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.notif:hover { color: var(--ink); background: var(--primary-soft); }
.notif.unread { background: var(--primary-soft); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-text { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.notif.unread .notif-text { font-weight: 800; }
.notif-meta { font-size: 12px; color: var(--muted); }
.notif-dot { width: 10px; height: 10px; flex: none; border-radius: 5px; background: var(--action); }

/* PIN lock (task 0016, docs/design/Pin.dc.html). */
.pin-centre { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 10px 8px 10px; text-align: center; }
.pin-lock-tile {
  width: 60px; height: 60px; border-radius: 20px;
  background: #FFFFFF; color: var(--action);
  display: flex; align-items: center; justify-content: center;
}
.pin-list-name { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.pin-prompt { font-size: 14px; font-weight: 500; }
.pin-dots { display: flex; gap: 16px; padding-top: 6px; min-height: 24px; }
.pin-dot { width: 18px; height: 18px; border-radius: 9px; border: 2px solid #FFFFFF; }
.pin-dot.filled { background: #FFFFFF; }
.pin-screen { gap: 12px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pin-key {
  min-height: 60px; border: 0; border-radius: 18px;
  background: var(--card); color: var(--ink);
  font-size: 26px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pin-key:hover { background: var(--primary-soft); }
.pin-key:active { background: var(--primary-tint); }
.pin-key.quiet { background: none; color: var(--primary); font-size: 14px; }
.pin-key.quiet:hover { background: var(--primary-soft); }
.pin-key-gap { min-height: 60px; }
.card-unlock { font-weight: 800; color: var(--primary); }

/* ------------------------------------------------------------------ Secret Santa (task 0017, Santa.dc.html) */

.steps {
  list-style: none; margin: 0; padding: 12px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
}
.step { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.step-dot {
  width: 28px; height: 28px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-strong); color: var(--muted);
  font-size: 13px; font-weight: 800;
}
.step.done .step-dot { border: 0; background: var(--claimed); color: #FFFFFF; }
.step.current .step-dot { border-color: var(--primary); color: var(--primary); }
.step-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.step.done .step-label { color: var(--claimed-text); }
.step.current .step-label { color: var(--primary-dark); }

.match-card {
  background: var(--ink); color: #FFFFFF; border-radius: var(--radius-card);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.match-kicker { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: #FFD98A; }
.match-row { display: flex; align-items: center; gap: 12px; }
.match-avatar {
  width: 56px; height: 56px; flex: none; border-radius: 28px;
  background: var(--amber-tint); color: var(--amber-text);
  font-size: 24px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.match-name { font-size: 28px; font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.match-meta { font-size: 13px; font-weight: 500; }
.lock-note {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: var(--radius-small); background: rgba(255, 255, 255, 0.12);
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
/* Wish lists (task 0018, Santa.dc.html "Sam's wish list") */
.wish-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.wish-thumb { width: 40px; height: 40px; flex: none; }
.wish-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
a.wish-name { color: var(--primary); }
.wish-price { flex: none; font-size: 14px; font-weight: 800; color: var(--action); }
.bought-note {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px;
  border-radius: var(--radius-card); background: var(--claimed-tint); color: var(--claimed-text);
  font-size: 15px; font-weight: 800;
}
/* After the event (task 0019): archive, reveal, "show it was me", Archived lists */
.reveal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.reveal-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--claimed-tint); }
.reveal-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--card); color: var(--claimed); }
.reveal-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reveal-name { font-size: 14px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.reveal-body .muted { color: var(--claimed-text); }
.reveal-card { border: 1px solid var(--amber-tint); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; }
.check { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--primary); }
.archived-link { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
/* Task 0043: the terms of use, scrollable inside their card. */
.terms-box { max-height: 52vh; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; display: flex; flex-direction: column; gap: 8px; }
.terms-box p { margin: 0; }
.terms-box:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.terms-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Task 0046: bug reports and suggestions (Settings -> My reports, admin page -> Reports). */
.report-row {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--touch); padding: 10px 0;
  border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none;
}
.report-row:last-child { border-bottom: 0; }
.report-row:hover { color: var(--ink); background: var(--primary-soft); }
.report-row.unread .ink { font-weight: 800; }
.report-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.report-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.report-shot { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.report-log { justify-content: flex-start; }
.report-log .chat-msg:not(.mine) { background: var(--primary-tint); }

/* ------------------------------------------------------------------ install the app (task 0047) */
.install-card { border: 2px solid var(--primary-tint); }
.install-head { display: flex; align-items: center; gap: 10px; }
.install-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary-tint); color: var(--primary);
}
.install-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.install-step { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.install-step-num {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: var(--card); font-size: 13px; font-weight: 800;
}
.install-step-icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--bg); color: var(--primary-dark); border: 1px solid var(--line);
}
.install-step-text { font-size: 14px; font-weight: 600; color: var(--ink); }

/* Short message near the bottom of the screen ("Press back again to exit"). */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 50; max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 14px;
  background: var(--ink); color: var(--card);
  font-size: 14px; font-weight: 600; text-align: center;
  pointer-events: none;
}
