:root {
  --ground: #07080a;
  --surface: #0d0f12;
  --raised: #14171c;
  --hairline: rgba(255, 255, 255, .08);
  --hairline-strong: rgba(255, 255, 255, .16);
  --ink: #eef1f5;
  --ink-2: #98a1ad;
  --ink-3: #7c8593;
  --accent: #ff4d5e;
  --accent-ink: #1a0507;
  --ok: #54d6a0;
  --warn: #f5b960;
  --danger: #ff6b6b;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --sp-1: 6px;
  --sp-2: 10px;
  --sp-3: 14px;
  --sp-4: 20px;
  --sp-5: 28px;
  --elev: 0 0 0 1px var(--hairline), inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 40px -28px rgba(0, 0, 0, .9);
  --ease: cubic-bezier(.2, .7, .3, 1);
  --sidebar: 260px;
  --header: 56px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JB Mono", Menlo, Consolas, monospace;
}

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 78% -20%, rgba(255, 89, 101, .10), transparent 60%),
    linear-gradient(to bottom, rgba(8, 9, 11, .86), rgba(8, 9, 11, .94)),
    none;
  opacity: .17;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(1200px 800px at 70% 0%, #000 20%, transparent 75%);
}

.pm-scanlines { display: none !important; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; margin: 0 0 var(--sp-2); }
h1 { font-size: 22px; line-height: 28px; }
h2 { font-size: 16px; line-height: 24px; }
h3 { font-size: 14px; }
p { margin: 0 0 var(--sp-2); }
a { color: var(--ink); text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
strong { font-weight: 600; }
code, kbd, .mono, .hud-chip { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 50;
  background: var(--raised); padding: 8px 12px; border-radius: var(--r-sm);
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.app-header {
  box-sizing: border-box;
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--header); padding: 0 var(--sp-4);
  background: rgba(8, 9, 11, .82);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 14px; letter-spacing: .14em; }
.brand-sub { font-size: 10px; letter-spacing: .22em; color: var(--ink-3); }
.hud { display: flex; gap: 6px; margin-left: var(--sp-3); }
.hud-chip {
  padding: 4px 8px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink-2); white-space: nowrap;
}
.hud-chip.bad { color: var(--warn); border-color: rgba(245, 185, 96, .35); }
.hud-chip.good { color: var(--ok); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.avatar-btn {
  width: 32px; height: 32px; padding: 0; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--hairline-strong); background: var(--raised); cursor: pointer;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-pop {
  position: absolute; top: calc(var(--header) - 6px); right: var(--sp-4);
  min-width: 200px; padding: var(--sp-1); border-radius: var(--r-md);
  background: var(--raised); box-shadow: var(--elev); display: none;
}
.profile-pop.on { display: block; }
.profile-pop a, .profile-pop button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px;
  background: none; border: 0; color: var(--ink); font: inherit; cursor: pointer;
}
.profile-pop a:hover, .profile-pop button:hover { background: rgba(255, 255, 255, .06); }
.profile-pop-head { display: grid; gap: 1px; padding: 8px 10px 10px; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
.profile-pop-head strong { font-size: 13px; }
.profile-pop-head .muted { font-size: 11px; }

/* ---------- shell ---------- */
.app-shell {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: calc(100vh - var(--header));
}
.sidebar {
  position: sticky; top: var(--header); align-self: start;
  height: calc(100vh - var(--header)); overflow-y: auto;
  padding: var(--sp-3) var(--sp-2) var(--sp-5);
  background: linear-gradient(to right, rgba(13, 15, 18, .92), rgba(13, 15, 18, .65));
  border-right: 1px solid var(--hairline);
}
.nav-group { margin-bottom: var(--sp-1); }
.nav-label {
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 8px 8px 6px; font-size: 10px; letter-spacing: .16em; color: var(--ink-3);
}
.nav-label button {
  margin-left: auto; background: none; border: 0; color: var(--ink-3); cursor: pointer;
  padding: 0 2px; font-size: 10px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; margin: 1px 0; border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--ink); }
.nav-item.on {
  background: var(--raised); color: var(--ink); border-color: var(--hairline);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-icon { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-group.collapsed .nav-item { display: none; }
.nav-group.collapsed .nav-label { padding-bottom: 8px; }

main { min-width: 0; box-sizing: border-box; padding: var(--sp-4) var(--sp-4) 72px; max-width: 1180px; width: 100%; margin-inline: auto; display: flex; flex-direction: column; }

.pane { display: none; }
.pane.on { display: block; animation: rise .22s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

.pane-head { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.pane-head h1 { margin: 0; }
.pane-head .sub { color: var(--ink-3); font-size: 12px; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-3); margin-bottom: var(--sp-3);
}
.card.pad-lg { padding: var(--sp-4); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--sp-2); }
.metric { background: var(--raised); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: var(--sp-3); }
.metric .k { font-size: 10px; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; }
.metric .v { font-size: 24px; font-weight: 600; letter-spacing: -.03em; margin-top: 4px; }
.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- controls ---------- */
label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: var(--sp-1) 0 5px; }
input, textarea, select {
  width: 100%; box-sizing: border-box;
  background: #0a0c0e; color: var(--ink);
  border: 1px solid var(--hairline-strong); border-radius: var(--r-sm);
  padding: 9px 11px; font: inherit; font-size: 13px;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 89, 101, .16); }
textarea { min-height: 76px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--hairline-strong);
  background: var(--raised); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .12s var(--ease), border-color .12s var(--ease), transform .08s;
}
.btn:hover { background: #1b1f25; border-color: rgba(255, 255, 255, .24); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ff6d77; }
.btn-ghost { background: transparent; border-color: var(--hairline); color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { border-color: rgba(255, 107, 107, .4); color: var(--danger); background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink-2); font-size: 11px;
}
.chip.ok { color: var(--ok); border-color: rgba(84, 214, 160, .35); }
.chip.warn { color: var(--warn); border-color: rgba(245, 185, 96, .35); }
.chip.bad { color: var(--danger); border-color: rgba(255, 107, 107, .35); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--hairline); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); background: var(--surface); font-weight: 500; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- lists / misc ---------- */
.msg-line { min-height: 18px; color: var(--warn); font-size: 12px; margin-bottom: var(--sp-2); }
.list { display: grid; gap: 6px; }
.list-row { display: flex; gap: var(--sp-2); align-items: center; padding: 9px 12px; border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--surface); }
.list-row .grow { flex: 1; min-width: 0; }
.empty { padding: var(--sp-4); text-align: center; color: var(--ink-3); border: 1px dashed var(--hairline-strong); border-radius: var(--r-md); }
.bar { height: 6px; background: #0a0c0e; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

pre, .pre {
  background: #06070a; border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 10px 12px; overflow: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  max-height: 340px;
}

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-5) var(--sp-3); }
.auth-split {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(320px, 4fr);
  width: min(1080px, 100%); border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--hairline); box-shadow: var(--elev); background: var(--surface);
}
.auth-hero { position: relative; min-height: 520px; overflow: hidden; }
.auth-hero > img { position: absolute; inset: -10% 0; width: 100%; height: 120%; object-fit: cover; will-change: transform; }
.auth-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(8, 9, 11, .25), rgba(8, 9, 11, .82) 85%);
}
.auth-hero-copy { position: absolute; left: var(--sp-5); bottom: var(--sp-5); z-index: 1; max-width: 22ch; }
.auth-hero-copy h2 { font-size: 26px; line-height: 1.15; }
.auth-card { padding: var(--sp-5); display: flex; flex-direction: column; justify-content: center; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .muted { margin-bottom: var(--sp-4); font-size: 13px; }
.auth-card form { display: grid; gap: var(--sp-2); }
.auth-foot { margin-top: var(--sp-3); font-size: 12.5px; color: var(--ink-2); }

/* ---------- chat ---------- */
.chat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-3); align-items: start; }
.chat { display: flex; flex-direction: column; min-height: 420px; height: calc(100vh - 210px); border: 1px solid var(--hairline); border-radius: var(--r-md); background: rgba(13, 15, 18, .72); overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-3) max(24px, (100% - 900px) / 2); display: flex; flex-direction: column; gap: var(--sp-3); }
.chat-recipes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.recipes-head { grid-column: 1 / -1; display: grid; gap: 2px; text-align: center; margin-bottom: 4px; }
.recipes-head strong { font-size: 15px; }
.recipes-head .muted { font-size: 12px; }
.recipe { text-align: left; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-2); cursor: pointer; font: inherit; }
.recipe strong { display: block; color: var(--ink); font-size: 12.5px; }
.recipe span { font-size: 11.5px; }
.recipe:hover { border-color: var(--hairline-strong); }

.msg { display: flex; gap: 10px; max-width: 900px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 24px; height: 24px; border-radius: 50%; overflow: hidden; flex: none; border: 1px solid var(--hairline); }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-bubble { padding: 12px 15px; border-radius: var(--r-md); background: var(--raised); border: 1px solid var(--hairline); font-size: 14px; line-height: 1.6; }
.msg.user .msg-bubble { background: rgba(255, 89, 101, .09); border-color: rgba(255, 89, 101, .32); border-bottom-right-radius: 6px; }
.msg.assistant .msg-bubble { border-bottom-left-radius: 6px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble .caret { display: inline-block; width: 6px; height: 14px; margin-left: 2px; background: var(--accent); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg-actions { display: flex; gap: 6px; margin-top: 6px; opacity: 0; transition: opacity .12s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button { background: none; border: 0; color: var(--ink-3); font-size: 11px; cursor: pointer; padding: 0; }
.msg-actions button:hover { color: var(--ink); }

.phase { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.phase i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

details.tool { border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--surface); font-size: 12.5px; }
details.tool summary { list-style: none; display: flex; gap: 8px; align-items: center; padding: 8px 10px; cursor: pointer; }
details.tool summary::-webkit-details-marker { display: none; }
details.tool .tool-body { border-top: 1px solid var(--hairline); padding: 8px 10px; }
details.tool.ok summary { box-shadow: inset 2px 0 0 var(--ok); }
details.tool.bad summary { box-shadow: inset 2px 0 0 var(--danger); }
details.tool.run summary { box-shadow: inset 2px 0 0 var(--accent); }
.tool-actions { display: flex; gap: 6px; margin-left: auto; }

.composer { border: 1px solid var(--hairline-strong); border-radius: var(--r-md); padding: 14px 16px; background: var(--raised); display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 8px; min-height: 132px; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset; }
.composer:focus-within { border-color: rgba(255, 77, 94, .55); box-shadow: 0 0 0 3px rgba(255, 77, 94, .12); }
.composer-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.composer textarea { border: 0; background: transparent; min-height: 72px; max-height: 260px; padding: 8px 4px; font-size: 15px; line-height: 1.55; color: var(--ink); }
.composer textarea::placeholder { color: var(--ink-3); }
.composer textarea:focus { box-shadow: none; }
.composer-bottom { display: flex; gap: 8px; align-items: center; }
.composer-bottom .btn-primary { min-width: 96px; padding: 9px 18px; }
.queued { font-size: 11px; color: var(--warn); }

.chat-rail { border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.rail-tabs { display: flex; border-bottom: 1px solid var(--hairline); }
.rail-tab { flex: 1; padding: 8px 4px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--ink-3); font: inherit; font-size: 12px; cursor: pointer; }
.rail-tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.rail-pane { display: none; padding: var(--sp-2); max-height: 480px; overflow: auto; }
.rail-pane.on { display: block; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .chat-wrap { grid-template-columns: minmax(0, 1fr); }
  .chat-rail { order: 2; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: var(--header); z-index: 25; width: var(--sidebar); transform: translateX(-104%); transition: transform .22s var(--ease); }
  .sidebar.open { transform: none; box-shadow: 0 40px 80px rgba(0, 0, 0, .6); }
  main { padding: var(--sp-3) var(--sp-3) 64px; overflow-x: clip; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hud { display: none; }
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { min-height: 200px; }
  .auth-hero-copy { left: var(--sp-4); bottom: var(--sp-4); }
  .chat { height: calc(100vh - 190px); min-width: 0; }
  .chat-log > .msg { max-width: 100%; }
  .card, .metric, .list-row { min-width: 0; }
  table { min-width: 520px; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  #who { display: none; }
  .hud-chip { font-size: 10.5px; }
  .composer textarea { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}




/* ---- brand, shell, chat v2 ---- */
.brand img { display: block; filter: saturate(105%); }
.chat-shell { display: grid; grid-template-columns: 248px minmax(0,1fr); gap: var(--sp-3); height: calc(100vh - 150px); min-height: 480px; }
.thread-rail { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface); padding: 10px; min-height: 0; }
.thread-rail-head { display: grid; gap: 6px; }
.thread-search { padding: 7px 9px; font-size: 12px; }
.thread-list { overflow: auto; display: grid; gap: 2px; }
.thread-row { display: flex; align-items: center; border-radius: 8px; }
.thread-row.on, .thread-row:hover { background: rgba(255,255,255,.05); }
.thread-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 7px 8px; background: none; border: 0; color: var(--ink-2); text-align: left; font: inherit; font-size: 12.5px; cursor: pointer; }
.thread-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-open time { font-size: 10.5px; color: var(--ink-3); }
.thread-row.on .thread-open { color: var(--ink); }
.thread-menu { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px 6px; }
.chat { height: auto; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--hairline); background: var(--surface); }
.chat-head-main { display: grid; min-width: 0; }
.chat-head-main strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-main span { font-size: 11px; }
.chat-log { padding: 14px max(24px, (100% - 900px) / 2); }
.msg-body { display: grid; gap: 8px; min-width: 0; }
.msg-body > :not(.msg-actions):not(.phase):not(.side-note) { background: var(--raised); border: 1px solid var(--hairline); border-radius: 14px; padding: 10px 13px; }
.msg.user .msg-body > :not(.msg-actions) { background: rgba(255,77,94,.09); border-color: rgba(255,77,94,.28); }
.msg-body .md { font-size: 14px; line-height: 1.62; overflow-wrap: anywhere; }
.msg-body .md > :first-child { margin-top: 0; } .msg-body .md > :last-child { margin-bottom: 0; }
.msg-body .md h3, .msg-body .md h4, .msg-body .md h5 { margin: 10px 0 6px; font-size: 14px; }
.msg-body .md ul, .msg-body .md ol { margin: 6px 0; padding-left: 20px; }
.msg-body .md code { background: #06070a; border: 1px solid var(--hairline); border-radius: 5px; padding: 1px 5px; font-size: 12px; }
.msg-body .md pre code { border: 0; padding: 0; background: none; }
.code { border: 1px solid var(--hairline); border-radius: 10px; overflow: hidden; background: #06070a; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 9px; border-bottom: 1px solid var(--hairline); font-size: 10.5px; color: var(--ink-3); }
.code pre { margin: 0; padding: 10px; max-height: 320px; }
.code-copy { background: none; border: 0; color: var(--ink-3); font-size: 10.5px; cursor: pointer; }
.msg-actions { display: flex; gap: 8px; opacity: 0; transition: opacity .12s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button, .msg-edit { background: none; border: 0; color: var(--ink-3); font-size: 11px; cursor: pointer; padding: 0; }
.msg-edit { align-self: flex-end; }
.msg-actions button:hover, .msg-edit:hover { color: var(--ink); }
.approval-card { border: 1px solid rgba(245,185,96,.4) !important; display: grid; gap: 6px; }
.approval-card pre { margin: 0; max-height: 140px; }
.ask-dock { position: fixed; right: 18px; bottom: 18px; width: 380px; max-width: calc(100vw - 24px); height: 520px; z-index: 40; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--hairline-strong); border-radius: var(--r-md); box-shadow: var(--elev); }
.ask-dock-head { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--hairline); }
.ask-dock-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ask-dock-form { display: flex; gap: 6px; padding: 9px; border-top: 1px solid var(--hairline); }
.ask-dock-form textarea { min-height: 40px; max-height: 120px; }
.plan .price { font-size: 22px; margin: 4px 0 8px; }
.footnote { font-size: 12px; color: var(--ink-3); }
@media (max-width: 1200px) { .chat-shell { grid-template-columns: 210px minmax(0,1fr); } }
@media (max-width: 1024px) { .chat-shell { grid-template-columns: minmax(0,1fr); } .thread-rail { display: none; } .chat-rail { display: none; } .chat-rail:not([hidden]) { display: block; } }
@media (max-width: 640px) { .ask-dock { inset: auto 0 0 0; width: auto; height: 70vh; border-radius: var(--r-lg) var(--r-lg) 0 0; } }
.msg > .msg-avatar { position: absolute; left: 0; top: 17px; width: 24px; height: 24px; padding: 0; background: none; border: 1px solid var(--hairline-strong); border-radius: 50%; overflow: hidden; }
.msg.user > .msg-avatar { left: auto; right: 0; }
.msg > .msg-body { padding: 0; background: none; border: 0; }


/* ---- v2.3: plan, contact, checkout, chat full-bleed ---- */
.eyebrow { display: block; font: 500 10.5px/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; }
.seg-btn { background: none; border: 0; color: var(--ink-2); padding: 7px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.seg-btn.on { background: var(--raised); color: var(--ink); }
.plan-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 10px; }
.plan-card { position: relative; text-align: left; padding: 16px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color .12s, transform .12s; }
.plan-card:hover { border-color: var(--hairline-strong); }
.plan-card.on { border-color: var(--accent); transform: translateY(-2px); }
.plan-card ul { margin: 10px 0 14px; padding-left: 16px; display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.plan-price { display: block; margin-top: 6px; font: 600 26px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.plan-price i { font: 400 12px var(--sans); color: var(--ink-3); }
.plan-pick { font-size: 12px; color: var(--ink-2); }
.plan-card.on .plan-pick { color: var(--accent); }
.badge-rec { position: absolute; top: -9px; right: 12px; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 600 10px var(--mono); text-transform: uppercase; }
.panel-current .grow { min-width: 0; }
.allowance { width: 160px; }
.allowance span { font: 11px var(--mono); color: var(--ink-3); }
.allowance i { display: block; margin-top: 5px; height: 6px; border-radius: 99px; background: var(--accent); width: var(--pct); }
.checklist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.checklist li::before { content: "＋"; color: var(--ok); margin-right: 7px; }

.contact-list { display: grid; gap: 8px; }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--surface); }
.contact-k { width: 96px; color: var(--ink-3); font-size: 10.5px; letter-spacing: .12em; }
.contact-v { flex: 1; font-size: 14px; font-weight: 500; }
.contact-v:hover { color: var(--accent); }

.chat-shell { grid-template-columns: clamp(190px, 15vw, 236px) minmax(0, 1fr); height: calc(100dvh - 56px - 20px); min-height: 0; }
#pane-chat { display: none; }
#pane-chat.on { display: block; margin: 0 calc(-1 * var(--sp-4)) -72px; padding: 0 var(--sp-4); max-width: none; }
#pane-chat .chat-shell { max-width: none; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-log { flex: 1; min-height: 0; padding-inline: max(24px, (100% - 900px) / 2); }
.chat-log > .msg { max-width: 900px; }
.chat-log > .chat-recipes { margin: auto 0; } /* center the empty state in the log */
.composer { max-width: 980px; width: 100%; margin: 0 auto; }
.side-sheet { max-width: 980px; width: 100%; margin: 10px auto 0; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface); padding: 10px; display: grid; gap: 8px; }
.side-head { display: flex; align-items: center; gap: 8px; }
.side-head .muted { font-size: 11px; }
.side-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.side-input { min-height: 40px; max-height: 120px; }
.side-answer .side-note { font-size: 11px; color: var(--ink-3); }
.jump-pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: 96px; display: none; }
.jump-pill.on { display: inline-flex; }

.checkout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.summary { position: sticky; top: 72px; }
.sum-total { font: 600 24px var(--mono); margin-top: 10px; }
.sum-total i { font: 400 12px var(--sans); color: var(--ink-3); }
.method-list { display: grid; gap: 6px; }
.method { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--r-sm); cursor: pointer; }
.method.on { border-color: var(--accent); background: rgba(255,77,94,.06); }
.method input { width: auto; }
.agree { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink-2); }
.agree input { width: auto; margin-top: 2px; }
.pay-card { display: grid; gap: 8px; }
.pay-amount { font-size: 26px; }
.addr { font-size: 12px; word-break: break-all; }
.pay-card img { border: 1px solid var(--hairline); border-radius: 10px; background: #fff; padding: 6px; }
.status-line { text-align: center; color: var(--warn); font-size: 12.5px; }
.done-card { text-align: center; display: grid; gap: 8px; justify-items: center; }
.done-ring { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--ok); color: var(--ok); font-size: 24px; animation: ring .5s var(--ease); }
@keyframes ring { from { transform: scale(.6); opacity: 0; } }
@media (max-width: 860px) { .checkout { grid-template-columns: minmax(0, 1fr); } .plan-cards { grid-template-columns: minmax(0, 1fr); } #pane-chat.on { margin: 0 calc(-1 * var(--sp-3)); padding: 0 var(--sp-3); } .chat-shell { height: calc(100dvh - 56px - 12px); } }
.chat { position: relative; }
.jump-pill { position: absolute; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 3; display: none; }
.jump-pill.on { display: inline-flex; }
@media (max-width: 900px) {
  .thread-rail { display: none; }
  .thread-rail.open { display: flex; position: fixed; z-index: 35; left: 12px; top: 68px; bottom: 12px; width: 260px; box-shadow: var(--elev); }
  #chat-threads-toggle { display: inline-flex; }
}
@media (min-width: 901px) { #chat-threads-toggle { display: none; } }
.bg-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .12; mix-blend-mode: luminosity; mask-image: linear-gradient(to bottom, #000 55%, transparent); }
.bg-layer img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
.rv { opacity: 0; transform: translateY(4px); }
.rv.in { opacity: 1; transform: none; transition: opacity .18s var(--ease), transform .18s var(--ease); }
.palette { position: fixed; inset: 0; z-index: 60; background: rgba(4,5,7,.62); backdrop-filter: blur(3px); display: grid; place-items: start center; padding-top: 16vh; }
.palette-box { width: min(520px, 92vw); background: var(--raised); border: 1px solid var(--hairline-strong); border-radius: var(--r-md); box-shadow: var(--elev); overflow: hidden; }
.palette-box input { border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; padding: 12px 14px; font-size: 14px; background: transparent; }
.palette-box input:focus { box-shadow: none; }
.palette-box ul { list-style: none; margin: 0; padding: 6px; max-height: 320px; overflow: auto; }
.palette-box li { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.palette-box li[aria-selected="true"] { background: var(--surface); }
.palette-box kbd { font-size: 10px; color: var(--ink-3); }
.palette-foot { display: flex; gap: 14px; padding: 7px 12px; border-top: 1px solid var(--hairline); font-size: 10.5px; color: var(--ink-3); }
.balance-hero { display: grid; gap: 2px; }
.balance { font: 600 34px/1.1 var(--mono); font-variant-numeric: tabular-nums; margin: 4px 0; }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.pack { display: grid; gap: 4px; justify-items: start; padding: 14px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; }
.pack:hover { border-color: var(--hairline-strong); }
.pack.on { border-color: var(--accent); }
.pack-cr { font-size: 20px; font-weight: 600; }
.neg { color: var(--danger); } .pos { color: var(--ok); }

main:has(#pane-chat.on) { max-width: none; }
.chat-head { position: relative; }
#pane-chat.on { height: calc(100dvh - 100px); padding-top: 12px; padding-bottom: 12px; box-sizing: border-box; overflow: hidden; }
#pane-chat .chat-shell { height: 100%; }

.chat-shell { grid-template-columns: clamp(190px, 14vw, 220px) minmax(0, 1fr); }
.chat-rail { position: fixed; z-index: 45; right: 16px; top: 68px; bottom: 16px; width: 320px; max-width: calc(100vw - 24px); box-shadow: var(--elev); }
.rail-head { display: flex; align-items: center; border-bottom: 1px solid var(--hairline); }
.rail-head .rail-tabs { flex: 1; min-width: 0; border-bottom: 0; }
.rail-close { flex: none; width: 36px; height: 36px; margin: 0 6px; display: grid; place-items: center; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.rail-close:hover { border-color: var(--hairline-strong); background: var(--raised); color: var(--ink); }
.rail-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 1280px) { .chat-shell { grid-template-columns: 200px minmax(0, 1fr); } }

/* ---- settings v2: sticky index + sections ---- */
.settings-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--sp-3); align-items: start; }
.settings-index { position: sticky; top: 74px; display: grid; gap: 2px; padding: 8px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--surface); }
.settings-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.settings-item:hover { background: rgba(255,255,255,.05); color: var(--ink); }
.settings-item.on { background: var(--surface-2, rgba(255,255,255,.06)); color: var(--ink); font-weight: 600; }
.settings-body { display: grid; gap: var(--sp-3); min-width: 0; }
.settings-sec h2 { margin: 0 0 10px; font-size: 16px; }
.settings-sec h3 { margin: 0 0 6px; font-size: 13.5px; }
.session-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 12.5px; }
.session-row:last-child { border-bottom: 0; }
.session-row .mono { font-size: 11px; }
@media (max-width: 900px) { .settings-shell { grid-template-columns: minmax(0, 1fr); } .settings-index { position: static; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; } }


/* Client interface refinement */
:root { --ink-2: #a8b0bd; --ink-3: #929cab; --sans: var(--font); }
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-color: #3b414c #0d0f12; scrollbar-width: thin; }
.app-header { box-shadow: 0 8px 32px -24px #000; }
.sidebar { padding: 20px 12px; }
.nav-label { min-height: 40px; letter-spacing: .13em; }
.nav-label button { min-width: 32px; min-height: 32px; font-size: 14px; }
.nav-item { min-height: 42px; padding: 10px 12px; gap: 12px; }
.nav-item.on { background: linear-gradient(100deg, rgba(255,77,94,.1), #14171c 85%); border-color: rgba(255,77,94,.18); }
.nav-icon { width: 17px; height: 17px; }
.pane-head { margin-bottom: 24px; padding: 6px 0 18px; border-bottom: 1px solid var(--hairline); gap: 8px 16px; }
.pane-head h1 { font-size: clamp(23px, 2.3vw, 30px); line-height: 1.2; letter-spacing: -.035em; }
.pane-head .sub { font-size: 13px; color: var(--ink-2); }
.card, .metric { box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 10px 32px -24px #000; }
.card { padding: 20px; }
.grid { gap: 14px; }
.metric { padding: 20px; background: linear-gradient(145deg,#191d24,#11141a); }
.metric .k { color: var(--ink-2); letter-spacing: .1em; }
.metric .v { margin-top: 12px; font-size: 32px; font-variant-numeric: tabular-nums; }
.btn { min-height: 40px; text-decoration: none; font-weight: 550; transition: background .16s var(--ease), border-color .16s var(--ease), box-shadow .16s var(--ease), transform .12s var(--ease); }
.btn-sm { min-height: 34px; padding: 6px 11px; }
.btn-primary { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 4px 16px -10px rgba(255,77,94,.6); }
.btn:disabled { cursor: wait; }
input, select { min-height: 42px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
label { font-size: 12px; letter-spacing: .025em; text-transform: none; color: var(--ink-2); }
th { padding: 13px 16px; color: var(--ink-2); letter-spacing: .08em; }
td { padding: 14px 16px; overflow-wrap: anywhere; }
.list-row { padding: 14px 16px; }
.empty { padding: 36px 24px; background: rgba(20,23,28,.45); line-height: 1.7; }
.profile-pop { max-width: calc(100vw - 24px); border: 1px solid var(--hairline-strong); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.profile-pop-head strong { overflow-wrap: anywhere; }
.settings-sec { scroll-margin-top: 80px; }
.settings-index button { min-height: 40px; }
.contact-v, .session-row, .kv dd { min-width: 0; overflow-wrap: anywhere; }
.plan-card { padding: 24px 20px; }
.plan-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(255,77,94,.15); }
.thread-rail { padding: 14px; gap: 14px; }
.thread-rail-head { gap: 10px; }
.thread-row { border: 1px solid transparent; }
.thread-row.on { border-color: var(--hairline-strong); background: var(--raised); }
.thread-open { padding: 10px; gap: 4px; }
.thread-menu { min-height: 32px; min-width: 28px; }
.chat-head { min-height: 64px; padding: 12px 18px; }
.chat-head-main { flex: 1; }
.chat-head-main strong { font-size: 14px; }
.chat-head-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { gap: 24px; padding-block: 24px; scrollbar-gutter: stable; }
.chat-log > .msg { min-width: 0; flex-shrink: 0; }
.msg-body { max-width: 100%; }
.msg-body .md { font-size: 14px; line-height: 1.8; }
.msg-body > .md { padding: 16px 20px !important; }
.msg-body .md p + p { margin-top: 12px; }
.msg-body .md blockquote { border-left: 2px solid var(--accent); padding-left: 14px; margin: 12px 0; color: var(--ink-2); }
.msg-body .md pre { max-width: 100%; }
.msg-body .md table { display: block; max-width: 100%; overflow-x: auto; min-width: 0; }
.msg-actions button, .msg-edit, .code-copy { min-height: 32px; padding: 5px 8px; border-radius: 6px; }
.msg-actions button:hover, .code-copy:hover { background: rgba(255,255,255,.06); }
.composer { min-height: 132px; padding: 14px 18px; flex-shrink: 0; margin-bottom: max(12px, env(safe-area-inset-bottom)); border-radius: 20px; box-shadow: 0 12px 32px -16px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05); }
.composer textarea { min-height: 72px; }
.code-head { min-height: 38px; }
.report-preview-row > td { padding: 20px; background: #101319; }
.report-preview-row table { table-layout: fixed; }
.report-preview-row th:first-child { width: 100px; }
.report-preview-row th:last-child { width: 35%; }
@media (hover: none) { .msg-actions { opacity: 1; } }
@media (max-width: 860px) {
  .card, .metric { padding: 16px; }
  .pane-head { margin-bottom: 18px; }
  .btn, .btn-sm, .nav-item { min-height: 44px; }
  input, textarea, select, .composer textarea { font-size: 16px; }
  .chat-head { padding: 10px 12px; }
  .chat-log { padding-inline: 12px; }
  .composer { padding: 12px; }
  .msg-body > .md { padding: 12px 14px !important; }
  .session-row { flex-wrap: wrap; }
  .profile-pop { right: 12px; }
  .report-preview-row table { min-width: 520px; }
}
@media (forced-colors: active) { .nav-item.on, .plan-card[aria-checked="true"] { outline: 2px solid Highlight; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}


/* Navigation states, reading comfort and stored-result summary */
[hidden] { display: none !important; }
.nav-item { position: relative; overflow: hidden; transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease); }
.nav-item::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 15%, rgba(255,255,255,.04) 55%, transparent 85%); opacity: 0; transition: opacity .18s var(--ease); }
.nav-item:hover::after { opacity: 1; }
.nav-icon { transition: transform .18s var(--ease); }
.nav-item:hover .nav-icon { transform: translateX(2px); }
.nav-label button { transition: transform .18s var(--ease), color .18s var(--ease); }
.nav-label button[aria-expanded="false"] { transform: rotate(-90deg); }
.profile-pop.on { animation: rise .18s var(--ease); }
.profile-pop a, .profile-pop button { text-decoration: none; min-height: 40px; }
.profile-pop [role="menuitem"]:focus-visible { background: rgba(255,255,255,.06); }
.chat-log > .msg > .msg-actions { background: none; border: 0; padding: 0; }
.msg-body .md { font-size: var(--chat-reading-size, 14px); }
.reading-toggle { font: 600 15px Georgia, serif; min-width: 40px; }
.composer-hint { color: var(--ink-3); font-size: 11px; }
#metrics .card { position: relative; margin-bottom: 0; padding: 20px; background: linear-gradient(145deg,#191d24,#11141a); }
#metrics .card h2 { margin: 10px 0 0; font-size: 32px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.overview-insights { margin-top: 20px; }
.overview-insights:empty { display: none; }
.insight-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.insight-head h2 { margin: 5px 0 0; }
.insight-head > .muted { font-size: 12px; }
.severity-chart { display: flex; gap: 4px; height: 14px; overflow: hidden; border-radius: 6px; }
.severity-segment { min-width: 3px; }
.severity-critical { background: #ff4d5e; }
.severity-high { background: #fa9b68; }
.severity-medium { background: #f0c875; }
.severity-low { background: #72cbaa; }
.severity-info { background: #859dc4; }
.severity-legend { display: flex; flex-wrap: wrap; gap: 12px 24px; margin-top: 18px; }
.severity-legend > span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); text-transform: capitalize; }
.severity-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.severity-legend strong { color: var(--ink); font-variant-numeric: tabular-nums; }
@media (min-width: 861px) { .sidebar-toggle { display: none; } }
@media (max-width: 860px) { .composer-hint { display: none; } .chat-head { gap: 6px; } .reading-toggle { min-width: 36px; } }
@media (prefers-reduced-motion: reduce) { .nav-item:hover .nav-icon { transform: none; } }


/* Product Design: account and entry experience */
:root { --entry-shadow: 0 32px 100px -48px rgba(0,0,0,.9); }
.auth-body { min-height: 100dvh; padding: clamp(16px, 4vw, 56px); }
.auth-split { width: min(1120px,100%); grid-template-columns: minmax(0,1fr) minmax(380px,.94fr); border-color: rgba(255,255,255,.12); box-shadow: var(--entry-shadow), inset 0 1px 0 rgba(255,255,255,.04); }
.auth-hero { min-height: 610px; }
.auth-hero::after { background: linear-gradient(180deg,rgba(7,8,10,.05) 30%,rgba(7,8,10,.93) 100%); }
.auth-hero-copy { left: 36px; right: 36px; bottom: 36px; max-width: 36ch; }
.auth-hero-copy h2 { font-size: clamp(28px,3vw,38px); line-height: 1.12; letter-spacing: -.035em; text-wrap: balance; }
.auth-hero-copy .muted { max-width: 38ch; color: #c1c7d0; font-size: 14px; line-height: 1.75; }
.auth-card { padding: clamp(24px,4vw,48px); background: rgba(13,15,18,.96); min-width: 0; }
.auth-wordmark { margin-bottom: 36px; justify-content: space-between; text-decoration: none; }
.auth-wordmark img { max-width: 150px; }
.auth-eyebrow { margin-bottom: 10px; color: var(--accent); }
.auth-card h1 { font-size: clamp(28px,3vw,36px); line-height: 1.15; letter-spacing: -.035em; text-wrap: balance; }
.auth-card > .muted { margin-top: 8px; margin-bottom: 28px; line-height: 1.7; font-size: 14px; }
.auth-card form { gap: 18px; }
.auth-card form > div { margin: 0; min-width: 0; }
.auth-card form label { margin: 0 0 8px; font-size: 13px; letter-spacing: 0; color: #c1c7d0; }
.auth-card form input { min-height: 48px; background: #0b0d10; font-size: 15px; }
.auth-card form input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,107,.09); }
.auth-card .btn-primary { min-height: 48px; font-size: 14px; }
.auth-inline-note { display:block; margin-top:5px; color:var(--ink-3); font-size:11px; line-height:1.45; }
.auth-card #auth-msg { min-height: 0; margin: 0; font-size: 13px; line-height: 1.6; }
.auth-card #auth-msg:empty { display: none; }
.auth-foot { margin: 24px 0 0; font-size: 13px; line-height: 1.8; }
.auth-foot a { text-decoration: underline; text-decoration-color: rgba(255,255,255,.25); }
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { padding-right: 72px; }
.password-visibility { position: absolute; right: 6px; top: 6px; bottom: 6px; min-width: 54px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--ink-2); font: 500 12px var(--font); cursor: pointer; }
.password-visibility:hover { background: rgba(255,255,255,.055); color: var(--ink); }
.password-guidance { margin: 8px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.invite-details { font-size: 12px; color: var(--ink-2); }
.invite-details summary { cursor: pointer; padding: 4px 0; }
.invite-details[open] summary { margin-bottom: 12px; }
.invite-details input { margin-top: 6px; }
.workspace-summary { padding: 24px; border-color: rgba(255,255,255,.12); background: linear-gradient(130deg,#181b22,#0d0f12 75%); }
.workspace-summary-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.workspace-summary-head h2 { margin: 6px 0 0; font-size: 20px; letter-spacing: -.025em; }
.account-facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 24px; margin-top: 28px; }
.account-facts > div { display: grid; align-content: start; gap: 7px; min-width: 0; padding-right: 16px; border-right: 1px solid var(--hairline); }
.account-facts > div:last-child { border-right: 0; padding-right: 0; }
.account-facts span { color: var(--ink-2); font-size: 12px; }
.account-facts strong { font-size: 17px; font-weight: 550; text-transform: capitalize; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.workspace-summary-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--hairline); font-size: 12px; }
.summary-security-link { color: var(--ink); text-decoration-color: rgba(255,255,255,.3); }
.pane.on { animation: pane-enter .24s var(--ease); }
@keyframes pane-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.btn:focus-visible, .nav-item:focus-visible, .password-visibility:focus-visible { outline-offset: 4px; }
.btn-primary:not(:disabled):hover { box-shadow: 0 8px 24px -12px rgba(255,77,94,.5), inset 0 1px 0 rgba(255,255,255,.16); }
.thread-row, .list-row { transition: background .16s var(--ease), border-color .16s var(--ease); }
.thread-row:hover, .list-row:hover { border-color: rgba(255,255,255,.17); }
.list-row .grow, .agent-body, .agent-goal { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: fade-out .12s ease both; }
  ::view-transition-new(root) { animation: fade-in .18s ease both; }
  @keyframes fade-out { to { opacity: 0; } }
  @keyframes fade-in { from { opacity: 0; } }
  @starting-style { .profile-pop.on { opacity: 0; } }
}
@media (max-width: 860px) {
  .auth-split { grid-template-columns: minmax(0,1fr); max-width: 560px; }
  .auth-hero { min-height: 210px; max-height: 240px; }
  .auth-hero-copy { left: 24px; right: 24px; bottom: 20px; }
  .auth-hero-copy h2 { font-size: 25px; max-width: 24ch; }
  .auth-hero-copy .muted { display: none; }
  .auth-wordmark { margin-bottom: 24px; }
  .auth-card form input { font-size: 16px; }
  .account-facts { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
  .account-facts > div:nth-child(2) { border-right: 0; }
}
@media (max-width: 480px) {
  .auth-body { padding: 12px; }
  .auth-hero { min-height: 160px; max-height: 180px; }
  .auth-card { padding: 28px 22px; }
  .auth-card h1 { font-size: 28px; }
  .workspace-summary { padding: 20px; }
  .account-facts strong { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}


/* Registration stays compact on standard laptop displays. */
@media (min-width: 861px) {
  .auth-body[data-auth-page="register"] { padding: 20px; }
  [data-auth-page="register"] .auth-card { padding: 30px 40px; }
  [data-auth-page="register"] .auth-wordmark { margin-bottom: 20px; }
  [data-auth-page="register"] .auth-eyebrow { margin-bottom: 8px; }
  [data-auth-page="register"] .auth-card h1 { font-size: 32px; }
  [data-auth-page="register"] .auth-card > .muted { margin-bottom: 20px; }
  [data-auth-page="register"] .auth-card form { gap: 12px; }
  [data-auth-page="register"] .auth-card form label { margin-bottom: 6px; }
  [data-auth-page="register"] .auth-foot { margin-top: 18px; }
}


/* Client workflow refinements */
.thread-context-menu { position: fixed; z-index: 90; width: 190px; padding: 5px; border: 1px solid var(--hairline-strong); border-radius: 12px; background: rgba(20,23,28,.98); box-shadow: 0 18px 42px rgba(0,0,0,.5); backdrop-filter: blur(16px); animation: menu-in .12s var(--ease); }
.thread-context-menu button { display:block; width:100%; border:0; border-radius:8px; padding:9px 10px; background:transparent; color:var(--ink); font:inherit; text-align:left; cursor:pointer; }
.thread-context-menu button:hover, .thread-context-menu button:focus-visible { background:rgba(255,255,255,.08); }
.thread-context-menu button.danger-item { color:var(--danger); }
.thread-context-menu button.danger-item:hover, .thread-context-menu button.danger-item:focus-visible { background:rgba(255,70,82,.12); }
.service-status-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:12px; }
.service-status-card { display:flex; align-items:center; gap:12px; }
.service-status-card p { margin:3px 0 0; }
.service-status-card .chip { margin-left:auto; }
.status-dot { width:9px; height:9px; flex:none; border-radius:50%; background:var(--warn); box-shadow:0 0 0 4px rgba(245,185,96,.1); }
.status-dot.ok { background:var(--ok); box-shadow:0 0 0 4px rgba(84,214,160,.1); }
.status-updated { grid-column:1/-1; font-size:12px; }
.findings-controls { margin-bottom:12px; }
.findings-controls input[type=search] { flex:1; min-width:180px; }
.findings-summary { display:flex; align-items:center; gap:8px 12px; flex-wrap:wrap; margin:0 0 12px; padding:12px 14px; border:1px solid var(--hairline); border-radius:12px; background:rgba(13,15,18,.74); }
.findings-summary > strong { font-size:20px; }
.findings-summary .severity-legend { margin-left:auto; }
.findings-table th { white-space:nowrap; }
.finding-check { display:block; margin-top:3px; font-size:11px; }
.finding-target { max-width:320px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.finding-detail { margin:0 0 12px; }
.finding-detail details { margin-top:10px; }
.report-brand, .report-preview-brand { display:flex; align-items:center; gap:14px; margin-bottom:14px; padding:14px 16px; border:1px solid var(--hairline); border-radius:14px; background:rgba(13,15,18,.84); }
.report-brand img, .report-preview-brand img { object-fit:contain; }
.report-brand span, .report-preview-brand span { color:var(--ink-2); }
.contact-card { max-width:720px; display:grid; justify-items:start; gap:12px; }
.contact-card h2, .contact-card p { margin:0; }
.contact-note { font-size:12px; }
@keyframes menu-in { from { opacity:0; transform:translateY(-3px) scale(.985); } to { opacity:1; transform:none; } }
@media (prefers-reduced-motion: reduce) { .thread-context-menu { animation:none; } }

.recipe { min-height:74px; text-align:left; }
.recipe strong { display:block; margin-bottom:4px; }
.recipe span { color:var(--ink-2); font-size:12px; }

/* Production polish: preserve the QELYTRA background while clarifying navigation and account states. */
.nav-item { transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.nav-item:hover { transform: translateX(2px); }
.nav-item.on { box-shadow: inset 2px 0 0 var(--accent, #ff2638), 0 8px 24px rgba(255,38,56,.08); }
.nav-item:focus-visible, .btn:focus-visible, summary:focus-visible { outline: 2px solid rgba(255,70,82,.88); outline-offset: 2px; }
.btn { transition: transform .16s ease, border-color .16s ease, background-color .16s ease, box-shadow .16s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.22); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.email-verification-banner { position:relative; z-index:30; display:flex; align-items:center; justify-content:space-between; gap:18px; margin:12px 18px 0; padding:13px 16px; border:1px solid rgba(255,174,86,.34); border-radius:14px; background:linear-gradient(105deg,rgba(75,48,24,.86),rgba(20,18,18,.92)); box-shadow:0 12px 32px rgba(0,0,0,.24); }
.email-verification-banner span { display:grid; gap:4px; }
.email-verification-banner strong { color:#ffe0b8; font-size:13px; }
.email-verification-banner small { color:rgba(255,240,221,.72); font-size:12px; line-height:1.5; }
.session-current { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:12px 0; }
.session-details { border-top:1px solid var(--hairline,rgba(255,255,255,.1)); padding-top:12px; }
.session-details > summary { cursor:pointer; color:var(--ink-2,#c2c5ca); font-size:13px; }
.session-list { display:grid; gap:8px; margin-top:12px; }
.session-row { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; padding:10px 12px; border:1px solid rgba(255,255,255,.08); border-radius:10px; }
@media (max-width:680px) { .email-verification-banner { align-items:flex-start; flex-direction:column; margin:10px 12px 0; } }
@media (prefers-reduced-motion:reduce) { .nav-item,.btn { transition:none !important; } .nav-item:hover,.btn:hover:not(:disabled),.btn:active:not(:disabled) { transform:none; } }
.findings-table td:first-child { min-width: 112px; white-space: nowrap; }
.findings-table .sev, .finding-detail .sev { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: max-content; min-width: 78px; white-space: nowrap; overflow: visible; line-height: 1.25; }
@media (max-width: 760px) { .findings-table { min-width: 720px; } .findings-table td:first-child { min-width: 106px; } }

/* Client workspace refinement */
:root { --accent: #9ca9f6; --accent-ink: #090d20; --hairline: rgba(190,202,235,.11); }
.btn, .nav-item, .rail-tab { transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.chat-head { backdrop-filter: blur(18px); }
.chat-log .msg-body { line-height: 1.7; }
.subagent-workspace { display: grid; grid-template-columns: minmax(250px,350px) minmax(0,1fr); gap: 16px; min-height: 520px; }
.subagent-list { display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow: auto; }
.agent-card { display: flex; gap: 12px; width: 100%; padding: 14px; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); cursor: pointer; }
.agent-card:hover, .agent-card:focus-visible { border-color: var(--accent); background: var(--raised); }
.agent-card small { display: block; color: var(--ink-2); }
.subagent-detail { min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); }
.subagent-detail[hidden] { display: none; }
#subagent-feed { max-height: 58vh; overflow: auto; margin: 20px 0; }
.agent-event { margin-bottom: 12px; padding: 14px; overflow-wrap: anywhere; background: var(--raised); border: 1px solid var(--hairline); border-radius: var(--r-md); }
.agent-event time { color: var(--ink-3); font-size: 11px; }
@media (max-width: 820px) { .subagent-workspace { grid-template-columns: 1fr; } .subagent-list { max-height: 250px; } }
@media (prefers-reduced-motion: reduce) { .btn, .nav-item, .rail-tab { transition: none; } }

/* Production visual review: keep content above the decorative artwork. */
.app-shell { isolation: isolate; }
body:has(.app-shell)::before { opacity: .025; }
body:has(.app-shell)::after { opacity: .18; }
#pane-chat .chat-log, #pane-chat .chat { background: #0d1017; }
#pane-chat .chat-log { background-image: radial-gradient(ellipse at 50% 25%,rgba(156,169,246,.045),transparent 60%); }
#pane-chat .chat-recipes { max-width: 720px; margin-inline: auto; }
#pane-chat .composer { background: #141820; box-shadow: 0 18px 50px -28px rgba(0,0,0,.9); }
#pane-subagents .subagent-workspace:has(.subagent-detail[hidden]) { display: block; min-height: 0; }
#pane-subagents .subagent-list:has(.empty) { max-height: none; overflow: visible; }
#pane-subagents .subagent-list > .empty { width: 100%; box-sizing: border-box; padding: 56px 28px; background: #11151c; border-style: solid; }
#pane-subagents .subagent-list > .empty strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 8px; }
#pane-subagents .subagent-list > .empty p { max-width: 440px; margin: 0 auto 18px; }
#pane-subagents .subagent-list > .empty .btn { display: inline-flex; }
.agent-card[aria-pressed="true"] { border-color: var(--accent); background: var(--raised); }
@media (max-width: 1024px) { #pane-chat .chat-shell { grid-template-columns: minmax(0,1fr); } #pane-chat .thread-rail:not(.open) { display: none; } }

body:has(.app-shell)::before, body:has(.app-shell)::after { display: none; }
#pane-chat .chat-log { overflow-x: hidden; }
#pane-chat .chat-recipes { width: 100%; min-width: 0; max-width: 720px; box-sizing: border-box; grid-template-columns: repeat(auto-fit,minmax(min(100%,170px),1fr)); }
#pane-chat .recipe { min-width: 0; }

body::before, body::after { content: none !important; display: none !important; }
.sidebar { background: #0d1017; }

/* Keep the signed-in workspace quiet and content-first. */
body::before, body::after, .bg-layer { display:none !important; content:none !important; }
.app-header { background:#0b0e13; }
.sidebar { background:#0d1017; }

/* Interactive dashboard metrics */
.metric-link{display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:6px;width:100%;color:inherit;cursor:pointer;transition:transform .16s ease,border-color .16s ease,background-color .16s ease}.metric-link strong{font-size:clamp(24px,2vw,34px);line-height:1.05;letter-spacing:-.04em}.metric-link small{color:var(--ink-3);font-size:11px}.metric-link:hover{transform:translateY(-2px);border-color:var(--accent,#58d7d0)}.metric-link:focus-visible{outline:2px solid var(--accent,#58d7d0);outline-offset:3px}.model-choice{transition:border-color .16s ease,background-color .16s ease}.model-choice:has(input:checked){border-color:var(--accent,#58d7d0);background:rgba(50,180,170,.08)}@media(prefers-reduced-motion:reduce){.metric-link,.model-choice{transition:none}}


/* Activity journal: restrained, scannable event history */
#pane-traffic { max-width:1160px; margin-inline:auto; padding-bottom:32px; }
.activity-head { display:flex; justify-content:space-between; align-items:flex-start; gap:20px; margin:4px 0 22px; }
.activity-kicker { display:flex; align-items:center; gap:8px; color:#8e9bb1; font:600 10px/1.3 var(--mono,monospace); letter-spacing:.16em; }
.activity-live-dot { width:7px; height:7px; border-radius:50%; background:#68d9bb; box-shadow:0 0 12px rgba(104,217,187,.55); }
.activity-head h1 { margin:8px 0 4px; font-size:clamp(26px,3vw,36px); letter-spacing:-.04em; }
.activity-head .sub { display:block; color:var(--ink-2); }
.activity-refresh { display:flex; align-items:center; gap:8px; padding-inline:14px; }
.activity-refresh span { font-size:18px; line-height:1; }
.activity-overview { display:grid; grid-template-columns:minmax(280px,1.8fr) repeat(2,minmax(110px,.65fr)) minmax(190px,1fr); gap:1px; overflow:hidden; margin-bottom:16px; border:1px solid rgba(190,202,235,.1); border-radius:15px; background:rgba(190,202,235,.09); box-shadow:0 14px 34px rgba(0,0,0,.15); }
.activity-scope,.activity-stat { min-width:0; padding:16px 18px; background:linear-gradient(145deg,rgba(20,25,34,.98),rgba(14,18,25,.98)); }
.activity-scope label,.activity-stat span { display:block; margin-bottom:8px; color:#818da2; font:600 9px/1.2 var(--mono,monospace); letter-spacing:.14em; }
.activity-scope select { width:100%; min-height:36px; color:var(--ink); }
.activity-stat strong { display:block; overflow:hidden; color:#e8edf6; font:500 23px/1.15 var(--mono,monospace); text-overflow:ellipsis; white-space:nowrap; }
.activity-latest strong { font:500 13px/1.5 var(--sans,inherit); }
.activity-board { overflow:hidden; border:1px solid rgba(190,202,235,.1); border-radius:15px; background:linear-gradient(150deg,rgba(19,23,31,.97),rgba(13,16,22,.97)); box-shadow:0 22px 60px rgba(0,0,0,.2); }
.activity-toolbar { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:13px 16px; border-bottom:1px solid rgba(190,202,235,.08); }
.activity-filters { display:flex; flex-wrap:wrap; gap:5px; }
.activity-filter { padding:7px 12px; border:1px solid transparent; border-radius:8px; color:#9ca7b8; background:transparent; font:500 12px/1.2 var(--sans,inherit); cursor:pointer; transition:background .16s ease,color .16s ease,border-color .16s ease; }
.activity-filter:hover { color:#e7ecf4; background:rgba(255,255,255,.04); }
.activity-filter.is-active { color:#e8f5f3; border-color:rgba(102,207,184,.2); background:rgba(67,169,148,.11); }
.activity-search { display:flex; align-items:center; gap:8px; width:min(250px,44%); min-height:34px; padding:0 10px; border:1px solid rgba(190,202,235,.1); border-radius:8px; color:#78869b; background:rgba(5,8,12,.28); }
.activity-search span { font-size:19px; }
.activity-search input { width:100%; min-width:0; padding:0; border:0; outline:0; color:#e4eaf4; background:transparent; font-size:12px; }
.activity-search input::placeholder { color:#717e90; }
.activity-list { min-height:260px; padding:20px clamp(16px,3vw,30px) 26px; }
.activity-date-label { display:flex; justify-content:space-between; margin:0 0 14px 39px; color:#738096; font:600 9px/1.3 var(--mono,monospace); letter-spacing:.14em; }
.activity-date-label span { color:#6f7e91; font-weight:400; letter-spacing:0; }
.activity-timeline { position:relative; display:grid; gap:0; }
.activity-timeline::before { position:absolute; top:13px; bottom:17px; left:8px; width:1px; background:linear-gradient(rgba(114,133,160,.5),rgba(114,133,160,.08)); content:""; }
.activity-event { position:relative; display:grid; grid-template-columns:18px minmax(0,1fr); gap:14px; padding:0 0 22px; }
.activity-event:last-child { padding-bottom:2px; }
.activity-marker { z-index:1; display:grid; width:17px; height:17px; place-items:center; border:1px solid rgba(139,156,183,.28); border-radius:50%; color:#9aabc0; background:#171d27; font:700 12px/1 var(--mono,monospace); }
.activity-finding .activity-marker { border-color:rgba(248,185,104,.45); color:#ffc97d; background:rgba(95,61,24,.42); }
.activity-attention .activity-marker { border-color:rgba(249,118,125,.4); color:#ff9a9f; background:rgba(99,36,43,.35); }
.activity-event-copy { min-width:0; padding-bottom:13px; border-bottom:1px solid rgba(190,202,235,.065); }
.activity-event:last-child .activity-event-copy { padding-bottom:0; border-bottom:0; }
.activity-event-top { display:flex; justify-content:space-between; align-items:baseline; gap:16px; }
.activity-event-top strong { color:#dce4ef; font-size:13px; font-weight:600; }
.activity-event-top time { flex:0 0 auto; color:#758297; font:10px/1.4 var(--mono,monospace); }
.activity-event-copy p { max-width:800px; margin:6px 0 0; color:#9ca8b9; font-size:12px; line-height:1.6; overflow-wrap:anywhere; }
.activity-empty,.activity-error { display:grid; justify-items:center; align-content:center; min-height:230px; padding:24px; text-align:center; }
.activity-empty-mark { display:grid; width:42px; height:42px; place-items:center; margin-bottom:12px; border:1px solid rgba(137,160,192,.18); border-radius:13px; color:#a6b6c8; background:rgba(121,148,181,.07); font-size:20px; }
.activity-empty strong,.activity-error strong { color:#dce4ef; font-size:14px; }
.activity-empty p,.activity-error p { max-width:400px; margin:6px 0 0; color:#8d99aa; font-size:12px; line-height:1.55; }
.activity-empty-small { min-height:150px; }
.activity-error { color:#ffb4b7; }
.activity-loading { display:grid; gap:14px; padding:8px 0; }
.activity-loading i { display:block; height:42px; border-radius:9px; background:linear-gradient(90deg,rgba(255,255,255,.025),rgba(255,255,255,.065),rgba(255,255,255,.025)); background-size:200% 100%; animation:activity-shimmer 1.3s ease-in-out infinite; }
@keyframes activity-shimmer { to { background-position:-200% 0; } }
@media(max-width:850px) { .activity-overview { grid-template-columns:minmax(0,1fr) repeat(2,minmax(90px,.55fr)); } .activity-latest { grid-column:1/-1; } }
@media(max-width:580px) { .activity-head { align-items:center; } .activity-head .sub { max-width:260px; } .activity-overview { grid-template-columns:1fr 1fr; } .activity-scope { grid-column:1/-1; } .activity-latest { grid-column:auto; } .activity-toolbar { align-items:stretch; flex-direction:column; } .activity-search { width:auto; } .activity-event-top { align-items:flex-start; flex-direction:column; gap:4px; } .activity-list { padding-inline:14px; } }
@media(prefers-reduced-motion:reduce) { .activity-filter,.activity-loading i { transition:none; animation:none; } }
