/* KCS Executive — the approved visual design (docs/design/, plan-0003).
   Phase 1: tokens, type, the three-band frame, shared components.
   Phase 2: the Ask conversation view, sign-in, and mode chrome.

   Claude Design owns how this LOOKS (docs/design/kcs-executive-ui/README.md is
   the authority; values not stated there were measured from the mockup).  This
   project owns how it WORKS — see docs/design/README.md for the settled
   divergences (Google sign-in, interaction modes, the notice link and the
   spend figure), none of which are visible in the mockups.

   Framework-free, no build step: the static files are served off a read-only
   mount and the deploy is a tree copy (plan-0003 § Implementation notes). */

/* ---- Type: two families, self-hosted, one variable file each.  The design
   set the record in Source Serif 4; Chris ruled 2026-09-18 that the serif was
   hard to read, so everything is Public Sans and one notch larger than the
   mockup (docs/design/README.md, Type). ---------------------------------- */
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/public-sans.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/static/fonts/nunito.woff2") format("woff2");
}

/* ---- Tokens ---------------------------------------------------------------- */
:root {
  --brand: #a32a2b;
  --brand-dk: #8c2427;
  --brand-lt: #c05a3c;
  --brand-txt: #a32a2b;
  --brand-wash: #f7e9e6;
  --brown: #6b4a32;
  --brown-lt: #8d6a4a;
  --gold: #c09a6a;
  --gold-lt: #d2a06a;
  --warn-wash: #fdf6ee;
  --warn-line: #eddfc8;

  --cream-page: #f4eee4;
  --cream-raised: #fbf7f1;
  --cream-sunk: #ece2d2;
  --cream-panel: #fffdf9;
  --cream-detail: #fdf9f2;
  --cream-active: #f5ece0;
  --cream-hover: #faf5ed;
  --surface: #ffffff;

  --ink-1: #2b2320;
  --ink-2: #4a4038;
  --ink-3: #8a7b6e;
  --ink-4: #a3968a;

  --line: #e9dfcf;
  --line-2: #ddd0bd;
  --line-3: #f2e9db;

  --diff-add-bg: #eef3ea; --diff-add-br: #85a86e; --diff-add-fg: #37522a;
  --diff-del-bg: #fbeeea; --diff-del-br: #cf8a7c; --diff-del-fg: #7d3a28;

  --shadow-card: 0 1px 2px rgba(80, 50, 30, .05);
  --shadow-composer: 0 4px 16px rgba(80, 50, 30, .08);
  --shadow-modal: 0 20px 50px rgba(43, 35, 32, .25);
  --dim: rgba(43, 35, 32, .32);

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --round: "Nunito", var(--sans);

  color-scheme: light;
}

/* Dark: the browns stay warm on purpose — reviewed and approved, not a grey
   inversion. */
:root[data-theme="dark"] {
  --brand: #a63035;
  --brand-dk: #8c2427;
  --brand-lt: #d9635e;
  --brand-txt: #f0b3ac;
  --brand-wash: rgba(217, 99, 94, .14);
  --brown: #8d6a4a;
  --brown-lt: #c09a6a;
  --gold: #d2a06a;
  --gold-lt: #dfb27d;
  --warn-wash: #2a211a;
  --warn-line: #4a3a2a;

  --cream-page: #231b18;
  --cream-raised: #171110;
  --cream-sunk: #171110;
  --cream-panel: #1f1817;
  --cream-detail: #1c1514;
  --cream-active: #2c2320;
  --cream-hover: #2a211e;
  --surface: #251d1a;

  --ink-1: #f7f0e8;
  --ink-2: #e2d6ca;
  --ink-3: #a1897b;
  --ink-4: #938075;

  --line: #372c27;
  --line-2: #453832;
  --line-3: #2f2622;

  --diff-add-bg: #1f2a1a; --diff-add-br: #85a86e; --diff-add-fg: #b9d3a6;
  --diff-del-bg: #2e1c19; --diff-del-br: #cf8a7c; --diff-del-fg: #e6b3a6;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .22);
  --shadow-composer: 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-modal: 0 20px 50px rgba(0, 0, 0, .5);
  --dim: rgba(0, 0, 0, .5);

  color-scheme: dark;
}

/* ---- Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--cream-page);
  color: var(--ink-2);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { color: var(--ink-1); font-family: var(--sans); margin: 0 0 .5em; line-height: 1.3; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: var(--brand-txt); text-decoration: none; }
a:hover { color: var(--brand-dk); text-decoration: underline; }
:root[data-theme="dark"] a:hover { color: var(--brand-txt); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--cream-active); padding: 0 .3em; border-radius: 4px; }
pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
[hidden] { display: none !important; }
.icon { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; vertical-align: -2px; flex: none; }
.icon-15 { width: 15px; height: 15px; }
.icon-22 { width: 22px; height: 22px; }
.microlabel { font: 700 11.5px/1.4 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--brown); }
.meta { font-size: 12.5px; color: var(--ink-3); }

/* ---- Buttons, pills, inputs ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--ink-1);
  border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 13px; font-size: 13.5px; font-weight: 500; line-height: 1.4;
  cursor: pointer; transition: background .12s ease; white-space: nowrap;
}
.btn:hover { background: var(--cream-hover); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.btn.primary:hover { background: var(--brand-dk); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:disabled:hover { background: var(--surface); }
.btn.primary:disabled:hover { background: var(--brand); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--cream-raised); color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 20px;
  padding: 7px 14px; font-size: 13.5px; cursor: pointer; transition: background .12s ease;
}
.pill:hover { background: var(--cream-hover); color: var(--ink-1); }
.pill.static { cursor: default; }
.pill.static:hover { background: var(--cream-raised); }
.pill.active { background: var(--brand-wash); border-color: var(--brand); color: var(--ink-1); }
.field {
  background: var(--surface); color: var(--ink-1);
  border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 13px; font-size: 15px; width: 100%;
}
.field::placeholder { color: var(--ink-4); }
select.field { padding: 6px 10px; width: auto; font-size: 13.5px; border-radius: 8px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px; box-shadow: var(--shadow-card);
}
.callout {
  background: var(--warn-wash); border: 1px solid var(--warn-line); border-left: 3px solid var(--gold);
  border-radius: 12px; padding: 16px 18px;
}
.callout h2 { font-size: 15.5px; font-weight: 600; margin-bottom: .4em; }
.callout p { font-size: 15px; line-height: 1.75; }
.callout p:last-child { margin-bottom: 0; }

/* ---- The frame: header / tab strip / content ------------------------------- */
body.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.hdr {
  flex: none; height: 48px; display: flex; align-items: center; gap: 16px;
  padding: 0 22px; background: var(--cream-raised); border-bottom: 1px solid var(--line);
}
.hdr .logo { height: 32px; width: auto; display: block; }
.hdr .title { font: 600 14.5px/1 var(--sans); color: var(--ink-1); white-space: nowrap; }
.hdr .title span { color: var(--ink-3); font-weight: 400; }
.hdr .spacer { flex: 1; }
.hdr .add { }
.hdr .toggle {
  width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer;
  color: var(--brown);
}
.hdr .toggle .sun { display: none; color: var(--gold-lt); }
:root[data-theme="dark"] .hdr .toggle .moon { display: none; }
:root[data-theme="dark"] .hdr .toggle .sun { display: block; }
.hdr .spend { font-size: 12.5px; color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.hdr .spend:hover { color: var(--ink-1); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff;
  font: 700 11.5px/24px var(--sans); text-align: center; border: 0; padding: 0; cursor: pointer; flex: none;
  letter-spacing: .02em;
}
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 32px; z-index: 30; min-width: 240px;
  background: var(--cream-raised); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow-modal); padding: 6px; font-size: 13.5px;
}
.menu .who { padding: 8px 10px 6px; color: var(--ink-1); font-weight: 600; border-bottom: 1px solid var(--line-3); margin-bottom: 4px; overflow-wrap: anywhere; }
.menu .who .ver { display: block; color: var(--ink-4); font-weight: 400; font-size: 12px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; background: none; border: 0; color: var(--ink-2); cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--cream-hover); color: var(--ink-1); text-decoration: none; }

.tabs {
  flex: none; display: flex; align-items: stretch; gap: 2px; padding: 0 22px;
  background: var(--cream-sunk); border-bottom: 1px solid var(--line-2);
}
.tabs .tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; font-size: 14px; color: var(--ink-3); border: 0; background: none;
  border-radius: 4px 4px 0 0; text-decoration: none; cursor: pointer;
}
.tabs .tab:hover { color: var(--ink-1); text-decoration: none; }
.tabs .tab .icon { display: none; }
body[data-page="ask"] .tab[data-tab="ask"],
body[data-page="documents"] .tab[data-tab="documents"],
body[data-page="history"] .tab[data-tab="history"] {
  background: var(--cream-raised); color: var(--ink-1); font-weight: 600;
  border: 1px solid var(--line-2); border-top: 2px solid var(--brand);
  border-bottom-color: var(--cream-panel); margin-bottom: -1px; padding: 7px 18px;
}
.tabs .state { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }

.content { flex: 1; min-height: 0; background: var(--cream-panel); display: flex; }
.content > .pane { min-width: 0; overflow: auto; }
.content > .pane.rail { flex: 0 0 206px; border-right: 1px solid var(--line); background: var(--cream-panel); padding: 14px 12px; }
.content > .pane.detail { flex: 1; background: var(--cream-detail); }
.page { flex: 1; min-width: 0; overflow: auto; padding: 24px 34px; }
.page.reading { max-width: 700px; }
.page.wide { max-width: none; }

/* Mode chrome, derived from the design's own devices (docs/design/README.md):
   mode state is a pill in the tab-strip band; the incognito banner is a
   warn-wash callout with the gold left border. */
.mode {
  display: inline-flex; align-items: center; gap: 6px;
  /* Whole-pixel line box and an even dot: a 7px dot in the inherited 1.55 line
     box centred on a half pixel and landed visibly below the label. */
  padding: 4px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 600; line-height: 16px;
  border: 1px solid var(--line-2); background: var(--cream-raised); color: var(--ink-2);
}
.mode::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.mode.editing { background: var(--brand-wash); color: var(--brand-txt); border-color: var(--brand); }
.mode.editing::before { background: var(--brand); }
.mode.incognito { background: var(--ink-1); color: var(--cream-page); border-color: var(--ink-1); }
.mode.incognito::before { background: var(--cream-page); }
.state .link, .state-mobile .link { background: none; border: 0; color: var(--brand-txt); cursor: pointer; padding: 0; font-size: 13px; white-space: nowrap; }
.state .link:hover, .state-mobile .link:hover { text-decoration: underline; }
.state label, .state-mobile label { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.banner {
  flex: none; display: flex; align-items: center; gap: 10px;
  background: var(--warn-wash); border-bottom: 1px solid var(--warn-line); border-left: 3px solid var(--gold);
  color: var(--ink-1); padding: 8px 22px; font-size: 13.5px;
}

/* ---- Ask: landing --------------------------------------------------------- */
.landing {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 40px 22px; overflow: auto; text-align: center;
}
.landing h1 { font: 700 29px/1.3 var(--sans); color: var(--ink-1); margin: 0; }
.landing .sub { font-size: 15px; line-height: 1.65; color: var(--ink-2); max-width: 520px; margin: 0; }
.landing .starts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.composer {
  width: 100%; max-width: 620px; display: flex; align-items: flex-end; gap: 12px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px;
  padding: 12px 14px 12px 16px; box-shadow: var(--shadow-composer); text-align: left;
}
.composer .tile {
  width: 26px; height: 26px; border-radius: 8px; background: var(--brand-wash); flex: none;
  display: flex; align-items: center; justify-content: center; margin-bottom: 4px;
}
.composer .tile img { width: 22px; height: 22px; object-fit: contain; }
.composer textarea {
  flex: 1; border: 0; background: none; resize: none; padding: 4px 0; min-height: 34px; max-height: 40vh;
  font-size: 15px; line-height: 1.5; color: var(--ink-1); outline: none;
}
.composer textarea::placeholder { color: var(--ink-4); }
.composer .btn.primary { border-radius: 10px; padding: 8px 17px; margin-bottom: 1px; }

/* ---- Ask: conversation ---------------------------------------------------- */
.convo { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--cream-detail); }
.convo .log { flex: 1; min-height: 0; overflow: auto; padding: 24px 34px; display: flex; flex-direction: column; gap: 18px; }
.convo .foot { flex: none; padding: 12px 34px 18px; }
.convo .foot .composer { max-width: none; border-radius: 14px; box-shadow: none; }
.rail .newq { width: 100%; justify-content: center; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.rail .microlabel { margin: 18px 6px 6px; }
.rail .qlist { list-style: none; margin: 0; padding: 0; }
.rail .qlist li { padding: 6px 8px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .qlist li:hover { background: var(--cream-hover); color: var(--ink-1); }
.rail .qlist li.active { background: var(--cream-active); color: var(--ink-1); font-weight: 600; }
.rail .note { margin: 14px 6px 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

.msg { max-width: 82%; }
.msg.user {
  align-self: flex-end; max-width: 64%;
  background: var(--brand); color: #fff; border-radius: 16px 16px 4px 16px;
  padding: 12px 17px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.assistant { display: flex; gap: 14px; align-items: flex-start; }
.msg.assistant .tile {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand-wash); flex: none;
  display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.msg.assistant .tile img { width: 26px; height: 26px; object-fit: contain; }
.prose { font: 400 15.5px/1.7 var(--sans); color: var(--ink-1); min-width: 0; overflow-wrap: anywhere; }
.prose p { margin: 0 0 .9em; }
.prose p:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--sans); margin: 1em 0 .4em; }
.prose h1 { font-size: 20px; } .prose h2 { font-size: 18px; } .prose h3, .prose h4 { font-size: 16px; }
.prose ul, .prose ol { margin: 0 0 .9em; padding-left: 1.4em; }
.prose li { margin: .2em 0; }
.prose pre { background: var(--cream-active); border-radius: 8px; padding: 10px 12px; overflow: auto; font-size: 13px; }
.prose blockquote { margin: 0 0 .9em; padding-left: 12px; border-left: 3px solid var(--gold); color: var(--ink-2); }
.prose table { border-collapse: collapse; margin: 0 0 .9em; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--line-2); margin: 1em 0; }
.prose strong { font-weight: 600; }
.indent { margin-left: 44px; }
.msg.error .prose, .prose.error { color: var(--diff-del-fg); }
.msg.status { font-size: 13px; color: var(--ink-3); margin-left: 44px; }
.msg.status.working { animation: kcs-pulse 1.6s ease-in-out infinite; }
.msg.status.working::after { content: ""; display: inline-block; width: 1.4em; text-align: left; animation: kcs-dots 1.2s steps(4, end) infinite; }
.msg.done { font-size: 12.5px; color: var(--ink-4); margin-left: 44px; }
.msg.restored { opacity: .78; }
.msg.ghost .prose { border-left: 3px dashed var(--ink-4); padding-left: 10px; }
.msg.user.ghost { background: var(--ink-2); }
.break { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 6px 0; }
.break::before, .break::after { content: ""; flex: 1; border-top: 3px double var(--line-2); }
.files { margin-left: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 82%; }
.files .lead, .files .omitted { flex-basis: 100%; }
.files .lead { font-size: 13px; color: var(--ink-3); }
.file { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; min-width: 190px; max-width: 100%; border-left: 3px solid var(--brown); }
.file .name { font-weight: 600; font-size: 13.5px; color: var(--ink-1); flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file .name:hover { text-decoration: underline; }
.file .keep-note { font-size: 12px; color: var(--ink-3); }
.files .omitted { font-size: 13px; color: var(--ink-3); }
.offer { display: flex; flex-direction: column; gap: 10px; }
.offer .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.firstlogin .notice h2 { font-size: 18px; }
.firstlogin .notice p, .firstlogin .notice li { font-size: 14.5px; line-height: 1.65; }
.firstlogin .btns { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.spend-detail { font-size: 13.5px; }
.spend-detail .row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--line-3); }
.spend-detail .row:last-child { border-bottom: 0; }
.starts .pill { cursor: pointer; }

@keyframes kcs-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes kcs-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---- Sign-in ------------------------------------------------------------- */
body.signin { display: flex; min-height: 100dvh; background: var(--cream-page); }
.signin .left {
  flex: 0 0 470px; padding: 52px; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  background: var(--cream-raised);
}
.signin .left .logo { width: 190px; height: auto; margin-bottom: 8px; }
.signin h1 { font: 700 28px/1.3 var(--sans); color: var(--ink-1); margin: 0; }
.signin .orient { font-size: 15px; line-height: 1.65; color: var(--ink-2); margin: 0; }
.signin .go {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  background: var(--brand); color: #fff; border: 0; border-radius: 11px; padding: 13px;
  font: 700 15px/1.2 var(--round); cursor: pointer; text-decoration: none; transition: background .12s ease;
}
.signin .go:hover { background: var(--brand-dk); color: #fff; text-decoration: none; }
.signin .lost { font-size: 13.5px; color: var(--ink-3); text-align: center; margin: 0; line-height: 1.55; }
.signin .err { color: var(--diff-del-fg); font-size: 14px; min-height: 1.4em; margin: 0; }
.signin .devform { display: flex; flex-direction: column; gap: 10px; }
.signin .devform label { font-size: 13.5px; color: var(--ink-2); }
.signin .right { flex: 1; min-width: 0; position: relative; overflow: hidden; background: var(--cream-sunk); }
.signin .right img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.signin .theme-corner { position: absolute; top: 14px; right: 14px; z-index: 2; }
.signin .theme-corner .toggle {
  width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; cursor: pointer; color: var(--brown);
}
.signin .theme-corner .sun { display: none; color: var(--gold-lt); }
:root[data-theme="dark"] .signin .theme-corner .moon { display: none; }
:root[data-theme="dark"] .signin .theme-corner .sun { display: block; }

/* ---- History (activity), Documents (vault), Review, Notice ----------------- */
.page .intro { font-size: 14.5px; color: var(--ink-2); max-width: 640px; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.grid th { text-align: left; font: 700 11.5px/1.4 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--brown); padding: 6px 8px; border-bottom: 1px solid var(--line-2); }
table.grid td { padding: 8px 8px; border-bottom: 1px solid var(--line-3); vertical-align: top; }
table.grid tr:hover td { background: var(--cream-hover); }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 19px; display: flex; gap: 18px; border-left: 3px solid var(--brand-lt); }
.row-card.p1 { border-left-color: var(--brand); }
.row-card.p2 { border-left-color: var(--gold); }
.row-card.p3 { border-left-color: var(--line-2); }
pre.diff { background: var(--cream-active); padding: 12px; border-radius: 10px; overflow-x: auto; white-space: pre; }
.transient { color: var(--ink-3); font-size: 13.5px; }
/* The folder tree (design § Documents): rows 5px 8px, radius 6px, disclosure
   triangles, right-aligned counts in --ink-4, the open folder on --cream-active
   at 600, children indented 22px, the current file --brown 600.  A long name
   wraps with a hanging indent, so its second line never reads as a new entry. */
.tree, .tree ul { list-style: none; padding: 0; margin: 0; }
.tree { font-size: 14px; overflow-wrap: anywhere; }
.tree ul { margin-left: 22px; }
.tree li { margin: 2px 0; }
.tree .folder, .tree .doc {
  display: flex; align-items: baseline; gap: 6px; width: 100%;
  padding: 5px 8px; border-radius: 6px; border: 0; background: none;
  color: var(--ink-2); text-align: left; line-height: 1.4; cursor: pointer;
}
.tree .folder:hover, .tree .doc:hover { background: var(--cream-hover); color: var(--ink-1); text-decoration: none; }
.tree .folder::before { content: "▸"; flex: none; width: 10px; color: var(--ink-3); }
.tree .folder[aria-expanded="true"]::before { content: "▾"; }
.tree .folder[aria-expanded="true"] { background: var(--cream-active); font-weight: 600; color: var(--ink-1); }
.tree .folder .name { flex: 1; min-width: 0; }
.tree .folder .count { flex: none; color: var(--ink-4); font-weight: 400; font-size: 12.5px; }
.tree .doc { display: block; padding-left: 40px; text-indent: -16px; }
.tree .doc.current { color: var(--brown); font-weight: 600; }
:root[data-theme="dark"] .tree .doc.current { color: var(--brown-lt); }
.docs { display: flex; flex: 1; min-height: 0; }
.docs .rail { flex: 0 0 300px; border-right: 1px solid var(--line); overflow: auto; padding: 14px 12px; }
.docs .reading { flex: 1; min-width: 0; overflow: auto; padding: 24px 34px; background: var(--cream-detail); }
.doc-body { max-width: 600px; font: 400 16px/1.7 var(--sans); color: var(--ink-1); }
.doc-body h3, .doc-body h4, .doc-body h5, .doc-body h6 { font: 700 13px/1.5 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--brown); margin: 1.4em 0 .5em; }
.doc-body p { margin: 0 0 .8em; }
.doc-body pre { font-size: 13px; white-space: pre-wrap; }
.wikilink { color: var(--brand-txt); }
.uploader { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.uploader input[type="file"] { font-size: 13.5px; }
.notice-page { max-width: 640px; }
.notice-page .notice h2 { font-size: 24px; font-weight: 700; }
.notice-page .notice p, .notice-page .notice li { font-size: 15.5px; line-height: 1.75; font-family: var(--sans); color: var(--ink-1); }
.ver { color: var(--ink-4); font-size: 12px; }

/* ---- Phone ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .content > .pane.rail { flex-basis: 170px; }
}
@media (max-width: 767px) {
  .hdr { padding: 0 14px; gap: 10px; }
  .hdr .title, .hdr .add, .hdr .spend { display: none; }
  .tabs { order: 3; padding: 8px 6px 14px; background: var(--cream-raised); border-top: 1px solid var(--line-2); border-bottom: 0; gap: 0; }
  .tabs .tab { flex: 1; flex-direction: column; justify-content: center; gap: 5px; padding: 6px 0; font-size: 12.5px; min-height: 44px; border: 0 !important; margin: 0 !important; background: none !important; border-radius: 0; color: var(--ink-3); }
  .tabs .tab .icon { display: block; width: 22px; height: 22px; color: var(--ink-4); }
  body[data-page="ask"] .tab[data-tab="ask"], body[data-page="documents"] .tab[data-tab="documents"], body[data-page="history"] .tab[data-tab="history"] { color: var(--brand); font-weight: 700; }
  body[data-page="ask"] .tab[data-tab="ask"] .icon, body[data-page="documents"] .tab[data-tab="documents"] .icon, body[data-page="history"] .tab[data-tab="history"] .icon { color: var(--brand); }
  .tabs .state { display: none; }
  .content { order: 2; flex-direction: column; }
  .content > .pane.rail { display: none; }
  .state-mobile { display: flex !important; flex: none; align-items: center; gap: 8px; padding: 8px 14px; background: var(--cream-sunk); border-bottom: 1px solid var(--line-2); font-size: 13px; overflow-x: auto; }
  .page { padding: 16px; }
  .convo .log, .convo .foot { padding-left: 16px; padding-right: 16px; }
  .msg { max-width: 100%; }
  .msg.user { max-width: 85%; }
  .indent, .files, .msg.status, .msg.done { margin-left: 0; }
  .files { max-width: 100%; }
  .landing { padding: 24px 16px; }
  .signin .left { flex: 1; padding: 32px 24px; }
  .signin .right { display: none; }
  .docs { flex-direction: column; }
  .docs .rail { flex: none; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
}
.state-mobile { display: none; }

@media (prefers-reduced-motion: reduce) {
  .msg.status.working { animation: none; }
  .msg.status.working::after { content: "…"; animation: none; }
  * { transition: none !important; }
}
