/* J.A.R.V.I.S. — HUD. Dark by design: this app is always dark. */

:root {
  color-scheme: dark;
  --bg: #03060c;
  --bg-2: #050b15;
  --panel: rgba(8, 20, 34, 0.58);
  --panel-2: rgba(5, 13, 24, 0.66);
  --panel-solid: #07111e;
  --line: rgba(94, 231, 255, 0.15);
  --line-soft: rgba(94, 231, 255, 0.08);
  --line-strong: rgba(94, 231, 255, 0.42);
  --cyan: #5ee7ff;
  --cyan-rgb: 94, 231, 255;
  --cyan-dim: rgba(94, 231, 255, 0.62);
  --cyan-ghost: rgba(94, 231, 255, 0.1);
  --amber: #ffb547;
  --amber-rgb: 255, 181, 71;
  --red: #ff4d5e;
  --red-rgb: 255, 77, 94;
  --text: #d8f6ff;
  --text-dim: rgba(216, 246, 255, 0.66);
  --text-faint: rgba(216, 246, 255, 0.4);
  --offline: #3b4a5a;

  --font-display: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --topbar-h: 58px;
  --gap: 14px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------------------------------------------ backdrop: hex grid + scanlines + vignette */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, rgba(18, 60, 92, 0.32), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.65) 100%),
    var(--bg);
}
.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='41.57' height='72' viewBox='0 0 41.57 72'%3E%3Cpath d='M20.785 0 L41.57 12 L41.57 36 L20.785 48 L0 36 L0 12 Z M20.785 48 L20.785 72' fill='none' stroke='%235ee7ff' stroke-opacity='0.07' stroke-width='0.8'/%3E%3C/svg%3E");
  background-size: 41.57px 72px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 20%, transparent 85%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 20%, transparent 85%);
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(160, 230, 255, 0.018) 0, rgba(160, 230, 255, 0.018) 1px, transparent 1px, transparent 3px);
}

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: relative;
  z-index: 3;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 16, 28, 0.85), rgba(3, 8, 16, 0.4));
}
.topbar::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan) 20%, transparent 45%, transparent 55%, var(--cyan) 80%, transparent);
  opacity: 0.45;
}

.brand { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.34em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(var(--cyan-rgb), 0.55), 0 0 2px rgba(var(--cyan-rgb), 0.9);
}
.brand .mark {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--text-faint);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 2px;
}

.status-line {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--text-dim);
  white-space: nowrap;
}
.status-line .sep { width: 44px; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong)); }
.status-line .sep.r { transform: scaleX(-1); }
#statusText { overflow: hidden; text-overflow: ellipsis; }

.top-right { display: flex; align-items: center; gap: 18px; white-space: nowrap; }

.node-dots { display: flex; align-items: center; gap: 12px; }
.node-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.node-dot i,
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--offline);
  flex: none;
}
.node-dot.online i,
.dot.on { background: var(--cyan); box-shadow: 0 0 8px rgba(var(--cyan-rgb), 0.9); }
.node-dot.idle i,
.dot.idle { background: var(--amber); box-shadow: 0 0 8px rgba(var(--amber-rgb), 0.7); }
.dot.bad { background: var(--red); box-shadow: 0 0 8px rgba(var(--red-rgb), 0.8); }
.node-dot.offline { color: var(--text-faint); }

.link-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--offline); }
.link-dot.online { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.link-dot.connecting { background: var(--amber); animation: blink 1s steps(2) infinite; }
.link-dot.offline { background: var(--red); }

.weather { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.clock .time {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.clock .date { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.2em; color: var(--text-faint); text-transform: uppercase; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.icon-btn:hover { color: var(--cyan); border-color: var(--line-strong); box-shadow: 0 0 14px rgba(var(--cyan-rgb), 0.2); }
.icon-btn svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ layout */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(320px, 392px);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "left center right"
    "bottom bottom bottom";
  gap: var(--gap);
  padding: var(--gap) 18px 16px;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
}
.col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.col-left { grid-area: left; }
.col-right { grid-area: right; }
.center { grid-area: center; }
.bottom {
  grid-area: bottom;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.25fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  gap: var(--gap);
  height: 214px;
}

/* ------------------------------------------------------------------ panels */
.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(var(--cyan-rgb), 0.05), 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(6px);
  animation: panel-in 0.7s var(--ease) forwards;
  animation-delay: var(--d, 0.4s);
}
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  pointer-events: none;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.7;
}
.panel::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.panel::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.panel > header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px 9px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cyan);
}
.panel .count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 8px;
  padding: 0 6px;
  line-height: 15px;
  min-width: 16px;
  text-align: center;
}
.panel .count:empty,
.panel .count[data-n="0"] { display: none; }
.panel .tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 14px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--cyan-rgb), 0.25) transparent;
}
.panel-body::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(var(--cyan-rgb), 0.22); border-radius: 3px; }

.empty {
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.empty::before { content: ""; width: 14px; height: 1px; background: var(--line-strong); }

.col-left #pSystems { flex: 1.1; }
.col-left #pPromises { flex: 1; }
.col-left #pStudy { flex: 1.15; min-height: 176px; transition: flex 0.35s var(--ease); }
.col-left #pStudy.active { flex: 3.2; }
.col-right #pTranscript { flex: 1; }
.col-right #pApprovals { flex: none; max-height: 58%; }
.col-right #pApprovals.is-empty { display: none; }

/* ------------------------------------------------------------------ center / orb */
.center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  min-width: 0;
}
.orb-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
}
#blob {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.caption {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  width: min(620px, 92%);
  text-align: center;
  pointer-events: none;
}
.caption .mode {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.46em;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(var(--cyan-rgb), 0.6);
  transition: color 0.4s;
}
.caption .mode .tool { color: var(--text-faint); letter-spacing: 0.18em; }
body[data-mode="thinking"] .caption .mode { color: var(--amber); text-shadow: 0 0 12px rgba(var(--amber-rgb), 0.55); }
body[data-mode="alert"] .caption .mode { color: var(--red); text-shadow: 0 0 12px rgba(var(--red-rgb), 0.6); }
.caption .subtitle {
  margin-top: 8px;
  min-height: 1.4em;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: opacity 0.6s;
}
.caption .subtitle.fade { opacity: 0; }

.corner-meta {
  position: absolute;
  top: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  line-height: 1.7;
  pointer-events: none;
  text-transform: uppercase;
}
.corner-meta.l { left: 4px; }
.corner-meta.r { right: 4px; text-align: right; }
.corner-meta b { color: var(--cyan-dim); font-weight: 500; }

/* talk bar */
.talk {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(660px, 100%);
  margin-top: 8px;
}
.talk .field {
  flex: 1;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 6px 0 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(4, 12, 22, 0.78);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.talk .field:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.07), 0 0 24px rgba(var(--cyan-rgb), 0.12); }
.talk input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: 15px var(--font-body);
}
.talk input::placeholder { color: var(--text-faint); }
.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.send-btn:hover { color: var(--cyan); background: var(--cyan-ghost); }
.send-btn svg { width: 17px; height: 17px; }

.mic-btn {
  position: relative;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(4, 12, 22, 0.8);
  color: var(--cyan);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, color 0.25s, border-color 0.25s;
}
.mic-btn svg { width: 19px; height: 19px; position: relative; z-index: 1; }
.mic-btn:hover { box-shadow: 0 0 18px rgba(var(--cyan-rgb), 0.3); }
.mic-btn::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1px dashed transparent;
}
.mic-btn.connecting::after { border-color: rgba(var(--amber-rgb), 0.8); animation: spin 1.4s linear infinite; }
.mic-btn.live {
  background: var(--cyan);
  color: var(--bg);
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(var(--cyan-rgb), 0.55), 0 0 0 calc(var(--mic, 0) * 10px) rgba(var(--cyan-rgb), 0.18);
}
.protocols {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  max-width: 100%;
}
.protocols .lbl {
  font-family: var(--font-display);
  font-size: 8.5px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-right: 4px;
}
.proto {
  appearance: none;
  height: 26px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(4, 12, 22, 0.6);
  color: var(--text-dim);
  font: 500 11.5px var(--font-body);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.proto:hover { color: var(--cyan); border-color: var(--line-strong); }
.proto.armed { color: var(--bg); background: var(--amber); border-color: var(--amber); box-shadow: 0 0 14px rgba(var(--amber-rgb), 0.45); }
.proto.running { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 12px rgba(var(--cyan-rgb), 0.3); }
.proto:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* modes: DND / Focus / Gaming / Quiet — one state synced to every device */
.modes-row {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  max-width: 100%;
}
.modes-row .lbl {
  font-family: var(--font-display);
  font-size: 8.5px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-right: 4px;
}
.mode-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px 0 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(4, 12, 22, 0.6);
  color: var(--text-dim);
  font: 500 11.5px var(--font-body);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.mode-btn .led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--offline);
  transition: background 0.2s, box-shadow 0.2s;
}
.mode-btn .left { font-family: var(--font-mono); font-size: 10px; color: inherit; opacity: 0.8; }
.mode-btn .left:empty { display: none; }
.mode-btn:hover { color: var(--cyan); border-color: var(--line-strong); }
.mode-btn.on { color: var(--bg); background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 14px rgba(var(--cyan-rgb), 0.4); }
.mode-btn.on .led { background: var(--bg); }
.mode-btn[data-mode="dnd"].on { background: #b69cff; border-color: #b69cff; box-shadow: 0 0 14px rgba(182, 156, 255, 0.45); }
.mode-btn.quiet.on { background: rgba(var(--amber-rgb), 0.16); color: var(--amber); border-color: rgba(var(--amber-rgb), 0.6); box-shadow: none; }
.mode-btn.quiet.on .led { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.mode-btn.private.on { background: rgba(var(--red-rgb), 0.16); color: var(--red); border-color: rgba(var(--red-rgb), 0.65); box-shadow: 0 0 10px rgba(var(--red-rgb), 0.25); }
.mode-btn.private.on .led { background: var(--red); box-shadow: 0 0 6px var(--red); }
body.private-on #micBtn { opacity: 0.35; filter: grayscale(1); }
.mode-btn.pending { opacity: 0.65; }
.mode-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.mode-dur {
  appearance: none;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(4, 12, 22, 0.6);
  color: var(--text-dim);
  font: 500 11px var(--font-body);
  cursor: pointer;
}
.mode-dur:hover, .mode-dur:focus-visible { color: var(--cyan); border-color: var(--line-strong); outline: none; }
.mode-dur option { background: var(--panel-solid); color: var(--text); }
.devices-line {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-faint);
}
.devices-line[hidden] { display: none; }
.devices-line .lbl { font-family: var(--font-display); font-size: 8px; letter-spacing: 0.24em; text-transform: uppercase; }
.devices-line .dev {
  padding: 1px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--text-dim);
}
.devices-line .dev::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 5px var(--cyan); vertical-align: 1px; }
body.dnd-on .status-line #statusText::after { content: " · DND"; color: #b69cff; }

.banner {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 16px);
  padding: 8px 14px;
  border: 1px solid rgba(var(--amber-rgb), 0.45);
  background: rgba(24, 16, 4, 0.78);
  border-radius: 20px;
  color: var(--text);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(var(--amber-rgb), 0.12);
  animation: msg-in 0.6s var(--ease);
}
.banner[hidden] { display: none; }
.banner span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; }
.banner b { color: var(--amber); font-weight: 600; }
.banner .go { font-family: var(--font-mono); font-size: 11px; color: var(--amber); }
.banner:hover { border-color: var(--amber); }
.mic-btn.unready { border-color: var(--line); color: var(--text-faint); }

.hints {
  flex: none;
  margin-top: 8px;
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-faint);
}
kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  margin-right: 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ systems */
.sys-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.sys-row:last-child { border-bottom: 0; }
.sys-row .name { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys-row .meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.sys-row .caps { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text-dim);
  white-space: nowrap;
}
.chip.cyan { color: var(--cyan); border-color: rgba(var(--cyan-rgb), 0.35); }
.chip.amber { color: var(--amber); border-color: rgba(var(--amber-rgb), 0.4); }
.chip.red { color: var(--red); border-color: rgba(var(--red-rgb), 0.45); }
.sub-h {
  margin: 12px 0 4px;
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 12.5px; color: var(--text-dim); }
.kv b { font-family: var(--font-mono); font-weight: 500; font-size: 11.5px; color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ promises */
.promise {
  display: grid;
  grid-template-columns: 3px 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
.promise:last-child { border-bottom: 0; }
.promise .bar { align-self: stretch; border-radius: 2px; background: var(--cyan-dim); }
.promise.soon .bar { background: var(--amber); }
.promise.overdue .bar { background: var(--red); box-shadow: 0 0 8px rgba(var(--red-rgb), 0.6); }
.promise .text { font-size: 13px; }
.promise .due { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); white-space: nowrap; text-align: right; }
.promise.overdue .due { color: var(--red); }
.promise.soon .due { color: var(--amber); }
.promise .nudges { display: block; font-size: 9.5px; color: var(--text-faint); }

/* ------------------------------------------------------------------ study */
.study .panel-body { display: flex; flex-direction: column; gap: 9px; }
.rec-dot {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--red);
  border: 1px solid rgba(var(--red-rgb), 0.5);
  border-radius: 2px;
  padding: 0 5px;
  line-height: 15px;
  animation: blink 1.6s steps(2) infinite;
}
.rec-dot[hidden] { display: none; }
.study-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.study-figs .fig { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.study-figs .fig b {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.study-figs .fig.hot b { color: var(--cyan); text-shadow: 0 0 12px rgba(var(--cyan-rgb), 0.45); }
.study-figs .fig span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--text-faint); text-transform: uppercase; }
.study-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.study-actions .btn.small { flex: 1 1 auto; }
.study-decks { display: flex; flex-wrap: wrap; gap: 4px; }
.study-decks .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.study-rec {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(var(--red-rgb), 0.45);
  border-radius: 2px;
  background: rgba(var(--red-rgb), 0.07);
}
.study-rec .led { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); animation: blink 1.6s steps(2) infinite; }
.study-rec .t { display: flex; flex-direction: column; min-width: 0; }
.study-rec .t b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-rec .t span { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.study-meta { display: flex; align-items: center; gap: 8px; }
.study-meta .chip { overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.study-meta .n { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-left: auto; }
.study-x {
  appearance: none; border: 0; background: none; color: var(--text-faint); cursor: pointer;
  font-size: 17px; line-height: 1; padding: 0 2px;
}
.study-x:hover { color: var(--red); }
.study-front { font-size: 14.5px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.study-back {
  font-size: 13px;
  line-height: 1.45;
  color: var(--cyan);
  padding: 8px 10px;
  border-left: 2px solid var(--cyan-dim);
  background: var(--cyan-ghost);
  overflow-wrap: anywhere;
  animation: msg-in 0.3s var(--ease);
}
.study-grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.study-grades .grade {
  appearance: none;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.study-grades .grade.again { color: var(--red); border-color: rgba(var(--red-rgb), 0.55); }
.study-grades .grade.hard { color: var(--amber); border-color: rgba(var(--amber-rgb), 0.55); }
.study-grades .grade.good { color: var(--cyan); }
.study-grades .grade.easy { color: var(--bg); background: var(--cyan); border-color: var(--cyan); }
.study-grades .grade:hover { box-shadow: 0 0 14px rgba(var(--cyan-rgb), 0.25); background-color: var(--cyan-ghost); }
.study-grades .grade.easy:hover { background: #86eeff; }
.study-grades .grade:disabled { opacity: 0.4; cursor: default; }
.study-grades .grade:focus-visible, .study-x:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.study-in {
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: rgba(var(--cyan-rgb), 0.04);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 9px;
  resize: vertical;
}
.study-in::placeholder { color: var(--text-faint); }
.study-in:focus { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.07); }
textarea.study-in { min-height: 96px; }
.study-note { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--text-dim); }
.study-done { display: flex; flex-direction: column; gap: 2px; }
.study-done b { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.06em; color: var(--cyan); }
.study-done span { font-size: 11.5px; color: var(--text-faint); }
.study-wrong { padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.study-wrong .q { font-weight: 500; }
.study-wrong .a { margin-top: 3px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.study-wrong .a s { color: var(--red); }
.study-wrong .a b { color: var(--cyan); font-weight: 500; }
.study-wrong .x { margin-top: 2px; font-size: 11.5px; color: var(--text-faint); }
.study-busy { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-dim); padding: 6px 0; }
.study-busy .spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(var(--cyan-rgb), 0.2); border-top-color: var(--cyan);
  animation: spin 0.9s linear infinite;
}

/* ------------------------------------------------------------------ transcript */
.transcript .panel-body { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; flex-direction: column; max-width: 88%; animation: msg-in 0.35s var(--ease); }
.msg .who {
  font-family: var(--font-display);
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--text-faint);
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
}
.msg .who time { font-family: var(--font-mono); letter-spacing: 0.04em; font-size: 9.5px; }
.msg .bubble {
  padding: 8px 12px;
  border-radius: 3px 12px 12px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.jarvis .bubble {
  background: linear-gradient(135deg, rgba(var(--cyan-rgb), 0.1), rgba(var(--cyan-rgb), 0.03));
  border: 1px solid rgba(var(--cyan-rgb), 0.2);
  border-left: 2px solid var(--cyan);
}
.msg.jarvis .who { color: var(--cyan-dim); }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.user .bubble {
  border-radius: 12px 3px 12px 12px;
  background: rgba(216, 246, 255, 0.06);
  border: 1px solid rgba(216, 246, 255, 0.1);
}
.msg.system { align-self: center; max-width: 100%; }
.msg.system .bubble { background: none; border: 0; padding: 0; font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); text-align: center; }
.msg.partial .bubble::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--cyan);
  animation: blink 0.9s steps(2) infinite;
}
.msg .via { font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); letter-spacing: 0.06em; }

/* ------------------------------------------------------------------ approvals */
.approvals .panel-body { display: flex; flex-direction: column; gap: 12px; }
#pApprovals { border-color: rgba(var(--amber-rgb), 0.35); }
#pApprovals::before,
#pApprovals::after { border-color: var(--amber); }
#pApprovals h2 { color: var(--amber); }
#pApprovals .count { background: var(--amber); }
.approval {
  position: relative;
  border: 1px solid rgba(var(--amber-rgb), 0.35);
  background: linear-gradient(180deg, rgba(var(--amber-rgb), 0.07), rgba(var(--amber-rgb), 0.02));
  border-radius: 3px;
  padding: 12px 12px 10px;
  animation: approval-in 0.5s var(--ease), approval-glow 2.4s ease-in-out 0.5s 3;
  transition: opacity 0.4s, transform 0.4s, max-height 0.5s;
}
.approval .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; }
.approval .tool { font-family: var(--font-mono); font-size: 11px; color: var(--amber); }
.approval .timer { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.approval .timer.low { color: var(--red); }
.approval .summary { font-size: 14px; font-weight: 500; line-height: 1.45; margin-bottom: 8px; overflow-wrap: anywhere; }
.approval pre {
  margin: 0 0 10px;
  max-height: 160px;
  overflow: auto;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.approval .life { height: 2px; background: rgba(255, 255, 255, 0.06); margin-bottom: 10px; overflow: hidden; }
.approval .life i { display: block; height: 100%; background: var(--amber); transform-origin: left; }
.approval .actions { display: flex; gap: 8px; }
.approval .stamp {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  padding: 3px 8px;
  border: 1px solid currentColor;
  transform: rotate(-4deg);
  background: var(--panel-solid);
}
.approval.resolved { opacity: 0.55; }
.approval.resolved .actions { display: none; }
.approval.approved .stamp { color: var(--cyan); }
.approval.denied .stamp,
.approval.expired .stamp { color: var(--red); }
.approval.leaving { opacity: 0; transform: translateX(16px); }

/* ------------------------------------------------------------------ buttons */
.btn {
  appearance: none;
  flex: 1;
  height: 34px;
  padding: 0 14px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover { background: var(--cyan-ghost); box-shadow: 0 0 16px rgba(var(--cyan-rgb), 0.18); }
.btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: var(--bg); }
.btn.primary:hover { box-shadow: 0 0 22px rgba(var(--cyan-rgb), 0.5); background: #86eeff; }
.btn.danger { border-color: rgba(var(--red-rgb), 0.6); color: var(--red); }
.btn.danger:hover { background: rgba(var(--red-rgb), 0.12); box-shadow: 0 0 16px rgba(var(--red-rgb), 0.25); }
.btn.small { flex: none; height: 26px; font-size: 9px; padding: 0 10px; }
.btn.danger.armed { background: var(--red); color: var(--bg); box-shadow: 0 0 16px rgba(var(--red-rgb), 0.45); }
.btn:focus-visible,
.icon-btn:focus-visible,
.mic-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ------------------------------------------------------------------ tasks */
.tasks .panel-body { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; }
.task {
  flex: 0 0 auto;
  width: 260px;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  gap: 8px 10px;
  animation: msg-in 0.4s var(--ease);
}
.task .shot {
  grid-column: 1 / 3;
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 104px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background:
    repeating-linear-gradient(45deg, rgba(var(--cyan-rgb), 0.03) 0 6px, transparent 6px 12px),
    rgba(0, 0, 0, 0.35);
  overflow: hidden;
  cursor: zoom-in;
}
.task .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task .shot .live {
  position: absolute;
  top: 5px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.55);
  padding: 1px 6px;
  border-radius: 2px;
}
.task .shot .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.2s steps(2) infinite; }
.task .shot .term {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 18px 8px 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.55);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.45;
  color: #9fe9c6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.task .shot .term[hidden] { display: none; }
.task .shot .nofeed { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.12em; }
.task .info { min-width: 0; }
.task .title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .state { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.task.running .state { color: var(--cyan); }
.task.done .state { color: var(--cyan-dim); }
.task.failed .state,
.task.cancelled .state,
.task.interrupted .state { color: var(--red); }
.task.finished { opacity: 0.6; }

/* ------------------------------------------------------------------ thoughts */
.thought {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
  animation: msg-in 0.4s var(--ease);
}
.thought:last-child { border-bottom: 0; }
.thought .score { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.thought .score i { display: block; height: 2px; margin-top: 4px; background: rgba(255, 255, 255, 0.07); }
.thought .score i b { display: block; height: 100%; background: var(--cyan); }
.thought.hot .score i b { background: var(--amber); }
.thought.crit .score i b { background: var(--red); }
.thought .t { font-size: 12.5px; font-weight: 500; }
.thought .d { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thought time { display: block; font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); text-align: right; margin-top: 3px; }

/* ------------------------------------------------------------------ spend */
.spend-fig { display: flex; align-items: baseline; gap: 8px; }
.spend-fig .big { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.spend-fig .of { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.meter { position: relative; height: 8px; margin: 12px 0 6px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-soft); border-radius: 1px; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, rgba(var(--cyan-rgb), 0.5), var(--cyan)); box-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.5); transition: width 0.8s var(--ease); }
.meter.warn .fill { background: linear-gradient(90deg, rgba(var(--amber-rgb), 0.5), var(--amber)); box-shadow: 0 0 10px rgba(var(--amber-rgb), 0.5); }
.meter.capped .fill { background: linear-gradient(90deg, rgba(var(--red-rgb), 0.5), var(--red)); box-shadow: 0 0 10px rgba(var(--red-rgb), 0.6); }
.meter .mk { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--text-faint); }
.meter .mk span { position: absolute; top: 14px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 9px; color: var(--text-faint); white-space: nowrap; }
.spend-level { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-faint); }

/* ------------------------------------------------------------------ grants */
.grants .panel-body { display: flex; flex-direction: column; }
.grant { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.grant:last-of-type { border-bottom: 0; }
.grant .g1 { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 500; }
.grant .g1 .left { font-family: var(--font-mono); font-size: 10.5px; color: var(--amber); white-space: nowrap; }
.grant .rules { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grants .cancel { margin-top: auto; padding-top: 8px; }
.grants .cancel .btn { width: 100%; }

/* ------------------------------------------------------------------ toasts */
/* top-centre, over the empty sky above the orb — never on top of the approval cards */
.toasts {
  position: fixed;
  z-index: 50;
  top: calc(var(--topbar-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 12px 10px 14px;
  background: rgba(6, 14, 26, 0.94);
  border: 1px solid var(--line);
  border-left: 2px solid var(--cyan);
  border-radius: 3px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.4s var(--ease);
  transition: opacity 0.35s, transform 0.35s;
}
.toast.warn { border-left-color: var(--amber); }
.toast.error { border-left-color: var(--red); }
.toast .tt { font-family: var(--font-display); font-size: 9.5px; letter-spacing: 0.22em; color: var(--cyan); text-transform: uppercase; }
.toast.warn .tt { color: var(--amber); }
.toast.error .tt { color: var(--red); }
.toast .tm { grid-column: 1; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.toast .x { grid-row: 1 / 3; grid-column: 2; align-self: start; background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.toast .x:hover { color: var(--text); }
.toast.leaving { opacity: 0; transform: translateY(-10px); }

/* ------------------------------------------------------------------ lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(1, 3, 7, 0.86);
  cursor: zoom-out;
  padding: 4vmin;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 100%; border: 1px solid var(--line-strong); box-shadow: 0 0 60px rgba(var(--cyan-rgb), 0.15); }

/* ------------------------------------------------------------------ boot */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(8, 24, 40, 0.9), var(--bg) 70%);
  transition: opacity 0.9s var(--ease), visibility 0.9s;
}
.boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot .inner { text-align: center; width: min(560px, 90vw); }
.boot .title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 3.4vw, 30px);
  letter-spacing: 0.32em;
  color: var(--cyan);
  text-shadow: 0 0 22px rgba(var(--cyan-rgb), 0.7);
  min-height: 1.4em;
  white-space: nowrap;
}
.boot .title::after { content: ""; display: inline-block; width: 0.55em; height: 0.9em; margin-left: 0.2em; vertical-align: -0.1em; background: var(--cyan); animation: blink 0.8s steps(2) infinite; }
.boot .log {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-faint);
  text-align: left;
  display: inline-block;
  min-height: 7.2em;
}
.boot .log .ok { color: var(--cyan); }
.boot .bar { margin: 16px auto 0; width: 220px; height: 1px; background: var(--line); overflow: hidden; }
.boot .bar i { display: block; height: 100%; width: 0; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width 0.25s linear; }
.boot .scan { position: absolute; left: 0; right: 0; height: 120px; top: -120px; background: linear-gradient(180deg, transparent, rgba(var(--cyan-rgb), 0.06), transparent); animation: scan 2.2s linear infinite; }

/* ------------------------------------------------------------------ TV + ORB modes */
.tv-layer { display: none; }

body.mode-tv .topbar,
body.mode-tv .col,
body.mode-tv .bottom,
body.mode-tv .talk,
body.mode-tv .hints,
body.mode-tv .protocols,
body.mode-tv .modes-row,
body.mode-tv .devices-line,
body.mode-tv .banner,
body.mode-tv .corner-meta { display: none !important; }
body.mode-tv .layout { display: block; height: 100vh; height: 100dvh; padding: 0; }
body.mode-tv .center { position: absolute; inset: 0; }
body.mode-tv .caption { bottom: 8vh; width: min(1200px, 86vw); }
body.mode-tv .caption .mode { font-size: clamp(12px, 1.1vw, 20px); }
body.mode-tv .caption .subtitle { font-size: clamp(20px, 2.5vw, 44px); color: var(--text); line-height: 1.35; margin-top: 1.2vh; -webkit-line-clamp: 3; }
body.mode-tv .tv-layer { display: block; position: fixed; z-index: 2; inset: 0; pointer-events: none; }
body.mode-tv .tv-clock { position: absolute; top: 5vh; left: 5vw; }
body.mode-tv .tv-clock .t { font-family: var(--font-display); font-weight: 600; font-size: clamp(44px, 7vw, 140px); letter-spacing: 0.06em; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(var(--cyan-rgb), 0.25); }
body.mode-tv .tv-clock .d { margin-top: 1.2vh; font-family: var(--font-display); font-size: clamp(11px, 1.1vw, 20px); letter-spacing: 0.36em; color: var(--text-dim); text-transform: uppercase; }
body.mode-tv .tv-brand { position: absolute; top: 5vh; right: 5vw; text-align: right; font-family: var(--font-display); font-weight: 800; font-size: clamp(14px, 1.4vw, 26px); letter-spacing: 0.4em; color: var(--cyan); text-shadow: 0 0 18px rgba(var(--cyan-rgb), 0.5); }
body.mode-tv .tv-brand small { display: block; margin-top: 8px; font-family: var(--font-mono); font-weight: 400; font-size: clamp(10px, 0.8vw, 14px); letter-spacing: 0.2em; color: var(--text-faint); }
body.mode-tv.idle-cursor,
body.mode-tv.idle-cursor * { cursor: none !important; }

body.mode-orb { background: radial-gradient(circle at 50% 50%, #071526 0%, var(--bg) 70%); }
body.mode-orb .backdrop,
body.mode-orb .topbar,
body.mode-orb .col,
body.mode-orb .bottom,
body.mode-orb .talk,
body.mode-orb .hints,
body.mode-orb .protocols,
body.mode-orb .modes-row,
body.mode-orb .devices-line,
body.mode-orb .banner,
body.mode-orb .corner-meta { display: none !important; }
body.mode-orb .layout { display: block; height: 100vh; height: 100dvh; padding: 0; }
body.mode-orb .center { position: absolute; inset: 0; }
body.mode-orb .caption { bottom: 6px; width: 94%; }
body.mode-orb .caption .mode { font-size: 8.5px; letter-spacing: 0.34em; }
body.mode-orb .caption .subtitle { font-size: 11px; margin-top: 3px; -webkit-line-clamp: 1; min-height: 0; }
body.mode-orb .toasts { top: 8px; width: calc(100vw - 16px); }
body.mode-orb .toast { padding: 6px 8px 6px 10px; }
body.mode-orb .toast .tm { font-size: 11.5px; }

/* ------------------------------------------------------------------ responsive */
/* short laptop screens: keep Approve/Deny on screen without scrolling the card */
@media (min-width: 1200px) and (max-height: 880px) {
  .bottom { height: 178px; }
  .hints { display: none; }
  .protocols { margin-top: 8px; }
  .modes-row, .devices-line { margin-top: 5px; }
  .approval { padding: 10px 10px 9px; }
  .approval .summary { font-size: 13px; margin-bottom: 6px; }
  .approval pre { max-height: 78px; margin-bottom: 8px; font-size: 11px; }
  .approval .life { margin-bottom: 8px; }
  .col-right #pApprovals { max-height: 68%; }
  .caption .subtitle { -webkit-line-clamp: 1; font-size: 14px; }
}

@media (max-width: 1199px) {
  .status-line { flex: 0 1 auto; }
  .status-line .sep { display: none; }
  .top-right { margin-left: auto; min-width: 0; }
  .node-dots { min-width: 0; overflow: hidden; }
}
@media (max-width: 1023px) {
  .status-line,
  .weather,
  .brand .mark { display: none; }
  .node-dot { font-size: 0; gap: 0; }   /* dots only; names stay in the tooltip */
}
@media (max-width: 1199px) {
  body:not(.mode-tv):not(.mode-orb) .layout {
    height: auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "center center"
      "right left"
      "bottom bottom";
  }
  body:not(.mode-tv):not(.mode-orb) .center { height: min(64vh, 640px); }
  .col-right, .col-left { min-height: 460px; }
  .bottom { height: auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bottom .panel { min-height: 200px; }
  .col-right #pApprovals { max-height: none; }
  .corner-meta { display: none; }
}

@media (max-width: 767px) {
  :root { --gap: 12px; --topbar-h: 52px; }
  .topbar { padding: 0 14px; gap: 12px; }
  .wordmark { font-size: 15px; letter-spacing: 0.26em; }
  .brand .mark,
  .status-line,
  .node-dots,
  .weather { display: none; }
  .top-right { margin-left: auto; gap: 12px; }
  .clock .time { font-size: 15px; }
  body:not(.mode-tv):not(.mode-orb) .layout {
    padding: 12px 16px 20px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "center"
      "right"
      "bottom"
      "left";
  }
  body:not(.mode-tv):not(.mode-orb) .center { height: auto; }
  body:not(.mode-tv):not(.mode-orb) .orb-wrap { flex: none; height: min(78vw, 400px); }
  .caption { bottom: 0; }
  .caption .subtitle { font-size: 13.5px; }
  .col-right, .col-left { min-height: 0; }
  .col-right #pTranscript { height: 380px; flex: none; }
  .col-left .panel { max-height: 360px; }
  .bottom { grid-template-columns: minmax(0, 1fr); }
  .bottom .panel { min-height: 0; max-height: 340px; }
  .hints { display: none; }
  .talk { gap: 8px; }
  .task { width: 100%; }
  .tasks .panel-body { flex-direction: column; overflow-x: hidden; overflow-y: auto; }
  .task .shot { max-height: none; }
  /* phones: skip the live blur — the panels are nearly opaque anyway and scrolling stays smooth */
  .panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: linear-gradient(180deg, rgba(8, 20, 34, 0.9), rgba(5, 13, 24, 0.92)); }
}

/* ------------------------------------------------------------------ motion */
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes panel-in { to { opacity: 1; transform: none; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes approval-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
@keyframes approval-glow { 50% { box-shadow: 0 0 22px rgba(var(--amber-rgb), 0.28); border-color: rgba(var(--amber-rgb), 0.75); } }
@keyframes scan { to { top: 100%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .panel { opacity: 1; transform: none; }
  .boot .scan { display: none; }
}

/* ------------------------------------------------------------------ auth + setup pages */
.page-auth,
.page-setup { min-height: 100vh; min-height: 100dvh; }
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth-card { width: min(400px, 100%); text-align: center; }
.auth-orb { position: relative; width: 100%; height: 280px; margin-bottom: 6px; }
.auth-orb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-card .wordmark { font-size: 22px; display: block; margin-bottom: 6px; }
.auth-card .lede { color: var(--text-faint); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--font-mono); margin: 0 0 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card .err { min-height: 18px; color: var(--red); font-size: 12.5px; }
.auth-card.shake { animation: shake 0.45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(4, 12, 22, 0.8);
  color: var(--text);
  font: 15px var(--font-body);
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(var(--cyan-rgb), 0.08); }
.input::placeholder { color: var(--text-faint); }
select.input { cursor: pointer; }
select.input option { background: var(--bg-2); color: var(--text); }
textarea.input { height: auto; min-height: 92px; padding: 10px 14px; resize: vertical; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.btn.block { flex: none; width: 100%; height: 44px; font-size: 11px; }

.setup-shell { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 26px 16px 80px; }
.setup-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.setup-head .wordmark { font-size: 18px; }
.setup-head .crumb { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.3em; color: var(--text-faint); }
.setup-head .spacer { flex: 1; }
.setup-head a.back { color: var(--text-dim); text-decoration: none; font-size: 13px; border: 1px solid var(--line); padding: 7px 14px; border-radius: 2px; }
.setup-head a.back:hover { color: var(--cyan); border-color: var(--line-strong); }
.setup-grid { display: grid; gap: var(--gap); }
.setup-grid .panel { animation-delay: 0.05s; }
.setup-grid .panel-body { overflow: visible; padding: 16px 18px 18px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fields .wide { grid-column: 1 / -1; }
.field label { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 6px; }
.field label .state { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.field label .state.set { color: var(--cyan); }
.help { font-size: 11.5px; color: var(--text-faint); }
.field .help { margin-top: 5px; }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row output { font-family: var(--font-mono); font-size: 13px; color: var(--cyan); min-width: 42px; text-align: right; }
input[type="range"] { flex: 1; accent-color: var(--cyan); }
.save-bar {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  margin-top: var(--gap);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: rgba(5, 12, 22, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 3px;
}
.save-bar .msg-line { flex: 1; font-size: 12.5px; color: var(--text-faint); }
.save-bar .btn { flex: none; min-width: 160px; }
.pair-box { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.pair-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 8vw, 54px);
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(var(--cyan-rgb), 0.55);
  font-variant-numeric: tabular-nums;
}
.pair-timer { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }
.pair-timer.low { color: var(--red); }
.cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-x: auto;
}
.cmd code { flex: 1; white-space: nowrap; color: var(--text); }
.hidden { display: none !important; }

@media (max-width: 767px) {
  .fields { grid-template-columns: minmax(0, 1fr); }
  .save-bar { flex-wrap: wrap; }
  .save-bar .btn { width: 100%; }
  .auth-orb { height: 220px; }
}

/* ---- Mark II setup: toggles, forwarding codes, authenticator QR ---- */
.toggle-row { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; color: var(--text); font-size: 13px; }
.toggle-row input.toggle { appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 20px; margin: 0; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.4); position: relative; cursor: pointer; transition: background 0.2s var(--ease); }
.toggle-row input.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-faint); transition: transform 0.2s var(--ease), background 0.2s var(--ease); }
.toggle-row input.toggle:checked { background: rgba(var(--cyan-rgb), 0.18); }
.toggle-row input.toggle:checked::after { transform: translateX(18px); background: var(--cyan); box-shadow: 0 0 10px rgba(var(--cyan-rgb), 0.6); }
.toggle-row input.toggle:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }
.info-box { margin-top: 18px; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(0, 0, 0, 0.2); }
.info-box .cmd { margin-top: 8px; }
.info-box .cmd .help { flex: 1; white-space: nowrap; }
.info-box .cmd code { flex: none; min-width: 12ch; color: var(--cyan); }
.qr-box { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.qr-box img.qr { flex: none; width: 180px; height: 180px; padding: 8px; background: #fff; border-radius: var(--radius); }
.qr-box .qr-side { flex: 1; min-width: 240px; }
.qr-box .qr-side a { color: var(--cyan); }
