/* ZongoConnect design system
   Tokens first, then primitives, then components. Light and dark are both
   first-class.

   The palette is taken from the Light of the Zongo Foundation's own mark — the dark
   brown of the shelter and the gold of the lamp. It was a cool green before, which
   read as generic SaaS and, now that the Foundation's logo sits in the masthead,
   actively fought it. The `--green-*` names are kept so nothing downstream has to be
   renamed; only the values moved. */

:root {
  --green-900: #241708;
  --green-800: #33210d;
  --green-700: #472e12;
  --green-600: #5c3d18;   /* primary: the shelter brown from the mark */
  --green-500: #74501f;
  --green-400: #9a7433;
  --green-100: #f0e3cc;
  --green-50:  #faf4e9;

  --amber-600: #a8761f;   /* the lamp gold */
  --amber-500: #c4923e;
  --amber-100: #fbf0dc;

  --rose-600: #a83232;
  --rose-100: #fbe4e4;

  /* Warm greys, so body text sits with the brown rather than against it. */
  --ink-900: #1c1509;
  --ink-800: #2b2113;
  --ink-700: #46392a;
  --ink-600: #63543f;
  --ink-500: #85735c;
  --ink-400: #a8987f;
  --ink-300: #cdc2ae;
  --ink-200: #e4dbcb;
  --ink-100: #f2ece1;
  --paper:   #fbf9f5;
  --white:   #ffffff;

  --bg:            var(--paper);
  --bg-raised:     var(--white);
  --bg-sunken:     #f4f3ef;
  --bg-inset:      var(--ink-100);
  --text:          var(--ink-900);
  --text-muted:    var(--ink-600);
  --text-subtle:   var(--ink-500);
  --border:        var(--ink-200);
  --border-strong: var(--ink-300);
  --accent:        var(--green-600);
  --accent-hover:  var(--green-700);
  --accent-soft:   var(--green-50);
  --accent-text:   var(--green-700);
  --warn:          var(--amber-600);
  --warn-soft:     var(--amber-100);
  --danger:        var(--rose-600);
  --danger-soft:   var(--rose-100);
  --on-accent:     #ffffff;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 2px rgb(28 21 9 / 6%), 0 1px 3px rgb(28 21 9 / 4%);
  --shadow:    0 2px 4px rgb(28 21 9 / 4%), 0 6px 16px -6px rgb(28 21 9 / 10%);
  --shadow-lg: 0 12px 40px -12px rgb(28 21 9 / 20%);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --step: 4px;
  --shell-max: 1140px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Warm dark, not neutral dark: the same browns pulled down, so the Foundation's
       gold still reads as the accent rather than as a stray highlight. */
    --bg:            #12100b;
    --bg-raised:     #1b1811;
    --bg-sunken:     #0f0d09;
    --bg-inset:      #262117;
    --text:          #f0eae0;
    --text-muted:    #b8ab97;
    --text-subtle:   #978b78;
    --border:        #322b1f;
    --border-strong: #443b2b;
    /* Gold on dark, because the brown primary disappears against it. */
    --accent:        var(--amber-500);
    --accent-hover:  #d7a852;
    --accent-soft:   #251d10;
    --accent-text:   var(--amber-500);
    --warn:          #e0a34a;
    --warn-soft:     #2b2113;
    --danger:        #e07070;
    --danger-soft:   #2c1717;
    --on-accent:     #1c1509;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow:    0 2px 6px rgb(0 0 0 / 40%);
    --shadow-lg: 0 16px 48px -16px rgb(0 0 0 / 70%);
  }
}

/* ------------------------------------ base ----------------------------------- */

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0 0 calc(var(--step) * 2); line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 calc(var(--step) * 3); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-text); text-decoration-color: color-mix(in oklab, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: calc(var(--step) * 6) 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------- layout ----------------------------------- */

.shell { width: 100%; max-width: var(--shell-max); margin-inline: auto; padding-inline: 20px; }
.main  { flex: 1; padding-block: calc(var(--step) * 9) calc(var(--step) * 14); }

.stack   > * + * { margin-top: calc(var(--step) * 4); }
.stack-sm > * + * { margin-top: calc(var(--step) * 2); }
.stack-lg > * + * { margin-top: calc(var(--step) * 8); }

.row { display: flex; gap: calc(var(--step) * 3); align-items: center; flex-wrap: wrap; }
.row-tight { gap: calc(var(--step) * 2); }
.row-center { justify-content: center; }
.row-end { justify-content: flex-end; }
.row-top { align-items: flex-start; }
.row-between { display: flex; gap: calc(var(--step) * 4); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1; }

.grid { display: grid; gap: calc(var(--step) * 5); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.split { display: grid; gap: calc(var(--step) * 7); grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.split-narrow { grid-template-columns: 260px minmax(0, 1fr); }
@media (max-width: 900px) { .split, .split-narrow { grid-template-columns: minmax(0, 1fr); } }

.page-head { margin-bottom: calc(var(--step) * 7); }
.page-head p { color: var(--text-muted); max-width: 62ch; }
.eyebrow {
  font-size: 0.78rem; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: calc(var(--step) * 2);
}

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

.masthead {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.masthead .shell { display: flex; align-items: center; gap: calc(var(--step) * 5); height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark {
  /* The emblem alone — the source artwork is a lockup whose wordmark is illegible at
     this size and duplicates the text beside it. Landscape because the cropped emblem
     is wider than it is tall. No background tile: it is drawn for a light ground. */
  width: 46px; height: 39px; flex: none; object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small {
  font-size: .68rem; font-weight: 500; opacity: .7; letter-spacing: .01em;
  text-transform: none;
}
/* On a narrow screen the strapline is the first thing to go, not the name. */
@media (max-width: 30rem) { .brand-text small { display: none; } }


.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }

/* :not(.btn) matters — these rules are more specific than .btn-primary, so without
   it the nav would repaint the call-to-action button's text in the muted link
   colour and drop it to roughly 1.5:1 against its own background. */
.nav a:not(.btn) {
  padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-muted);
  text-decoration: none; font-size: 0.92rem; font-weight: 550; white-space: nowrap;
}
.nav a:not(.btn):hover { background: var(--bg-inset); color: var(--text); }
.nav a:not(.btn)[aria-current="page"] { color: var(--text); background: var(--bg-inset); }

.nav-count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius-full); font-size: 0.7rem; font-weight: 700;
  text-align: center; line-height: 18px;
}

/* Scoped to .masthead so it outranks `.btn { display: inline-flex }`, which is
   declared later in this file and would otherwise keep the toggle on screen. */
.masthead .menu-toggle { display: none; }
@media (max-width: 780px) {
  .masthead .shell { height: auto; flex-wrap: wrap; padding-block: 12px; }
  .masthead .menu-toggle { display: inline-flex; margin-left: auto; }
  .nav {
    order: 3; width: 100%; margin-left: 0; flex-direction: column; align-items: stretch;
    gap: 2px; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 10px;
  }
  .nav[hidden] { display: none; }
  .nav a:not(.btn) { padding: 10px 12px; }
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-size: 0.94rem; font-weight: 600; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .14s ease, border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-raised); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-inset); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-inset); color: var(--text); }

.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }

.btn-lg { padding: 13px 26px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ----------------------------------- cards ----------------------------------- */

.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: calc(var(--step) * 6);
  box-shadow: var(--shadow-sm);
}
.card-sm { padding: calc(var(--step) * 4); border-radius: var(--radius); }
.card-flat { box-shadow: none; }
.card-quiet { background: var(--bg-sunken); }

.card-link { display: block; color: inherit; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }

.card-title { font-size: 1.05rem; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.card-head { display: flex; gap: calc(var(--step) * 3); align-items: flex-start; }
.card-head > div { min-width: 0; }
.card-head h3, .card-head p { margin: 0; }
.card > * + * { margin-top: calc(var(--step) * 3); }
.card > .divider + * { margin-top: 0; }

.section-title {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-subtle); margin-bottom: calc(var(--step) * 3);
}

/* ---------------------------------- avatars ---------------------------------- */

.avatar {
  --size: 44px;
  width: var(--size); height: var(--size); flex: none;
  border-radius: var(--radius-full); display: grid; place-items: center;
  font-weight: 700; font-size: calc(var(--size) / 2.6); letter-spacing: -0.02em;
  background: hsl(var(--hue, 160) 42% 88%);
  color: hsl(var(--hue, 160) 65% 24%);
  border: 1px solid hsl(var(--hue, 160) 35% 78%);
  text-decoration: none;
}
@media (prefers-color-scheme: dark) {
  .avatar { background: hsl(var(--hue, 160) 30% 22%); color: hsl(var(--hue, 160) 55% 78%); border-color: hsl(var(--hue, 160) 25% 30%); }
}
.avatar-lg { --size: 76px; }
.avatar-sm { --size: 32px; }
.avatar-xs { --size: 26px; }

/* Avatar hues live in classes rather than inline style attributes, so the CSP can
   keep style-src locked to 'self' with no unsafe-inline escape hatch. */
.hue-0  { --hue: 0; }    .hue-1  { --hue: 15; }   .hue-2  { --hue: 30; }   .hue-3  { --hue: 45; }
.hue-4  { --hue: 60; }   .hue-5  { --hue: 75; }   .hue-6  { --hue: 90; }   .hue-7  { --hue: 105; }
.hue-8  { --hue: 120; }  .hue-9  { --hue: 135; }  .hue-10 { --hue: 150; }  .hue-11 { --hue: 165; }
.hue-12 { --hue: 180; }  .hue-13 { --hue: 195; }  .hue-14 { --hue: 210; }  .hue-15 { --hue: 225; }
.hue-16 { --hue: 240; }  .hue-17 { --hue: 260; }  .hue-18 { --hue: 280; }  .hue-19 { --hue: 300; }
.hue-20 { --hue: 315; }  .hue-21 { --hue: 330; }  .hue-22 { --hue: 345; }  .hue-23 { --hue: 355; }

/* ----------------------------------- tags ------------------------------------ */

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  background: var(--bg-inset); color: var(--text-muted);
  font-size: 0.79rem; font-weight: 550; text-decoration: none; border: 1px solid transparent;
}
a.tag:hover { border-color: var(--border-strong); color: var(--text); }
.tag-accent { background: var(--accent-soft); color: var(--accent-text); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.76rem; font-weight: 650; letter-spacing: 0.01em;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-open    { background: var(--accent-soft); color: var(--accent-text); }
.pill-pending { background: var(--warn-soft);   color: var(--warn); }
.pill-closed  { background: var(--bg-inset);    color: var(--text-subtle); }
.pill-ended   { background: var(--danger-soft); color: var(--danger); }

.meta { display: flex; flex-wrap: wrap; gap: calc(var(--step) * 3); color: var(--text-subtle); font-size: 0.85rem; }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); font-size: 0.85rem; }
.strong { font-weight: 650; color: var(--text); }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

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

.field { display: block; margin-bottom: calc(var(--step) * 5); }
.field > label, .label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.hint { display: block; color: var(--text-subtle); font-size: 0.82rem; margin-top: 5px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="search"], input[type="datetime-local"],
textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 0.94rem;
  color: var(--text); background: var(--bg-raised);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .14s ease, box-shadow .14s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field-error input, .field-error textarea, .field-error select { border-color: var(--danger); }
.error-text { display: block; color: var(--danger); font-size: 0.84rem; font-weight: 550; margin-top: 5px; }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check-body strong { display: block; font-size: 0.94rem; }
.check-body span { color: var(--text-subtle); font-size: 0.84rem; }

.choice-grid { display: grid; gap: calc(var(--step) * 3); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.choice {
  position: relative; display: block; padding: 14px 16px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-raised);
  transition: border-color .14s ease, background-color .14s ease;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice strong { display: block; font-size: 0.95rem; }
.choice span { color: var(--text-subtle); font-size: 0.83rem; }
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-actions { display: flex; gap: calc(var(--step) * 3); align-items: center; flex-wrap: wrap; margin-top: calc(var(--step) * 6); }

.auth-shell { max-width: 460px; margin-inline: auto; }
.form-grid { display: grid; gap: 0 calc(var(--step) * 5); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------------------------------- filters ---------------------------------- */

/* Flex rather than grid: `repeat(auto-fit, …)` is invalid alongside an `fr` track,
   which silently voided the whole template and collapsed the bar to one column.
   Flex also adapts to pages that have three controls instead of four. */
.filters { display: flex; flex-wrap: wrap; gap: calc(var(--step) * 3); align-items: flex-end; }
.filters .field { flex: 1 1 150px; margin-bottom: 0; min-width: 0; }
.filters .field:first-child { flex: 3 1 240px; }
.filters .btn { flex: 0 0 auto; }
@media (max-width: 620px) {
  .filters .field, .filters .field:first-child { flex-basis: 100%; }
  .filters .btn { width: 100%; }
}

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------- alerts ----------------------------------- */

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid transparent; font-size: 0.92rem;
}
.alert-ok    { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in oklab, var(--accent) 30%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger);      border-color: color-mix(in oklab, var(--danger) 30%, transparent); }
.alert-warn  { background: var(--warn-soft);   color: var(--warn);        border-color: color-mix(in oklab, var(--warn) 30%, transparent); }
.alert-info  { background: var(--bg-inset);    color: var(--text-muted);  border-color: var(--border); }
.alert a { color: inherit; font-weight: 600; }

.empty {
  text-align: center; padding: calc(var(--step) * 14) calc(var(--step) * 6);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  color: var(--text-muted); background: var(--bg-sunken);
}
.empty h3 { color: var(--text); }
.empty-mark { font-size: 1.8rem; margin-bottom: 8px; }

/* ----------------------------------- hero ------------------------------------ */

.hero { padding-block: calc(var(--step) * 16) calc(var(--step) * 12); position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: auto -10% 0 auto;
  width: 620px; height: 620px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 16%, transparent), transparent 68%);
  transform: translate(20%, -18%);
}
.hero h1 { max-width: 16ch; }
.hero-lede { font-size: 1.12rem; color: var(--text-muted); max-width: 54ch; }
.hero-actions { display: flex; gap: calc(var(--step) * 3); flex-wrap: wrap; margin-top: calc(var(--step) * 7); }

.stat-row { display: flex; gap: calc(var(--step) * 10); flex-wrap: wrap; margin-top: calc(var(--step) * 10); }
.stat b { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat span { color: var(--text-subtle); font-size: 0.85rem; }

.step-num {
  width: 30px; height: 30px; border-radius: var(--radius-full); display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 0.85rem;
  margin-bottom: calc(var(--step) * 3);
}

.band { background: var(--bg-sunken); border-block: 1px solid var(--border); padding-block: calc(var(--step) * 14); }

/* ---------------------------------- profile ---------------------------------- */

.profile-head { display: flex; gap: calc(var(--step) * 5); align-items: flex-start; flex-wrap: wrap; }
.profile-head h1 { margin-bottom: 4px; }

.facts { display: grid; gap: calc(var(--step) * 3); }
.fact { display: flex; justify-content: space-between; gap: calc(var(--step) * 3); font-size: 0.9rem; align-items: baseline; }
.fact dt { color: var(--text-subtle); }
.fact dd { margin: 0; font-weight: 600; text-align: right; }

.sticky-side { position: sticky; top: 84px; }
@media (max-width: 900px) { .sticky-side { position: static; } }

/* ---------------------------------- threads ---------------------------------- */

.thread {
  display: flex; flex-direction: column; gap: calc(var(--step) * 4);
  max-height: 60vh; overflow-y: auto; padding: calc(var(--step) * 5);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0;
  scroll-behavior: smooth;
}
.bubble-row { display: flex; gap: 10px; align-items: flex-end; max-width: 82%; }
.bubble-row.is-mine { margin-left: auto; flex-direction: row-reverse; }

.bubble {
  padding: 10px 14px; border-radius: var(--radius-lg);
  background: var(--bg-raised); border: 1px solid var(--border);
  font-size: 0.93rem; line-height: 1.55;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.bubble-row:not(.is-mine) .bubble { border-bottom-left-radius: 5px; }
.is-mine .bubble { background: var(--accent); color: var(--on-accent); border-color: transparent; border-bottom-right-radius: 5px; }
.bubble-time { display: block; font-size: 0.72rem; opacity: .7; margin-top: 4px; }

.composer {
  display: flex; gap: calc(var(--step) * 3); align-items: flex-end;
  padding: calc(var(--step) * 4); background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.composer textarea { min-height: 46px; max-height: 180px; }

.timeline { display: grid; gap: calc(var(--step) * 3); }
.timeline-item {
  display: flex; gap: calc(var(--step) * 4); align-items: flex-start;
  padding: calc(var(--step) * 4); border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-raised);
}
.timeline-item.is-past { opacity: .65; }
.date-block {
  flex: none; width: 54px; text-align: center; padding: 6px 0;
  background: var(--bg-inset); border-radius: var(--radius-sm); line-height: 1.15;
}
.date-block b { display: block; font-size: 1.15rem; }
.date-block span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-subtle); }

/* -------------------------------- pagination --------------------------------- */

.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: calc(var(--step) * 8); }
.pagination a, .pagination span {
  min-width: 38px; padding: 7px 11px; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text-muted); font-size: 0.9rem; background: var(--bg-raised);
}
.pagination a:hover { border-color: var(--border-strong); color: var(--text); }
.pagination [aria-current="page"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 650; }
.pagination .is-gap { border: 0; background: none; min-width: auto; padding: 7px 2px; }

/* ---------------------------------- footer ----------------------------------- */

.footer { border-top: 1px solid var(--border); padding-block: calc(var(--step) * 8); background: var(--bg-sunken); }
.footer .shell { display: flex; gap: calc(var(--step) * 5); justify-content: space-between; flex-wrap: wrap; align-items: center; }
.footer, .footer a { color: var(--text-subtle); font-size: 0.87rem; }
.footer nav { display: flex; gap: calc(var(--step) * 5); flex-wrap: wrap; }

/* --------------------------------- utilities --------------------------------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
.divider { border-top: 1px solid var(--border); margin-block: calc(var(--step) * 5); }
.inline-form { display: inline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .masthead, .footer, .btn, .composer { display: none !important; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- banners ---- */
/* Site-wide notices that sit above the page: guardian consent still needed, or an
   account under restriction. Deliberately not dismissible — both are states the
   person needs to act on, not messages to be cleared away. */
.banner { padding: .7rem 0; font-size: .93rem; border-bottom: 1px solid transparent; }
.banner .shell { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.banner a { color: inherit; font-weight: 600; }
.banner-warn  { background: var(--warn-soft); color: var(--warn);
                border-bottom-color: var(--border); }
.banner-error { background: var(--danger-soft); color: var(--danger);
                border-bottom-color: var(--border); }

.nav-staff { font-weight: 600; }

/* Staff console */
.stat-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.stat { display: flex; flex-direction: column; gap: .15rem; text-decoration: none; }
.stat b { font-size: 1.9rem; line-height: 1.1; }
.stat span { font-size: .85rem; opacity: .75; }

.quote { margin: 0; padding: .6rem .9rem; border-left: 3px solid currentColor;
         opacity: .9; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.msg:last-child { border-bottom: 0; }
.msg p { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-flagged { background: var(--warn-soft); border-radius: .4rem; padding: .6rem .8rem; }

.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-ok   { background: var(--accent-soft);   color: var(--accent-text); }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .45rem .6rem;
                       border-bottom: 1px solid var(--border); }
.nowrap { white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.detail-grid dt { font-weight: 600; opacity: .7; }
.detail-grid dd { margin: 0; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.small { font-size: .85rem; }

/* ------------------------------------------------------- safety actions ---- */
/* Report and block. Quiet by design: prominent enough to find when you need it,
   never so loud that it reads as an accusation waiting to be made. */
.safety-actions {
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
  padding: .8rem 0; margin-top: .5rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
}
.safety-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; opacity: .65; text-decoration: underline;
  text-underline-offset: 2px;
}
.safety-link:hover, .safety-link:focus-visible { opacity: 1; color: var(--danger); }
.safety-blocked { opacity: .65; }

/* Per-message report, revealed on hover or keyboard focus so the thread stays calm. */
.bubble-row { position: relative; }
.bubble-report {
  align-self: center; margin-inline: .4rem;
  font-size: .72rem; opacity: 0; text-decoration: underline; text-underline-offset: 2px;
  transition: opacity .12s ease; white-space: nowrap;
}
.bubble-row:hover .bubble-report,
.bubble-report:focus-visible { opacity: .7; }
.bubble-report:hover { opacity: 1; color: var(--danger); }
/* Touch has no hover, so on coarse pointers it is simply always visible. */
@media (hover: none) { .bubble-report { opacity: .55; } }

.choice-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row-revoked { opacity: .55; }
