:root {
  --ink: #080807;
  --panel: #11100e;
  --panel-2: #181613;
  --paper: #f4eee3;
  --paper-2: #e9e1d2;
  --lime: #c8ff37;
  --aubergine: #502c52;
  --muted: #a49d91;
  --line: rgba(244, 238, 227, .18);
  --line-strong: rgba(244, 238, 227, .42);
  --mono: "IBM Plex Mono", monospace;
  --sans: "Instrument Sans", sans-serif;
  --serif: "Instrument Serif", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(rgba(244, 238, 227, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 238, 227, .025) 1px, transparent 1px),
    var(--ink);
  background-size: 48px 48px;
  font: 400 16px/1.55 var(--sans);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--lime);
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

.desk-header {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 7, .92);
  backdrop-filter: blur(16px);
}

.desk-brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  font: 600 14px/1 var(--mono);
  letter-spacing: .18em;
  text-decoration: none;
}

.desk-mark {
  width: 28px;
  height: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
}
.desk-mark i, .desk-mark b { display: block; border: 1px solid var(--paper); }
.desk-mark b { background: var(--lime); border-color: var(--lime); }

.desk-header nav { display: flex; gap: clamp(16px, 2.5vw, 36px); }
.desk-header nav a, .desk-footer a {
  color: var(--paper-2);
  font-size: 13px;
  text-decoration: none;
}
.desk-header nav a:hover, .desk-footer a:hover { color: var(--lime); }

.account-button {
  justify-self: end;
  padding: 10px 17px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  font: 500 12px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.account-button:hover { border-color: var(--lime); color: var(--lime); }

.desk-hero {
  min-height: calc(100svh - 72px);
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(500px, 1.15fr);
  align-items: center;
  gap: clamp(48px, 7vw, 120px);
  padding: clamp(80px, 10vw, 150px) clamp(20px, 6vw, 96px);
  overflow: hidden;
}

.kicker, .rail-heading p, .conversation-header p {
  margin: 0 0 20px;
  color: var(--lime);
  font: 500 11px/1.35 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.desk-hero h1, .section-lead h2, .knowledge-section h2 {
  margin: 0;
  max-width: 820px;
  font: 400 clamp(54px, 7vw, 112px)/.88 var(--serif);
  letter-spacing: -.035em;
}
.desk-hero h1 em, .section-lead h2 em { color: var(--lime); font-weight: 400; }

.hero-deck {
  max-width: 650px;
  margin: 34px 0;
  color: var(--paper-2);
  font-size: clamp(18px, 1.5vw, 23px);
  line-height: 1.5;
}

.hero-actions { display: flex; align-items: center; gap: 22px; }
.hero-actions > a, .knowledge-links a {
  color: var(--paper);
  font: 500 12px var(--mono);
  text-underline-offset: 5px;
}
.primary-action, .auth-submit {
  min-height: 48px;
  padding: 13px 20px;
  border: 1px solid var(--lime);
  color: var(--ink);
  background: var(--lime);
  cursor: pointer;
  font: 600 12px/1 var(--mono);
  letter-spacing: .035em;
  text-transform: uppercase;
}
.primary-action:hover, .auth-submit:hover { background: var(--paper); border-color: var(--paper); }
.hero-boundary { margin: 22px 0 0; color: var(--muted); font: 11px var(--mono); }

.xray {
  position: relative;
  min-height: 540px;
  border: 1px solid var(--line);
  background: rgba(17, 16, 14, .72);
  box-shadow: 28px 28px 0 rgba(80, 44, 82, .26);
}
.xray::before {
  content: "";
  position: absolute;
  inset: 36px;
  border: 1px solid rgba(200, 255, 55, .14);
}
.xray-label {
  position: absolute;
  top: 18px;
  left: 20px;
  color: var(--muted);
  font: 10px var(--mono);
  letter-spacing: .15em;
}
.xray svg { position: absolute; inset: 82px 30px auto; width: calc(100% - 60px); height: 310px; }
.xray path { fill: none; stroke: var(--lime); stroke-width: 1.5; stroke-dasharray: 5 7; }
.xray circle { fill: var(--lime); }
.xray-node {
  position: absolute;
  z-index: 2;
  width: 210px;
  padding: 16px;
  border-left: 3px solid var(--lime);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 8px 8px 0 rgba(8, 8, 7, .4);
}
.xray-node small, .xray-node strong, .xray-node span { display: block; }
.xray-node small { margin-bottom: 9px; color: var(--aubergine); font: 600 9px var(--mono); letter-spacing: .12em; }
.xray-node strong { font-size: 16px; line-height: 1.2; }
.xray-node span { margin-top: 7px; color: #5d574e; font: 10px var(--mono); }
.node-problem { top: 80px; left: 8%; }
.node-evidence { top: 210px; left: 38%; }
.node-decision { top: 340px; right: 7%; }
.xray-note { position: absolute; right: 28px; bottom: 22px; width: 46%; margin: 0; color: var(--muted); font: 10px/1.5 var(--mono); }

.desk-shell {
  width: min(1600px, calc(100% - 40px));
  min-height: 780px;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  margin: 0 auto clamp(100px, 10vw, 160px);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 18px 18px 0 rgba(80, 44, 82, .3);
}

.agent-rail, .evidence-rail { padding: 28px 20px; background: #0c0b0a; }
.agent-rail { border-right: 1px solid var(--line); }
.evidence-rail { border-left: 1px solid var(--line); }
.rail-heading { margin-bottom: 30px; }
.rail-heading p { margin-bottom: 8px; font-size: 9px; }
.rail-heading h2 { margin: 0; font: 400 28px var(--serif); }

.agent-choice {
  width: 100%;
  display: block;
  margin: 0 0 7px;
  padding: 16px 14px;
  border: 1px solid transparent;
  border-left: 2px solid var(--line-strong);
  color: var(--paper);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.agent-choice span, .agent-choice small { display: block; }
.agent-choice span { font-weight: 600; }
.agent-choice small { margin-top: 4px; color: var(--muted); font: 10px var(--mono); }
.agent-choice:hover { background: var(--panel-2); }
.agent-choice.is-active { border-color: var(--lime); color: var(--ink); background: var(--lime); }
.agent-choice.is-active small { color: rgba(8, 8, 7, .68); }

.capacity-card, .context-card, .source-card, .boundary-card {
  margin-top: 28px;
  padding: 17px 15px;
  border: 1px solid var(--line);
}
.capacity-card { margin-top: 44px; }
.capacity-card strong { font-size: 12px; }
.capacity-card p, .context-card p, .boundary-card p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.status-dot { width: 7px; height: 7px; display: inline-block; margin-right: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 12px var(--lime); }

.conversation { min-width: 0; display: flex; flex-direction: column; }
.conversation-header {
  min-height: 103px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
}
.conversation-header p { margin-bottom: 6px; font-size: 9px; }
.conversation-header h2 { margin: 0; font: 400 clamp(23px, 2vw, 32px)/1.05 var(--serif); }
.conversation-header > span { padding: 7px 9px; border: 1px solid var(--line); color: var(--muted); font: 9px var(--mono); text-transform: uppercase; }

.gate {
  width: min(670px, calc(100% - 40px));
  margin: auto;
  padding: clamp(30px, 5vw, 58px);
  border-top: 3px solid var(--lime);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 13px 13px 0 var(--aubergine);
}
.gate-index { color: var(--aubergine); font: 600 11px var(--mono); }
.gate h3 { margin: 12px 0 15px; font: 400 clamp(34px, 4vw, 55px)/.95 var(--serif); }
.gate > p { margin: 0 0 28px; color: #4d4841; }

.problem-form, .auth-form { display: grid; gap: 17px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid #a9a195;
  border-radius: 0;
  padding: 11px 12px;
  color: var(--ink);
  background: #fffdf8;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--aubergine); }
.consent-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; font-weight: 400; line-height: 1.45; }
.consent-row input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--aubergine); }
.form-actions { display: flex; align-items: center; gap: 15px; margin-top: 8px; }
.form-status { color: #594d56; font: 11px var(--mono); }

.chat-workspace { min-height: 675px; display: flex; flex: 1; flex-direction: column; }
.message-list { flex: 1; margin: 0; padding: 26px 30px 8px; list-style: none; overflow: auto; }
.message { display: grid; grid-template-columns: 76px 1fr; gap: 18px; padding: 21px 0; border-bottom: 1px solid var(--line); }
.message > span { padding-top: 3px; color: var(--lime); font: 600 9px var(--mono); letter-spacing: .08em; }
.message-user > span { color: var(--paper-2); }
.message p { margin: 0; color: var(--paper-2); white-space: pre-wrap; }
.message-assistant p { font-size: 17px; }
.message.is-pending p { color: var(--muted); }
.message.is-pending p::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 8px; background: var(--lime); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .15; } }

.composer { margin: 20px 28px 28px; border: 1px solid var(--line-strong); background: #0b0a09; }
.composer textarea { min-height: 96px; border: 0; color: var(--paper); background: transparent; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 11px 12px; border-top: 1px solid var(--line); }
.composer-footer > span { color: var(--muted); font: 9px/1.4 var(--mono); }
.composer-footer button {
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 0;
  color: var(--ink);
  background: var(--lime);
  cursor: pointer;
  font: 600 10px var(--mono);
  text-transform: uppercase;
}
.composer-footer button:disabled { opacity: .45; cursor: wait; }

.context-card > span, .source-card > span, .boundary-card > span {
  color: var(--lime);
  font: 600 9px var(--mono);
  letter-spacing: .1em;
}
.context-card button {
  margin-top: 13px;
  padding: 0;
  border: 0;
  color: var(--paper);
  background: transparent;
  font: 10px var(--mono);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.source-card ol { margin: 15px 0 0; padding: 0; list-style: none; }
.source-card li { padding: 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.source-card a { color: var(--paper-2); text-underline-offset: 3px; }

.method-section, .agent-catalog, .knowledge-section {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto clamp(100px, 12vw, 180px);
}
.section-lead { max-width: 920px; margin-bottom: 60px; }
.section-lead h2, .knowledge-section h2 { font-size: clamp(48px, 6vw, 88px); }
.section-lead > p:last-child { max-width: 700px; margin: 25px 0 0; color: var(--muted); font-size: 18px; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-strong); }
.method-grid article { min-height: 250px; padding: 25px 24px 25px 0; border-right: 1px solid var(--line); }
.method-grid article:not(:first-child) { padding-left: 24px; }
.method-grid article:last-child { border-right: 0; }
.method-grid span, .catalog-grid header span, .agent-request span { color: var(--lime); font: 9px var(--mono); letter-spacing: .11em; }
.method-grid h3 { margin: 34px 0 12px; font: 400 31px var(--serif); }
.method-grid p { margin: 0; color: var(--muted); font-size: 14px; }

.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.catalog-grid article { display: flex; flex-direction: column; min-height: 510px; padding: clamp(24px, 3vw, 42px); border: 1px solid var(--line); background: var(--panel); }
.catalog-grid article:nth-child(2) { transform: translateY(22px); }
.catalog-grid header { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.catalog-grid h3 { margin: 10px 0 0; font: 400 39px var(--serif); }
.catalog-grid article > p { min-height: 112px; color: var(--paper-2); }
.catalog-grid dl { margin: 10px 0 30px; }
.catalog-grid dl div { padding: 12px 0; border-top: 1px solid var(--line); }
.catalog-grid dt { color: var(--muted); font: 9px var(--mono); text-transform: uppercase; }
.catalog-grid dd { margin: 4px 0 0; font-size: 13px; }
.catalog-grid button { width: 100%; margin-top: auto; padding: 13px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font: 600 10px var(--mono); text-transform: uppercase; }
.catalog-grid button:hover { border-color: var(--lime); color: var(--lime); }
.agent-request { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin-top: 68px; padding: 30px; color: var(--ink); background: var(--lime); }
.agent-request h3 { margin: 5px 0 0; font: 400 clamp(27px, 3vw, 42px)/1 var(--serif); }
.agent-request span { color: var(--aubergine); }
.agent-request a { flex: 0 0 auto; padding: 14px 18px; border: 1px solid var(--ink); font: 600 10px var(--mono); text-decoration: none; text-transform: uppercase; }

.knowledge-section { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(50px, 8vw, 130px); padding-top: 50px; border-top: 1px solid var(--line-strong); }
.knowledge-copy { padding-top: 35px; }
.knowledge-copy > p { color: var(--paper-2); font-size: 18px; }
.knowledge-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 36px; }

.desk-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 30px;
  padding: 48px clamp(20px, 5vw, 80px);
  border-top: 1px solid var(--line);
  background: #050504;
}
.desk-footer > div:first-child p, .desk-footer > p { margin: 9px 0 0; color: var(--muted); font-size: 11px; }
.desk-footer > div:nth-child(2) { display: flex; gap: 20px; }
.desk-footer > p { justify-self: end; }

.auth-dialog {
  width: min(520px, calc(100% - 28px));
  padding: clamp(28px, 5vw, 50px);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  color: var(--paper);
  background: var(--panel);
  box-shadow: 16px 16px 0 var(--aubergine);
}
.auth-dialog::backdrop { background: rgba(8, 8, 7, .82); backdrop-filter: blur(4px); }
.auth-dialog h2 { margin: 0 0 24px; font: 400 47px/1 var(--serif); }
.auth-guidance { margin: -10px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dialog-close { position: absolute; top: 15px; right: 15px; padding: 2px 10px; border: 0; color: var(--paper); background: transparent; cursor: pointer; font-size: 26px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.auth-tabs button { padding: 12px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { border-color: var(--lime); color: var(--paper); }
.auth-form label { color: var(--paper-2); }
.auth-form label small { color: var(--muted); font-weight: 400; }
.auth-form .consent-row input { accent-color: var(--lime); }
.auth-submit { width: 100%; }
.text-button { width: max-content; padding: 0; border: 0; color: var(--paper-2); background: transparent; cursor: pointer; font-size: 12px; text-decoration: underline; }
.auth-status { min-height: 1.5em; margin: 18px 0 0; color: var(--lime); font: 11px/1.4 var(--mono); }

@media (max-width: 1180px) {
  .desk-hero { grid-template-columns: 1fr; }
  .xray { width: min(760px, 100%); }
  .desk-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .evidence-rail { grid-column: 1 / -1; display: grid; grid-template-columns: 160px 1fr 1fr 1fr; gap: 15px; border-top: 1px solid var(--line); border-left: 0; }
  .evidence-rail .rail-heading, .evidence-rail > div { margin-top: 0; }
  .method-grid { grid-template-columns: 1fr 1fr; }
  .method-grid article:nth-child(2) { border-right: 0; }
  .catalog-grid article { padding: 28px; }
}

@media (max-width: 760px) {
  .desk-header { min-height: 62px; grid-template-columns: 1fr auto; padding-inline: 16px; }
  .desk-header nav { display: none; }
  .desk-mark { width: 23px; height: 23px; }
  .desk-hero { min-height: auto; padding: 72px 20px 105px; }
  .desk-hero h1 { font-size: clamp(51px, 16vw, 78px); }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .xray { min-height: 500px; box-shadow: 10px 10px 0 rgba(80, 44, 82, .35); }
  .xray::before { inset: 24px; }
  .xray svg { display: none; }
  .xray-node { width: min(240px, calc(100% - 70px)); }
  .node-problem { top: 68px; left: 32px; }
  .node-evidence { top: 205px; left: 52px; }
  .node-decision { top: 342px; right: 32px; }
  .xray-note { display: none; }
  .desk-shell { width: calc(100% - 24px); grid-template-columns: 1fr; box-shadow: 8px 8px 0 rgba(80, 44, 82, .3); }
  .agent-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .agent-choice { display: inline-block; width: calc(33.333% - 5px); min-height: 80px; vertical-align: top; padding: 10px; }
  .agent-choice span { font-size: 12px; }
  .capacity-card { margin-top: 20px; }
  .conversation-header { padding: 20px; }
  .conversation-header > span { display: none; }
  .gate { width: calc(100% - 28px); margin-block: 42px; padding: 28px 22px; box-shadow: 7px 7px 0 var(--aubergine); }
  .field-row { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .message-list { padding-inline: 18px; }
  .message { grid-template-columns: 54px 1fr; gap: 8px; }
  .composer { margin-inline: 16px; }
  .composer-footer { align-items: stretch; flex-direction: column; }
  .evidence-rail { grid-template-columns: 1fr; }
  .method-section, .agent-catalog, .knowledge-section { width: calc(100% - 32px); }
  .method-grid, .catalog-grid, .knowledge-section { grid-template-columns: 1fr; }
  .method-grid article, .method-grid article:not(:first-child) { min-height: auto; padding: 28px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .catalog-grid article:nth-child(2) { transform: none; }
  .agent-request { align-items: stretch; flex-direction: column; }
  .agent-request a { text-align: center; }
  .knowledge-section { gap: 10px; }
  .knowledge-links { align-items: flex-start; flex-direction: column; }
  .desk-footer { grid-template-columns: 1fr; align-items: start; }
  .desk-footer > div:nth-child(2) { flex-wrap: wrap; }
  .desk-footer > p { justify-self: start; }
}

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

/* Dedicated portal shell */
html, body { height: 100%; overflow: hidden; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.desk-header { position: relative; height: 72px; }
.desk-product {
  margin: 0;
  font: 400 25px/1 var(--serif);
  text-align: center;
}
.desk-product span {
  display: block;
  margin-top: 5px;
  color: var(--lime);
  font: 500 8px/1 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.desk-account { justify-self: end; display: flex; align-items: center; gap: 18px; }
.desk-account > a { color: var(--muted); font: 10px var(--mono); text-underline-offset: 4px; }

#desk-main { height: calc(100svh - 72px); min-height: 0; }
.desk-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: clamp(230px, 18vw, 280px) minmax(0, 1fr) clamp(260px, 21vw, 320px);
  margin: 0;
  border-width: 0 0 1px;
  box-shadow: none;
  overflow: hidden;
}
.agent-rail, .evidence-rail { min-height: 0; overflow-y: auto; }
.agent-rail, .evidence-rail, .message-list {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.agent-rail::-webkit-scrollbar, .evidence-rail::-webkit-scrollbar, .message-list::-webkit-scrollbar { width: 7px; }
.agent-rail::-webkit-scrollbar-track, .evidence-rail::-webkit-scrollbar-track, .message-list::-webkit-scrollbar-track { background: transparent; }
.agent-rail::-webkit-scrollbar-thumb, .evidence-rail::-webkit-scrollbar-thumb, .message-list::-webkit-scrollbar-thumb { background: var(--line-strong); }
.agent-rail { display: flex; flex-direction: column; gap: 7px; }
.agent-rail .rail-heading { margin: 18px 0 8px; }
.agent-choice { min-height: 58px; margin: 0; }
.new-thread {
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--lime);
  color: var(--lime);
  background: transparent;
  cursor: pointer;
  font: 600 10px/1 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.new-thread:hover { color: var(--ink); background: var(--lime); }
.thread-history { min-height: 150px; margin-top: 20px; border-top: 1px solid var(--line); }
.history-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 18px 0 10px; }
.history-heading h2 { margin: 0; font: 400 22px var(--serif); }
.history-heading span { color: var(--muted); font: 8px var(--mono); text-transform: uppercase; }
.thread-history ol { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.thread-history button {
  width: 100%;
  min-height: 54px;
  display: block;
  padding: 10px 11px;
  overflow: hidden;
  border: 1px solid transparent;
  color: var(--paper-2);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.thread-history button:hover { border-color: var(--line-strong); background: var(--panel-2); }
.thread-history button[aria-current="page"] { border-color: var(--lime); background: rgba(200, 255, 55, .08); }
.thread-history button span, .thread-history button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-history button span { font-size: 12px; }
.thread-history button small { margin-top: 4px; color: var(--muted); font: 8px var(--mono); }
.capacity-card { margin-top: auto; }

.conversation { min-height: 0; overflow: hidden; }
.conversation-header { min-height: 92px; padding: 18px 26px; }
.gate { max-height: calc(100% - 132px); overflow-y: auto; }
.chat-workspace { min-height: 0; height: 100%; overflow: hidden; }
.message-list { min-height: 0; }
.composer { flex: 0 0 auto; }
input, select, button { min-height: 44px; }

@media (min-width: 821px) {
  .evidence-rail { grid-column: auto; display: block; border-top: 0; border-left: 1px solid var(--line); }
}

@media (max-width: 820px) {
  html, body { overflow: auto; }
  .desk-header { height: 62px; grid-template-columns: auto 1fr auto; gap: 10px; }
  .desk-product { font-size: 21px; }
  .desk-product span, .desk-account > a { display: none; }
  #desk-main { height: auto; min-height: calc(100svh - 62px); }
  .desk-shell { height: auto; min-height: calc(100svh - 62px); grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow: visible; }
  .agent-rail { display: block; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .agent-rail .rail-heading, .capacity-card { display: none; }
  .new-thread { width: 100%; margin-bottom: 8px; }
  .agent-choice { width: calc(33.333% - 5px); min-height: 70px; padding: 9px; }
  .thread-history { min-height: 0; margin-top: 10px; }
  .history-heading { padding: 10px 0 7px; }
  .thread-history ol { display: flex; gap: 7px; overflow-x: auto; }
  .thread-history li { flex: 0 0 170px; }
  .conversation { min-height: 620px; overflow: visible; }
  .chat-workspace { min-height: 520px; }
  .gate { max-height: none; }
  .evidence-rail { display: grid; grid-template-columns: 1fr; padding: 20px 16px; border-top: 1px solid var(--line); border-left: 0; overflow: visible; }
  .evidence-rail .rail-heading, .evidence-rail > div { margin-top: 0; }
}
