/* Odyssey Relay // K3 Communicator — V3 Space Odyssey theme.
   Tokens mirror v3/frontend/src/styles/tokens.css (ONE ramp, no blend):
   dark-grid default, white-silicon light. Accent #51f1e8, never Tron #00E5FF. */

:root {
  --bg: #020b10;
  --bg-deep: #01070b;
  --surface: rgba(6, 28, 36, 0.76);
  --surface-strong: rgba(4, 20, 28, 0.96);
  --surface-soft: rgba(9, 38, 47, 0.62);
  --surface-hover: rgba(28, 124, 128, 0.13);
  --line: rgba(76, 231, 225, 0.18);
  --line-strong: rgba(75, 235, 225, 0.52);
  --line-soft: rgba(137, 233, 231, 0.08);
  --text: #e9ffff;
  --text-soft: #a9ced0;
  --muted: #668f94;
  --faint: #3d6469;
  --cyan: #51f1e8;
  --cyan-soft: #7ef6ef;
  --green: #4cf08d;
  --amber: #ffc85e;
  --red: #ff5868;
  --violet: #b8a4ff;
  --shadow: rgba(0, 0, 0, 0.55);
  --glow: rgba(81, 241, 232, 0.15);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --font-sans: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html[data-theme="white-silicon"] {
  --bg: #e8efed;
  --bg-deep: #d8e5e2;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(250, 255, 253, 0.8);
  --surface-hover: rgba(14, 130, 118, 0.08);
  --line: rgba(14, 109, 106, 0.17);
  --line-strong: rgba(10, 127, 121, 0.46);
  --line-soft: rgba(16, 116, 112, 0.08);
  --text: #102d30;
  --text-soft: #345e61;
  --muted: #65888a;
  --faint: #9ab0af;
  --cyan: #047d79;
  --cyan-soft: #03655f;
  --green: #128552;
  --amber: #aa6715;
  --red: #cf3f4c;
  --violet: #6757bb;
  --shadow: rgba(32, 82, 80, 0.18);
  --glow: rgba(4, 125, 121, 0.12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-width: 1080px;
  min-height: 720px;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 68% 5%, rgba(14, 102, 114, .18), transparent 34%),
    radial-gradient(circle at 18% 105%, rgba(10, 90, 80, .2), transparent 38%),
    linear-gradient(155deg, var(--bg-deep), var(--bg));
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: .005em;
}

button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hidden { display: none !important; }

.space-layer, .aurora, .scanlines { position: fixed; inset: 0; pointer-events: none; }
.space-layer { opacity: .28; background-repeat: repeat; }
.space-a {
  background-image:
    radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(81,241,232,.45) 0 1px, transparent 1.6px);
  background-position: 12px 18px, 76px 93px;
  background-size: 118px 118px, 191px 191px;
  animation: starDrift 85s linear infinite;
}
.space-b {
  opacity: .14;
  background-image: radial-gradient(circle, rgba(255,255,255,.65) 0 1px, transparent 1.4px);
  background-position: 35px 42px;
  background-size: 247px 247px;
  animation: starDrift 140s linear infinite reverse;
}
.aurora {
  opacity: .7;
  background:
    radial-gradient(ellipse at 64% -25%, transparent 18%, rgba(31, 184, 196, .11) 19%, transparent 32%),
    radial-gradient(ellipse at 65% -20%, transparent 28%, rgba(14, 102, 114, .12) 29%, transparent 47%);
  filter: blur(8px);
}
.scanlines {
  z-index: 20;
  opacity: .035;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, #fff 4px);
  mix-blend-mode: overlay;
}
html[data-theme="white-silicon"] .space-layer { opacity: .1; }
html[data-theme="white-silicon"] .scanlines { opacity: .015; }
@keyframes starDrift { to { transform: translate3d(-118px, 118px, 0); } }

.relay-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 66px 32px minmax(0, 1fr) 28px;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(90deg, rgba(2, 11, 16, .96), rgba(3, 17, 22, .78) 38%, rgba(2, 11, 16, .94));
  transition: background .35s ease, color .35s ease;
}
html[data-theme="white-silicon"] .relay-shell { background: linear-gradient(125deg, rgba(246,253,251,.9), rgba(231,246,243,.78)); }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  display: grid;
  grid-template-columns: 310px minmax(560px, 1fr) 180px;
  align-items: center;
  gap: 20px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 11, 16, .82);
  box-shadow: 0 12px 35px rgba(0,0,0,.2);
  backdrop-filter: blur(22px) saturate(130%);
}
html[data-theme="white-silicon"] .topbar { background: rgba(247, 254, 252, .82); }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-orbit {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid var(--cyan); border-radius: 50%; color: var(--cyan);
  box-shadow: 0 0 20px var(--glow), inset 0 0 18px var(--glow);
}
.brand-orbit::before, .brand-orbit::after { content: ""; position: absolute; background: var(--cyan); opacity: .55; }
.brand-orbit::before { width: 56px; height: 1px; }
.brand-orbit::after { width: 1px; height: 56px; }
.brand-orbit span { position: absolute; inset: 6px; border: 1px dashed var(--line-strong); border-radius: 50%; animation: spin 11s linear infinite; }
.brand-orbit b { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.eyebrow { color: var(--muted); font: 600 8px/1.2 var(--font-mono); letter-spacing: .23em; }
.brand-lockup h1 { margin: 3px 0 0; color: var(--cyan-soft); font-size: 18px; line-height: 1; font-weight: 500; letter-spacing: .13em; }
.brand-lockup p { margin: 4px 0 0; color: var(--text-soft); font: 9px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }

.system-spine { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 8px; max-width: 760px; justify-self: center; width: 100%; }
.spine-node {
  position: relative; display: grid; grid-template-columns: 22px 1fr; grid-template-rows: 1fr 1fr;
  align-items: center; column-gap: 8px; min-width: 0; height: 42px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft);
  overflow: hidden;
}
.spine-node svg { grid-row: 1 / 3; width: 19px; height: 19px; color: var(--cyan); }
.spine-node span { color: var(--muted); font: 8px/1 var(--font-mono); letter-spacing: .13em; }
.spine-node strong { overflow: hidden; color: var(--text); font: 600 10px/1 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.spine-node[data-state="up"] strong { color: var(--green); }
.spine-node[data-state="warn"] strong, .spine-node[data-state="warn"] svg { color: var(--amber); }
.spine-node[data-state="down"] strong, .spine-node[data-state="down"] svg { color: var(--red); }
.spine-node[data-state="unknown"] strong { color: var(--faint); }
.window-actions { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.icon-button, .avatar-button {
  display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface-soft); cursor: pointer; transition: .18s ease;
}
.icon-button:hover { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 18px var(--glow); transform: translateY(-1px); }
.icon-button svg { width: 16px; height: 16px; }
.avatar-button { position: relative; margin-left: 4px; color: var(--cyan); font-family: var(--font-mono); cursor: default; }
.avatar-button span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: radial-gradient(circle at 35% 25%, #1f5b63, #04141a 68%); font-size: 11px; }
.avatar-button i { position: absolute; right: -1px; top: -1px; width: 8px; height: 8px; background: var(--green); border: 2px solid var(--bg); border-radius: 50%; box-shadow: 0 0 9px var(--green); }

/* ── Status ribbon ─────────────────────────────────────── */
.status-ribbon {
  display: flex; align-items: center; gap: 22px; padding: 0 18px;
  border-bottom: 1px solid var(--line-soft); background: rgba(4, 20, 28, .78);
  color: var(--muted); font: 8px/1 var(--font-mono); letter-spacing: .1em;
}
html[data-theme="white-silicon"] .status-ribbon { background: rgba(236, 249, 246, .78); }
.signal-label { min-width: 244px; color: var(--cyan); }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s ease-in-out infinite; }
.live-dot.dead { background: var(--red); box-shadow: 0 0 8px var(--red); }
.ribbon-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ribbon-item span { color: var(--muted); }
.ribbon-item strong { color: var(--text-soft); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ribbon-item.right { margin-left: auto; }

/* ── Grid + panels ─────────────────────────────────────── */
.workspace-grid {
  display: grid;
  grid-template-columns: 268px minmax(600px, 1fr) 318px;
  min-height: 0;
  gap: 8px;
  padding: 8px;
}
.panel-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255,255,255,.018), transparent 45%),
    var(--surface);
  box-shadow: 0 18px 45px -32px var(--shadow), inset 0 1px rgba(255,255,255,.02);
  backdrop-filter: blur(15px) saturate(125%);
}
html[data-theme="white-silicon"] .panel-surface { box-shadow: 0 18px 35px -28px var(--shadow), inset 0 1px rgba(255,255,255,.7); }

.empty-hint { padding: 14px 10px; color: var(--faint); font: 10px/1.6 var(--font-mono); text-align: center; letter-spacing: .04em; }

/* ── Left deck ─────────────────────────────────────────── */
.left-deck { min-height: 0; display: flex; flex-direction: column; padding: 12px 10px; overflow: hidden; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px 10px; }
.section-head > div { display: grid; gap: 4px; }
.section-head span { color: var(--muted); font: 7px/1 var(--font-mono); letter-spacing: .16em; }
.section-head strong { color: var(--text); font-size: 12px; font-weight: 600; }
.section-head.compact { padding-top: 10px; padding-bottom: 8px; }
.small-action, .panel-footer-button {
  border: 0; background: transparent; color: var(--cyan); cursor: pointer;
  font: 600 8px/1 var(--font-mono); letter-spacing: .1em;
}
.small-action:hover { text-shadow: 0 0 8px var(--cyan); }
.session-list { display: grid; gap: 5px; overflow-y: auto; min-height: 0; }
.session-card {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 16px; align-items: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 7px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; cursor: pointer; text-align: left; transition: .16s ease;
}
.session-card:hover { background: var(--surface-soft); border-color: var(--line); }
.session-card.active { border-color: var(--cyan); background: linear-gradient(90deg, rgba(81,241,232,.13), rgba(9,38,47,.4)); box-shadow: inset 3px 0 var(--cyan), 0 0 18px rgba(81,241,232,.06); }
.session-card > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.session-card strong { overflow: hidden; color: var(--text); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.session-card small { overflow: hidden; color: var(--muted); font: 8px/1 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.session-card > svg { width: 12px; color: var(--muted); }
.session-beacon { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid rgba(81,241,232,.45); border-radius: 50%; }
.session-beacon i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.session-beacon[data-state="running"] i { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.2s infinite; }
.session-beacon[data-state="queued"] i { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.session-beacon[data-state="error"] i { background: var(--red); box-shadow: 0 0 10px var(--red); }
.session-beacon[data-state="blocked"] i { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.left-divider { height: 1px; margin: 12px 4px 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.context-stack { display: grid; gap: 1px; padding: 0 4px; }
.context-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 25px; border-bottom: 1px solid var(--line-soft); }
.context-row span { color: var(--muted); font-size: 9px; }
.context-row strong { overflow: hidden; color: var(--text-soft); font: 500 8px/1 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.context-row strong.teal { color: var(--cyan); }
.quick-directives { margin-top: 5px; display: grid; gap: 5px; }
.quick-directives button {
  min-height: 31px; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 6px;
  background: rgba(2, 15, 19, .32); color: var(--text-soft); cursor: pointer; text-align: left; font-size: 9px; transition: .15s;
}
html[data-theme="white-silicon"] .quick-directives button { background: rgba(255,255,255,.3); }
.quick-directives button::before { content: "›"; margin-right: 7px; color: var(--cyan); }
.quick-directives button:hover { border-color: var(--cyan); color: var(--text); transform: translateX(2px); }
.sovereign-note {
  display: flex; gap: 9px; margin-top: auto; padding: 10px; border: 1px solid rgba(76,240,141,.22); border-radius: var(--radius-sm);
  background: rgba(18, 92, 66, .09);
}
.sovereign-note svg { flex: 0 0 auto; color: var(--green); }
.sovereign-note strong { color: var(--green); font: 600 8px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.sovereign-note p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }

/* ── Center deck ───────────────────────────────────────── */
.center-deck { min-width: 0; min-height: 0; display: grid; grid-template-rows: 90px minmax(0, 1fr) auto; gap: 8px; }
.signal-chamber {
  position: relative; display: grid; grid-template-columns: minmax(250px, 1fr) 250px minmax(220px, .75fr); align-items: center;
  padding: 10px 16px; overflow: hidden;
}
.signal-chamber::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0 28%, rgba(81,241,232,.04) 50%, transparent 72%); animation: chamberSweep 8s ease-in-out infinite; }
.chamber-copy { position: relative; z-index: 2; }
.chamber-copy h2 { margin: 5px 0 4px; color: var(--cyan-soft); font-size: 17px; font-weight: 500; letter-spacing: .12em; }
.chamber-copy p { margin: 0; color: var(--text-soft); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.holo-core { position: relative; width: 230px; height: 76px; justify-self: center; perspective: 500px; }
.core-ring { position: absolute; left: 50%; top: 50%; border: 1px solid var(--cyan); border-radius: 50%; transform-style: preserve-3d; box-shadow: 0 0 15px rgba(81,241,232,.17); }
.ring-a { width: 154px; height: 42px; margin: -21px 0 0 -77px; animation: orbitA 7s linear infinite; }
.ring-b { width: 130px; height: 58px; margin: -29px 0 0 -65px; border-style: dashed; opacity: .6; animation: orbitB 9s linear infinite; }
.ring-c { width: 88px; height: 68px; margin: -34px 0 0 -44px; opacity: .45; animation: orbitC 5.5s linear infinite; }
.core-orb { position: absolute; z-index: 3; left: 50%; top: 50%; display: grid; place-items: center; width: 48px; height: 48px; margin: -24px; border: 1px solid var(--cyan); border-radius: 50%; color: var(--cyan-soft); background: radial-gradient(circle at 35% 28%, rgba(126,246,239,.35), rgba(14,102,114,.16) 38%, rgba(2,11,16,.8) 72%); box-shadow: 0 0 30px rgba(81,241,232,.27), inset 0 0 18px rgba(81,241,232,.16); }
.core-orb span { font: 600 12px var(--font-mono); }
.core-orb i { position: absolute; inset: 7px; border: 1px dotted rgba(126,246,239,.55); border-radius: 50%; animation: spin 5s linear infinite reverse; }
.core-shadow { position: absolute; left: 50%; bottom: 3px; width: 120px; height: 8px; margin-left: -60px; border: 1px solid rgba(81,241,232,.25); border-radius: 50%; background: rgba(81,241,232,.06); box-shadow: 0 0 18px rgba(81,241,232,.22); }
.holo-core[data-state="working"] .core-orb { animation: orbBreathe 1.6s ease-in-out infinite; }
.holo-core[data-state="working"] .ring-a { animation-duration: 3.5s; }
.holo-core[data-state="working"] .ring-b { animation-duration: 4.5s; }
@keyframes orbBreathe { 0%,100% { box-shadow: 0 0 30px rgba(81,241,232,.27), inset 0 0 18px rgba(81,241,232,.16); } 50% { box-shadow: 0 0 44px rgba(81,241,232,.5), inset 0 0 26px rgba(81,241,232,.3); } }
.chamber-metrics { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.chamber-metrics div { display: grid; gap: 5px; padding: 9px; border-left: 1px solid var(--line); background: linear-gradient(90deg, rgba(81,241,232,.04), transparent); }
.chamber-metrics span { color: var(--muted); font: 7px/1 var(--font-mono); letter-spacing: .13em; }
.chamber-metrics strong { color: var(--cyan-soft); font: 500 15px/1 var(--font-mono); }

.conversation { min-height: 0; overflow: auto; padding: 14px 17px 24px; scroll-behavior: smooth; }
.conversation::-webkit-scrollbar, .activity-rail::-webkit-scrollbar, .session-list::-webkit-scrollbar { width: 5px; }
.conversation::-webkit-scrollbar-thumb, .activity-rail::-webkit-scrollbar-thumb, .session-list::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.message { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 9px; margin-bottom: 11px; }
.message.human { grid-template-columns: minmax(0, 1fr) 34px; }
.message.human .message-marker { grid-column: 2; grid-row: 1; border-color: var(--amber); color: var(--amber); }
.message.human .message-card { grid-column: 1; grid-row: 1; justify-self: end; max-width: 78%; border-right: 2px solid var(--amber); border-left: 1px solid var(--line); background: linear-gradient(120deg, rgba(170,103,21,.14), var(--surface-soft)); }
.message-marker { display: grid; place-items: center; width: 32px; height: 32px; margin-top: 2px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--cyan); background: var(--surface-strong); font: 600 8px var(--font-mono); box-shadow: 0 0 13px var(--glow); }
.message-marker.k3-mark { position: relative; }
.message-marker.k3-mark::after { content: ""; position: absolute; inset: 5px; border: 1px dashed currentColor; border-radius: 50%; animation: spin 8s linear infinite; opacity: .55; }
.message-card { width: fit-content; max-width: 88%; padding: 10px 12px; border: 1px solid var(--line); border-left: 2px solid var(--cyan); border-radius: var(--radius-sm); background: linear-gradient(120deg, rgba(14,102,114,.27), var(--surface-soft)); box-shadow: 0 10px 30px -24px var(--shadow); }
.message-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.message-meta strong { color: var(--cyan-soft); font: 600 9px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.message.human .message-meta strong { color: var(--amber); }
.message-meta time { margin-left: auto; color: var(--muted); font: 8px/1 var(--font-mono); }
.model-chip { padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--cyan); font: 7px/1 var(--font-mono); }
.message-card > p, .msg-body { margin: 0; color: var(--text); font-size: 12px; line-height: 1.55; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-body code { font-family: var(--font-mono); font-size: 11px; padding: 1px 4px; border: 1px solid var(--line-soft); border-radius: 4px; background: rgba(0,0,0,.22); color: var(--cyan-soft); }
html[data-theme="white-silicon"] .msg-body code { background: rgba(4,125,121,.06); }
.msg-body pre { margin: 8px 0; padding: 9px 10px; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 6px; background: rgba(0,0,0,.28); }
html[data-theme="white-silicon"] .msg-body pre { background: rgba(4,125,121,.05); }
.msg-body pre code { padding: 0; border: 0; background: transparent; font-size: 11px; line-height: 1.5; color: var(--text-soft); }
.message.pending .message-card { opacity: .6; }
.message.streaming .msg-body::after { content: "▊"; margin-left: 2px; color: var(--cyan); animation: pulse 1s infinite; }
.message-context { display: flex; align-items: center; gap: 6px; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--muted); font: 8px/1.4 var(--font-mono); }
.message-context svg { width: 12px; color: var(--amber); }
.system-note { margin: 4px 42px 10px; padding: 7px 10px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font: 9px/1.5 var(--font-mono); text-align: center; }
.system-note.error { border-color: rgba(255,88,104,.4); color: var(--red); }

/* ── Composer ──────────────────────────────────────────── */
.composer { position: relative; padding: 9px 10px 8px; }
.composer textarea { width: 100%; min-height: 44px; max-height: 94px; resize: none; padding: 8px 10px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--muted); }
.composer-controls { display: flex; align-items: center; gap: 8px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.control-group { display: flex; gap: 5px; }
.round-control { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); color: var(--text-soft); cursor: pointer; }
.round-control svg { width: 14px; height: 14px; }
.round-control:hover, .round-control.active { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 12px var(--glow); }
.round-control.cancel { border-color: rgba(255,88,104,.5); color: var(--red); }
.round-control.cancel:hover { border-color: var(--red); box-shadow: 0 0 12px rgba(255,88,104,.25); }
.mode-selector { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,.1); }
.mode-selector button { padding: 5px 7px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; cursor: pointer; font: 600 7px/1 var(--font-mono); letter-spacing: .08em; }
.mode-selector button.active { color: var(--cyan); background: rgba(81,241,232,.1); }
.voice-wave { display: flex; align-items: center; justify-content: center; gap: 2px; width: 66px; height: 24px; margin-left: auto; opacity: .4; }
.voice-wave i { width: 2px; height: 4px; border-radius: 3px; background: var(--cyan); }
.voice-wave.active { opacity: 1; }
.voice-wave.active i { animation: wave 1s ease-in-out infinite; }
.voice-wave.active i:nth-child(2) { animation-delay: .1s; } .voice-wave.active i:nth-child(3) { animation-delay: .2s; }
.voice-wave.active i:nth-child(4) { animation-delay: .3s; } .voice-wave.active i:nth-child(5) { animation-delay: .4s; }
.voice-wave.active i:nth-child(6) { animation-delay: .5s; } .voice-wave.active i:nth-child(7) { animation-delay: .6s; }
.send-button { display: flex; align-items: center; gap: 8px; min-height: 31px; padding: 0 11px; border: 1px solid var(--cyan); border-radius: 6px; color: #02161a; background: linear-gradient(110deg, var(--cyan), #8ffaf2); cursor: pointer; box-shadow: 0 0 18px rgba(81,241,232,.13); }
html[data-theme="white-silicon"] .send-button { color: #ffffff; background: linear-gradient(110deg, #03655f, #0a9790); }
.send-button span { font: 700 8px/1 var(--font-mono); letter-spacing: .08em; }
.send-button svg { width: 13px; }
.send-button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.send-button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.capture-tray { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; padding: 6px 8px; border: 1px solid rgba(255,88,104,.35); border-radius: 6px; background: rgba(255,88,104,.07); }
.capture-preview { display: flex; align-items: center; gap: 7px; }
.capture-preview strong { color: var(--red); font: 600 8px var(--font-mono); letter-spacing: .1em; }
.capture-preview small { color: var(--muted); font: 8px var(--font-mono); }
.record-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1s infinite; }
.capture-tray button { border: 0; background: transparent; color: var(--red); cursor: pointer; font: 600 8px var(--font-mono); }
.attachment-strip { display: flex; gap: 5px; overflow-x: auto; }
.attachment-chip { display: flex; align-items: center; gap: 5px; max-width: 180px; margin-top: 6px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--text-soft); background: var(--surface-soft); font: 8px var(--font-mono); }
.attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip svg { width: 11px; flex: 0 0 auto; }
.attachment-chip button { border: 0; background: transparent; color: var(--red); cursor: pointer; }

/* ── Right deck ────────────────────────────────────────── */
.right-deck { min-height: 0; display: grid; grid-template-rows: minmax(210px, 1.25fr) auto minmax(120px, auto) auto; gap: 8px; }
.activity-panel, .health-panel, .approval-panel, .usage-panel { min-height: 0; padding: 11px 10px; overflow: hidden; }
.live-label { display: flex; align-items: center; gap: 5px; color: var(--green) !important; font: 600 7px/1 var(--font-mono); }
.live-label i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 7px var(--green); }
.activity-panel { display: flex; flex-direction: column; }
.activity-rail { min-height: 0; overflow-y: auto; padding: 0 3px; }
.activity-event { position: relative; display: grid; grid-template-columns: 48px 10px 1fr; gap: 7px; min-height: 45px; }
.activity-event:not(:last-child)::after { content: ""; position: absolute; left: 52px; top: 20px; bottom: -1px; width: 1px; background: var(--line); }
.activity-event time { padding-top: 3px; color: var(--muted); font: 7px/1 var(--font-mono); text-align: right; }
.activity-event > i { z-index: 2; width: 7px; height: 7px; margin-top: 3px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg); }
.activity-event.done > i { background: var(--green); border-color: var(--green); box-shadow: 0 0 7px var(--green); }
.activity-event.active > i { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse 1.2s infinite; }
.activity-event.failed > i { background: var(--red); border-color: var(--red); box-shadow: 0 0 7px var(--red); }
.activity-event div { display: grid; align-content: start; gap: 4px; min-width: 0; }
.activity-event strong { color: var(--text); font-size: 9px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-event p { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.health-panel { display: grid; }
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; align-self: center; }
.service-card { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 5px; min-height: 39px; padding: 5px; border: 1px solid var(--line-soft); border-radius: 5px; background: transparent; text-align: left; }
.service-card svg { width: 14px; color: var(--cyan); }
.service-card span { display: grid; gap: 2px; min-width: 0; }
.service-card strong { font-size: 8px; color: var(--text); }
.service-card small { color: var(--muted); font-size: 7px; }
.service-card em { color: var(--green); font: 7px var(--font-mono); font-style: normal; }
.service-card[data-state="warn"] em, .service-card[data-state="warn"] svg { color: var(--amber); }
.service-card[data-state="down"] em, .service-card[data-state="down"] svg { color: var(--red); }
.service-card[data-state="unknown"] em { color: var(--faint); }
.attention-badge { display: grid !important; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #160d00 !important; background: var(--amber); font: 700 8px var(--font-mono) !important; box-shadow: 0 0 11px rgba(255,200,94,.35); }
.approval-card { padding: 9px; margin-bottom: 6px; border: 1px solid rgba(255,200,94,.28); border-radius: 7px; background: linear-gradient(120deg, rgba(255,200,94,.08), transparent); }
.approval-severity { display: flex; justify-content: space-between; color: var(--amber); font: 7px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.approval-severity.sev-critical, .approval-severity.sev-high { color: var(--red); }
.approval-card h3 { margin: 7px 0 5px; font-size: 10px; color: var(--text); }
.approval-card p { margin: 0; color: var(--text-soft); font-size: 8px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.approval-actions { display: grid; grid-template-columns: .6fr 1fr; gap: 5px; margin-top: 7px; }
.approval-actions button { height: 25px; border-radius: 4px; cursor: pointer; font: 600 8px var(--font-mono); }
.approval-actions .deny { border: 1px solid var(--line); color: var(--muted); background: transparent; }
.approval-actions .deny:hover { color: var(--red); border-color: var(--red); }
.approval-actions .approve { border: 1px solid var(--amber); color: #1a1000; background: var(--amber); }
.approval-actions .approve:hover { filter: brightness(1.08); }
/* decision facts — WHY / BLAST / UNDO rows on cards + dialog (CEO 2026-08-14:
   cards were too thin to decide on) */
.approval-facts { display: grid; gap: 4px; margin-top: 6px; }
.approval-facts:empty { display: none; }
.approval-facts .fact { display: grid; grid-template-columns: 34px 1fr; gap: 6px; padding: 4px 6px; border: 1px solid var(--line-soft); border-radius: 5px; background: rgba(0,0,0,.18); }
.approval-facts .fact span { color: var(--amber); font: 700 7px var(--font-mono); letter-spacing: .08em; padding-top: 1px; }
.approval-facts .fact p { margin: 0; color: var(--text-soft); font-size: 8px; line-height: 1.4; display: block; overflow: visible; -webkit-line-clamp: unset; -webkit-box-orient: unset; }
.usage-panel { display: grid; gap: 5px; }
.usage-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 7px; }
.usage-row span { color: var(--muted); font: 7px var(--font-mono); }
.usage-row strong { color: var(--text-soft); font: 9px var(--font-mono); text-align: right; }
.usage-panel footer { display: flex; align-items: center; gap: 6px; padding-top: 5px; border-top: 1px solid var(--line-soft); color: var(--muted); font: 7px var(--font-mono); }
.usage-panel footer strong { color: var(--cyan); font-weight: 500; }
.usage-panel footer strong#statLastTurn { margin-right: auto; }

.bottom-status { display: flex; align-items: center; gap: 24px; padding: 0 13px; border-top: 1px solid var(--line); background: rgba(2, 11, 16, .9); color: var(--muted); font: 8px/1 var(--font-mono); letter-spacing: .04em; }
.bottom-status strong { color: var(--text-soft); font-weight: 500; }
.bottom-status .right { margin-left: auto; }
html[data-theme="white-silicon"] .bottom-status { background: rgba(241, 251, 248, .9); }

/* ── Dialogs ───────────────────────────────────────────── */
.approval-dialog { width: min(660px, 72vw); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); color: var(--text); background: var(--surface-strong); box-shadow: 0 40px 100px rgba(0,0,0,.6), 0 0 60px rgba(81,241,232,.12); }
.approval-dialog::backdrop { background: rgba(1,7,11,.78); backdrop-filter: blur(8px); }
.approval-dialog form { margin: 0; }
.approval-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(255,200,94,.08), transparent); }
.approval-dialog header span { color: var(--amber); font: 8px var(--font-mono); letter-spacing: .12em; }
.approval-dialog h2 { margin: 5px 0 0; font-size: 17px; font-weight: 500; }
.dialog-body { padding: 16px 17px; }
.decision-summary { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: start; }
.severity-tag { padding: 5px 7px; border: 1px solid var(--amber); border-radius: 4px; color: var(--amber); font: 600 8px var(--font-mono); text-align: center; text-transform: uppercase; }
.severity-tag.sev-critical, .severity-tag.sev-high { border-color: var(--red); color: var(--red); }
.severity-tag.sev-low { border-color: var(--green); color: var(--green); }
.decision-summary p { margin: 0; color: var(--text-soft); font-size: 11px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.decision-facts { display: grid; gap: 6px; margin: 12px 0 0; }
.decision-facts .fact { display: grid; grid-template-columns: 52px 1fr; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,.18); }
.decision-facts .fact span { color: var(--amber); font: 700 8px var(--font-mono); letter-spacing: .08em; padding-top: 2px; }
.decision-facts .fact p { margin: 0; color: var(--text-soft); font-size: 10px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.decision-evidence { margin: 12px 0 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,.14); }
.decision-evidence span { color: var(--cyan); font: 700 8px var(--font-mono); letter-spacing: .1em; }
.decision-evidence ul { margin: 6px 0 0; padding-left: 16px; color: var(--text-soft); font-size: 10px; line-height: 1.55; }
.decision-outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.decision-outcomes .outcome { padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); }
.decision-outcomes .outcome span { display: block; margin-bottom: 4px; font: 700 8px var(--font-mono); letter-spacing: .1em; }
.decision-outcomes .outcome p { margin: 0; color: var(--text-soft); font-size: 10px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.decision-outcomes .outcome.approve { border-color: rgba(0,212,170,.4); background: rgba(0,212,170,.06); }
.decision-outcomes .outcome.approve span { color: var(--green); }
.decision-outcomes .outcome.reject { border-color: rgba(255,42,60,.35); background: rgba(255,42,60,.05); }
.decision-outcomes .outcome.reject span { color: var(--red); }
.raw-meta { margin: 12px 0 0; }
.raw-meta summary { cursor: pointer; color: var(--muted); font: 700 8px var(--font-mono); letter-spacing: .1em; }
.raw-meta summary:hover { color: var(--text-soft); }
.raw-meta pre { margin: 8px 0 0; }
.approval-dialog pre { margin: 12px 0; padding: 10px; overflow: auto; max-height: 220px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,.28); color: var(--green); font: 9px/1.5 var(--font-mono); white-space: pre-wrap; }
html[data-theme="white-silicon"] .approval-dialog pre { background: rgba(4,125,121,.05); }
.decision-note { display: grid; gap: 6px; color: var(--muted); font: 8px var(--font-mono); }
.decision-note textarea, .decision-note input { min-height: 60px; resize: vertical; padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: rgba(0,0,0,.18); font: 11px/1.5 var(--font-sans); }
.decision-note input { min-height: 0; height: 34px; resize: none; }
html[data-theme="white-silicon"] .decision-note textarea, html[data-theme="white-silicon"] .decision-note input { background: rgba(255,255,255,.5); }
.approval-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 17px; border-top: 1px solid var(--line); }
.approval-dialog footer button { min-height: 32px; padding: 0 13px; border-radius: 6px; cursor: pointer; font: 700 8px var(--font-mono); letter-spacing: .06em; }
.dialog-deny { border: 1px solid var(--line); color: var(--muted); background: transparent; }
.dialog-deny:hover { color: var(--red); border-color: var(--red); }
.dialog-secondary { border: 1px solid var(--line-strong); color: var(--cyan); background: transparent; }
.dialog-secondary:hover { background: rgba(81,241,232,.08); }
.dialog-approve { border: 1px solid var(--cyan); color: #02161a; background: linear-gradient(110deg, var(--cyan), #8ffaf2); }
.dialog-approve:hover { filter: brightness(1.1); }
.session-dialog header { background: linear-gradient(90deg, rgba(81,241,232,.08), transparent); }
.session-dialog header span { color: var(--cyan); }
.session-dialog .dialog-body { display: grid; gap: 12px; }

.toast { position: fixed; z-index: 200; left: 50%; bottom: 45px; min-width: 260px; max-width: 520px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--text); background: var(--surface-strong); box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 20px var(--glow); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; transition: .22s ease; text-align: center; font-size: 10px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.focus-mode .left-deck { display: none; }
body.focus-mode .workspace-grid { grid-template-columns: minmax(700px, 1fr) 330px; }
body.focus-mode .system-spine { opacity: .6; }
body.voice-active .holo-core { filter: drop-shadow(0 0 12px rgba(81,241,232,.25)); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes wave { 0%,100% { height: 4px; } 50% { height: 18px; } }
@keyframes chamberSweep { 0%, 100% { transform: translateX(-60%); } 50% { transform: translateX(60%); } }
@keyframes orbitA { to { transform: rotateX(64deg) rotateZ(360deg); } }
@keyframes orbitB { to { transform: rotateY(56deg) rotateZ(-360deg); } }
@keyframes orbitC { to { transform: rotateX(73deg) rotateY(30deg) rotateZ(360deg); } }

@media (max-width: 1380px) {
  .topbar { grid-template-columns: 270px minmax(500px, 1fr) 130px; }
  .workspace-grid { grid-template-columns: 235px minmax(580px, 1fr) 290px; }
  .system-spine .spine-node:nth-child(4) { display: none; }
  .system-spine { grid-template-columns: repeat(3, 1fr); }
}

@media (max-height: 850px) {
  .relay-shell { grid-template-rows: 60px 28px minmax(0,1fr) 25px; }
  .signal-chamber { height: 78px; }
  .left-deck { padding-top: 9px; }
  .quick-directives button:nth-of-type(n+4) { display: none; }
  .activity-event { min-height: 39px; }
}

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


/* ════════════════════════════════════════════════════════════════════════
   IDE SHELL v2.4.0 — activity rail, side panel, views, terminal drawer.
   Extends the dark-grid ramp above; same tokens, same accent family.
   ════════════════════════════════════════════════════════════════════════ */

.relay-shell { grid-template-rows: 66px 32px minmax(0, 1fr) auto 28px; grid-template-columns: minmax(0, 1fr); }

.ide-workspace {
  display: flex;
  min-height: 0;
  min-width: 0;
  gap: 8px;
  padding: 8px;
}

/* ── Activity rail ─────────────────────────────────────────────────────── */
.activity-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 56px;
  flex: 0 0 56px;
  padding: 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(9, 38, 47, .5), rgba(4, 20, 28, .82));
  backdrop-filter: blur(15px) saturate(125%);
}
.activity-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: .18s ease;
}
.activity-button svg { width: 18px; height: 18px; }
.activity-button:hover { color: var(--cyan-soft); background: var(--surface-hover); }
.activity-button.active {
  color: var(--cyan);
  border-color: var(--line-strong);
  background: linear-gradient(145deg, rgba(81, 241, 232, .14), rgba(9, 38, 47, .5));
  box-shadow: inset 2px 0 0 var(--cyan), 0 0 16px rgba(81, 241, 232, .1);
}
.activity-button.armed { color: var(--green); }
.activity-spacer { flex: 1; }
.activity-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  place-items: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  color: #160d00;
  background: var(--amber);
  font: 700 8px/1 var(--font-mono);
  box-shadow: 0 0 10px rgba(255, 200, 94, .4);
}

/* ── Side panel ────────────────────────────────────────────────────────── */
.side-panel {
  display: flex;
  flex-direction: column;
  width: 280px;
  flex: 0 0 280px;
  min-height: 0;
  overflow: hidden;
  transition: margin-left .25s ease, opacity .25s ease;
}
.relay-shell.panel-collapsed .side-panel { display: none; }
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 8px 9px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.side-head > span { color: var(--muted); font: 600 8px/1 var(--font-mono); letter-spacing: .2em; }
.side-collapse {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.side-collapse:hover { color: var(--cyan); border-color: var(--cyan); }
.side-collapse svg { width: 13px; height: 13px; }
.side-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
}
.side-body::-webkit-scrollbar { width: 5px; }
.side-body::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }

/* ── Main area ─────────────────────────────────────────────────────────── */
.main-area { flex: 1; min-width: 0; min-height: 0; display: flex; }
.view-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.view-main.hidden { display: none; }

.center-deck { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-rows: 90px auto minmax(0, 1fr) auto; gap: 8px; }

/* ── Right deck (telemetry) ────────────────────────────────────────────── */
.right-deck {
  width: 300px;
  flex: 0 0 300px;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(190px, 1.25fr) auto minmax(110px, auto) auto;
  gap: 8px;
  transition: margin-right .25s ease, opacity .25s ease;
}
.relay-shell.deck-collapsed .right-deck { display: none; }

/* ── Focus mode (IDE adaptation) ───────────────────────────────────────── */
body.focus-mode .side-panel { display: none; }
body.focus-mode .activity-bar { display: none; }
body.focus-mode .ide-workspace { padding-left: 8px; }

/* ── Chat toolbar + conversation search ────────────────────────────────── */
.chat-toolbar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
}
.chat-search {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
}
.chat-search svg { width: 14px; height: 14px; color: var(--muted); flex: 0 0 auto; }
.chat-search input {
  flex: 1;
  min-width: 0;
  height: 24px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: 11px var(--font-mono);
}
.chat-search input::placeholder { color: var(--muted); }
.search-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
}
.search-clear:hover { color: var(--red); }
.chat-search-meta { color: var(--faint); font: 8px/1 var(--font-mono); white-space: nowrap; }
.search-results {
  position: absolute;
  z-index: 60;
  top: calc(100% + 5px);
  left: 8px;
  right: 8px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 24px var(--glow);
  backdrop-filter: blur(18px);
}
.search-hit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .14s ease;
}
.search-hit:hover { background: var(--surface-hover); }
.search-hit:last-child { border-bottom: 0; }
.search-hit .hit-session { color: var(--cyan); font: 600 8px/1.3 var(--font-mono); letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit .hit-time { color: var(--faint); font: 8px/1.3 var(--font-mono); }
.search-hit .hit-snippet {
  grid-column: 1 / 3;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-hit .hit-snippet mark { color: var(--cyan); background: rgba(81, 241, 232, .12); border-radius: 2px; padding: 0 1px; }
.search-hit .hit-role { color: var(--amber); font: 600 7px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.message.search-flash .message-card { animation: searchFlash 2.4s ease; }
@keyframes searchFlash {
  0%, 60% { box-shadow: 0 0 0 1px var(--amber), 0 0 26px rgba(255, 200, 94, .35); }
  100% { box-shadow: 0 10px 30px -24px var(--shadow); }
}

/* ── Inline attachments in chat ────────────────────────────────────────── */
.attachment-gallery { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.attachment-image {
  position: relative;
  max-width: 260px;
  max-height: 190px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-deep);
  transition: .18s ease;
}
.attachment-image:hover { border-color: var(--cyan); box-shadow: 0 0 18px var(--glow); }
.attachment-image img { display: block; max-width: 260px; max-height: 190px; object-fit: contain; }
.attachment-file {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 240px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  background: var(--surface-soft);
  font: 8px var(--font-mono);
  text-decoration: none;
  transition: .15s ease;
}
.attachment-file:hover { border-color: var(--cyan); color: var(--cyan); }
.attachment-file svg { width: 12px; flex: 0 0 auto; }
.attachment-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Lightbox ──────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  background: rgba(1, 7, 11, .9);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 160px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), 0 0 60px var(--glow);
  object-fit: contain;
}
.lightbox-caption { color: var(--text-soft); font: 10px var(--font-mono); letter-spacing: .04em; text-align: center; }
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
}
.lightbox-close:hover { color: var(--red); border-color: var(--red); }

/* ── Shared IDE view chrome ────────────────────────────────────────────── */
.ide-pane { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ide-pane-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.ide-pane-scroll::-webkit-scrollbar { width: 5px; }
.ide-pane-scroll::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.ide-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  min-height: 40px;
}
.ide-toolbar .toolbar-title { color: var(--cyan-soft); font: 600 10px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.ide-toolbar .toolbar-sub { color: var(--muted); font: 8px/1 var(--font-mono); }
.ide-toolbar .spacer { flex: 1; }
.ide-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-soft);
  background: var(--surface-soft);
  cursor: pointer;
  font: 600 8px/1 var(--font-mono);
  letter-spacing: .07em;
  transition: .15s ease;
}
.ide-button svg { width: 12px; height: 12px; }
.ide-button:hover { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 12px var(--glow); }
.ide-button.primary { color: #02161a; border-color: var(--cyan); background: linear-gradient(110deg, var(--cyan), #8ffaf2); }
html[data-theme="white-silicon"] .ide-button.primary { color: #fff; background: linear-gradient(110deg, #03655f, #0a9790); }
.ide-button.primary:hover { filter: brightness(1.08); color: #02161a; }
html[data-theme="white-silicon"] .ide-button.primary:hover { color: #fff; }
.ide-button.danger:hover { color: var(--red); border-color: var(--red); box-shadow: 0 0 12px rgba(255, 88, 104, .2); }
.ide-button.active { color: var(--cyan); border-color: var(--line-strong); background: rgba(81, 241, 232, .1); }
.ide-button:disabled { opacity: .45; cursor: not-allowed; }

.ide-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 26px auto;
  max-width: 420px;
  padding: 30px 26px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.ide-empty svg { width: 26px; height: 26px; color: var(--faint); }
.ide-empty strong { color: var(--text-soft); font: 600 10px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.ide-empty p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.ide-empty code { color: var(--cyan); font: 9px var(--font-mono); }
.ide-empty.error { border-color: rgba(255, 88, 104, .35); }
.ide-empty.error svg { color: var(--red); }
.ide-empty.error strong { color: var(--red); }

.ide-loading { display: grid; gap: 9px; padding: 22px; }
.ide-loading i {
  display: block;
  height: 12px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-hover) 50%, var(--surface-soft) 75%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
.ide-loading i:nth-child(2) { width: 82%; }
.ide-loading i:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -220% 0; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  font: 600 7px/1.4 var(--font-mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.chip.cyan { color: var(--cyan); border-color: rgba(81, 241, 232, .4); }
.chip.green { color: var(--green); border-color: rgba(76, 240, 141, .4); }
.chip.amber { color: var(--amber); border-color: rgba(255, 200, 94, .4); }
.chip.red { color: var(--red); border-color: rgba(255, 88, 104, .4); }
.chip.violet { color: var(--violet); border-color: rgba(184, 164, 255, .4); }
.chip.faint { color: var(--faint); }

.side-filter-row { display: flex; gap: 5px; flex-wrap: wrap; padding: 2px 0 9px; }
.side-filter {
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 600 7px/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.side-filter:hover { color: var(--text); border-color: var(--line); }
.side-filter.active { color: var(--cyan); border-color: var(--cyan); background: rgba(81, 241, 232, .08); }
.side-input {
  width: 100%;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--text);
  background: rgba(0, 0, 0, .18);
  font: 10px var(--font-mono);
  outline: none;
}
html[data-theme="white-silicon"] .side-input { background: rgba(255, 255, 255, .5); }
.side-input:focus { border-color: var(--cyan); }
.side-input::placeholder { color: var(--faint); }
select.side-input { appearance: none; cursor: pointer; }
.side-note { color: var(--faint); font: 8px/1.5 var(--font-mono); padding: 6px 2px; }

/* ══ FILES VIEW ══════════════════════════════════════════════════════════ */
.files-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.file-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}
.file-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 200px;
  padding: 7px 8px 7px 11px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 9px var(--font-mono);
  white-space: nowrap;
}
.file-tab svg { width: 11px; height: 11px; flex: 0 0 auto; }
.file-tab:hover { color: var(--text); }
.file-tab.active {
  color: var(--cyan);
  border-color: var(--line);
  background: var(--surface-strong);
  box-shadow: inset 0 2px 0 var(--cyan);
}
.file-tab .tab-close {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 0;
  border-radius: 4px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}
.file-tab .tab-close:hover { color: var(--red); background: rgba(255, 88, 104, .12); }
.file-tab span { overflow: hidden; text-overflow: ellipsis; }
.files-body { flex: 1; min-height: 0; display: flex; gap: 8px; }
.editor-surface {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.editor-surface.standalone { border-radius: var(--radius); border-top: 1px solid var(--line); }
.editor-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font: 8px/1 var(--font-mono);
}
.editor-meta strong { color: var(--text-soft); font-weight: 500; }
.editor-meta .spacer { flex: 1; }
.code-scroll { flex: 1; min-height: 0; overflow: auto; }
.code-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.code-scroll::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.code-view { margin: 0; padding: 10px 0 16px; font: 11px/1.55 var(--font-mono); }
.code-line { display: flex; min-width: max-content; }
.code-line:hover { background: var(--surface-hover); }
.code-line .ln {
  flex: 0 0 auto;
  width: 52px;
  padding-right: 14px;
  color: var(--faint);
  text-align: right;
  user-select: none;
}
.code-line .lc { flex: 1; padding-right: 18px; white-space: pre; color: var(--text-soft); }
.tk-kw { color: var(--cyan); }
.tk-str { color: var(--green); }
.tk-com { color: var(--faint); font-style: italic; }
.tk-num { color: var(--amber); }
.tk-tag { color: var(--violet); }
.tk-attr { color: var(--cyan-soft); }
.tk-key { color: var(--cyan-soft); }
.tk-op { color: var(--red); }
.editor-image { flex: 1; min-height: 0; display: grid; place-items: center; padding: 18px; overflow: auto; }
.editor-image img { max-width: 100%; max-height: 100%; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; box-shadow: 0 18px 50px rgba(0, 0, 0, .4); }

.git-panel {
  width: 330px;
  flex: 0 0 330px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.git-tabs { display: flex; gap: 4px; padding: 8px 8px 0; }
.git-tabs .ide-button { flex: 1; justify-content: center; }
.git-content { flex: 1; min-height: 0; overflow-y: auto; padding: 9px; }
.git-content::-webkit-scrollbar { width: 5px; }
.git-content::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.git-commit { display: grid; gap: 3px; padding: 7px 8px; border-bottom: 1px solid var(--line-soft); }
.git-commit .gc-head { display: flex; align-items: center; gap: 7px; }
.git-commit .gc-hash { color: var(--amber); font: 600 8px var(--font-mono); }
.git-commit .gc-ago { margin-left: auto; color: var(--faint); font: 7px var(--font-mono); }
.git-commit .gc-subject { color: var(--text); font-size: 9px; line-height: 1.4; }
.git-commit .gc-author { color: var(--muted); font: 7px var(--font-mono); }
.git-status-row { display: flex; align-items: center; gap: 8px; padding: 5px 7px; border-bottom: 1px solid var(--line-soft); font: 8px var(--font-mono); }
.git-status-row .gs-code { flex: 0 0 22px; text-align: center; font-weight: 700; }
.git-status-row .gs-code.modified { color: var(--amber); }
.git-status-row .gs-code.added { color: var(--green); }
.git-status-row .gs-code.deleted { color: var(--red); }
.git-status-row .gs-code.untracked { color: var(--cyan); }
.git-status-row .gs-path { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.git-diff { margin: 0; padding: 8px; font: 9px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-all; }
.git-diff .diff-add { color: var(--green); }
.git-diff .diff-del { color: var(--red); }
.git-diff .diff-hunk { color: var(--cyan); }
.git-diff .diff-meta { color: var(--faint); }
.git-repo-line { display: flex; align-items: center; gap: 7px; padding: 7px 8px 9px; color: var(--muted); font: 8px var(--font-mono); border-bottom: 1px solid var(--line-soft); }
.git-repo-line strong { color: var(--cyan); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fs-tree { display: grid; gap: 1px; padding: 2px 0; }
.fs-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 24px;
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  color: var(--text-soft);
  background: transparent;
  cursor: pointer;
  font: 9px var(--font-mono);
  text-align: left;
}
.fs-row:hover { background: var(--surface-hover); color: var(--text); }
.fs-row.active { color: var(--cyan); background: rgba(81, 241, 232, .08); }
.fs-row .fs-twisty { flex: 0 0 10px; width: 10px; color: var(--faint); transition: transform .15s ease; }
.fs-row .fs-twisty svg { width: 9px; height: 9px; }
.fs-row.open .fs-twisty { transform: rotate(90deg); }
.fs-row > svg.fs-kind { flex: 0 0 12px; width: 12px; height: 12px; color: var(--muted); }
.fs-row.dir > svg.fs-kind { color: var(--cyan); }
.fs-row .fs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-row .fs-size { margin-left: auto; color: var(--faint); font-size: 7px; }
.fs-children { margin-left: 12px; border-left: 1px solid var(--line-soft); padding-left: 4px; }
.fs-search-results { display: grid; gap: 1px; }
.fs-search-note { padding: 6px 2px; color: var(--faint); font: 8px/1.4 var(--font-mono); }

/* ══ DIRECTIVES VIEW ═════════════════════════════════════════════════════ */
.kanban { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 8px; overflow-x: auto; }
.kanban-col { min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.kanban-col-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-soft);
  font: 600 8px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.kanban-col-head i { width: 7px; height: 7px; border-radius: 50%; }
.kanban-col-head .col-count { margin-left: auto; color: var(--faint); }
.kanban-col[data-status="open"] .kanban-col-head i { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.kanban-col[data-status="dispatched"] .kanban-col-head i { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
.kanban-col[data-status="in_progress"] .kanban-col-head i { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.4s infinite; }
.kanban-col[data-status="blocked"] .kanban-col-head i { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.kanban-col[data-status="done"] .kanban-col-head i { background: var(--faint); }
.kanban-cards { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: grid; gap: 7px; align-content: start; }
.kanban-cards::-webkit-scrollbar { width: 5px; }
.kanban-cards::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.kanban-empty { padding: 12px 6px; color: var(--faint); font: 8px/1.5 var(--font-mono); text-align: center; }
.directive-card {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .015), transparent 50%), var(--surface-soft);
  transition: .16s ease;
}
.directive-card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: 0 10px 24px -18px var(--shadow); }
.directive-card .dc-head { display: flex; align-items: flex-start; gap: 7px; }
.directive-card h4 { flex: 1; margin: 0; color: var(--text); font-size: 10px; font-weight: 600; line-height: 1.4; }
.directive-card .dc-body { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.directive-card .dc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.directive-card .dc-age { margin-left: auto; color: var(--faint); font: 7px var(--font-mono); }
.directive-card .dc-actions { display: flex; gap: 5px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.directive-card .dc-actions .ide-button { min-height: 22px; padding: 0 8px; font-size: 7px; }
.priority-chip { padding: 2px 6px; border-radius: 8px; font: 700 7px/1.5 var(--font-mono); letter-spacing: .07em; text-transform: uppercase; }
.priority-chip.low { color: var(--faint); border: 1px solid var(--line-soft); }
.priority-chip.normal { color: var(--cyan); border: 1px solid rgba(81, 241, 232, .35); }
.priority-chip.high { color: var(--amber); border: 1px solid rgba(255, 200, 94, .4); }
.priority-chip.critical { color: var(--red); border: 1px solid rgba(255, 88, 104, .45); box-shadow: 0 0 10px rgba(255, 88, 104, .12); }
.priority-picker { display: flex; gap: 5px; }
.priority-picker button {
  flex: 1;
  min-height: 27px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 600 8px var(--font-mono);
  letter-spacing: .06em;
}
.priority-picker button.active[data-priority="low"] { color: var(--text-soft); border-color: var(--line-strong); }
.priority-picker button.active[data-priority="normal"] { color: var(--cyan); border-color: var(--cyan); background: rgba(81, 241, 232, .08); }
.priority-picker button.active[data-priority="high"] { color: var(--amber); border-color: var(--amber); background: rgba(255, 200, 94, .08); }
.priority-picker button.active[data-priority="critical"] { color: var(--red); border-color: var(--red); background: rgba(255, 88, 104, .08); }
.decision-note select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(0, 0, 0, .18);
  font: 10px var(--font-sans);
}
html[data-theme="white-silicon"] .decision-note select { background: rgba(255, 255, 255, .5); }

/* ══ REPORTS / DASHBOARD shared ══════════════════════════════════════════ */
.report-tabs { display: flex; gap: 5px; padding: 8px 10px 0; }
.report-tabs .ide-button { border-radius: 6px 6px 0 0; border-bottom-color: transparent; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; padding: 10px; }
.stat-card {
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(81, 241, 232, .045), transparent 55%), var(--surface);
}
.stat-card span { color: var(--muted); font: 600 7px/1 var(--font-mono); letter-spacing: .13em; text-transform: uppercase; }
.stat-card strong { color: var(--cyan-soft); font: 500 20px/1 var(--font-mono); }
.stat-card small { color: var(--faint); font: 7px var(--font-mono); }
.stat-card.accent strong { color: var(--cyan); }
.stat-card.warn strong { color: var(--amber); }
.stat-card.good strong { color: var(--green); }
.report-section { margin: 0 10px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.report-section > header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
}
.report-section > header strong { color: var(--text); font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.report-section > header span { color: var(--faint); font: 7px var(--font-mono); letter-spacing: .1em; }
.report-section > header .spacer { flex: 1; }
.report-table { width: 100%; border-collapse: collapse; }
.report-table th {
  padding: 7px 11px;
  color: var(--muted);
  font: 600 7px/1 var(--font-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.report-table td { padding: 7px 11px; color: var(--text-soft); font-size: 9px; border-bottom: 1px solid var(--line-soft); }
.report-table tr:last-child td { border-bottom: 0; }
.report-table tbody tr { cursor: pointer; transition: background .13s ease; }
.report-table tbody tr:hover { background: var(--surface-hover); }
.report-table td.mono { font-family: var(--font-mono); font-size: 8px; }
.progress-track { position: relative; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, .3); overflow: hidden; }
html[data-theme="white-silicon"] .progress-track { background: rgba(4, 125, 121, .1); }
.progress-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: linear-gradient(90deg, var(--cyan), var(--cyan-soft)); box-shadow: 0 0 10px var(--glow); }
.feed-list { display: grid; }
.feed-row { display: grid; grid-template-columns: 74px 1fr; gap: 9px; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.feed-row:last-child { border-bottom: 0; }
.feed-row time { color: var(--faint); font: 7px/1.5 var(--font-mono); text-align: right; padding-top: 2px; }
.feed-row .feed-body { min-width: 0; display: grid; gap: 3px; }
.feed-row .feed-title { color: var(--text); font-size: 9px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .feed-detail { margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bar-rows { display: grid; gap: 7px; padding: 11px 13px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 40px; align-items: center; gap: 10px; }
.bar-row > span { color: var(--text-soft); font: 8px var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row > strong { color: var(--cyan); font: 8px var(--font-mono); text-align: right; }
.status-chip-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 11px 13px; }

/* ══ GALLERY VIEW ════════════════════════════════════════════════════════ */
/* CEO 2026-08-13: big readable previews, grouped by project — never a
 * sandwich of mixed projects. The outer column stacks project sections; the
 * inner grid holds large 16:10 cards. */
.gallery-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px;
  align-content: start;
}
.gallery-grid::-webkit-scrollbar { width: 5px; }
.gallery-grid::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.gallery-project { display: flex; flex-direction: column; gap: 8px; }
.gallery-project-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(81, 241, 232, .07), transparent 55%), var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease;
}
.gallery-project-head:hover { border-color: var(--line-strong); }
.gallery-project-head strong {
  color: var(--text);
  font: 700 11px var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.gallery-project-head .gp-stats { color: var(--muted); font: 8px var(--font-mono); }
.gallery-project-head .collapse-caret { width: 12px; height: 12px; color: var(--cyan); transition: transform .18s ease; transform: rotate(90deg); }
.gallery-project.collapsed .collapse-caret { transform: rotate(0deg); }
.gallery-project.collapsed .gallery-project-grid { display: none; }
.gallery-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.concept-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: .18s ease;
}
.concept-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 16px 40px -22px var(--shadow), 0 0 22px rgba(81, 241, 232, .06); }
.concept-card.selected-badge { border-color: var(--green); box-shadow: 0 0 20px rgba(76, 240, 141, .12); }
.concept-card.compare-picked { border-color: var(--amber); box-shadow: 0 0 18px rgba(255, 200, 94, .18); }
.concept-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--bg-deep); overflow: hidden; }
.concept-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.concept-card:hover .concept-thumb img { transform: scale(1.03); }
.concept-thumb .thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font: 8px var(--font-mono); }
.concept-selected-tag {
  position: absolute;
  top: 7px;
  right: 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 8px;
  color: #06130a;
  background: var(--green);
  font: 700 7px/1 var(--font-mono);
  letter-spacing: .06em;
  box-shadow: 0 0 14px rgba(76, 240, 141, .4);
}
.concept-selected-tag svg { width: 9px; height: 9px; }
.concept-compare-check {
  position: absolute;
  top: 7px;
  left: 7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: transparent;
  background: rgba(1, 7, 11, .65);
  font-size: 11px;
}
.concept-card.compare-picked .concept-compare-check { color: #160d00; background: var(--amber); border-color: var(--amber); }
.concept-info { display: grid; gap: 5px; padding: 9px 10px 10px; min-width: 0; }
.concept-info .ci-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.concept-info .ci-direction { flex: 1; min-width: 0; color: var(--text); font-size: 9px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concept-info .ci-meta { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--faint); font: 7px var(--font-mono); }
.concept-info .ci-meta .spacer { flex: 1; }
.rating-chip { padding: 2px 6px; border-radius: 8px; font: 700 7px/1.5 var(--font-mono); }
.rating-chip.good { color: var(--green); border: 1px solid rgba(76, 240, 141, .4); }
.rating-chip.mid { color: var(--amber); border: 1px solid rgba(255, 200, 94, .4); }
.rating-chip.low { color: var(--red); border: 1px solid rgba(255, 88, 104, .4); }
.rating-chip.none { color: var(--faint); border: 1px solid var(--line-soft); }
.compare-tray {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(255, 200, 94, .1), transparent 60%), var(--surface);
}
.compare-tray strong { color: var(--amber); font: 600 8px var(--font-mono); letter-spacing: .1em; }
.compare-tray span { color: var(--text-soft); font: 8px var(--font-mono); }
.compare-tray .spacer { flex: 1; }
.compare-stage { flex: 1; min-height: 0; overflow: auto; display: grid; gap: 10px; padding: 10px; grid-auto-flow: column; grid-auto-columns: minmax(300px, 1fr); align-content: start; }
.compare-cell { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.compare-cell img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--bg-deep); cursor: zoom-in; }
.compare-cell .cc-body { display: grid; gap: 8px; padding: 10px 12px 12px; }
.compare-cell .cc-row { display: grid; gap: 3px; }
.compare-cell .cc-row > span { color: var(--muted); font: 600 7px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.compare-cell .cc-row > p { margin: 0; color: var(--text-soft); font-size: 9px; line-height: 1.5; max-height: 72px; overflow-y: auto; }
.compare-cell .cc-facts { display: flex; flex-wrap: wrap; gap: 6px; }

/* ══ DASHBOARD VIEW ══════════════════════════════════════════════════════ */
.dash-hero { display: grid; grid-template-columns: minmax(300px, 1.2fr) repeat(3, minmax(140px, .6fr)); gap: 8px; padding: 10px 10px 0; }
.dash-position {
  display: grid;
  gap: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(140deg, rgba(81, 241, 232, .09), transparent 60%), var(--surface);
  box-shadow: 0 0 26px rgba(81, 241, 232, .05);
}
.dash-position .dp-label { color: var(--muted); font: 600 7px/1 var(--font-mono); letter-spacing: .14em; }
.dash-position .dp-stage { color: var(--cyan-soft); font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.dash-position .dp-sub { color: var(--text-soft); font: 8px var(--font-mono); }
.concept-strip { display: flex; gap: 8px; overflow-x: auto; padding: 11px 13px; }
.concept-strip::-webkit-scrollbar { height: 5px; }
.concept-strip::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.concept-strip .strip-item {
  position: relative;
  flex: 0 0 148px;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-deep);
}
.concept-strip .strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.concept-strip .strip-item .strip-tag {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 7px;
  color: var(--text-soft);
  background: linear-gradient(transparent, rgba(1, 7, 11, .88));
  font: 7px var(--font-mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.work-item-row { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.work-item-row:last-child { border-bottom: 0; }
.work-item-row .wi-key { color: var(--amber); font: 700 8px var(--font-mono); }
.work-item-row .wi-title { color: var(--text-soft); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-item-row .wi-state { font: 600 7px var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }

/* ══ TERMINAL DRAWER ════════════════════════════════════════════════════ */
.terminal-drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 40vh;
  min-height: 140px;
  max-height: 78vh;
  margin: 0 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(2, 10, 14, .96);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .4);
  overflow: hidden;
}
.terminal-drawer.hidden { display: none; }
.terminal-grip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  cursor: ns-resize;
  z-index: 5;
}
.terminal-grip::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 50%;
  width: 46px;
  height: 3px;
  margin-left: -23px;
  border-radius: 2px;
  background: var(--line-strong);
  opacity: .5;
}
.terminal-grip:hover::after { opacity: 1; background: var(--cyan); }
.terminal-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px 7px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}
.terminal-head > svg { width: 14px; height: 14px; color: var(--cyan); }
.terminal-title { color: var(--cyan-soft); font: 600 8px/1 var(--font-mono); letter-spacing: .16em; }
.terminal-state { font: 600 7px/1 var(--font-mono); letter-spacing: .1em; color: var(--faint); }
.terminal-state.live { color: var(--green); }
.terminal-state.dead { color: var(--red); }
.terminal-geo { color: var(--faint); font: 7px/1 var(--font-mono); }
.terminal-head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.terminal-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 21px;
  padding: 0 8px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 600 7px/1 var(--font-mono);
  letter-spacing: .07em;
}
.terminal-action:hover { color: var(--cyan); border-color: var(--cyan); }
.terminal-action svg { width: 11px; height: 11px; }
.terminal-screen {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px;
  font: 11px/1.45 var(--font-mono);
  color: #a9ced0;
  background: #01070b;
  cursor: text;
  white-space: pre;
}
.terminal-screen::-webkit-scrollbar { width: 6px; }
.terminal-screen::-webkit-scrollbar-thumb { border-radius: 8px; background: var(--line-strong); }
.terminal-screen:focus { outline: none; }
.terminal-screen .t-line { min-height: 1.45em; }
.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-top: 1px solid var(--line-soft);
  background: rgba(4, 20, 28, .7);
}
.terminal-prompt { color: var(--cyan); font: 700 12px/1 var(--font-mono); }
.terminal-input-row input {
  flex: 1;
  height: 25px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: 11px var(--font-mono);
}
.terminal-input-row input::placeholder { color: var(--faint); }
.tf0 { color: #3d6469; } .tf1 { color: #ff5868; } .tf2 { color: #4cf08d; } .tf3 { color: #ffc85e; }
.tf4 { color: #5eb2ff; } .tf5 { color: #b8a4ff; } .tf6 { color: #51f1e8; } .tf7 { color: #a9ced0; }
.tf8 { color: #668f94; } .tf9 { color: #ff8b98; } .tf10 { color: #8cffb6; } .tf11 { color: #ffdc97; }
.tf12 { color: #93ccff; } .tf13 { color: #d5c6ff; } .tf14 { color: #8ffaf2; } .tf15 { color: #e9ffff; }
.tb0 { background: #14262b; } .tb1 { background: #5c1f26; } .tb2 { background: #17452c; } .tb3 { background: #54401a; }
.tb4 { background: #1d3a5c; } .tb5 { background: #3a2d5c; } .tb6 { background: #124540; } .tb7 { background: #33555a; }
.t-bold { font-weight: 700; }
.t-dim { opacity: .55; }
.t-uline { text-decoration: underline; }
.t-blink { animation: pulse 1s steps(2) infinite; }
.t-invert { color: #01070b; background: #a9ced0; }

/* ══ Confirm dialog ══════════════════════════════════════════════════════ */
.confirm-dialog { width: min(480px, 60vw); }
.confirm-dialog header { background: linear-gradient(90deg, rgba(81, 241, 232, .08), transparent); }
.confirm-dialog header span { color: var(--cyan); }
.confirm-text { margin: 0; color: var(--text-soft); font-size: 11px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

/* ══ Responsive ══════════════════════════════════════════════════════════ */
@media (max-width: 1380px) {
  .right-deck { width: 280px; flex-basis: 280px; }
  .git-panel { width: 300px; flex-basis: 300px; }
  .dash-hero { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1240px) {
  .side-panel {
    position: absolute;
    z-index: 40;
    top: 8px;
    bottom: 8px;
    left: 64px;
    box-shadow: 24px 0 60px rgba(0, 0, 0, .5);
  }
  .ide-workspace { position: relative; }
}
@media (max-height: 850px) {
  .terminal-drawer { height: 36vh; }
}

/* ══ WORK FEED (CEO 2026-08-13 — "see everything big or small") ════════════
 * The chat lane is a merged durable timeline: conversation bubbles PLUS every
 * tool call, result, plan update, reasoning pulse, and CLI observation. Newest
 * at the bottom; "load earlier" pages upward out of PostgreSQL. */

.load-earlier {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--cyan);
  font: 700 9px var(--font-mono);
  letter-spacing: .14em;
  cursor: pointer;
  transition: .15s ease;
}
.load-earlier:hover:not(:disabled) { background: rgba(81, 241, 232, .07); border-style: solid; }
.load-earlier:disabled { opacity: .55; cursor: wait; }

/* status chips — turn boundaries, approvals, lifecycle */
.feed-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 3px 42px 9px;
  padding: 5px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  background: rgba(1, 7, 11, .35);
  color: var(--muted);
  font: 8px/1.5 var(--font-mono);
}
.feed-chip svg { width: 11px; height: 11px; color: var(--faint); }
.feed-chip time { margin-left: auto; color: var(--faint); font-size: 7px; }
.feed-chip.active { border-color: rgba(81, 241, 232, .4); color: var(--cyan-soft); }
.feed-chip.active svg { color: var(--cyan); }
.feed-chip.done { border-color: rgba(76, 240, 141, .3); }
.feed-chip.done svg { color: var(--green); }
.feed-chip.failed { border-color: rgba(255, 88, 104, .45); color: var(--red); }
.feed-chip.failed svg { color: var(--red); }
.feed-chip-detail {
  flex-basis: 100%;
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* work cards — tool calls, results, plans, reasoning */
.work-event {
  display: grid;
  grid-template-columns: 44px 12px minmax(0, 1fr);
  gap: 7px;
  margin: 0 42px 10px 8px;
  align-items: start;
}
.work-event > time { padding-top: 3px; color: var(--faint); font: 7px/1 var(--font-mono); text-align: right; }
.work-event > i { width: 7px; height: 7px; margin-top: 4px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--bg); }
.work-event.active > i { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); animation: pulse 1.2s infinite; }
.work-event.done > i { background: var(--green); border-color: var(--green); box-shadow: 0 0 7px var(--green); }
.work-event.failed > i { background: var(--red); border-color: var(--red); box-shadow: 0 0 7px var(--red); }
.work-event.thought > i { background: var(--violet, #b48cff); border-color: var(--violet, #b48cff); }
.work-event.plan > i { background: var(--amber); border-color: var(--amber); }
.work-event .work-body {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(1, 7, 11, .3);
}
.work-event.failed .work-body { border-left-color: var(--red); }
.work-event.done .work-body { border-left-color: var(--green); }
.work-event.active .work-body { border-left-color: var(--cyan); }
.work-event.thought .work-body { border-left-color: var(--violet, #b48cff); }
.work-event.plan .work-body { border-left-color: var(--amber); }
.work-event .work-body > strong {
  display: block;
  color: var(--text);
  font: 600 9px/1.5 var(--font-mono);
  word-break: break-word;
}
.src-badge {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--amber);
  border-radius: 7px;
  color: var(--amber);
  font: 700 7px/1.4 var(--font-mono);
  letter-spacing: .1em;
  vertical-align: 1px;
}
.work-detail { margin-top: 5px; }
.work-detail summary {
  color: var(--faint);
  font: 700 7px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
}
.work-detail summary:hover { color: var(--cyan); }
.work-detail pre {
  margin: 6px 0 2px;
  padding: 8px 9px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(0, 0, 0, .3);
  color: var(--text-soft);
  font: 10px/1.5 var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
}
.work-event.thought .work-detail { margin-top: 0; }
.work-event.thought .work-detail pre { color: var(--muted); font-style: italic; }

.plan-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.plan-list li { color: var(--text-soft); font: 9px/1.45 var(--font-mono); }
.plan-list li b { color: var(--faint); margin-right: 4px; }
.plan-list li.plan-in_progress { color: var(--cyan-soft); }
.plan-list li.plan-in_progress b { color: var(--cyan); }
.plan-list li.plan-completed { color: var(--muted); text-decoration: line-through; }
.plan-list li.plan-completed b { color: var(--green); text-decoration: none; }

.cli-prompt .work-body { border-left-color: var(--amber); }
.cli-prompt .prompt-text { margin: 4px 0 0; color: var(--text); font-size: 10px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

/* ══ MARKDOWN IN CHAT (CEO 2026-08-13 — formatted, never raw md) ══════════ */
.msg-body.md { white-space: normal; }
.msg-body.md p { margin: 0 0 7px; }
.msg-body.md p:last-child { margin-bottom: 0; }
.msg-body.md h1, .msg-body.md h2, .msg-body.md h3, .msg-body.md h4 {
  margin: 10px 0 5px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}
.msg-body.md h1 { font-size: 15px; }
.msg-body.md h2 { font-size: 13.5px; }
.msg-body.md h3 { font-size: 12.5px; }
.msg-body.md h4 { font-size: 12px; }
.msg-body.md h1:first-child, .msg-body.md h2:first-child,
.msg-body.md h3:first-child, .msg-body.md h4:first-child { margin-top: 0; }
.msg-body.md ul, .msg-body.md ol { margin: 4px 0 8px; padding-left: 19px; }
.msg-body.md ul ul, .msg-body.md ul ol, .msg-body.md ol ul, .msg-body.md ol ol { margin: 2px 0; }
.msg-body.md li { margin: 2px 0; line-height: 1.5; }
.msg-body.md ul > li::marker { color: var(--cyan); }
.msg-body.md ol > li::marker { color: var(--cyan); font-family: var(--font-mono); font-size: 10px; }
.msg-body.md strong { color: var(--text); font-weight: 700; }
.msg-body.md em { color: var(--text); }
.msg-body.md del { color: var(--muted); }
.msg-body.md a { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.msg-body.md blockquote {
  margin: 6px 0 8px;
  padding: 5px 10px;
  border-left: 2px solid var(--cyan);
  background: rgba(81, 241, 232, .05);
  color: var(--text-soft);
}
.msg-body.md hr { margin: 10px 0; border: 0; border-top: 1px solid var(--line); }
.msg-body.md table {
  margin: 7px 0 9px;
  border-collapse: collapse;
  font-size: 11px;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}
.msg-body.md th, .msg-body.md td {
  padding: 4px 9px;
  border: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}
.msg-body.md th {
  background: rgba(81, 241, 232, .07);
  color: var(--cyan-soft);
  font: 700 9px var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
html[data-theme="white-silicon"] .work-event .work-body,
html[data-theme="white-silicon"] .feed-chip { background: rgba(4, 125, 121, .04); }

/* ── Phase 0 (CEO 2026-08-13): in-chat doc viewer, line comments, queue ── */

/* Doc-looking chat links open inside the relay — dashed underline signals
 * "internal" vs the solid underline of external target=_blank links. */
.msg-body.md a[data-doc-link] { text-decoration-style: dashed; }
.msg-body.md a[data-doc-link]:hover { color: var(--cyan-soft); }

/* Rendered markdown documents reuse the chat .msg-body.md styles inside a
 * roomier reading column; raw source stays one click away (SOURCE button). */
.doc-rendered {
  max-width: 880px;
  margin: 0 auto;
  padding: 22px 30px 60px;
  font-size: 12.5px;
}

/* Gutter affordance: line numbers are clickable comment anchors. */
.code-line .ln { cursor: pointer; }
.code-line .ln:hover { color: var(--cyan); }
.code-line .ln.has-comment.open { color: var(--cyan); text-shadow: 0 0 6px var(--glow); }
.code-line .ln.has-comment.open::after { content: ' ●'; font-size: 7px; }
.code-line .ln.has-comment.resolved { color: var(--faint); }
.code-line.composing { background: rgba(81, 241, 232, .07); }
.code-line.flash { animation: lineflash 1.8s ease-out; }
@keyframes lineflash {
  0% { background: rgba(81, 241, 232, .28); }
  100% { background: transparent; }
}

/* Inline annotation blocks + composer sit under their anchor line. They are
 * sticky-left so they stay reachable when code scrolls horizontally. */
.line-comment, .comment-composer {
  position: sticky;
  left: 12px;
  max-width: 720px;
  margin: 3px 0 3px 52px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--cyan);
  border-radius: 0 6px 6px 0;
  background: var(--surface-soft);
  white-space: normal;
  font: 10px/1.5 var(--font-mono);
}
.line-comment.resolved { opacity: .55; border-left-color: var(--faint); }
.lc-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.lc-head strong { color: var(--cyan); }
.lc-head .lc-lines { color: var(--text-soft); }
.lc-head .spacer { flex: 1; }
.lc-body { margin-top: 4px; color: var(--text); white-space: pre-wrap; word-break: break-word; font-size: 10.5px; }
.lc-action {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font: 10px/1 var(--font-mono);
  padding: 2px 6px;
}
.lc-action:hover { border-color: var(--line-strong); color: var(--cyan); }
.lc-action.danger:hover { color: var(--red); border-color: var(--red); }

.comment-composer textarea {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-deep);
  color: var(--text);
  font: 10.5px/1.5 var(--font-mono);
  resize: vertical;
}
.comment-composer textarea:focus { outline: none; border-color: var(--line-strong); }
.cc-head { display: flex; align-items: center; color: var(--cyan); font-size: 8px; letter-spacing: .08em; }
.cc-head .spacer { flex: 1; }
.cc-actions { display: flex; gap: 6px; margin-top: 6px; }

/* Comments side strip — same surface language as the git panel. */
.comments-strip {
  width: 320px;
  flex: 0 0 320px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.cs-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font: 8px/1 var(--font-mono);
  letter-spacing: .08em;
}
.cs-head strong { color: var(--cyan); }
.cs-head .spacer { flex: 1; }
.cs-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.cs-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  text-align: left;
}
.cs-row:hover { border-color: var(--line-strong); }
.cs-row.resolved { opacity: .5; }
.cs-loc { color: var(--cyan); font: 8px var(--font-mono); }
.cs-body { font-size: 10px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.cs-meta { color: var(--faint); font: 7.5px var(--font-mono); }

/* Comments toggle badge in the editor meta bar. */
[data-comments-toggle].has-open .cc-count { color: var(--cyan); font-weight: 700; }

/* ── K3 task log (FINAL PUSH 2026-08-13) ───────────────── */
.tasklog-current { margin: 0 12px 8px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--ok, #2ecc71); background: rgba(255,255,255,.02); }
.tasklog-current-row { display: flex; align-items: center; gap: 8px; }
.tasklog-current-row strong { font: 600 11px/1.3 var(--font-ui, sans-serif); letter-spacing: .04em; }
.tasklog-current p { margin: 6px 0 4px; font: 10px/1.45 var(--font-ui, sans-serif); color: var(--muted); word-break: break-word; }
.tasklog-current small { font: 8px/1 var(--font-mono); color: var(--muted); }
.tasklog-current small em { font-style: normal; color: var(--fg); }
.tasklog-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ok, #2ecc71); animation: tasklog-pulse 1.6s ease-in-out infinite; }
@keyframes tasklog-pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(46,204,113,.5); } 50% { opacity: .55; box-shadow: 0 0 0 5px rgba(46,204,113,0); } }
.tasklog-idle { margin: 0 12px 8px; padding: 8px 10px; font: 9px/1.4 var(--font-mono); color: var(--muted); border: 1px dashed var(--line); }
.tasklog-list { max-height: 260px; overflow-y: auto; }
.tasklog-entry { position: relative; display: grid; grid-template-columns: 48px 10px 1fr; gap: 7px; min-height: 32px; padding: 2px 12px 8px 0; }
.tasklog-entry time { padding-top: 3px; color: var(--muted); font: 7px/1 var(--font-mono); text-align: right; }
.tasklog-entry i { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--muted); justify-self: center; }
.tasklog-entry.status-ok i { background: var(--ok, #2ecc71); }
.tasklog-entry.status-active i { background: #3498db; }
.tasklog-entry.status-error i { background: var(--err, #e74c3c); }
.tasklog-entry strong { font: 600 9.5px/1.3 var(--font-ui, sans-serif); }
.tasklog-entry p { margin: 2px 0 0; font: 8.5px/1.4 var(--font-mono); color: var(--muted); word-break: break-word; }

/* ── Scrape meter (CEO addition 2026-08-13): right-deck top, above activity ── */
.meter-body { padding: 0 12px 10px; }
.meter-counts { display: flex; align-items: baseline; justify-content: space-between; }
.meter-counts strong { font: 600 13px/1.2 var(--font-mono); }
.meter-counts span { font: 700 10px/1 var(--font-mono); color: var(--ok, #2ecc71); }
.meter-bar { height: 6px; margin: 7px 0 6px; background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.meter-bar i { display: block; height: 100%; width: 0; background: var(--ok, #2ecc71); transition: width .6s ease; }
.meter-meta { display: flex; justify-content: space-between; font: 9px/1.6 var(--font-mono); }
.meter-sub { display: flex; justify-content: space-between; font: 8px/1.6 var(--font-mono); color: var(--muted); }
.meter-sub em { font-style: normal; color: var(--err, #e74c3c); }

/* ── K3 work pulse (CEO 2026-08-13): proof-of-work, not promises ── */
.workpulse { margin: 0 12px 8px; padding: 8px 10px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.wp-row { display: flex; align-items: center; gap: 8px; }
.wp-pill { font: 700 8px/1 var(--font-mono); letter-spacing: .06em; padding: 4px 7px; border-radius: 8px; }
.wp-pill[data-state="working"] { color: #0b1410; background: var(--ok, #2ecc71); animation: tasklog-pulse 1.6s ease-in-out infinite; }
.wp-pill[data-state="recent"] { color: #14100b; background: hsl(38,92%,50%); }
.wp-pill[data-state="quiet"] { color: var(--fg); background: rgba(255,255,255,.08); }
.wp-proof { font: 8px/1.4 var(--font-mono); color: var(--muted); }
.wp-detail { margin-top: 6px; display: grid; gap: 2px; }
.wp-commit, .wp-file { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: baseline; font: 8px/1.4 var(--font-mono); color: var(--muted); }
.wp-commit code { color: var(--fg); }
.wp-commit span, .wp-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-commit time, .wp-file time { font-size: 7px; }

/* Chat bottom-anchor (CEO 2026-08-13): hidden until first anchor kick lands,
   so a reload never flashes old messages; JS fallback removes it in 6s. */
#chatViewport.anchoring { visibility: hidden; }

/* 2026-08-14: transient tool errors (retried/self-healed) render amber;
   red stays reserved for turn-fatal events (CEO: "lots of red errors"). */
.work-event.warn > i { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 7px var(--amber); }
.work-event.warn .work-body { border-left-color: var(--amber); }

/* Automation-injected prompts never masquerade as the CEO (2026-08-14). */
.message.automation { display: flex; justify-content: center; margin: 4px 0; }
.automation-card { display: flex; align-items: center; gap: 8px; max-width: 90%; padding: 4px 10px; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--faint); font: 8px/1.3 var(--font-mono); }
.automation-card p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-card time { color: var(--faint); }
.automation-badge { color: var(--amber); letter-spacing: .08em; }
