/* Tokens follow teem.cloud (2026-web/src/styles/global.css). */
:root {
  --font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --ink: #111827;
  --ink-muted: #5c6570;
  --surface: #f7f6f4;
  --surface-elevated: #ffffff;
  --border: #e5e2dc;
  --brand: #141820;
  --accent: #e8751a;
  --accent-hover: #cf6514;
  --accent-soft: #fef3e8;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceae6;
    --ink-muted: #a3a8b0;
    --surface: #12151b;
    --surface-elevated: #1b2029;
    --border: #2b313c;
    --brand: #eceae6;
    --accent-soft: #2a1e12;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* Layout rules below set display; `hidden` must still win. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font: 16px/1.55 var(--font-sans);
  color: var(--ink);
  background: var(--surface);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-family: var(--font-display);
}

button { font: inherit; cursor: pointer; }
.ghost {
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font-size: 14px;
}
.ghost:hover { border-color: var(--accent); }

main {
  flex: 1; overflow-y: auto;
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: 32px 16px 16px;
}

.welcome h1 {
  font: 600 clamp(28px, 5vw, 38px)/1.15 var(--font-display);
  margin: 24px 0 12px;
}
.welcome p { color: var(--ink-muted); max-width: 56ch; }
.starters {
  list-style: none; padding: 0; margin: 24px 0 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px;
}
.starters button {
  width: 100%; height: 100%; text-align: left;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-elevated); color: var(--ink);
}
.starters button:hover { border-color: var(--accent); background: var(--accent-soft); }

.log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.msg { max-width: 100%; }
.msg.user {
  align-self: flex-end; max-width: 85%;
  background: var(--brand); color: var(--surface);
  padding: 10px 16px; border-radius: var(--radius) var(--radius) 4px var(--radius);
  white-space: pre-wrap;
}
.msg.assistant {
  background: var(--surface-elevated); border: 1px solid var(--border);
  padding: 14px 18px; border-radius: 4px var(--radius) var(--radius) var(--radius);
}
.msg.assistant p, .msg.assistant ul, .msg.assistant ol { margin: 0 0 10px; }
.msg.assistant > :last-child { margin-bottom: 0; }
.msg.assistant li { margin: 4px 0; }
.msg.assistant a { color: var(--accent); font-weight: 600; }
.msg.assistant h3 { font-size: 16px; margin: 12px 0 6px; }
.msg.error { border-color: #d9534f; color: #b52b27; }
.msg.pending::after {
  content: "…"; display: inline-block; color: var(--ink-muted);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

.composer-wrap {
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: 8px 16px 16px;
}
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--surface-elevated);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px;
}
.composer:focus-within { border-color: var(--accent); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; padding: 8px; max-height: 200px;
}
.composer button {
  border: 0; border-radius: 10px; padding: 10px 18px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.composer button:hover { background: var(--accent-hover); }
.composer button:disabled { opacity: 0.5; cursor: default; }
.fineprint { font-size: 13px; color: var(--ink-muted); margin: 8px 4px 0; }

/* ---- access tiers ---- */
.top-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  font-size: 13px; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink); border: 1px solid var(--border);
  white-space: nowrap;
}
.ghost.link { border-color: transparent; color: var(--ink-muted); }

.gate {
  margin-top: 20px; padding: 20px;
  background: var(--surface-elevated); border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.gate h2 { font: 600 22px/1.2 var(--font-display); margin: 0 0 8px; }
.gate p { margin: 0 0 14px; color: var(--ink-muted); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack label, .stack legend { font-weight: 600; font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row input { flex: 1 1 200px; }
.gate input, .gate textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.row input { width: auto; }
.gate input:focus, .gate textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.gate button[type="submit"] {
  border: 0; border-radius: 10px; padding: 10px 18px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.gate button[type="submit"]:hover { background: var(--accent-hover); }
.gate button:disabled { opacity: 0.6; cursor: default; }
.gate fieldset { border: 0; padding: 0; margin: 6px 0 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; margin-top: 6px; }
.checks label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.checks input { width: auto; margin-top: 4px; }
.small { font-size: 13px; color: var(--ink-muted); font-weight: 400; }
.linkish { border: 0; background: none; padding: 0; color: var(--accent); font-size: 13px; text-decoration: underline; }
.gate-status { min-height: 1.2em; font-size: 14px; }
.gate-status.error { color: #b52b27; }
.gate-status.ok { color: #2e7d32; }

.note {
  align-self: center; font-size: 13px; color: var(--ink-muted);
  border: 1px dashed var(--border); border-radius: 999px; padding: 4px 12px;
}
.turnstile:empty { display: none; }
.turnstile { display: flex; justify-content: center; margin-bottom: 8px; }
.composer.locked { opacity: 0.55; }
@media (max-width: 520px) {
  .pill { font-size: 12px; padding: 3px 8px; }
  .brand span:last-child { display: none; }
}
