/*
 * yoin.in, one stylesheet (ADR-0026, ADR-0028, ADR-0029). Mobile first: designed for a 360 px
 * wide in-app browser (AGENTS.md); wide screens get more room and more side by side.
 *
 * The look: Scandinavian calm with an 80s Swatch pulse. Cool white paper, ink lines, tight
 * corners, and Source Sans; colour comes in flat primary blocks, used where it means something.
 * Sustainable by design: one small self-hosted font, no images, a dark mode, and no motion
 * for people who ask for less. To change the look, change the tokens below; pages only use
 * class names.
 */

/* ---------- Font ---------- */

/* Source Sans 3 (formerly Source Sans Pro), every weight in one 29 KB file, served by us (ADR-0029).
   Characters outside its Latin set fall back to the system font, one by one.
   `optional`, with the preload in every page's head: the browser waits for the font before the
   first paint instead of painting a page without text and then the text (that read as a second
   load on every page). If it's ever really slow, that page keeps the system font: never a swap. */
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: optional;
  src: url("/static/fonts/source-sans-3-5.3.1-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  /* Paper and ink */
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #e8eaee;
  --text: #0f1115;
  --muted: #545a65;
  --line: #0f1115;
  --line-soft: #d9dce2;

  /* Brand: cobalt, with Swatch red for the name and what's new */
  --brand: #1f4fe0;
  --brand-text: #ffffff;
  --accent: #e8231a;
  --accent-text: #ffffff;

  /* The six colours groups and people are shown in, each with the ink that reads on it */
  --blue: #2f5cff;
  --yellow: #ffd100;
  --red: #ff3b30;
  --mint: #2fd3a0;
  --violet: #8a6bff;
  --graphite: #2a2e36;
  --on-colour: #0f1115;
  --on-dark: #ffffff;
  --night: #0f1115; /* the front page's dark face, in both modes */

  /* Status */
  --ok: #0b7a55;
  --ok-soft: #daf6ea;
  --warn: #6e5200;
  --warn-soft: #fff3bf;
  --bad: #c5221a;
  --bad-soft: #ffe1de;
  --info: #1f4fe0;
  --info-soft: #e3eaff;

  /* Shape: tight corners, ink lines */
  --border: 2px;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-pill: 999px;
  --pop: 3px 3px 0 var(--line);
  --pop-lift: 4px 4px 0 var(--line);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
  --space: 16px;
  --gap: 12px;
  --bar: 60px; /* the top bar with its stripe */

  /* Type */
  --font: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-sm: 0.9375rem;
  --text-xs: 0.8125rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d10;
    --surface: #15171c;
    --surface-2: #1f2229;
    --text: #f1f2f4;
    --muted: #a5abb6;
    --line: #e6e8ec;
    --line-soft: #2d3139;

    --brand: #6b8cff;
    --brand-text: #0c0d10;
    --accent: #ff4a3d;
    --accent-text: #0c0d10;
    --graphite: #e6e8ec;
    --on-dark: #ffffff;

    --ok: #4fe0b0;
    --ok-soft: rgb(47 211 160 / 0.16);
    --warn: #ffd84a;
    --warn-soft: rgb(255 209 0 / 0.14);
    --bad: #ff8a80;
    --bad-soft: rgb(255 59 48 / 0.18);
    --info: #8ea8ff;
    --info-soft: rgb(47 92 255 / 0.2);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

main {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--space) var(--space) calc(var(--space) * 3);
}

main.narrow { max-width: 30rem; }

h1 { font-size: 1.75rem; line-height: 1.1; margin: 0.5rem 0 1rem; letter-spacing: -0.015em; font-weight: 900; }
h2 { font-size: 1.125rem; line-height: 1.3; margin: 0 0 0.75rem; font-weight: 800; }
h3 { font-size: 1.0625rem; margin: 0 0 0.5rem; font-weight: 700; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--text); text-decoration-thickness: 2px; text-underline-offset: 3px; }

ul { margin: 0; padding: 0; list-style: none; }

code { font-size: var(--text-sm); overflow-wrap: anywhere; }

[hidden] { display: none !important; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }

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

/* Between pages: the new one fades in over the old, and the bars that don't change stay put,
   instead of the screen blinking on every link. Browsers without view transitions just navigate. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-group(*) { animation-duration: 0.15s; }
.topbar { view-transition-name: topbar; }
.sidebar { view-transition-name: sidebar; }
.group-head { view-transition-name: group-head; }
.tabs { view-transition-name: tabs; }

.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.grow { flex: 1; min-width: 0; }
.centered { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.fineprint { color: var(--muted); font-size: var(--text-sm); text-align: center; margin-top: 1.25rem; }
.error { color: var(--bad); }
.description { white-space: pre-wrap; }
.label-like { font-weight: 700; font-size: 0.9375rem; margin: 0 0 0.25rem; }

/* ---------- Colour blocks: groups and people ---------- */

.tone-0, .band-0 { --tone: var(--blue); --on-tone: var(--on-dark); }
.tone-1, .band-1 { --tone: var(--yellow); --on-tone: var(--on-colour); }
.tone-2, .band-2 { --tone: var(--red); --on-tone: var(--on-colour); }
.tone-3, .band-3 { --tone: var(--mint); --on-tone: var(--on-colour); }
.tone-4, .band-4 { --tone: var(--violet); --on-tone: var(--on-colour); }
.tone-5, .band-5 { --tone: var(--graphite); --on-tone: var(--bg); }

/* ---------- Icons, avatars, badges ---------- */

.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.icon svg {
  width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon.big { width: 2.75rem; height: 2.75rem; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--tone, var(--surface-2)); color: var(--on-tone, var(--text));
  border: var(--border) solid var(--line);
  font-size: 0.8125rem; font-weight: 800; letter-spacing: 0.02em;
}
.avatar.square { border-radius: var(--radius); width: 3rem; height: 3rem; font-size: 1rem; }
.avatar.small-square { border-radius: var(--radius-sm); width: 2.25rem; height: 2.25rem; font-size: 0.8125rem; }
.avatar.tiny { width: 1.875rem; height: 1.875rem; font-size: 0.6875rem; }
.avatar.square.tiny { border-radius: var(--radius-sm); }
.avatar.big { width: 4.5rem; height: 4.5rem; border-radius: var(--radius); font-size: 1.5rem; }

/* Unread messages: Swatch red, hard to miss, easy to count. */
.badge {
  display: inline-grid; place-items: center;
  min-width: 1.375rem; height: 1.375rem; padding: 0 0.375rem; margin-left: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-text);
  font-size: 0.75rem; font-weight: 800; line-height: 1; vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

/* ---------- Top bar ---------- */

/* The name sits in the middle, on every page. A phone gets a way back on the left; a wide
   screen doesn't need one, the sidebar is the way around. The stripe is the Swatch nod. */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
}
.topbar::after {
  content: ""; display: block; height: 4px;
  background: linear-gradient(to right,
    var(--red) 0 25%, var(--yellow) 25% 50%, var(--blue) 50% 75%, var(--mint) 75%);
}
.topbar-inner {
  max-width: 44rem; margin: 0 auto; height: calc(var(--bar) - 4px);
  padding: 0 var(--space);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--gap);
}
.topbar-inner.narrow { max-width: 30rem; }
.wordmark {
  grid-column: 2;
  display: inline-flex; align-items: baseline;
  font-weight: 900; font-size: 1.75rem; line-height: 1; letter-spacing: -0.035em;
  color: var(--text); text-decoration: none;
}
.wordmark span {
  margin-left: 0.06em; padding: 0.04em 0.14em 0.08em;
  background: var(--accent); color: var(--accent-text);
  border-radius: 3px; letter-spacing: -0.02em;
}
.topbar .back {
  grid-column: 1; justify-self: start;
  display: inline-flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%;
  color: var(--text); text-decoration: none; font-weight: 700;
  min-height: 44px; margin-left: -6px;
}
.topbar .back span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-link {
  grid-column: 3; justify-self: end;
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  color: var(--text); background: var(--surface); border: var(--border) solid var(--line);
}

/* ---------- Wide screens: your groups beside everything ---------- */

.sidebar { display: none; }

@media (min-width: 1024px) {
  .topbar-inner { max-width: none; padding: 0 1.5rem; }
  .topbar .back { display: none; }
  /* The column keeps its colour below a sidebar that's shorter than the page. */
  .shell {
    display: grid; grid-template-columns: 264px minmax(0, 1fr); align-items: start;
    min-height: calc(100vh - var(--bar));
    background: linear-gradient(to right, var(--surface) 262px, var(--line-soft) 262px 264px, transparent 264px) no-repeat;
  }
  .shell > main { max-width: 76rem; padding: 1.5rem 2rem 3rem; }
  .sidebar {
    display: flex; flex-direction: column; gap: 0.125rem;
    position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); overflow-y: auto;
    padding: 1.25rem 0.875rem;
    background: var(--surface); color: var(--text);
    border-right: var(--border) solid var(--line-soft);
  }
  .sidebar-label {
    margin: 0 0 0.5rem 0.625rem; font-size: var(--text-xs); font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted);
  }
  .sidebar-group, .sidebar-new {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.4375rem 0.625rem; border-radius: var(--radius-sm);
    color: inherit; text-decoration: none; font-weight: 650;
  }
  .sidebar-group:hover, .sidebar-new:hover { background: var(--surface-2); }
  .sidebar-group[aria-current="page"] { background: var(--text); color: var(--bg); }
  .sidebar-group[aria-current="page"] .avatar { border-color: var(--bg); }
  .sidebar-new { margin-top: 0.5rem; color: var(--muted); }
}

/* ---------- Cards and sections ---------- */

.card {
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  padding: var(--space);
  margin: 0 0 var(--space);
}
.card > h2, .section-head h2 {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800;
}
.card.message { text-align: center; margin-top: 2rem; }

.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  margin: 1.5rem 0 0.75rem;
}
.section-head h2 { margin: 0; display: inline-flex; align-items: center; }
.card > .section-head:first-child { margin-top: 0; }
.quiet-link { font-weight: 800; font-size: var(--text-sm); }

.stack > * + * { margin-top: 0.625rem; }
.row { display: flex; align-items: center; gap: var(--gap); }
.actions { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: var(--space); }
.actions.stack { display: block; }
.actions.top { margin: 0 0 0.5rem; }

/* Rows in a card: people, groups, settings. */
.rows > li {
  display: flex; align-items: center; gap: var(--gap);
  padding: 0.75rem 0; border-top: var(--border) solid var(--line-soft);
}
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows > li:last-child { padding-bottom: 0; }
.row-title { font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.rows form { margin: 0; }

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

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 700; font-size: 1rem;
  min-height: 46px; padding: 0 1.125rem;
  border: var(--border) solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  text-decoration: none; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
button.primary, .button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
button.danger, .button.danger { color: var(--bad); border-color: var(--bad); }
button.link, .button.link {
  min-height: 44px; padding: 0 0.25rem; border: 0; background: none;
  color: var(--muted); font-weight: 600; font-size: var(--text-sm);
  text-decoration: underline; text-underline-offset: 3px;
}
button.small, .button.small { min-height: 38px; padding: 0 0.875rem; font-size: var(--text-sm); }
.block { display: flex; width: 100%; }
button:disabled { opacity: 0.6; cursor: progress; }

/* Hover only where there is hover: on touch screens it sticks after a tap and looks selected. */
@media (hover: hover) {
  button:not(.link, .icon-button):hover, .button:not(.link):hover { transform: translate(-1px, -1px); box-shadow: var(--pop); }
  button.primary:hover, .button.primary:hover { border-color: var(--line); box-shadow: var(--pop-lift); }
  button.link:hover { color: var(--text); }
}
button:not(.link, .icon-button):active, .button:not(.link):active { transform: translate(1px, 1px); box-shadow: none; }

/* ---------- Forms ---------- */

form { margin: 0; }
.fields > * + * { margin-top: 1rem; }

label { display: block; font-weight: 700; font-size: 1rem; }
label .hint, .hint { display: block; font-weight: 400; color: var(--muted); font-size: var(--text-sm); margin-top: 0.125rem; }
form .hint { margin-top: 0.375rem; }

input[type="email"], input[type="text"], input[type="password"], input[type="time"],
input[type="date"], input[type="number"], select, textarea {
  display: block; width: 100%;
  font: inherit; font-weight: 400; color: var(--text);
  min-height: 48px; padding: 0.625rem 0.875rem; margin-top: 0.375rem;
  border: var(--border) solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
textarea { resize: vertical; min-height: 48px; line-height: 1.4; }
select { appearance: none; padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--text) 50%), linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.85; }
.code-input { font-size: 1.625rem; font-weight: 800; letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; }

/* A checkbox or radio with its text beside it. */
label.check {
  display: flex; align-items: flex-start; gap: 0.625rem;
  font-weight: 400; padding: 0.375rem 0;
}
label.check input { width: 1.25rem; height: 1.25rem; margin: 0.125rem 0 0; flex: none; accent-color: var(--brand); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.form-error, p.error {
  background: var(--bad-soft); color: var(--bad);
  border: var(--border) solid var(--bad);
  border-radius: var(--radius-sm); padding: 0.625rem 0.875rem; font-weight: 650;
}

/* Disclosure: optional settings and organiser tools stay folded until wanted. */
details { border-top: var(--border) solid var(--line-soft); }
details > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 0.5rem;
  min-height: 48px; font-weight: 700;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: ""; margin-left: auto; width: 8px; height: 8px;
  border-right: 2.5px solid var(--text); border-bottom: 2.5px solid var(--text);
  transform: rotate(45deg) translateY(-2px); transition: transform 0.15s;
}
details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details > .fold { padding: 0.25rem 0 1rem; }
.card > details:first-child { border-top: 0; }
details.plain { border: 0; }
details.note { border: 0; margin-top: 0.25rem; }
details.note > summary { min-height: 44px; font-weight: 650; font-size: var(--text-sm); color: var(--muted); }
details.note > summary::after { display: none; }
details.past { margin-top: 0.5rem; border: 0; }
details.confirm { margin-top: 0.5rem; }
details.confirm > summary { color: var(--bad); font-size: var(--text-sm); }

/* ---------- Pills, callouts, empty states ---------- */

/* Status tags: small caps on a flat colour block, square like a watch's date window. */
.pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.0625rem 0.4375rem; border-radius: 3px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--surface-2); color: var(--text);
}
.pill.ok { background: var(--mint); color: var(--on-colour); }
.pill.warn { background: var(--yellow); color: var(--on-colour); }
.pill.bad { background: var(--red); color: var(--on-colour); }
.pill.info { background: var(--blue); color: var(--on-dark); }

/* Notes and guidance: a quiet tint with a colour edge, so the page's real colour stays the content. */
.callout {
  display: flex; gap: 0.75rem; align-items: flex-start;
  border: var(--border) solid var(--line); border-left-width: 6px; border-radius: var(--radius-sm);
  padding: 0.875rem var(--space); margin: 0 0 var(--space);
  background: var(--info-soft); color: var(--text); border-left-color: var(--blue);
}
.callout.ok { background: var(--ok-soft); border-left-color: var(--mint); }
.callout.warn { background: var(--warn-soft); border-left-color: var(--yellow); }
.callout.bad { background: var(--bad-soft); border-left-color: var(--red); }
.callout p { margin: 0 0 0.375rem; }
.callout p:last-child { margin: 0; }
.callout .actions { margin-top: 0.625rem; }
.callout a { color: var(--text); }
p.callout { display: block; }

.empty { text-align: center; padding: 1rem 0.5rem; color: var(--muted); }
.empty p { margin: 0.5rem auto 1rem; max-width: 24rem; }
.empty .icon.big { color: var(--text); }

/* ---------- Front page ---------- */

/* Ink, the name big, and the stripe: the face of the watch. Always dark, in both modes. */
.hero {
  background: var(--night); color: var(--on-dark);
  border: var(--border) solid var(--line); border-radius: var(--radius);
  padding: 2.75rem 1.5rem 0; margin: 0.5rem 0 1.25rem; text-align: center; overflow: hidden;
}
.hero::after {
  content: ""; display: block; height: 10px; margin: 2.25rem -1.5rem 0;
  background: linear-gradient(to right,
    var(--red) 0 25%, var(--yellow) 25% 50%, var(--blue) 50% 75%, var(--mint) 75%);
}
.hero h1 { font-size: 3.5rem; font-weight: 900; letter-spacing: -0.045em; margin: 0; line-height: 1; }
.hero h1 span {
  margin-left: 0.05em; padding: 0.02em 0.12em 0.06em; border-radius: 4px;
  background: var(--accent); color: var(--on-dark); letter-spacing: -0.02em;
}
.hero .lead { font-size: 1.25rem; font-weight: 400; margin: 1.125rem auto 0; max-width: 20rem; opacity: 0.85; }
.features { display: grid; gap: 0.75rem; margin: 0 0 1.5rem; }
.features li {
  display: flex; gap: 0.875rem; padding: 1rem;
  border: var(--border) solid var(--line); border-radius: var(--radius);
  background: var(--surface); border-top: 8px solid var(--tone);
}
.features li:nth-child(1) { --tone: var(--blue); }
.features li:nth-child(2) { --tone: var(--yellow); }
.features li:nth-child(3) { --tone: var(--red); }
.feature-icon {
  width: 2.5rem; height: 2.5rem; padding: 0.5rem; border-radius: var(--radius-sm);
  background: var(--tone); color: var(--on-colour);
}
.features li:nth-child(1) .feature-icon { color: var(--on-dark); }
.feature-title { font-weight: 800; margin: 0; }
.features .muted { margin: 0; font-size: var(--text-sm); }

.group-list { display: grid; gap: 0.75rem; }
.group-row {
  display: flex; align-items: center; gap: var(--gap);
  padding: 0.875rem var(--space);
  background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
@media (hover: hover) { .group-row:hover { transform: translate(-1px, -1px); box-shadow: var(--pop); } }
.group-row p { margin: 0; }
.chevron { color: var(--muted); }

@media (min-width: 720px) {
  .features { grid-template-columns: repeat(3, 1fr); }
  .features li { flex-direction: column; }
  .group-list { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 4rem 2rem 3rem; }
  .hero h1 { font-size: 4.5rem; }
}

/* ---------- Group header and tabs ---------- */

.group-head {
  display: flex; align-items: center; gap: var(--gap);
  margin: 0.25rem 0 0.75rem; padding: 1rem;
  background: var(--tone, var(--surface)); color: var(--on-tone, var(--text));
  border: var(--border) solid var(--line); border-radius: var(--radius);
}
.group-head h1 { margin: 0; font-size: 1.625rem; overflow-wrap: anywhere; }
.group-head p { margin: 0.125rem 0 0; font-weight: 600; }
.group-head .avatar { background: var(--surface); color: var(--text); }

/* Five equal tabs in one bar, icon over label, so all fit at 360 px. */
.tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  padding: 3px; margin: 0 0 var(--space);
  background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius);
}
.tabs a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 52px; padding: 0.25rem 0.125rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 0.75rem;
}
.tabs a .icon { width: 1.375rem; height: 1.375rem; }
.tabs a[aria-current="page"] { background: var(--text); color: var(--bg); }
.tabs .badge { position: absolute; top: 2px; right: 4px; margin: 0; min-width: 1.25rem; height: 1.25rem; font-size: 0.6875rem; }
@media (min-width: 640px) {
  .tabs { display: flex; }
  .tabs a { flex-direction: row; gap: 0.4rem; font-size: 1rem; padding: 0 1rem; min-height: 44px; }
  .tabs .badge { position: static; margin-left: 0.125rem; }
}

/* Onboarding checklist */
.checklist li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.5rem 0; }
.checklist .step {
  flex: none; display: grid; place-items: center;
  width: 1.875rem; height: 1.875rem; border-radius: 50%;
  border: var(--border) solid var(--line); background: var(--surface); color: var(--text);
  font-size: var(--text-xs); font-weight: 800;
}
.checklist li.done .step { background: var(--mint); color: var(--on-colour); }
.checklist li.done .row-title { color: var(--muted); text-decoration: line-through; }
.checklist p { margin: 0; }
.onboarding { background: var(--yellow); color: var(--on-colour); }
.onboarding .muted, .onboarding li.done .row-title { color: var(--on-colour); }
.onboarding .button { background: var(--surface); color: var(--text); }

/* Home: events, and on a wide screen the chat beside them. */
.home-aside { display: none; }
.chat-teaser {
  display: flex; align-items: center; gap: var(--gap);
  margin: var(--space) 0; padding: 0.875rem var(--space);
  background: var(--brand); color: var(--brand-text); text-decoration: none;
  border: var(--border) solid var(--line); border-radius: var(--radius);
}
.chat-teaser .chevron { color: var(--brand-text); }
.teaser-icon { width: 2.25rem; height: 2.25rem; padding: 0.4rem; border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.teaser-title { display: flex; align-items: center; font-weight: 800; }
.teaser-text { display: block; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 1024px) {
  .home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 1.5rem; align-items: start; }
  .home-aside { display: block; position: sticky; top: calc(var(--bar) + 1.5rem); }
  .home-main .chat-teaser { display: none; }
  .home-main > .section-head:first-of-type { margin-top: 0.25rem; }
  .home-chat ul.thread { max-height: calc(100vh - 340px); overflow-y: auto; padding-right: 0.25rem; }
}

/* The next event, pinned above the group chat (C7.5). */
.pinned { flex: none; margin: 0 0 var(--space); }
.pinned-label {
  margin: 0 0 0.375rem; font-size: var(--text-xs); font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.pinned .event-card { margin: 0; background: var(--bg); }
@media (min-width: 1024px) {
  /* A row, so the messages keep their room. */
  .pinned .event-card { display: flex; align-items: center; gap: var(--gap); padding: 0.75rem 1rem; }
  .pinned .event { flex: 1; min-width: 0; }
  .pinned form.answer { flex: 0 0 20rem; margin: 0; }
  .pinned .answers button { min-height: 40px; }
}

/* An event: on a phone, who's coming, then the conversation, then the organiser's tools. */
.event-layout { display: flex; flex-direction: column; }
.event-main { display: contents; }
.event-side { order: 1; }
.event-main > .guests, .event-main > .tools { order: 2; }

@media (min-width: 1024px) {
  .event-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 1.5rem; align-items: start; }
  .event-main { display: block; }
  .event-side { position: sticky; top: calc(var(--bar) + 1.5rem); }
  .event-side ul.thread { max-height: calc(100vh - 300px); overflow-y: auto; padding-right: 0.25rem; }
}

/* ---------- Events ---------- */

.event { display: flex; gap: 0.875rem; }
.datebadge {
  flex: none; width: 3.5rem; text-align: center;
  border-radius: var(--radius-sm); overflow: hidden;
  border: var(--border) solid var(--line); background: var(--surface);
  align-self: flex-start;
}
.datebadge .dow { display: block; background: var(--accent); color: var(--accent-text); font-size: 0.6875rem; font-weight: 800; text-transform: uppercase; padding: 0.125rem 0; letter-spacing: 0.1em; }
.datebadge .day { display: block; font-size: 1.625rem; font-weight: 900; line-height: 1.1; padding-top: 0.125rem; font-variant-numeric: tabular-nums; }
.datebadge .mon { display: block; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding-bottom: 0.25rem; }
.event.cancelled .datebadge { opacity: 0.6; }
.event.cancelled .datebadge .dow { background: var(--muted); color: var(--bg); }
.event-title { font-weight: 800; font-size: 1.1875rem; margin: 0; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
a.event-title:hover { text-decoration: underline; }
.event .meta { color: var(--muted); font-size: var(--text-sm); margin: 0.125rem 0 0; display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.event .meta .icon { width: 1rem; height: 1rem; vertical-align: -0.15em; }
.pills { display: flex; flex-wrap: wrap; gap: 0.375rem; margin: 0.5rem 0 0; }
.count-line { margin: 0.375rem 0 0; }
.latest {
  margin-top: 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: var(--text-sm);
}
.latest p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest b { font-weight: 800; }

/* Headcount: a meter, so the bar needs no inline width. */
.count { font-weight: 800; margin: 0.75rem 0 0; }
meter.places {
  display: block; width: 100%; height: 12px; margin: 0.375rem 0 0.75rem;
  border: var(--border) solid var(--line); border-radius: 2px; background: var(--surface-2);
}
meter.places::-webkit-meter-bar { background: var(--surface-2); border: 0; border-radius: 0; height: 8px; }
meter.places::-webkit-meter-optimum-value, meter.places::-webkit-meter-suboptimum-value, meter.places::-webkit-meter-even-less-good-value { background: var(--mint); border-radius: 0; }
meter.places::-moz-meter-bar { background: var(--mint); border-radius: 0; }

/* C5.1: one tap per answer, big enough for a thumb. */
.answer { margin-top: 0.875rem; }
.answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.answers button { width: 100%; min-height: 48px; padding: 0 0.5rem; }
.answers button.chosen { box-shadow: var(--pop); border-color: var(--line); }
.answers button.chosen.YES { background: var(--mint); color: var(--on-colour); }
.answers button.chosen.MAYBE { background: var(--yellow); color: var(--on-colour); }
.answers button.chosen.NO { background: var(--red); color: var(--on-colour); }
.answers button.chosen::before { content: "✓"; font-weight: 900; }
.my-answer { font-size: var(--text-sm); color: var(--muted); margin: 0.75rem 0 0.375rem; }
.answer + .my-answer { margin-top: 0.625rem; }
label.offer { font-weight: 400; font-size: var(--text-sm); color: var(--muted); display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.25rem 0 0.75rem; }
label.offer input { width: 1.125rem; height: 1.125rem; margin-top: 0.125rem; flex: none; accent-color: var(--brand); }

/* Event page */
.event-hero h1 { margin: 0.375rem 0 0.5rem; font-size: 1.875rem; }
.facts { margin: 0.5rem 0 0; }
.facts li { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.25rem 0; }
.facts .icon { margin-top: 0.125rem; }
p.decision { color: var(--muted); font-size: var(--text-sm); margin: 0.5rem 0 0; }
.facts p.decision { margin: 0; color: var(--text); font-size: 1rem; }

/* The roster */
.roster-group + .roster-group { margin-top: 1rem; }
.roster-group h3 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; }
.people { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.person {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.1875rem 0.75rem 0.1875rem 0.1875rem; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line-soft); background: var(--surface); font-size: var(--text-sm); font-weight: 600;
}
.person .avatar { border-width: 1.5px; }

/* Invariant 9: the claim question comes first and stands out. C10.4: so does an offered place. */
.claim {
  border: var(--border) solid var(--line); border-radius: var(--radius);
  padding: var(--space); margin: 0 0 var(--space); background: var(--yellow); color: var(--on-colour);
}
.claim .actions { margin-top: 0.75rem; }

/* Organiser tool links. */
.rows.links { margin-top: 0.5rem; }
.rows.links li:first-child { padding-top: 0.75rem; border-top: var(--border) solid var(--line-soft); }
.rows.links a { color: var(--text); text-decoration: none; font-weight: 700; }

/* Guests on the event page: name and remove on one line, merge beneath. */
.rows > li.guest-row { display: block; }
.merge { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.merge select { margin: 0; }

/* ---------- Conversations ---------- */

ul.thread { display: flex; flex-direction: column; gap: 0.5rem; }
li.message { display: flex; gap: 0.5rem; align-items: flex-end; max-width: 100%; }
/* Wide rather than tall: a bubble takes the room it needs across, and its name, time and
   actions share one line above the text. */
li.message .bubble {
  min-width: 0; max-width: min(92%, 44rem);
  background: var(--surface); border: var(--border) solid var(--line);
  border-radius: 8px 8px 8px 2px; padding: 0.25rem 0.75rem 0.375rem;
}
li.message.own { flex-direction: row-reverse; }
li.message.own .bubble { background: var(--brand); border-color: var(--brand); color: var(--brand-text); border-radius: 8px 8px 2px 8px; }
li.message.own .meta, li.message.own .author, li.message.own .icon-button { color: var(--brand-text); }
li.message .head { display: flex; align-items: center; gap: 0.5rem; }
li.message .meta { flex: 1; min-width: 0; margin: 0; font-size: var(--text-xs); line-height: 1.5; color: var(--muted); }
li.message .author { font-weight: 800; color: var(--text); }
li.message .body { margin: 0; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
li.message .mark { font-weight: 700; }
/* The negative margins keep the 32 px buttons from making the line taller. */
li.message .tools { display: flex; flex: none; margin: -0.375rem -0.625rem -0.375rem 0; font-size: var(--text-xs); }
li.message .tools form { display: flex; align-items: center; }
.icon-button {
  min-height: 32px; width: 32px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted);
}
.icon-button .icon { width: 1rem; height: 1rem; }
@media (hover: hover) {
  .icon-button:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
}
li.message .deleted { font-style: italic; color: var(--muted); font-size: var(--text-sm); }
li.message.gone { justify-content: center; }
p.empty { text-align: center; color: var(--muted); font-size: var(--text-sm); padding: 0.75rem 0; }

form.post { display: flex; gap: 0.5rem; align-items: flex-end; margin-top: var(--space); }
form.post .grow textarea { margin-top: 0; padding-left: 1rem; resize: none; }
form.post button { flex: none; min-height: 48px; }
form.post label.offer { flex-basis: 100%; }
form.post.with-offer { flex-wrap: wrap; }
.thread-fold { margin-top: 0.75rem; }

/* The chat tab: who to talk to, and the open conversation. */
.conversations {
  display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--space) * -1) 0.75rem; padding: 0.125rem var(--space) 0.375rem;
}
.conversations::-webkit-scrollbar { display: none; }
.conversation-link {
  display: inline-flex; align-items: center; gap: 0.375rem; flex: none;
  padding: 0.25rem 0.75rem 0.25rem 0.25rem; min-height: 44px;
  border: var(--border) solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; font-size: var(--text-sm);
}
.conversation-link[aria-current="page"] { background: var(--text); color: var(--bg); }
.conversation-link[aria-current="page"] .avatar { border-color: var(--bg); }
.conversation-link .badge { margin-left: 0.125rem; }
.conversation-link.new { padding-left: 0.75rem; }
.conversation { margin: 0; }
.conversation-head {
  display: flex; align-items: center; gap: 0.75rem;
  padding-bottom: 0.75rem; margin-bottom: 0.75rem; border-bottom: var(--border) solid var(--line-soft);
}
.conversation-head h2 { margin: 0; font-size: 1.125rem; }
.conversation-head p { margin: 0; }
.conversation ul.thread { max-height: calc(100dvh - 420px); min-height: 14rem; overflow-y: auto; padding: 0.25rem 0.25rem 0.25rem 0; }

@media (min-width: 1024px) {
  .chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .conversations {
    flex-direction: column; overflow: visible; margin: 0; padding: 0.75rem;
    background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius);
    position: sticky; top: calc(var(--bar) + 1.5rem);
  }
  .conversation-link { display: flex; border-color: transparent; border-radius: var(--radius-sm); min-height: 48px; }
  .conversation-link:hover { border-color: var(--line); }
  .conversation-link .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conversation { display: flex; flex-direction: column; height: calc(100vh - 280px); min-height: 28rem; }
  .conversation ul.thread { flex: 1; max-height: none; min-height: 0; }
}

/* ---------- Sharing and QR ---------- */

.share { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0 0; }
.share a.button { font-size: var(--text-sm); }
.linkbox {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface-2); border: var(--border) solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 0.625rem 0.75rem; font-size: var(--text-sm);
}
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.qr { background: #ffffff; border-radius: var(--radius); padding: 0.75rem; border: var(--border) solid var(--line); }
/* QR screen (C3.2e): big enough to scan from arm's length, always dark on white. */
.qr svg { display: block; width: min(100%, 22rem); height: auto; margin: 0 auto; }
#qr-link { overflow-wrap: anywhere; text-align: center; color: var(--muted); font-size: var(--text-sm); }
.qr-card { text-align: center; }
.qr-card .actions { justify-content: center; }

/* ---------- Joining and signing in ---------- */

.invite-head { text-align: center; margin-bottom: 1rem; }
.invite-head h1 { margin: 0.125rem 0 0; }
.invite-head p { margin: 0.75rem 0 0; }
.card > .icon.big:first-child { display: flex; margin: 0.25rem auto 0.5rem; }

/* ---------- Settings and account ---------- */

/* C6.2, C6.3: kinds of notice by channel, and quiet hours. */
table.channels { border-collapse: collapse; width: 100%; margin: 0 0 0.5rem; }
table.channels th, table.channels td { padding: 0.5rem 0.25rem; text-align: left; vertical-align: middle; border-top: var(--border) solid var(--line-soft); }
table.channels thead th { border-top: 0; font-size: var(--text-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
table.channels td { text-align: center; width: 5rem; }
table.channels thead th:not(:first-child) { text-align: center; }
table.channels input { width: 1.25rem; height: 1.25rem; accent-color: var(--brand); }
.quiet { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.quiet label:last-child { grid-column: 1 / -1; }

.danger-zone { border-color: var(--bad); }
.danger-zone h2 { color: var(--bad); }

.member-tools { margin-top: 0.25rem; }
.member-tools > summary { min-height: 36px; font-size: var(--text-sm); color: var(--muted); }
.member-tools .row select { margin: 0; }
.device-row { margin-bottom: 0.75rem; }
.device-row p { margin: 0; }
.add-name { margin-top: 1rem; display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: end; }
.add-name > * + * { margin-top: 0; }
.rows form.row input { margin: 0; }
.onboarding h2 { margin-bottom: 0.5rem; }

/* C6.2: "Get reminders on this phone", shown by push.js after joining. */
section.push { background: var(--info-soft); border-left: 6px solid var(--blue); }
section.push p { margin: 0 0 0.625rem; }
section.push .row { flex-wrap: wrap; }
section.push label.check { font-size: var(--text-sm); }
.push-head { margin-bottom: 0.5rem; }
.push-head h2 { margin: 0; font-size: 1.0625rem; text-transform: none; letter-spacing: 0; }

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  main { padding-top: 1.5rem; }
  h1 { font-size: 2.25rem; }
  .card { padding: 1.25rem 1.5rem; }
  .group-head { padding: 1.25rem 1.5rem; }
  .group-head h1 { font-size: 2.25rem; }
}
