/* ============================================================
   TrolleyList — design tokens
   Palette: paper-white surface, deep emerald accent (savings/money),
   mustard-gold for price highlights. Space Mono for numerals/headings
   (receipt-printer character), Karla for body text.
   The fonts are files of this site (static/fonts): nothing is loaded
   from another company.
   ============================================================ */
@font-face { font-family: "Karla"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/karla-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Karla"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/karla-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Karla"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/karla-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/space-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/space-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --paper: #faf9f6;
  --surface: #ffffff;
  --surface-2: #f2efe6;
  --ink: #1b1b18;
  --ink-soft: #4a473f;
  --muted: #6e6a62;
  --muted-2: #9a958a;
  --border: #e3ded2;
  --border-strong: #d0c9b8;

  --accent: #146b4d;
  --accent-dark: #0e4f39;
  --accent-soft: #e3f0ea;
  --accent-line: #a9cdbd;
  --accent-pale: #b5d2c5;
  --gold: #b9860f;
  --gold-dark: #5c4300;
  --gold-soft: #faf1dc;
  --danger: #ac3f2f;
  --danger-dark: #8a2f22;
  --danger-soft: #fbebe7;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --font-body: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Consolas, monospace;

  /* "What you buy" on Home: five kinds told apart by colour, everything else in grey */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-other: #b9b4a6;

  --shadow-card: 0 1px 2px rgba(27, 27, 24, 0.04), 0 1px 8px rgba(27, 27, 24, 0.03);
  --side-w: 236px;
  --tabs-h: 68px;
  --bar-max: 64px;

  /* Aliases for older templates still using pre-redesign variable names */
  --text-secondary: var(--muted);
  --text-muted: var(--muted-2);
  --text: var(--ink);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ico { flex: 0 0 auto; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- The frame: a side menu on a PC, a top bar and a bottom bar on a phone ---------- */
.shell { display: flex; align-items: stretch; min-height: 100vh; }
.side {
  flex: 0 0 var(--side-w);
  width: var(--side-w);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 2px dashed var(--border-strong);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.main { flex: 1 1 auto; min-width: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
}
.side .brand { padding: 0 8px; }

.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group.last { border-top: 1px dashed var(--border-strong); padding-top: 14px; }
.side-label { padding: 0 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
}
.side-link:hover { background: var(--surface-2); color: var(--ink); }
.side-link.on { background: var(--accent-soft); color: var(--accent-dark); }
.side-link .grow { flex: 1 1 auto; min-width: 0; }
.side-count { font-family: var(--font-mono); font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); color: var(--ink-soft); }
.side-user { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.side-small { display: flex; flex-wrap: wrap; gap: 0 14px; padding: 0 10px; font-size: 13px; }
.side-small a { display: flex; align-items: center; min-height: 30px; color: var(--muted); }
.side-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}
.side-add:hover { background: var(--accent-dark); }

.top { display: none; }
.tabs { display: none; }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 32px 104px; }

h1 { font-family: var(--font-mono); font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-family: var(--font-mono); font-size: 16px; font-weight: 700; margin: 32px 0 12px; letter-spacing: 0.01em; }
p.subtitle { color: var(--muted); margin: 0 0 24px; font-size: 14.5px; max-width: 60ch; }

.flash {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid var(--accent-line);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
}

.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.head-row h2 { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; font-weight: 700; text-decoration: none; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > h2 { margin: 6px 0 -4px; }
.stack > .card, .stack > .rows, .stack > .metrics { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 20px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Metric cards ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.metric-card .label { font-size: 12px; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.metric-card .value { font-family: var(--font-mono); font-size: 25px; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Tabs inside a page (Money, Top lists, Admin): pills ---------- */
.range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 20px;
}
.range-tab {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 14px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-soft);
  padding: 0 14px;
  border-radius: 20px;
  text-decoration: none;
  white-space: nowrap;
}
.range-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.range-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Day / Week / Month / Year / Custom ---------- */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
}
.seg a, .seg button, .seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  cursor: pointer;
  white-space: nowrap;
}
.seg a.on, .seg button.on, .seg input:checked + label { border-color: var(--border-strong); background: var(--surface); color: var(--ink); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper .step-label { font-family: var(--font-mono); font-weight: 700; font-size: 14px; text-align: center; }
.step-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.step-btn.off { visibility: hidden; }
.period-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.period-bar .seg { flex: 1 1 320px; max-width: 460px; }
.period-bar .stepper { flex: 0 1 auto; }

/* ---------- The big total ---------- */
.total-card { display: flex; flex-direction: column; gap: 12px; }
.total-label { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 0; }
.total-amount { font-family: var(--font-mono); font-weight: 700; font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
.total-amount.pos { color: var(--accent); }
.total-amount.neg { color: var(--danger-dark); }
.total-sub { font-size: 14px; color: var(--ink-soft); margin: 0; }
.total-note { font-size: 13px; color: var(--muted); margin: 0; }
.rule { border: 0; border-top: 1px dashed var(--border-strong); margin: 0; }

/* bars: the days of a week, or months */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; height: calc(var(--bar-max) + 22px); }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; color: inherit; text-decoration: none; }
.bar { width: 26px; max-width: 80%; height: calc(var(--bar-max) * var(--h, 0) / 100); min-height: 0; border-radius: 4px 4px 0 0; background: var(--accent-pale); }
.bar-col.has .bar { min-height: 3px; }
.bar-col.now .bar { background: var(--accent); }
a.bar-col:hover .bar { background: var(--accent-dark); }
.bar-val { font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.bar-col.now .bar-val { font-weight: 700; color: var(--ink); }
.bar-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; border-top: 1px solid var(--border-strong); padding-top: 4px; margin-top: -12px; font-size: 12px; color: var(--muted); text-align: center; }
.bar-labels .now { font-weight: 700; color: var(--ink); }
.bar-labels .future { color: var(--muted-2); }

/* a name, a bar, a number: shops and categories */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 24px; }
/* a long name ("Cooking Ingredients & Spices") takes two lines and is not cut off */
.hbar .name { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.25; overflow-wrap: anywhere; }
.hbar .fill { height: 12px; border-radius: 0 4px 4px 0; background: var(--accent); }
.hbar .fill.unknown { background: var(--muted-2); }
.hbar .val { text-align: right; font-family: var(--font-mono); font-size: 13.5px; white-space: nowrap; }
.hbar.rest { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.hbar.rest .val { color: var(--ink); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  overflow-x: auto;
}
.card > h2:first-child { margin-top: 0; }

/* a list of rows inside one card: trips, menu entries, people */
.rows {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 14px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
}
.row:last-child { border-bottom: 0; }
a.row:hover .row-title { color: var(--accent); }
.row-date { flex: 0 0 auto; width: 56px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.row-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.row-amt { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 700; font-size: 15px; white-space: nowrap; text-align: right; }
.row-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.row-side .what { font-size: 12px; color: var(--muted); }
.row-chev { flex: 0 0 auto; color: var(--muted); }
/* Trips: how big a shop's part of the total is, the shop that was tapped, and the place in a top list */
.share { display: block; height: 5px; margin-top: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.share > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.rows > a.row.on { margin: 0 -14px; padding-left: 14px; padding-right: 14px; background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rows > a.row.on:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.rows > a.row.on:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.rows > a.row.on:only-child { border-radius: var(--radius-lg); }
/* Trips with one shop open: two columns on a wide screen; on a phone one column, in the order
   total, what was bought, the trips, the other shops */
.trip-cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
@media (max-width: 759px) {
  .trip-cols { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .trip-cols > .t-left { display: contents; }
  .trip-cols .t-total { order: 1; }
  .trip-cols .t-bought { order: 2; }
  .trip-cols .t-trips { order: 3; }
  .trip-cols .t-shops { order: 4; }
}
.row-num { flex: 0 0 auto; width: 22px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); text-align: right; }
.row-ico { flex: 0 0 auto; color: var(--accent); }
.pos { color: var(--accent); }
.neg { color: var(--danger-dark); }
.icon-box {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-box.gold { background: var(--gold-soft); color: #7a5800; }
.avatar {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-family: var(--font-body); }

/* a card that is a link: "7 things on your list" */
.note-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  color: var(--accent-dark);
  text-decoration: none;
}
.note-card .icon-box { background: var(--accent); color: #fff; }
.note-card.gold { background: var(--gold-soft); border: 1px dashed var(--gold); color: var(--gold-dark); }
.note-card.gold .icon-box { background: var(--gold); }
.note-card.gold .row-title, .note-card.gold .row-sub { color: var(--gold-dark); }
.note-card .row-title, .note-card .row-sub { color: var(--accent-dark); }
.note-card .row-sub { font-size: 13.5px; }
.note-card.plain { display: block; padding: 12px 14px; font-size: 14px; }
.nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 10px 6px 14px;
  background: var(--gold-soft);
  border: 1px dashed var(--gold);
  border-radius: var(--radius-lg);
  color: var(--gold-dark);
  font-size: 14px;
  text-decoration: none;
}
.nudge .grow { flex: 1 1 auto; min-width: 0; }
.info-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-lg); font-size: 13.5px; color: var(--ink-soft); }

/* the choices on the Add page */
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
}
.choice:hover { border-color: var(--accent); }
.choice .icon-box { width: 44px; height: 44px; border-radius: 12px; }
.choice .row-title { font-size: 16px; }
.choice .row-sub { font-size: 13.5px; }
.choice.main { background: var(--accent); border-color: var(--accent); color: #fff; padding: 16px 12px 16px 16px; }
.choice.main:hover { background: var(--accent-dark); }
.choice.main .icon-box { width: 48px; height: 48px; background: #fff; color: var(--accent); }
.choice.main .row-title { font-size: 17px; color: #fff; }
.choice.main .row-sub, .choice.main .row-chev { color: #fff; }
.example { padding: 8px 10px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 8px; font-family: var(--font-mono); font-size: 13px; }

/* ---------- Tables (receipt-style) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px dashed var(--border-strong); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
td:first-child { white-space: normal; }
a.row-link { color: var(--ink); text-decoration: none; font-weight: 500; }
a.row-link:hover { color: var(--accent); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.good { background: var(--accent-soft); color: var(--accent-dark); }
.badge.bad { background: var(--danger-soft); color: var(--danger-dark); }

/* ---------- Forms ---------- */
form label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 16px 0 5px; text-transform: uppercase; letter-spacing: 0.03em; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="number"], input[type="date"] { font-family: var(--font-mono); font-size: 15px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px 10px; }
.fields .wide { grid-column: 1 / -1; }
.fields label, .field label { margin: 0 0 5px; }
.field { display: flex; flex-direction: column; }
.inline-form { display: flex; gap: 8px; align-items: stretch; margin: 0; }
.inline-form input, .inline-form textarea { flex: 1 1 auto; min-width: 0; margin: 0; min-height: 48px; }
.inline-form button { flex: 0 0 auto; }
label.tick { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0; font-size: 14.5px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; cursor: pointer; }
label.tick input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; }

.item-row {
  display: grid;
  grid-template-columns: 2fr 1.3fr 0.8fr 0.7fr 0.9fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border-strong);
}
.item-row label { margin: 0 0 4px; }

button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: var(--font-body);
  transition: background 0.12s ease;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
button.secondary:hover, .btn.secondary:hover { background: var(--surface-2); }
button.remove-row {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid var(--border);
  padding: 9px 12px;
  min-width: 40px;
  min-height: 40px;
}
#trip-form .actions button { min-height: 44px; }
.btn.big, button.big { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 10px; font-size: 15px; }
.btn.block, button.block { width: 100%; }
button.link, .btn.link { background: none; border: 0; padding: 0 8px; min-height: 44px; color: var(--danger); font-size: 14px; font-weight: 700; }
button.link:hover { background: none; text-decoration: underline; }
button.check {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
button.check:hover { background: none; }
button.check span { width: 24px; height: 24px; border: 2px solid var(--muted); border-radius: 7px; background: var(--surface); color: #fff; display: flex; align-items: center; justify-content: center; }
button.check.done span { background: var(--accent); border-color: var(--accent); }
button.icon-btn { flex: 0 0 auto; width: 44px; height: 44px; padding: 0; background: none; color: var(--muted); display: flex; align-items: center; justify-content: center; }
button.icon-btn:hover { background: none; color: var(--danger); }

.actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.actions button, .actions .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.two-btn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.savings-highlight {
  background: var(--gold-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 22px;
  border: 1px dashed var(--gold);
}
.savings-highlight .amount { font-family: var(--font-mono); font-size: 34px; font-weight: 700; color: #7a5800; margin: 0; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-card);
}
.auth-card h1 { margin-bottom: 4px; }
.auth-card .subtitle { margin-bottom: 22px; }
.auth-card .actions { margin-top: 22px; }
.auth-card .actions button { width: 100%; min-height: 48px; }
.auth-card .switch { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-card .switch a { color: var(--accent); font-weight: 700; }
.auth-card .switch a.auth-tap { display: inline-flex; align-items: center; min-height: 44px; }
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-wrap { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
/* the form, and what the site is: side by side on a wide screen, the form first on a narrow one */
.auth-split { width: 100%; max-width: 940px; display: flex; flex-direction: column; align-items: center; gap: 36px; padding: 16px 0; }
.auth-info { width: 100%; max-width: 440px; }
.auth-info h2 { font-family: var(--font-mono); font-size: 26px; line-height: 1.2; margin: 0 0 12px; }
.auth-info .eyebrow { margin-bottom: 10px; }
.auth-lead { margin: 0 0 18px; color: var(--ink-soft); font-size: 15.5px; }
.auth-points { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; color: var(--ink-soft); }
.auth-points li .ico { flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.auth-points b { color: var(--ink); }
.auth-receipt { padding: 12px 16px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); font-family: var(--font-mono); font-size: 13px; }
.auth-receipt .receipt-line { padding: 5px 0; }
.auth-receipt .receipt-highlight { margin-top: 6px; padding: 8px 10px; }
.auth-more { margin: 16px 0 0; font-size: 13.5px; font-weight: 700; }
.auth-more a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
@media (min-width: 900px) {
  .auth-split { flex-direction: row-reverse; align-items: center; justify-content: center; gap: 64px; }
  .auth-wrap { flex: 0 0 360px; }
  .auth-info { flex: 1 1 auto; }
}
.auth-card .agree a, .auth-links a { color: var(--accent); }
.auth-links a { display: inline-flex; align-items: center; min-height: 44px; }
/* back to the first page, above the form: on the left, where a back button is looked for */
.auth-home { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-bottom: -10px; padding-right: 10px; color: var(--accent); font-size: 14px; font-weight: 700; text-decoration: none; }
.auth-home:hover { text-decoration: underline; }
.auth-card .agree { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 14px; font-size: 13px; }

/* ---------- Places: a box that offers towns while you type, My area, Shops ---------- */
.place-box { position: relative; display: block; flex: 1 1 auto; min-width: 0; }
.place-box input { margin: 0; width: 100%; }
.place-box .suggest div { display: block; }
.place-box .suggest b { font-weight: 700; }
.radius-seg label { flex: 1 1 0; min-width: 0; padding-left: 4px; padding-right: 4px; font-family: var(--font-mono); }
.shop-row { flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 10px; }
.shop-row .row-main { flex: 1 1 200px; }
.shop-place { flex: 1 1 260px; display: flex; gap: 8px; align-items: center; margin: 0; }
.shop-place button { flex: 0 0 auto; min-height: 44px; }
.row.far .row-title, .row.far .row-ico { color: var(--muted); }
.shop-more { flex: 1 1 100%; }
.shop-more summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 700; color: var(--accent); cursor: pointer; }
.shop-more-in { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 6px 0 8px; }
.shop-more-in .shop-place input, .shop-more-in .shop-place select { margin: 0; flex: 1 1 auto; min-width: 0; }
.receipt-place { margin: 14px 0 4px; padding: 6px 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-lg); }
.receipt-place label.tick { align-items: flex-start; padding: 8px 0; color: var(--accent-dark); }
.receipt-place label.tick input { margin-top: 2px; }

/* ---------- Sort products: a name, and its category to choose ---------- */
.sort-row { flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 10px; }
.sort-row .row-main { flex: 1 1 220px; margin: 0; text-transform: none; letter-spacing: 0; cursor: pointer; }
.sort-pick { flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px; }
.sort-pick select { margin: 0; }

/* ---------- The shopping list ---------- */
.list-item { display: flex; align-items: center; gap: 2px; min-height: 52px; border-bottom: 1px dashed var(--border-strong); }
.list-item:last-child { border-bottom: 0; }
.list-item form { margin: 0; }
.list-item .row-main { padding: 6px 0; }
.list-item.done .row-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.list-item .old { color: #7a5800; }
.rows.tight { padding: 0 4px 0 2px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 6px; }
.group-head h2 { margin: 0; font-size: 14px; }
.suggest { display: none; position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-top: none; border-radius: 0 0 8px 8px; max-height: 220px; overflow-y: auto; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); }
.suggest div { padding: 11px 12px; cursor: pointer; font-size: 14px; }
.suggest div:hover { background: var(--surface-2); }

/* ---------- Groups ---------- */
.who-row { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 0; border-bottom: 1px dashed var(--border-strong); }
.who-row:last-child { border-bottom: 0; }
.who-set { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
label.who { display: flex; align-items: center; justify-content: center; width: 40px; height: 44px; margin: 0; cursor: pointer; }
label.who input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.who span { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--muted-2); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: 0; text-transform: none; display: flex; align-items: center; justify-content: center; }
label.who input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
label.who input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-soft); }
.legend b { color: var(--ink); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; }
.totals .who-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.totals .who-sum { font-family: var(--font-mono); font-weight: 700; font-size: 17px; }
.split-row { display: flex; align-items: center; gap: 12px; min-height: 54px; border-bottom: 1px dashed var(--border-strong); }
.split-row:last-child { border-bottom: 0; }
.split-row .row-title { flex: 1 1 auto; min-width: 0; }
.split-row input[type="text"] { width: 96px; flex: 0 0 auto; text-align: right; font-family: var(--font-mono); margin: 0; }
.split-row .part { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 700; min-width: 64px; text-align: right; }
.split-row label.tick { flex: 1 1 auto; min-width: 0; font-weight: 700; }
/* a part of the form that belongs to one way of splitting is only there while that way is chosen */
[data-mode], .split-row [data-mode] { display: none; }
.mode-equal [data-mode~="equal"], .mode-amounts [data-mode~="amounts"], .mode-percent [data-mode~="percent"], .mode-shares [data-mode~="shares"],
.mode-equal .split-row [data-mode~="equal"], .mode-amounts .split-row [data-mode~="amounts"], .mode-percent .split-row [data-mode~="percent"], .mode-shares .split-row [data-mode~="shares"] { display: flex; }

/* ---------- The pages How to use, Terms, Privacy ---------- */
.doc-top { background: var(--surface); border-bottom: 2px dashed var(--border-strong); }
.doc-top-inner { max-width: 680px; margin: 0 auto; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.doc { max-width: 680px; margin: 0 auto; padding: 28px 20px 48px; display: flex; flex-direction: column; gap: 22px; font-size: 16px; }
.doc h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; }
.doc h2 { margin: 0 0 6px; }
.doc p { margin: 0; color: var(--ink-soft); }
.doc p + p { margin-top: 6px; }
.doc p b { color: var(--ink); }
.doc .dated { font-size: 14px; color: var(--muted); }
.doc .short { padding: 16px 18px; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius-lg); }
.doc .short h2, .doc .short p { color: var(--accent-dark); font-family: var(--font-body); }
.doc .short p { font-size: 15px; }
.doc-foot { display: flex; flex-wrap: wrap; gap: 4px 20px; padding-top: 14px; border-top: 1px dashed var(--border-strong); font-size: 14.5px; font-weight: 700; }
.doc-foot a, .doc-top a.back-link { display: flex; align-items: center; min-height: 44px; }
.doc-top a.back-link { font-size: 14.5px; font-weight: 700; }
.steps-list { display: flex; flex-direction: column; gap: 12px; }
.step-card { display: flex; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.step-card .n { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 700; font-size: 15px; color: var(--accent); padding-top: 2px; }
.step-card h2 { font-family: var(--font-body); font-size: 17px; margin: 0 0 4px; }
.step-card p { font-size: 15px; }
.step-card code { font-family: var(--font-mono); font-weight: 700; font-size: 14px; padding: 2px 8px; background: var(--surface-2); border-radius: 6px; }

/* ---------- A phone, and anything narrower than a small laptop ---------- */
@media (max-width: 899px) {
  .side { display: none; }
  body.app { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px)); }
  .top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    height: 58px;
    padding: 0 8px 0 16px;
    padding-top: env(safe-area-inset-top, 0px);
    box-sizing: content-box;
    background: var(--surface);
    border-bottom: 2px dashed var(--border-strong);
  }
  .top .brand { font-size: 15px; }
  .top .brand-mark { width: 30px; height: 30px; }
  .top-menu { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
  .tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 60px; color: var(--muted); font-size: 11.5px; font-weight: 700; text-decoration: none; position: relative; }
  .tabs a.on { color: var(--accent); }
  .tabs .plus { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
  .tabs a.on .plus { background: var(--accent-dark); box-shadow: 0 0 0 3px var(--accent-pale); }
  .tabs .dot { position: absolute; top: 6px; left: 50%; margin-left: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 11px; line-height: 18px; text-align: center; }
  .tabs .dot.gold { background: var(--gold); }
  .container { padding: 16px 16px 28px; }
  /* the chat has its own tab here: the round button in the corner is for the PC */
  .tlc:not(.tlc-page) .tlc-fab, .tlc:not(.tlc-page) .tlc-teaser { display: none !important; }
}
@media (min-width: 900px) {
  :root { --bar-max: 140px; }
  .bar { width: 44px; }
  .bar-val { font-size: 12.5px; }
  .bar-labels { font-size: 13px; }
  .only-phone { display: none !important; }
}
@media (max-width: 899px) {
  .only-pc { display: none !important; }
}

@media (max-width: 640px) {
  h1 { font-size: 21px; }
  h2 { margin-top: 26px; }
  .card { padding: 16px; }
  .item-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px 0;
  }
  .item-row > div:first-child { grid-column: 1 / -1; }
  .item-row > div:last-child { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-card .value { font-size: 21px; }
  table { font-size: 13px; }
  th, td { padding: 8px 6px; }
  .actions { flex-direction: column; }
  .actions button, .actions .btn { width: 100%; text-align: center; min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .savings-highlight .amount { font-size: 27px; }
  .hbar { grid-template-columns: minmax(0, 118px) minmax(0, 1fr) auto; gap: 8px; }
  .total-amount { font-size: 38px; }
  .auth-card { padding: 24px 20px; }
}

/* ============================================================
   Landing page (public, logged-out)
   ============================================================ */
.landing-nav {
  border-bottom: 2px dashed var(--border-strong);
  background: var(--surface);
}
.landing-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.landing-nav-links { display: flex; align-items: center; gap: 20px; }
.landing-nav-links a:not(.btn) { color: var(--ink-soft); text-decoration: none; font-weight: 700; font-size: 14px; }
.landing-nav-links a:not(.btn):hover { color: var(--accent); }

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 64px 20px 40px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
.hero-inner { max-width: 480px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 16px;
}
.hero h1 {
  font-family: var(--font-mono);
  font-size: 40px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  color: var(--ink);
}
.hero-sub { font-size: 16.5px; color: var(--ink-soft); margin: 0 0 28px; line-height: 1.6; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.hero-note { font-size: 13px; color: var(--muted); margin: 0; }

.receipt-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  font-family: var(--font-mono);
  font-size: 14px;
  transform: rotate(1.2deg);
}
.receipt-line { display: flex; justify-content: space-between; padding: 7px 0; color: var(--ink-soft); }
.receipt-divider { border-top: 1px dashed var(--border-strong); margin: 8px 0; }
.receipt-total { font-weight: 700; color: var(--ink); }
.receipt-highlight { margin-top: 10px; padding: 10px 12px; background: var(--gold-soft); border-radius: var(--radius-sm); color: #7a5800; font-weight: 700; }

.section-inner { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.section-title {
  font-family: var(--font-mono);
  font-size: 22px;
  text-align: center;
  margin: 0 0 40px;
  font-weight: 700;
}

.features { padding: 72px 0; background: var(--surface-2); }
.feature-grid { display: flex; flex-wrap: wrap; gap: 20px; }   /* the last row fills the width: no empty place, however many cards */
.feature-card {
  flex: 1 1 280px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
}
.feature-icon { margin: 0 0 12px; color: var(--accent); }
.feature-card h3 { font-size: 16px; margin: 0 0 8px; font-weight: 700; }
.feature-card p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; }

.how { padding: 72px 0; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.steps-detailed { grid-template-columns: repeat(5, 1fr); }
.step-number { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 700; margin: 0 0 10px; letter-spacing: 0.05em; }
.step h3 { font-size: 16px; margin: 0 0 8px; font-weight: 700; }
.step p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; }

.why { padding: 72px 0; background: var(--surface-2); }
.why-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: start;
}
.why-title { font-family: var(--font-mono); font-size: 26px; margin: 8px 0 18px; font-weight: 700; line-height: 1.25; }
.why-body { font-size: 15.5px; color: var(--ink-soft); line-height: 1.65; margin: 0; }
.why-points { display: flex; flex-direction: column; gap: 14px; }
.why-point {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.why-point h3 { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; color: var(--muted); }
.why-point p { font-size: 14px; color: var(--ink-soft); margin: 0; line-height: 1.5; }
.why-point-accent { border-color: var(--accent); background: var(--accent-soft); }
.why-point-accent h3 { color: var(--accent-dark); }
.why-point-accent p { color: var(--accent-dark); }

.cta { padding: 60px 0 80px; }
.cta-inner { text-align: center; }
.cta h2 { font-family: var(--font-mono); font-size: 24px; margin: 0 0 24px; font-weight: 700; }

.steps-four { grid-template-columns: repeat(4, 1fr); }
.how-more { text-align: center; margin: 36px 0 0; font-weight: 700; }
.how-more a { display: inline-flex; align-items: center; min-height: 44px; }
.receipt-split { margin-top: 8px; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--radius-sm); color: var(--accent-dark); font-weight: 700; }
.invite-box { max-width: 620px; margin: 0 auto; padding: 32px 28px; text-align: center; background: var(--surface); border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); }
.invite-box h2 { font-family: var(--font-mono); font-size: 22px; margin: 0 0 12px; font-weight: 700; }
.invite-box p { margin: 0 0 22px; color: var(--ink-soft); }
.invite-box .hero-actions { justify-content: center; margin: 0; }

.landing-footer {
  text-align: center;
  padding: 28px 20px;
  border-top: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 13px;
}
.landing-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin-top: 8px; }
.landing-footer nav a { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .receipt-strip { transform: none; max-width: 340px; }
  .steps { grid-template-columns: 1fr; gap: 28px; }
  .steps-detailed, .steps-four { grid-template-columns: 1fr; }
  .why-inner { grid-template-columns: 1fr; }
}

@media (min-width: 861px) and (max-width: 1080px) {
  .steps-detailed { grid-template-columns: repeat(3, 1fr); row-gap: 28px; }
  .steps-four { grid-template-columns: repeat(2, 1fr); row-gap: 28px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 30px; }
  .landing-nav-links a:not(.btn) { display: none; }
  .why-title { font-size: 21px; }
  .invite-box { padding: 24px 18px; }
}

/* ---------- The shopping list of a group (group_list.html) ---------- */
.gl-new { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; background: var(--gold-soft); color: var(--gold-dark); border: 1px dashed var(--gold); border-radius: var(--radius-lg); font-weight: 700; }
.gl-new[hidden] { display: none; }
.gl-new .btn { min-height: 40px; display: inline-flex; align-items: center; }
.gl-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.gl-sum b { font-size: 22px; }
.gl-sum span { font-size: 13px; color: var(--muted); }
.gl-sum .gl-warn { color: var(--gold-dark); background: var(--gold-soft); padding: 1px 8px; border-radius: 10px; }
.gl-bar { height: 10px; margin: 10px 0 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.gl-bar i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.gl-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.gl-tabs::-webkit-scrollbar { display: none; }
.gl-tab { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: 22px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none; }
.gl-tab b { font-family: var(--font-mono); font-size: 12.5px; }
.gl-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.gl-thing { display: flex; flex-direction: column; gap: 10px; padding: 12px 8px 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); scroll-margin: 90px 0; }
.gl-thing.nobody { border: 1px dashed var(--gold); }
.gl-thing.done { background: var(--surface-2); }
.gl-top { display: flex; align-items: flex-start; gap: 6px; }
.gl-name { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding-top: 2px; }
.gl-name b { font-size: 16px; overflow-wrap: anywhere; }
.gl-thing.done .gl-name b { font-weight: 500; color: var(--muted); text-decoration: line-through; }
.gl-hint { font-size: 12.5px; color: var(--muted); }
.gl-top .icon-btn { margin: -8px 0 -8px 0; }
.gl-who { align-self: flex-start; padding: 3px 10px; border-radius: 20px; background: var(--surface-2); color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.gl-who.me { background: var(--accent-soft); color: var(--accent-dark); }
.gl-who.none { background: var(--gold-soft); color: var(--gold-dark); }
.gl-acts { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding-right: 6px; }
.gl-acts > form { margin: 0; flex: 1 1 auto; display: flex; }
.gl-acts > form:has(.gl-quiet) { flex: 0 0 auto; }
.gl-acts button, .gl-acts summary.btn { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px; font-size: 14.5px; }
.gl-acts button.gl-quiet, .gl-acts summary.gl-quiet { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.gl-acts button.gl-quiet:hover, .gl-acts summary.gl-quiet:hover { background: var(--surface-2); color: var(--ink); }
.gl-thing.done .gl-quiet:hover { background: var(--surface); }
.gl-more { flex: 0 0 auto; }
.gl-more summary { list-style: none; cursor: pointer; }
.gl-more summary::-webkit-details-marker { display: none; }
.gl-more[open] { flex: 1 1 100%; order: 5; }
.gl-more[open] summary { display: none; }
.gl-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 10px; background: var(--surface-2); border-radius: 10px; }
.gl-thing.done .gl-panel { background: var(--surface); }
.gl-panel label { flex: 1 1 100%; margin: 0; }
.gl-panel select, .gl-panel input { flex: 1 1 130px; min-width: 0; min-height: 46px; margin: 0; background: var(--surface); }
.gl-panel button { flex: 1 1 auto; }
.gl-panel .small { flex: 1 1 100%; }
.gl-doneline { display: flex; align-items: flex-start; gap: 8px; padding-right: 6px; font-size: 13.5px; color: var(--ink-soft); }
.gl-doneline .ico { color: var(--accent); margin-top: 1px; }
.gl-doneline > span:first-of-type { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.gl-price { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 700; color: var(--ink); }

/* "How a group works" on the Groups page: closed once somebody has a group, open before */
.how-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 14px; }
.how-box summary { display: flex; align-items: center; min-height: 48px; font-weight: 700; color: var(--accent); cursor: pointer; }
.how-box ol { margin: 0 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.how-box li { overflow-wrap: anywhere; }
.how-box summary { list-style: none; justify-content: space-between; }
.how-box summary::-webkit-details-marker { display: none; }
.how-box summary::after { content: "+"; font-family: var(--font-mono); font-size: 18px; }
.how-box[open] summary::after { content: "\2013"; }

/* a phone: the chart on Home is lower, so that the trips under it are on the screen */
@media (max-width: 640px) {
  :root { --bar-max: 44px; }
  /* and the top of Home is tighter: less air between the parts, a slightly smaller big number */
  .home-stack { gap: 10px; }
  .home-stack .period-bar { gap: 6px 16px; }
  .home-stack .total-card { gap: 8px; padding-top: 12px; padding-bottom: 12px; }
  .home-stack .total-amount { font-size: 34px; }
  .home-stack .note-card { padding-top: 9px; padding-bottom: 9px; }
}

/* ---------- Search and filters at the top of Products and Compare prices ---------- */
.filters { display: flex; flex-direction: column; gap: 8px; max-width: 860px; margin: 0 0 18px; }
.filters-top { display: flex; gap: 8px; }
.filters-top input { flex: 1 1 auto; min-width: 0; min-height: 48px; margin: 0; }
.filters-top button { flex: 0 0 auto; }
.filters-more { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 14px; }
.filters-more summary { display: flex; align-items: center; justify-content: space-between; min-height: 46px; font-weight: 700; color: var(--accent); cursor: pointer; list-style: none; }
.filters-more summary::-webkit-details-marker { display: none; }
.filters-more summary::after { content: "+"; font-family: var(--font-mono); font-size: 18px; }
.filters-more[open] summary::after { content: "\2013"; }
.filters-more .fields { padding-bottom: 4px; }
.filters-more select, .filters-more input { margin: 0; min-height: 46px; }
.filters-more .actions { margin: 12px 0 14px; align-items: center; }
.filters-more .actions button, .filters-more .actions a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Products: one row for each product, on every screen ---------- */
.prod-bulk { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; max-width: 860px; margin: 0 0 10px; }
.prod-bulk label.tick { min-height: 44px; }
.prod-bulk button { min-height: 44px; color: var(--danger); }
.prod-bulk button:disabled { opacity: .45; cursor: default; }
.prod-list { max-width: 860px; }
.prod-row { align-items: flex-start; gap: 4px 10px; }
.prod-tick { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; margin: -2px 0 0 -10px; cursor: pointer; }
.prod-tick input { width: 22px; height: 22px; margin: 0; }
.prod-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.prod-main a.row-link { display: flex; align-items: center; min-height: 40px; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.prod-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.prod-acts a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 700; text-decoration: none; }
.prod-acts a:hover { background: var(--surface-2); }
.prod-row .row-side { padding-top: 8px; }

/* ---------- A table that becomes a list on a narrow screen ----------
   Each cell says what it is (data-label), the first cell is the heading of its row. */
@media (max-width: 640px) {
  table.t-stack, table.t-stack tbody, table.t-stack tr, table.t-stack td { display: block; width: auto; }
  table.t-stack tr:first-child { display: none; }
  table.t-stack tr { padding: 10px 0; border-bottom: 1px dashed var(--border-strong); }
  table.t-stack tr:last-child { border-bottom: 0; padding-bottom: 2px; }
  table.t-stack td { border: 0; padding: 1px 0; text-align: left; white-space: normal; font-size: 14px; }
  table.t-stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12.5px; }
  table.t-stack td:empty, table.t-stack td.t-hide { display: none; }
  table.t-stack td.t-lead { font-size: 15px; font-weight: 700; padding-bottom: 3px; }
  table.t-stack td.t-lead a { display: inline-flex; align-items: center; min-height: 40px; }
}
@media (max-width: 1099px) {
  table.t-chips, table.t-chips tbody, table.t-chips tr { display: block; width: auto; }
  table.t-chips tr:first-child { display: none; }
  table.t-chips tr { padding: 10px 0; border-bottom: 1px dashed var(--border-strong); }
  table.t-chips tr:last-child { border-bottom: 0; padding-bottom: 2px; }
  table.t-chips td { display: inline-block; border: 0; margin: 3px 6px 3px 0; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; text-align: left; white-space: nowrap; vertical-align: top; }
  table.t-chips td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: 12.5px; font-weight: 400; }
  table.t-chips td.t-hide { display: none; }
  table.t-chips td.t-lead { display: block; margin: 0 0 4px; padding: 0; background: none; white-space: normal; font-size: 15px; }
  table.t-chips td.t-lead a { display: inline-flex; align-items: center; min-height: 40px; font-weight: 700; }
  table.t-chips td .cmp-old { display: inline; margin-left: 4px; }
}

/* ---------- Home at a glance (tl_home.py): the sentence, the budget ring, price news, the strip ---------- */
.home-hero { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px 28px; }
.home-hero-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.home-story { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--ink); font-weight: 700; }
.home-story.down { background: var(--accent-soft); color: var(--accent-dark); }
.home-story.up { background: var(--danger-soft); color: var(--danger-dark); }
.home-story span { min-width: 0; }
.home-budget { flex: 0 1 390px; min-width: 0; display: flex; align-items: center; gap: 14px; }
.home-ring { position: relative; flex: 0 0 112px; width: 112px; height: 112px; }
.home-ring svg { display: block; transform: rotate(-90deg); }
.home-ring .track { stroke: var(--accent-pale); }
.home-ring .fill { stroke: var(--accent); }
.home-ring.warn .track { stroke: #f0dca4; }
.home-ring.warn .fill { stroke: var(--gold); }
.home-ring.over .track { stroke: #efc4bb; }
.home-ring.over .fill { stroke: var(--danger); }
.home-ring-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.home-ring-mid b { font-family: var(--font-mono); font-size: 22px; line-height: 1.1; }
.home-ring-mid span { font-size: 11.5px; color: var(--muted); }
.home-budget-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.home-budget-text > b { font-size: 15px; }
.home-budget-more summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 700; color: var(--accent); cursor: pointer; list-style: none; }
.home-budget-more summary::-webkit-details-marker { display: none; }
/* no budget yet: the trips of this time and "Set a budget" share one line */
.home-sub-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 16px; }
.home-budget-link { flex: 0 1 auto; min-width: 0; }
.home-budget-link summary { text-decoration: underline; text-underline-offset: 3px; }
.home-budget-link[open] { flex: 1 1 100%; padding-bottom: 6px; }
/* the budget as a bar: only on a phone, where the ring would take five lines */
.home-meter, .home-meter-pct { display: none; }
.home-meter { height: 10px; margin: 4px 0; border-radius: 5px; background: var(--accent-pale); overflow: hidden; }
.home-meter i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.home-meter.warn { background: #f0dca4; } .home-meter.warn i { background: var(--gold); }
.home-meter.over { background: #efc4bb; } .home-meter.over i { background: var(--danger); }
.home-meter-pct { font-weight: 400; color: var(--muted); }
@media (max-width: 640px) {
  .home-ring { display: none; }
  .home-meter { display: block; }
  .home-meter-pct { display: inline; }
  .home-budget { flex: 1 1 100%; }
}
.home-budget-form { display: flex; align-items: center; gap: 6px; margin: 0; }
.home-budget-form input { width: 96px; min-height: 44px; margin: 0; }
.home-budget-form button { min-height: 44px; }
.home-pound { font-family: var(--font-mono); font-weight: 700; color: var(--muted); }
.home-news { display: flex; flex-direction: column; }
.home-news-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 0; border-bottom: 1px dashed var(--border); color: inherit; text-decoration: none; }
.home-news-row:last-child { border-bottom: 0; }
.home-news-ico { flex: 0 0 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); }
.home-news-ico.up { background: var(--danger-soft); color: var(--danger); }
.home-news-ico.down { background: var(--accent-soft); color: var(--accent-dark); }
.home-news-row .row-amt { font-size: 14px; }
.home-save .row-sub { font-size: 13px; }
.home-save-amt { font-family: var(--font-mono); font-weight: 700; font-size: 26px; line-height: 1.2; color: var(--accent-dark); }
.home-strip { display: flex; gap: 2px; height: 22px; border-radius: 6px; overflow: hidden; }
.home-strip span { min-width: 3px; }
.home-strip .s0, .home-swatch.s0 { background: var(--series-other); }
.home-strip .s1, .home-swatch.s1 { background: var(--series-1); }
.home-strip .s2, .home-swatch.s2 { background: var(--series-2); }
.home-strip .s3, .home-swatch.s3 { background: var(--series-3); }
.home-strip .s4, .home-swatch.s4 { background: var(--series-4); }
.home-strip .s5, .home-swatch.s5 { background: var(--series-5); }
.home-legend { display: flex; flex-direction: column; margin-top: 10px; }
.home-legend-row { display: flex; align-items: center; gap: 10px; min-height: 34px; border-bottom: 1px dashed var(--border); font-size: 14px; }
.home-legend-row:last-child { border-bottom: 0; }
.home-swatch { flex: 0 0 12px; height: 12px; border-radius: 3px; }
.home-legend-row .name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.home-legend-row .pct { flex: 0 0 40px; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
/* a line of What you buy opens: its products, or for "Everything else" its categories */
.home-cat { border-bottom: 1px dashed var(--border); }
.home-legend > .home-cat:last-child, .home-rest-in > .home-cat:last-child { border-bottom: 0; }
.home-cat > summary { min-height: 44px; border-bottom: 0; cursor: pointer; list-style: none; }
.home-cat > summary::-webkit-details-marker { display: none; }
.home-chev { flex: 0 0 16px; display: grid; place-items: center; color: var(--muted); transition: transform .15s ease; }
.home-cat[open] > summary .home-chev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .home-chev { transition: none; } }
.home-cat-in { padding: 0 0 8px 22px; }
.home-cat-item { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13.5px; color: var(--ink-soft); }
.home-cat-item span { min-width: 0; overflow-wrap: anywhere; }
.home-cat-item b { flex: 0 0 auto; font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.home-cat-all { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 700; }
.home-rest > summary .home-share { display: block; }
.home-rest-in { margin: 0 0 6px 5px; padding-left: 14px; border-left: 2px solid var(--border); }
/* the card of an answer: it leads to the answer, and a cross puts it away */
.home-answer { padding: 0; gap: 0; align-items: stretch; }
.home-answer-go { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 4px 12px 14px; color: inherit; text-decoration: none; }
.home-answer form { margin: 0; display: flex; }
.home-answer-x { width: 48px; min-height: 48px; height: 100%; padding: 0; border: 0; border-radius: 0 var(--radius-lg) var(--radius-lg) 0; background: none; color: var(--accent-dark); display: grid; place-items: center; }
.home-answer-x:hover { background: var(--accent-line); }
.home-answer .row-sub { overflow-wrap: anywhere; }
/* the first day */
.home-first-title { margin: 4px 0 2px; font-size: 20px; }
.home-steps { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.home-step { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 10px 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); text-decoration: none; }
.home-step:hover { background: var(--surface-2); }
.home-step .row-sub { font-size: 13px; }
.home-tick { flex: 0 0 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; }
.home-step.done { background: var(--accent-soft); border-color: var(--accent-line); }
.home-step.done .home-tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.home-legend-row .val { flex: 0 0 68px; text-align: right; font-family: var(--font-mono); font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.home-share { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.home-chart .bar-labels { margin-top: 0; }
.home-chart h2 { margin-bottom: 4px; }

/* ---- for the admin: "Add a shop", "Add a category", "Add a product" (templates/_add_box.html) ---- */
.add-box { margin: 0 0 6px; }
.add-box summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; font-size: 14px; color: var(--accent); cursor: pointer; list-style: none; }
.add-box summary::-webkit-details-marker { display: none; }
.add-box[open] summary { color: var(--ink); }
.add-box form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; align-items: end; margin: 2px 0 0; padding: 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); }
.card .add-box form { background: var(--surface-2); border: 0; }
.add-box form > div { min-width: 0; }
.add-box label { margin: 0 0 5px; }
.add-box input, .add-box select { margin: 0; width: 100%; box-sizing: border-box; }
.add-box button { min-height: 44px; }
.add-box > p { margin: 8px 0 10px; overflow-wrap: anywhere; }

/* ---- for the admin, under the form of a product: join it, delete it ---- */
.check-line { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.check-line input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; }
.check-line span { min-width: 0; overflow-wrap: anywhere; }
button.adm-del { background: var(--danger); color: #fff; border-color: var(--danger); }
button.adm-del:hover { background: var(--danger-dark); }

/* ---- the index page: Home drawn on a phone, the steps that fold, who to ask for an invite ---- */
.phone-demo { margin: 0 auto; width: 100%; max-width: 320px; }
.phone-screen { display: flex; flex-direction: column; gap: 8px; padding: 18px 16px; background: var(--paper, #faf9f6); border: 2px solid var(--border-strong); border-radius: 28px; box-shadow: var(--shadow-card); }
.phone-demo figcaption { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--muted); }
.pd-label { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.pd-amount { margin: 0; font-family: var(--font-mono); font-weight: 700; font-size: 32px; line-height: 1.15; letter-spacing: -0.02em; }
.pd-story { display: flex; align-items: center; gap: 8px; margin: 2px 0; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: 13.5px; }
.pd-story span { min-width: 0; }
.pd-meter { height: 9px; border-radius: 5px; background: var(--accent-pale); overflow: hidden; }
.pd-meter i { display: block; height: 100%; border-radius: 5px; background: var(--accent); }
.pd-small { margin: 0 0 4px; font-size: 12.5px; color: var(--ink-soft); }
.pd-card { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.pd-head { margin: 0 0 8px; font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.pd-card .home-strip { height: 16px; margin-bottom: 6px; }
.pd-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.pd-row span:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.pd-row b { font-family: var(--font-mono); font-size: 12.5px; }
.pd-note { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12.5px; line-height: 1.4; }
.pd-note.gold { background: var(--gold-soft); border: 1px dashed var(--gold); color: var(--gold-dark); }
.pd-note .ico { flex: 0 0 auto; }
.pd-note b { font-size: 13.5px; }
.how-fold { margin-top: 44px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 0 22px; }
.how-fold summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; font-family: var(--font-mono); font-weight: 700; font-size: 17px; cursor: pointer; list-style: none; }
.how-fold summary::-webkit-details-marker { display: none; }
.how-fold summary::after { content: "+"; flex: 0 0 auto; font-size: 22px; color: var(--accent); }
.how-fold[open] summary::after { content: "\2013"; }
.how-fold[open] { padding-bottom: 26px; }
.how-fold[open] summary { margin-bottom: 8px; }
.how-open { font-weight: 700; white-space: nowrap; }
.invite-box .invite-ask { margin: 18px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.invite-box .invite-ask a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.hero-note a { font-weight: 700; }
@media (max-width: 860px) {
  .phone-demo { max-width: 340px; }
  .how-fold { padding: 0 16px; }
  .how-fold summary { font-size: 15.5px; }
}
.feature-grid.seven .feature-card { flex-basis: 230px; }        /* seven cards: four and three, not three, three and one */
@media (max-width: 640px) {
  /* on a phone the page is long: the cards lie flat (the icon next to the words), and the parts stand closer */
  .features, .how, .why, .cta { padding-top: 44px; padding-bottom: 44px; }
  .section-title { margin-bottom: 24px; }
  .feature-grid { gap: 10px; }
  .feature-card { flex-basis: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 14px; padding: 14px 16px; }
  .feature-icon { grid-row: 1 / span 2; margin: 2px 0 0; }
  .feature-card h3 { margin-bottom: 4px; }
  .steps { gap: 20px; }
  .hero { padding-bottom: 28px; gap: 28px; }
}

/* ---- the form of a trip that a photo filled: the photo to check against, and a warning when it did not add up ---- */
.read-unsure { margin: 16px 0 0; padding: 12px 14px; background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: var(--radius-lg); color: var(--gold-dark); font-size: 14.5px; }
.read-photo { margin: 14px 0 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 0 14px; }
.read-photo summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; font-weight: 700; color: var(--accent); cursor: pointer; list-style: none; }
.read-photo summary::-webkit-details-marker { display: none; }
.read-photo summary::after { content: "+"; font-family: var(--font-mono); font-size: 18px; }
.read-photo[open] summary::after { content: "\2013"; }
.read-photo-hint { margin: -4px 0 8px; }
.read-photo-in { max-height: 70vh; overflow: auto; margin: 0 0 14px; border-radius: var(--radius); background: var(--surface-2); }
.read-zoom { display: block; width: 100%; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; cursor: zoom-in; }
.read-zoom:hover, .read-zoom:active { background: none; transform: none; box-shadow: none; }
.read-zoom.big { width: 230%; cursor: zoom-out; }
.read-zoom img { display: block; width: 100%; height: auto; }
@media (min-width: 1200px) {
  /* on a wide screen the photo stands next to the lines, and stays there while the lines scroll */
  .read-wrap:has(> .read-photo[open]) { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 24px; align-items: start; }
  .read-wrap:has(> .read-photo[open]) > .read-photo { grid-column: 2; grid-row: 1; position: sticky; top: 12px; margin-top: 22px; }
  .read-wrap:has(> .read-photo[open]) > .read-lines { grid-column: 1; grid-row: 1; min-width: 0; }
  .read-wrap:has(> .read-photo[open]) .read-photo-in { max-height: 72vh; }
  /* with the photo next to them the lines have less room: the name gets a line of its own */
  .read-wrap:has(> .read-photo[open]) .item-row { grid-template-columns: 1.6fr 1fr 0.8fr 1fr auto; }
  .read-wrap:has(> .read-photo[open]) .item-row > div:first-child { grid-column: 1 / -1; }
}

/* ---- Split bills, for somebody with nobody to split with yet: the start is one friend ---- */
.split-start { border: 2px solid var(--accent-line); background: var(--accent-soft); }
.split-start h2 { margin: 4px 0 8px; font-size: 20px; }
.split-start p { margin: 0; color: var(--accent-dark); }
.split-start .small.muted { color: var(--accent-dark); opacity: 0.85; }

/* ---- How to use: the parts that open, with the detail ---- */
.help-part { margin: 18px 0 2px; font-family: var(--font-mono); font-size: 20px; }
.help-more { font-weight: 700; white-space: nowrap; }
.help-box summary { min-height: 56px; font-size: 16px; }
.help-in { padding: 0 2px 16px; }
.help-in h3 { margin: 16px 0 6px; font-family: var(--font-body); font-size: 15.5px; }
.help-in h3:first-child { margin-top: 2px; }
.help-in p { margin: 0 0 6px; font-size: 15px; }
.help-in ol { margin: 0 0 6px; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.help-in code { font-family: var(--font-mono); font-weight: 700; font-size: 14px; padding: 2px 8px; background: var(--surface-2); border-radius: 6px; }

/* ---- for the admin: the page of one shop and its price list (admin_shop.html) ---- */
.shp-add { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.shp-add > div { min-width: 0; }
.shp-add label { margin: 0 0 4px; }
.shp-add input, .shp-add select { margin: 0; min-height: 48px; width: 100%; }
.shp-add .shp-wide, .shp-add .shp-go { grid-column: 1 / -1; }
.shp-add .shp-go button { min-height: 48px; }
@media (min-width: 1000px) {
  .shp-add { grid-template-columns: 1fr 1.1fr 1.2fr 1fr auto; }
  .shp-add .shp-go { grid-column: auto; }
  .shp-add .shp-go button { min-height: 48px; white-space: nowrap; }
}
.shp-list { padding-top: 4px; padding-bottom: 4px; }
.shp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-bottom: 1px dashed var(--border-strong); }
.shp-row:last-child { border-bottom: 0; }
.shp-main { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shp-name { font-weight: 700; overflow-wrap: anywhere; display: inline-flex; align-items: center; min-height: 40px; align-self: flex-start; }
.shp-main .row-sub { line-height: 1.5; }
.shp-set { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; margin: 0; }
.shp-set input { width: 96px; min-height: 44px; margin: 0; font-family: var(--font-mono); }
.shp-set button { min-height: 44px; }
.shp-pound { color: var(--muted); font-family: var(--font-mono); }
.shp-x { flex: 0 0 44px; margin: 0; }
#many textarea { width: 100%; min-height: 160px; font-family: var(--font-mono); font-size: 14px; }

/* ---- for the admin: a pasted price list, to check before it is saved (admin_shop_check.html) ---- */
.chk-list { padding-top: 4px; padding-bottom: 4px; }
.chk-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 124px; gap: 6px 10px; align-items: start; padding: 12px 0; border-bottom: 1px dashed var(--border-strong); }
.chk-row:last-child { border-bottom: 0; }
.chk-row.off .chk-main, .chk-row.off .chk-price { opacity: 0.45; }
.chk-tick { display: flex; align-items: center; justify-content: center; width: 44px; min-height: 48px; margin: 0; cursor: pointer; }
.chk-tick input, .chk-same input { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; }
.chk-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.chk-main input[type=text] { margin: 0; min-height: 48px; width: 100%; }
.chk-main .row-sub { line-height: 1.6; }
.chk-same { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-size: 13.5px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; cursor: pointer; overflow-wrap: anywhere; }
.chk-price { display: flex; align-items: center; gap: 6px; }
.chk-price input { margin: 0; min-height: 48px; width: 100%; font-family: var(--font-mono); }
.chk-all { min-height: 44px; font-size: 13px; margin-right: 6px; }
.chk-more { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 8px; }
.chk-more input, .chk-more select { margin: 0; min-height: 44px; width: 100%; font-size: 13.5px; }
.chk-more select.chk-none, .chk-more input.chk-guess { border-color: var(--gold); background-color: var(--gold-soft); }
.shp-find { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.shp-find input { flex: 2 1 200px; min-width: 0; margin: 0; min-height: 48px; }
.shp-find select { flex: 1 1 150px; min-width: 0; width: auto; margin: 0; min-height: 48px; }
.shp-find button { flex: 0 0 auto; min-height: 48px; }
.shp-prompt { margin: 4px 0 10px; }
.shp-prompt summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 700; color: var(--accent); cursor: pointer; }
.shp-prompt textarea { width: 100%; min-height: 0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; background: var(--surface-2); }
@media (max-width: 560px) {
  /* on a phone: the name across, the brand next to the price, the category across */
  .chk-row { grid-template-columns: 44px minmax(0, 1fr) 112px; grid-template-areas: "tick name name" ". brand price" ". cat cat" ". sub sub"; gap: 8px 8px; }
  .chk-main, .chk-more { display: contents; }
  .chk-tick { grid-area: tick; }
  .chk-main > input[type=text] { grid-area: name; }
  .chk-more > input[type=text] { grid-area: brand; }
  .chk-more > select { grid-area: cat; }
  .chk-price { grid-area: price; }
  .chk-price input { min-height: 44px; }
  .chk-main > .row-sub, .chk-main > .chk-same { grid-area: sub; }
}

/* ---- for the admin: the links of a shop to its website, to fetch prices from (tl_fetch.py) ---- */
.shp-fetch .shp-row:first-of-type { border-top: 1px dashed var(--border-strong); }
.shp-url { display: flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; word-break: break-all; }
.shp-fetch-go button { min-height: 44px; min-width: 84px; }
.shp-link { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; align-items: end; margin: 14px 0 0; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.shp-link > div { min-width: 0; }
.shp-link label { margin: 0 0 4px; }
.shp-link input, .shp-link select { margin: 0; min-height: 48px; width: 100%; }
.shp-link .shp-wide, .shp-link .shp-go { grid-column: 1 / -1; }
.shp-link .shp-go button { min-height: 48px; }
@media (max-width: 560px) { .shp-link { grid-template-columns: 1fr; } }
@media (min-width: 1000px) {
  .shp-link { grid-template-columns: 1fr 1.3fr auto; }
  .shp-link .shp-go { grid-column: auto; }
}

/* ---- Compare prices in tabs: my products, my list by shop, starred (compare_mine.html, tl_compare.py) ---- */
.cmp-tabs { margin-bottom: 14px; }
.cmp-tabs .range-tab { min-height: 44px; }

/* ---------- The shopping list: "Your usual things" ---------- */
.usual { display: flex; flex-direction: column; gap: 10px; margin: 0; scroll-margin-top: 84px; }
.usual-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.usual-head h2 { margin: 0; font-size: 16px; }
.badge.gold { background: var(--gold-soft); color: var(--gold-dark); }
.usual-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.usual-chip { display: flex; align-items: stretch; max-width: 100%; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); overflow: hidden; }
.usual-chip.due { border-color: var(--gold); background: var(--gold-soft); }
.usual-chip form { margin: 0; display: flex; }
.usual-chip form:first-child { min-width: 0; }
button.usual-add { display: flex; flex-direction: column; align-items: flex-start; min-height: 48px; min-width: 0; padding: 6px 4px 6px 12px; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ink); text-align: left; font-weight: 400; }
button.usual-add:hover { background: rgba(20, 107, 77, 0.06); transform: none; }
button.usual-add b { font-size: 14.5px; font-weight: 700; overflow-wrap: anywhere; }
button.usual-add small { font-size: 11.5px; color: var(--muted); }
.usual-chip.due button.usual-add small { color: var(--gold-dark); }
button.usual-x { width: 40px; min-height: 48px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--muted); display: grid; place-items: center; }
button.usual-x:hover { color: var(--danger); background: none; transform: none; }
.usual-shops { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; }
.usual-shops > small { color: var(--muted); font-size: 12.5px; padding-top: 4px; }
.usual-shop { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--border-strong); }
.usual-shop > span { min-width: 0; overflow-wrap: anywhere; }
.usual-shop b { font-family: var(--font-mono); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usual-shop small { color: var(--muted); }
.usual-shop em { font-style: normal; margin-left: 4px; padding: 0 7px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); font-size: 11.5px; font-weight: 700; }
.usual-shop.best b { color: var(--accent-dark); }
.usual-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.usual-acts form { margin: 0; }
.usual-acts button { min-height: 44px; }
button.usual-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.row-title .qty { font-family: var(--font-mono); font-size: 13px; color: var(--accent-dark); }

/* ---------- Split bills: a bill that opens, and the bills that were removed ---------- */
a.row-go { color: inherit; text-decoration: none; min-height: 44px; justify-content: center; }
a.row-go:hover .row-title { color: var(--accent-dark); text-decoration: underline; }
.grp-removed summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 700; color: var(--accent); cursor: pointer; }

/* ---------- Notifications: the bell, and its page ---------- */
.top-acts { display: flex; align-items: center; gap: 2px; }
.top-bell { position: relative; border-radius: 12px; }
.top-bell.on { background: var(--accent-soft); color: var(--accent-dark); }
.top-num { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-family: var(--font-body); font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; }
.top-num[hidden], .side-new[hidden] { display: none; }
.side-count.side-new { background: var(--danger); color: #fff; font-family: var(--font-body); font-weight: 700; }
.nt-wrap { max-width: 680px; }
.nt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.nt-head h1 { margin: 0; }
.nt-head-acts { display: flex; align-items: center; gap: 2px; }
.nt-head-acts form { margin: 0; }
button.nt-link { min-height: 44px; padding: 0 10px; border: 0; background: none; box-shadow: none; color: var(--accent); font-weight: 700; font-size: 14px; }
button.nt-link:hover { background: var(--surface-2); transform: none; }
a.nt-gear { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--ink); }
a.nt-gear:hover { background: var(--surface-2); }
a.nt-back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.nt-tabs { margin: 10px 0 6px; }
.nt-tabs .range-tab { min-height: 44px; }
.nt-tabs .range-tab b { margin-left: 6px; font-family: var(--font-mono); font-size: 12px; }
h2.nt-when { margin: 14px 2px 6px; font-family: var(--font-body); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nt-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.nt-note { display: flex; gap: 10px; padding: 12px; border-top: 1px dashed var(--border-strong); scroll-margin-top: 84px; }
.nt-note:first-child { border-top: 0; }
.nt-note.new { background: var(--accent-soft); }
.nt-ico { flex: 0 0 36px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 18px; background: var(--surface-2); color: var(--ink-soft); }
.nt-note.new .nt-ico { background: var(--surface); color: var(--accent-dark); }
.nt-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.nt-say { display: block; color: var(--ink); text-decoration: none; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
a.nt-say { padding: 12px 0; margin: -12px 0 -8px; }
a.nt-say:hover { color: var(--accent-dark); }
.nt-say b { font-weight: 700; }
.nt-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.nt-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.nt-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-acts form { margin: 0; }
.nt-acts .nt-act { min-height: 44px; padding: 0 14px; font-size: 13.5px; display: inline-flex; align-items: center; }
.nt-done { font-size: 13px; font-weight: 700; color: var(--accent-dark); }
.nt-set { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
label.nt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; margin: 0; padding: 6px 12px; border-top: 1px dashed var(--border-strong); font-size: 14.5px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; cursor: pointer; }
label.nt-row:first-child { border-top: 0; }
label.nt-row > span { min-width: 0; overflow-wrap: anywhere; }
label.nt-row small { display: block; font-size: 12.5px; color: var(--muted); }
/* a tick box drawn as a switch */
input.nt-sw { appearance: none; -webkit-appearance: none; flex: 0 0 auto; position: relative; width: 48px; height: 28px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 14px; background: var(--border-strong); cursor: pointer; transition: background 0.15s; }
input.nt-sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 11px; background: var(--surface); transition: left 0.15s; }
input.nt-sw:checked { background: var(--accent); }
input.nt-sw:checked::after { left: 23px; }
input.nt-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { input.nt-sw, input.nt-sw::after { transition: none; } }

/* ---------- Admin: the row of tabs, and the three parts of a shop's page ---------- */
.adm-tabs .range-tab, .shp-parts .range-tab { min-height: 44px; }
.shp-parts { margin: 0 0 14px; }
.shp-part[hidden] { display: none; }
.shp-part > h2:first-child { margin-top: 0; }
.shp-part [id] { scroll-margin-top: 84px; }

/* ---- Not live prices (_not_live.html): on Compare prices and the shopping list ---- */
.not-live { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); border: 1px dashed var(--gold); color: var(--gold-dark); font-size: 13.5px; line-height: 1.45; }
.not-live b { color: var(--ink); }
.not-live a { color: var(--gold-dark); font-weight: 700; }
.not-live-mark { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; margin-top: 1px; }

/* ---- Compare prices: the shopping list, compared (compare_list.html) ---- */
.cmp3 { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.cmp3 h2 { margin: 0 0 4px; font-size: 16px; }
.cmp3-small { margin: 0; font-size: 12.5px; color: var(--muted); }
.cmp3-shops, .cmp3-things { display: flex; flex-direction: column; gap: 4px; }
.cmp3-shop { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px dashed var(--border-strong); }
.cmp3-shop:last-of-type { border-bottom: 0; }
.cmp3-shop.far { opacity: 0.7; }
.cmp3-shophead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cmp3-shophead > span { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.cmp3-shophead > b { font-family: var(--font-mono); font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp3-shop.best .cmp3-shophead > b { color: var(--accent-dark); }
.cmp3-pill { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 8px; background: var(--surface-2); color: var(--ink-soft); font-size: 11.5px; font-weight: 700; vertical-align: 1px; white-space: nowrap; }
.cmp3-pill.best { background: var(--accent); color: #fff; }
.cmp3-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.cmp3-bar i { display: block; height: 100%; border-radius: 5px; background: var(--border-strong); }
.cmp3-shop.best .cmp3-bar i { background: var(--accent); }
.cmp3-split { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: 13.5px; line-height: 1.45; }
.cmp3-split small { display: block; margin-top: 2px; font-size: 12.5px; }
.cmp3-split > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.cmp3-thing { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px dashed var(--border-strong); }
.cmp3-thing:last-child { border-bottom: 0; }
.cmp3-name { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.cmp3-name:hover { color: var(--accent); }
.cmp3-name small { font-weight: 700; color: var(--muted); }
.cmp3-chips { display: flex; flex-wrap: wrap; gap: 6px; }
button.cmp3-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 44px; margin: 0; padding: 5px 10px; border: 0; border-radius: 8px; background: var(--surface-2); box-shadow: none; color: var(--ink-soft); font: inherit; font-size: 13.5px; font-weight: 400; text-align: left; min-width: 0; max-width: 100%; cursor: pointer; }
button.cmp3-chip:hover { background: var(--border); color: var(--ink-soft); transform: none; }
button.cmp3-chip[aria-expanded="true"] { outline: 2px solid var(--ink-soft); outline-offset: -2px; }
.cmp3-chip > span { overflow-wrap: anywhere; }
.cmp3-chip b { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
button.cmp3-chip.low { background: var(--accent-soft); color: var(--accent-dark); }
.cmp3-chip.low b { color: var(--accent-dark); }
button.cmp3-chip.old, button.cmp3-chip.far { opacity: 0.6; }
.cmp3-when { font-size: 11.5px; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; }
.cmp3-why { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.cmp3-why a { display: inline-block; padding: 6px 0; font-weight: 700; }
.cmp3-more summary { display: inline-flex; align-items: center; min-height: 44px; font-size: 13.5px; font-weight: 700; color: var(--accent); cursor: pointer; }
.cmp3-more > .cmp3-chips { margin-bottom: 6px; }
.cmp3-empty p { margin: 0 0 10px; }
.cmp3-usual { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cmp3-usual form { margin: 0; }
.cmp3-usual button { min-height: 44px; }

