:root {
  --bg: #030913;
  --bg2: #071427;
  --panel: rgba(9, 24, 44, 0.78);
  --line: rgba(64, 160, 230, 0.22);
  --line-strong: rgba(64, 190, 255, 0.5);
  --text: #e3f1ff;
  --muted: #7f9ab8;
  --cyan: #38d6ff;
  --blue: #2a8cff;
  --green: #34e0a1;
  --amber: #ffb547;
  --red: #ff6b7d;
  --radius: 12px;
  --glow: 0 0 18px rgba(56, 214, 255, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Inter, system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(42, 140, 255, 0.16), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(56, 214, 255, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(56, 214, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(56, 214, 255, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--red); min-height: 1.2em; }
.bad-text { color: var(--red); }
h2 { margin: 2px 0 0; font-size: 18px; font-weight: 600; }
h3 { margin: 0; font-size: 14px; }

/* ---------- controls ---------- */
button {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(42, 140, 255, 0.45), rgba(42, 140, 255, 0.22));
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font: 600 13px/1.2 inherit;
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
button:hover:not(:disabled) { box-shadow: var(--glow); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: rgba(9, 30, 56, 0.6); border-color: var(--line); }
button.danger { background: rgba(255, 107, 125, 0.18); border-color: rgba(255, 107, 125, 0.5); }
button.small { padding: 5px 10px; font-size: 12px; }
input, select, textarea {
  width: 100%;
  background: rgba(3, 12, 24, 0.85);
  border: 1px solid rgba(80, 165, 235, 0.5); /* 3:1 against the field, so fields are easy to see */
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
textarea { resize: vertical; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 6px; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
label.inline select { width: auto; }
label.inline input[type="checkbox"] { width: auto; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row.between { justify-content: space-between; margin-top: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(120, 200, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px);
  min-width: 0;
}
.label { margin: 0 0 12px; font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--cyan); text-transform: uppercase; }
.pill {
  display: inline-block;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--cyan);
  white-space: nowrap;
}
.pill.good { color: var(--green); border-color: rgba(52, 224, 161, 0.5); }
.pill.bad { color: var(--red); border-color: rgba(255, 107, 125, 0.5); }
.pill.warn { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); }
.pill.live { color: var(--cyan); animation: pulse 1.6s infinite; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; position: relative; }
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(3, 12, 24, 0.7);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto; /* never cut off the voice panel on short screens */
}
.logo { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line); }
.logo b { display: block; letter-spacing: 5px; font-size: 18px; }
.logo small { color: var(--muted); font-size: 9px; letter-spacing: 3px; }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  color: #b7cce3;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
nav a:hover { background: rgba(42, 140, 255, 0.1); }
nav a.active { border-color: var(--line-strong); background: rgba(42, 140, 255, 0.16); color: var(--text); box-shadow: var(--glow); }
.badge { font-style: normal; background: var(--amber); color: #1a1000; border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700; }

.voice-status { margin-top: auto; text-align: center; padding: 14px; }
.voice-status p { margin: 6px 0; font-size: 12px; }
.wave { display: flex; gap: 3px; justify-content: center; align-items: center; height: 34px; }
.wave i { width: 3px; height: 6px; background: var(--cyan); border-radius: 2px; opacity: 0.5; }
.speaking .wave i, .listening .wave i { animation: wave 0.9s ease-in-out infinite; opacity: 1; }
.wave i:nth-child(2n) { animation-delay: -0.3s; }
.wave i:nth-child(3n) { animation-delay: -0.6s; }
.listening .wave i { background: var(--green); }
.mic {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 6px auto 0;
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  background: radial-gradient(circle, rgba(56, 214, 255, 0.45), rgba(42, 140, 255, 0.15));
  box-shadow: 0 0 22px rgba(56, 214, 255, 0.35);
}
.listening .mic { background: radial-gradient(circle, rgba(52, 224, 161, 0.6), rgba(52, 224, 161, 0.15)); }

.main { display: flex; flex-direction: column; min-width: 0; padding: 0 22px 90px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.clock { text-align: center; }
.clock small { display: block; color: var(--muted); font-size: 11px; }
.clock b { font-size: 22px; color: var(--cyan); letter-spacing: 1px; text-shadow: 0 0 12px rgba(56, 214, 255, 0.5); }
.user { display: flex; align-items: center; gap: 10px; }
.user small { color: var(--cyan); font-size: 10px; letter-spacing: 2px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }

.view { display: flex; flex-direction: column; gap: 16px; }
.grid-top { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 16px; }
.grid-mid { display: grid; grid-template-columns: 1.5fr 1fr 0.8fr; gap: 16px; }
.grid-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- command centre ---------- */
.small-note { font-size: 11px; margin: 10px 0 0; }
.trading-proposals { margin-top: 10px; }
.trading-proposals li { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(3, 12, 24, 0.5); font-size: 12px; }
.core-list, .feed, .timeline, .models, .decisions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.core-list li { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(3, 12, 24, 0.5); }
.core-list i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex: none; }
.core-list li.off i { background: var(--red); box-shadow: 0 0 8px var(--red); }
.core-list b, .models b { display: block; font-size: 13px; }
.core-list small, .models small { color: var(--muted); font-size: 11px; }

.orb-panel { position: relative; display: grid; place-items: center; min-height: 300px; overflow: hidden; }
.orb { position: absolute; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle at 50% 45%, rgba(56, 214, 255, 0.35), rgba(42, 140, 255, 0.12) 45%, transparent 70%); box-shadow: 0 0 60px rgba(42, 140, 255, 0.35), inset 0 0 50px rgba(56, 214, 255, 0.25); }
.ring { position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgba(56, 214, 255, 0.45); border-top-color: transparent; border-bottom-color: transparent; animation: spin 14s linear infinite; }
.ring.r2 { inset: -34px; animation-duration: 22s; animation-direction: reverse; border-color: rgba(42, 140, 255, 0.3); border-left-color: transparent; }
.ring.r3 { inset: 18px; animation-duration: 9s; border-style: dashed; border-color: rgba(56, 214, 255, 0.25); }
.thinking .ring { animation-duration: 3s; }
.thinking .orb { animation: pulse 1.6s infinite; }
.orb-text { position: relative; text-align: center; }
.orb-text b { display: block; font-size: 38px; letter-spacing: 12px; color: #dff6ff; text-shadow: 0 0 22px rgba(56, 214, 255, 0.9); padding-left: 12px; }
.orb-text span { display: block; letter-spacing: 8px; color: var(--cyan); font-size: 13px; }
.orb-text small { color: var(--muted); font-size: 11px; }
.orb-status { position: absolute; bottom: 10px; margin: 0; color: var(--muted); font-size: 12px; }

.feed li { padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: 8px; cursor: pointer; background: rgba(3, 12, 24, 0.5); }
.feed li.warn { border-left-color: var(--amber); }
.feed li.bad { border-left-color: var(--red); }
.feed li.muted { cursor: default; border-left-color: var(--line); }
.feed li b { display: block; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; }
.feed li span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; color: #c4d6ea; }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.agent { display: flex; gap: 10px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(3, 12, 24, 0.5); }
.agent b { display: block; font-size: 12px; }
.agent small { color: var(--muted); font-size: 11px; }
.agent.thinking { border-color: var(--cyan); box-shadow: var(--glow); }
.agent.thinking small { color: var(--cyan); }
.agent.done small { color: var(--green); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--cyan); border: 1px solid var(--line-strong); background: rgba(42, 140, 255, 0.15); }
.agent.thinking .avatar { animation: pulse 1.2s infinite; }

.timeline li { display: flex; gap: 10px; cursor: pointer; padding: 4px 0; }
.timeline li.muted { cursor: default; }
.timeline li > div { min-width: 0; flex: 1; }
.timeline b { display: block; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timeline small { color: var(--muted); font-size: 11px; }
.dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; flex: none; background: var(--amber); }
.dot.good { background: var(--green); }
.dot.bad { background: var(--red); }
.dot.live { background: var(--cyan); animation: pulse 1.2s infinite; }

.quick { display: flex; flex-direction: column; gap: 8px; }
.quick button { text-align: left; }

.gauges { display: flex; gap: 18px; flex-wrap: wrap; }
.gauge { position: relative; width: 92px; text-align: center; }
.gauge svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 6; }
.gauge .track { stroke: rgba(64, 160, 230, 0.15); }
.gauge .value { stroke: var(--cyan); stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(56, 214, 255, 0.7)); }
.gauge b { position: absolute; top: 28px; left: 0; right: 0; font-size: 14px; }
.gauge small { display: block; color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.models li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(3, 12, 24, 0.5); }

/* ---------- boardroom ---------- */
.progress { height: 4px; background: rgba(64, 160, 230, 0.15); border-radius: 4px; margin: 14px 0 6px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 10px var(--cyan); transition: width 0.4s; }
.controls { margin: 8px 0 12px; }
.transcript { display: flex; flex-direction: column; gap: 10px; }
.contribution { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: rgba(3, 12, 24, 0.55); }
.contribution header { display: flex; align-items: center; gap: 10px; }
.contribution header small { color: var(--muted); font-size: 11px; margin-right: auto; }
.contribution p { margin: 10px 0 0; white-space: pre-wrap; color: #cfe0f2; }
.contribution.chair { border-color: rgba(52, 224, 161, 0.4); }
.contribution.chair .avatar { color: var(--green); border-color: rgba(52, 224, 161, 0.5); font-size: 9px; }
.boardchat, .approval { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.decisions li { color: var(--muted); font-size: 12px; }
.decisions b { color: var(--text); }
.decisions p { margin: 2px 0 0; }

/* ---------- tables & lists ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid rgba(64, 160, 230, 0.1); vertical-align: top; overflow-wrap: anywhere; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: rgba(42, 140, 255, 0.08); }
.exec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.exec { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(3, 12, 24, 0.5); }
.exec div { flex: 1; }
.exec b, .exec small { display: block; }
.exec small { font-size: 12px; color: #b7cce3; }
.facts { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }

.talkbar { position: fixed; left: 230px; right: 0; bottom: 0; display: flex; justify-content: center; padding: 12px; background: linear-gradient(0deg, rgba(3, 9, 19, 0.95), transparent); pointer-events: none; }
.talk { pointer-events: auto; border-radius: 999px; padding: 10px 46px; text-align: center; box-shadow: 0 0 26px rgba(56, 214, 255, 0.35); border-color: var(--cyan); }
.talk b { display: block; letter-spacing: 3px; font-size: 13px; }
.talk small { color: #bfe9ff; font-size: 11px; font-weight: 400; }
.listening .talk { border-color: var(--green); box-shadow: 0 0 26px rgba(52, 224, 161, 0.5); }

.toast { position: fixed; right: 20px; bottom: 80px; max-width: 360px; margin: 0; padding: 12px 16px; border-radius: 10px; background: #0b2340; border: 1px solid var(--line-strong); box-shadow: var(--glow); z-index: 10; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); text-align: center; padding: 34px 30px; }
.login-card form { text-align: left; margin-top: 18px; }
.login-card button { width: 100%; margin-top: 18px; padding: 12px; }
.brandmark { margin: 14px 0 0; letter-spacing: 12px; font-size: 30px; padding-left: 12px; text-shadow: 0 0 18px rgba(56, 214, 255, 0.7); }
.brandsub { margin: 4px 0 0; letter-spacing: 4px; color: var(--cyan); font-size: 11px; }
.fine { color: var(--muted); font-size: 11px; margin: 16px 0 0; }
.core-mini { width: 40px; height: 40px; border-radius: 50%; position: relative; border: 1px solid var(--cyan); box-shadow: 0 0 14px rgba(56, 214, 255, 0.6); flex: none; margin: 0 auto; }
.core-mini span { position: absolute; inset: 9px; border-radius: 50%; background: radial-gradient(circle, #bff3ff, var(--blue)); box-shadow: 0 0 12px var(--cyan); }
.core-mini::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgba(56, 214, 255, 0.4); border-left-color: transparent; border-right-color: transparent; animation: spin 6s linear infinite; }
.logo .core-mini { margin: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes wave { 50% { height: 26px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1200px) {
  .grid-top { grid-template-columns: 1fr 1fr; }
  .orb-panel { grid-column: 1 / -1; order: -1; }
  .grid-mid { grid-template-columns: 1fr 1fr; }
  .grid-mid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .voice-status { display: none; }
  .main { padding: 0 16px 90px; }
  .grid-top, .grid-mid, .grid-bottom, .form-grid { grid-template-columns: 1fr; }
  .talkbar { left: 0; }
  .topbar { flex-wrap: wrap; }
  .facts { grid-template-columns: 1fr; }
}

button.small.active { border-color: var(--cyan); box-shadow: var(--glow); color: var(--cyan); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { padding: 4px 10px; font-size: 11px; font-weight: 600; border-radius: 999px; background: rgba(9, 30, 56, 0.6); border-color: var(--line); }

/* ---------- work orders & knowledge ---------- */
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 6px; counter-reset: step; }
.steps li { counter-increment: step; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); }
.steps li::before { content: counter(step) ". "; }
.steps li.done { color: var(--green); border-color: rgba(52, 224, 161, 0.45); }
.steps li.current { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow); animation: pulse 1.6s infinite; }
.doc { margin-top: 14px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 10px; background: rgba(3, 12, 24, 0.55); line-height: 1.65; }
.doc h3 { margin: 18px 0 8px; font-size: 17px; color: var(--cyan); }
.doc h3:first-child { margin-top: 0; }
.doc h4 { margin: 14px 0 6px; font-size: 14px; }
.doc p { margin: 8px 0; color: #d3e2f2; }
.doc ul, .doc ol, .sources ul, .checks ul { margin: 6px 0; padding-left: 22px; }
.doc li { margin: 4px 0; color: #d3e2f2; }
.sources, .checks { margin-top: 14px; }
.sources li { margin: 4px 0; font-size: 13px; }
.sources a { color: var(--cyan); }
.good-text { color: var(--green); }
.review { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.review summary { cursor: pointer; color: var(--cyan); font-weight: 600; }
.kb-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
input[type="file"] { width: auto; flex: 1; }

/* ---------- microphone & talk bar ---------- */
.mic svg, .talk svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mic { display: grid; place-items: center; padding: 0; color: #dff6ff; }
.mic svg { width: 26px; height: 26px; }
.listening .mic { animation: pulse 1.2s infinite; color: #eafff6; }
.talkbar {
  position: fixed; left: 230px; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; padding: 10px 16px;
  background: rgba(3, 10, 20, 0.92); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
  pointer-events: auto;
}
.talk { display: inline-flex; align-items: center; gap: 12px; padding: 8px 34px 8px 26px; text-align: left; }
.talk svg { width: 22px; height: 22px; flex: none; }
.talk span { display: flex; flex-direction: column; }
.main { padding-bottom: 96px; }

/* Short screens (laptops at 1366x768 and below): keep the whole sidebar visible. */
@media (max-height: 820px) and (min-width: 821px) {
  .sidebar { gap: 10px; padding: 12px 12px; }
  .logo { padding-bottom: 10px; }
  nav a { padding: 6px 12px; }
  .voice-status {
    display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "mic label wave" "mic state wave";
    align-items: center; column-gap: 12px; padding: 10px 12px; text-align: left;
  }
  .voice-status .label { grid-area: label; margin: 0; font-size: 10px; letter-spacing: 2px; }
  .voice-status #voice-state { grid-area: state; margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .voice-status .wave { grid-area: wave; height: 26px; gap: 2px; }
  .voice-status .wave i:nth-child(n + 6) { display: none; }
  .mic { grid-area: mic; width: 42px; height: 42px; margin: 0; }
  .mic svg { width: 20px; height: 20px; }
  .talkbar { padding: 7px 16px; }
  .talk { padding: 6px 28px 6px 20px; }
  .talk b { font-size: 12px; }
}

@media (max-width: 820px) { .talkbar { left: 0; } }

/* ---------- workspaces, account, feed ---------- */
.topleft { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-link { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--line-strong); }
.user-link:hover { color: var(--cyan); }
.ws-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ws-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: rgba(3, 12, 24, 0.5); display: flex; flex-direction: column; gap: 6px; }
.ws-card.current { border-color: var(--cyan); box-shadow: var(--glow); }
.ws-card > div:first-child { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ws-card p { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ws-card .row { margin-top: 4px; }
.feed li small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 12px; margin: 12px 0 0; }
legend { color: var(--cyan); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; padding: 0 6px; }
.ws-note { align-self: end; margin: 0 0 10px; }

.inline-select { width: auto; padding: 5px 30px 5px 10px; background-position: right 8px center; background-size: 14px; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* Workspace switcher: a chip in the same family as the status pill, with its own menu. */
.ws-switch { position: relative; }
.ws-button {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); font-weight: 400;
  background: linear-gradient(180deg, rgba(42, 140, 255, 0.16), rgba(9, 30, 56, 0.55));
}
.ws-button:hover, .ws-button[aria-expanded="true"] { box-shadow: var(--glow); border-color: var(--cyan); }
.ws-icon, .ws-chevron { fill: none; stroke: var(--cyan); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ws-icon { width: 16px; height: 16px; }
.ws-chevron { width: 14px; height: 14px; transition: transform 0.15s; }
.ws-button[aria-expanded="true"] .ws-chevron { transform: rotate(180deg); }
.ws-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.ws-text small { font-size: 8px; letter-spacing: 2px; color: var(--muted); }
.ws-text b { font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: 300px; padding: 12px;
  background: #0a1a2f; border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), var(--glow);
}
.ws-menu .label { margin: 2px 4px 8px; }
#ws-options { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; }
.ws-option {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 10px; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--text); font-weight: 400;
}
.ws-option:hover, .ws-option:focus-visible { background: rgba(42, 140, 255, 0.12); border-color: var(--line); box-shadow: none; }
.ws-option.current { background: rgba(56, 214, 255, 0.1); border-color: var(--line-strong); }
.ws-option b { display: block; font-size: 13px; }
.ws-option small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.ws-check { width: 14px; color: var(--green); font-weight: 700; flex: none; }
.ws-menu-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- form fields (whole app) ---------- */
/* Focus stays inside the field: no ring that can run into the label above it. */
input, select, textarea { border-radius: 10px; transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s; }
input:hover, select:hover, textarea:hover { border-color: rgba(64, 190, 255, 0.4); }
input:focus, select:focus, textarea:focus, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--cyan); background-color: rgba(5, 18, 34, 0.95);
  box-shadow: inset 0 0 0 1px var(--cyan), 0 0 14px rgba(56, 214, 255, 0.18);
}
input::placeholder, textarea::placeholder { color: #7891ad; }
/* A field inside its label sits clearly below the label text. */
label > input:not([type="checkbox"]):not([type="radio"]), label > select, label > textarea { display: block; margin-top: 8px; }
label { margin: 14px 0 8px; }
label + input, label + textarea, label + select { margin-top: 0; }
/* Dropdowns in the NEXUS style, with our own arrow. */
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2338d6ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
select option, select optgroup { background: #0b1a2e; color: var(--text); }
input[type="checkbox"] { accent-color: var(--cyan); width: 16px; height: 16px; margin: 0; cursor: pointer; }
label.inline { color: #b7cce3; font-size: 13px; cursor: pointer; }
label.inline select { margin-top: 0; display: inline-block; }
input[type="file"] { padding: 8px; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: rgba(42, 140, 255, 0.25); color: var(--text); font-weight: 600; cursor: pointer;
}

/* ---------- test fixes: keyboard, small screens, landmarks ---------- */
html { scroll-padding-bottom: 96px; scroll-padding-top: 16px; } /* focused fields never hide behind the talk bar */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.linkbtn { all: unset; cursor: pointer; color: var(--text); font-weight: 600; border-radius: 4px; }
.linkbtn:hover { color: var(--cyan); }
.linkbtn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.feed li:focus-visible, .timeline li:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.row > input:not([type="checkbox"]):not([type="file"]) { flex: 1; width: auto; min-width: 180px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-cell { display: table-cell; }
#wd-error:empty, #meeting-error:empty { display: none; }
.ws-menu { position: fixed; }
@media (max-width: 820px) {
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .table td { white-space: nowrap; }
  nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  nav a { white-space: nowrap; gap: 8px; }
  .sidebar { gap: 8px; padding: 10px 12px; }
  .logo { padding-bottom: 8px; }
  .topbar { padding: 10px 0; }
}

/* ---------- Jarvis ---------- */
.jv-stage { display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 22px; }
.jv-head { align-self: stretch; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.jv-head .label { margin: 0; }
.jv-orb { position: relative; width: 220px; height: 220px; margin: 34px 0 26px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 50% 45%, rgba(56, 214, 255, 0.35), rgba(42, 140, 255, 0.12) 45%, transparent 70%);
  box-shadow: 0 0 60px rgba(42, 140, 255, 0.35), inset 0 0 50px rgba(56, 214, 255, 0.25); transition: box-shadow 0.3s, transform 0.3s; }
.jv-orb:hover:not(:disabled) { box-shadow: 0 0 80px rgba(42, 140, 255, 0.5), inset 0 0 50px rgba(56, 214, 255, 0.35); }
.jv-core { position: relative; display: grid; place-items: center; gap: 4px; }
.jv-core b { font-size: 26px; letter-spacing: 8px; padding-left: 8px; color: #dff6ff; text-shadow: 0 0 22px rgba(56, 214, 255, 0.9); }
.jv-core small { font-size: 11px; letter-spacing: 4px; color: var(--cyan); }
.jv-state { margin: 0 0 12px; min-height: 1.4em; font-size: 15px; color: var(--text); max-width: 640px; }
.jv-level { width: 220px; height: 4px; border-radius: 4px; background: rgba(56, 214, 255, 0.12); overflow: hidden; margin-bottom: 16px; }
.jv-level i { display: block; height: 100%; background: var(--green); transform-origin: left; transform: scaleX(0); transition: transform 0.08s linear; }
.jv-buttons { justify-content: center; }
.jv-stage.listening .jv-orb { box-shadow: 0 0 70px rgba(52, 224, 161, 0.45), inset 0 0 50px rgba(52, 224, 161, 0.3); }
.jv-stage.listening .jv-core small { color: var(--green); }
.jv-stage.listening .ring { border-color: rgba(52, 224, 161, 0.5); border-top-color: transparent; border-bottom-color: transparent; }
.jv-stage.thinking .ring { animation-duration: 2.5s; }
.jv-stage.thinking .jv-orb { animation: pulse 1.4s infinite; }
.jv-stage.speaking .jv-orb { animation: jv-speak 0.9s ease-in-out infinite; }
.jv-stage.speaking .ring { animation-duration: 5s; }
@keyframes jv-speak { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.045); } }
.jv-transcript { max-height: 460px; overflow-y: auto; }
.jv-type { display: flex; gap: 10px; margin-top: 12px; }
.jv-type input { flex: 1; }
@media (prefers-reduced-motion: reduce) { .jv-stage .jv-orb, .jv-stage .ring { animation: none !important; } }
.jv-model { font-size: 12px; }
.jv-model select { padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.jv-hint { margin: 16px 0 0; max-width: 620px; line-height: 1.5; }
@media (max-width: 560px) {
  .jv-orb { width: 170px; height: 170px; margin: 46px 0 30px; }
  .jv-core b { font-size: 22px; letter-spacing: 6px; padding-left: 6px; }
}

/* Personal Intelligence: what Jarvis remembers */
.memory-list { list-style: none; margin: 12px 0; padding: 0; }
.memory-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(64, 160, 230, 0.1); }
.memory-list li > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; flex: 1; }
.memory-list li input { width: 100%; }
.memory-list .row { flex-shrink: 0; margin: 0; }
@media (max-width: 600px) { .memory-list li { flex-direction: column; align-items: stretch; } }
