/* Harbour — interface styles.
 * Palette, type, and radii follow the cursor.com design language: a warm
 * paper background (#f7f7f4), warm near-black ink (#26251e / #14120b for
 * dark surfaces), hairline borders at ~8% ink, a grotesque sans for
 * everything, a mono for metadata, and an italic serif reserved for the
 * wordmark. Rounded rectangles throughout (10px cards, 8px buttons).
 * --tenant is the contrast-guarded org colour; --tenant-deco the org's true
 * colour for decorative use. Both default to Harbour neutrals. */

:root {
  /* core palette (cursor.com light theme) */
  --superior: #14120b;  /* deepest ink — dark surfaces (sidebar, hero, footer) */
  --harbour: #4a443b;   /* warm dark — links, hover states on dark */
  --slate: #77746b;     /* secondary text (~55% ink on paper) */
  --mist: #e7e5df;      /* hairlines, dividers (~8% ink on paper) */
  --fog: #f7f7f4;       /* app background — warm paper */
  --beacon: #c08532;    /* THE accent — cursor build-orange */
  /* functional (quiet, desaturated) */
  --ready: #34785c;
  --caution: #9a6a28;
  --signal: #a94f3d;
  --ink: #26251e;       /* primary body text */
  /* tenant slots (overridden per org in the page head) */
  --tenant: var(--ink);
  --tenant-deco: var(--ink);
  /* type */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  /* layout */
  --shadow: 0 1px 3px rgba(20, 18, 11, 0.07);
  --shadow-float: 0 14px 32px rgba(20, 18, 11, 0.10), 0 0 0 1px var(--mist);
  --radius-card: 10px;
  --radius-btn: 8px;
  /* derived (token mixes only) */
  --band: color-mix(in srgb, var(--mist) 45%, var(--fog));
  --sidebar-text: color-mix(in srgb, var(--fog) 80%, transparent);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--fog);
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--harbour); text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent); }
a:hover { color: var(--ink); }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.01em; }
strong, b, th { font-weight: 600; }

/* §9 focus floor */
:focus-visible { outline: 2px solid var(--harbour); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--harbour); outline-offset: 2px; border-color: var(--mist); }

/* §6.2 motion */
@media (prefers-reduced-motion: no-preference) {
  a, button, .btn, .icon-btn, .copy-btn, .source-chip, .starter, .conversation-item { transition: background-color 180ms ease-out, color 180ms ease-out, border-color 180ms ease-out, box-shadow 180ms ease-out, opacity 180ms ease-out; }
}

/* ---------- Type scale (§3.1) ---------- */
.display { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.2; font-weight: 550; letter-spacing: -0.02em; color: var(--superior); }
.micro, .message-eyebrow, .sources-label, .composer-hint, .table thead th {
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.4; font-weight: 400;
}

/* ---------- Shell (§5.1) ---------- */
/* dvh keeps the composer visible above the iOS keyboard; vh is the fallback. */
.shell { display: flex; height: 100vh; height: 100dvh; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.sidebar {
  width: 264px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--superior); color: var(--sidebar-text);
  padding: 16px 12px; overflow-y: auto;
}
.btn-sidebar {
  display: block; width: 100%; text-align: left;
  background: transparent; color: var(--fog);
  border: 1px solid color-mix(in srgb, var(--fog) 25%, transparent);
  border-radius: var(--radius-btn); padding: 8px 12px;
  font: 500 0.875rem/1.5 var(--font-body); cursor: pointer;
}
.btn-sidebar:hover { background: var(--harbour); border-color: var(--harbour); }

.sidebar-search {
  margin-top: 12px; background: color-mix(in srgb, var(--fog) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--fog) 20%, transparent);
  color: var(--fog); font-size: 0.875rem; padding: 6px 10px;
}
.sidebar-search::placeholder { color: var(--slate); }
.conversation-snippet {
  display: block; font-size: 0.75rem; color: var(--slate);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-empty { color: var(--slate); font-size: 0.8125rem; padding: 8px 10px; }
.conversation-list { flex: 1; margin-top: 16px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.conversation-item { display: flex; align-items: center; border-radius: var(--radius-btn); border-left: 2px solid transparent; }
.conversation-item:hover { background: var(--harbour); }
.conversation-item.active { background: var(--harbour); border-left-color: var(--tenant-deco); }
.conversation-link {
  flex: 1; min-width: 0; display: block; padding: 7px 10px;
  text-decoration: none; color: var(--sidebar-text); font-size: 0.875rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conversation-item.active .conversation-link { color: var(--fog); }
.conversation-actions { display: none; padding-right: 6px; }
.conversation-item:hover .conversation-actions { display: flex; gap: 2px; }
.icon-btn {
  border: none; background: none; color: var(--sidebar-text); cursor: pointer;
  font-size: 0.85rem; padding: 2px 5px; border-radius: 4px;
}
.icon-btn:hover { color: var(--fog); background: var(--superior); }

.sidebar-foot {
  margin-top: 16px; padding: 12px 10px 4px;
  border-top: 1px solid color-mix(in srgb, var(--fog) 15%, transparent);
  display: flex; flex-direction: column; gap: 6px; font-size: 0.875rem;
}
.sidebar-foot a { color: var(--sidebar-text); text-decoration: none; }
.sidebar-foot a:hover { color: var(--fog); }
.sidebar-foot .powered { font-family: var(--font-mono); font-size: 0.75rem; color: var(--slate); margin-top: 6px; }
.sidebar-back { display: block; color: var(--sidebar-text); text-decoration: none; font-size: 0.875rem; padding: 6px 10px; }
.sidebar-back:hover { color: var(--fog); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; flex: 1; }
.sidebar-nav a {
  color: var(--sidebar-text); text-decoration: none; font-size: 0.875rem;
  padding: 8px 10px; border-radius: var(--radius-btn); border-left: 2px solid transparent;
}
.sidebar-nav a:hover { background: var(--harbour); color: var(--fog); }
.sidebar-nav a.active { background: var(--harbour); color: var(--fog); border-left-color: var(--tenant-deco); }

/* ---------- Top bar + waterline (§4, §5.1) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 12px 32px; background: var(--fog);
}
.topbar-org { display: flex; align-items: center; gap: 12px; min-width: 0; }
.org-logo { height: 28px; width: auto; }
.org-name { font-weight: 600; font-size: 1rem; color: var(--superior); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--slate); font-size: 0.875rem; }
.waterline {
  height: 2px; flex-shrink: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tenant-deco) 30%, transparent), transparent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: var(--radius-btn);
  border: 1px solid var(--mist); background: #fff; color: var(--ink);
  font: 500 0.9375rem/1.5 var(--font-body); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--slate); }
.btn-primary { background: var(--tenant); border-color: var(--tenant); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--tenant) 85%, var(--superior)); border-color: color-mix(in srgb, var(--tenant) 85%, var(--superior)); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-superior { background: var(--superior); border-color: var(--superior); color: var(--fog); }
.btn-superior:hover { background: var(--harbour); border-color: var(--harbour); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--slate); }
.btn-quiet:hover { color: var(--harbour); border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-stop { border-color: var(--signal); color: var(--signal); }
.btn-stop:hover { background: color-mix(in srgb, var(--signal) 8%, #fff); border-color: var(--signal); }
.btn-danger { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--signal) 85%, var(--superior)); border-color: color-mix(in srgb, var(--signal) 85%, var(--superior)); }

/* ---------- Confirm dialog (branded window.confirm replacement) ---------- */
.confirm-dialog {
  margin: auto; padding: 0; border: none; border-radius: var(--radius-card);
  background: #fff; box-shadow: var(--shadow-float); color: var(--ink);
  width: min(26rem, calc(100vw - 48px));
}
/* ::backdrop can't reliably read :root custom properties, so Superior Ink
 * is spelled out here (matches the shadow rgba values above). */
.confirm-dialog::backdrop { background: rgba(20, 18, 11, 0.4); }
.confirm-card { padding: 24px; }
.confirm-title {
  margin: 0 0 8px; font: 600 1.125rem/1.35 var(--font-body);
  letter-spacing: -0.01em; color: var(--superior);
}
.confirm-message { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--slate); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 20px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .confirm-dialog[open] { animation: dialog-settle 180ms ease-out; }
}
@keyframes dialog-settle { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Forms ---------- */
input, select, textarea {
  font: 400 1rem/1.5 var(--font-body); color: var(--ink);
  padding: 8px 12px; border: 1px solid var(--mist); border-radius: var(--radius-card);
  background: #fff; width: 100%;
}
input[type="color"] { padding: 2px; height: 38px; width: 80px; }
label.field { display: block; }
label.field > span { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 5px; }
label.field .muted { font-weight: 400; }
.stack > * + * { margin-top: 24px; }
.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-inline input[type="email"] { max-width: 320px; }
.form-inline select { width: auto; }
.form-row { display: flex; gap: 32px; }
.field-checkbox .checkbox-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--slate); font-size: 0.875rem; }
.field-checkbox input[type="checkbox"] { width: auto; margin-top: 3px; }

/* ---------- Cards, notices, pills, tables ---------- */
.page { width: 100%; max-width: 960px; margin: 0 auto; padding: 32px 32px 64px; overflow-y: auto; }
.page h1 { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.2; font-weight: 550; letter-spacing: -0.02em; color: var(--superior); margin: 8px 0 24px; }
.page h2 { font-size: 1.25rem; line-height: 1.35; font-weight: 600; margin: 0 0 12px; }
.card {
  background: #fff; border: 1px solid var(--mist); border-radius: var(--radius-card);
  padding: 24px; margin-bottom: 24px;
}
.muted { color: var(--slate); }
.small { font-size: 0.875rem; }

.notice { padding: 10px 14px; border-radius: var(--radius-card); font-size: 0.9375rem; background: #fff; border: 1px solid var(--mist); }
.notice-info { border-left: 2px solid var(--harbour); }
.notice-error { border-left: 2px solid var(--signal); color: var(--signal); }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 500; text-transform: capitalize;
}
.badge-active, .badge-ready { background: color-mix(in srgb, var(--ready) 12%, #fff); color: var(--ready); }
.badge-processing, .badge-invited { background: color-mix(in srgb, var(--slate) 12%, #fff); color: var(--slate); }
.badge-failed, .badge-disabled { background: color-mix(in srgb, var(--signal) 10%, #fff); color: var(--signal); }
@media (prefers-reduced-motion: no-preference) {
  .badge-processing { animation: pill-pulse 2.5s ease-in-out infinite; }
}
@keyframes pill-pulse { 50% { opacity: 0.55; } }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--mist); vertical-align: middle; font-size: 0.9375rem; }
.table thead th { text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate); font-weight: 400; }
.table tfoot th { border-bottom: none; }
.table .num, .invite-link { font-family: var(--font-mono); font-size: 0.8125rem; }
.invite-link { max-width: 260px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { text-align: center; margin-bottom: 0; }
.stat-value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 500; color: var(--superior); }
.stat-label { color: var(--slate); font-size: 0.8125rem; }

/* ---------- Upload dropzone (§5.5 “docking”) ---------- */
.dropzone {
  display: block;
  border: 1.5px dashed var(--mist); border-radius: var(--radius-card);
  background: var(--fog); padding: 32px 24px; text-align: center; cursor: pointer;
  color: var(--slate); font-size: 0.9375rem;
}
.dropzone.dragover { border-style: solid; border-color: var(--tenant); color: var(--ink); }
.dropzone input[type="file"] { display: none; }
.dropzone .dropzone-files { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink); margin-top: 8px; }

/* ---------- Chat canvas (§5.1, §5.2) ---------- */
.chat-main { background: var(--fog); }
.messages { flex: 1; overflow-y: auto; }
.transcript { max-width: 760px; margin: 0 auto; padding: 32px 24px 24px; }

.message { margin: 0 0 32px; position: relative; }
.message-eyebrow {
  display: flex; align-items: center; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate);
  margin-bottom: 6px;
}
.message-user {
  background: var(--band); border-radius: var(--radius-card);
  padding: 14px 18px; margin-left: -18px; margin-right: -18px;
}
.message-user .message-body { white-space: pre-wrap; }
.message-assistant .message-body { max-width: 68ch; }
.message-error .message-body { color: var(--signal); }
.message.thinking .message-body::after { content: '·'; color: var(--slate); }

/* §6.1 the Beacon */
.beacon-slot { display: inline-flex; width: 8px; justify-content: center; }
.beacon {
  width: 8px; height: 8px; border-radius: 999px; display: inline-block;
  background: var(--tenant-deco);
}
.beacon.breathing { animation: beacon-breathe 2.5s ease-in-out infinite; }
.beacon.settled { animation: beacon-settle 700ms ease-out forwards; }
@keyframes beacon-breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@keyframes beacon-settle { 0% { opacity: 1; } 45% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .beacon.breathing, .beacon.settled { animation: none; opacity: 1; }
  .badge-processing { animation: none; }
  * { transition-property: opacity !important; }
}

/* Grounding (§5.3) */
.message-sources { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--mist); display: none; }
.message-sources.visible { display: block; }
.sources-group { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.sources-label {
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate); margin-right: 4px;
}
.source-chip {
  display: inline-block; background: #fff; border: 1px solid var(--mist);
  border-radius: 999px; padding: 3px 12px; font-size: 0.8125rem; color: var(--ink);
  text-decoration: none;
}
a.source-chip:hover { box-shadow: var(--shadow); color: var(--harbour); }
.sources-note { font-size: 0.875rem; color: var(--slate); }

/* Message tools */
.message-tools { position: absolute; top: -4px; right: 0; display: flex; gap: 6px; opacity: 0; }
.message:hover .message-tools { opacity: 1; }
/* Regenerate (the toolbar's last button) only applies to the newest reply */
.message-assistant .message-tools .copy-btn:last-child { display: none; }
.message-assistant.is-last-assistant .message-tools .copy-btn:last-child { display: inline-block; }
.message-status { margin-top: 6px; font-size: 0.875rem; color: var(--slate); }

/* Welcome / empty state (§5.7 — the "new conversation" room).
 * The greeting is set in the display sans (§3.1), not the serif — the serif
 * is reserved for the wordmark. The composer floats up to meet it, with the
 * starter chips beneath. */
.welcome { max-width: 68ch; margin: 0 auto 8px; text-align: center; color: var(--slate); }
.welcome-greeting {
  font-family: var(--font-display); font-weight: 550; letter-spacing: -0.02em;
  font-size: clamp(1.9rem, 4vw, 2.4rem); line-height: 1.2;
  color: var(--superior); margin: 0 0 10px;
}
/* The greeting is a brand moment like the wordmark: the mark stays Beacon
 * Amber (the screen's single amber light) on every workspace. */
.welcome-greeting .beacon-mark {
  width: 13px; height: 13px; margin-right: 14px; vertical-align: 0.22em;
}
.welcome-sub { margin: 0; font-size: 1rem; }
.welcome-privacy { max-width: 760px; margin: 14px auto 0; text-align: center; font-size: 0.8125rem; color: var(--slate); }

/* In the empty state the greeting sits just above the lifted composer,
 * the pair resting at the upper-middle of the canvas. */
.chat-main.is-empty .messages { display: flex; flex-direction: column; justify-content: flex-end; }
.chat-main.is-empty .composer-dock { margin-bottom: clamp(12px, 16vh, 200px); }
@media (max-height: 560px) { .chat-main.is-empty .composer-dock { margin-bottom: 12px; } }
@media (prefers-reduced-motion: no-preference) {
  .chat-main.is-empty .welcome { animation: settle 300ms ease-out; }
  @keyframes settle { from { opacity: 0; transform: translateY(4px); } }
}

.starters { max-width: 760px; margin: 14px auto 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.starter {
  border: 1px solid var(--mist); background: #fff; color: var(--harbour);
  border-radius: var(--radius-card); padding: 7px 14px; font: 500 0.875rem/1.5 var(--font-body); cursor: pointer;
}
.starter:hover { border-color: var(--slate); color: var(--ink); box-shadow: var(--shadow); }

/* Composer (§5.4) — a white card: message on top, controls resting below. */
.composer-dock { padding: 8px 24px 12px; }
.composer {
  max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px;
  background: #fff; border: 1px solid var(--mist); border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px 12px 10px;
}
.composer textarea { width: 100%; resize: none; max-height: 160px; border: none; padding: 2px 6px; background: transparent; }
.composer textarea:focus { outline: none; }
.composer:focus-within { border-color: color-mix(in srgb, var(--ink) 45%, var(--mist)); box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--ink) 25%, transparent); }
.composer-controls { display: flex; align-items: center; gap: 8px; }
.composer-spacer { flex: 1; }
.composer-hint {
  max-width: 760px; margin: 6px auto 0; text-align: center; color: var(--slate);
  position: relative;
}
.composer-hint::after {
  content: ''; display: block; height: 2px; margin-top: 8px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tenant-deco) 30%, transparent), transparent);
}
.hint-keys { opacity: 0.75; }

/* ---------- Rendered markdown (§3.2, §9) ---------- */
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table { margin: 8px 0; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 16px 0 6px; font-size: 1.0625rem; font-weight: 600; line-height: 1.35; }
.md h1 { font-size: 1.1875rem; }
.md h2 { font-size: 1.125rem; }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 3px 0; }
.md code {
  background: color-mix(in srgb, var(--mist) 40%, #fff); border: 1px solid var(--mist); border-radius: 4px;
  padding: 1px 5px; font-size: 0.875em; font-family: var(--font-mono);
}
.md pre {
  position: relative; background: var(--superior); color: var(--fog);
  border-radius: var(--radius-card); padding: 14px 16px; overflow-x: auto;
}
.md pre code { background: none; border: none; padding: 0; color: inherit; font-size: 0.8125rem; }
.md blockquote { border-left: 2px solid var(--mist); margin-left: 0; padding: 2px 0 2px 14px; color: var(--slate); }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--mist); padding: 6px 10px; text-align: left; font-size: 0.9375rem; }
.md th { background: var(--fog); font-weight: 500; }
.md hr { border: none; border-top: 1px solid var(--mist); margin: 16px 0; }
.md a { word-break: break-all; }

/* Copy buttons */
.copy-btn {
  border: 1px solid var(--mist); background: #fff; color: var(--slate);
  border-radius: var(--radius-btn); padding: 2px 9px; font: 400 0.78rem/1.5 var(--font-body); cursor: pointer;
}
.copy-btn:hover { color: var(--harbour); border-color: var(--harbour); }
.copy-btn.copied { color: var(--ready); border-color: var(--ready); }
.md pre .copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: color-mix(in srgb, var(--fog) 12%, transparent);
  border-color: color-mix(in srgb, var(--fog) 30%, transparent); color: var(--mist);
  opacity: 0;
}
.md pre:hover .copy-btn { opacity: 1; }

/* Draft option cards */
.draft-card {
  border: 1px solid var(--mist); border-radius: var(--radius-card);
  background: #fff; margin: 12px 0;
}
.draft-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--mist);
}
.draft-title { font-weight: 600; font-size: 0.875rem; color: var(--superior); }
.draft-body { padding: 12px 16px; }
.draft-open .draft-head::after { content: '…'; color: var(--slate); }

/* ---------- Login (standalone) ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--fog); padding: 24px; }
.login-card { width: 100%; max-width: 400px; text-align: center; box-shadow: var(--shadow); }
.login-brand { margin-bottom: 4px; }
/* The wordmark is the one serif moment — italic Garamond with swash, the
 * same brand treatment cursor.com uses. */
.login-brand .wordmark {
  font-family: var(--font-serif); font-style: italic; font-size: 2.1rem; font-weight: 500;
  font-feature-settings: 'cswh' 1; letter-spacing: 0; color: var(--superior);
}
.beacon-mark {
  display: inline-block; width: 9px; height: 9px; border-radius: 999px;
  background: var(--beacon); margin-right: 10px; vertical-align: 0.35em;
}
.login-tagline { color: var(--slate); margin-top: 4px; }
.login-card .stack { text-align: left; margin-top: 24px; }
.login-card .notice { text-align: left; margin: 12px 0; }

/* ---------- Self-serve signup (standalone, shares login chrome) ---------- */
.signup-card { width: 100%; max-width: 560px; text-align: center; box-shadow: var(--shadow); margin: 32px auto; }
.signup-card .stack { text-align: left; margin-top: 24px; }
.signup-card .notice { text-align: left; margin: 12px 0; }
.signup-note { font-size: 0.875rem; line-height: 1.5; }
.signup-signin { margin-top: 20px; font-size: 0.875rem; }
.signup-signin a { color: var(--harbour); }

/* ---------- Onboarding checklist (admin overview) ---------- */
.checklist { list-style: none; margin: 8px 0 0; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; color: var(--slate); }
.checklist li a { color: var(--harbour); }
.checklist li.done { color: var(--slate); opacity: 0.7; text-decoration: line-through; text-decoration-color: var(--mist); }
.checklist-mark {
  flex: none; width: 18px; height: 18px; border-radius: 999px; border: 1px solid var(--mist);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: var(--ready); background: #fff; transform: translateY(3px);
}
.checklist li.done .checklist-mark { border-color: var(--ready); }

/* ---------- Plan & workspace ---------- */
.billing-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8125rem;
  background: color-mix(in srgb, var(--harbour) 10%, #fff); color: var(--harbour); text-transform: capitalize;
}

/* ---------- Data promise (§5.6) ---------- */
.promise-page { background: #fff; min-height: 100%; }
.promise { max-width: 720px; margin: 0 auto; padding: 48px 32px 64px; color: var(--superior); }
.promise h1 {
  font-family: var(--font-display); font-size: 2.25rem; line-height: 1.15;
  letter-spacing: -0.02em; font-weight: 550; margin: 0 0 8px;
}
.promise h2 { font-size: 1.125rem; font-weight: 600; margin: 32px 0 8px; }
.promise p { font-size: 1.0625rem; line-height: 1.65; margin: 8px 0; }
.promise-intro { color: var(--slate); font-size: 1.125rem; }
.promise-footer {
  margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--mist);
  font-family: var(--font-mono); font-size: 0.8125rem; color: var(--slate);
}

/* ---------- Error page ---------- */
.page-narrow { max-width: 720px; margin: 0 auto; padding: 48px 24px; }
.error-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; }
.error-brand { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); margin: 0 0 20px; }
.error-page h1 {
  font-family: var(--font-display); font-size: 2.25rem; line-height: 1.15;
  letter-spacing: -0.02em; font-weight: 550; color: var(--superior); margin: 0 0 10px;
}
.error-page > p { color: var(--slate); max-width: 48ch; margin: 0 0 28px; }
.error-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.error-waterline {
  width: 220px; height: 2px; margin-top: 48px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--harbour) 30%, transparent), transparent);
}

/* ---------- Public pages (data promise, privacy, terms — no login) ---------- */
.public-bar {
  max-width: 720px; margin: 0 auto; padding: 20px 32px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.public-wordmark {
  font-family: var(--font-serif); font-style: italic; font-size: 1.25rem; font-weight: 500;
  font-feature-settings: 'cswh' 1; letter-spacing: 0; color: var(--superior); text-decoration: none;
}
.public-bar-links { display: flex; gap: 20px; }
.public-bar-links a { font-size: 0.875rem; color: var(--slate); text-decoration: none; }
.public-bar-links a:hover { color: var(--harbour); }

/* Marketing landing page styles live in marketing.css (loaded only on that page). */

/* ---------- Print (§5.6) ---------- */
@media print {
  .sidebar, .topbar, .waterline, .composer-dock, .message-tools, .no-print { display: none !important; }
  body, .promise-page { background: #fff; }
  .card { border: none; padding: 0; }
  .promise { padding: 0; }
}

.feedback-btn.feedback-active { color: var(--harbour); border-color: var(--harbour); background: color-mix(in srgb, var(--mist) 40%, #fff); }

/* Edit & resend */
.edit-area textarea { background: #fff; }
.edit-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Attachments (FE2) */
.attach-btn {
  border: none; background: none; color: var(--slate); cursor: pointer;
  font-size: 1.1rem; padding: 6px 8px; border-radius: var(--radius-btn);
}
.attach-btn:hover { color: var(--harbour); }

/* Dictation: the ready-green dot convention marks a live microphone */
.attach-btn.listening { color: var(--harbour); position: relative; }
.attach-btn.listening::after {
  content: ''; position: absolute; top: 4px; right: 2px; width: 7px; height: 7px;
  border-radius: 999px; background: var(--ready); animation: pill-pulse 1.6s ease-in-out infinite;
}

/* Think deeper: a quiet mode toggle, never amber (beacon rule §2.3) */
.mode-btn {
  border: 1px solid var(--mist); background: none; color: var(--slate); cursor: pointer;
  font: 500 0.8125rem/1 var(--font-body); padding: 8px 10px; border-radius: 999px;
  white-space: nowrap;
}
.mode-btn:hover { color: var(--harbour); border-color: var(--harbour); }
.mode-btn.mode-active {
  color: #fff; background: var(--harbour); border-color: var(--harbour);
}

/* ---------- Writing canvas (FE3) ---------- */
.canvas {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 92vw);
  background: #fff; border-left: 1px solid var(--mist); box-shadow: var(--shadow);
  display: flex; flex-direction: column; z-index: 40;
}
.canvas-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--mist);
}
.canvas-title {
  font-family: var(--font-display); font-size: 1.0625rem; font-weight: 550; color: var(--superior);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.canvas-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.canvas textarea {
  flex: 1; border: none; border-radius: 0; resize: none; padding: 16px;
  font: 400 0.9375rem/1.6 var(--font-body); color: var(--ink); background: var(--fog);
}
.canvas textarea:focus { outline: none; }
.canvas-hint {
  padding: 10px 16px; font-size: 0.8125rem; color: var(--slate);
  border-top: 1px solid var(--mist);
}
.attachment-row { max-width: 760px; margin: 0 auto 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-row:empty { display: none; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--mist); border-radius: 999px;
  padding: 3px 6px 3px 12px; font-size: 0.8125rem; color: var(--ink);
}
.attachment-chip.attachment-error { color: var(--signal); border-color: var(--signal); padding-right: 12px; }
.chip-remove {
  border: none; background: none; color: var(--slate); cursor: pointer;
  font-size: 0.9rem; padding: 0 4px; border-radius: 999px;
}
.chip-remove:hover { color: var(--signal); }

/* ---------- Small screens ---------- */
.menu-btn { display: none; border: none; background: none; color: var(--superior); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }
@media (max-width: 720px) {
  .menu-btn { display: block; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: 280px;
    transform: translateX(-100%);
  }
  @media (prefers-reduced-motion: no-preference) {
    .sidebar { transition: transform 200ms ease-out; }
  }
  .shell.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: none; }
  .shell.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 20;
    background: color-mix(in srgb, var(--superior) 40%, transparent);
  }
  .message-user { margin-left: 0; margin-right: 0; }
  .form-row { flex-direction: column; gap: 16px; }
  .card { overflow-x: auto; } /* admin tables scroll inside their card, the page never does */
  .topbar { padding: 12px 16px; }
  .transcript { padding: 24px 16px 16px; }
  .composer-dock { padding: 8px 12px 12px; }
}
