:root {
  --cream: #fafafa;
  --cream2: #f7f7f8;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --accent: #2563eb;
  --accent2: #3b82f6;
  --danger: #dc2626;
  --queued: #b5812a;
  --running: #2563eb;
  --done: #059669;
  --card: #ffffff;
  --rail: #ffffff;
  --shadow: 0 10px 30px rgba(24, 24, 27, 0.06);
  --on-accent: #ffffff;
  --input: #fff;
  --bubble: #eff6ff;
  --bubble-fg: #18181b;
  --warn-bg: #fff7ed;
  --warn-fg: #9a3412;
  --selected: #eff6ff;
  --hover: rgba(24, 24, 27, 0.05);
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --label-user: #2563eb;
  --label-assistant: #7c3aed;
  --label-system: #6b7280;
  --label-context: #059669;
  --label-tool: #d97706;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent-red: #2563eb;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --foreground: #18181b;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  font-family: Manrope, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
}
html[data-theme="dark"] {
  --cream: #101216;
  --cream2: #20242b;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2c313a;
  --accent: #60a5fa;
  --accent2: #93c5fd;
  --danger: #f05252;
  --queued: #d4a04a;
  --running: #60a5fa;
  --done: #34d399;
  --card: #15181d;
  --rail: #15181d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --on-accent: #ffffff;
  --input: #1b1f25;
  --bubble: #172554;
  --bubble-fg: #f4f4f5;
  --warn-bg: #2a2418;
  --warn-fg: #e8d5a3;
  --selected: #172554;
  --hover: rgba(255, 255, 255, 0.06);
  --label-user: #60a5fa;
  --label-assistant: #a78bfa;
  --label-system: #6b7280;
  --label-context: #34d399;
  --label-tool: #f59e0b;
  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --accent-red: #60a5fa;
  --surface: #15181d;
  --surface-raised: #1b1f25;
  --foreground: #f4f4f5;
  --muted-foreground: #a1a1aa;
  --border: #2c313a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}
button, input, textarea, select {
  font: inherit;
}
.authBody {
  display: grid;
  place-items: center;
  min-height: 100%;
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(8, 145, 178, 0.10), transparent 60%),
    var(--cream);
}
html[data-theme="dark"] .authBody {
  background: var(--cream);
}
.authCard {
  width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.brandRow { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brandName { font-size: 18px; font-weight: 650; }
.logoMark {
  width: 40px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  color: #f4f4f5;
  display: grid;
  place-items: center;
  overflow: hidden;
  line-height: 0;
}
.logoMark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.logoMark.sm {
  width: 40px;
  height: 28px;
  margin: 8px 0 10px;
}
.logoMark.lg {
  width: 196px;
  height: 84px;
  border-radius: 12px;
}
.seg { display: flex; gap: 6px; margin: 8px 0 16px; }
.segBtn, .btn, .pill, .sendBtn, .tabBtn, .railBtn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 10px;
}
.segBtn { padding: 6px 12px; }
.segBtn.active, .railBtn.active {
  background: var(--cream2);
}
.btn { padding: 6px 10px; font-size: 12px; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.wide { width: 100%; margin-top: 12px; }
.input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
  color: var(--ink);
  font-size: 13px;
}
label { display: block; margin: 10px 0 6px; font-size: 12px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.shell {
  display: grid;
  grid-template-columns: 52px 260px minmax(0, 1fr) 300px;
  height: 100vh;
}
body.nav-collapsed .shell,
html.nav-collapsed-html .shell {
  grid-template-columns: 52px 0 minmax(0, 1fr) 300px;
}
body.nav-collapsed .leftCol,
html.nav-collapsed-html .leftCol {
  overflow: hidden;
  border-right: none;
  min-width: 0;
  width: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}
.rail {
  width: 52px;
  min-width: 52px;
  flex-shrink: 0;
  background: var(--rail);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 6px;
  border-right: 1px solid var(--line);
}
.railBtn {
  width: 34px; height: 34px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  display: grid; place-items: center;
}
.railBtn:hover { background: var(--cream2); color: var(--ink); }
.railBtn.active { background: #eff6ff; color: var(--accent); }
.railGrow { flex: 1; }
.leftCol, .rightCol, .centerCol {
  border-right: 1px solid var(--line);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
}
.rightCol {
  border-right: none;
  border-left: 1px solid var(--line);
  box-shadow: -6px 0 20px rgba(24, 24, 27, 0.025);
  background: var(--card);
}
.centerCol {
  background: radial-gradient(circle at 50% -20%, rgba(219, 234, 254, 0.55), transparent 40%), #fafafa;
}
.leftCol {
  box-shadow: 6px 0 20px rgba(24, 24, 27, 0.025);
}
.leftHead, .crumb, .rightTabs, .composer {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.composer { border-bottom: none; border-top: 1px solid var(--line); background: rgba(255,255,255,.84); backdrop-filter: blur(12px); }
.leftHead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.leftHeadMain { display: flex; align-items: center; gap: 8px; min-width: 0; }
.navCollapse {
  width: 28px; height: 28px; flex-shrink: 0;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 8px; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.navCollapse:hover { color: var(--ink); background: var(--hover); }
.btn.ghost, .newSession {
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: 8px;
  padding: 5px 12px; font-size: 12px; white-space: nowrap;
}
.btn.ghost:hover, .newSession:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.eyebrow { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.h1 { font-size: 16px; font-weight: 600; }
.taskList, .fileList, .chatLog, .rightPane {
  overflow: auto;
  flex: 1;
}
#taskPane, #drivePane {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#taskPane[hidden], #drivePane[hidden] { display: none !important; }
.userBar { flex-shrink: 0; }
.task {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.task:hover { background: var(--hover); }
.task.active { border: 1px solid #bfdbfe; background: #eff6ff; box-shadow: inset 3px 0 0 var(--accent); border-radius: 10px; }
.task .title { font-weight: 500; font-size: 13px; }
.task .meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; }
.st {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.st.queued { color: var(--queued); }
.st.running { color: var(--running); }
.st.done { color: var(--done); }
.st.error { color: var(--danger); }
.crumb {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 16px 0;
  font-size: 12px;
  border-bottom: none;
}
.crumbRow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sep { color: var(--muted); }
.spacer { flex: 1; }
.queueBanner {
  margin: 10px 16px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-size: 12px;
}
.chatLog {
  padding: 18px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chatLog[hidden], #welcome[hidden] { display: none !important; }
.msg { margin-bottom: 16px; max-width: 780px; }
.msg.user {
  align-self: flex-end;
  margin-left: auto;
  max-width: min(72%, 560px);
  user-select: text;
  -webkit-user-select: text;
}
.msg.user .role { text-align: right; }
.msg.user .bubble {
  display: inline-block;
  text-align: left;
  background: var(--bubble);
  color: var(--bubble-fg);
  border: 1px solid var(--line);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  cursor: text;
  line-height: 1.5;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
.msg.assistant .md {
  line-height: 1.55;
  user-select: text;
  -webkit-user-select: text;
}
.msg.assistant .md p { margin: 0 0 0.7em; }
.msg.assistant .md p:last-child { margin-bottom: 0; }
.chatTraces { margin: 2px 0 12px; max-width: 100%; }
.chatTraces[hidden] { display: none !important; }
.msg .role { font-size: 12px; color: var(--muted); margin-bottom: 6px; user-select: none; }
.msg.user .msgAttach { justify-content: flex-end; }
.msg.assistant { align-self: stretch; max-width: min(92%, 780px); }
.msgAttach { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.msgThumb {
  display: block; width: 96px; height: 96px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--card);
}
.msgThumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msgFile {
  font-size: 12px; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; text-decoration: none;
}
.traces {
  margin-top: 8px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--hover);
}
.traces summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.tracePre, .traces pre {
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  margin: 8px 0 0;
}
.composerBox {
  background: #fff;
  border: 1px solid #d4d4d8;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(24, 24, 27, 0.07);
}
.plusBtn {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 18px; line-height: 1; padding: 0;
}
.plusBtn:hover { background: var(--hover); }
.composerBox textarea {
  border: none;
  width: 100%;
  min-height: 48px;
  max-height: 200px;
  resize: none;
  overflow-y: hidden;
  background: transparent;
  font-size: 14px;
  line-height: 1.5;
  padding: 2px 4px 6px;
}
.composerActions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 0;
}
.sendBtn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.sendBtn svg { width: 16px; height: 16px; display: block; }
.sendBtn.idle {
  background: #d4d4d8;
  color: #fff;
  cursor: default;
}
.sendBtn:not(.idle):hover { background: var(--primary-strong); }
.pauseBtn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0;
}
.pauseBtn svg { width: 10px; height: 10px; }
.pill { padding: 4px 9px; border-radius: 999px; font-size: 12px; }
.rightTabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.tabBtn {
  padding: 0 12px;
  height: 58px;
  font-size: 13px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}
.tabBtn.active {
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.rightPane { padding: 0; background: var(--card); min-height: 0; overflow: auto; }
.rightPane[hidden] { display: none !important; }
.notesBox { min-height: 220px; margin: 10px 0; }
.fileRow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  align-items: center;
}
.fileRow a { color: var(--accent); }
.fileActs { display: flex; align-items: center; gap: 8px; }
.driveBar { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 15px; margin: 12px 0 6px; font-weight: 650; }
.md h4 { font-size: 13px; margin: 10px 0 4px; font-weight: 650; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.md code { background: var(--cream2); padding: 1px 4px; border-radius: 4px; font-family: ui-monospace, monospace; font-size: 0.92em; }
.md pre { background: var(--card); border: 1px solid var(--line); padding: 10px; border-radius: 8px; overflow: auto; }
.md pre code { background: none; padding: 0; }
.md .katex-display { margin: 0.55em 0; overflow-x: auto; overflow-y: hidden; }
.md .katex { font-size: 1.05em; }
.md .texFallback { font-family: ui-monospace, monospace; font-size: 0.92em; }
.md a, .md a.mdLink {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  word-break: break-all;
}
.md a:hover { opacity: 0.88; }

a { color: var(--accent); }
.authH { font-size: 18px; margin: 8px 0 12px; font-weight: 600; }
.authCard.wide { width: 640px; max-width: calc(100vw - 32px); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span2 { grid-column: 1 / -1; }
.notice {
  background: var(--cream2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0;
}
.searchWrap { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.task { display: flex; align-items: flex-start; gap: 6px; }
.taskMain { flex: 1; min-width: 0; }
.moreBtn {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); padding: 4px 6px; border-radius: 8px;
  font-size: 12px;
}
.moreBtn:hover { background: var(--cream2); }
.taskMenu {
  position: fixed; z-index: 40;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow);
  min-width: 120px; padding: 4px;
}
.taskMenu button {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; padding: 8px 10px;
  border-radius: 8px; cursor: pointer;
}
.taskMenu button:hover { background: var(--cream2); }
.emptyHint { padding: 24px 16px; text-align: center; color: var(--muted); }
.emptyState {
  display: grid;
  place-items: center;
  flex: 1;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.emptyState .burst { display: none; }
.emptyTitle { font-weight: 600; margin: 8px 0 5px; color: var(--ink); font-size: 14px; }
.burst {
  width: 40px; height: 40px; margin: 0 auto 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #67e8f9 0 18%, transparent 19%),
    repeating-conic-gradient(from 0deg, #a5f3fc 0 8deg, transparent 8deg 22deg);
}
.welcome { padding: 22px 24px 8px; overflow: auto; flex: 1; }
.welcomeTitle { font-size: clamp(21px, 2vw, 24px); font-weight: 650; letter-spacing: -0.025em; }
.welcomeLead { color: var(--muted); max-width: 560px; margin: 8px 0 16px; font-size: 13px; }
.quickGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 720px; }
.quickCard {
  text-align: left; padding: 18px; border-radius: 14px;
  min-height: 108px;
  background: rgba(255,255,255,.9); border: 1px solid var(--line); cursor: pointer;
  box-shadow: 0 8px 24px rgba(24,24,27,.035);
}
.quickCard:hover {
  border-color: #93c5fd;
  box-shadow: 0 5px 18px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}
.quickT { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.chipRow { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 8px; }
.chip {
  font-size: 12px; border: 1px solid var(--line); background: var(--cream);
  border-radius: 10px; padding: 4px 4px 4px 4px;
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px;
}
.chipThumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 8px;
  background: var(--card); flex-shrink: 0;
}
.chipName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.chipX {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); width: 18px; height: 18px; border-radius: 50%;
  line-height: 1; font-size: 14px; padding: 0;
}
.chipX:hover { background: var(--cream2); color: var(--danger); }
.dropTarget.dragging, .composerBox.dragging {
  outline: 2px dashed #93c5fd;
  background: rgba(37, 99, 235, 0.04);
}
.modelWrap { position: relative; }
.modelPill {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 4px 10px; cursor: pointer;
  font-size: 12px;
}
.modelPill::after { content: " ▾"; color: var(--muted); font-size: 10px; }
.modelFlyout {
  position: absolute; left: 0; bottom: 36px; z-index: 50;
  flex-direction: column; gap: 8px;
}
.modelFlyout:not([hidden]) { display: flex; }
.modelFlyout[hidden], .customList[hidden], .effortList[hidden], .modelHint[hidden] { display: none !important; }
.modelCols { display: flex; align-items: stretch; gap: 8px; }
.tierList, .customList, .effortList {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  min-width: 220px; padding: 4px;
}
.customList, .effortList { min-width: 160px; }
.tierItem, .customItem, .effortItem {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; padding: 7px 8px;
  border-radius: 8px; cursor: pointer;
}
.tierItem:hover, .customItem:hover, .effortItem:hover { background: var(--cream2); }
.tierItem.selected, .customItem.selected, .effortItem.selected { background: var(--selected); }
.tierName { font-weight: 600; font-size: 13px; }
.tierDesc { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.customItem, .effortItem { font-size: 12px; }
.customItem.disabled, .effortItem.disabled { opacity: 0.45; cursor: not-allowed; }
.modelHint {
  max-width: 240px; font-size: 11px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; box-shadow: var(--shadow);
}
.infoI {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--line); font-size: 10px; color: var(--muted);
}
.userBar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--cream);
}
.userAvatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #d9c8f0 0%, #f5d2c4 100%);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 650; flex-shrink: 0;
}
.userMeta { min-width: 0; flex: 1; }
.userName { font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userOrg { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { display: flex; height: 100vh; overflow: hidden; }
.pageMain { flex: 1; min-width: 0; overflow: auto; padding: 28px 36px; }
.pageMain h1 { font-size: 18px; font-weight: 600; }
.resources-main {
  padding: 0;
  background: #fafafa;
}
.resources-main .page-content h1 {
  font-size: 22px;
  font-weight: 650;
}
.resources-crumb {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}
.resources-crumb strong { color: var(--ink); }
.resource-search {
  max-width: 420px;
  margin: 0 0 8px;
  height: 36px;
  border-radius: 8px;
}
html[data-theme="dark"] .resources-main { background: #101216; }
.resList { display: flex; flex-direction: column; gap: 8px; }
.resItem {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.resItem b { display: block; margin-bottom: 4px; }
.app-shell {
  width: 100%;
  height: 100dvh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
}
.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px 14px;
  border-right: 1px solid var(--line);
  background: #fff;
}
.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 6px 8px;
}
.brand-wordmark { display: block; width: 142px; height: auto; object-fit: contain; }
.brand-wordmark-dark { display: none; }
.sidebar-nav { min-height: 0; display: grid; align-content: start; gap: 4px; overflow: auto; }
.nav-item {
  width: 100%;
  min-width: 0;
  height: 38px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.nav-item:hover { background: var(--cream2); color: var(--ink); }
.nav-item.active { color: var(--accent); background: #eff6ff; }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer { min-width: 0; display: grid; gap: 8px; margin-top: auto; }
.sidebar-user {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
}
.sidebar-user .avatar,
.sidebar #railUserAv {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  border: none;
  background: var(--accent);
  font-size: 11px;
  font-weight: 650;
  color: #fff;
  line-height: 1;
}
.sidebar-user-copy strong,
.sidebar-user-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-copy strong { font-size: 13px; line-height: 17px; }
.sidebar-user-copy small { color: var(--muted); font-size: 11px; line-height: 14px; }
.main-shell {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fafafa;
}
.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}
.breadcrumb {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumb strong { color: var(--ink); }
.page-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 30px clamp(20px, 4vw, 54px);
  background: #fafafa;
}
.page-content h1 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.035em;
}
.page-content > p {
  max-width: 680px;
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}
.resource-section {
  max-width: 1040px;
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(24, 24, 27, 0.035);
}
.resource-section h2 { margin: 0 0 14px; font-size: 15px; }
.resource-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.resource-row {
  min-width: 0;
  padding: 14px;
  border: 1px solid #f0f0f2;
  border-radius: 12px;
  background: #fafafa;
  transition: border-color 150ms, background 150ms, transform 150ms;
}
.resource-row:hover { border-color: #bfdbfe; background: #f8fafc; transform: translateY(-1px); }
.resource-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.resource-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .sidebar { background: var(--surface); }
html[data-theme="dark"] .brand-wordmark-light { display: none; }
html[data-theme="dark"] .brand-wordmark-dark { display: block; }
html[data-theme="dark"] .nav-item.active { background: #172554; color: #60a5fa; }
html[data-theme="dark"] .main-shell,
html[data-theme="dark"] .page-content { background: #101216; }
html[data-theme="dark"] .topbar { background: rgba(21, 24, 29, 0.92); }
html[data-theme="dark"] .resource-section { background: var(--surface); }
html[data-theme="dark"] .resource-row { border-color: var(--line); background: var(--surface-raised); }
html[data-theme="dark"] .resource-row:hover { border-color: #1e3a8a; background: #1e293b; }
html[data-theme="dark"] .sidebar-user { background: var(--surface-raised); }
@media (max-width: 600px) {
  .resource-list { grid-template-columns: 1fr; }
  .page-content { padding-inline: 14px; }
}
.formNarrow { max-width: 520px; }
.rail a.railBtn { text-decoration: none; }
.railUser {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent);
  color: #fff; text-decoration: none;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 650; margin-top: 4px;
  border: none; cursor: pointer; padding: 0;
  overflow: hidden;
  line-height: 1;
}
.railUser #railUserAv {
  font-size: 11px;
  color: #fff;
  line-height: 1;
}
.userMenu {
  position: fixed; z-index: 80;
  width: 268px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px 0 6px;
}
.userMenuHead {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.userMenuAv {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650; flex-shrink: 0;
  color: #fff;
  border: none;
  line-height: 1;
  overflow: hidden;
}
.userMenuName { font-size: 13px; font-weight: 650; }
.userMenuEmail { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.userMenuItem {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 14px; margin-top: 2px;
  border: none; background: transparent;
  color: inherit; text-decoration: none;
  font-size: 13px; cursor: pointer;
}
.userMenuItem:hover { background: var(--cream2); }
.userMenuItem.danger { color: var(--danger); }
.userMenuVer {
  padding: 8px 14px 4px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.userMenu[hidden] { display: none !important; }
.pauseBtn { background: var(--accent); color: #fff; }
.sendBtn[hidden], .pauseBtn[hidden] { display: none !important; }
.traceStack { display: flex; flex-direction: column; gap: 0; padding: 8px 10px; }
.traceStack[hidden] { display: none !important; }
.traceGroup { border: none; }
.traceGroup > summary {
  cursor: pointer; font-size: 12px; color: var(--muted);
  margin: 0 0 4px; list-style: none;
}
.traceGroup > summary::-webkit-details-marker { display: none; }
.traceGroup > summary::before { content: "▸ "; }
.traceGroup[open] > summary::before { content: "▾ "; }
.traceStackInner { display: flex; flex-direction: column; gap: 1px; }
.traceItem { display: flex; flex-direction: column; gap: 0; }
.tracePill {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 3px 2px;
  cursor: pointer;
  color: var(--ink);
  border-bottom: none;
}
.tracePill:hover { background: var(--cream2); }
.tracePill.open { border-radius: 0; }
.traceIcon {
  width: 16px; height: 16px; flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--muted);
}
.traceIcon[data-kind="observe"], .traceIcon[data-kind="error"] {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5c5 0 9.3 3.1 11 7-1.7 3.9-6 7-11 7S2.7 15.9 1 12c1.7-3.9 6-7 11-7zm0 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.traceIcon[data-kind="error"] { color: var(--danger); }
.traceIcon[data-kind="phase"], .traceIcon[data-kind="validate"] {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 5h-2v6l5 3 1-1.7-4-2.3V7z'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--muted);
}
.traceTitle {
  flex: 1; min-width: 0;
  font-size: 12px;
  font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.traceTime { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.traceTime::before { content: "⏱ "; }
.traceChev { color: var(--muted); font-size: 14px; transform: translateY(-1px); }
.tracePill.open .traceChev { transform: rotate(90deg); }
.traceBody {
  margin: 0 0 4px;
  border: none;
  border-top: none;
  border-radius: 0;
  padding: 0 2px 6px 26px;
  background: transparent;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  max-height: 240px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}
.traceThumbs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 12px 4px;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: var(--card);
}
.traceThumbs img {
  max-width: 160px; max-height: 120px;
  border-radius: 8px; border: 1px solid var(--line);
}
.traceThink {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  padding: 4px 8px;
}
.thinkRow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 10px;
  min-height: 22px;
}
.thinkCard {
  margin: 0 0 12px;
  background: transparent;
  border: none;
}
.thinkCard > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  user-select: none;
}
.thinkCard > summary::-webkit-details-marker { display: none; }
.thinkFold {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 14%, transparent);
}
.thinkFold svg {
  width: 12px;
  height: 12px;
  display: block;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
}
.thinkCard[open] > summary .thinkFold svg { transform: rotate(0deg); }
.thinkCard > summary:hover .thinkFold {
  background: var(--hover);
  color: var(--ink);
}
.thinkPanel { margin: 2px 0 4px; }
.thinkPanel .compactTraces { margin: 4px 0 8px; }
.thinkStream {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
  padding: 6px 0 4px 20px;
  margin: 4px 0 0 6px;
  border-left: 1px solid var(--line);
  user-select: text;
  -webkit-user-select: text;
}
.thinkOrb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 3px rgba(92, 107, 74, 0.16);
  animation: thinkPulse 1.15s ease-in-out infinite;
  flex-shrink: 0;
}
.thinkOrb.sm { width: 8px; height: 8px; box-shadow: none; margin-right: 2px; }
.thinkText {
  font-size: 13px;
  font-weight: 550;
  background: linear-gradient(90deg, #5a5246 0%, #9a8d78 45%, #5a5246 90%);
  background-size: 180% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: thinkShimmer 1.8s linear infinite;
}
.thinkDots { display: inline-flex; gap: 3px; align-items: flex-end; height: 10px; }
.thinkDots i {
  width: 4px; height: 4px; border-radius: 50%;
  background: #8a7d6a;
  animation: thinkBounce 1.05s ease-in-out infinite;
}
.thinkDots i:nth-child(2) { animation-delay: 0.15s; }
.thinkDots i:nth-child(3) { animation-delay: 0.3s; }
.traceGroup.live > summary {
  display: flex; align-items: center; gap: 6px;
}
@keyframes thinkPulse {
  0%, 100% { transform: scale(0.86); opacity: 0.7; }
  50% { transform: scale(1); opacity: 1; }
}
@keyframes thinkShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes thinkBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}
.traceThinkDot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent2);
}
.todoList { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 4px; }
.todoItem { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.todoGroup { margin: 8px 12px 4px; }
.todoGroup > summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.notesHead { font-size: 12px; font-weight: 650; padding: 10px 12px 0; }
.h1 { font-size: 15px; font-weight: 600; }
.task .title { font-weight: 500; font-size: 12px; }
.traceStack.inChat { margin-top: 0; margin-bottom: 8px; }
button.msgThumb {
  padding: 0; border: 1px solid var(--line); background: var(--card); cursor: zoom-in;
}
[data-preview-src] { cursor: zoom-in; }
.chipThumb { cursor: zoom-in; }
.traceThumbs img { cursor: zoom-in; }
.filePreview {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; background: transparent; padding: 0;
  color: inherit; cursor: zoom-in; min-width: 0; text-align: left;
}
.filePreview img {
  width: 36px; height: 36px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); flex-shrink: 0;
}
.filePreview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imgLightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 16, 12, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 56px 24px 24px;
}
.imgLightbox[hidden] { display: none !important; }
.imgLightboxImg {
  max-width: min(92vw, 1400px);
  max-height: calc(100vh - 88px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  background: #111;
}
.imgLightboxBar {
  position: absolute; top: 14px; right: 16px;
  display: flex; gap: 8px;
}
.imgLightboxBtn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(32, 28, 24, 0.88);
  color: #f6f1e8;
  display: grid; place-items: center;
  cursor: pointer; padding: 0;
}
.imgLightboxBtn:hover { background: rgba(48, 42, 36, 0.95); }
.imgLightboxHint {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(32, 28, 24, 0.9); color: #f6f1e8;
  padding: 6px 12px; border-radius: 999px; font-size: 12px;
}
body.lightboxOpen { overflow: hidden; }
.railHelp {
  width: 40px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 4px;
}
.railHelp:hover { color: var(--ink); }
.railHelpIcon {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650;
}
.railHelpLabel { font-size: 10px; }
.helpMenu { min-width: 180px; padding: 6px; }
.bugModal {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(9, 9, 11, 0.48);
  display: grid; place-items: center;
  padding: 20px;
}
.bugModal[hidden] { display: none !important; }
.bugCard {
  width: 420px; max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.bugCard h2 { margin: 0 0 8px; font-size: 18px; }
.bugCard label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.bugDesc { min-height: 110px; resize: vertical; }
.bugShotBtn {
  display: block;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  background: var(--card);
  color: var(--ink);
  margin: 8px 0 4px;
}
.bugCard .btn { width: 100%; margin-top: 6px; }
.bugCard .btn.primary { margin-top: 10px; }

/* Requirement gate: numbered radio / checkbox cards, matching paid Biomni. */
.clarifyCard {
  background: transparent;
  padding: 2px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 640px;
}
.clarifyMsg {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.clarifyQ { display: flex; flex-direction: column; gap: 10px; }
.clarifyHead {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.clarifyNum {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.55;
  flex: none;
}
.clarifyTitle {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 500;
}
.clarifyOpts { display: flex; flex-direction: column; gap: 12px; padding-left: 22px; }
.clarifyOpt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.clarifyPick {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 3px 0 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.clarifyOptBody { min-width: 0; }
.clarifyOptLabel {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}
.clarifyOptDetail {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.clarifyQ .clarifyInput,
.clarifyQ .clarifyFree {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  margin-left: 22px;
  max-width: calc(100% - 22px);
}
.clarifyActs { display: flex; gap: 8px; margin-top: 4px; }
.clarifyGo {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 550;
  border-radius: 10px;
}
.clarifyErr { font-size: 12px; color: #b3261e; }
.clarifyErr[hidden] { display: none !important; }
.clarifyFree[hidden] { display: none !important; }

.settingsModal {
  position: fixed; inset: 0; z-index: 130;
  background: rgba(9, 9, 11, 0.48);
  display: grid; place-items: center;
  padding: 20px;
}
.settingsModal[hidden] { display: none !important; }
.settingsCard {
  width: 760px; max-width: calc(100vw - 32px);
  height: min(640px, calc(100vh - 40px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  color: var(--ink);
}
.settingsHead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.settingsHead h2 { margin: 0; font-size: 16px; font-weight: 650; }
.settingsClose {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 20px; line-height: 1;
  width: 32px; height: 32px; border-radius: 8px;
}
.settingsClose:hover { background: var(--cream2); color: var(--ink); }
.settingsBody { display: grid; grid-template-columns: 168px 1fr; min-height: 0; flex: 1; }
.settingsNav {
  border-right: 1px solid var(--line);
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--cream);
}
.settingsNavBtn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  border: none; background: transparent;
  padding: 8px 10px; border-radius: 10px;
  cursor: pointer; color: var(--ink); font-size: 13px;
}
.settingsNavBtn:hover { background: var(--cream2); }
.settingsNavBtn.active { background: var(--cream2); font-weight: 600; }
.settingsMain { padding: 16px 20px 20px; overflow: auto; min-height: 0; }
.settingsPane[hidden] { display: none !important; }
.settingsLabel { font-size: 13px; font-weight: 650; margin: 4px 0 10px; }
.settingsHint { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.settingsThemeRow { display: flex; gap: 10px; margin-bottom: 22px; }
.settingsThemeBtn {
  flex: 1; border: 1px solid var(--line); background: var(--cream);
  border-radius: 12px; padding: 14px 8px 12px; cursor: pointer;
  color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.settingsThemeBtn.selected { border-color: var(--accent); background: var(--cream2); }
.settingsThemeBtn svg { width: 22px; height: 22px; }
.settingsLangRow {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 0;
}
.settingsLangRow select {
  min-width: 140px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 10px; padding: 6px 8px;
}
.settingsRow {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.settingsRow:last-child { border-bottom: none; }
.settingsRow .settingsRowText { min-width: 0; }
.settingsRow .settingsRowText b { display: block; font-size: 13px; font-weight: 600; }
.settingsRow .btn.danger {
  color: var(--danger); border-color: var(--danger);
}
.settingsForm label { margin-top: 8px; }
.settingsForm .btn { margin-top: 14px; }
.settingsMsg { font-size: 12px; margin-top: 8px; }

.mainTabs {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: 0;
  border-bottom: 1px solid var(--line);
}
.mainTab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0 0 8px;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.mainTab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}
.compactTraces {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 12px;
}
.compactRow {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.compactPill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 2px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 6px;
}
.compactPill:hover { background: var(--hover); color: var(--ink); }
.compactKind { color: var(--muted); flex-shrink: 0; font-weight: 550; }
.compactTitle {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compactBody {
  margin: 0 0 6px 22px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 11px;
  max-height: 240px;
  overflow: auto;
  color: var(--ink);
}
.compactBody[hidden] { display: none !important; }
#trajView {
  --dsh-trajectory-toolbar-height: 32px;
  --dsw-alias-bg-layer-1: var(--card);
  --dsw-alias-bg-layer-2: var(--cream);
  --dsw-alias-border-l1: var(--line);
  --dsw-alias-border-l2: var(--line);
  --dsw-alias-label-primary: var(--ink);
  --dsw-alias-label-secondary: var(--muted);
  --dsw-alias-label-tertiary: var(--muted);
  --dsw-alias-label-caption: var(--muted);
  --dsw-alias-label-dimmed: var(--muted);
  --dsw-alias-state-business-primary: var(--accent);
  --dsw-alias-state-business-tertiary: color-mix(in srgb, var(--accent) 14%, var(--card));
  --dsw-alias-state-success-primary: #059669;
  --dsw-alias-state-success-tertiary: color-mix(in srgb, #059669 12%, var(--card));
  --dsw-alias-state-warn-label: #d97706;
  --dsw-alias-state-warn-tertiary: color-mix(in srgb, #d97706 14%, var(--card));
  --dsw-alias-state-error-primary: var(--danger);
  --dsw-alias-state-error-secondary: #c084fc;
  --dsw-alias-brand-primary: #7c3aed;
  --dsw-alias-interactive-bg-hover: var(--hover);
  --dsw-alias-interactive-bg-active: var(--selected);
  --dsw-specific-sidebar-fill: var(--cream2);
  --dsw-alias-bg-module-platform: var(--cream2);
  --ds-font-family-code: var(--mono);
  --dsw-font-xxs-12: 12px/18px ui-sans-serif, system-ui, sans-serif;
  --dsw-font-xs-13: 13px/18px ui-sans-serif, system-ui, sans-serif;
  --dsw-font-xs-strong-13: 600 13px/18px ui-sans-serif, system-ui, sans-serif;
  --dsw-static-blue-500: #3b82f6;
  --trajectory-turn-accent: color-mix(in srgb, var(--dsw-static-blue-500) 22%, var(--dsw-alias-bg-layer-1));
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  color: var(--dsw-alias-label-primary);
  background: var(--dsw-alias-bg-layer-1);
}
html[data-theme="dark"] #trajView {
  --dsw-alias-state-business-primary: #4d8dff;
  --dsw-alias-state-business-tertiary: rgba(77, 141, 255, 0.16);
  --dsw-alias-state-success-primary: #34d399;
  --dsw-alias-state-success-tertiary: rgba(52, 211, 153, 0.12);
  --dsw-alias-state-warn-label: #f5a524;
  --dsw-alias-state-warn-tertiary: rgba(245, 165, 36, 0.16);
  --dsw-alias-brand-primary: #c4b5fd;
  --dsw-specific-sidebar-fill: #171717;
  --dsw-alias-bg-module-platform: #1a1a1a;
}
#trajView[hidden] { display: none !important; }
.dshTraj {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}
.dshToolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  box-sizing: border-box;
  width: 100%;
  height: var(--dsh-trajectory-toolbar-height);
  border-bottom: 1px solid var(--dsw-alias-border-l2);
  background: var(--dsw-alias-bg-layer-1);
}
.dshToolbarInner {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 0 6px;
  gap: 8px;
}
.dshToggle,
.dshAction {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  gap: 4px;
  border: 0;
  border-radius: 3px;
  color: var(--dsw-alias-label-tertiary);
  background: transparent;
  cursor: pointer;
  font: var(--dsw-font-xxs-12);
}
.dshAction { padding: 0 5px; }
.dshToggle:hover,
.dshAction:hover,
.dshToggle[aria-pressed="true"] {
  color: var(--dsw-alias-label-primary);
  background: var(--dsw-alias-interactive-bg-hover);
}
.dshToggle:focus-visible,
.dshAction:focus-visible {
  outline: 1px solid var(--dsw-alias-state-business-primary);
  outline-offset: 1px;
}
.dshActionIcon {
  color: var(--dsw-alias-label-tertiary);
  font: 14px/14px var(--ds-font-family-code);
}
.dshSearch {
  display: flex;
  flex: 0 1 164px;
  align-items: center;
  min-width: 84px;
  height: 22px;
  margin-left: auto;
  padding: 0 6px;
  gap: 4px;
  border: 1px solid var(--dsw-alias-border-l2);
  border-radius: 4px;
  color: var(--dsw-alias-label-caption);
  background: var(--dsw-alias-bg-layer-2);
}
.dshSearch:hover { border-color: var(--dsw-alias-label-caption); }
.dshSearch:focus-within {
  border-color: var(--dsw-alias-state-business-primary);
  background: var(--dsw-alias-bg-layer-1);
}
.dshSearch input {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--dsw-alias-label-primary);
  background: transparent;
  font: var(--dsw-font-xxs-12);
}
.dshSearch input::placeholder { color: var(--dsw-alias-label-caption); }
.dshTimeline {
  position: relative;
  z-index: 1;
  flex: none;
  border-bottom: 1px solid var(--dsw-alias-border-l2);
  user-select: none;
}
.dshPlot {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  height: 50px;
  overflow: hidden;
  background: var(--dsw-alias-bg-layer-2);
}
.dshLaneLabels {
  position: relative;
  border-right: 1px solid var(--dsw-alias-border-l1);
  color: var(--dsw-alias-label-caption);
  font-size: 10px;
  line-height: 1;
}
.dshLaneLabels span {
  position: absolute;
  right: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 8px;
  text-align: right;
}
.dshLaneLabels span:nth-child(1) { top: 7px; }
.dshLaneLabels span:nth-child(2) { top: 21px; }
.dshLaneLabels span:nth-child(3) { top: 35px; }
.dshTrack {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: crosshair;
}
.dshTrack::-webkit-scrollbar { height: 6px; }
.dshLanes {
  position: absolute;
  z-index: 2;
  top: 7px;
  bottom: 7px;
  left: 0;
  min-width: 100%;
}
.dshSpan {
  position: absolute;
  top: calc(var(--trajectory-span-lane) * 14px);
  left: var(--trajectory-span-left);
  width: max(2px, var(--trajectory-span-width));
  height: 8px;
  min-width: 2px;
  border-radius: 1px;
  background: var(--dsw-alias-label-secondary);
  opacity: 0.78;
  cursor: pointer;
}
.dshSpan[data-equal="true"] { min-width: 8px; }
.dshSpan[data-kind="user"] { background: var(--dsw-alias-state-business-primary); }
.dshSpan[data-kind="context"] {
  background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 68%, var(--dsw-alias-label-secondary));
}
.dshSpan[data-kind="message"] {
  background: color-mix(in srgb, var(--dsw-alias-brand-primary) 60%, var(--dsw-alias-state-error-secondary));
  opacity: 1;
}
.dshSpan[data-kind="tool"],
.dshSpan[data-kind="subtool"] {
  background: var(--dsw-alias-state-warn-label);
  opacity: 1;
}
.dshSpan[data-kind="system"] { background: var(--dsw-alias-label-tertiary); }
.dshSpan[data-error="true"] { background: var(--dsw-alias-state-error-primary); }
.dshSpan[data-current="true"] {
  z-index: 1;
  opacity: 1;
  box-shadow:
    0 0 0 1px var(--dsw-alias-bg-layer-2),
    0 0 0 2px var(--dsw-alias-state-business-primary);
}
.dshSpan[data-search-match="false"] { opacity: 0.14; }
.dshHover {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: clamp(0px, calc(var(--trajectory-hover-left) - 1px), calc(100% - 2px));
  width: 2px;
  background: var(--dsw-alias-state-business-primary);
  pointer-events: none;
}
.dshHover[hidden] { display: none; }
.dshSplit {
  position: relative;
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--dsw-alias-bg-layer-1);
}
.dshTablePane {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.dshEmpty {
  padding: 28px 16px;
  text-align: center;
  color: var(--dsw-alias-label-caption);
  font: var(--dsw-font-xs-13);
}
#trajEmpty.dshEmpty {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 30px;
  pointer-events: none;
}
.dshTable {
  width: 100%;
  min-width: 0;
  border-spacing: 0;
  table-layout: fixed;
  color: var(--dsw-alias-label-primary);
  background: var(--dsw-alias-bg-layer-1);
  font: var(--dsw-font-xxs-12);
}
.dshEventCol { width: 122px; }
.dshTable th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-sizing: border-box;
  height: 30px;
  padding: 0 8px;
  overflow: hidden;
  border-bottom: 1px solid var(--dsw-alias-border-l2);
  color: var(--dsw-alias-label-tertiary);
  background: var(--dsw-specific-sidebar-fill);
  font: var(--dsw-font-xxs-12);
  font-weight: 500;
  text-align: left;
  text-overflow: ellipsis;
  user-select: none;
  white-space: nowrap;
}
.dshTable th.dshEventCol {
  padding-right: 4px;
  text-align: right;
}
.dshTable td {
  box-sizing: border-box;
  height: 30px;
  padding: 0 8px;
  overflow: hidden;
  border-bottom: 1px solid var(--dsw-alias-border-l1);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dshRow { cursor: default; outline: none; }
.dshRow:hover { background: var(--dsw-alias-interactive-bg-hover); }
.dshRow[data-selected="true"] { background: var(--dsw-alias-interactive-bg-active); }
.dshRow[data-collapsed="true"] td { height: 20px; }
.dshEvent {
  position: relative;
  overflow: visible !important;
  padding-right: 4px !important;
  padding-left: 36px !important;
}
.dshTurnRail,
.dshSelRail {
  position: absolute;
  left: 0;
  pointer-events: none;
}
.dshTurnRail {
  z-index: 4;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: var(--trajectory-turn-accent);
}
.dshSelRail {
  z-index: 5;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--dsw-alias-brand-primary);
  display: none;
}
.dshRow[data-selected="true"] .dshSelRail { display: block; }
.dshRow[data-error="true"] .dshTurnRail {
  background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 22%, var(--dsw-alias-bg-layer-1));
}
.dshRow[data-error="true"] .dshSelRail { background: var(--dsw-alias-state-error-primary); }
.dshRow[data-turn-start="true"]:not(:first-child) td::before {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--dsw-alias-border-l1);
  content: "";
  pointer-events: none;
  transform: translateY(-50%);
}
.dshRow[data-turn-start="true"] td { position: relative; }
.dshRow[data-turn-start="true"] .dshEvent { overflow: visible; }
.dshRow[data-turn-start="true"] .dshContent { overflow: hidden; }
.dshKindSlot {
  display: flex;
  flex: none;
  align-items: flex-end;
  justify-content: flex-end;
  width: 76px;
  margin-left: auto;
}
.dshKindTag {
  display: inline-flex;
  flex: none;
  align-items: center;
  box-sizing: border-box;
  height: 19px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 10px;
  line-height: 16px;
  font-weight: 650;
  letter-spacing: 0.035em;
  user-select: none;
}
.dshKind-user { color: var(--dsw-alias-state-business-primary); background: var(--dsw-alias-state-business-tertiary); }
.dshKind-system { color: var(--dsw-alias-label-secondary); background: var(--dsw-alias-bg-module-platform); }
.dshKind-context {
  color: color-mix(in srgb, var(--dsw-alias-state-success-primary) 68%, var(--dsw-alias-label-secondary));
  background: var(--dsw-alias-state-success-tertiary);
}
.dshKind-message {
  color: color-mix(in srgb, var(--dsw-alias-brand-primary) 60%, var(--dsw-alias-state-error-secondary));
  background: color-mix(in srgb, color-mix(in srgb, var(--dsw-alias-brand-primary) 55%, var(--dsw-alias-state-error-secondary)) 15%, var(--dsw-alias-bg-layer-1));
}
.dshKind-tool { color: var(--dsw-alias-state-warn-label); background: var(--dsw-alias-state-warn-tertiary); }
.dshKind-subtool {
  color: color-mix(in srgb, var(--dsw-alias-state-warn-label) 62%, var(--dsw-alias-label-tertiary));
  background: color-mix(in srgb, var(--dsw-alias-state-warn-tertiary) 58%, var(--dsw-alias-bg-layer-1));
}
.dshContent {
  padding-left: 4px !important;
  color: var(--dsw-alias-label-primary);
  min-width: 0;
  overflow: hidden;
}
.dshRow[data-kind="subtool"] .dshContent { padding-left: 26px !important; }
.dshContentText {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dshRow[data-kind="context"] td,
.dshRow[data-kind="message"] td,
.dshRow[data-kind="system"] td {
  height: auto;
  min-height: 30px;
  padding-top: 6px;
  padding-bottom: 6px;
  white-space: normal;
}
.dshRow[data-kind="context"] .dshContentText,
.dshRow[data-kind="message"] .dshContentText,
.dshRow[data-kind="system"] .dshContentText {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}
.dshToolPreview {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 8px;
  overflow: hidden;
  font-family: var(--ds-font-family-code);
  font-size: 12px;
}
.dshToolReq {
  flex: 1 1 46%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dshToolName { color: var(--dsw-alias-label-primary); }
.dshToolArgs { margin-left: 7px; color: var(--dsw-alias-label-secondary); }
.dshInlineResult {
  display: flex;
  flex: 1 1 54%;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  color: var(--dsw-alias-label-secondary);
}
.dshInlineResult .dshContentText {
  flex: 1;
  min-width: 0;
}
.dshArrow { flex: none; margin-right: 8px; color: var(--dsw-alias-label-caption); }
.dshNoOut { color: var(--dsw-alias-label-caption); }
.dshCollapsed {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--dsw-alias-label-secondary);
  font-size: 12px;
  line-height: 16px;
}
.dshCollapsed i {
  flex: none;
  margin-right: 6px;
  color: var(--dsw-alias-label-tertiary);
  font-weight: 600;
  font-style: normal;
}
.dshDetails {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  width: clamp(280px, 34%, 320px);
  max-width: calc(100% - 280px);
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -6px 0 20px rgba(24, 24, 27, 0.025);
}
.dshDetails[hidden] { display: none !important; }
.dshDetailsHeader {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  min-height: 58px;
  height: auto;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.dshDetailsTitle {
  display: block;
  min-width: 0;
  color: var(--ink);
  font: 650 15px/20px Manrope, "Noto Sans SC", "PingFang SC", sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dshDetailsLoc {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font: 11px/16px Manrope, "Noto Sans SC", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dshClose {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--dsw-alias-label-secondary);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 18px;
}
.dshClose:hover {
  color: var(--dsw-alias-label-primary);
  background: var(--dsw-alias-interactive-bg-hover);
}
.dshDetailTabs {
  display: flex;
  flex: none;
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  height: 46px;
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  scrollbar-width: none;
  white-space: nowrap;
}
.dshDetailTabs::-webkit-scrollbar { display: none; }
.dshDetailTab {
  position: relative;
  flex: none;
  padding: 0 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 13px/46px Manrope, "Noto Sans SC", sans-serif;
}
.dshDetailTab:hover {
  color: var(--ink);
  background: var(--cream2);
}
.dshDetailTab.on { color: var(--accent); font-weight: 650; }
.dshDetailTab.on::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  border-radius: 1px 1px 0 0;
  background: var(--accent);
  content: "";
}
.dshDetailBody {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fafafa;
  padding: 8px 0;
}
.dshOverview {
  margin: 0;
  padding: 12px 16px;
  font: 13px/1.6 Manrope, "Noto Sans SC", sans-serif;
  background: #fff;
}
.dshOverview > div {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  min-height: 22px;
  padding: 0 14px;
  align-items: center;
}
.dshOverview dt { color: var(--muted); }
.dshOverview dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dshOverview dd.error { color: var(--dsw-alias-state-error-primary); }
.dshSection {
  display: flex;
  flex-direction: column;
  min-height: 28px;
  overflow: hidden;
}
.dshSection + .dshSection { padding-top: 8px; }
.dshHeading {
  display: flex;
  flex: none;
  align-items: flex-end;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 10px 16px 6px;
  color: var(--ink);
  background: transparent;
  font: 650 13px/18px Manrope, "Noto Sans SC", sans-serif;
  user-select: none;
}
.dshMd {
  padding: 0 16px 16px;
  color: var(--ink);
  font: 13px/1.65 Manrope, "Noto Sans SC", sans-serif;
}
.dshMd table {
  width: 100%;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}
.dshPre {
  margin: 0;
  padding: 4px 16px 16px;
  overflow: auto;
  color: var(--ink);
  font: 12px/1.6 Manrope, "Noto Sans SC", sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
}
.dshSchemaEmpty {
  padding: 24px 16px;
  color: var(--dsw-alias-label-caption);
  font: var(--dsw-font-xs-13);
}
.dshPayload { padding: 10px 14px 14px; }
body[data-main-view="trajectory"] .rightCol { display: none !important; }
body[data-main-view="trajectory"] .shell {
  grid-template-columns: 52px 260px minmax(0, 1fr) !important;
}
body[data-main-view="trajectory"].nav-collapsed .shell,
html.nav-collapsed-html body[data-main-view="trajectory"] .shell {
  grid-template-columns: 52px 0 minmax(0, 1fr) !important;
}
body[data-main-view="chat"] #pane-inspect {
  display: none !important;
}

.sessionStats {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 4px 16px 8px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--cream);
}
.sessionStats[hidden] { display: none !important; }
body[data-main-view="trajectory"] #rightTabs {
  display: none !important;
}
body[data-main-view="trajectory"] .rightTabs .tabBtn[data-tab="compute"],
body[data-main-view="trajectory"] .rightTabs .tabBtn[data-tab="results"] {
  display: none;
}
body[data-main-view="chat"] #pane-inspect,
body[data-main-view="trajectory"] #pane-compute,
body[data-main-view="trajectory"] #pane-results {
  display: none !important;
}
html[data-theme="dark"] .thinkOrb {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
html[data-theme="dark"] .thinkText {
  background: linear-gradient(90deg, #8a8a8a 0%, #e8e8e8 45%, #8a8a8a 90%);
  background-size: 180% 100%;
  -webkit-background-clip: text;
  background-clip: text;
}
html[data-theme="dark"] .traceThinkDot { background: var(--accent); }
html[data-theme="dark"] .centerCol {
  background: radial-gradient(circle at 50% -20%, rgba(30, 64, 175, 0.28), transparent 40%), #101216;
}
html[data-theme="dark"] .leftCol,
html[data-theme="dark"] .rightCol,
html[data-theme="dark"] .rightTabs,
html[data-theme="dark"] .rightPane,
html[data-theme="dark"] .rail,
html[data-theme="dark"] .dshDetails,
html[data-theme="dark"] .dshDetailsHeader,
html[data-theme="dark"] .dshDetailTabs {
  background: #15181d;
}
html[data-theme="dark"] .dshDetailBody { background: #101216; }
html[data-theme="dark"] .task.active { border-color: #1e3a8a; background: #172554; }
html[data-theme="dark"] .railBtn.active { background: #172554; color: #60a5fa; }
html[data-theme="dark"] .quickCard { background: #1b1f25; }
html[data-theme="dark"] .composer { background: rgba(21, 24, 29, 0.88); }
html[data-theme="dark"] .composerBox { background: #15181d; border-color: #2c313a; }
html[data-theme="dark"] .sendBtn.idle { background: #3f4650; color: #e4e4e7; }

/* Zip login/register: white default, dark via html[data-theme]. */
.login-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100%;
  place-items: center;
  overflow: hidden;
  padding: 40px 24px;
  background: #fafaf9;
  color: var(--ink);
}
.login-screen::before {
  position: absolute;
  z-index: -3;
  inset: 0;
  content: "";
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 10%, transparent 78%);
  animation: tech-grid-drift 26s linear infinite;
}
.login-screen::after {
  position: absolute;
  z-index: -4;
  inset: -18%;
  content: "";
  background:
    radial-gradient(circle at 18% 30%, rgba(37, 99, 235, 0.16), transparent 25%),
    radial-gradient(circle at 78% 68%, rgba(99, 102, 241, 0.15), transparent 24%),
    radial-gradient(circle at 52% 46%, rgba(255, 255, 255, 0.98) 0, rgba(255, 255, 255, 0.82) 30%, rgba(250, 250, 249, 0.9) 74%);
  animation: tech-aurora-drift 20s ease-in-out infinite alternate;
}
.login-tech-field {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-tech-field::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(72vw, 920px);
  height: min(72vw, 920px);
  content: "";
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
  box-shadow: 0 0 0 42px rgba(37, 99, 235, 0.03), 0 0 0 84px rgba(14, 165, 233, 0.03);
  animation: tech-ring-breathe 12s ease-in-out infinite;
}
.login-tech-field::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(54vw, 680px);
  height: min(19vw, 240px);
  content: "";
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(30deg);
  animation: tech-ring-spin 32s linear infinite reverse;
}
.tech-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.tech-orbit-one {
  width: min(54vw, 680px);
  height: min(18vw, 220px);
  animation: tech-orbit-one 22s linear infinite;
}
.tech-orbit-two {
  width: min(66vw, 830px);
  height: min(28vw, 350px);
  border-color: rgba(99, 102, 241, 0.12);
  transform: translate(-50%, -50%) rotate(-38deg);
  animation: tech-orbit-two 30s linear infinite reverse;
}
.tech-orbit-three {
  width: min(38vw, 480px);
  height: min(72vw, 900px);
  border-color: rgba(37, 99, 235, 0.1);
  transform: translate(-50%, -50%) rotate(22deg);
  animation: tech-orbit-three 28s linear infinite;
}
.tech-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.1), 0 0 20px rgba(37, 99, 235, 0.35);
  animation: tech-node-pulse 4s ease-in-out infinite;
}
.tech-node-one { top: 24%; left: 18%; }
.tech-node-two { top: 28%; right: 19%; animation-delay: -1.2s; }
.tech-node-three { bottom: 24%; left: 23%; animation-delay: -2.4s; }
.tech-node-four { right: 13%; bottom: 18%; animation-delay: -3.3s; }
.tech-scan-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(transparent, rgba(37, 99, 235, 0.2), transparent);
  opacity: 0.6;
  animation: tech-scan 9s ease-in-out infinite alternate;
}
.login-card-modern {
  position: relative;
  width: min(100%, 448px);
  overflow: hidden;
  border: 1px solid rgba(228, 228, 231, 0.9);
  border-radius: 18px;
  padding: 22px 26px 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 26px 80px rgba(24, 24, 27, 0.14), 0 0 0 1px rgba(255, 255, 255, 0.68) inset;
  backdrop-filter: blur(18px);
  color: var(--ink);
}
.login-card-modern::before {
  position: absolute;
  inset: 0 16% auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
  opacity: 0.9;
}
.login-card-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.login-wordmark-shell {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.login-wordmark-shell img { display: block; width: 156px; height: auto; object-fit: contain; }
.theme-logo-dark { display: none !important; }
.login-eyebrow {
  margin: 0 0 6px;
  color: var(--accent-red);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
}
.login-form-head { margin-bottom: 14px; }
.login-form-head .login-eyebrow { margin-bottom: 6px; }
.login-form-head h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.login-form-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.login-form-footer {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.login-form-footer a { color: var(--accent-red); text-decoration: none; }
.login-form-footer a:hover { text-decoration: underline; }
.login-form-footer.small { font-size: 11px; margin-top: 6px; }
.register-card-modern { width: min(100%, 520px); }
.register-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.register-fields label { min-width: 0; }
.register-fields .span2 { grid-column: 1 / -1; }
.register-fields .fieldName { display: inline; }
.register-fields .req {
  color: #e11d48;
  margin-left: 2px;
  font-weight: 700;
}
.register-fields .optionalHint {
  color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
}
.form-stack { display: grid; gap: 8px; }
.form-stack label {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.login-screen label,
.login-screen .form-stack label {
  font-weight: 600;
}
.login-screen .input {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 400;
  font-synthesis: none;
  padding: 7px 10px;
}
.login-screen .input::placeholder {
  font-weight: 400;
  font-synthesis: none;
  color: var(--muted);
  opacity: 1;
}
.login-screen .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 650;
  height: 36px;
  margin-top: 4px;
}
.login-screen .btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.theme-toggle:hover,
.auth-lang:hover {
  border-color: #d4d4d8;
  background: var(--cream2);
  color: var(--ink);
}
.login-theme-toggle { position: absolute; top: 22px; right: 24px; z-index: 2; }
.login-auth-bar {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-chrome-icon,
.auth-lang-globe {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  display: block;
}
.auth-lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 30px;
  padding: 0 5px 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--muted);
}
.auth-lang-globe { margin-right: 4px; }
.auth-lang-div {
  width: 1px;
  height: 12px;
  background: var(--line);
  margin: 0 2px;
}
.auth-lang-seg {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
}
.auth-lang-seg:hover { color: var(--ink); }
.auth-lang-seg[aria-pressed="true"] {
  background: #eff6ff;
  color: var(--accent);
}
.auth-lang-seg[aria-pressed="true"]:hover {
  color: var(--accent);
}
html[data-theme="dark"] .auth-lang-seg[aria-pressed="true"] {
  background: rgba(96, 165, 250, 0.16);
  color: var(--accent);
}
html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .auth-lang:hover {
  border-color: #3f4652;
  background: var(--cream2);
  color: var(--ink);
}
html[data-theme="dark"] .login-screen { background: #0d0f12; color: var(--ink); }
html[data-theme="dark"] .login-screen::before {
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.08) 1px, transparent 1px);
}
html[data-theme="dark"] .login-screen::after {
  background:
    radial-gradient(circle at 18% 30%, rgba(37, 99, 235, 0.22), transparent 25%),
    radial-gradient(circle at 78% 68%, rgba(99, 102, 241, 0.2), transparent 24%),
    radial-gradient(circle at 52% 46%, rgba(21, 24, 29, 0.98) 0, rgba(13, 15, 18, 0.92) 70%);
}
html[data-theme="dark"] .login-card-modern {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
html[data-theme="dark"] .theme-logo-light { display: none; }
html[data-theme="dark"] .theme-logo-dark { display: block !important; }
html[data-theme="dark"] .login-wordmark-shell {
  background: transparent;
  box-shadow: none;
}
@keyframes tech-grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 48px 48px, 48px 48px; }
}
@keyframes tech-aurora-drift {
  from { transform: translate3d(-2%, -1%, 0) rotate(0deg); }
  to { transform: translate3d(2%, 1%, 0) rotate(3deg); }
}
@keyframes tech-ring-breathe {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) rotate(-18deg) scale(0.98); }
  50% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1.03); }
}
@keyframes tech-ring-spin {
  from { transform: translate(-50%, -50%) rotate(30deg); }
  to { transform: translate(-50%, -50%) rotate(390deg); }
}
@keyframes tech-orbit-one {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes tech-orbit-two {
  from { transform: translate(-50%, -50%) rotate(-38deg); }
  to { transform: translate(-50%, -50%) rotate(-398deg); }
}
@keyframes tech-orbit-three {
  from { transform: translate(-50%, -50%) rotate(22deg); }
  to { transform: translate(-50%, -50%) rotate(382deg); }
}
@keyframes tech-node-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
@keyframes tech-scan {
  from { transform: translateX(-22vw); opacity: 0.08; }
  to { transform: translateX(22vw); opacity: 0.6; }
}
@media (prefers-reduced-motion: reduce) {
  .login-screen::before, .login-screen::after, .login-tech-field::before, .login-tech-field::after, .tech-orbit, .tech-node, .tech-scan-line { animation: none; }
}
@media (max-width: 600px) {
  .login-screen { padding: 20px 14px; }
  .login-card-modern { padding: 26px 22px; border-radius: 14px; }
  .login-card-brand { margin-bottom: 28px; }
  .register-card-modern { width: min(100%, 448px); }
  .register-fields { grid-template-columns: 1fr; }
  .login-theme-toggle { top: 14px; right: 14px; }
  .login-auth-bar { top: 14px; right: 14px; }
}
