/* JARVIS HUD — monochrome (black / white / gray) */
:root {
  color-scheme: dark;
  --bg: #000000;
  --bg-elev: #0a0a0a;
  --line: rgba(255, 255, 255, 0.14);
  --line-bright: rgba(255, 255, 255, 0.42);
  --text: #f4f4f4;
  --text-dim: rgba(255, 255, 255, 0.55);
  --glow: 0.35;
  --scale: 1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Rajdhani", ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

/* CRT overlay off — keep pure black field behind orb */
.scanlines {
  display: none;
}

.shell {
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

/* —— Top bar —— */
.top-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: max(12px, env(safe-area-inset-top)) 16px 8px;
  z-index: 5;
}

.listen-state {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  justify-self: start;
}

.claw-badge {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(54px, calc(env(safe-area-inset-right) + 54px));
  font-family: "Orbitron", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  padding: 4px 10px 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.35);
  z-index: 30;
  animation: claw-pulse 1s ease-in-out infinite;
}
.claw-badge[hidden] { display: none !important; }

/** WEB badge — shown when Jarvis is doing a web search.
 *  Same position/styling as the Claw badge; only one shows at a time. */
.web-badge {}

@keyframes claw-pulse {
  0%, 100% { opacity: 0.85; box-shadow: 0 0 22px rgba(255, 255, 255, 0.25); }
  50%      { opacity: 1;    box-shadow: 0 0 36px rgba(255, 255, 255, 0.55); }
}

.brand {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 600;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  font-style: italic;
  color: var(--text);
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.18);
  justify-self: center;
}

.icon-btn {
  justify-self: end;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.icon-i {
  font-family: "Orbitron", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  font-style: italic;
}

/* —— Stage & HUD —— */
.stage {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 100px;
  min-height: 0;
  --voice: 0;
  background: transparent;
}

.hud-grid {
  display: none;
}

.orb-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 1;
  background: transparent;
}

#orb {
  background: transparent;
}

.ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  left: 50%;
  top: 50%;
}

.ring-outer {
  width: min(78vw, 300px);
  aspect-ratio: 1;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  animation: spin-hud calc(48s - var(--voice) * 43s) linear infinite;
}

.ring-mid {
  width: min(68vw, 260px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.4);
  border-right-color: rgba(255, 255, 255, 0.22);
  animation: spin-hud-reverse calc(28s - var(--voice) * 22s) linear infinite;
  opacity: 0.85;
}

/* Particle orb only: stack rings and HUD chrome hidden */
.orb-stack > .ring,
.orb-ring,
.orb-segments {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.stage.voice-active .ring-outer {
  border-color: rgba(255, 255, 255, calc(0.12 + var(--voice) * 0.28));
  filter: drop-shadow(0 0 calc(6px + var(--voice) * 30px) rgba(255, 255, 255, 0.5));
}

.stage.voice-active .ring-mid {
  border-color: rgba(255, 255, 255, calc(0.12 + var(--voice) * 0.22));
  border-top-color: rgba(255, 255, 255, calc(0.4 + var(--voice) * 0.35));
  opacity: calc(0.85 + var(--voice) * 0.12);
  filter: drop-shadow(0 0 calc(4px + var(--voice) * 22px) rgba(255, 255, 255, 0.35));
}

.stage.voice-active .hud-grid {
  display: none;
}

.status-line {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  min-height: 1.2em;
  text-align: center;
}

.hud-subhint {
  margin: 6px 0 0;
  text-align: center;
}

.hud-subhint__btn {
  border: none;
  background: none;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.hud-subhint__btn:active {
  color: var(--text);
}

/* —— Orb core (professional B&W globe) —— */
.orb {
  /* responsive: never wider than viewport, never taller than usable height */
  width: min(92vw, min(72vh, 640px));
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  /* Idle is solid (no scale wobble). Speaking subtle pulse is handled in canvas. */
  transform: none;
  --energy: 0.15;
}

.stage.voice-active .orb {
  transition: transform 42ms linear;
}

.orb-core,
.orb-ring {
  position: absolute;
  border-radius: 999px;
}

.orb-canvas {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 480px) {
  .orb {
    width: min(94vw, min(60vh, 420px));
  }
}

@media (max-height: 640px) {
  .orb {
    width: min(90vw, min(58vh, 380px));
  }
}

.orb-core {
  display: none;
}

.orb-ring {
  border: 1px solid var(--line);
  inset: 15%;
  z-index: 2;
}

.orb-ring-a {
  animation: spin calc(14s - var(--voice) * 10s) linear infinite;
}

.orb-ring-b {
  inset: 6%;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.18);
  animation: spin-reverse calc(18s - var(--voice) * 12s) linear infinite;
}

/* Segmented tick ring */
.orb-segments {
  position: absolute;
  inset: -4%;
  z-index: 2;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.14) 0deg 4deg,
    transparent 4deg 12deg
  );
  mask-image: radial-gradient(circle, transparent 58%, black 59%, black 68%, transparent 69%);
  opacity: 0.35;
  pointer-events: none;
  animation: spin calc(60s - var(--voice) * 52s) linear infinite;
}

.stage.voice-active .orb-segments {
  opacity: calc(0.35 + var(--voice) * 0.48);
}

/* —— Bottom dock —— */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.07));
  border: 1px solid var(--line);
  border-radius: 999px;
  z-index: 20;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.65);
}

.dock-item {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.dock-item:hover:not(:disabled) {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.dock-item.is-armed {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.dock-item:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dock-item.dock-mic {
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.35);
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.8));
  box-shadow: 0 0 28px rgba(255, 255, 255, 0.12);
}

.dock-item.dock-mic:not(:disabled):active,
#talkBtn.active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.55);
}

.dock-svg {
  width: 22px;
  height: 22px;
}

.dock-mic .mic-svg {
  width: 26px;
  height: 26px;
}

/* Two-icon dock buttons (on / off swap by class) */
.dock-item .icon-off,
.dock-item.is-muted .icon-on {
  display: none;
}
.dock-item.is-muted .icon-off {
  display: inline-block;
}

#talkBtn.is-muted {
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-dim);
}
#talkBtn:not(.is-muted) {
  background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.12));
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
  box-shadow: 0 0 36px rgba(255, 255, 255, 0.3);
}
#muteBtn.is-muted {
  color: var(--text-dim);
  border-color: rgba(255, 255, 255, 0.2);
}

.helmet-svg {
  width: 24px;
  height: 24px;
}

.dock-share-wrap {
  position: relative;
}

.share-pop {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  min-width: 140px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85);
}

.share-pop[hidden] {
  display: none !important;
}

.share-pop.is-open {
  display: flex !important;
}

.share-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: inherit;
}

.share-pop-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

/* Help FAB */
.help-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 80px));
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-dim);
  font-family: "Orbitron", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 21;
}

.help-fab:hover {
  color: var(--text);
  border-color: var(--line-bright);
}

/* Camera + screen-share FABs — left side, always visible */
.camera-fab,
.screenshare-fab {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 21;
  padding: 0;
}
.camera-fab {
  bottom: max(140px, calc(env(safe-area-inset-bottom) + 124px));
}
.screenshare-fab {
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 80px));
}
.camera-fab:hover,
.screenshare-fab:hover {
  color: var(--text);
  border-color: var(--line-bright);
}
.camera-fab[hidden],
.screenshare-fab[hidden] {
  display: none !important;
}
.camera-fab.is-camera-live,
.screenshare-fab.is-screen-sharing {
  color: #4da3ff;
  border-color: #4da3ff;
  background: rgba(77, 163, 255, 0.15);
}

.jobs-fab {
  position: fixed;
  right: calc(64px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 21;
}

.jobs-fab:hover {
  color: var(--text);
  border-color: var(--line-bright);
}

/* Dialogs */
.panel-dialog {
  width: min(88vw, 400px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: #080808;
  color: var(--text);
}

.panel-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.settings-form,
.info-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
}
.settings-h3 {
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.settings-help {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}
.btn-small { padding: 6px 10px; font-size: 12px; }

.password-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.password-row input { flex: 1 1 auto; min-width: 0; }
.password-row .btn-small { flex: 0 0 auto; }

.codex-login-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  min-width: min(380px, 90vw);
}
.codex-step {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
}
.codex-step-label {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex-basis: 100%;
}
.codex-link {
  flex: 1 1 auto;
  word-break: break-all;
  color: var(--text);
  font-size: 13px;
}
.codex-link:hover { text-decoration: underline; }
.codex-code {
  flex: 1 1 auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 22px;
  letter-spacing: 0.18em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed var(--line-bright);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  user-select: all;
}
.codex-status {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}
.codex-status.is-success { color: #b6e9b6; }
.codex-status.is-error { color: #ffb3b3; }

.settings-form h2,
.info-body h2 {
  margin: 0 0 4px;
  font-family: "Orbitron", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
}

.info-body p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.55;
  font-size: 0.95rem;
}

.info-body .settings-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  word-break: break-all;
}

.info-subhead {
  margin: 6px 0 -4px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.info-thread {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 6px;
  font-size: 0.85rem;
}
.info-thread dt {
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.info-thread dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}
.info-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  color: var(--text);
}

.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.settings-form input,
.settings-form textarea {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}

.mail-hint {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.mail-reply {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}

.mail-reply.is-error {
  color: #ff8a8a;
  border-color: rgba(255, 138, 138, 0.4);
  background: rgba(255, 138, 138, 0.05);
}

/* ===== Jobs dashboard ===== */
.jobs-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-width: 100dvw;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
}

.jobs-dialog::backdrop {
  background: var(--bg);
}

.jobs-shell {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}

.jobs-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.jobs-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.jobs-title-name,
.jobs-section h2,
.jobs-panel h2 {
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.jobs-status,
.jobs-section-meta,
.jobs-form-status {
  color: var(--text-dim);
  font-size: 12px;
}

.jobs-status.is-error,
.jobs-form-status.is-error {
  color: #ffb3b3;
}

.jobs-status.is-ok,
.jobs-form-status.is-ok {
  color: #b6e9b6;
}

.jobs-header-actions,
.jobs-actions,
.jobs-card-actions,
.jobs-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jobs-view-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.jobs-view-tab {
  min-height: 42px;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 12px;
  text-transform: uppercase;
  cursor: pointer;
}

.jobs-view-tab:last-child {
  border-right: none;
}

.jobs-view-tab.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.jobs-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.jobs-icon-btn:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.jobs-summary {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.jobs-summary[hidden],
.jobs-layout[hidden],
.jobs-agent-view[hidden],
.jobs-files-view[hidden] {
  display: none !important;
}

.jobs-agent-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 0;
}

.jobs-stat {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jobs-stat:last-child {
  border-right: none;
}

.jobs-stat-value {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: clamp(19px, 3vw, 30px);
  line-height: 1;
  color: var(--text);
  white-space: nowrap;
}

.jobs-stat-label {
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
}

.jobs-stat-detail {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jobs-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  overflow: hidden;
}

.jobs-main,
.jobs-side {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.jobs-main {
  border-right: 1px solid var(--line);
}

.jobs-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.jobs-section,
.jobs-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jobs-panel {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.jobs-panel:last-child {
  border-bottom: none;
}

.jobs-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.jobs-kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 10px;
  align-items: start;
}

.jobs-lane-tabs {
  display: none;
}

.jobs-lane {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}

.jobs-lane-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  text-transform: uppercase;
}

.jobs-lane-count {
  color: var(--text-dim);
}

.jobs-lane-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  min-height: 120px;
}

.jobs-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.jobs-card.is-good {
  border-color: rgba(182, 233, 182, 0.34);
}

.jobs-card.is-warn {
  border-color: rgba(255, 220, 140, 0.35);
}

.jobs-card.is-bad {
  border-color: rgba(255, 138, 138, 0.42);
}

.jobs-card-title,
.jobs-row-title {
  font-size: 14px;
  color: var(--text);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.jobs-card-subtitle,
.jobs-row-subtitle {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.jobs-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.jobs-chip {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jobs-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 2px;
}

.jobs-panel label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-dim);
  font-size: 12px;
}

.jobs-panel [hidden] {
  display: none !important;
}

.jobs-panel input,
.jobs-panel select,
.jobs-panel textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.jobs-panel textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.35;
}

.jobs-panel select option {
  background: #111;
  color: var(--text);
}

.jobs-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.jobs-checkbox-row {
  min-height: 58px;
  justify-content: center;
}

.jobs-checkbox-row input {
  width: auto;
  align-self: flex-start;
}

.jobs-checkbox-row {
  flex-direction: row !important;
  align-items: center;
}

.jobs-primary-btn,
.jobs-secondary-btn,
.jobs-row-btn {
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.jobs-primary-btn {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.13);
}

.jobs-primary-btn:hover,
.jobs-secondary-btn:hover,
.jobs-row-btn:hover {
  border-color: var(--line-bright);
}

.jobs-primary-btn:disabled,
.jobs-secondary-btn:disabled,
.jobs-row-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.jobs-full-btn {
  width: 100%;
}

.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jobs-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(255, 255, 255, 0.025);
}

.jobs-row-meta {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.jobs-log-tail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.jobs-log-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.jobs-log-title {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
}

.jobs-log-pre,
.jobs-repo-result {
  margin: 0;
  padding: 10px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.78);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.jobs-repo-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 76px;
  font-family: inherit;
  font-size: 12px;
}

.jobs-agent-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.jobs-agent-view[hidden] {
  display: none !important;
}

.jobs-agent-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 14px;
  min-height: 100%;
}

.jobs-agent-form-panel {
  border-bottom: none;
}

.jobs-agent-board-section {
  min-width: 0;
}

.jobs-agent-kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 10px;
  align-items: start;
}

.jobs-agent-card-prompt {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1.35;
  max-height: 96px;
  overflow: auto;
  white-space: pre-wrap;
}

.jobs-files-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.jobs-files-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  overflow: hidden;
}

.jobs-files-list-panel,
.jobs-files-preview-panel {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.jobs-files-list-panel {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jobs-files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jobs-file-row {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.jobs-file-row:hover,
.jobs-file-row.is-selected {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.075);
}

.jobs-file-row.is-active-write {
  border-color: rgba(182, 233, 182, 0.5);
}

.jobs-file-row.is-changed {
  box-shadow: inset 3px 0 0 rgba(182, 233, 182, 0.8);
}

.jobs-file-row-title {
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.jobs-file-row-path {
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.jobs-file-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.jobs-files-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jobs-file-preview-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.jobs-file-preview-head h2 {
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.jobs-file-preview-path {
  margin-top: 4px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.jobs-file-preview-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  min-width: min(320px, 40%);
}

.jobs-file-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.36);
  color: rgba(255, 255, 255, 0.84);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.jobs-file-preview-body.is-updated {
  border-color: rgba(182, 233, 182, 0.62);
  box-shadow: inset 0 0 0 1px rgba(182, 233, 182, 0.22);
}

/* ===== Agent Room ===== */
.agent-room-dialog {
  width: min(1320px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  max-width: none;
  padding: 0;
  overflow: hidden;
}

.agent-room-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(5, 7, 10, 0.98);
  color: var(--text);
}

.agent-room-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.agent-room-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.agent-room-title-name {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.agent-room-status,
.agent-room-meta,
.agent-room-mini-meta,
.agent-room-empty {
  color: var(--text-dim);
  font-size: 12px;
}

.agent-room-status.ok { color: rgba(182, 233, 182, 0.92); }
.agent-room-status.running { color: rgba(255, 220, 150, 0.95); }
.agent-room-status.error { color: rgba(255, 150, 150, 0.95); }

.agent-room-header-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.agent-room-app-btn {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
}

.agent-room-app-btn:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.agent-room-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.agent-room-icon-btn:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.agent-room-summary {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.agent-room-control-panel {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.agent-room-mission-panel {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.012);
}

.agent-room-missions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-room-mission-form,
.agent-room-mission-list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-room-mission-form input,
.agent-room-mission-form textarea,
.agent-room-mission-form select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.agent-room-mission-form input,
.agent-room-mission-form select {
  height: 32px;
  padding: 0 9px;
}

.agent-room-mission-form textarea {
  resize: vertical;
  min-height: 66px;
  max-height: 150px;
  padding: 8px 9px;
  line-height: 1.35;
}

.agent-room-mission-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.agent-room-control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.agent-room-control-item,
.agent-room-failed-panel {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
}

.agent-room-control-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-room-control-item span,
.agent-room-control-head span {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
}

.agent-room-control-item strong,
.agent-room-control-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-room-control-item strong {
  font-size: 13px;
}

.agent-room-control-item em {
  color: var(--text-dim);
  font-size: 11px;
  font-style: normal;
}

.agent-room-control-head,
.agent-room-failed-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.agent-room-failed-panel {
  border-right: 0;
}

.agent-room-failed-row {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.agent-room-failed-row div {
  min-width: 0;
}

.agent-room-failed-row strong,
.agent-room-failed-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-room-failed-row strong {
  font-size: 12px;
}

.agent-room-failed-row span {
  color: rgba(255, 170, 170, 0.92);
  font-size: 11px;
}

.agent-room-small-btn {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.agent-room-small-btn:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.agent-room-small-btn.is-danger {
  border-color: rgba(255, 150, 150, 0.42);
  color: rgba(255, 205, 205, 0.96);
}

.agent-room-stat {
  min-width: 0;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-room-stat:last-child {
  border-right: none;
}

.agent-room-stat-value {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 18px;
  line-height: 1;
}

.agent-room-stat-label {
  font-size: 12px;
  text-transform: uppercase;
}

.agent-room-stat-detail {
  color: var(--text-dim);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.agent-room-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr) minmax(260px, 340px);
  overflow: hidden;
}

.agent-room-side,
.agent-room-main {
  min-height: 0;
  overflow: auto;
  padding: 13px;
}

.agent-room-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-room-agents-panel {
  border-right: 1px solid var(--line);
}

.agent-room-memory-panel {
  border-left: 1px solid var(--line);
}

.agent-room-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agent-room-section-head {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.agent-room-section-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.agent-room-section-head h2 {
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.agent-room-forum-head {
  align-items: center;
}

.agent-room-forum-focus-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
}

.agent-room-forum-focus-btn .icon-collapse {
  display: none;
}

.agent-room-dialog.is-forum-focus .agent-room-forum-focus-btn .icon-expand {
  display: none;
}

.agent-room-dialog.is-forum-focus .agent-room-forum-focus-btn .icon-collapse {
  display: block;
}

.agent-room-dialog.is-forum-focus .agent-room-summary,
.agent-room-dialog.is-forum-focus .agent-room-control-panel,
.agent-room-dialog.is-forum-focus .agent-room-agents-panel,
.agent-room-dialog.is-forum-focus .agent-room-memory-panel {
  display: none !important;
}

.agent-room-dialog.is-forum-focus .agent-room-layout {
  grid-template-columns: minmax(0, 1fr);
}

.agent-room-dialog.is-forum-focus .agent-room-main {
  overflow: hidden;
  padding: 16px;
}

.agent-room-dialog.is-forum-focus .agent-room-messages {
  padding-right: 6px;
}

.agent-room-dialog.is-forum-focus .agent-room-message {
  max-width: min(980px, 100%);
}

.agent-room-dialog.is-forum-focus .agent-room-message.is-owner {
  align-self: flex-end;
  width: min(820px, calc(100% - 42px));
  margin-left: 0;
}

.agent-room-dialog.is-forum-focus .agent-room-message.is-agent,
.agent-room-dialog.is-forum-focus .agent-room-message.is-system {
  align-self: flex-start;
  width: min(940px, calc(100% - 42px));
  margin-right: 0;
}

.agent-room-dialog.is-forum-focus .agent-room-message-body {
  font-size: 14px;
  line-height: 1.52;
}

.agent-room-dialog.is-forum-focus .agent-room-composer.chat-composer {
  border-top-color: var(--line-bright);
}

.agent-room-task-head,
.agent-room-artifact-head,
.agent-room-skill-head {
  margin-top: 6px;
}

.agent-room-agents,
.agent-room-tasks,
.agent-room-memory,
.agent-room-artifacts,
.agent-room-skill-proposals,
.agent-room-skills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-room-agent,
.agent-room-task,
.agent-room-mission,
.agent-room-memory-item,
.agent-room-skill-proposal,
.agent-room-artifact,
.agent-room-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.agent-room-agent,
.agent-room-task,
.agent-room-mission,
.agent-room-memory-item,
.agent-room-skill-proposal,
.agent-room-artifact {
  padding: 10px;
}

.agent-room-agent.is-running,
.agent-room-mission.is-running,
.agent-room-task.is-running,
.agent-room-task.is-queued {
  border-color: rgba(255, 220, 150, 0.45);
}

.agent-room-agent.is-error,
.agent-room-mission.is-error,
.agent-room-task.is-error,
.agent-room-task.is-stopped {
  border-color: rgba(255, 150, 150, 0.5);
}

.agent-room-task.is-complete {
  border-color: rgba(182, 233, 182, 0.36);
}

.agent-room-agent-top,
.agent-room-task-top,
.agent-room-mission-top,
.agent-room-skill-proposal-top,
.agent-room-message-head {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.agent-room-agent-top strong,
.agent-room-task-top strong,
.agent-room-mission-top strong,
.agent-room-skill-proposal-top strong,
.agent-room-message-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-room-agent-top span,
.agent-room-task-top span,
.agent-room-mission-top span,
.agent-room-skill-proposal-top span,
.agent-room-message-head span {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
}

.agent-room-agent p,
.agent-room-mission p,
.agent-room-memory-item p,
.agent-room-skill-proposal p,
.agent-room-error {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.agent-room-skill-proposal em {
  display: block;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.agent-room-row-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.agent-room-mini-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow-wrap: anywhere;
}

.agent-room-error {
  color: rgba(255, 170, 170, 0.94);
}

.agent-room-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-right: 3px;
}

.agent-room-message {
  padding: 10px 11px;
}

.agent-room-message.is-owner {
  margin-left: min(64px, 12%);
  border-color: rgba(180, 210, 255, 0.42);
}

.agent-room-message.is-agent {
  margin-right: min(64px, 12%);
  border-color: rgba(182, 233, 182, 0.28);
}

.agent-room-message.is-system {
  background: rgba(255, 255, 255, 0.018);
}

.agent-room-message.is-error {
  border-color: rgba(255, 150, 150, 0.5);
}

.agent-room-message.is-thinking {
  border-color: rgba(255, 220, 150, 0.42);
  background: rgba(255, 220, 150, 0.055);
  animation: chat-thinking-glow 1.6s ease-in-out infinite;
}

.agent-room-message-body {
  margin-top: 7px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.agent-room-thinking {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-dim);
}

.agent-room-thinking-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.agent-room-thinking-head::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.48);
  animation: chat-thinking-pulse 1.2s ease-in-out infinite;
}

.agent-room-thinking-activity {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.agent-room-composer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.agent-room-composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.agent-room-composer label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
}

.agent-room-composer select,
.agent-room-composer textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
  color: var(--text);
  font: inherit;
}

.agent-room-composer select {
  height: 36px;
  padding: 0 10px;
}

.agent-room-composer textarea {
  resize: vertical;
  min-height: 78px;
  max-height: 220px;
  padding: 10px;
  line-height: 1.4;
}

.agent-room-composer select:focus,
.agent-room-composer textarea:focus {
  outline: none;
  border-color: var(--line-bright);
}

.agent-room-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-room-primary-btn,
.agent-room-secondary-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.agent-room-primary-btn {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg, #000);
  font-weight: 700;
}

.agent-room-secondary-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.agent-room-primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.agent-room-artifact {
  color: var(--text);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.agent-room-artifact:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.07);
}

.agent-room-artifact span,
.agent-room-memory-item span {
  color: var(--text-dim);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.agent-room-skill-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.agent-room-skill-tabs button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.agent-room-skill-tabs button.is-active {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.agent-room-skill-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-room-skill-editor span,
.agent-room-skill-actions span {
  color: var(--text-dim);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.agent-room-skill-editor textarea {
  width: 100%;
  min-height: 220px;
  max-height: 360px;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: 12px/1.42 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  outline: none;
}

.agent-room-skill-editor textarea:focus {
  border-color: var(--line-bright);
}

.agent-room-skill-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.btn-primary,
.btn-secondary {
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.btn-primary {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
}

@keyframes spin-hud {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes spin-hud-reverse {
  from {
    transform: translate(-50%, -50%) rotate(360deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-reverse {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.97);
  }
  50% {
    transform: scale(1.05);
  }
}

@media (max-width: 380px) {
  .dock {
    gap: 6px;
    padding: 8px 10px;
  }

  .dock-item {
    width: 40px;
    height: 40px;
  }

  .dock-item.dock-mic {
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 980px) {
  .jobs-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .jobs-main,
  .jobs-side {
    overflow: visible;
  }

  .jobs-main {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .jobs-kanban {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .jobs-log-tail {
    grid-template-columns: 1fr;
  }

  .jobs-files-layout {
    grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  }

  .agent-room-layout {
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  }

  .agent-room-memory-panel {
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: start;
  }

  .agent-room-memory-panel .agent-room-section-head,
  .agent-room-memory-panel .agent-room-memory,
  .agent-room-memory-panel .agent-room-artifact-head,
  .agent-room-memory-panel .agent-room-artifacts {
    min-width: 0;
  }
}

@media (max-width: 620px) {
  .jobs-shell {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .jobs-header {
    position: sticky;
    top: 0;
    z-index: 4;
    background: rgba(0, 0, 0, 0.94);
  }

  .jobs-view-tabs {
    position: sticky;
    top: 61px;
    z-index: 4;
  }

  .jobs-summary,
  .jobs-agent-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jobs-agent-summary {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .jobs-stat {
    padding: 8px 10px;
    min-height: 60px;
  }

  .jobs-agent-summary .jobs-stat {
    flex: 0 0 128px;
    border-right: 1px solid var(--line);
  }

  .jobs-stat-value {
    font-size: 17px;
  }

  .jobs-stat-detail {
    white-space: normal;
    line-height: 1.25;
  }

  .jobs-stat:nth-child(2n) {
    border-right: none;
  }

  .jobs-agent-summary .jobs-stat:last-child {
    border-right: 1px solid var(--line);
  }

  .jobs-layout {
    display: flex;
    flex-direction: column;
    min-height: auto;
    overflow: visible;
  }

  .jobs-kanban {
    grid-template-columns: 1fr;
  }

  .jobs-lane-tabs {
    position: sticky;
    top: 103px;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 6px 0 8px;
    background: var(--bg);
  }

  .jobs-lane-tab {
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 5px 3px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font-size: 10px;
    line-height: 1.05;
    text-transform: uppercase;
    cursor: pointer;
  }

  .jobs-lane-tab.is-active {
    border-color: var(--line-bright);
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
  }

  .jobs-lane-tab-count {
    font-family: "Orbitron", "Rajdhani", sans-serif;
    font-size: 13px;
    color: var(--text);
  }

  .jobs-lane {
    display: none;
  }

  .jobs-lane.is-active {
    display: block;
  }

  .jobs-agent-lane {
    display: none;
  }

  .jobs-agent-lane.is-active {
    display: block;
  }

  .jobs-lane-body {
    min-height: 180px;
    max-height: none;
  }

  .jobs-card {
    padding: 9px;
  }

  .jobs-card-meta {
    gap: 4px;
  }

  .jobs-chip {
    max-width: 100%;
  }

  .jobs-main,
  .jobs-side {
    padding: 10px;
  }

  .jobs-main {
    border-bottom: none;
  }

  .jobs-option-grid {
    grid-template-columns: 1fr;
  }

  .jobs-logs-section {
    margin-top: 12px;
  }

  .jobs-fab {
    right: calc(58px + env(safe-area-inset-right));
  }

  .jobs-agent-view {
    min-height: auto;
    overflow: visible;
    padding: 10px;
  }

  .jobs-agent-layout {
    grid-template-columns: 1fr;
  }

  .jobs-agent-kanban {
    grid-template-columns: 1fr;
  }

  .jobs-files-view {
    min-height: auto;
    overflow: visible;
  }

  .jobs-files-layout {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .jobs-files-list-panel,
  .jobs-files-preview-panel {
    overflow: visible;
    padding: 10px;
  }

  .jobs-files-list-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .jobs-file-preview-head {
    flex-direction: column;
  }

  .jobs-file-preview-meta {
    justify-content: flex-start;
    min-width: 0;
  }

  .jobs-file-preview-body {
    min-height: 360px;
  }

  .agent-room-dialog {
    width: calc(100vw - 14px);
    height: calc(100vh - 14px);
  }

  .agent-room-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-room-stat:nth-child(2n) {
    border-right: none;
  }

  .agent-room-layout {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }

  .agent-room-side,
  .agent-room-main {
    overflow: visible;
    padding: 10px;
  }

  .agent-room-agents-panel,
  .agent-room-memory-panel {
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .agent-room-memory-panel {
    display: flex;
  }

  .agent-room-main {
    min-height: 560px;
  }

  .agent-room-composer-row {
    grid-template-columns: 1fr;
  }

  .agent-room-message.is-owner,
  .agent-room-message.is-agent {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ===== Chat panel ===== */
.chat-dialog {
  /** Fullscreen on every breakpoint. The dialog element keeps default
   *  centering, so we pin it edge-to-edge with width/height: 100% +
   *  position:fixed inset:0 to override UA padding/margin. */
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-width: 100dvw;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
}
.chat-dialog::backdrop {
  background: var(--bg);
}
.chat-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.chat-shell.is-file-dragging::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 30;
  border: 1px dashed var(--line-bright);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.chat-shell.is-file-dragging::after {
  content: "Drop files to attach";
  position: absolute;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 31;
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text);
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  flex-shrink: 0;
}
.chat-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
.chat-title-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sessions-btn { color: var(--text); }
.chat-sessions-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-bright);
}
.chat-new-btn { color: var(--text-dim); }
.chat-new-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* Sessions drawer overlay (slides down from header). */
.chat-sessions-panel {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line-bright);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  animation: chat-sessions-slide 180ms ease-out;
}
/* The base rule above sets `display: flex`, which beats the user-agent
 * `[hidden] { display: none }`. Without this explicit !important rule the
 * sessions drawer would never close, so toggling the hamburger looked like
 * a one-way "open" instead of a true toggle. */
.chat-sessions-panel[hidden] {
  display: none !important;
}
@keyframes chat-sessions-slide {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.chat-sessions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: "Orbitron", "Rajdhani", sans-serif;
}
.chat-sessions-title {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chat-sessions-new {
  background: transparent;
  border: 1px solid var(--line-bright);
  color: var(--text);
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}
.chat-sessions-new:hover { background: rgba(255, 255, 255, 0.08); }
.chat-sessions-list {
  overflow-y: auto;
  padding: 6px 0;
}
.chat-sessions-empty {
  padding: 14px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.chat-session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 120ms ease;
}
.chat-session-item:hover { background: rgba(255, 255, 255, 0.04); }
.chat-session-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-left: 2px solid var(--text);
  padding-left: 12px;
}
.chat-session-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-session-title {
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-session-meta {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.chat-session-delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: color 120ms ease, background 120ms ease;
}
.chat-session-delete:hover {
  color: #ffb3b3;
  background: rgba(255, 90, 90, 0.12);
}
.chat-title-name {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.chat-status {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.chat-icon-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}
.chat-icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}
.chat-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.chat-icon-btn[hidden],
.chat-ai-mute-btn[hidden],
.chat-realtime-start-btn[hidden],
.chat-stop-btn[hidden] {
  display: none !important;
}
.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.chat-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 32px 24px;
}
.chat-session-divider {
  align-self: center;
  max-width: 86%;
  margin: 8px 0 2px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.42;
  word-wrap: break-word;
  white-space: pre-wrap;
  border: 1px solid var(--line);
}
.chat-msg.is-user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-bright);
  border-bottom-right-radius: 4px;
}
.chat-msg.is-assistant {
  align-self: flex-start;
  background: var(--bg-elev);
  border-bottom-left-radius: 4px;
}
.chat-msg.is-error {
  border-color: rgba(255, 90, 90, 0.6);
  background: rgba(255, 90, 90, 0.08);
}
.chat-msg-text {
  white-space: pre-wrap;
}
.chat-msg-stream-placeholder {
  color: var(--text-dim);
}
.chat-msg-stream-placeholder::after {
  content: "";
  display: inline-block;
  width: 1.1em;
  text-align: left;
  animation: chat-stream-placeholder 1.2s steps(4, end) infinite;
}
@keyframes chat-stream-placeholder {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}
.chat-msg-progress {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  white-space: normal;
  overflow: hidden;
}
.chat-msg-progress[open] {
  background: rgba(255, 255, 255, 0.045);
}
.chat-msg-progress:not([open]) .chat-msg-progress-list {
  display: none !important;
}
.chat-msg-progress summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.3;
}
.chat-msg-progress summary::-webkit-details-marker {
  display: none;
}
.chat-msg-progress summary::before {
  content: ">";
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}
.chat-msg-progress[open] summary::before {
  transform: rotate(90deg);
}
.chat-msg-progress-title {
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1 1 auto;
}
.chat-msg-progress-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}
.chat-msg-progress-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0 10px 10px;
}
.chat-msg-progress-task {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.35;
}
.chat-msg-progress-task input {
  width: 14px;
  height: 14px;
  margin: 2px 0 0;
  accent-color: var(--text);
}
.chat-msg-progress-task.is-done span {
  color: var(--text-dim);
  text-decoration: line-through;
}
.chat-msg-why {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  white-space: normal;
  overflow: hidden;
}
.chat-msg-why[open] {
  background: rgba(255, 255, 255, 0.045);
}
.chat-msg-why:not([open]) > :not(summary) {
  display: none !important;
}
.chat-msg-why summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0;
  list-style: none;
  padding: 8px 10px;
}
.chat-msg-why summary::-webkit-details-marker {
  display: none;
}
.chat-msg-why summary::before {
  content: ">";
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}
.chat-msg-why[open] summary::before {
  transform: rotate(90deg);
}
.chat-msg-why pre {
  margin: 0 10px 10px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text);
}

.chat-trace-summary-title {
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.chat-trace-summary-meta {
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

/* Trace panel: structured cards stay hidden until the disclosure is opened. */
.chat-trace-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 10px;
  max-height: min(52vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.chat-trace-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  padding: 8px 10px;
}
.chat-trace-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.chat-trace-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.chat-trace-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.chat-trace-stat-value {
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.chat-trace-tool.is-error {
  border-color: rgba(220, 70, 70, 0.55);
}
.chat-trace-tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-trace-tool-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-trace-tool-status {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  flex: 0 0 auto;
}
.chat-trace-tool.is-error .chat-trace-tool-status {
  background: rgba(220, 70, 70, 0.18);
  color: #ff8a8a;
}
.chat-trace-tool-time {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.chat-trace-kv {
  margin-top: 6px;
}
.chat-trace-kv-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 2px;
}
.chat-trace .chat-trace-kv-val {
  margin: 0;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow: auto;
  background: #050d17;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.chat-msg-text.is-streaming::after {
  content: "▍";
  margin-left: 2px;
  animation: chat-blink 1s steps(1) infinite;
  color: var(--text-dim);
}
@keyframes chat-blink {
  50% { opacity: 0; }
}

/* Claw processing indicator (shown while waiting for the first delta). */
.chat-thinking {
  align-self: flex-start;
  display: block;
  box-sizing: border-box;
  width: 78vw;
  border: 1px solid rgba(10, 132, 255, 0.72);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  background: #090b0f;
  font-size: 12px;
  color: var(--text-dim);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(10, 132, 255, 0.12), 0 10px 34px rgba(0, 0, 0, 0.44);
  animation: chat-thinking-glow 1.8s ease-in-out infinite;
  min-width: 260px;
  max-width: 560px;
  min-height: 50px;
  isolation: isolate;
}
@supports (width: min(78vw, 560px)) {
  .chat-thinking {
    width: min(78vw, 560px);
  }
}
.chat-thinking::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #0a84ff;
  opacity: 0.95;
  z-index: 0;
}
.chat-thinking-details {
  display: block;
  border-top: 1px solid var(--line);
}
.chat-thinking-details[hidden] {
  display: none !important;
}
.chat-thinking-details[open] {
  background: rgba(255, 255, 255, 0.025);
}
.chat-thinking-details:not([open]) .chat-thinking-body {
  display: none !important;
}
.chat-working-head,
.chat-thinking-summary {
  align-items: center;
  gap: 8px;
  min-width: 0;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}
.chat-working-head {
  display: grid;
  grid-template-columns: 10px max-content minmax(48px, 1fr) auto;
  min-height: 48px;
  width: 100%;
  padding: 12px 14px 12px 16px;
  background: rgba(10, 132, 255, 0.08);
}
.chat-thinking-summary {
  display: flex;
  padding: 7px 12px 7px 16px;
  cursor: pointer;
  list-style: none;
}
.chat-thinking-summary::-webkit-details-marker {
  display: none;
}
.chat-thinking-summary::before {
  content: ">";
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}
.chat-thinking-details[open] .chat-thinking-summary::before {
  transform: rotate(90deg);
}
.chat-thinking-pulse {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0a84ff;
  box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.55);
  animation: chat-thinking-pulse 1.2s ease-in-out infinite;
}
.chat-working-title,
.chat-thinking-title {
  flex: 0 0 auto;
  color: var(--text);
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chat-working-title {
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-shadow: 0 0 12px rgba(10, 132, 255, 0.32);
}
.chat-thinking-title {
  color: var(--text-dim);
}
.chat-working-latest {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(235, 235, 218, 0.78);
  letter-spacing: 0;
  font-size: 12px;
}
.chat-thinking-count {
  flex: 0 0 auto;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font: 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.chat-thinking-body {
  padding: 0 10px 10px;
  border-top: 1px solid var(--line);
  max-height: min(52vh, 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.chat-thinking-activity {
  white-space: pre-wrap;
  text-transform: none;
  letter-spacing: 0;
  font: 11.5px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text-dim);
  padding-top: 8px;
}
.chat-thinking-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
  min-width: 23px;
}
.chat-thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: chat-thinking-bounce 1.2s ease-in-out infinite;
}
.chat-thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.chat-thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-thinking-pulse {
  0% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.55);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(10, 132, 255, 0);
  }
  100% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(10, 132, 255, 0);
  }
}
@keyframes chat-thinking-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
@keyframes chat-thinking-glow {
  0%, 100% { border-color: rgba(10, 132, 255, 0.44); }
  50% { border-color: rgba(10, 132, 255, 0.86); }
}

/* Rich live tool result cards during Claw runs */
.chat-tool-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.chat-tool-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 12px;
  overflow: hidden;
}
.chat-tool-card.is-running {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.04);
}
.chat-tool-card.is-success {
  border-color: rgba(70, 170, 110, 0.55);
}
.chat-tool-card.is-error {
  border-color: rgba(220, 70, 70, 0.55);
}
.chat-tool-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  list-style: none;
}
.chat-tool-summary::-webkit-details-marker {
  display: none;
}
.chat-tool-summary::before {
  content: ">";
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  transform: rotate(0deg);
  transition: transform 0.12s ease;
}
.chat-tool-card[open] .chat-tool-summary::before {
  transform: rotate(90deg);
}
.chat-tool-summary:hover {
  background: rgba(255,255,255,0.04);
}
.chat-tool-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  opacity: 1;
}
.chat-tool-name {
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-tool-status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.chat-tool-card.is-success .chat-tool-status { background: rgba(70, 170, 110, 0.16); color: #9fd8b0; }
.chat-tool-card.is-error .chat-tool-status { background: rgba(220, 70, 70, 0.18); color: #ff8a8a; }
.chat-tool-duration {
  font-size: 10px;
  color: var(--muted);
  margin-left: 4px;
}
.chat-tool-body {
  display: none;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}
.chat-tool-card[open] .chat-tool-body,
.chat-tool-card.is-open .chat-tool-body {
  display: block;
}
.chat-tool-args,
.chat-tool-output {
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
  background: #050d17;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
  margin: 4px 0;
}
.chat-tool-args-label,
.chat-tool-output-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b8aa8;
  margin-top: 6px;
  margin-bottom: 2px;
}
.chat-tool-output.is-error {
  border-color: #5a2a2a;
  color: #f0a0a0;
}

.chat-mic-btn {
  touch-action: none; /* Prevents long-press / scroll on touch during PTT hold. */
  user-select: none;
  -webkit-user-select: none;
}
.chat-mic-btn.is-recording {
  background: rgba(255, 90, 90, 0.22);
  border-color: rgba(255, 90, 90, 0.7);
  color: #ffb3b3;
  transform: scale(1.05);
  animation: chat-mic-pulse 1.1s ease-in-out infinite;
}
.chat-new-inline-btn,
.chat-realtime-start-btn,
.chat-ai-mute-btn,
.chat-mic-btn.is-realtime {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--text-dim);
}
.chat-new-inline-btn:hover:not(:disabled),
.chat-realtime-start-btn:hover:not(:disabled),
.chat-ai-mute-btn:hover:not(:disabled),
.chat-mic-btn.is-realtime:hover:not(:disabled) {
  color: var(--text);
}
.chat-mic-btn.is-realtime.is-live,
.chat-ai-mute-btn:not(.is-muted) {
  color: var(--text);
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.12);
}
.chat-mic-btn.is-realtime.is-muted,
.chat-ai-mute-btn.is-muted {
  color: var(--text-dim);
}
.chat-mic-btn .icon-off,
.chat-ai-mute-btn .icon-off { display: none; }
.chat-mic-btn.is-realtime.is-muted .icon-on,
.chat-ai-mute-btn.is-muted .icon-on { display: none; }
.chat-mic-btn.is-realtime.is-muted .icon-off,
.chat-ai-mute-btn.is-muted .icon-off { display: block; }
@keyframes chat-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 90, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(255, 90, 90, 0); }
}

.chat-msg-top-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Per-message copy + TTS playback buttons (assistant bubbles only). */
.chat-msg-copy,
.chat-msg-speak {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.chat-msg.is-assistant { position: relative; padding-right: 66px; }
.chat-msg-copy:hover,
.chat-msg-speak:hover { opacity: 1; color: var(--text); background: rgba(255, 255, 255, 0.06); }
.chat-msg-copy.did-copy {
  opacity: 1;
  color: var(--text);
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.1);
}
.chat-msg-speak.is-speaking {
  opacity: 1;
  color: var(--text);
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.1);
  animation: chat-mic-pulse 1.2s ease-in-out infinite;
}
.chat-msg-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.05em;
}
.chat-msg-attachments {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}
.chat-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 13px;
  color: var(--text);
}
.chat-attachment-chip .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.chat-attachment-chip .size {
  color: var(--text-dim);
  font-size: 11px;
}
.chat-attachment-chip.chat-attachment-image {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 6px;
  max-width: 240px;
}
.chat-attachment-thumb {
  display: block;
  max-width: 228px;
  max-height: 228px;
  border-radius: 8px;
  object-fit: cover;
}
.chat-attachment-chip.chat-attachment-image .meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
}
.chat-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px 0;
  flex-shrink: 0;
}
.chat-pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  background: var(--bg-elev);
}
.chat-pending-chip .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.chat-pending-chip .thumb {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.chat-pending-chip.has-thumb {
  padding-left: 6px;
}
.chat-pending-chip .remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
}
.chat-pending-chip.is-uploading {
  opacity: 0.6;
}
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  flex-shrink: 0;
  flex-wrap: wrap;
  row-gap: 8px;
}
.chat-composer.is-realtime .chat-attach-btn,
.chat-composer.is-realtime .chat-composer-pills,
.chat-composer.is-realtime .chat-input,
.chat-composer.is-realtime .chat-new-inline-btn,
.chat-composer.is-realtime .chat-send-btn {
  display: none !important;
}
.chat-composer.is-realtime {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 10px;
}
/* Realtime: skip the ⋯ menu — mic sits inline with camera / mute / stop */
.chat-composer.is-realtime .chat-voice-more-btn {
  display: none !important;
}
.chat-composer.is-realtime .chat-voice-more-wrap {
  display: contents;
}
.chat-composer.is-realtime .chat-voice-more-menu {
  display: flex !important;
  position: static;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.chat-composer.is-realtime .chat-voice-more-menu[hidden] {
  display: flex !important;
}
.chat-composer.is-realtime .chat-voice-more-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 0;
}
.chat-composer.is-realtime .chat-realtime-start-btn {
  display: none !important;
}
.chat-camera-btn[hidden],
.chat-screenshare-btn[hidden] {
  display: none !important;
}
/* Camera live state — button glows when streaming */
.chat-camera-btn.is-camera-live,
.chat-camera-btn.is-camera-watching,
.chat-screenshare-btn.is-screen-sharing {
  color: #4da3ff;
  border-color: #4da3ff;
  background: rgba(77, 163, 255, 0.12);
}
.chat-camera-btn.is-camera-watching,
.chat-screenshare-btn.is-screen-watching {
  color: #6ee7a0;
  border-color: #6ee7a0;
  background: rgba(110, 231, 160, 0.12);
}
/* Camera PiP wrapper — positions the preview + flip button together */
.chat-camera-pip-wrap,
.dock-camera-pip-wrap {
  position: absolute;
  right: 14px;
  z-index: 20;
}
.chat-camera-pip-wrap { bottom: 70px; }
.dock-camera-pip-wrap { bottom: 90px; }
.chat-camera-pip-wrap[hidden],
.dock-camera-pip-wrap[hidden] { display: none !important; }

/* Camera PiP preview — chat panel */
.chat-camera-preview,
.dock-camera-preview {
  display: block;
  width: 110px;
  height: 82px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #4da3ff;
  background: #000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* Flip button overlaid on top-left corner of the PiP */
.camera-flip-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.camera-flip-btn[hidden],
.camera-watch-btn[hidden],
.screen-watch-btn[hidden] { display: none !important; }
.camera-watch-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.camera-watch-btn.is-watching {
  color: #6ee7a0;
  border-color: #6ee7a0;
  background: rgba(110, 231, 160, 0.2);
}

/** Pills group (Plan dropdown + Think + Why). Inline group on wide screens,
 *  jumps to its own full-width row above the input on narrow viewports. */
.chat-composer-pills {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 1 auto;
}

@media (max-width: 640px) {
  .chat-composer-pills {
    order: -1;            /* row 1: pills */
    flex-basis: 100%;
    overflow-x: visible;
    flex-wrap: wrap;
    row-gap: 8px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .chat-composer-pills::-webkit-scrollbar { display: none; }
  /* On mobile we lose extra horizontal space — let the textarea breathe. */
  .chat-input { flex: 1 1 0; min-width: 0; }
}
.chat-input {
  flex: 1 1 auto;
  resize: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  max-height: 140px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-input:focus {
  border-color: var(--line-bright);
}
.chat-send-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-bright);
}
.chat-send-btn:disabled {
  background: transparent;
  border-color: transparent;
}

/* === Stop button (visible only while a response is streaming) ============ */
.chat-stop-btn {
  background: rgba(220, 70, 70, 0.18);
  border-color: rgba(220, 70, 70, 0.55);
  color: #ff8a8a;
}
.chat-stop-btn:hover:not(:disabled) {
  background: rgba(220, 70, 70, 0.28);
  border-color: rgba(220, 70, 70, 0.75);
}
.chat-stop-btn[hidden] {
  display: none !important;
}

/* === Per-message edit / delete actions =================================== */
.chat-msg {
  position: relative;
}
.chat-msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  /* Always visible — touch devices don't have :hover, and hover-only hid
   * Edit & Resend on phones. Subtle by default, brighter on hover/focus. */
  opacity: 0.55;
  transition: opacity 0.12s ease;
}
.chat-msg:hover .chat-msg-actions,
.chat-msg:focus-within .chat-msg-actions,
.chat-msg-actions:hover {
  opacity: 1;
}
.chat-msg-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted, rgba(220, 225, 240, 0.7));
  border-radius: 6px;
  padding: 2px 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.chat-msg-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text, #fff);
}
.chat-msg-delete:hover {
  color: #ff8a8a;
  border-color: rgba(220, 70, 70, 0.6);
  background: rgba(220, 70, 70, 0.12);
}

/* === Inline edit form ==================================================== */
.chat-msg-edit-form {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg-edit-input {
  width: 100%;
  resize: vertical;
  min-height: 36px;
  max-height: 220px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-bright, rgba(255, 255, 255, 0.25));
  border-radius: 6px;
  color: inherit;
  padding: 6px 8px;
  font: inherit;
  outline: none;
}
.chat-msg-edit-input:focus {
  border-color: rgba(255, 255, 255, 0.5);
}
.chat-msg-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.chat-msg-edit-cancel,
.chat-msg-edit-save,
.chat-msg-edit-resend {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: inherit;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.chat-msg-edit-save {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.45);
}
.chat-msg-edit-resend {
  background: rgba(120, 170, 255, 0.18);
  border-color: rgba(120, 170, 255, 0.55);
  color: #cfe0ff;
}
.chat-msg-edit-cancel:hover { background: rgba(255, 255, 255, 0.06); }
.chat-msg-edit-save:hover { background: rgba(255, 255, 255, 0.2); }
.chat-msg-edit-resend:hover {
  background: rgba(120, 170, 255, 0.28);
  border-color: rgba(120, 170, 255, 0.75);
}
@media (max-width: 480px) {
  .chat-msg {
    max-width: 92%;
  }
}

/* === Queued-prompt chip (visible only while a queued message is parked) ==== */
.chat-queued {
  padding: 6px 10px 0;
}
.chat-queued[hidden] { display: none !important; }

.chat-mode-nudge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 10px 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-dim);
}
.chat-mode-nudge.is-intervention {
  border-color: #0866c6;
  background: #0a84ff;
  color: #fff;
  font-size: 12px;
}
.chat-mode-nudge[hidden] {
  display: none !important;
}
.chat-mode-nudge-text {
  flex: 1;
  color: inherit;
}
.chat-mode-nudge-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.chat-mode-nudge-accept {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  color: #0a84ff;
  cursor: pointer;
}
.chat-mode-nudge-accept:hover {
  background: #000;
  border-color: #000;
}
.chat-mode-nudge-reject {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: transparent;
  color: #333;
  cursor: pointer;
}
.chat-mode-nudge-reject:hover {
  color: #000;
  border-color: rgba(0, 0, 0, 0.6);
}

.chat-queued-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px dashed var(--line-bright);
  border-radius: 10px;
  background: var(--bg-elev);
  position: relative;
}
.chat-queued-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chat-queued-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  /* keep the chip compact; long prompts truncate visually */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-queued-attachments {
  font-size: 11px;
  color: var(--text-dim);
}
.chat-queued-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
}
.chat-queued-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 3px 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.chat-queued-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-bright);
  color: var(--text);
}
.chat-queued-btn.chat-queued-send {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-bright);
  color: var(--text);
}
.chat-queued-btn.chat-queued-send:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--text);
}

/* -----------------------------------------------------------------
 * Composer pills: Think / Why / Mode (Agent·Plan·Ask) share .chat-select-pill.
 * Plan wizard dialog follows below.
 * ----------------------------------------------------------------- */
.chat-select-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text, #d8d8d8);
  font-size: 12px;
  line-height: 1;
  height: 32px;
  min-width: 0;
}
.chat-select-pill:hover {
  border-color: var(--line-bright, rgba(255, 255, 255, 0.24));
  background: rgba(255, 255, 255, 0.06);
}
.chat-select-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim, rgba(255, 255, 255, 0.6));
}
.chat-select.chat-select-embedded {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  color: inherit;
  border: 0;
  font: inherit;
  padding: 2px 18px 2px 2px;
  height: 24px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 10px) 50%, calc(100% - 5px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.chat-select.chat-select-embedded option {
  background: #1a1a1a;
  color: #e8e8e8;
}

.chat-compose-mode-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
/** Agent / Plan / Ask — always visible like other composer pills */
.chat-compose-mode-dropdown.compose-mode-visible {
  padding: 4px 6px 4px 8px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}
.chat-compose-mode-dropdown.compose-mode-visible .chat-compose-mode-trigger {
  border: 0;
  background: transparent;
  padding: 0;
  height: 24px;
  min-height: 24px;
  color: var(--text, #e6e6e6);
  font-size: 12px;
  font-weight: 600;
}
.chat-compose-mode-dropdown.compose-mode-visible .chat-compose-mode-trigger-ico,
.chat-compose-mode-dropdown.compose-mode-visible .chat-compose-mode-trigger-chevron {
  opacity: 0.75;
}
.chat-compose-mode-dropdown.compose-mode-visible .mode-suggest-chip {
  display: none;
}
.chat-compose-mode-dropdown.compose-mode-visible.is-open .mode-suggest-chip {
  display: inline-flex;
}

.chat-composer-more-wrap,
.chat-voice-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.chat-composer-more-btn,
.chat-voice-more-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.chat-composer-more-btn:hover,
.chat-voice-more-btn:hover,
.chat-composer-more-wrap.is-open .chat-composer-more-btn,
.chat-voice-more-wrap.is-open .chat-voice-more-btn {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}
.chat-composer-more-menu,
.chat-voice-more-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 154px;
  padding: 6px;
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  background: var(--bg-elev, #0a0a0a);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  z-index: 65;
}
.chat-voice-more-menu {
  min-width: 96px;
}
.chat-composer-more-menu[hidden],
.chat-voice-more-menu[hidden] {
  display: none !important;
}
/** Stack extra composer pills (trace today; more later) */
.chat-composer-more-items {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.chat-composer-more-items .chat-select-pill {
  width: 100%;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .chat-composer-more-menu {
    left: 0;
    right: auto;
  }
}
.chat-composer-more-actions,
.chat-voice-more-actions {
  display: grid;
  grid-template-columns: repeat(2, 40px);
  gap: 8px;
  align-items: center;
  justify-content: end;
  padding: 2px;
}
.chat-composer-more-action,
.chat-voice-more-action {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: var(--text-dim);
}
.chat-composer-more-action:hover:not(:disabled),
.chat-voice-more-action:hover:not(:disabled) {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.chat-compose-mode-trigger {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.16));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #e6e6e6);
  font: inherit;
  font-size: 12px;
  height: 32px;
  cursor: pointer;
  white-space: nowrap;
}
.chat-compose-mode-trigger:hover,
.chat-compose-mode-dropdown.is-open .chat-compose-mode-trigger {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.chat-compose-mode-dropdown.compose-mode-visible:hover,
.chat-compose-mode-dropdown.compose-mode-visible.is-open {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}
.chat-compose-mode-trigger-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim, rgba(255, 255, 255, 0.6));
}
.chat-compose-mode-trigger-label {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.chat-compose-mode-trigger-label.is-updated {
  color: #0a84ff;
}

.mode-forced-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(10, 132, 255, 0.22);
  color: #0a84ff;
  margin-left: 4px;
  align-self: center;
  line-height: 1.1;
}
.chat-compose-mode-trigger-chevron {
  display: inline-flex;
  align-items: center;
  opacity: 0.85;
}
.chat-compose-mode-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 260px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 4px;
  background: var(--bg-elev, #0a0a0a);
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-compose-mode-menu[hidden] {
  display: none !important;
}
.chat-compose-mode-option {
  appearance: none;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font: inherit;
}
.chat-compose-mode-option:hover {
  background: rgba(255, 255, 255, 0.06);
}
.chat-compose-mode-option.is-selected {
  background: rgba(255, 255, 255, 0.1);
  outline: 1px solid var(--line-bright);
}

.mode-rec-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.32);
  color: #fff;
  letter-spacing: 0.3px;
  align-self: center;
}
.chat-compose-mode-option.is-recommended {
  outline: 1px solid #0866c6;
  background: #0a84ff;
  color: #fff;
}
.chat-compose-mode-option.is-recommended:hover {
  background: #0a74e6;
}
.chat-compose-mode-option.is-recommended .chat-compose-mode-option-title { color: #fff; }
.chat-compose-mode-option.is-recommended .chat-compose-mode-option-desc { color: #dbe9ff; }
.mode-rec-use-btn {
  margin-top: 4px;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  color: #0a84ff;
  cursor: pointer;
}
.mode-rec-use-btn:hover {
  background: #000;
  border-color: #000;
}
.mode-suggest-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #0866c6;
  background: #0a84ff;
  color: #fff;
  cursor: pointer;
  margin-left: 4px;
  white-space: nowrap;
}
.mode-suggest-chip:hover {
  background: #0a74e6;
  border-color: #0959a6;
}

.chat-agent-triage-panel[hidden] {
  display: none !important;
}
/** Agent clarify uses the same inline card as Plan (is-plan.is-agent-clarify). */
.chat-msg.is-agent-clarify .plan-card-hero-summary {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}
.chat-agent-triage-panel .chat-agent-triage-title {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.chat-post-triage-nudge .chat-mode-nudge-accept[data-action="ask"] {
  display: none;
}
.chat-compose-mode-option-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.02em;
}
.chat-compose-mode-option-desc {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-dim);
}

/* Plan-wizard dialog -------------------------------------------------- */
.chat-plan-md-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  color: #e6e6e6;
}
.chat-plan-md-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.chat-plan-md-dialog-inner {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev, #0a0a0a);
  border: 1px solid var(--line-bright);
  border-radius: 14px;
  overflow: hidden;
  max-height: calc(100vh - 40px);
}
.chat-plan-md-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-plan-md-head-copy { flex: 1 1 auto; min-width: 0; }
.chat-plan-md-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-plan-md-path {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.chat-plan-md-format-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: #e8b86a;
}
.chat-plan-md-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-plan-md-tab {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
}
.chat-plan-md-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.chat-plan-md-tab.is-active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.1);
  border-bottom-color: var(--bg-elev, #0a0a0a);
  background: rgba(255, 255, 255, 0.06);
}
.chat-plan-md-preview {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: 50vh;
  margin: 12px 16px 0;
  padding: 14px 16px;
  overflow: auto;
  background: var(--bg, #000);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.chat-plan-md-preview h2 {
  margin: 1.35em 0 0.45em;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9fd4ff;
  border-bottom: 1px solid rgba(159, 212, 255, 0.2);
  padding-bottom: 0.35em;
}
.chat-plan-md-preview h2:first-child { margin-top: 0; }
.chat-plan-md-preview h3 {
  margin: 1em 0 0.35em;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.chat-plan-md-preview p { margin: 0.5em 0; }
.chat-plan-md-preview ul { margin: 0.4em 0 0.6em 1.1em; padding: 0; }
.chat-plan-md-preview li { margin: 0.25em 0; }
.chat-plan-md-preview pre {
  margin: 0.6em 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}
.chat-plan-md-preview code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}
.chat-plan-md-preview .pw-task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0.35em 0;
  padding: 4px 0;
}
.chat-plan-md-preview .pw-task input { margin-top: 3px; flex-shrink: 0; }
.chat-plan-md-preview .pw-task.is-done span { opacity: 0.55; text-decoration: line-through; }
.plan-mermaid-host {
  margin: 0.75em 0 1em;
  padding: 12px;
  min-height: 180px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(159, 212, 255, 0.25);
  overflow: auto;
}
.plan-mermaid-svg {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.plan-mermaid-svg svg {
  max-width: 100%;
  height: auto;
}
.plan-mermaid-err,
.plan-mermaid-missing-hint {
  font-size: 11px;
  color: #e8b86a;
  margin: 0 0 10px;
}
.plan-mermaid-fallback {
  margin: 0;
  font-size: 11px;
  opacity: 0.85;
}
.plan-card-outline {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(159, 212, 255, 0.06);
  border: 1px solid rgba(159, 212, 255, 0.15);
}
.plan-card-outline-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.plan-card-outline-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plan-card-outline-list li {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #9fd4ff;
  border: 1px solid rgba(159, 212, 255, 0.2);
}
.plan-card-hint-warn {
  color: #e8b86a;
}
.plan-card-format-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8b86a;
  border: 1px solid rgba(232, 184, 106, 0.45);
  background: rgba(232, 184, 106, 0.08);
  vertical-align: middle;
}
.chat-plan-md-editor {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: 50vh;
  margin: 12px 16px 0;
  padding: 10px 12px;
  background: var(--bg, #000);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
.chat-plan-md-editor:focus {
  outline: none;
  border-color: var(--line-bright);
}
.chat-plan-md-editor:disabled {
  background: var(--bg, #000);
  color: var(--text-dim);
}
.pw-label {
  margin: 14px 16px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.chat-plan-md-tasks {
  margin: 0 16px 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  max-height: 36vh;
  overflow-y: auto;
}
.chat-plan-md-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}

.pw-primary-btn,
.pw-ghost-btn {
  appearance: none;
  font: inherit;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.pw-primary-btn {
  background: var(--text);
  border: 1px solid var(--text);
  color: var(--bg, #000);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}
.pw-primary-btn:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
}
.pw-ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}
.pw-ghost-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-bright);
}
.pw-primary-btn:disabled,
.pw-ghost-btn:disabled,
.pw-danger-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pw-danger-btn {
  appearance: none;
  font: inherit;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(220, 72, 72, 0.18);
  border: 1px solid rgba(220, 72, 72, 0.55);
  color: #ffb4b4;
}
.pw-danger-btn:hover:not(:disabled) {
  background: rgba(220, 72, 72, 0.32);
  border-color: rgba(255, 120, 120, 0.75);
}

.pw-q {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
.pw-q:last-of-type { border-bottom: 0; }
.pw-q-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-bright);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.pw-q-prompt {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.pw-q-answer {
  width: 100%;
  background: var(--bg, #000);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
}
.pw-q-answer:focus {
  outline: none;
  border-color: var(--line-bright);
}
.pw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.pw-chip {
  appearance: none;
  font: inherit;
  font-size: 11.5px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 999px;
  cursor: pointer;
}
.pw-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-bright);
  color: var(--text);
}
.pw-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.pw-locked {
  font-size: 13px;
  line-height: 1.45;
}
.pw-locked strong {
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.pw-locked p { margin: 4px 0 8px; color: var(--text); }
.pw-locked ul { margin: 0; padding-left: 18px; color: var(--text-dim); }
.pw-tasklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pw-task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.pw-task input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--text);
}

/* References footer beneath an assistant message bubble.
 * Picks up vault paths and URLs the model mentioned in its reply
 * so the operator can click straight to the source. Monochrome to
 * match the HUD theme. */
.chat-msg-references {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg-references-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.chat-msg-references-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-msg-reference-item {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.chat-msg-reference-item .chat-msg-reference {
  border: none;
  border-radius: 0;
  background: transparent;
  flex: 1;
  min-width: 0;
}
.chat-msg-reference-item:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.06);
}
.chat-msg-reference-item .chat-msg-reference:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
}
.chat-msg-reference-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: none;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  text-decoration: none;
  flex-shrink: 0;
}
.chat-msg-reference-download:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}
.chat-msg-reference-download-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-msg-reference {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 11.5px;
  line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-decoration: none;
  max-width: 100%;
}
.chat-msg-reference:not(.chat-msg-reference-item .chat-msg-reference):hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-bright);
}
.chat-msg-reference-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.chat-msg-reference:hover .chat-msg-reference-ico { color: var(--text); }
.chat-msg-reference-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 28ch;
}
.chat-msg-reference-web .chat-msg-reference-label { letter-spacing: 0; }

/** Clickable workspace file paths inside assistant bubbles */
.chat-msg-inline-file-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.chat-msg-inline-file-link:hover {
  color: var(--line-bright);
}

.chat-plan-stored-file-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-plan-stored-file-link:hover {
  color: var(--line-bright);
}

/* -----------------------------------------------------------------
 * Inline plan card (chat-msg.is-plan) — the primary plan-mode UI.
 * Lives in the chat stream like an assistant bubble but with its own
 * controls (Refine, Expand, Finish). Monochrome JARVIS HUD theme.
 * ----------------------------------------------------------------- */
.chat-msg.is-plan {
  align-self: stretch;
  max-width: 100%;
  background: var(--bg-elev, #0a0a0a);
  border: 1px solid var(--line-bright);
  border-radius: 12px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
}
.chat-msg.is-plan.is-executing {
  border-color: var(--text);
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.plan-card-cursor-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plan-card-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 12px;
}
.plan-card-file-ico {
  display: flex;
  opacity: 0.85;
}
.plan-card-filename {
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.plan-card-hero-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.02em;
}
.plan-card-hero-summary {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  max-height: 7.5em;
  overflow: auto;
}
.plan-card-todos-inset {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.plan-card-todos-head {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 8px;
  list-style-position: inside;
}
.plan-card-todos-head::-webkit-details-marker {
  color: var(--text-dim);
}
.plan-card-todos-meter {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 0 10px;
}
.plan-card-todos-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #c9a227;
  transition: width 180ms ease;
}
.plan-card-todos-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}
.plan-card-todos-placeholder,
.plan-card-todos-more {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}
.plan-card-todo-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}
.plan-card-todo-line.is-done .plan-card-todo-text {
  text-decoration: line-through;
  color: var(--text-dim);
}
.plan-card-todo-glyph {
  flex-shrink: 0;
  opacity: 0.75;
}
.plan-card-context-bullets ul {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}
.plan-card-hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-dim);
}
.plan-card-refine-compact {
  margin-top: 4px;
}
.plan-card-footer-cursor {
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 12px;
  margin-top: 4px;
}
.plan-card-footer-left,
.plan-card-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.plan-card-link-btn {
  appearance: none;
  font: inherit;
  font-size: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.plan-card-link-btn:hover:not(:disabled) {
  color: var(--text);
}
.plan-card-link-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: none;
}
.plan-card-link-muted {
  opacity: 0.8;
}
.plan-card-footer-hint {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.plan-card-review {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.plan-card-review-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
}
.plan-card-review-item {
  margin-bottom: 10px;
}
.plan-card-review-item.severity-p0,
.plan-card-review-item.severity-p1 {
  color: #f5c6c6;
}
.plan-card-review-impact,
.plan-card-review-fix {
  margin-top: 4px;
  color: var(--text-dim);
}
.plan-card-review-persona {
  font-weight: normal;
  color: var(--text-dim);
}
.chat-notebook-picker-wrap {
  position: relative;
  max-width: min(14rem, 42vw);
}
.chat-notebook-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 11rem;
  padding: 2px 18px 2px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) calc(50% - 2px), calc(100% - 8px) calc(50% - 2px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.chat-notebook-picker-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 40;
  min-width: min(280px, 88vw);
  max-width: min(320px, 92vw);
  max-height: min(50vh, 320px);
  overflow: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 14, 16, 0.98);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.chat-notebook-picker-menu[hidden] {
  display: none !important;
}
.chat-notebook-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.chat-notebook-picker-option:hover,
.chat-notebook-picker-option:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}
.chat-notebook-picker-row.is-active .chat-notebook-picker-option {
  font-weight: 600;
}
.chat-notebook-picker-option-new {
  color: #c9a227;
  font-weight: 600;
}
.chat-notebook-picker-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  margin-top: 2px;
}
.chat-notebook-picker-row.is-active .chat-notebook-picker-option {
  background: rgba(201, 162, 39, 0.12);
}
.chat-notebook-picker-row .chat-notebook-picker-option {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-notebook-picker-manage {
  flex-shrink: 0;
  width: 34px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.chat-notebook-picker-manage:hover,
.chat-notebook-picker-manage:focus-visible {
  background: rgba(201, 162, 39, 0.2);
  color: var(--text);
}
.chat-notebook-panel-btn {
  flex-shrink: 0;
}
.chat-notebook-modal {
  width: min(92vw, 480px);
  max-height: min(88vh, 640px);
}
.chat-notebook-modal-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 20px 22px 18px;
  max-height: min(88vh, 640px);
  overflow: hidden;
}
.chat-notebook-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-right: 2px;
}
.chat-notebook-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.chat-notebook-modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.chat-notebook-modal-sub {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.4;
}
.chat-notebook-modal-drop {
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s, background 0.15s;
}
.chat-notebook-modal-drop.is-dragover {
  border-color: rgba(201, 162, 39, 0.65);
  background: rgba(201, 162, 39, 0.08);
}
.chat-notebook-modal-drop-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}
.chat-notebook-modal-drop-hint {
  margin: 0 0 12px;
  font-size: 12px;
}
.chat-notebook-modal-upload-label {
  margin: 0 auto;
}
.chat-notebook-modal-section-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.chat-notebook-modal-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(36vh, 280px);
  overflow: auto;
  font-size: 13px;
}
.chat-notebook-modal-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}
.chat-notebook-modal-source-meta {
  min-width: 0;
  flex: 1;
}
.chat-notebook-modal-source-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-notebook-source-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}
.chat-notebook-source-view {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}
.chat-notebook-source-view:hover,
.chat-notebook-source-view:focus-visible {
  background: rgba(201, 162, 39, 0.2);
  border-color: rgba(201, 162, 39, 0.45);
}
.chat-notebook-modal-source-size {
  font-size: 11px;
  color: var(--text-dim);
}
.chat-notebook-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-notebook-delete-dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: none;
  background: transparent;
}
.chat-notebook-delete-inner {
  padding: 20px 20px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 14, 16, 0.98);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
.chat-notebook-delete-title {
  margin: 0 0 10px;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chat-notebook-delete-message {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.45;
}
.chat-notebook-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.chat-notebook-modal-status {
  margin: 0;
  font-size: 12px;
}
.chat-notebook-panel {
  position: absolute;
  top: 52px;
  right: 0;
  bottom: 0;
  width: min(320px, 92vw);
  z-index: 12;
  background: rgba(12, 12, 14, 0.97);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-notebook-panel[hidden] {
  display: none !important;
}
.chat-notebook-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-notebook-title {
  font-weight: 600;
  font-size: 14px;
}
.chat-notebook-section {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow: auto;
}
.chat-notebook-section-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.chat-notebook-section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-notebook-section-chats {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.chat-notebook-chats-search-wrap {
  padding: 0 0 8px;
  border-bottom: 0;
  background: transparent;
}
.chat-notebook-chats .chat-session-item {
  border-radius: 8px;
  border-bottom: 0;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.03);
}
.chat-notebook-sources,
.chat-notebook-chats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 8px;
}
.chat-notebook-source-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.chat-notebook-memory {
  font-size: 11px;
  line-height: 1.45;
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text-dim);
  margin: 0;
}
.chat-notebook-upload-btn {
  display: inline-block;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
.chat-sessions-row.is-notebook-chat .chat-sessions-row-title::after {
  content: " · nb";
  font-size: 10px;
  color: var(--text-dim);
}
.chat-notebook-hub-active {
  font-size: 12px;
  margin: 4px 0 0;
}

.chat-search-btn {
  flex-shrink: 0;
}
.chat-search-btn.is-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-bright);
}
.chat-sessions-search-wrap {
  flex-shrink: 0;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.chat-sessions-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  transition: border-color 140ms ease, background 140ms ease;
}
.chat-sessions-search-field:focus-within {
  border-color: rgba(201, 162, 39, 0.45);
  background: rgba(0, 0, 0, 0.38);
}
.chat-sessions-search-icon {
  flex-shrink: 0;
  color: var(--text-dim);
}
.chat-sessions-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  padding: 10px 0;
  outline: none;
}
.chat-sessions-search-input::placeholder {
  color: var(--text-dim);
}
.chat-sessions-search-input::-webkit-search-cancel-button {
  display: none;
}
.chat-sessions-search-clear {
  flex-shrink: 0;
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease, background 120ms ease;
}
.chat-sessions-search-clear:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
}
.chat-sessions-search-count {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sessions-search-count[hidden] {
  display: none !important;
}
.chat-session-snippet {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-session-item.is-search-hit .chat-session-title {
  color: #e8d5a3;
}
.chat-notebook-hub-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.chat-notebook-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 8px;
}
.chat-notebook-search-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow: auto;
  margin-bottom: 8px;
}
.chat-notebook-search-results[hidden] {
  display: none !important;
}
.chat-notebook-search-hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.chat-notebook-search-hit:hover,
.chat-notebook-search-hit:focus-visible {
  background: rgba(201, 162, 39, 0.15);
}
.chat-notebook-search-hit-title {
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.chat-notebook-search-hit-meta {
  font-size: 10px;
  color: var(--text-dim);
  display: block;
}
.chat-notebook-search-hit-snippet {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}
.chat-notebook-hub-chats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow: auto;
}
.chat-notebook-picker-option-docs {
  color: #c9a227;
  font-weight: 600;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 4px;
  padding-top: 10px;
}
.plan-card-btn-build {
  background: #c9a227 !important;
  border-color: #c9a227 !important;
  color: #0a0a0a !important;
  font-weight: 700;
  padding: 8px 18px !important;
  border-radius: 8px !important;
  text-transform: none !important;
  letter-spacing: 0.02em !important;
}
.plan-card-btn-build:hover:not(:disabled) {
  background: #d4b03a !important;
  border-color: #d4b03a !important;
}
.plan-card-questions .pw-q {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  grid-template-columns: unset;
}
.plan-card-questions .pw-q:last-of-type {
  border-bottom: none;
}
.pw-q-mcq {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.pw-q-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.pw-q-radio:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.04);
}
.pw-q-radio.is-selected {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}
.pw-q-radio input {
  margin-top: 3px;
  accent-color: var(--text);
}
.pw-q-custom-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-top: 4px;
}
.plan-card-todo-line.is-next {
  background: rgba(201, 162, 39, 0.08);
  border-radius: 6px;
  padding: 4px 8px;
  margin: 2px -8px;
  border-left: 3px solid #c9a227;
}
.plan-card-activity {
  margin-top: 2px;
}
.plan-card-activity .plan-card-section {
  margin-bottom: 8px;
}
.plan-card-activity-pre {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.plan-card-activity-pre .chat-msg-inline-file-link {
  color: var(--text);
  word-break: break-all;
}
.plan-card-questions.is-think-frozen,
.plan-card-refine.is-think-frozen {
  position: relative;
  opacity: 0.9;
}
.plan-card-questions.is-think-frozen::after,
.plan-card-refine.is-think-frozen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  pointer-events: none;
}
.plan-card-questions.is-think-frozen .pw-primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.plan-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.plan-card-kind {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bg, #000);
  background: var(--text);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
}
.plan-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  flex: 1 1 auto;
  min-width: 0;
}
.plan-card-phase {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.plan-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-card-section {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 600;
}
.plan-card-goal {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}
.plan-card-empty {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 0;
}
.plan-card-busy {
  font-size: 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed var(--line);
  padding: 6px 10px;
  border-radius: 6px;
}

/** While planner round-trips (Thinking…): block shell + body; footer Cancel stays live. */
.chat-msg.is-plan.is-plan-think-busy > .plan-card-cursor-shell,
.chat-msg.is-plan.is-plan-think-busy > .plan-card-body {
  pointer-events: none;
  user-select: none;
  opacity: 0.82;
}
.chat-msg.is-plan.is-plan-think-busy > .plan-card-footer {
  pointer-events: auto;
  opacity: 1;
}
.plan-card-error {
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-bright);
  padding: 6px 10px;
  border-radius: 6px;
}
.plan-card-locked p {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.plan-card-locked ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 12px;
}

.plan-card-md-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 6px;
}
.plan-card-md-bar .plan-card-section { margin: 0; }
.plan-card-md-actions {
  display: inline-flex;
  gap: 6px;
}
.plan-card-md-editor,
.plan-card-refine-input {
  width: 100%;
  background: var(--bg, #000);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
  font: inherit;
}
.plan-card-md-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  min-height: 180px;
}
.plan-card-md-editor:focus,
.plan-card-refine-input:focus {
  outline: none;
  border-color: var(--line-bright);
}
.plan-card-refine-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: flex-start;
}
.plan-card-refine-row .plan-card-btn { align-self: stretch; }

.plan-card-btn {
  appearance: none;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.plan-card-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-bright);
}
.plan-card-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.plan-card-btn-primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg, #000);
  font-weight: 700;
}
.plan-card-btn-primary:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
}
.plan-card-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.pw-task.is-done span {
  text-decoration: line-through;
  color: var(--text-dim);
}
.pw-empty { padding: 16px 4px; font-size: 12px; color: var(--text-dim); }

/* Agent Room final overrides: keep the composer aligned with the regular chat composer. */
.agent-room-dialog {
  max-height: calc(100dvh - 28px);
}

.agent-room-composer.chat-composer {
  position: relative;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}

.agent-room-pending {
  padding: 8px 0 0;
}

.agent-room-composer .agent-room-pills {
  flex: 0 1 auto;
}

.agent-room-composer .agent-room-input {
  flex: 1 1 180px;
  min-width: 120px;
  resize: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  max-height: 140px;
  outline: none;
}

.agent-room-composer .agent-room-input:focus {
  border-color: var(--line-bright);
}

.agent-room-mention-menu {
  position: absolute;
  left: 58px;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 6px;
  width: min(560px, calc(100% - 76px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
}

.agent-room-mention-menu[hidden] {
  display: none;
}

.agent-room-mention-menu button {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.agent-room-mention-menu button:hover,
.agent-room-mention-menu button[data-active="1"] {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.agent-room-mention-menu strong,
.agent-room-mention-menu span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-room-mention-menu strong {
  font-size: 13px;
}

.agent-room-mention-menu span {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 11px;
}

.agent-room-composer .chat-select.chat-select-embedded {
  background-color: transparent;
  border: 0;
  height: 24px;
}

.agent-room-composer .chat-icon-btn {
  flex: 0 0 auto;
}

.agent-room-pill-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.agent-room-pill-btn:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}

.agent-room-pill-btn.is-off {
  color: var(--text-dim);
  border-style: dashed;
}

.agent-room-msg-attachments {
  margin-top: 8px;
  margin-bottom: 0;
}

@media (max-width: 620px) {
  .agent-room-dialog {
    width: calc(100vw - 10px);
    height: calc(100dvh - 10px);
    max-height: calc(100dvh - 10px);
  }

  .agent-room-shell {
    overflow: hidden;
  }

  .agent-room-header {
    padding: 10px;
  }

  .agent-room-layout {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .agent-room-main {
    min-height: 0;
  }

  .agent-room-messages {
    min-height: 320px;
    max-height: 54dvh;
  }

  .agent-room-composer.chat-composer {
    flex-wrap: wrap;
    align-items: flex-end;
  }

  .agent-room-composer .agent-room-pills {
    order: -1;
    flex: 1 0 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .agent-room-composer .agent-room-input {
    flex: 1 1 0;
    min-width: 0;
  }

  .agent-room-composer .chat-select-pill {
    max-width: 100%;
  }

  .agent-room-pill-btn {
    flex: 0 0 auto;
  }
}

/* iPhone Safari fallback: one-column, full-screen, no overlapping panels. */
@media (max-width: 700px) {
  .agent-room-dialog,
  .agent-room-dialog[open] {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
  }

  @supports (height: 100svh) {
    .agent-room-dialog,
    .agent-room-dialog[open] {
      height: 100svh;
    }
  }

  @supports (-webkit-touch-callout: none) {
    .agent-room-dialog,
    .agent-room-dialog[open] {
      height: -webkit-fill-available;
    }
  }

  .agent-room-shell {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .agent-room-header {
    flex: 0 0 auto;
    min-height: 52px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(5, 7, 10, 0.98);
  }

  .agent-room-app-btn {
    width: 36px;
    padding: 0;
  }

  .agent-room-app-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .agent-room-title-name,
  .agent-room-status {
    overflow-wrap: anywhere;
  }

  .agent-room-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
  }

  .agent-room-control-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    flex: 0 0 auto;
  }

  .agent-room-mission-panel {
    padding: 10px;
  }

  .agent-room-missions {
    display: flex;
    flex-direction: column;
  }

  .agent-room-mission-form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-room-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-room-control-item,
  .agent-room-failed-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .agent-room-stat {
    min-width: 0;
    padding: 8px 10px;
  }

  .agent-room-stat:nth-child(2n) {
    border-right: none;
  }

  .agent-room-layout {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    display: flex !important;
    flex-direction: column;
    overflow: visible;
  }

  .agent-room-dialog.is-forum-focus .agent-room-shell {
    overflow: hidden;
  }

  .agent-room-dialog.is-forum-focus .agent-room-layout {
    flex: 1 1 auto;
    height: auto;
    overflow: hidden;
  }

  .agent-room-main {
    order: 1;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 10px;
  }

  .agent-room-dialog.is-forum-focus .agent-room-main {
    flex: 1 1 auto;
    height: auto;
    overflow: hidden;
    padding: 10px;
  }

  .agent-room-agents-panel {
    order: 2;
  }

  .agent-room-memory-panel {
    order: 3;
  }

  .agent-room-side {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    padding: 10px;
  }

  .agent-room-agents-panel,
  .agent-room-memory-panel {
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
    display: flex;
    flex-direction: column;
  }

  .agent-room-agents,
  .agent-room-tasks,
  .agent-room-missions,
  .agent-room-memory,
  .agent-room-artifacts,
  .agent-room-skill-proposals {
    max-height: 220px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .agent-room-messages {
    flex: 0 0 auto;
    min-height: 260px;
    height: clamp(260px, 42vh, 420px);
    max-height: 42vh;
    overflow: auto;
    padding-right: 0;
    -webkit-overflow-scrolling: touch;
  }

  @supports (height: 100svh) {
    .agent-room-messages {
      height: clamp(260px, 42svh, 420px);
      max-height: 42svh;
    }
  }

  .agent-room-dialog.is-forum-focus .agent-room-messages {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: auto;
    padding-right: 0;
  }

  .agent-room-dialog.is-forum-focus .agent-room-message.is-owner,
  .agent-room-dialog.is-forum-focus .agent-room-message.is-agent,
  .agent-room-dialog.is-forum-focus .agent-room-message.is-system {
    width: 100%;
  }

  .agent-room-message,
  .agent-room-agent,
  .agent-room-task,
  .agent-room-mission,
  .agent-room-memory-item,
  .agent-room-skill-proposal,
  .agent-room-artifact {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .agent-room-pending {
    padding: 8px 0 0;
  }

  .agent-room-composer.chat-composer {
    position: relative;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: end;
    gap: 8px;
    width: 100%;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    box-sizing: border-box;
  }

  .agent-room-composer .agent-room-pills {
    grid-column: 1 / -1;
    order: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
  }

  .agent-room-composer .chat-select-pill {
    flex: 1 1 130px;
    min-width: 0;
    max-width: 100%;
  }

  .agent-room-composer .chat-select.chat-select-embedded {
    min-width: 0;
    max-width: 100%;
  }

  #agentRoomAttachBtn {
    grid-column: 1;
  }

  .agent-room-composer .agent-room-input {
    grid-column: 2;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .agent-room-mention-menu {
    left: 8px;
    right: 8px;
    width: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #agentRoomSendBtn {
    grid-column: 3;
  }
}

/* =================================================================
   Company OS Agent Map (agent-map.js) — matches JARVIS HUD / Agent Room.
   All selectors namespaced `am-` so they never collide with the rest of the app.
   ================================================================= */
.am-dialog {
  width: min(1280px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  max-width: none;
  max-height: none;
  overflow: hidden;
}
.am-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: rgba(5, 7, 10, 0.98);
  color: var(--text);
}

.am-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.am-title {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.am-title-glyph { color: var(--text-dim); }
.am-search {
  flex: 1 1 auto;
  min-width: 80px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  font: inherit;
  font-size: 12px;
}
.am-search::placeholder { color: var(--text-dim); }
.am-search:focus {
  outline: none;
  border-color: var(--line-bright);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}
.am-controls { display: flex; gap: 8px; }
.am-btn {
  height: 36px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.am-btn:hover {
  border-color: var(--line-bright);
  background: rgba(255, 255, 255, 0.08);
}
.am-btn-close:hover { color: rgba(255, 150, 150, 0.95); }

.am-body {
  display: grid;
  grid-template-columns: 210px 1fr 300px;
  flex: 1 1 auto;
  min-height: 0;
}
.am-side {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  background: var(--bg);
  border-right: 1px solid var(--line);
}
.am-side-right { border-right: none; border-left: 1px solid var(--line); }
.am-side-title {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.am-filters { display: flex; flex-direction: column; gap: 4px; }
.am-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 12px;
  color: var(--text);
}
.am-filter:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.am-filter.is-off { opacity: 0.45; }
.am-filter input { accent-color: var(--text); }
.am-filter-dot { width: 9px; height: 9px; border-radius: 50%; }
.am-filter-label { flex: 1 1 auto; }
.am-filter-count { color: var(--text-dim); font-size: 11px; }

.am-warnings { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.am-warn-row {
  font-size: 11px;
  color: rgba(255, 220, 150, 0.95);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.am-graph-frame {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.04), transparent 60%),
    var(--bg-elev);
  cursor: grab;
}
.am-graph-frame.is-panning { cursor: grabbing; }
.am-graph { width: 100%; height: 100%; display: block; touch-action: none; }

.am-edge {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.1;
  transition: stroke 0.12s, opacity 0.12s;
}
.am-edge:hover { stroke: var(--line-bright); cursor: help; }
.am-edge.is-active {
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 1.8;
}

.am-node { cursor: pointer; }
.am-node-circle {
  stroke: var(--bg);
  stroke-width: 1.4;
  transition: stroke 0.12s, filter 0.12s;
}
.am-node:hover .am-node-circle { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35)); }
.am-node.is-selected .am-node-circle {
  stroke: var(--text);
  stroke-width: 2.2;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.45));
}
.am-node.is-dim { transition: opacity 0.15s; }
.am-node-label {
  fill: var(--text);
  font-size: 8px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  pointer-events: none;
  font-family: "Rajdhani", ui-sans-serif, system-ui, sans-serif;
}
.am-node.is-selected .am-node-label { fill: #fff; }

.am-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.am-count {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

.am-details { font-size: 12px; }
.am-details-empty { color: var(--text-dim); font-size: 12px; }
.am-details-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.am-details-dot { width: 11px; height: 11px; border-radius: 50%; }
.am-details-name { font-size: 15px; margin: 0; color: var(--text); }
.am-details-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.am-badge {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.am-badge-active { color: rgba(182, 233, 182, 0.92); border-color: rgba(182, 233, 182, 0.35); }
.am-badge-inferred { color: rgba(255, 220, 150, 0.95); border-color: rgba(255, 220, 150, 0.35); }
.am-badge-unknown { color: var(--text-dim); }
.am-badge-src { color: var(--text); }
.am-details-desc { color: var(--text-dim); line-height: 1.5; margin: 0 0 12px; }
.am-details-file { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.am-details-file span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.am-details-file code {
  font-size: 11px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 7px;
  word-break: break-all;
}
.am-details-rel-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.am-rel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.am-rel {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
}
.am-rel-label { font-size: 10px; color: var(--text-dim); }
.am-rel-out .am-rel-label::before { content: "→ "; color: var(--text); }
.am-rel-in .am-rel-label::before { content: "← "; color: var(--text-dim); }
.am-rel-target {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0;
  text-decoration: underline dotted;
}
.am-rel-target:hover { color: #fff; }

.am-statusbar {
  padding: 6px 14px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.am-tip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  font: inherit;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  max-width: 320px;
}

@media (max-width: 860px) {
  .am-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .am-side { max-height: 130px; border-right: none; border-bottom: 1px solid var(--line); }
  .am-side-right { border-left: none; border-top: 1px solid var(--line); }
}
