/* ==========================================================================
   Relay by Cairn

   The first build grew five stacked override blocks: a base sheet, a palette
   correction, a branding patch, a mobile-nav patch and a depth pass. Several
   rules were declared three times and some targeted elements that no longer
   existed. This sheet is the same design expressed once, in source order:

     1. Tokens          6. Messages
     2. Reset           7. Composer
     3. Primitives      8. Profile sheet
     4. Sign in         9. Responsive
     5. Inbox          10. Motion

   Cairn's palette is the only source of colour. Every value below comes from
   a token, so the palette can be adjusted in one place.
   ========================================================================== */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */

/* Archivo, the Cairn typeface (11/15), so Relay reads like Operations.
   SIL Open Font License 1.1, see archivo-OFL.txt. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/archivo.ttf') format('truetype');
}

:root {
  --overlay-shade: #00000066;
  color-scheme: light;
  --surface: #ffffff;
  --surface-end: #fbfdfb;
  --wash: #edf3ef;
  --wash-end: #f6f7f3;
  --sidebar-end: #f3f7f5;
  --search-start: #f0f5f2;
  --search-end: #f4f7f5;
  --selected-end: #edf4ef;
  --message-end: #f8fbf9;
  --bubble-start: #f4f7f5;
  --bubble-end: #eef3f0;
  --quote: #e8edea;
  --symbol-text: #e3edea;
  --button-green: #1f5048;
  --mine-start: #286056;
  /* Cairn palette */
  --green: #1f5048;
  --green-lift: #2c665b;      /* top of the green gradient on raised controls */
  --green-deep: #19423b;
  --ink: #141f1b;             /* navigation and the conversation backdrop */
  --ink-lift: #22362e;
  --soft: #e3edea;            /* soft green surfaces */
  --pale: #f9fbfa;
  --pale-sunk: #f2f6f4;
  --gold: #8d7324;            /* restrained accent, used sparingly */
  --gold-ink: #6f5b1d;        /* the accent darkened for text on --gold-wash */
  --gold-on-ink: #d5c48b;     /* the same accent, legible on dark navigation */
  --gold-wash: #f8f3e2;

  /* Text and lines */
  --text: #141f1b;
  --text-soft: #35433e;
  --quiet: #5b6b65;           /* 5.1:1 on --pale */
  --on-ink: #ffffff;
  --on-ink-quiet: #b9c7c0;
  --line: #e1e7e3;
  --danger: #a33730;

  /* Type scale. Nothing below 11px, and every input is 16px so that iOS
     does not zoom the page when a field is focused. */
  --t-xs: 11px;
  --t-sm: 13px;
  --t-md: 14px;
  --t-base: 15px;
  --t-lg: 17px;
  --t-xl: 21px;
  --t-display: 29px;

  /* Shape and depth */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --tap: 44px;                /* minimum comfortable touch target */
  --shadow-soft: 0 3px 12px #1f50480d;
  --shadow-card: 0 6px 18px #1f50480b, 0 1px 3px #1f504805;
  --shadow-raised: 0 6px 15px #1f50482a, inset 0 1px #ffffff25;
  --inset-top: env(safe-area-inset-top, 0px);
  --inset-bottom: env(safe-area-inset-bottom, 0px);

  /* Replaced by JavaScript with the visual viewport height so the composer
     stays above the iPhone keyboard. */
  --top-surface: var(--surface);
  --bottom-surface: var(--pale-sunk);
  --app-height: 100dvh;
  /* How far iOS has scrolled the visible area away from the top of the page,
     which it does when the keyboard opens. */
  --app-top: 0px;

  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: var(--t-base);
  color: var(--text);
  background: var(--pale-sunk);
  -webkit-text-size-adjust: 100%;
}


:root[data-theme="green"] {
  color-scheme: dark;
  --surface: #203129;
  --surface-end: #1e3027;
  --pale: #15231d;
  --pale-sunk: #192920;
  --wash: #17271f;
  --wash-end: #1b2d23;
  --sidebar-end: #192b22;
  --search-start: #283d31;
  --search-end: #283d31;
  --selected-end: #304a3c;
  --message-end: #1c2e24;
  --bubble-start: #2b4034;
  --bubble-end: #293c32;
  --quote: #354c3e;
  --symbol-text: #c7e2d6;
  --soft: #30483b;
  --ink: #0f1914;
  --ink-lift: #182b21;
  --green: #a0d2bf;
  --text: #e5eee9;
  --text-soft: #cadbd1;
  --quiet: #a3b7aa;
  --line: #3a5144;
  --gold: #d5c48b;
  --gold-ink: #e1d19c;
  --gold-wash: #393323;
  --danger: #ffaaa2;
  --shadow-soft: 0 3px 12px #00000020;
  --shadow-card: 0 6px 18px #00000024;
}

/* Charcoal surfaces keep the Cairn green and gold as accents. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #24272d;
  --surface-end: #22252b;
  --pale: #191c21;
  --pale-sunk: #202329;
  --wash: #14171b;
  --wash-end: #1d2026;
  --sidebar-end: #1c1f25;
  --search-start: #2d323a;
  --search-end: #292e36;
  --selected-end: #293b38;
  --message-end: #20242b;
  --bubble-start: #343943;
  --bubble-end: #2e333c;
  --quote: #404752;
  --symbol-text: #c7e2d6;
  --soft: #2f443f;
  --ink: #111318;
  --ink-lift: #242832;
  --green: #a0d2bf;
  --text: #edf0f5;
  --text-soft: #d3d8e1;
  --quiet: #adb6c5;
  --line: #3b424d;
  --gold: #d5c48b;
  --gold-ink: #e1d19c;
  --gold-wash: #393323;
  --danger: #ffaaa2;
  --shadow-soft: 0 3px 12px #00000020;
  --shadow-card: 0 6px 18px #00000024;
}

/* ── 2. Reset ──────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  background: var(--pale-sunk);
  overscroll-behavior: none;
}

/* The surface behind the app follows whatever is on screen, so the status bar
   and home indicator areas never show a strip of a different colour. */
html, body, html.in-conversation, html.in-conversation body { background: var(--bottom-surface); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.icon-source { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

/* ── 3. Primitives ─────────────────────────────────────────────────────── */

button, input, textarea { font: inherit; color: inherit; }

/* iOS paints a grey box on tap and waits for a possible double-tap zoom.
   Neither belongs on a control that already has its own pressed state. */
button, .room-row, a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.app-rail, .mobile-nav, .tabs { -webkit-touch-callout: none; user-select: none; }
.bubble, .message-body { user-select: text; -webkit-user-select: text; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
}

button:disabled { opacity: .45; cursor: default; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.app-rail :focus-visible,
.mobile-nav :focus-visible,
.chat-head :focus-visible { outline-color: var(--gold-on-ink); }

.primary {
  background: linear-gradient(145deg, var(--green-lift), var(--button-green));
  color: var(--on-ink);
  font-weight: 600;
  padding: 12px 20px;
  box-shadow: 0 3px 9px #1f504817, inset 0 1px #ffffff1f;
}
.primary:hover:not(:disabled) { background: linear-gradient(145deg, #317166, var(--green-lift)); }
.wide { width: 100%; }

.quiet-link { color: var(--quiet); font-size: var(--t-sm); margin-top: 18px; }
.danger-link { color: var(--danger); font-size: var(--t-md); padding: 8px 12px; }

.field { display: block; margin: 0 0 18px; }
.field label { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--text-soft); }
.field input {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--pale);
  box-shadow: inset 0 1px 3px #1f50480a;
}
.field input:focus { background: var(--surface); }
.field-hint { display: block; margin-top: 7px; font-size: var(--t-xs); color: var(--quiet); }

.form-error:not(:empty) {
  margin-top: 14px;
  font-size: var(--t-sm);
  line-height: 1.5;
  color: var(--danger);
}
.form-note { margin-top: 14px; font-size: var(--t-sm); color: var(--green); }

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  font-size: var(--t-sm);
  font-weight: 650;
  letter-spacing: .2px;
}
.avatar-button {
  padding: 0;
  min-width: 0;
  box-shadow: 0 3px 10px #1f50480d, 0 0 0 1px var(--line);
}
/* Phone-only layout trial pieces; shown in the narrow layout below. */
.top-search, .top-new, #nav-avatar { display: none; }
.view-announcements .top-search { display: none !important; }

/* Brand lockup: Relay leads, the Cairn signature sits beside it at a
   noticeably smaller size. */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  display: grid;
  place-items: center;
  width: 43px; height: 43px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, var(--green-lift), var(--button-green));
  box-shadow: inset 0 1px #ffffff20, 0 3px 10px #1f504818;
}
.mark svg { width: 26px; height: 26px; fill: none; stroke: var(--on-ink); stroke-width: 4.5;
            stroke-linecap: round; stroke-linejoin: round; }
.brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-name {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -1px;
  text-shadow: 0 1px 0 var(--surface);
}
.brand-dot { color: var(--gold); }
.brand-byline { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.by-label { font-size: 10px; color: var(--quiet); }
.cairn-signature {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: -.3px;
  color: var(--green);
}
.cairn-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5px;
  width: 10px; height: 10px;
}
.cairn-mark i { display: block; height: 1.8px; background: var(--green); border-radius: 1px; }
.cairn-mark i:nth-child(1) { width: 4px; background: var(--gold); }
.cairn-mark i:nth-child(2) { width: 7px; }
.cairn-mark i:nth-child(3) { width: 10px; }
.cairn-dot { color: var(--gold); }
/* The Cairn stones logo (10/22): the three stones of Operations' "Main Logo
   (App).png" (also kept as static/cairn-logo.png) without its green tile, so
   the lower stones can follow the theme like the text beside them. */
.cairn-logo { display: block; flex-shrink: 0; width: 12px; height: 12px; fill: var(--green); }
.cairn-logo .cairn-stone-top { fill: var(--gold); }
:root:is([data-theme="dark"], [data-theme="green"]) .cairn-logo { fill: #ffffff; }
/* "by Cairn" is white on the dark themes (10/21); Light keeps its colours. */
:root:is([data-theme="dark"], [data-theme="green"]) .cairn-signature { color: #ffffff; }
:root:is([data-theme="dark"], [data-theme="green"]) .cairn-mark i:not(:nth-child(1)) { background: #ffffff; }

/* ── 4. Sign in ────────────────────────────────────────────────────────── */

.auth {
  min-height: var(--app-height);
  display: grid;
  place-items: center;
  padding: 24px max(20px, env(safe-area-inset-left)) calc(24px + var(--inset-bottom));
  background: radial-gradient(ellipse at top right, var(--soft), transparent 62%), var(--pale);
}
.auth-card {
  width: 100%;
  max-width: 412px;
  padding: 34px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: 0 15px 60px #1f504814;
}
.auth h1 { margin-top: 30px; font-size: 26px; letter-spacing: -.7px; }
/* The testing shortcut is deliberately conspicuous: it is the one setting that
   must not be left on by accident. */
.test-note {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--gold-wash);
  border: 1px solid #e4d9b4;
  color: var(--gold-ink);
  font-size: var(--t-sm);
  line-height: 1.5;
}
.test-badge {
  padding: 5px 9px;
  border-radius: 20px;
  background: var(--gold-wash);
  color: var(--gold-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}

#auth-copy { margin-top: 10px; font-size: var(--t-sm); line-height: 1.65; color: var(--quiet); }
#auth-form { margin-top: 26px; }
#auth-submit { margin-top: 4px; }

/* ── 5. App shell and inbox ────────────────────────────────────────────── */

.app {
  display: flex;
  height: var(--app-height);
  min-height: 0;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--wash), var(--wash-end));
}

.app-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 82px;
  flex-shrink: 0;
  padding: 24px 10px;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  background: var(--ink);
  color: var(--on-ink-quiet);
  box-shadow: inset 1px 0 #ffffff12, 5px 0 16px #141f1b0f;
}
.app-rail .mark { margin-bottom: 6px; }
.rail-item {
  flex-direction: column;
  gap: 5px;
  width: 62px;
  padding: 9px 0;
  color: inherit;
}
.rail-item small { font-size: var(--t-xs); }
.rail-item:hover { background: #ffffff0d; }
.rail-item.is-active { background: #ffffff12; color: var(--gold-on-ink); }
.rail-spacer { flex: 1; }
.rail-label {
  font-size: 10px;
  letter-spacing: 2px;
  writing-mode: vertical-rl;
  color: #8fa39a;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 350px;
  flex-shrink: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, var(--surface) 0%, var(--pale) 38%, var(--sidebar-end) 100%);
  box-shadow: 0 8px 28px #1f50480b;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 22px 16px;
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0 12px;
  min-height: var(--tap);
  border-radius: var(--r-md);
  background: linear-gradient(var(--search-start), var(--search-end));
  box-shadow: inset 0 1px 3px #1f50480f, 0 1px 0 var(--surface);
  color: var(--quiet);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  -webkit-appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: none; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--green); }
.search-clear {
  position: relative;
  min-height: 34px;
  min-width: 34px;
  padding: 0;
  color: var(--quiet);
}
.search-clear .icon { width: 17px; height: 17px; }

.inbox-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 22px 24px 12px;
}
.inbox-heading h2 { font-size: var(--t-display); font-weight: 750; letter-spacing: -1px; }
.inbox-heading h2 { flex: 1; }
#search-toggle { width: var(--tap); height: var(--tap); padding: 0; flex-shrink: 0; color: var(--text-soft); }
#search-toggle:hover { background: var(--soft); }
.inbox-heading .search { flex: 1; min-width: 0; min-height: var(--tap); }
.inbox-heading.is-searching #inbox-title { flex: 0 0 auto; white-space: nowrap; }
.inbox-heading.is-searching .search > .icon { display: none; }
.inbox-heading.is-searching .search { gap: 0; padding-right: 4px; }
.inbox-heading.is-searching #search-toggle,
.inbox-heading.is-searching #new-message { display: none; }
.inbox-heading .search-clear { width: var(--tap); min-width: var(--tap); min-height: var(--tap); }
.inbox-heading .search-clear::before { inset: 0; }

#new-message {
  width: var(--tap); height: var(--tap);
  padding: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
}
#new-message:hover { background: #d7e6e0; }

.tabs {
  display: flex;
  gap: 2px;
  margin: 0 20px 12px;
  padding: 4px;
  border-radius: var(--r-lg);
  background: var(--pale-sunk);
  box-shadow: inset 0 1px 3px #1f50480d, 0 1px 0 var(--surface);
}
.tabs button {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 6px 4px;
  border-radius: var(--r-md);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--quiet);
  white-space: nowrap;
}
.tabs .is-active {
  background: var(--surface);
  color: var(--green);
  box-shadow: 0 3px 9px #1f504814;
}
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--button-green);
  color: var(--on-ink);
  font-size: var(--t-xs);
  font-weight: 650;
}
.tabs .is-active .tab-count { background: var(--button-green); }

.room-list { flex: 1; overflow: auto; padding-bottom: 12px; scrollbar-width: thin; }
.section-label {
  padding: 18px 25px 8px;
  font-size: var(--t-xs);
  font-weight: 650;
  letter-spacing: 1.1px;
  color: var(--quiet);
}

.room-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: calc(100% - 20px);
  margin: 3px 10px;
  padding: 14px;
  min-height: 84px;
  text-align: left;
  border-radius: var(--r-md);
  justify-content: flex-start;
}
.room-row:hover { background: var(--pale-sunk); box-shadow: var(--shadow-soft); }
.room-row.is-selected {
  background: linear-gradient(120deg, var(--soft), var(--selected-end));
  box-shadow: inset 0 0 0 1px #d6e5dc, 0 4px 12px #1f50480d;
}
.room-row .symbol {
  display: grid;
  place-items: center;
  width: 47px; height: 47px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  box-shadow: inset 0 1px 0 #ffffffb0, 0 3px 8px #1f50480d;
}
.room-row .symbol .icon { width: 21px; height: 21px; }
.room-row .symbol.is-initials { font-size: var(--t-sm); font-weight: 650; }

.room-copy { flex: 1; min-width: 0; }
.room-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.room-top strong { font-size: var(--t-md); font-weight: 650; letter-spacing: -.2px; }
.room-top time { flex-shrink: 0; font-size: var(--t-xs); color: var(--quiet); }
.snippet {
  display: block;
  margin-top: 5px;
  font-size: var(--t-sm);
  line-height: 1.45;
  color: var(--quiet);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.has-unread .room-top strong { font-weight: 700; }
.has-unread .snippet { padding-right: 26px; color: var(--text-soft); }
.unread {
  position: absolute;
  right: 14px; bottom: 16px;
  display: grid;
  place-items: center;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--button-green);
  color: var(--on-ink);
  font-size: var(--t-xs);
  font-weight: 650;
  box-shadow: 0 2px 5px #1f50481f;
}

.person-row .person-arrow { color: var(--quiet); }
.person-row .person-arrow .icon { width: 18px; height: 18px; }

.inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 44px 26px;
  text-align: center;
}
.empty-symbol {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  background: var(--soft);
  color: var(--green);
}
.empty-symbol .icon { width: 26px; height: 26px; }
.inbox-empty strong { font-size: var(--t-base); }
.inbox-empty span { font-size: var(--t-sm); color: var(--quiet); }

.start-conversation {
  margin: 18px 22px 24px;
  justify-content: flex-start;
  color: var(--green);
  font-size: var(--t-sm);
  font-weight: 600;
}

/* Group cards: the layered, colourful card layout from the second reference,
   in Cairn's palette. */
.group-overview {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0 2px;
  padding: 21px;
  border-radius: var(--r-md);
  background: linear-gradient(120deg, var(--soft), var(--gold-wash));
  /* No light line along the top edge (owner, 10/22). */
  box-shadow: 0 5px 18px #1f50480d;
}
.overview-label { font-size: var(--t-xs); letter-spacing: 1.4px; color: var(--quiet); }
.group-overview strong { font-size: 19px; letter-spacing: -.4px; }

.view-groups .room-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 11px;
  padding: 0 18px 20px;
}
.view-groups .room-list > .section-label,
.view-groups .room-list > .group-overview,
.view-groups .room-list > .inbox-empty { grid-column: 1 / -1; }
.view-groups .room-list > .section-label { padding: 6px 3px 2px; }

/* Scoped to the groups view so it outranks the plain .room-row width and
   margin, including the narrower ones set in the phone breakpoint below. */
.view-groups .group-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  margin: 0;
  min-height: 172px;
  padding: 17px 15px;
  /* 10/22: a faint tint of the theme green instead of the near-white line. */
  border: 1px solid var(--line);
  border-color: color-mix(in srgb, var(--green) 16%, transparent);
  border-radius: var(--r-md);
  background: linear-gradient(150deg, var(--surface), var(--surface-end));
  box-shadow: var(--shadow-card);
}
.group-card .symbol { width: 43px; height: 43px; }
.group-card:nth-of-type(odd) .symbol { background: var(--gold-wash); color: var(--gold); }
.group-card .room-copy { width: 100%; flex: 0; }
.group-card .room-top time { display: none; }
.group-card.is-selected { border-color: color-mix(in srgb, var(--green) 40%, transparent); box-shadow: 0 7px 20px #1f504814; }
.group-card .unread { top: 15px; bottom: auto; }

.card-members {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin-top: auto;
  font-size: var(--t-xs);
  color: var(--quiet);
}
.card-faces { display: flex; padding-left: 4px; }
.mini-avatar {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  margin-left: -4px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}
.mini-avatar:nth-child(2) { background: var(--gold-wash); color: var(--gold-ink); }
.mini-avatar:nth-child(3) { background: #dce6ef; color: #4a637a; }

/* ── 6. Conversation and messages ──────────────────────────────────────── */

.conversation {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  background: linear-gradient(125deg, var(--ink), var(--ink-lift));
  box-shadow: 6px 8px 28px #1f50480f;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 24px 28px 32px;
  min-height: 108px;
  color: var(--on-ink);
  background: transparent;
  box-shadow: none;
}
.chat-head-copy { min-width: 0; flex: 1; }
.chat-head h1 {
  font-size: var(--t-lg);
  font-weight: 650;
  letter-spacing: -.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head small { display: block; margin-top: 4px; font-size: var(--t-xs); color: #b4c8bf; }
/* Online (10/28): a small green dot before the word, one-to-one chats only. */
.chat-head small.is-online::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #5fd39a; vertical-align: 1px; }
.head-button { color: var(--on-ink); padding: 0; }
.head-button:hover:not(:disabled) { background: #ffffff14; }
#back { display: none; }
.room-symbol {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #29433b;
  color: var(--symbol-text);
  font-size: var(--t-sm);
  font-weight: 650;
  box-shadow: inset 0 1px #ffffff1c, 0 3px 9px #00000014;
}
.room-symbol .icon { width: 21px; height: 21px; }

.messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 32px 14px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: linear-gradient(155deg, var(--surface) 0%, var(--surface) 60%, var(--message-end) 100%);
  box-shadow: none;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.messages:focus-visible { outline-offset: -3px; }

.load-older { margin: 0 auto 18px; display: flex; color: var(--green); font-size: var(--t-sm); }
.load-older .icon { width: 17px; height: 17px; }

.date-divider {
  width: fit-content;
  margin: 2px auto 22px;
  padding: 8px 16px;
  min-height: 0;
  border-radius: var(--r-lg);
  background: var(--pale-sunk);
  box-shadow: none;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--quiet);
}

/* 10/22: messages run edge to edge of the chat on wide windows too (they were
   capped at 780px and centred, which read as a phone layout on the desktop). */
/* 10/27 (owner's chat reference video): 18px between speakers, 4px inside a
   run (see .is-continuation), so a run reads as one turn. */
.message { display: flex; gap: 10px; margin: 0 0 18px; }
.message .avatar {
  width: 30px; height: 30px;
  align-self: flex-end;
  font-size: 10px;
  background: var(--soft);
  color: var(--green);
}
.message-content { min-width: 0; max-width: 72%; }
.message-name {
  margin: 0 0 5px 8px;
  font-size: var(--t-xs);
  font-weight: 650;
  color: var(--quiet);
}

/* Runs of messages from the same person in the same minute collapse into one
   visual group, so a quick back-and-forth does not repeat the avatar and name
   on every line. */
.message.is-continuation { margin-top: -14px; }
/* Read receipt under your newest message in a one-to-one chat (10/27). */
.message-receipt { margin: 4px 6px 0 0; text-align: right; font-size: var(--t-xs); font-weight: 600; color: var(--quiet); }
.message-receipt.is-read { color: var(--green); }
@media (prefers-reduced-motion: no-preference) {
  .message-receipt { animation: fade-in .2s ease-out; }
}
/* Typing dots (10/28): one-to-one chats only, a small bubble on their side. */
.typing-dots { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 18px 40px; padding: 12px 14px; border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 6px; background: linear-gradient(150deg, var(--bubble-start), var(--bubble-end)); }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--quiet); opacity: .5; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: no-preference) {
  .typing-dots { animation: message-in .24s ease-out both; }
  .typing-dots i { animation: typing-dot 1.2s ease-in-out infinite; }
  .typing-dots i:nth-child(2) { animation-delay: .15s; }
  .typing-dots i:nth-child(3) { animation-delay: .3s; }
}
/* One-to-one chats: the side says who, so their name is not repeated. */
.message.is-direct .message-name { display: none; }
/* The photo sits beside the newest message of a run (see markRuns). */
.message.is-followed .avatar { visibility: hidden; }
.message.is-continuation .message-name { display: none; }

.bubble {
  padding: 14px 17px;
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 6px;
  background: linear-gradient(150deg, var(--bubble-start), var(--bubble-end));
  box-shadow: 0 3px 8px #1f50480d, inset 0 1px #ffffffb0;
  color: var(--text-soft);
  font-size: var(--t-md);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.is-continuation .bubble { border-top-left-radius: 10px; }

.message.is-mine { flex-direction: row-reverse; }
.message.is-mine .avatar { display: none; }
.message.is-mine .message-name { display: none; }
.message.is-mine .bubble {
  border-radius: var(--r-lg) var(--r-lg) 6px var(--r-lg);
  background: linear-gradient(140deg, var(--mine-start), var(--button-green));
  box-shadow: 0 4px 10px #1f50481a, inset 0 1px #ffffff1a;
  color: var(--on-ink);
}
.message.is-mine.is-continuation .bubble { border-top-right-radius: 10px; }
.message.is-pending .bubble { opacity: .6; }

.message-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  padding: 0 4px;
  font-size: var(--t-xs);
  color: var(--quiet);
}
.message-foot time { white-space: nowrap; }
.message-foot .icon { width: 13px; height: 13px; stroke-width: 2.4; }

/* Reversing the row puts the time against the right edge for your own
   messages, mirroring the bubble above it. */
.is-mine .message-foot { flex-direction: row-reverse; }
/* Extend the compact search close control to a full touch target. */
.search-clear::before { content: ''; position: absolute; inset: -5px; }

.reply-quote {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 0 9px;
  padding: 8px 11px;
  border-left: 2px solid #bfd4ce;
  border-radius: 0 8px 8px 0;
  background: var(--quote);
  font-size: var(--t-xs);
  white-space: normal;
}
.reply-quote strong { font-size: var(--t-xs); color: var(--text-soft); }
.reply-quote span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--quiet);
}
.is-mine .reply-quote { background: #ffffff1f; border-color: #b8cfc6; }
.is-mine .reply-quote strong,
.is-mine .reply-quote span { color: #d7e5df; }

.conversation-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 11vh auto 0;
  padding: 20px;
  text-align: center;
}
.welcome-icon {
  display: grid;
  place-items: center;
  width: 70px; height: 70px;
  margin-bottom: 14px;
  border-radius: var(--r-lg);
  background: var(--soft);
  color: var(--green);
}
.welcome-icon .icon { width: 32px; height: 32px; }
.conversation-welcome h2 { font-size: var(--t-xl); letter-spacing: -.4px; }
.conversation-welcome p { font-size: var(--t-sm); color: var(--quiet); }

/* ── 7. Composer ───────────────────────────────────────────────────────── */

.reply-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 26px;
  background: var(--pale-sunk);
  color: var(--green);
}
.reply-banner-copy { flex: 1; min-width: 0; }
.reply-banner small {
  display: block;
  font-size: var(--t-xs);
  font-weight: 650;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.reply-banner span {
  display: block;
  margin-top: 3px;
  font-size: var(--t-sm);
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#cancel-reply { color: var(--quiet); padding: 0; }

.compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 26px;
  padding-bottom: max(20px, var(--inset-bottom));
  background: linear-gradient(var(--surface), var(--surface-end));
}
.compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  max-height: 160px;
  padding: 14px 18px;
  resize: none;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--pale-sunk);
  box-shadow: inset 0 1px 3px #1f50480f, 0 1px 0 var(--surface);
  font-size: 16px;
  line-height: 1.45;
  overflow-y: auto;
}
.send {
  width: 50px; height: 50px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 5px 12px #1f504826, inset 0 1px #ffffff20;
}
.send .icon { width: 23px; height: 23px; stroke-width: 2.2; }

.connection { background: var(--surface); text-align: center; font-size: var(--t-sm); color: var(--danger); }
.connection:not(:empty) { padding: 9px; }
.server-stale { margin: 0; padding: 9px 16px; background: var(--surface); text-align: center; font-size: var(--t-sm); font-weight: 600; color: var(--danger); }
.server-stale[hidden] { display: none; }

/* ── 8. Details and profile sheet ──────────────────────────────────────── */

.detail-pane {
  width: 284px;
  flex-shrink: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  background: var(--surface);
  box-shadow: -8px 0 30px #1f50480f;
}
/* No title or bar (10/21): a back chevron at the top left and the Pin
   button beside it, floating over the page. */
.detail-pane header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 0;
}
#close-details, .detail-pin { display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border-radius: 50%; color: var(--text); }
#close-details:active, .detail-pin:active { background: var(--soft); }
.detail-pin { border: 1px solid var(--line); background: var(--surface); color: var(--quiet); }
.detail-pin .icon { width: 19px; height: 19px; }
.detail-pin[aria-pressed="true"] { border-color: var(--green); background: var(--soft); color: var(--green); }
/* 10/22: Pin in the top right corner, Delete chat the same kind of button to its left. */
.detail-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.detail-delete { color: var(--danger); }
.detail-delete.is-tidy { color: var(--text); }   /* a group: removes it from your list only */
.detail-delete[hidden] { display: none; }
#detail-content .delete-error:empty { display: none; }
/* Details panel: photos, documents and links sent in the chat (10/22). */
.shared { margin-top: 6px; padding: 0 0 12px; }
.shared-tabs { display: flex; gap: 6px; padding: 0 20px 10px; }
.shared-tabs button { flex: 1; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text-soft); font-size: var(--t-sm); font-weight: 600; }
.shared-tabs button[aria-pressed="true"] { border-color: var(--green); background: var(--soft); color: var(--green); }
.shared-body { padding: 0 20px; }
.shared-empty { margin: 6px 0; color: var(--quiet); font-size: var(--t-sm); text-align: center; }
.shared-media { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.shared-photo { aspect-ratio: 1; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--pale-sunk); }
.shared-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shared-list { display: flex; flex-direction: column; }
.shared-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; color: var(--text); text-decoration: none; }
.shared-row > .icon { flex-shrink: 0; width: 20px; height: 20px; color: var(--green); }
.shared-row-copy { display: flex; flex-direction: column; min-width: 0; }
.shared-row-copy strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--t-sm); font-weight: 600; }
.shared-row-copy small { color: var(--quiet); font-size: var(--t-xs); }
.detail-hero { padding: 26px 20px 18px; text-align: center; }
.detail-icon {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--green);
  font-size: var(--t-lg);
  font-weight: 650;
}
.detail-icon .icon { width: 28px; height: 28px; }
.detail-hero h2 { font-size: var(--t-xl); margin-bottom: 6px; letter-spacing: -.3px; }
.detail-hero p { font-size: var(--t-sm); color: var(--quiet); }
/* Photo and name together: one tap opens Change name / Change photo. */
.detail-identity { display: flex; flex-direction: column; align-items: center; width: 100%; min-height: 0; padding: 4px 0 0; border-radius: var(--r-md); background: none; color: inherit; }
.detail-identity .detail-icon { position: relative; overflow: visible; }
/* A group with a photo clipped its edit badge (the photo rule hides overflow);
   round the photo itself instead so the badge sits on top (10/21). */
.detail-identity .detail-icon.has-photo { overflow: visible; }
.detail-identity .detail-icon.has-photo img { border-radius: 50%; }
.detail-edit-badge { z-index: 1; }
/* Text in the details panel keeps the same side margins as everything else. */
#detail-content > p, #detail-content .group-actions, #detail-content .detail-note,
#detail-content .group-adder, #detail-content .group-exits { margin-left: 20px; margin-right: 20px; }
.detail-edit-badge { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); color: var(--on-ink); }
.detail-edit-badge .icon { width: 12px !important; height: 12px !important; color: var(--on-ink) !important; }
.detail-identity:active .detail-icon { transform: scale(.97); }
.detail-member {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 22px;
  font-size: var(--t-sm);
}
.detail-member .avatar { width: 34px; height: 34px; font-size: 11px; }
.detail-member span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.sheet {
  width: min(430px, calc(100% - 32px));
  padding: 26px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 24px 80px #141f1b33;
}
.sheet::backdrop { background: #141f1b66; }
.sheet-title {
  margin-bottom: 20px;
  font-size: var(--t-sm);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--quiet);
}
.profile-head { display: flex; align-items: center; gap: 14px; }
#profile-avatar { width: 54px; height: 54px; font-size: var(--t-base); }
.profile-identity { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.profile-identity strong { font-size: var(--t-lg); letter-spacing: -.3px; }
.profile-identity span { font-size: var(--t-sm); color: var(--quiet); overflow-wrap: anywhere; }
.profile-role { font-weight: 600; color: var(--green) !important; }

.profile-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.row-button {
  width: 100%;
  justify-content: flex-start;
  gap: 11px;
  padding: 10px 8px;
  border-radius: var(--r-sm);
  font-size: var(--t-md);
  color: var(--text-soft);
}
.row-button:hover { background: var(--pale-sunk); }
.row-button .icon { color: var(--green); }
.password-form { margin-top: 16px; }

.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.sheet-actions { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ── 9. Responsive ─────────────────────────────────────────────────────── */

.mobile-nav { display: none; }

@media (max-width: 1100px) {
  .sidebar { width: 316px; }
  .messages { padding: 22px; }
  .message-content { max-width: 82%; }
  .detail-pane {
    position: absolute;
    z-index: 5;
    top: 18px; right: 18px; bottom: 18px;
    width: 300px;
    border-radius: var(--r-lg);
    box-shadow: -15px 0 44px #1f504826;
  }
}

@media (max-width: 700px) {
  /* iOS does not shrink the page for the keyboard; it scrolls the visible area
     instead, which dragged the whole app upward and took the composer with it.
     Pinning the app to the visible area keeps the header and composer where
     they are and lets the message list take the change, which is how a native
     app behaves. */
  .app {
    position: fixed;
    top: var(--app-top);
    left: 0;
    right: 0;
    padding: 0;
    background: var(--surface);
  }
  .app-rail { display: none; }

  .sidebar {
    width: 100%;
    border: 0;
    box-shadow: none;
  }
  .sidebar-head { padding: 16px 22px 10px; padding-top: calc(16px + var(--inset-top)); }
  .brand-name { font-size: 23px; }
  .search { margin: 0; }
  .inbox-heading { padding: 20px 24px 16px; }
  .inbox-heading h2 { font-size: 34px; letter-spacing: -1.3px; }
  .inbox-heading #new-message { display: none; }
  .tabs { margin: 0 22px 12px; }
  .tabs button { min-height: var(--tap); }
  .room-row { width: calc(100% - 24px); margin: 3px 12px; min-height: 88px; }
  .room-row .symbol { width: 50px; height: 50px; }

  .view-groups .room-list { padding: 0 20px 20px; gap: 12px; }

  /* Five equal columns keep the plus button on the exact centre line and stop
     the last item from being pushed past the right edge. */
  /* Anchored to the bottom edge rather than floating, so the home indicator
     sits on the bar itself instead of on a strip of background below it. */
  .mobile-nav {
    position: relative;
    z-index: 2;
    order: 2;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    padding: 10px 8px;
    padding-bottom: calc(10px + var(--inset-bottom));
    min-height: 72px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    /* The entire bottom edge ends at ink, matching the home-indicator area. */
    background: linear-gradient(180deg, var(--ink-lift), var(--ink));
    box-shadow: 0 -4px 20px #141f1b1f, inset 0 1px #ffffff17;
  }
  .mobile-nav button {
    flex-direction: column;
    gap: 3px;
    width: 100%;
    min-width: 0;
    padding: 0;
    color: var(--on-ink-quiet);
  }
  .mobile-nav button span { font-size: 10px; font-weight: 600; }
  .mobile-nav button.is-active { color: var(--gold-on-ink); }
  /* Layout trial 10/21 (undo with tag relay-pre-profile-swap): on the phone,
     search takes the profile photo's place at the top right, and the photo
     takes the Settings icon's place in the tab bar, as in Instagram. */
  #account { display: none; }
  .top-search { display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; flex-shrink: 0; margin-left: auto; border-radius: 50%; color: var(--text-soft); }
  .top-search:active { background: var(--soft); }
  #search-toggle { display: none; }
  #mobile-account > .icon { display: none; }
  .mobile-nav #nav-avatar { display: grid; place-items: center; width: 26px; height: 26px; overflow: hidden; border-radius: 50%; font-size: 9px; font-weight: 650; background: var(--soft); color: var(--green); box-shadow: 0 0 0 1.5px var(--on-ink-quiet); transition: transform .13s cubic-bezier(.3, .8, .4, 1); }
  .mobile-nav #nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .mobile-nav #mobile-account.is-active #nav-avatar { box-shadow: 0 0 0 2px var(--gold-on-ink); }
  .mobile-nav #mobile-account:active #nav-avatar { transform: scale(.88); }
  /* Round 3 (10/21): the tab-bar photo is the same size as the tab icons, so
     it and its label sit level with the other tabs. */
  .mobile-nav #nav-avatar { width: 22px; height: 22px; font-size: 8px; }

  /* Round 3: no "Chats" or "Groups" title on the phone; the heading row
     only appears while searching, and then sits on the top bar's line in
     place of the brand and the search button. */
  .app:not(.view-community):not(.view-assistant):not(.view-announcements):not(.view-team) #inbox-title { display: none; }
  .app:not(.view-community):not(.view-assistant):not(.view-announcements):not(.view-team) .inbox-heading:not(.is-searching) { display: none; }
  .sidebar { position: relative; }

  /* Round 3: in a chat the strip under the status bar (painted --ink by
     paintSurfaces) and the info bar below it are one colour. The diagonal
     gradient made the bar lighter than the strip; now the top band is solid
     --ink and the gradient starts below it. */
  .app .conversation { background: linear-gradient(180deg, var(--ink) 0, var(--ink) calc(120px + var(--inset-top)), var(--ink-lift) 100%); }
  .inbox-heading.is-searching {
    position: absolute;
    z-index: 3;
    top: calc(16px + var(--inset-top));
    left: 16px;
    right: 16px;
    height: var(--tap);
    padding: 0;
  }
  .sidebar:has(.inbox-heading.is-searching) .sidebar-head > * { visibility: hidden; }

  .mobile-nav .mobile-new {
    width: 58px; height: 58px;
    min-width: 0;
    margin-top: -36px;
    justify-self: center;
    border-radius: 50%;
    border: 5px solid var(--soft);
    background: linear-gradient(145deg, var(--green-lift), var(--button-green));
    color: var(--on-ink);
    box-shadow: var(--shadow-raised);
  }
  .mobile-nav .mobile-new .icon { width: 24px; height: 24px; stroke-width: 2.4; }

  /* The conversation sits on top of the inbox and slides in, instead of the
     two swapping instantly. The inbox eases back slightly behind it, which is
     what makes the movement read as going somewhere rather than redrawing. */
  /* .app is already position:fixed above, which is the containing block the
     sliding conversation is positioned against. */
  .conversation {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    border-radius: 0;
    box-shadow: none;
    transform: translate3d(100%, 0, 0);
  }
  .app.chat-open .conversation { transform: translate3d(0, 0, 0); }
  .app.chat-open .sidebar { transform: translate3d(-16%, 0, 0); }
  .sidebar { transform: translate3d(0, 0, 0); }

  .chat-head {
    gap: 8px;
    padding: 14px 12px 26px;
    padding-top: calc(14px + var(--inset-top));
    min-height: 0;
  }
  #back { display: inline-flex; }
  .chat-head h1 { font-size: var(--t-lg); }
  .room-symbol { width: 38px; height: 38px; }
  .room-symbol .icon { width: 19px; height: 19px; }

  .messages { padding: 20px 16px 10px; border-radius: 28px 28px 0 0; }
  .message { gap: 8px; margin-bottom: 18px; }
  .message .avatar { width: 26px; height: 26px; font-size: 9px; }
  .message-content { max-width: 84%; }
  .conversation-welcome { margin-top: 9vh; }

  .reply-banner { padding: 10px 16px; }
  .compose { padding: 12px 16px; padding-bottom: max(14px, var(--inset-bottom)); gap: 8px; }

  .detail-pane { inset: 0; width: 100%; z-index: 20; border-radius: 0; box-shadow: none; padding-bottom: var(--inset-bottom); }
  .detail-pane header { padding-top: calc(18px + var(--inset-top)); }
  /* A panel anchored to the bottom edge is easier to reach one-handed than a
     box floating in the middle of the screen. */
  .sheet {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 22px 20px calc(22px + var(--inset-bottom));
    position: fixed;
    inset: auto 0 0 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .sheet::before {
    content: '';
    display: block;
    width: 38px;
    height: 4px;
    margin: -6px auto 16px;
    border-radius: 2px;
    background: var(--line);
  }
  @media (prefers-reduced-motion: no-preference) {
    .sheet[open] { animation: sheet-up .3s cubic-bezier(.32, .72, 0, 1); }
  }
}

@media (max-width: 360px) {
  .inbox-heading h2 { font-size: 30px; }
  .view-groups .room-list { grid-template-columns: 1fr; }
  .tabs button { padding: 6px 2px; letter-spacing: -.2px; }
  .mobile-nav { padding-left: 4px; padding-right: 4px; }
}

/* Mac Safari in the Dock and iPhone on the Home Screen both run standalone;
   there is no browser chrome to absorb the safe areas. */
@media (display-mode: standalone) {
  .sidebar-head { padding-top: calc(16px + var(--inset-top)); }
}

/* ── 10. Motion ────────────────────────────────────────────────────────── */

/* Touch screens have no hover, so pressing is the only feedback there is. A
   small, fast scale is what makes a control feel like it was physically
   pressed rather than merely recoloured. */
.room-row:active { background: var(--soft); transform: scale(.985); }
.group-card:active { transform: scale(.97); }
.mobile-nav button:active, .rail-item:active { background: #ffffff1a; }
.mobile-nav button:active .icon { transform: scale(.88); }
.primary:active, .send:active, .mobile-new:active { transform: scale(.94); }
.row-button:active, .message-actions:active { background: var(--soft); }
.tabs button:active { color: var(--green); }
.avatar-button:active { transform: scale(.92); }

/* A sent or received message arrives rather than appearing. */
@keyframes message-in {
  from { opacity: 0; transform: translateY(7px) scale(.985); }
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
}
@keyframes fade-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .room-row, .group-card, .tabs button, .primary, .rail-item, .row-button,
  .avatar-button, .send, .mobile-new, .message-actions {
    transition: background .15s ease, box-shadow .15s ease, color .15s ease,
                transform .13s cubic-bezier(.3, .8, .4, 1);
  }
  .mobile-nav button .icon { transition: transform .13s cubic-bezier(.3, .8, .4, 1); }
  .group-card:hover { box-shadow: 0 9px 25px #1f504817; }

  /* The easing here is the flat-then-settle curve used for sliding panels;
     it reads as weight rather than as a linear slide. */
  .conversation, .sidebar {
    transition: transform .3s cubic-bezier(.32, .72, 0, 1);
    /* Keep both panels on their own layer so the slide never repaints them. */
    will-change: transform;
    backface-visibility: hidden;
  }
  /* While a finger drags the chat back, it follows the finger exactly. */
  .conversation.is-dragging, .sidebar.is-dragging { transition: none; }
  .message.is-new { animation: message-in .24s ease-out both; }
  .sheet[open] { animation: fade-in .18s ease-out; }
  .sheet::backdrop { animation: fade-in .22s ease-out; }
  .detail-pane { animation: fade-in .18s ease-out; }
}

@media (prefers-reduced-motion: reduce) {
  .conversation, .sidebar { transition: none; }
}

.rail-wordmark { color: var(--on-ink); font-size: 15px; font-weight: 700; letter-spacing: -.5px; padding: 12px 0; }

.field select { width: 100%; min-height: var(--tap); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--pale); color: var(--text); font: inherit; font-size: 16px; }
.field select:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* Dedicated settings destination, with the same navigation as the inbox. */
.settings-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--pale); border-radius: 0 var(--r-lg) var(--r-lg) 0; }
.app.settings-open .conversation, .app.settings-open .detail-pane { display: none; }
.settings-header { display: flex; align-items: center; gap: 12px; padding: 24px 30px; border-bottom: 1px solid var(--line); background: var(--surface); }
.settings-header h1 { font-size: var(--t-display); font-weight: 750; letter-spacing: -1px; }
.settings-header button { width: var(--tap); height: var(--tap); padding: 0; color: var(--text-soft); }
.settings-body { flex: 1; min-height: 0; overflow-y: auto; padding: 30px; }
.settings-body > * { max-width: 480px; margin-left: auto; margin-right: auto; }
.settings-body .profile-head { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-soft); }
.settings-body .profile-section { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-top: 18px; }
.settings-body .profile-section .field:first-child { margin-top: 0; }
.settings-actions { justify-content: flex-start; margin-top: 24px; }
@media (max-width: 700px) {
  .app.settings-open .sidebar { transform: none; position: relative; z-index: 20; background: transparent; pointer-events: none; }
  .settings-open .mobile-nav { margin-top: auto; pointer-events: auto; }
  .settings-pane { position: absolute; inset: 0 0 max(72px, calc(64px + var(--inset-bottom))) 0; z-index: 15; border-radius: 0; }
  .settings-header { padding: calc(15px + var(--inset-top)) 20px 16px; gap: 10px; }
  .settings-header h1 { font-size: 30px; }
  .settings-body { padding: 20px; }
  .settings-body .profile-head { padding: 20px; }
  .settings-body .profile-section { padding: 17px; }
}

:root:is([data-theme="dark"], [data-theme="green"]) #new-message:hover { background: var(--soft); }
:root:is([data-theme="dark"], [data-theme="green"]) .room-row.is-selected,
:root:is([data-theme="dark"], [data-theme="green"]) .group-card,
:root:is([data-theme="dark"], [data-theme="green"]) .bubble { box-shadow: var(--shadow-soft); }

/* Settings controls share one spacing rhythm and use direct choices. */
.settings-body .profile-head { padding: 20px; }
.settings-body .profile-section { padding: 16px; margin-top: 14px; }
.settings-body .profile-section:has(> .row-button) { padding: 8px; }
.settings-body .profile-section .password-form { padding: 0 8px 8px; }
.settings-actions { margin-top: 14px; }
.settings-choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.settings-choices legend { padding: 0; margin-bottom: 12px; font-size: var(--t-sm); font-weight: 650; color: var(--text-soft); }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-choice { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 82px; padding: 12px 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pale); color: var(--text-soft); font-size: var(--t-sm); cursor: pointer; }
.theme-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-choice:has(input:checked) { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); color: var(--green); background: var(--soft); }
.theme-choice:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 3px; }
.theme-swatch { width: 25px; height: 25px; border-radius: 50%; border: 1px solid #ffffff40; box-shadow: 0 1px 4px #00000020; }
.swatch-light { background: #f9fbfa; border-color: #d0d9d4; }
.swatch-dark { background: #24272d; }
.swatch-green { background: #2c665b; }
.account-options { display: grid; gap: 6px; }
.account-choice { display: flex; align-items: center; gap: 10px; padding: 8px; min-height: var(--tap); border-radius: var(--r-sm); cursor: pointer; }
.account-choice:has(input:checked) { background: var(--soft); }
.account-choice input { accent-color: var(--button-green); width: 18px; height: 18px; flex-shrink: 0; margin: 0; }
.account-choice .avatar { width: 32px; height: 32px; font-size: var(--t-xs); }
.account-choice-name { font-size: var(--t-sm); overflow-wrap: anywhere; min-width: 0; }
#test-switch-submit { width: 100%; margin-top: 12px; }

/* A single backdrop continues around both rounded conversation corners. */
.conversation { background: linear-gradient(125deg, var(--ink), var(--ink-lift)); }
.messages { position: relative; isolation: isolate; }
.date-divider { background: transparent; border: 1px solid var(--line); box-shadow: none; padding: 6px 14px; }
.avatar, .symbol, .mini-avatar, .room-symbol { overflow: hidden; }
.avatar img, .symbol img, .mini-avatar img, .room-symbol img, .detail-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.symbol.has-photo, .room-symbol.has-photo, .detail-icon.has-photo { overflow: hidden; padding: 0; }
html.standalone body::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--inset-top); background: var(--top-surface); z-index: 100; pointer-events: none; }
html.standalone .auth { padding-top: calc(30px + var(--inset-top)); }
.settings-body > .profile-head { margin-bottom: 16px; }
.settings-body [role="tabpanel"] > .profile-section:first-child { margin-top: 0; }
.signout-button { width: 100%; min-height: 48px; gap: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--danger); background: var(--surface); font-weight: 600; }
.signout-button:hover { border-color: var(--danger); }
.profile-photo-controls { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
#edit-profile-avatar { width: 72px; height: 72px; font-size: var(--t-xl); }
.profile-photo-buttons { display: flex; flex-direction: column; align-items: flex-start; }
.profile-photo-buttons button { padding: 6px 8px; font-size: var(--t-sm); color: var(--green); }
.preferences-placeholder h2 { font-size: var(--t-lg); }
.preferences-placeholder p { margin-top: 8px; color: var(--quiet); }
/* Notifications: one list per delivery route, saved as each choice changes.
   Rows match the Settings list and iOS switches, ready for the native app. */
.notify-group + .notify-group { margin-top: 30px; }
.notify-group h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--quiet); font-size: 13px; font-weight: 650; }
.notify-soon { padding: 3px 8px; border-radius: 999px; background: var(--soft); color: var(--green); font-size: 11px; font-weight: 700; }
.notify-list { border-top: 1px solid var(--line); }
.notify-choice, .notify-switch, .notify-row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 54px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--text); }
.notify-choice { cursor: pointer; }
.notify-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.notify-choice:has(input:checked)::after { content: '✓'; margin-left: auto; color: var(--green); font-size: 20px; }
.notify-choice:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; border-radius: var(--r-sm); }
.notify-row label { flex: 1; }
.notify-row input { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pale); color: var(--text); font-size: 16px; }
.notify-switch span { flex: 1; }
.notify-switch:has(input:disabled) span { color: var(--quiet); }
.notify-switch input { appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; width: 51px; height: 31px; margin: 0; border-radius: 999px; background: var(--line); transition: background .2s ease; }
.notify-switch input::before { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--on-ink); box-shadow: var(--shadow-soft); transition: transform .2s ease; }
.notify-switch input:checked { background: var(--button-green); }
.notify-switch input:checked::before { transform: translateX(20px); }
.notify-switch input:disabled { opacity: .55; }
.notify-note { margin-top: 8px; font-size: 12px; color: var(--quiet); }
.notify-status { margin-top: 6px; min-height: 18px; font-size: 13px; color: var(--green); }
.message-alert { position: fixed; z-index: 110; top: calc(16px + var(--inset-top)); right: 20px; max-width: min(380px, calc(100vw - 40px)); display: flex; gap: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-raised); padding: 8px; }
#message-alert-open { flex: 1; text-align: left; justify-content: flex-start; overflow-wrap: anywhere; min-width: 0; }
#message-alert-close { width: var(--tap); flex-shrink: 0; }
@media (max-width: 700px) {
  .settings-body { padding-top: 16px; }
}

/* Inbox priorities and direct actions. */
/* Unread rows are tinted only; the bar down the left side is gone (10/22). */
.has-unread.room-row { background: var(--soft); }
.has-unread .room-top strong { font-weight: 750; }
.pin-marker { width: 14px; height: 14px; color: var(--gold); }
[data-view="chats"] { position: relative; }
.nav-unread { position: absolute; top: 2px; right: 6px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border-radius: 10px; background: var(--gold-on-ink); color: var(--ink); font-size: 10px; font-weight: 750; line-height: 1; }
.mobile-nav .nav-unread { font-size: 10px; }
.message-actions { position: relative; width: 28px; height: 28px; min-height: 28px; padding: 0; color: var(--quiet); border-radius: 50%; }
.message-actions::before { content: ''; position: absolute; inset: -8px; }
.message-actions .icon { width: 19px; height: 19px; }
.message-actions:hover { color: var(--green); background: var(--soft); }
.new-conversation, .message-menu { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-raised); }
.new-conversation::backdrop, .message-menu::backdrop { background: #00000066; }
.new-conversation { width: min(440px, calc(100vw - 40px)); max-height: min(640px, calc(var(--app-height) - 40px)); padding: 24px; }
.flow-header { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.flow-header h2 { font-size: var(--t-xl); letter-spacing: -.5px; }
.flow-header button { padding: 0; width: var(--tap); height: var(--tap); flex-shrink: 0; }
.new-conversation-people { margin-top: 16px; }
.new-person { display: flex; align-items: center; width: 100%; gap: 12px; min-height: 68px; padding: 10px 6px; justify-content: flex-start; border-radius: var(--r-sm); }
.new-person strong { flex: 1; min-width: 0; text-align: left; font-size: var(--t-md); overflow-wrap: anywhere; }
.new-person > .icon { color: var(--green); width: 18px; }
.new-person:hover { background: var(--pale-sunk); }
.message-menu { width: 240px; padding: 16px; }
.message-menu h2 { font-size: var(--t-sm); color: var(--quiet); margin-bottom: 10px; }
/* Pin: a compact button under the name, not a full-width bar. */
#detail-content .pin-conversation { display: flex; width: auto; margin: 0 auto 20px; padding: 0 16px; justify-content: center; }
/* Buttons in the details panel look like buttons, not plain text. */
#detail-content .row-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); font-size: var(--t-sm); font-weight: 600; box-shadow: var(--shadow-soft); }
#detail-content .row-button:hover:not(:disabled) { background: var(--pale-sunk); }
#detail-content .row-button:active:not(:disabled) { background: var(--soft); transform: scale(.98); }
#detail-content .group-exit { width: 100%; justify-content: center; margin-top: 8px; color: var(--danger); }
#detail-content .group-exit .icon { color: var(--danger); }
#detail-content .group-adder > .row-button { width: 100%; justify-content: center; }
@media (max-width: 700px) {
  .new-conversation { position: fixed; top: var(--app-top); left: 0; margin: 0; width: 100%; max-width: none; height: var(--app-height); max-height: none; border-radius: 0; border: 0; padding: calc(16px + var(--inset-top)) 20px calc(20px + var(--inset-bottom)); }
  .message-menu { position: fixed; top: auto; bottom: 0; margin: 0; width: 100%; max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 20px 20px calc(20px + var(--inset-bottom)); }
}

@media (max-width: 700px) {
  .new-conversation::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--inset-top); background: var(--top-surface); pointer-events: none; }
}
@media (pointer: coarse) { .bubble { -webkit-touch-callout: none; } }

/* Keep the status area and main header one surface in the darker themes. */
@media (max-width: 700px) {
  :root:is([data-theme="dark"], [data-theme="green"]) .app:not(.settings-open) .sidebar {
    background: linear-gradient(180deg, var(--surface) 0, var(--surface) calc(var(--inset-top) + 82px), var(--pale) 55%, var(--sidebar-end) 100%);
  }
}

/* Reactions update independently so the message text and selection stay put. */
.reaction-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; margin-bottom: 10px; }
.message-menu { width: 336px; max-width: calc(100% - 24px); }
.reaction-chip { min-width: 44px; min-height: 44px; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-size: 18px; }
.reaction-chip[aria-pressed="true"] { border-color: var(--green); background: var(--soft); }
.message-reactions { display: flex; flex-wrap: wrap; gap: 6px; }
.message-reactions:not(:empty) { margin-top: 6px; }
.is-mine .message-reactions { justify-content: flex-end; }
#share-stats { flex: 0 0 44px; margin-bottom: 3px; border: 1px solid var(--line); border-radius: 50%; color: var(--green); }
.stats-picker { width: 410px; max-width: calc(100% - 24px); max-height: calc(var(--app-height) - 32px); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); background: var(--surface); box-shadow: var(--shadow-raised); }
.stats-picker::backdrop { background: var(--overlay-shade); }
.stats-picker header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stats-picker h2 { font-size: 22px; }
/* The close button borrowed the conversation header's light-on-dark colour,
   which made it invisible on this light sheet. */
.stats-picker #close-stats, .gif-picker #close-gifs { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--pale-sunk); color: var(--text); }
.stats-picker #close-stats:hover:not(:disabled), .gif-picker #close-gifs:hover:not(:disabled) { background: var(--soft); }
.stats-picker #close-stats .icon, .gif-picker #close-gifs .icon { width: 18px; height: 18px; }
/* GIF picker: search, then a two-column grid of previews */
.gif-picker #gif-search { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--pale-sunk); color: var(--text); font-size: 16px; }
.gif-status { margin: 8px 0 0; color: var(--quiet); font-size: var(--t-sm); }
.gif-status:empty { display: none; }
.gif-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; max-height: min(52vh, 420px); overflow-y: auto; }
.gif-tile { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border-radius: var(--r-md); background: var(--pale-sunk); }
.gif-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-tile:disabled { opacity: .5; }
.gif-credit { margin: 10px 0 0; color: var(--quiet); font-size: var(--t-xs); text-align: center; }
.stats-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 16px; }
.stat-option { min-height: 44px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-md); color: var(--quiet); background: var(--pale); font-size: 12px; }
.stat-option[aria-pressed="true"] { background: var(--soft); border-color: var(--green); color: var(--green); }
#send-stats { width: 100%; min-height: 48px; margin-top: 16px; }
.stat-card { min-width: 0; text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; }
.stat-card h3 { font-size: 18px; line-height: 1.3; margin: 10px 0 4px; }
.stat-sample { display: inline-block; padding: 4px 8px; border-radius: var(--r-md); background: var(--soft); color: var(--green); font-size: 11px; font-weight: 700; }
.stat-period { color: var(--quiet); font-size: 12px; margin-bottom: 12px; }
.stat-metric { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.stat-metric dt { color: var(--quiet); font-size: 13px; }
.stat-metric dd { margin: 0; font-weight: 750; font-size: 17px; white-space: nowrap; }
.message .bubble:has(.stat-card) { padding: 0; background: none; box-shadow: none; width: 300px; max-width: 100%; }
@media (max-width: 700px) {
  .message-menu { max-width: none; width: 100%; }
  .stats-picker { padding: 18px; }
  .compose { gap: 6px; }
  .compose textarea { padding-left: 12px; padding-right: 12px; }
}

/* Keep message actions anchored to the message, rather than a bottom sheet. */
.messages:focus-visible { outline: none; }
.message-menu { position: fixed; inset: auto; margin: 0; width: 292px; max-width: calc(100% - 24px); max-height: calc(var(--app-height) - 40px); padding: 8px; border-radius: 24px; overflow: auto; }
/* Reactions popup: a short, quiet appear (scale and fade), nothing more. */
@keyframes menu-appear { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes menu-shade { from { opacity: 0; } to { opacity: 1; } }
#message-menu[open] { animation: menu-appear 150ms cubic-bezier(.2, .8, .3, 1); transform-origin: center bottom; }
#message-menu[open]::backdrop { animation: menu-shade 150ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  #message-menu[open], #message-menu[open]::backdrop { animation: none; }
}
.message-menu::backdrop { background: transparent; }
.message-menu h2 { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.message-menu .reaction-picker { margin: 0; gap: 2px; }
.message-menu .reaction-chip { border-color: transparent; background: transparent; padding: 6px; border-radius: 50%; }
.message-menu .reaction-chip[aria-pressed="true"] { border-color: var(--green); background: var(--soft); }
.message-menu-actions { display: flex; align-items: center; border-top: 1px solid var(--line); margin-top: 6px; }
.message-menu-actions .row-button { flex: 1; justify-content: center; min-height: 44px; padding: 6px; border-radius: 16px; font-size: 13px; }
.message-menu.reactions-only .message-menu-actions { display: none; }
.message-menu .form-error:empty { display: none; }
.more-reactions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; max-height: min(320px, 45vh); overflow-y: auto; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.bubble { touch-action: pan-y; }
/* The strip behind the reply preview uses the composer's colour, so no
   conversation background shows beside it; only the preview itself is a pill. */
.reply-banner { margin: 0; padding: 8px 16px 0; min-height: 0; border-radius: 0; border-left: 0; background: var(--surface); }
.reply-banner-copy { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 5px 10px; border-radius: var(--r-md); border-left: 3px solid var(--green); background: var(--pale-sunk); }
.reply-banner small { flex: 0 1 auto; max-width: 100px; letter-spacing: 0; text-transform: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-banner span { flex: 1; min-width: 0; margin-top: 0; font-size: 12px; }
.reply-quote { flex-direction: row; align-items: center; gap: 8px; padding: 6px 8px; min-width: 0; }
.reply-quote strong { flex: 0 1 auto; max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-quote span { display: block; flex: 1; min-width: 0; white-space: nowrap; text-overflow: ellipsis; -webkit-line-clamp: unset; }
@media (pointer: coarse) {
  .bubble, .bubble * { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
}

/* Community is a preview feed; the working directory now lives in Settings. */
:is(.view-community, .view-announcements) .room-list { padding: 0 20px 20px; }
.team-search { margin: 14px 0 4px; }
#settings-team h2 { font-size: 20px; }
#settings-team-list .section-label { display: none; }
#settings-team-list .room-row { padding: 10px 0; }
#settings-team-list .avatar { width: 42px; height: 42px; }
#settings-team-list .snippet { font-size: 12px; }
.community-intro { display: flex; align-items: center; gap: 10px; color: var(--quiet); font-size: 12px; margin-bottom: 16px; }
.community-preview-badge { padding: 5px 9px; border-radius: var(--r-sm); background: var(--soft); color: var(--green); font-weight: 700; }
.community-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 18px; }
.community-filters button { padding: 8px 10px; min-height: 44px; border-radius: var(--r-md); font-size: 12px; color: var(--quiet); border: 1px solid var(--line); background: var(--surface); }
.community-filters button[aria-pressed="true"] { background: var(--soft); color: var(--green); border-color: var(--green); }
.community-post { padding: 18px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.community-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.community-post .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.community-post-identity { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.community-post-identity strong { font-size: 13px; }
.community-post-identity small { font-size: 11px; color: var(--quiet); }
.community-pin { color: var(--gold); margin-left: auto; }
.community-pin .icon { width: 18px; height: 18px; }
.community-post h3 { font-size: 20px; line-height: 1.3; letter-spacing: -.3px; margin-bottom: 8px; }
.community-post-body { font-size: 14px; line-height: 1.6; color: var(--text-soft); }
.community-post-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.community-post-actions button { min-height: 44px; border-radius: var(--r-md); padding: 7px 12px; font-size: 12px; }
.community-like { background: var(--pale); border: 1px solid var(--line); }
.community-like[aria-pressed="true"] { background: var(--soft); border-color: var(--green); }
.community-discuss { color: var(--green); }
@media (min-width: 701px) {
  .app:is(.view-community, .view-assistant, .view-announcements):not(.settings-open) .sidebar { flex: 1; width: auto; min-width: 0; border-radius: 0 var(--r-lg) var(--r-lg) 0; }
  .app:is(.view-community, .view-assistant, .view-announcements) .conversation { display: none; }
  :is(.view-community, .view-assistant, .view-announcements) .room-list { width: 100%; max-width: 740px; margin: 0 auto; }
  :is(.view-community, .view-assistant, .view-announcements) :is(.sidebar-head, .inbox-heading) { width: 100%; max-width: 740px; margin-left: auto; margin-right: auto; }
}

/* Assistant preview, laid out like Cairn Practice: a centred prompt, one
   large rounded composer with a round send button, and suggestion rows. */
.view-assistant .room-list { padding: 0 20px 24px; }
/* No visible "Assistant" title; it stays available to screen readers. */
.view-assistant .inbox-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.assistant { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 640px; margin: 0 auto; }
.assistant-heading { margin: 22px 0 6px; text-align: center; font-size: 26px; line-height: 1.2; letter-spacing: -.6px; font-weight: 700; }
.assistant-compose { padding: 14px 12px 12px 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-card); }
.assistant-compose textarea { display: block; width: 100%; min-height: 52px; padding: 4px 6px 4px 0; border: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 1.45; resize: none; outline: none; }
.assistant-compose:focus-within { border-color: var(--green); }
.assistant-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.assistant-badge { padding: 4px 9px; border-radius: 999px; background: var(--soft); color: var(--green); font-size: 11px; font-weight: 700; }
.assistant-send { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--button-green); color: var(--on-ink); }
.assistant-send .icon { width: 20px; height: 20px; stroke-width: 2.2; }
.assistant-suggestions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.assistant-suggestion { display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: start; justify-content: stretch; gap: 3px 12px; padding: 12px 14px; border-radius: var(--r-md); text-align: left; color: var(--text); }
.assistant-suggestion:hover { background: var(--pale-sunk); }
.assistant-suggestion:active { background: var(--soft); }
.assistant-suggestion .icon { grid-row: span 2; width: 14px; height: 14px; margin-top: 3px; color: var(--quiet); }
.assistant-suggestion strong { font-size: 15px; font-weight: 600; }
.assistant-suggestion small { font-size: 12px; color: var(--quiet); }
.assistant-thread { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.assistant:not(.has-thread) .assistant-thread, .assistant.has-thread .assistant-heading, .assistant.has-thread .assistant-suggestions { display: none; }
.assistant-message { max-width: 88%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.assistant-message.is-you { align-self: flex-end; background: var(--soft); }
.assistant-message small { display: block; margin-bottom: 6px; color: var(--quiet); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.assistant-message p { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
@media (min-width: 520px) { .assistant-suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Photos and conversation symbols sit flat on the darker themes: the light
   theme's top highlight and halo read as a smudge on a dark surface. */
:root:is([data-theme="dark"], [data-theme="green"]) :is(.avatar, .avatar-button, .symbol, .room-symbol, .mini-avatar) { box-shadow: none; }

/* Settings uses a native-style list and separate detail pages. */
.settings-pane { background: var(--surface); }
.settings-header { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; padding: 18px 20px; gap: 10px; border: 0; background: var(--surface); }
.settings-header h1 { text-align: center; font-size: 22px; letter-spacing: -.4px; font-weight: 700; outline: none; }
.settings-header button { border: 1px solid var(--line); border-radius: 50%; background: var(--pale); }
.settings-body { padding: 0; background: var(--surface); }
.settings-body > * { max-width: 600px; margin-left: auto; margin-right: auto; }
.settings-detail .settings-body { padding: 20px; }
.settings-list-group { padding: 14px 20px; border-top: 7px solid var(--pale); }
.settings-list-group:first-of-type { border-top: 0; padding-top: 0; }
.settings-list-group h2 { margin: 6px 0 12px; color: var(--quiet); font-size: 13px; font-weight: 650; }
.settings-list-row { display: flex; width: 100%; gap: 14px; min-height: 58px; padding: 10px 0; border-radius: 0; text-align: left; justify-content: flex-start; font-size: 16px; color: var(--text); }
.settings-list-row > .icon { flex-shrink: 0; width: 24px; height: 24px; }
.settings-list-row > span { flex: 1; }
.settings-chevron { margin-left: auto; color: var(--quiet); width: 19px; height: 19px; flex-shrink: 0; }
.settings-body .profile-head { width: 100%; padding: 10px 0; min-height: 76px; gap: 14px; background: transparent; border: 0; border-radius: 0; box-shadow: none; text-align: left; }
.settings-profile-row .avatar { width: 44px; height: 44px; flex-shrink: 0; }
.settings-profile-row .profile-identity { flex: 1; }
.settings-profile-row .profile-identity strong { font-size: 17px; }
.settings-profile-row .profile-identity span { font-size: 12px; }
.settings-signout { padding: 8px 20px 24px; border-top: 7px solid var(--pale); }
.settings-signout .signout-button { justify-content: flex-start; border: 0; background: transparent; padding: 8px 0; min-height: 58px; font-weight: 500; font-size: 16px; }
.settings-body .profile-section, .settings-body .profile-section:has(> .row-button) { margin-top: 0; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.settings-body .profile-section .password-form { padding: 0; }
.settings-detail .theme-options { display: flex; flex-direction: column; gap: 0; }
.settings-detail .theme-choice { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 64px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 16px; }
.settings-detail .theme-choice:has(input:checked) { background: transparent; box-shadow: none; }
.settings-detail .theme-choice:has(input:checked)::after { content: '✓'; margin-left: auto; color: var(--green); font-size: 20px; }
.settings-detail .theme-swatch { width: 28px; height: 28px; }
.settings-detail .account-choice { border-radius: var(--r-sm); }
.settings-pane #profile-error:empty { display: none; }
.settings-pane #profile-error { padding: 8px 20px; }
@media (min-width: 701px) { .app.settings-open .sidebar { display: none; } }
@media (max-width: 700px) {
  .settings-header { padding-top: calc(15px + var(--inset-top)); }
}

/* Teams (managers only): personal filters over their own direct chats. The
   picker borrows the anchored reaction popup; managing borrows New conversation. */
.team-bar { display: flex; align-items: center; gap: 2px; margin: -4px 20px 12px; padding: 0 0 0 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.team-bar[hidden] { display: none; }
#team-bar-switch { flex: 1; min-width: 0; justify-content: flex-start; gap: 8px; padding: 0 8px; color: var(--green); font-size: var(--t-sm); font-weight: 650; }
#team-bar-switch span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#team-bar-switch .icon { width: 18px; height: 18px; flex-shrink: 0; }
#team-bar-switch .team-bar-chevron { width: 15px; height: 15px; transform: rotate(90deg); color: var(--quiet); }
#team-bar-clear { flex-shrink: 0; color: var(--quiet); }
#team-bar-clear .icon { width: 18px; height: 18px; }
@media (max-width: 700px) { .team-bar { margin: -2px 22px 12px; } }

.message-menu.team-picker { width: 260px; padding: 6px; }
.team-picker-list { display: flex; flex-direction: column; max-height: min(320px, calc(var(--app-height) - 200px)); overflow-y: auto; }
.team-choice { width: 100%; justify-content: flex-start; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: 16px; text-align: left; font-size: var(--t-md); color: var(--text); }
.team-choice:hover { background: var(--pale-sunk); }
.team-choice[aria-pressed="true"] { color: var(--green); font-weight: 650; }
.team-choice-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-choice-count { color: var(--quiet); font-size: var(--t-xs); font-weight: 600; }
.team-choice .icon { width: 18px; height: 18px; color: var(--green); flex-shrink: 0; }
.team-picker-empty { padding: 12px; color: var(--quiet); font-size: var(--t-sm); }
#team-picker-manage { min-height: 48px; margin-top: 4px; padding: 0 12px; border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; font-size: var(--t-sm); }

.team-manager-panel[hidden] { display: none; }
.team-manager .flow-header h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-inline-form { display: flex; gap: 8px; margin-bottom: 16px; }
.team-inline-form input { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pale); color: var(--text); font-size: 16px; }
.team-inline-form input:focus { outline: none; border-color: var(--green); }
.team-inline-form button { flex-shrink: 0; padding: 0 16px; }
.team-inline-form button:not(.primary) { border: 1px solid var(--line); color: var(--green); background: var(--surface); }
.team-manager-teams { border-top: 1px solid var(--line); }
.team-manage-row { border-bottom: 1px solid var(--line); }
.team-manage-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-manage-row small { color: var(--quiet); font-size: var(--t-xs); }
.team-people { margin-top: 12px; border-top: 1px solid var(--line); }
.team-person { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.team-person .avatar { width: 40px; height: 40px; }
.team-person strong { flex: 1; min-width: 0; font-size: var(--t-md); overflow-wrap: anywhere; }
.team-person input { width: 22px; height: 22px; margin: 0 6px 0 0; flex-shrink: 0; accent-color: var(--button-green); }
.team-delete { width: 100%; min-height: 48px; margin-top: 20px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--danger); background: var(--surface); font-weight: 600; }
.team-delete.is-armed { border-color: var(--danger); }
.team-manager .form-error:empty { display: none; }
/* "Start a chat" rows line up with the conversation rows above them. */
.room-list .team-start { display: flex; width: calc(100% - 20px); margin: 3px 10px; padding: 14px; border-radius: var(--r-md); }
.room-list .team-start .avatar { width: 47px; height: 47px; }
@media (max-width: 700px) {
  .room-list .team-start { width: calc(100% - 24px); margin: 3px 12px; }
  .room-list .team-start .avatar { width: 50px; height: 50px; }
}
/* Manage teams: Done reads as the way out; renaming sits behind a pencil. */
.flow-header .flow-done { width: auto; padding: 0 12px; color: var(--green); font-weight: 650; font-size: var(--t-md); }
.team-edit-heading { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.team-edit-heading h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-header .team-edit-heading button { color: var(--quiet); }
.team-edit-heading .icon { width: 18px; height: 18px; }
.team-edit-count { margin: -10px 0 14px 56px; color: var(--quiet); font-size: var(--t-sm); }
.team-inline-form[hidden] { display: none; }

/* Groups people create: the New group picker and their details controls. */
.new-group-start { min-height: 52px; margin: -6px 0 12px; padding: 0 6px; color: var(--text); font-weight: 600; }
.new-group-start[hidden], .new-group-form[hidden], .create-group[hidden], #new-group-back[hidden] { display: none; }
.new-group-start > span { flex: 1; text-align: left; }
.new-group-start .icon:first-child { color: var(--green); }
.new-group-form { margin-bottom: 12px; }
.new-group-form input { width: 100%; min-height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pale); color: var(--text); font-size: 16px; }
.new-group-form input:focus { outline: none; border-color: var(--green); }
.new-conversation .team-person { padding: 8px 6px; }
.create-group { position: sticky; bottom: 0; margin-top: 16px; box-shadow: 0 -12px 16px var(--surface); }
.create-group:disabled { opacity: 1; background: var(--soft); color: var(--quiet); }   /* solid, so the list never shows through */
#new-group-back + h2 { flex: 1; }

.group-actions .row-button, .group-adder > .row-button, .group-exits .row-button { min-height: var(--tap); }
.group-actions .form-error:empty { display: none; }
.group-rename { margin: 4px 0 8px; }
.group-rename[hidden], .group-add-list[hidden] { display: none; }
.detail-member { position: relative; }
.detail-member > span:not(.avatar) { flex: 1; min-width: 0; }
.detail-member-note { color: var(--quiet); font-size: var(--t-xs); font-weight: 600; }
.detail-note { margin: 4px 0 10px; color: var(--quiet); font-size: var(--t-sm); line-height: 1.45; }
.detail-member-actions { display: flex; flex-shrink: 0; gap: 6px; margin-left: auto; }
.compose.is-muted textarea { opacity: .7; }
.compose.is-muted .send, .compose.is-muted #share-stats { opacity: .4; }
.detail-member-gear { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; min-height: 0; margin-left: auto; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--quiet); }
.detail-member-gear .icon { width: 18px; height: 18px; }
.detail-member-gear:active { background: var(--soft); }
.detail-member-note + .detail-member-gear { margin-left: 8px; }
.detail-member > .detail-member-note { margin-left: auto; }
.detail-member-remove, .detail-member-admin { flex-shrink: 0; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); font-size: var(--t-sm); font-weight: 600; }
.detail-member-remove { color: var(--danger); }
.detail-member-admin { color: var(--green); }
.group-adder { margin-top: 6px; }
.group-add-list { margin: 4px 0 8px; }   /* no left accent bar */
.group-add-person { width: 100%; justify-content: flex-start; text-align: left; min-height: var(--tap); }
.group-add-person > .icon { margin-left: auto; color: var(--green); width: 18px; height: 18px; }
.group-add-empty { padding: 8px 0; color: var(--quiet); font-size: var(--t-sm); }
/* No separating line in the details panel (10/22); spacing only. */
.group-exits { margin-top: 18px; padding-top: 10px; }
.group-exit, .group-exit .icon { color: var(--danger); }
.group-exit.is-armed { background: var(--pale-sunk); font-weight: 650; }

/* No focus rings after a tap; keyboard navigation keeps them (see wire()). */
:root[data-input="touch"] :focus-visible,
:root[data-input="touch"] .notify-choice:has(input:focus-visible),
:root[data-input="touch"] .theme-choice:has(input:focus-visible) { outline: none; }

/* One confirmation dialog for every permanent action. */
.confirm-dialog { width: min(340px, calc(100vw - 40px)); padding: 22px 20px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-raised); text-align: center; }
.confirm-dialog::backdrop { background: #00000066; }
.confirm-dialog h2 { font-size: var(--t-lg); line-height: 1.3; letter-spacing: -.3px; overflow-wrap: anywhere; }
.confirm-dialog p { margin-top: 8px; color: var(--quiet); font-size: var(--t-sm); line-height: 1.45; }
.confirm-dialog p[hidden] { display: none; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.confirm-actions button { min-height: 48px; border-radius: var(--r-sm); font-weight: 650; }
#confirm-cancel, #name-cancel, #crop-cancel, .choice-cancel { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.confirm-danger { background: var(--danger); color: var(--surface); }
.confirm-primary { background: var(--button-green); color: var(--on-ink); }
.confirm-primary:disabled { opacity: .6; }
/* Short list of choices (group name and photo; member settings) */
.choice-options { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.choice-option { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text); font-weight: 600; text-align: left; }
.choice-option .icon { width: 18px; height: 18px; color: var(--green); }
.choice-option.is-danger, .choice-option.is-danger .icon { color: var(--danger); }
.choice-option:active { background: var(--soft); }
.choice-cancel { width: 100%; min-height: 48px; margin-top: 12px; border-radius: var(--r-sm); font-weight: 650; }
/* Name popup */
#name-input { width: 100%; min-height: 48px; margin-top: 14px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pale-sunk); color: var(--text); font-size: 16px; }
#name-error:empty { display: none; }
/* Crop window: square photo, circle shows what is kept */
.crop-dialog { width: min(320px, calc(100vw - 32px)); }
.crop-canvas { display: block; width: 260px; height: 260px; max-width: 100%; margin: 14px auto 0; border-radius: var(--r-sm); touch-action: none; cursor: grab; }
.crop-zoom { display: block; margin-top: 14px; }
.crop-zoom input { width: 100%; accent-color: var(--green); }

/* Settings, Deleted groups (owner only). */
.deleted-group { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.deleted-group-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.deleted-group-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deleted-group-copy small { color: var(--quiet); font-size: var(--t-xs); }
.deleted-restore, .deleted-erase { flex-shrink: 0; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: var(--t-sm); }
.deleted-restore { color: var(--green); }
.deleted-erase { color: var(--danger); }

/* Settings is a tab: no back button on its main screen (space kept so the
   title stays centred). */
.settings-header #close-account.is-root { visibility: hidden; }

/* Announcements: the Groups gradient card opens it; back returns to Groups. */
button.group-overview { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; text-align: left; justify-content: stretch; color: var(--text); }
button.group-overview > .overview-label, button.group-overview > strong, button.group-overview > .overview-preview { grid-column: 1; }
button.group-overview > .icon { grid-column: 2; grid-row: 1 / span 3; align-self: center; width: 20px; height: 20px; color: var(--quiet); }
.overview-preview { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); font-size: var(--t-sm); }
button.group-overview:active { transform: scale(.99); }
.inbox-back { flex-shrink: 0; margin-left: -10px; color: var(--text-soft); }
.inbox-back[hidden] { display: none; }

/* Times: tap a message to reveal its time (and, on touch screens, its actions
   button). Mouse users also see it on hover. The text stays in the page for
   screen readers. */
.message:not(.show-time) .message-foot time {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (hover: hover) and (pointer: fine) {
  .message:hover .message-foot time { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
}
@media (pointer: coarse) {
  .message:not(.show-time) .message-foot { height: 0; margin: 0; overflow: hidden; }
  .message:not(.show-time) .message-actions { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
.time-divider { margin: 6px auto 16px; padding: 4px 12px; border: 0; background: transparent; }

/* Reactions: a small pill on the message's bottom-right corner. Its visible
   size is small; ::after extends the touch area to 44px. */
.bubble { position: relative; }
.message .message-reactions { position: absolute; right: 10px; bottom: -15px; z-index: 1; display: flex; gap: 4px; margin: 0; }
/* Incoming messages carry reactions on the right corner, your own on the left. */
.message.is-mine .message-reactions { right: auto; left: 10px; }
.message .message-reactions:empty { display: none; }
.message .bubble:has(.message-reactions:not(:empty)) { margin-bottom: 18px; }
.message .message-reactions .reaction-chip { position: relative; min-width: 0; min-height: 0; height: 26px; padding: 0 8px; gap: 3px; border: 2px solid var(--surface); border-radius: 13px; background: var(--pale-sunk); color: var(--text); font-size: 13px; font-weight: 650; line-height: 1; box-shadow: var(--shadow-soft); }
.message .message-reactions .reaction-chip[aria-pressed="true"] { background: var(--soft); color: var(--green); }
.message .message-reactions .reaction-chip::after { content: ''; position: absolute; inset: -11px -6px; }

/* Sample stat cards: a coloured header per kind, a lead figure, then tiles
   (or a leaderboard for competitions). */
.stat-card { padding: 0; overflow: hidden; border-radius: 20px; box-shadow: var(--shadow-card); }
.stat-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; color: var(--on-ink); background: linear-gradient(135deg, var(--green-lift), var(--button-green)); }
.stat-commission .stat-head { background: linear-gradient(135deg, var(--gold), var(--gold-ink)); }
.stat-competition .stat-head { background: linear-gradient(135deg, var(--ink-lift), var(--ink)); }
.stat-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--on-ink) 18%, transparent); }
.stat-icon .icon { width: 19px; height: 19px; }
.stat-icon.is-person { overflow: hidden; font-size: 12px; font-weight: 650; }
.stat-icon.is-person img { width: 100%; height: 100%; object-fit: cover; }
.stat-titles { flex: 1; min-width: 0; }
.stat-card .stat-head h3 { margin: 0; font-size: 15px; line-height: 1.25; color: inherit; }
.stat-card .stat-period { margin: 2px 0 0; color: inherit; opacity: .8; font-size: 12px; }
.stat-card .stat-sample { flex-shrink: 0; align-self: flex-start; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--on-ink) 20%, transparent); color: var(--on-ink); font-size: 10px; letter-spacing: .4px; text-transform: uppercase; }
.stat-hero { display: flex; flex-direction: column; gap: 2px; padding: 16px 16px 4px; }
.stat-hero strong { font-size: 30px; line-height: 1.1; letter-spacing: -1px; color: var(--text); font-weight: 750; }
.stat-hero small { color: var(--quiet); font-size: 12px; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 12px 16px 16px; }
.stat-tile { min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--pale); }
.stat-tile dt { color: var(--quiet); font-size: 11px; }
.stat-tile dd { margin: 2px 0 0; color: var(--text); font-size: 17px; font-weight: 750; }
.stat-progress { display: block; height: 5px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.stat-progress > span { display: block; height: 100%; border-radius: 3px; background: var(--button-green); }
.stat-board { list-style: none; margin: 0; padding: 6px 16px 12px; }
.stat-place { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--text); }
.stat-place:first-child { border-top: 0; }
.stat-rank { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--pale-sunk); color: var(--text-soft); font-size: 13px; font-weight: 750; }
.stat-place:first-child .stat-rank { background: var(--gold); color: var(--on-ink); }
.stat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.stat-place strong { white-space: nowrap; font-size: 14px; }

/* Sparklines on stat cards: subtle line and fill in the card's accent. */
.stat-card { --spark: var(--green); }
.stat-commission { --spark: var(--gold); }
.stat-spark, .stat-spark-hero { display: block; overflow: visible; }
.stat-spark { width: 100%; height: 22px; margin-top: 8px; }
.stat-hero { flex-direction: row; align-items: center; gap: 14px; }
.stat-hero-copy { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.stat-spark-hero { flex: 1; min-width: 60px; height: 38px; }
.spark-line { fill: none; stroke: var(--spark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: color-mix(in srgb, var(--spark) 14%, transparent); stroke: none; }
/* Charts sit on the tile's bottom edge so a bar and a sparkline side by side line up. */
.stat-tile { display: flex; flex-direction: column; }
.stat-tile .stat-progress, .stat-tile .stat-spark { margin-top: auto; padding-top: 0; }
.stat-tile dd { margin-bottom: 8px; }

/* Desktop refinements. Phones are unchanged. */
@media (min-width: 701px) {
  /* One brand mark: the rail's Relay wordmark (with its CAIRN label). The
     list header keeps only the test badge, and disappears when that is off. */
  .sidebar-head .brand, .sidebar-head #account { display: none; }
  .sidebar-head { justify-content: flex-start; padding: 18px 22px 0; }
  .sidebar-head:has(#test-badge[hidden]) { display: none; }

  /* Groups read as one column of wide cards in the narrow list. */
  .view-groups .room-list { grid-template-columns: minmax(0, 1fr); }
  .view-groups .group-card { display: grid; grid-template-columns: 43px minmax(0, 1fr); align-items: center; column-gap: 14px; row-gap: 6px; min-height: 0; padding: 14px 16px; }
  .view-groups .group-card .symbol { grid-row: 1 / span 2; }
  .view-groups .group-card .room-copy { grid-column: 2; width: auto; min-width: 0; }
  .view-groups .group-card .card-members { grid-column: 2; }
}

/* Desktop with no conversation open: an empty header and one quiet line in
   the middle of the panel, instead of a blank symbol and helper text. */
@media (min-width: 701px) {
  .app:not(.chat-open) .chat-head > * { visibility: hidden; }
  .app:not(.chat-open) .messages { display: grid; place-items: center; }
  .app:not(.chat-open) .messages::before { content: 'Choose a conversation'; color: var(--quiet); font-size: var(--t-sm); font-weight: 600; }
}

/* With a mouse, a message's time and "…" appear on hover or keyboard focus
   rather than under every bubble. Opacity keeps the button focusable. */
@media (hover: hover) and (pointer: fine) {
  .message:not(:hover):not(:focus-within):not(.show-time) .message-foot { opacity: 0; }
  .message-foot { transition: opacity .12s ease; }
}

/* Desktop is edge to edge, like a native app: no outer margin and square
   outer corners. Inner surfaces (the message panel, cards) keep their curves. */
@media (min-width: 701px) {
  .app { padding: 0; }
  .app-rail, .conversation, .detail-pane, .settings-pane,
  .app:is(.view-community, .view-assistant, .view-announcements):not(.settings-open) .sidebar { border-radius: 0; }
}

/* Announcements: composer for those who may post; reactions and comments for everyone. */
.announce-compose { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-soft); }
.announce-compose input, .announce-compose textarea, .announce-reply input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--pale); color: var(--text); font-size: 16px; font-family: inherit; }
.announce-compose textarea { resize: vertical; min-height: 76px; line-height: 1.45; }
.announce-compose input:focus, .announce-compose textarea:focus, .announce-reply input:focus { outline: none; border-color: var(--green); }
.announce-compose .primary { align-self: flex-end; min-height: 44px; padding: 0 22px; }
.announcement .community-post-head { align-items: flex-start; }
.announce-delete { flex-shrink: 0; margin-left: auto; color: var(--quiet); }
.announce-delete .icon { width: 17px; height: 17px; }
.announce-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.announce-reactions .reaction-chip, .announce-picker .reaction-chip { min-height: 36px; padding: 4px 10px; font-size: 14px; border-radius: 18px; }
.announce-react { width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--quiet); }
.announce-react .icon { width: 16px; height: 16px; }
.announce-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.announce-picker[hidden], .announce-comments[hidden] { display: none; }
.announce-comments { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.announce-comment { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; }
.announce-comment-copy { flex: 1; min-width: 0; }
.announce-comment-copy strong { font-size: 13px; }
.announce-comment-copy p { margin: 2px 0; font-size: 14px; line-height: 1.5; color: var(--text-soft); overflow-wrap: anywhere; white-space: pre-wrap; }
.announce-comment-copy small { font-size: 11px; color: var(--quiet); }
.announce-reply { display: flex; gap: 8px; margin-top: 8px; }
.announce-send { flex-shrink: 0; width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--button-green); color: var(--on-ink); }
.announce-send .icon { width: 18px; height: 18px; }
/* Search and new-message do nothing on Announcements; keep its header to the title and back. */
.view-announcements #search-toggle, .view-announcements #new-message { display: none; }
/* One Team's chats (10/22): just the back chevron and the Team's name on top. */
.view-team #search-toggle, .view-team #new-message { display: none; }
/* Its list reads like the Chats tab, not the Teams page's card grid. */
.view-groups.view-team .room-list { display: block; padding: 0 0 12px; }

/* Attachments: the + menu, photos in the chat, file cards and the photo viewer. */
.message-menu.attach-menu { width: 220px; padding: 6px; }
.attach-menu .row-button { min-height: 48px; padding: 0 12px; border-radius: 16px; color: var(--text); }
/* + menu and the sheets it opens (10/21): a quick, quiet appear, options with
   their icon in a round tile, and a light press response. */
.attach-menu .row-button { gap: 12px; font-weight: 600; transition: background-color .12s ease, transform .12s ease; }
.attach-menu .row-button .icon { box-sizing: content-box; width: 18px; height: 18px; padding: 7px; border-radius: 50%; background: var(--soft); color: var(--green); }
.attach-menu .row-button:active:not(:disabled) { background: var(--pale-sunk); transform: scale(.98); }
#attach-menu[open] { animation: menu-appear 150ms cubic-bezier(.2, .8, .3, 1); transform-origin: left bottom; }
#attach-menu[open]::backdrop { animation: menu-shade 150ms ease-out; }
@keyframes sheet-appear { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
#gif-picker[open], #stats-picker[open], #choice-sheet[open], #name-dialog[open], #crop-dialog[open] { animation: sheet-appear 180ms cubic-bezier(.2, .8, .3, 1); }
@media (prefers-reduced-motion: reduce) {
  #attach-menu[open], #attach-menu[open]::backdrop, #gif-picker[open], #stats-picker[open], #choice-sheet[open], #name-dialog[open], #crop-dialog[open] { animation: none; }
}
.attach-menu .row-button:disabled { opacity: .5; cursor: default; }
.attach-soon { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--pale-sunk); color: var(--quiet); font-size: 11px; font-weight: 650; }
.message .bubble.has-image { padding: 0; overflow: hidden; background: none; box-shadow: none; }
.message .bubble.has-image:has(.message-reactions:not(:empty)) { overflow: visible; }
.attachment-photo { display: block; padding: 0; min-width: 0; min-height: 0; border-radius: 18px; overflow: hidden; line-height: 0; }
.attachment-photo img { display: block; width: auto; max-width: min(260px, 62vw); max-height: 320px; min-width: 80px; min-height: 60px; object-fit: cover; background: var(--pale-sunk); }
.attachment-file { display: flex; align-items: center; gap: 10px; min-width: 180px; max-width: 260px; color: inherit; text-decoration: none; }
.attachment-file-icon { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; background: color-mix(in srgb, currentColor 14%, transparent); }
.attachment-file-icon .icon { width: 20px; height: 20px; }
.attachment-file-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attachment-file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.attachment-file-copy small { opacity: .75; font-size: 12px; }
.photo-viewer { max-width: none; max-height: none; width: 100vw; height: var(--app-height); margin: 0; padding: 0; border: 0; background: var(--ink); }
.photo-viewer[open] { display: flex; flex-direction: column; }
.photo-viewer::backdrop { background: var(--ink); }
.photo-viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.photo-viewer-bar { display: flex; justify-content: space-between; padding: 12px 16px calc(12px + var(--inset-bottom)); }
.photo-viewer-button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; background: color-mix(in srgb, var(--on-ink) 14%, transparent); color: var(--on-ink); font-weight: 600; text-decoration: none; }

/* Search inside messages */
.message-hit { min-height: 72px; }
.message-hit .snippet { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.message-hit mark { background: var(--soft); color: inherit; font-weight: 650; border-radius: 3px; padding: 0 1px; }
.message.is-found .bubble { box-shadow: 0 0 0 2px var(--green); transition: box-shadow .4s; }

/* Settings, People and roles (owner only) */
.people-note { color: var(--quiet); font-size: var(--t-sm); margin: 0 0 6px; }
.people-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; row-gap: 8px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.people-row > .avatar { width: 40px; height: 40px; }
.people-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.people-copy strong, .people-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-copy small { color: var(--quiet); font-size: var(--t-xs); }
.people-controls { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.people-role { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm, 10px); background: var(--surface); color: inherit; font: inherit; font-size: var(--t-sm); }
.people-announce { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: var(--t-sm); }
.people-announce input { width: 18px; height: 18px; accent-color: var(--green); }
.people-announce:has(input:disabled) { color: var(--quiet); }
@media (min-width: 701px) {
  .people-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .people-controls { grid-column: 3; flex-wrap: nowrap; }
}

/* Settings buttons that used to read as plain text get the same outlined
   style as the details panel. */
#choose-profile-photo, #show-password-form, #cancel-password { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); font-size: var(--t-sm); font-weight: 600; box-shadow: var(--shadow-soft); }
#choose-profile-photo:active, #show-password-form:active, #cancel-password:active { background: var(--soft); transform: scale(.98); }
#remove-profile-photo { color: var(--danger); font-weight: 600; }

/* Settings, Archive: filter pills above the list */
.archive-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.archive-filter button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text-soft); font-size: var(--t-sm); font-weight: 600; }
.archive-filter button[aria-pressed="true"] { border-color: var(--green); background: var(--soft); color: var(--green); }
#archive-error:empty { display: none; }

/* Attachments waiting in the message box until Send */
.staged-attachments { display: flex; gap: 10px; padding: 10px 16px 0; overflow-x: auto; background: var(--surface); scrollbar-width: none; }
.staged-attachments[hidden] { display: none; }
.staged-item { position: relative; flex-shrink: 0; height: 72px; margin-top: 6px; border-radius: var(--r-md); background: var(--pale-sunk); }
.staged-item.is-photo { width: 72px; }
.staged-item.is-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.staged-item.is-file { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; column-gap: 8px; width: 170px; padding: 0 30px 0 12px; color: var(--green); }
.staged-item.is-file .icon { grid-row: span 2; width: 22px; height: 22px; }
.staged-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); font-size: var(--t-sm); font-weight: 600; }
.staged-size { color: var(--quiet); font-size: var(--t-xs); }
/* Every button has a 44px minimum width; without min-width: 0 this 24px
   circle was stretched into an oval (10/21). */
.staged-remove { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 24px; height: 24px; min-width: 0; min-height: 0; aspect-ratio: 1; flex: none; padding: 0; border: 2px solid var(--surface); border-radius: 50%; background: #111; color: #fff; }
.staged-remove .icon { width: 12px; height: 12px; }
.staged-remove::after { content: ''; position: absolute; inset: -10px; }


/* 10/22: pinned conversations as large round tiles above the list (All and
   Groups tabs), like pinned chats in Messages. */
/* Centred as a group (10/22, 4:00pm): one tile sits in the middle, two split
   either side of it, and so on; rows wrap three at a time on a phone. Larger
   than a chat row's photo, and no line under them. */
.pinned-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 18px; padding: 10px 16px 18px; }
.pinned-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 92px; min-width: 0; padding: 4px 2px; border: 0; border-radius: var(--r-md); background: none; color: var(--text); font: inherit; cursor: pointer; transition: transform .15s ease; }
.pinned-tile:active { transform: scale(.94); }
.pinned-face { position: relative; display: block; width: 80px; height: 80px; }
.pinned-face .symbol { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: var(--soft); color: var(--green); font-size: var(--t-xl, 22px); font-weight: 650; box-shadow: var(--shadow-soft); }
.pinned-face .symbol .icon { width: 34px; height: 34px; }
.pinned-face .symbol img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.pinned-tile.is-selected .pinned-face .symbol { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--green); }
.pinned-face .unread { position: absolute; top: -2px; right: -4px; bottom: auto; }
.pinned-name { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--t-xs); font-weight: 600; color: var(--text-soft); }
.pinned-tile.has-unread .pinned-name { color: var(--text); font-weight: 750; }
@media (prefers-reduced-motion: reduce) { .pinned-tile { transition: none; } }

/* Teams page (bottom bar): Team cards reuse the group card look. */
.team-card .symbol { background: var(--gold-wash); color: var(--gold); }
/* 10/22 (4:53pm): icon centred, name larger, people at the bottom, at every width. */
.view-groups .group-card.team-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 0; padding: 20px 16px 16px; text-align: center; }
.view-groups .team-card .symbol { grid-row: auto; width: 52px; height: 52px; }
.view-groups .team-card .symbol .icon { width: 24px; height: 24px; }
.view-groups .team-card .room-copy { width: 100%; grid-column: auto; }
.team-card-name { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--t-lg); font-weight: 750; letter-spacing: -.2px; color: var(--text); }
.view-groups .team-card .card-members { grid-column: auto; justify-content: center; }
.view-groups .team-card .unread { top: 14px; right: 14px; bottom: auto; }
.view-groups .room-list > .start-conversation { grid-column: 1 / -1; }

/* ── 11. Cairn suite shell (11/15) ─────────────────────────────────────────
   On desktop Relay wears the same top bar and sidebar as Operations: the
   Cairn mark and wordmark, an app switcher, search, the bell and your photo
   across the top, and a dark sidebar with text items. The gold bar on the
   selected sidebar item is the one accent bar the suite allows. The phone
   keeps its own layout. Sizes match Operations exactly (sidebar 252px, bar
   56px, search 400px, 12px rounded corner where the canvas starts). */
.suite-bar { display: none; }

@media (min-width: 701px) {
  .app {
    position: relative;
    padding: 56px 0 0 252px;
    background: var(--ink);
  }
  .app::after {
    content: '';
    position: absolute;
    top: 56px; left: 252px;
    width: 12px; height: 12px;
    z-index: 6;
    pointer-events: none;
    background: radial-gradient(circle at 100% 100%, transparent 11.5px, var(--ink) 12px);
  }

  .suite-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 48px 0 0;
    background: var(--ink);
    color: #fff;
  }
  .suite-bar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .suite-brand { display: flex; align-items: center; gap: 10px; width: 252px; height: 56px; flex-shrink: 0; padding: 0 12px 0 20px; }
  .suite-mark { width: 34px; height: 34px; border-radius: 10px; }
  .suite-wordmark { font-size: 20px; font-weight: 800; letter-spacing: -.4px; color: #fff; }
  .suite-wordmark span { color: var(--gold-on-ink); }
  .suite-wrap { position: relative; }
  .suite-app { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px; border-radius: 6px; color: var(--on-ink-quiet); font-size: 14px; font-weight: 400; }
  .suite-app:hover, .suite-app[aria-expanded="true"] { background: #ffffff14; color: #fff; }
  .suite-app svg { width: 14px; height: 14px; }
  .suite-menu { position: absolute; top: 38px; left: 0; z-index: 30; min-width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 12px 32px #141f1b29; }
  .suite-menu-k { margin: 0; padding: 8px 10px 6px; font-size: 12px; font-weight: 600; color: var(--quiet); }
  .suite-menu a, .suite-menu button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 36px; padding: 0 10px; border-radius: 6px; color: var(--text); font-size: 14px; font-weight: 500; text-decoration: none; }
  .suite-menu a:hover, .suite-menu button:hover { background: var(--pale-sunk); }
  .suite-menu svg { width: 16px; height: 16px; color: var(--green); }

  .suite-search { display: flex; align-items: center; gap: 8px; width: 400px; max-width: 36vw; height: 34px; margin-left: 48px; padding: 0 6px 0 12px; border-radius: 6px; background: #ffffff14; color: var(--on-ink-quiet); cursor: text; }
  .suite-search:focus-within { box-shadow: 0 0 0 2px var(--gold-on-ink); }
  .suite-search svg { width: 15px; height: 15px; flex-shrink: 0; }
  .suite-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: 14px; }
  .suite-search input::placeholder { color: var(--on-ink-quiet); }
  .suite-search input::-webkit-search-cancel-button { filter: invert(1); }
  .suite-sp { flex: 1; }
  .suite-icon { position: relative; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid #ffffff2e; border-radius: 6px; color: #fff; }
  .suite-icon:hover { background: #ffffff14; }
  .suite-icon svg { width: 16px; height: 16px; }
  .suite-badge { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
  .suite-me.avatar { width: 30px; height: 30px; margin-left: 2px; border: 1px solid #2a3832; background: #ffffff1a; color: #fff; font-size: 12px; font-weight: 700; box-shadow: none; }

  /* Sidebar: Operations' rail, text items, Settings last in the list. */
  .app-rail {
    position: absolute;
    top: 56px; left: 0; bottom: 0;
    z-index: 5;
    width: 252px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 20px 12px 16px;
    border-radius: 0;
    background: var(--ink);
    box-shadow: none;
  }
  .app-rail .rail-wordmark, .app-rail .rail-label, .app-rail .rail-spacer, .app-rail .icon { display: none; }
  .app-rail .rail-item {
    position: relative;
    flex-direction: row;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--on-ink-quiet);
    font-size: 14px;
    font-weight: 500;
  }
  .app-rail .rail-item small { font-size: 14px; font-weight: inherit; }
  .app-rail .rail-item:hover { background: #ffffff14; color: #fff; }
  .app-rail .rail-item.is-active { background: var(--ink-lift); color: #fff; font-weight: 600; }
  .app-rail .rail-item.is-active::before { content: ''; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; transform: translateY(-50%); border-radius: 0 6px 6px 0; background: var(--gold-on-ink); }
  .app-rail .nav-unread { position: static; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ffffff1f; color: #fff; font-size: 12px; font-weight: 600; }

  /* The canvas: chat list and conversation on light surfaces. */
  .sidebar { background: var(--surface); box-shadow: none; border-right: 1px solid var(--line); }
  .sidebar-head { display: none; }
  .inbox-heading { padding: 24px 20px 12px 24px; }
  .inbox-heading h2 { font-size: 24px; font-weight: 700; letter-spacing: -.6px; }
  #search-toggle { display: none; }
  .inbox-heading.is-searching #search-toggle { display: none; }

  .conversation { background: var(--surface); box-shadow: none; }
  .chat-head { min-height: 72px; padding: 14px 24px; color: var(--text); background: var(--surface); border-bottom: 1px solid var(--line); }
  .chat-head small { color: var(--quiet); }
  .chat-head .head-button { color: var(--text-soft); }
  .chat-head .head-button:hover:not(:disabled) { background: var(--pale-sunk); }
  .room-symbol { background: var(--soft); color: var(--green); box-shadow: none; }
  .messages { border-radius: 0; background: var(--surface); }
  .compose { background: var(--surface); border-top: 1px solid var(--line); padding-top: 14px; }
}

/* Phone navigation (11/16, Aidan: "more like the rep app"): no flat bars
   running into the screen edges. The top is the page's own colour, see-through,
   with the Cairn mark in the middle, search on the left and your photo on the
   right. The tabs float as a pill above the bottom edge, the current one in a
   soft green pill. A chat opens on the same light surface. */
.phone-suite-brand { display: none; }
@media (max-width: 700px) {
  .app { background: var(--pale-sunk); }
  .sidebar { background: var(--pale-sunk); }
  .sidebar-head {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    justify-items: center;
    gap: 12px;
    min-height: 64px;
    padding: var(--inset-top) 16px 0;
    border: 0;
    background: color-mix(in srgb, var(--pale-sunk) 86%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
  .sidebar-head .brand { grid-column: 2; grid-row: 1; justify-content: center; }
  .sidebar-head .brand-lockup, .sidebar-head #test-badge { display: none; }
  .phone-suite-brand { display: flex; }
  .phone-mark { width: 28px; height: 29px; fill: var(--green); }
  .phone-mark .cairn-stone-top { fill: #c9a748; }
  .sidebar-head .top-search {
    grid-column: 1; grid-row: 1;
    width: 40px; height: 40px; margin: 0;
    border: 1px solid var(--line); border-radius: 50%;
    background: var(--surface); color: var(--text);
  }
  .sidebar-head .top-search .icon { width: 19px; height: 19px; }
  .sidebar-head #account {
    display: grid; grid-column: 3; grid-row: 1;
    width: 40px; height: 40px;
    border: 1px solid #cfdad5; background: var(--surface); color: var(--text);
    font-size: 14px; font-weight: 700; box-shadow: none;
  }
  .sidebar-head ~ .tabs { margin-top: 6px; }

  .room-list { padding-bottom: calc(96px + var(--inset-bottom)); }
  .room-row.is-selected, .room-row:hover { box-shadow: none; }

  .mobile-nav {
    position: absolute;
    left: 12px; right: 12px;
    bottom: calc(10px + var(--inset-bottom));
    z-index: 4;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 0;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: 0 10px 30px #141f1b29, 0 2px 6px #141f1b0f;
  }
  .mobile-nav button, .mobile-nav .mobile-new {
    width: 100%; height: 54px; margin: 0;
    flex-direction: column; gap: 2px;
    border: 0; border-radius: 999px;
    background: none; box-shadow: none;
    color: var(--quiet);
    transition: background .15s, color .15s;
  }
  .mobile-nav button .icon, .mobile-nav .mobile-new .icon { width: 22px; height: 22px; stroke-width: 1.8; }
  .mobile-nav button span { font-size: 11.5px; font-weight: 600; }
  .mobile-nav button.is-active { background: var(--soft); color: var(--green); }
  .mobile-nav .nav-unread { top: 4px; right: calc(50% - 22px); background: var(--green); color: #fff; }
  .mobile-nav #mobile-account { display: none; }

  /* In a chat: the same light, see-through top as the inbox. */
  .app .conversation { background: var(--surface); }
  .chat-head {
    min-height: 64px;
    padding: var(--inset-top) 12px 0;
    gap: 10px;
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border-bottom: 1px solid var(--line);
  }
  .chat-head small { color: var(--quiet); }
  .chat-head .head-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); }
  .chat-head .room-symbol { width: 38px; height: 38px; background: var(--soft); color: var(--green); box-shadow: none; }
  .chat-head h1 { font-size: 16px; }
  .messages { border-radius: 0; background: var(--surface); }
  .compose { margin: 0 10px calc(10px + var(--inset-bottom)); padding: 6px; border: 1px solid var(--line); border-radius: 30px; background: var(--surface); box-shadow: 0 8px 24px #141f1b1f; }
  .compose textarea { min-height: 44px; }
}

/* On the shared Cairn Backend (11/16): controls for things the Backend does
   not hold yet stay out of sight rather than failing when tapped. People,
   roles and teams are managed in Operations. */
.relay-live #attach-stats-row,
.relay-live #attach-gif-row,
.relay-live .deleted-erase,
.relay-live #settings-manage-teams,
.relay-live #settings-owner-group,
.relay-live #settings-test-group,
.relay-live [data-settings-page="security"],
[data-settings-page="preferences"],
.relay-live #inbox-back[data-announcements] { display: none !important; }

/* Loading and empty (Cairn standard, 11/16). Skeletons pulse gently while
   something loads; an empty chat shows a faint, still thread behind its
   message. */
.sk-row { display: flex; align-items: center; gap: 13px; width: calc(100% - 20px); margin: 3px 10px; padding: 14px; min-height: 84px; }
.sk-dot { width: 47px; height: 47px; flex-shrink: 0; border-radius: 50%; background: var(--pale-sunk); }
.sk-lines { display: grid; gap: 9px; flex: 1; }
.sk-line { display: block; height: 10px; width: 78%; border-radius: 5px; background: var(--pale-sunk); }
.sk-line.sk-title { width: 42%; height: 12px; }
.sk-thread, .ghost-thread { display: flex; flex-direction: column; gap: 14px; padding: 18px 0; }
.sk-bubble { display: block; height: 42px; border-radius: 18px; background: var(--pale-sunk); }
.sk-bubble.is-mine { align-self: flex-end; background: var(--soft); }
.sk-bubble.is-theirs { margin-left: 44px; }
.sk-list .sk-dot, .sk-list .sk-line, .sk-thread .sk-bubble { animation: sk-pulse 1.4s ease-in-out infinite; }
@keyframes sk-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .sk-list *, .sk-thread * { animation: none; } }
.messages:has(.ghost-thread) { position: relative; }
.ghost-thread { position: absolute; inset: 0 32px auto; opacity: .45; pointer-events: none; }
.ghost-thread + .conversation-welcome { position: relative; }
@media (max-width: 700px) { .ghost-thread { inset: 0 16px auto; } }

/* No left accent bars (Cairn design rule): quotes are a rounded tint only. */
.reply-quote { border-left: 0; border-radius: 10px; }
.reply-banner-copy { border-left: 0; }

.person-row .room-copy { align-self: center; }

/* Sign-in (11/16): the Operations sign-in. A white card on the page colour;
   on wider screens the Cairn mark sits on a green panel to its left. */
.auth { background: var(--pale-sunk); }
.auth-shell { display: grid; width: 100%; max-width: 412px; }
.auth-art { display: none; }
.auth-card { max-width: none; padding: 34px 30px; border: 1px solid var(--line); border-radius: 12px; box-shadow: none; }
.auth-card .brand { display: none; }
.auth h1 { margin-top: 0; font-size: 28px; font-weight: 750; letter-spacing: -.8px; }
.auth-card::before { content: ''; display: block; width: 34px; height: 36px; margin-bottom: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='256 256 512 526'%3E%3Crect x='392' y='256' width='240' height='134' rx='67' fill='%23c9a748'/%3E%3Crect x='316' y='452' width='392' height='134' rx='67' fill='%231f5048'/%3E%3Crect x='256' y='648' width='512' height='134' rx='67' fill='%231f5048'/%3E%3C/svg%3E") no-repeat center / contain; }
.auth .field input, .auth .field select { border: 1px solid #cfdad5; border-radius: 6px; background: var(--surface); }
.auth .primary.wide { border-radius: 6px; background: var(--green); box-shadow: none; }
@media (min-width: 900px) {
  .auth-shell { grid-template-columns: 1fr 1fr; max-width: 1080px; min-height: 620px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .auth-art { display: grid; place-items: center; border-radius: 10px; background: linear-gradient(160deg, #2c665b, #18403a); }
  .auth-art svg { width: 34%; fill: #fff; }
  .auth-art .cairn-stone-top { fill: #c9a748; }
  .auth-card { align-self: center; justify-self: center; width: 100%; max-width: 400px; border: 0; }
  .auth-card::before { display: none; }
}

/* 11/17 review: on phones a long page title (Announcements, a Team's name)
   sits smaller, with room before the first card. */
@media (max-width: 700px) {
  .app:is(.view-announcements, .view-team) .inbox-heading h2 { font-size: 28px; letter-spacing: -.8px; }
  .app:is(.view-announcements, .view-team) .inbox-heading { margin-bottom: 8px; }
}

/* 11/17 review: with a mouse the foot under each bubble (time, actions button)
   always takes its 32px, so the avatar lifts by the same to sit beside the
   bubble instead of under it. Touch screens hide the foot until a tap. */
@media (hover: hover) and (pointer: fine) {
  .message .avatar { margin-bottom: 32px; }
}

/* Password sign-in (11/17), as in Operations: show/hide eye, Keep me signed in
   beside Forgot password, and the support line under the button. */
.password-box { position: relative; display: block; }
.password-box input { padding-right: 46px; }
.password-eye { position: absolute; top: 50%; right: 4px; display: grid; place-items: center; width: 40px; height: 40px;
  margin-top: 3px; transform: translateY(-50%); border-radius: 6px; color: var(--quiet); }
.password-eye:hover { color: var(--text); }
.password-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-eye[aria-pressed="true"] .eye-off { display: none; }
.auth-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px 0 20px; font-size: var(--t-sm); }
.auth-check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); cursor: pointer; }
.auth-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.auth-link { color: var(--green); font-size: var(--t-sm); font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.auth-support { margin: 18px 0 0; text-align: center; font-size: var(--t-sm); color: var(--quiet); }
.auth-support a { color: var(--text); font-weight: 600; text-decoration: none; }
.auth-support a:hover { text-decoration: underline; }

/* ── 12. My Cairn's shell (11/27) ─────────────────────────────────────────
   Relay in the same hand as My Cairn, the rep app: soft initials, dot
   statuses, readable counts, one sliding pill in the tab bar, the page under
   the clock on the Home Screen, and the frame's rounded corner drawn as a
   line on desktop. Looks (looks.css) adjust these where they differ. */

/* Initials on one of four soft tones, picked from the name (avatarTone in app.js), as in My Cairn and Operations. */
:root {
  --avt-sage-bg: #e6ece6; --avt-sage-ink: #3f5a45; --avt-sand-bg: #f3ece0; --avt-sand-ink: #7a5f35;
  --avt-slate-bg: #e5e9ed; --avt-slate-ink: #3e5060; --avt-clay-bg: #f4e7e1; --avt-clay-ink: #8a4a30;
}
:root:is([data-theme="dark"], [data-theme="green"]) {
  --avt-sage-bg: #2b3b31; --avt-sage-ink: #bfd8c5; --avt-sand-bg: #3b3326; --avt-sand-ink: #e3cda0;
  --avt-slate-bg: #2b3744; --avt-slate-ink: #bccedd; --avt-clay-bg: #43302a; --avt-clay-ink: #edbda8;
}
.avt-sage { --avb: var(--avt-sage-bg); --avi: var(--avt-sage-ink); }
.avt-sand { --avb: var(--avt-sand-bg); --avi: var(--avt-sand-ink); }
.avt-slate { --avb: var(--avt-slate-bg); --avi: var(--avt-slate-ink); }
.avt-clay { --avb: var(--avt-clay-bg); --avi: var(--avt-clay-ink); }
:is(.avatar, .symbol):is(.avt-sage, .avt-sand, .avt-slate, .avt-clay):not(.suite-me, .avatar-button, .nav-avatar):not(:has(img)) { background: var(--avb); color: var(--avi); }

/* Statuses: a dot and the word in the status colour, as in My Cairn and Operations. Online in a one-to-one chat's header; Sent and
   Read under your newest message (grey, then green). */
:root { --positive: #2c6b47; }
:root:is([data-theme="dark"], [data-theme="green"]) { --positive: #6bc08c; }
.chat-head small.is-online { color: var(--positive); font-weight: 600; }
.chat-head small.is-online::before { width: 7px; height: 7px; background: currentColor; }
.message-receipt { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.message-receipt::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.message-receipt.is-read { color: var(--positive); }

/* Counts that read at a glance: white figures on the company colour (11px, never smaller), with a ring of the bar's own colour so a
   count over a pill or an icon keeps its edge. The bell's count is the one red, in the same red in every theme. */
.mobile-nav .nav-unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--button-green); color: #ffffff; font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px var(--surface); }
.tab-count, .unread { font-weight: 700; }
.suite-badge { background: #a33730; color: #ffffff; box-shadow: 0 0 0 2px var(--ink); }

/* The tab bar's sliding pill (placeNavPill in app.js), phones only. */
.nav-pill { display: none; }
@media (max-width: 700px) {
  .nav-pill { display: block; position: absolute; left: 0; top: 5px; z-index: 0; width: var(--pw, 0); height: 54px; border-radius: 999px;
    background: var(--soft); transform: translateX(var(--px, 0)); opacity: 0; pointer-events: none; }
  .mobile-nav.pill-on .nav-pill { opacity: 1; }
  .mobile-nav.pill-go .nav-pill { transition: transform .32s cubic-bezier(.2, .8, .2, 1), width .32s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
  .mobile-nav button, .mobile-nav .mobile-new { position: relative; z-index: 1; transition: color .32s cubic-bezier(.2, .8, .2, 1); }
  .mobile-nav.pill-on button.is-active { background: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-nav.pill-go .nav-pill, .mobile-nav button { transition: none; }
}

/* Desktop: the frame's 12px corner where the canvas starts, drawn as a fine line with a soft inner shade along the top and left
   edges, as in Operations and Recruit (it sits over the canvas and takes no clicks). */
@media (min-width: 701px) {
  .app::before { content: ''; position: absolute; top: 56px; left: 252px; right: 0; bottom: 0; z-index: 7; pointer-events: none;
    border-top-left-radius: 12px; box-shadow: inset 1px 1px 0 rgba(0, 0, 0, .06), inset 10px 10px 20px -12px rgba(16, 32, 28, .16); }
  :root:is([data-theme="dark"], [data-theme="green"]) .app::before { box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .11), inset 10px 10px 20px -12px rgba(0, 0, 0, .6); }
}

/* + New beside your photo, Settings opened from your photo, three tabs (Aidan, 11/27). On the phone the top bar reads search · mark ·
   + New · photo, and the tab bar keeps Chats, Teams and Assistant, evenly spaced. Settings opens as a sheet over the chats, as
   My Cairn's Account does: × closes its main screen, its pages go back. On desktop + New sits in the top bar beside your photo
   (it replaces the + beside the Chats title), and Settings stays in the sidebar. Announcements is where it was: the first card on Teams. */
@media (max-width: 700px) {
  .sidebar-head { grid-template-columns: 40px 40px minmax(0, 1fr) 40px 40px; gap: 8px; }
  .sidebar-head .top-search { grid-column: 1; }
  .sidebar-head .brand { grid-column: 3; }
  .sidebar-head .top-new { display: grid; place-items: center; grid-column: 4; grid-row: 1; width: 40px; height: 40px; min-width: 0; min-height: 0; margin: 0; padding: 0;
    border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--text); }
  .sidebar-head .top-new .icon { width: 20px; height: 20px; stroke-width: 2; }
  .sidebar-head #account { grid-column: 5; min-width: 0; min-height: 0; height: 40px; }
  .mobile-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .app.settings-open .mobile-nav { display: none; }
  .app.settings-open .settings-pane { position: fixed; inset: calc(var(--inset-top) + 12px) 0 0 0; z-index: 30; border-radius: 22px 22px 0 0;
    box-shadow: 0 0 0 100vmax var(--overlay-shade), 0 -6px 24px rgba(0, 0, 0, .12); overflow: hidden; animation: sheet-up .3s cubic-bezier(.32, .72, 0, 1); }
  .app.settings-open .settings-header { padding-top: 16px; border-radius: 22px 22px 0 0; }
  .settings-header #close-account.is-root { visibility: visible; grid-column: 3; grid-row: 1; }
  .settings-header #settings-title { grid-column: 2; grid-row: 1; }
  .settings-body { padding-bottom: calc(24px + var(--inset-bottom)); }
}
@media (max-width: 700px) and (prefers-reduced-motion: reduce) { .app.settings-open .settings-pane { animation: none; } }
@media (min-width: 701px) {
  .inbox-heading #new-message { display: none; }
  .suite-new { flex-shrink: 0; border-radius: 50%; width: 30px; height: 30px; min-width: 0; min-height: 0; margin-left: 2px; }
  .suite-new .icon { width: 16px; height: 16px; stroke-width: 2; }
}

/* The ghost page (11/27): nothing to show draws a faint, still outline of the list, as inset cards inside the page's gutters, with the
   message and the main action centred over it. No sample data and no motion. The ghosts take the look's own colours. */
.inbox-empty.ghost-page { position: relative; display: block; min-height: 380px; padding: 0; gap: 0; text-align: center; }
.ghost-rows { display: flex; flex-direction: column; pointer-events: none; opacity: .6;
  -webkit-mask-image: linear-gradient(#000, rgba(0, 0, 0, .35) 70%, transparent); mask-image: linear-gradient(#000, rgba(0, 0, 0, .35) 70%, transparent); }
.ghost-row { display: flex; align-items: center; gap: 13px; width: calc(100% - 20px); min-height: 84px; margin: 3px 10px; padding: 14px;
  border-radius: var(--r-md); background: var(--surface); }
.ghost-dot { flex-shrink: 0; width: 47px; height: 47px; border-radius: 50%; background: var(--pale-sunk); }
.ghost-lines { display: grid; gap: 10px; flex: 1; }
.ghost-bar { display: block; height: 10px; border-radius: 5px; background: var(--pale-sunk); }
.ghost-bar.ghost-name { height: 12px; }
.ghost-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; }
.ghost-msg strong { font-size: var(--t-lg); font-weight: 700; color: var(--text); }
.ghost-msg span { max-width: 300px; font-size: var(--t-sm); color: var(--quiet); }
.ghost-action { margin-top: 6px; min-height: 44px; padding: 0 20px; border-radius: 999px; background: linear-gradient(145deg, var(--green-lift), var(--button-green)); color: var(--on-ink); font-weight: 650; }
.view-groups .room-list > .inbox-empty.ghost-page { grid-column: 1 / -1; }
.view-groups .room-list > .ghost-page .ghost-row { width: 100%; margin: 3px 0; }

/* Phone top bars (Aidan's iPhone, 11/27): the buttons sit in the middle of the bar, with the same room above and below them; the
   bar is the safe area at the top, then 10px, the 40px buttons and 10px. */
@media (max-width: 700px) {
  .sidebar-head { min-height: 0; padding: calc(var(--inset-top) + 10px) 16px 10px; align-items: center; }
  .chat-head { min-height: 0; padding: calc(var(--inset-top) + 10px) 12px 10px; align-items: center; }
  .sidebar-head .top-search, .chat-head .head-button { min-width: 0; min-height: 0; width: 40px; height: 40px; }
}
