/* Parley desk — light, dark and system themes.
   Theme is chosen by html[data-theme]; without it the OS preference wins. */

:root {
  color-scheme: light;
  --canvas: #f3f5f6;
  --surface: #ffffff;
  --sunken: #eef1f2;
  --hover: #f1f4f4;
  --selected: #e6f1ed;
  --line: #e1e6e8;
  --line-strong: #cfd7da;
  --ink: #13171a;
  --ink-2: #333b40;
  --muted: #5d686e;
  --faint: #8a959a;

  --accent: #0f5c4d;
  --accent-hover: #0b4a3e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ec;
  --accent-text: #0f5c4d;

  --out-bg: #0f5c4d;
  --out-ink: #f2fbf8;
  --out-under: #0b4a3e;
  --out-under-ink: #bfe6da;
  --in-under: #f3f6f6;

  --warn-bg: #fdf3e1;
  --warn-ink: #7a4b0c;
  --warn-dot: #d48a1c;
  --good-dot: #1f9d6c;
  --good-ink: #17784f;
  --bad: #b4352a;
  --bad-soft: #fbe9e7;

  --code-bg: #12181a;
  --code-ink: #d8e6e1;

  --brand-bg: #0b2e28;
  --brand-ink: #eef7f3;

  --shadow-sm: 0 1px 2px rgba(16, 24, 22, 0.06);
  --shadow-lg: 0 18px 50px -12px rgba(12, 40, 34, 0.18);
  --focus: 0 0 0 3px rgba(15, 92, 77, 0.25);
  --avatar-l: 88%;
  --avatar-c: 0.07;
  --avatar-ink-l: 34%;

  --font: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --side: 236px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --canvas: #0e1214;
    --surface: #151a1d;
    --sunken: #111618;
    --hover: #1b2124;
    --selected: #17302a;
    --line: #242c30;
    --line-strong: #323c41;
    --ink: #e7eeec;
    --ink-2: #c4cfcc;
    --muted: #93a09c;
    --faint: #6c7975;
    --accent: #45c6a5;
    --accent-hover: #5fd6b7;
    --accent-ink: #062520;
    --accent-soft: #163a32;
    --accent-text: #6fd8bc;
    --out-bg: #13463c;
    --out-ink: #e9f8f3;
    --out-under: #0f3a31;
    --out-under-ink: #9fd9c8;
    --in-under: #11171a;
    --warn-bg: #2e2412;
    --warn-ink: #f0c983;
    --warn-dot: #e7a43c;
    --good-dot: #3fcf93;
    --good-ink: #5cd6a2;
    --bad: #f07a6d;
    --bad-soft: #3a1d1a;
    --code-bg: #0a0e10;
    --code-ink: #cfe3dc;
    --brand-bg: #0a1a17;
    --brand-ink: #e6f3ee;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
    --focus: 0 0 0 3px rgba(69, 198, 165, 0.3);
    --avatar-l: 34%;
    --avatar-c: 0.06;
    --avatar-ink-l: 88%;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0e1214;
  --surface: #151a1d;
  --sunken: #111618;
  --hover: #1b2124;
  --selected: #17302a;
  --line: #242c30;
  --line-strong: #323c41;
  --ink: #e7eeec;
  --ink-2: #c4cfcc;
  --muted: #93a09c;
  --faint: #6c7975;
  --accent: #45c6a5;
  --accent-hover: #5fd6b7;
  --accent-ink: #062520;
  --accent-soft: #163a32;
  --accent-text: #6fd8bc;
  --out-bg: #13463c;
  --out-ink: #e9f8f3;
  --out-under: #0f3a31;
  --out-under-ink: #9fd9c8;
  --in-under: #11171a;
  --warn-bg: #2e2412;
  --warn-ink: #f0c983;
  --warn-dot: #e7a43c;
  --good-dot: #3fcf93;
  --good-ink: #5cd6a2;
  --bad: #f07a6d;
  --bad-soft: #3a1d1a;
  --code-bg: #0a0e10;
  --code-ink: #cfe3dc;
  --brand-bg: #0a1a17;
  --brand-ink: #e6f3ee;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
  --focus: 0 0 0 3px rgba(69, 198, 165, 0.3);
  --avatar-l: 34%;
  --avatar-c: 0.06;
  --avatar-ink-l: 88%;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }

.icon { width: 18px; height: 18px; display: inline-grid; place-items: center; flex: none; }
.icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Form controls ---------- */
label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--focus); }
input[readonly] { background: var(--sunken); color: var(--ink-2); font-family: var(--mono); font-size: 12.5px; }
input:disabled, select:disabled { opacity: 0.55; cursor: not-allowed; }
select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a959a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}
textarea { resize: none; line-height: 1.5; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 9px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--accent-hover); }
.btn .icon { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--hover); border-color: var(--faint); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.danger { background: transparent; color: var(--bad); border-color: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.icon-only { padding: 7px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--accent); }
.btn.full { width: 100%; margin-top: 18px; padding: 11px 14px; }

/* ---------- Avatars ---------- */
.avatar {
  --h: 160;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: oklch(var(--avatar-l) var(--avatar-c) var(--h));
  color: oklch(var(--avatar-ink-l) 0.09 var(--h));
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }

/* ---------- Sign-in ---------- */
.gate { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
.gate-brand {
  position: relative;
  overflow: hidden;
  padding: 44px 56px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  color: var(--brand-ink);
  background: var(--brand-bg);
}
.gate-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(160deg, #000 10%, transparent 70%);
  pointer-events: none;
}
.gate-brand > * { position: relative; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: inherit; text-decoration: none; }
.logo svg { width: 30px; height: 30px; flex: none; }
.gate-copy { margin-top: auto; max-width: 520px; }
.gate-brand h1 {
  font-size: clamp(40px, 4.6vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin: 0 0 18px;
}
.gate-brand .lede { font-size: 17px; line-height: 1.55; color: rgba(230, 243, 238, 0.74); margin: 0; max-width: 42ch; }
.gate-demo { display: grid; gap: 10px; max-width: 440px; }
.demo-msg {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 14px;
  backdrop-filter: blur(6px);
}
.demo-msg.right { justify-self: end; background: #e6f6f0; color: #0b2e28; border-color: transparent; }
.demo-msg .said { font-size: 15px; margin: 0; }
.demo-msg .heard {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  font-size: 13.5px;
  color: rgba(230, 243, 238, 0.7);
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.demo-msg.right .heard { border-top-color: rgba(11, 46, 40, 0.2); color: #2d5a50; }
.demo-msg .heard .tag { background: rgba(255, 255, 255, 0.1); color: inherit; }
.demo-msg.right .heard .tag { background: rgba(11, 46, 40, 0.08); }
.demo-who { font-size: 12px; color: rgba(230, 243, 238, 0.55); margin: 0 4px; }
.demo-who.right { justify-self: end; }
.gate-foot { display: flex; gap: 28px; flex-wrap: wrap; font-size: 13px; color: rgba(230, 243, 238, 0.6); margin: 0; }
.gate-foot b { color: var(--brand-ink); font-weight: 600; }

.gate-card { display: flex; align-items: center; justify-content: center; padding: 40px 32px; position: relative; }
.gate-card .theme-switch { position: absolute; top: 20px; right: 20px; }
.card { width: min(400px, 100%); }
.card h2 { font-size: 28px; letter-spacing: -0.03em; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 8px; line-height: 1.55; max-width: 60ch; }
.error { color: var(--bad); min-height: 1.4em; margin: 10px 0 0; font-size: 13px; }
.demos-title { margin: 28px 0 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.demos-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demos { display: grid; gap: 6px; }
.demo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  transition: border-color 120ms ease, background 120ms ease;
}
.demo:hover { border-color: var(--accent); background: var(--hover); }
.demo strong { display: block; font-weight: 600; }
.demo span.note { display: block; color: var(--muted); font-size: 12.5px; }
.demo .go { margin-left: auto; color: var(--faint); }
.demo:hover .go { color: var(--accent-text); }

/* ---------- Shell ---------- */
.shell { height: 100%; min-height: 0; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  height: 100vh;
  height: 100dvh;
  position: sticky;
  top: 0;
  min-height: 0;
}
.rail .logo { color: var(--ink); padding: 2px 8px 18px; }
.nav-group { display: grid; gap: 2px; }
.nav {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.nav:hover { background: var(--hover); color: var(--ink); }
.nav.active { background: var(--selected); color: var(--accent-text); }
.nav .count { margin-left: auto; }
.nav-label { font-size: 12px; color: var(--faint); padding: 18px 10px 6px; }
.rail-spacer { flex: 1; }
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 2px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}
.me-text { min-width: 0; flex: 1; }
.me-text strong { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { display: block; font-size: 12px; color: var(--muted); }

.theme-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--sunken);
  border: 1px solid var(--line);
}
.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--faint);
  border-radius: 7px;
  padding: 5px 9px;
  display: inline-grid;
  place-items: center;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.theme-switch .icon { width: 16px; height: 16px; }
.rail .theme-switch { display: flex; width: 100%; }
.rail .theme-switch button { flex: 1; }

.stage { padding: 20px 24px 24px; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 22px; letter-spacing: -0.025em; }
.crumbs { color: var(--muted); margin: 2px 0 0; font-size: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chips select { width: auto; min-width: 180px; padding-top: 7px; padding-bottom: 7px; box-shadow: var(--shadow-sm); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 11px 5px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.chip.good::before { background: var(--good-dot); box-shadow: 0 0 0 3px color-mix(in oklab, var(--good-dot) 22%, transparent); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.chip.warn::before { background: var(--warn-dot); }
a.chip:hover { border-color: var(--line-strong); }

/* ---------- Surfaces ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  min-height: 0;
  box-shadow: var(--shadow-sm);
}
.empty { color: var(--muted); padding: 28px 20px; line-height: 1.55; margin: 0; }
.empty-state { margin: auto; text-align: center; padding: 40px 24px; max-width: 340px; color: var(--muted); }
.empty-state .icon { width: 40px; height: 40px; color: var(--faint); margin-bottom: 12px; }
.empty-state .icon svg { stroke-width: 1.3; }
.empty-state strong { display: block; color: var(--ink); font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.quiet { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--sunken);
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* ---------- Inbox ---------- */
.inbox {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 352px minmax(0, 1fr) 300px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.inbox > .panel { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.inbox > .convos { border-right: 1px solid var(--line); }
.inbox > .dossier { border-left: 1px solid var(--line); background: var(--sunken); }
.convos, .thread, .dossier { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

.panel-head { padding: 14px 14px 10px; display: flex; gap: 8px; align-items: center; }
.panel-head strong { font-weight: 600; flex: 1; }
.search { position: relative; flex: 1; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search input { padding-left: 34px; background: var(--sunken); border-color: transparent; }
.search input:hover { border-color: var(--line-strong); }
.search input:focus { background: var(--surface); }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font: 500 11px var(--font); color: var(--faint);
  border: 1px solid var(--line-strong); border-radius: 5px; padding: 0 5px;
  pointer-events: none;
}
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
.list { overflow: auto; padding: 4px 8px 8px; flex: 1; }
.convo {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: var(--r);
  padding: 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1px 12px;
  align-items: center;
  position: relative;
  transition: background 120ms ease;
}
.convo + .convo { margin-top: 2px; }
.convo:hover { background: var(--hover); }
.convo.active { background: var(--selected); }
.convo .avatar { grid-row: span 2; align-self: start; margin-top: 1px; }
.convo .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .when { color: var(--faint); font-size: 12px; justify-self: end; }
.convo .line2 { display: flex; gap: 8px; align-items: center; min-width: 0; grid-column: 2; }
.convo .snippet { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.convo .tail { grid-column: 3; justify-self: end; }
.convo.unread .name { color: var(--ink); }
.convo.unread .snippet { color: var(--ink-2); }
.convo.active .tag { background: var(--surface); }
.badge {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  min-width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
}

.thread-head, .dossier-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 65px;
}
.thread-head .who { flex: 1; min-width: 0; }
.thread-head h2 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head p { color: var(--muted); margin: 1px 0 0; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lang-flow { display: inline-flex; align-items: center; gap: 4px; }
.lang-flow .icon { width: 13px; height: 13px; color: var(--faint); }
.thread-head .actions-top { display: flex; gap: 4px; }
.dossier-head h2 { font-size: 15px; flex: 1; }

.scroll {
  overflow: auto;
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in oklab, var(--line) 70%, transparent) 1px, transparent 0) 0 0 / 20px 20px,
    var(--canvas);
}
.day { align-self: center; font-size: 12px; color: var(--faint); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }

/* The bilingual bubble: your language on top, the other language underneath. */
.bubble { max-width: min(560px, 86%); display: grid; gap: 5px; }
.bubble.in { align-self: flex-start; }
.bubble.out { align-self: flex-end; justify-items: end; }
.sheet {
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 180px;
}
.bubble.in .sheet { border-top-left-radius: 5px; }
.bubble.out .sheet { border-top-right-radius: 5px; background: var(--out-bg); border-color: transparent; color: var(--out-ink); }
.sheet .primary { margin: 0; padding: 11px 14px 12px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.under {
  display: flex;
  gap: 9px;
  align-items: baseline;
  padding: 9px 14px 10px;
  background: var(--in-under);
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.under p { margin: 0; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.out .under { background: var(--out-under); border-top-color: rgba(255, 255, 255, 0.08); color: var(--out-under-ink); }
.bubble.out .under .tag { background: rgba(255, 255, 255, 0.12); color: var(--out-ink); }
.flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 14px 12px;
  color: var(--warn-ink);
  background: var(--warn-bg);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
}
.meta { color: var(--faint); font-size: 12px; display: flex; gap: 6px; align-items: center; padding: 0 4px; }
.meta .icon { width: 14px; height: 14px; }
.status-held { color: var(--warn-ink); }
.status-failed { color: var(--bad); }
.status-sent, .status-delivered, .status-read { color: var(--good-ink); }

.composer { flex-shrink: 0; border-top: 1px solid var(--line); padding: 12px 16px 14px; display: grid; gap: 10px; background: var(--surface); }
.warn-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.45;
}
.warn-line .icon { width: 16px; height: 16px; margin-top: 1px; }
.warn-line a { color: inherit; font-weight: 600; }
.compose-box {
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.compose-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.compose-box textarea { border: 0; box-shadow: none; background: transparent; padding: 12px 14px 6px; min-height: 64px; max-height: 200px; }
.compose-box textarea:focus { box-shadow: none; }
.xlate {
  display: flex;
  gap: 9px;
  align-items: baseline;
  margin: 0 8px;
  padding: 9px 6px;
  border-top: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
  min-height: 38px;
}
.xlate p { margin: 0; flex: 1; }
.xlate.live p { color: var(--ink-2); }
.composer-bar { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 8px 8px; }
.composer-bar .quiet { margin: 0 0 0 6px; font-size: 12px; }
kbd.k { font: 500 11px var(--font); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--muted); }

.dossier { overflow: auto; }
.dossier .block { padding: 4px 16px 0; }
.dossier .block label:first-child { margin-top: 12px; }
.dossier .quiet { font-size: 12.5px; }
.dossier .actions { margin-top: 16px; }
.facts { margin: 18px 16px 16px; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.fact { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.fact .icon { width: 16px; height: 16px; color: var(--faint); margin-top: 2px; }
.fact.ok .icon { color: var(--good-ink); }
.fact.off .icon { color: var(--warn-dot); }
.back, .details-toggle, .dossier-close { display: none; }

/* ---------- Attachments ---------- */
.thread { position: relative; }
.bar-left { display: flex; align-items: center; gap: 4px; min-width: 0; }
.bar-left .btn.icon-only { color: var(--muted); }
.bar-left .btn.icon-only:hover { color: var(--accent-text); }
.bar-left .icon { width: 18px; height: 18px; }
.tray { padding: 10px 10px 0; }
.tray[hidden] { display: none; }
.att {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 8px;
  border-radius: var(--r-sm);
  background: var(--sunken);
  border: 1px solid var(--line);
  max-width: 420px;
}
.att.bad { background: var(--bad-soft); border-color: transparent; }
.att .thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface); }
.file-glyph {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 44px;
  flex: none;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.file-glyph .icon { width: 22px; height: 22px; }
.file-glyph .ext {
  position: absolute;
  bottom: 4px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.4;
}
.file-glyph:has(.ext) .icon { transform: translateY(-5px); }
.att-text { min-width: 0; flex: 1; display: grid; gap: 4px; }
.att-text strong { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-text .quiet { margin: 0; font-size: 12px; }
.att-error { color: var(--bad); font-size: 12.5px; line-height: 1.4; }
.progress { display: block; height: 4px; border-radius: 99px; background: var(--line-strong); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 120ms linear; }

.drop-hint {
  position: absolute;
  inset: 8px;
  border: 2px dashed var(--accent);
  border-radius: var(--r);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(2px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  z-index: 5;
  pointer-events: none;
}
.drop-hint .icon { width: 30px; height: 30px; color: var(--accent-text); }
.drop-hint strong { color: var(--ink); font-size: 15px; font-weight: 600; }
.thread.dropping .drop-hint { display: flex; }

/* Media inside a bubble */
.sheet.has-media { min-width: 0; }
.media-photo {
  display: block;
  padding: 0;
  border: 0;
  background: var(--sunken);
  cursor: zoom-in;
  width: 100%;
  line-height: 0;
}
.media-photo img { display: block; width: 100%; max-width: 340px; max-height: 360px; min-height: 80px; object-fit: cover; }
.bubble.out .media-photo { background: var(--out-under); }
.media-photo.sticker { background: transparent; cursor: default; }
.media-photo.sticker img { width: 140px; max-height: 140px; object-fit: contain; min-height: 0; }
.media-video { display: block; width: 340px; max-width: 100%; max-height: 360px; background: #000; }
.media-audio { display: block; width: 300px; max-width: calc(100% - 20px); margin: 10px; height: 40px; }
.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  min-width: 240px;
  max-width: 340px;
  color: inherit;
  text-decoration: none;
  transition: background 120ms ease;
}
a.file-card:hover { background: var(--hover); }
.bubble.out a.file-card:hover { background: var(--out-under); }
.bubble.out .file-glyph { background: rgba(255, 255, 255, 0.14); color: var(--out-ink); }
.bubble.out .file-glyph .ext { background: var(--out-ink); color: var(--out-bg); }
.file-text { min-width: 0; flex: 1; display: grid; }
.file-text strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-text span { font-size: 12.5px; color: var(--muted); }
.bubble.out .file-text span { color: var(--out-under-ink); }
.file-dl { color: var(--faint); display: inline-grid; }
.bubble.out .file-dl { color: var(--out-under-ink); }
.file-card.missing .file-glyph { background: var(--sunken); color: var(--faint); }
.file-card.missing .file-text span { white-space: normal; }
.sheet.has-media > .primary { padding-top: 10px; }
.sheet.has-media > .flag { margin-top: 10px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 12, 12, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 16px 24px;
  animation: rise 160ms ease both;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.lightbox-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px 10px 20px;
  color: #e9f1ee;
  font-weight: 500;
}
.lightbox-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox-bar .btn { color: #e9f1ee; }
.lightbox-bar .btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ---------- Team: views, notes, quick replies, templates ---------- */
:root { --note-bg: #fff6dc; --note-line: #f0dca0; --note-ink: #5c4511; --hot: #d9622b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --note-bg: #2a2412; --note-line: #4a3d17; --note-ink: #f1d99a; --hot: #f08a52; } }
:root[data-theme="dark"] { --note-bg: #2a2412; --note-line: #4a3d17; --note-ink: #f1d99a; --hot: #f08a52; }

button.nav { border: 0; background: transparent; width: 100%; text-align: left; font: inherit; font-weight: 500; }
.nav.alerts.on .icon { color: var(--accent-text); }
[hidden] { display: none !important; }

.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.empty { background: var(--sunken); color: var(--faint); border: 1px dashed var(--line-strong); }
.avatar.empty .icon { width: 14px; height: 14px; }

.convos .panel-head { flex-wrap: wrap; }
.person-filter { width: auto; max-width: 132px; padding: 8px 30px 8px 10px; font-size: 13px; background-color: var(--sunken); border-color: transparent; }
.views {
  display: flex;
  gap: 2px;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  row-gap: 4px;
}
.view-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 7px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.view-tab:hover { color: var(--ink); background: var(--hover); }
.view-tab.active { color: var(--ink); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.view-tab .n { font-size: 11px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.view-tab .n.hot { color: var(--hot); }
.list { padding-top: 6px; }
.scroll > * { flex-shrink: 0; }
.search { min-width: 0; flex: 1 1 170px; }
.convos .person-filter { flex: 1 1 110px; max-width: none; }
.panel-head:has(.person-filter) .search kbd { display: none; }
.convo .tail { display: inline-flex; align-items: center; gap: 6px; }
.convo.waiting .when { color: var(--hot); font-weight: 600; }

/* Composer modes */
.mode-tabs { display: flex; gap: 4px; margin-bottom: -2px; }
.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 7px;
}
.mode-tab .icon { width: 15px; height: 15px; }
.mode-tab:hover { color: var(--ink); background: var(--hover); }
.mode-tab.active { color: var(--accent-text); background: var(--accent-soft); }
.note-mode .mode-tab.active { color: var(--note-ink); background: var(--note-bg); }
.note-mode .compose-box { background: var(--note-bg); border-color: var(--note-line); }
.note-mode .compose-box:focus-within { border-color: var(--warn-dot); box-shadow: 0 0 0 3px color-mix(in oklab, var(--warn-dot) 25%, transparent); }
.note-mode .compose-box textarea { color: var(--note-ink); }
.note-mode .btn#send { background: var(--note-ink); color: var(--note-bg); }
.compose-box { position: relative; }
.btn.attention { color: var(--hot) !important; }

/* Quick replies popover */
.quick-pop {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  z-index: 8;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  max-height: 320px;
  overflow: auto;
}
.quick-title { margin: 4px 8px 6px; font-size: 12px; color: var(--faint); }
.quick-empty { margin: 8px; color: var(--muted); font-size: 13px; }
.quick-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  display: grid;
  gap: 1px;
}
.quick-item strong { font-weight: 600; font-size: 13px; }
.quick-item span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-item:hover, .quick-item.active { background: var(--selected); }

/* Timeline extras */
.meta .by { font-weight: 600; color: var(--muted); }
.tpl-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 14px 0;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}
.tpl-label .icon { width: 14px; height: 14px; }
.event {
  align-self: center;
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  max-width: 92%;
  text-align: center;
}
.event time, .note-head time { color: var(--faint); font-size: 11.5px; }
.note-card {
  align-self: center;
  width: min(520px, 94%);
  background: var(--note-bg);
  border: 1px solid var(--note-line);
  border-radius: var(--r);
  color: var(--note-ink);
  overflow: hidden;
}
.note-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 0 12px; font-size: 12.5px; }
.note-head .icon { width: 15px; height: 15px; }
.note-head > span:not(.icon) { flex: 1; min-width: 0; }
.note-head strong { font-weight: 600; }
.note-del { padding: 4px !important; color: inherit !important; opacity: 0.6; }
.note-del:hover { opacity: 1; background: rgba(0, 0, 0, 0.06) !important; }
.note-del .icon { width: 14px; height: 14px; }
.note-body { margin: 0; padding: 6px 14px 11px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-card .under { background: transparent; border-top: 1px dashed var(--note-line); color: inherit; opacity: 0.8; }
.note-card .under .tag { background: rgba(0, 0, 0, 0.06); color: inherit; }

/* Guest details: who has it */
.owner-card { display: flex; align-items: center; gap: 10px; margin: 14px 16px 0; padding: 10px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.owner-text { display: grid; min-width: 0; }
.owner-text strong { font-weight: 600; font-size: 13.5px; }
.owner-text span { font-size: 12px; color: var(--muted); }
.quick-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px 2px; }

/* Template dialog */
.dlg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 14, 13, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: rise 140ms ease both;
}
.dlg {
  width: min(560px, 100%);
  max-height: min(720px, calc(100dvh - 32px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.dlg-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 18px 12px 22px; border-bottom: 1px solid var(--line); }
.dlg-head > div { flex: 1; }
.dlg-head h2 { font-size: 17px; }
.dlg-body { padding: 14px 22px 22px; overflow: auto; }
.tpl-list { display: grid; gap: 8px; }
.tpl-item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 11px 13px;
  display: grid;
  gap: 4px;
  transition: border-color 120ms ease, background 120ms ease;
}
.tpl-item:hover:not(:disabled) { border-color: var(--accent); background: var(--hover); }
.tpl-item:disabled { opacity: 0.55; cursor: not-allowed; }
.tpl-top { display: flex; gap: 8px; align-items: center; }
.tpl-top strong { font-weight: 600; text-transform: capitalize; }
.tpl-top .quiet { margin: 0 0 0 auto; font-size: 12px; text-transform: capitalize; }
.tag.match { background: var(--accent-soft); color: var(--accent-text); }
.tpl-text { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-name { font-size: 16px; margin: 12px 0 2px; text-transform: capitalize; }
.tpl-preview { margin: 0; white-space: pre-wrap; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; line-height: 1.5; }

/* People editor */
.checks { display: grid; gap: 6px; }
.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-weight: 500;
  color: var(--ink) !important;
  cursor: pointer;
}
.check-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.check-row .quiet { margin: 0 0 0 auto; }
.role-help { margin: 8px 0 0; }
.editor textarea { min-height: 120px; resize: vertical; }

/* Meta onboarding steps on a line */
.ob { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; max-width: 640px; }
.ob-step { display: flex; gap: 12px; align-items: flex-start; }
.ob-dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none; margin-top: 1px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); color: var(--muted);
}
.ob-dot .icon { width: 13px; height: 13px; }
.ob-dot .icon svg { stroke-width: 2.4; }
.ob-step.done .ob-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ob-step.warn .ob-dot { background: var(--warn-bg); border-color: var(--warn-dot); color: var(--warn-ink); }
.ob-text { display: grid; gap: 1px; min-width: 0; }
.ob-text strong { font-weight: 600; font-size: 13.5px; }
.ob-text span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.ob-step.warn .ob-text span { color: var(--warn-ink); }
.section.onboarding { margin-top: 18px; padding-top: 18px; margin-bottom: 8px; }
.hint-box {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 12px 0 4px; padding: 12px 14px; max-width: 640px;
  border-radius: var(--r); background: var(--accent-soft); color: var(--ink-2);
}
.hint-box .icon { color: var(--accent-text); margin-top: 2px; }
.hint-box strong { font-weight: 600; font-size: 13.5px; }
.hint-box p { margin: 2px 0 0; font-size: 13px; line-height: 1.5; }

/* ---------- Admin pages ---------- */
.page { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.page.single { grid-template-columns: minmax(0, 860px); }
.page:not(.single) { grid-template-columns: 300px minmax(0, 760px); }
.intro { max-width: 1076px; }
.menu { overflow: hidden; }
.menu .panel-head { border-bottom: 1px solid var(--line); padding: 12px 12px 12px 16px; }
.menu-list { padding: 6px; display: grid; gap: 2px; grid-template-columns: minmax(0, 1fr); }
.menu-item, .hook {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background 120ms ease;
}
.menu-item:hover, .hook:hover { background: var(--hover); }
.menu-item.active, .hook.active { background: var(--selected); }
.menu-item .text, .hook .text { min-width: 0; flex: 1; }
.menu-item strong, .hook strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item .quiet, .hook .quiet { margin: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hook .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good-dot); flex: none; }
.hook .dot.bad { background: var(--bad); }
.hook .dot.mid { background: var(--warn-dot); }

.editor { padding: 24px 28px 28px; }
.editor h2 { font-size: 20px; letter-spacing: -0.02em; }
.editor-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.editor .sub { margin-bottom: 4px; }
.editor .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; max-width: 640px; }
.editor .grid > .wide { grid-column: 1 / -1; }
.section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.section:first-of-type { margin-top: 20px; }
.section h3 { font-size: 15px; letter-spacing: -0.01em; }
.section > .sub { font-size: 13px; }
.actions { display: flex; gap: 8px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
.actions .push { margin-left: auto; }

.intro { padding: 22px 24px; margin-bottom: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: end; }
.intro .text { max-width: 60ch; }
.intro h2 { font-size: 17px; }
.intro .controls { display: flex; gap: 8px; align-items: flex-end; }
.intro .controls label { margin-top: 0; }
.intro .controls select { min-width: 200px; }
.intro .quiet { grid-column: 1 / -1; }

/* Setup checklist — a real sequence, so it is numbered. */
.check {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}
.check a {
  text-decoration: none;
  color: inherit;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 12px;
  align-items: center;
  background: var(--surface);
  transition: background 120ms ease;
}
.check a:hover { background: var(--hover); }
.check .step {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--line-strong); color: var(--muted);
  grid-row: span 2;
}
.check a.done .step { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check .step .icon { width: 14px; height: 14px; }
.check .step .icon svg { stroke-width: 2.4; }
.check strong { font-size: 12px; font-weight: 600; color: var(--warn-ink); }
.check a.done strong { color: var(--good-ink); }
.check span.label { font-size: 13px; color: var(--ink-2); line-height: 1.35; }

.payload {
  margin: 12px 0 0;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--r);
  padding: 16px 18px;
  overflow: auto;
  max-height: 420px;
  font: 12.5px/1.6 var(--mono);
  border: 1px solid var(--line);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* One orchestrated moment on sign-in: the guest's words are interpreted. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { opacity: 0; max-height: 0; padding-top: 0; margin-top: 0; } to { opacity: 1; max-height: 80px; } }
.gate-demo > * { animation: rise 500ms cubic-bezier(.2,.7,.2,1) both; }
.gate-demo > :nth-child(2) { animation-delay: 80ms; }
.gate-demo > :nth-child(3) { animation-delay: 1500ms; }
.gate-demo > :nth-child(4) { animation-delay: 1580ms; }
.gate-demo .heard { overflow: hidden; animation: reveal 600ms ease both; }
.gate-demo > :nth-child(2) .heard { animation-delay: 750ms; }
.gate-demo > :nth-child(4) .heard { animation-delay: 2200ms; }

/* ---------- Responsive ---------- */
.mobile-theme { display: none !important; }
@media (max-width: 1280px) {
  :root { --side: 72px; }
  .rail { padding: 16px 10px; align-items: center; }
  .rail .logo { padding: 2px 0 16px; }
  .rail .logo span, .nav span.label, .nav-label, .me-text, .nav .count { display: none; }
  .nav { justify-content: center; padding: 10px; position: relative; }
  .nav .icon { width: 20px; height: 20px; }
  .nav.has-unread::after { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
  .rail .theme-switch { flex-direction: column; width: auto; }
  .me { flex-direction: column; padding: 10px 0 0; border-top: 1px solid var(--line); }
}
@media (max-width: 1100px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox > .dossier { display: none; }
  .details-toggle, .dossier-close { display: inline-flex; }
  .inbox.dossier-open { grid-template-columns: minmax(0, 1fr) 300px; }
  .inbox.dossier-open > .convos { display: none; }
  .inbox.dossier-open > .dossier { display: flex; }
}
@media (max-width: 860px) {
  .gate { grid-template-columns: 1fr; }
  .gate-brand { padding: 24px 20px 28px; gap: 24px; }
  .gate-brand h1 { font-size: 36px; }
  .gate-copy { margin-top: 8px; }
  .gate-foot { display: none; }
  .gate-card { padding: 28px 16px 40px; align-items: flex-start; }
  .gate { position: relative; }
  .gate-card { position: static; }
  .gate-card .theme-switch { top: 18px; right: 16px; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); }
  .gate-card .theme-switch button { color: rgba(230, 243, 238, 0.6); }
  .gate-card .theme-switch button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; }
  .gate-demo { display: none; }

  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .rail {
    order: 2;
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    gap: 2px;
    overflow-x: auto;
  }
  .rail .logo, .rail-spacer, .me .avatar, .rail .theme-switch { display: none; }
  .nav-group { display: contents; }
  .nav { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 11px; min-width: 52px; }
  .nav span.label { display: block; }
  .me { border: 0; margin: 0; padding: 0; }
  .stage { padding: 14px 12px 12px; }
  .topbar { margin-bottom: 12px; gap: 10px; }
  .topbar h1 { font-size: 20px; }
  .chips { width: 100%; }
  .chips select { flex: 1; min-width: 0; }
  .mobile-theme { display: inline-flex !important; margin-left: auto; }
  .crumbs, .search kbd { display: none; }
  .stage:has(.inbox.show-thread) .topbar { display: none; }

  .inbox { grid-template-columns: 1fr; }
  .inbox > .convos { border-right: 0; }
  .inbox > .thread, .inbox > .dossier { display: none; }
  .inbox.show-thread > .convos { display: none; }
  .inbox.show-thread > .thread { display: flex; }
  .inbox.show-thread.dossier-open > .thread { display: none; }
  .inbox.show-thread.dossier-open > .dossier { display: flex; }
  .inbox.dossier-open { grid-template-columns: 1fr; }
  .back { display: inline-flex; }
  .scroll { padding: 16px 12px 12px; }
  .bubble { max-width: 92%; }
  .composer { padding: 10px; }
  .composer-bar .quiet { display: none; }
  .person-filter { max-width: none; flex: 1; }
  .nav.alerts span.label { display: none; }
  .note-head { flex-wrap: wrap; }
  .mode-tab { flex: 1; justify-content: center; }
  .composer-bar { justify-content: space-between; }

  .page, .page:not(.single) { grid-template-columns: 1fr; }
  .editor { padding: 20px 18px 22px; }
  .editor .grid { grid-template-columns: 1fr; }
  .intro { grid-template-columns: 1fr; }
  .intro .controls { flex-direction: column; align-items: stretch; }
  .check { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
