:root {
  --agent-bg: #080b12;
  --agent-panel: rgba(9, 13, 22, 0.94);
  --agent-panel-2: rgba(18, 24, 36, 0.92);
  --agent-line: rgba(132, 160, 190, 0.22);
  --agent-text: #edf4ff;
  --agent-dim: #91a3b8;
  --agent-accent: #6ee7b7;
  --agent-blue: #7dd3fc;
  --agent-warn: #fbbf24;
}

.agent-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(110, 231, 183, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.28), transparent 18%),
    radial-gradient(circle at 50% 56%, rgba(110, 231, 183, 0.42), rgba(125, 211, 252, 0.20) 42%, rgba(8, 13, 22, 0.98) 72%);
  color: var(--agent-text);
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.48),
    0 0 24px rgba(110, 231, 183, 0.22),
    0 0 0 1px rgba(255,255,255,0.08) inset;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
  overflow: visible;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.agent-hidden {
  display: none !important;
}

.agent-panel-hidden .agent-launcher {
  opacity: 0.5;
  transform: scale(0.85);
}
.agent-panel-hidden .agent-launcher:hover {
  opacity: 1;
  transform: scale(1);
}
.agent-panel-hidden .agent-launcher::after {
  animation: none;
  opacity: 0;
}

.agent-sidebar-slot {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.agent-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(125, 211, 252, 0.72);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.58),
    0 0 34px rgba(125, 211, 252, 0.32),
    0 0 0 1px rgba(255,255,255,0.12) inset;
}

.agent-launcher-core {
  position: relative;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(4, 10, 18, 0.72);
  color: #eafff8;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  font-family: var(--font-mono, ui-monospace, monospace);
  text-shadow: 0 0 12px rgba(110, 231, 183, 0.5);
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.22) inset;
}

.agent-launcher-orbit {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1px solid rgba(125, 211, 252, 0.46);
  border-left-color: transparent;
  transform: rotate(-28deg);
  animation: agent-orbit 4.8s linear infinite;
}

.agent-launcher-dot {
  position: absolute;
  right: 9px;
  top: 10px;
  z-index: 3;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--agent-accent);
  box-shadow: 0 0 12px rgba(110, 231, 183, 0.9);
}

.agent-launcher::after {
  content: "";
  position: absolute;
  inset: -8px;
  border: 1px solid rgba(110, 231, 183, 0.16);
  border-radius: 50%;
  animation: agent-pulse 2.4s ease-in-out infinite;
}

.agent-panel {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 2147483000;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 60px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--agent-line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--agent-panel), rgba(5, 8, 14, 0.96));
  color: var(--agent-text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(18px) saturate(1.25);
}

.agent-panel.open {
  display: flex;
}

.agent-panel.embedded {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  max-height: none;
  flex: 1;
  min-height: 0;
  display: flex;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(10, 14, 24, 0.98), rgba(7, 10, 18, 0.98));
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255,255,255,0.03) inset;
  backdrop-filter: blur(18px) saturate(1.2);
}

.agent-head {
  position: relative;
  z-index: 20;
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--agent-line);
  gap: 10px;
}

.agent-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.agent-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.agent-title strong {
  font-size: 14px;
  letter-spacing: 0;
}

.agent-title span {
  color: var(--agent-dim);
  font-size: 11px;
}

.agent-voice-head {
  flex: 1 1 auto;
  min-width: 128px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.agent-voice-main {
  height: 30px;
  min-width: 34px;
  max-width: 118px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(145, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--agent-dim);
  padding: 4px 8px 4px 6px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.agent-voice-main:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.42);
  color: #e8f7ff;
}

.agent-voice-main-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.agent-voice-main-icon svg {
  width: 15px;
  height: 15px;
}

.agent-voice-main-label {
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.agent-voice-main[data-voice-state="listening"] {
  border-color: rgba(110, 231, 183, 0.34);
  background: rgba(110, 231, 183, 0.08);
  color: #d9fff1;
  box-shadow: 0 0 18px rgba(110, 231, 183, 0.12);
}

.agent-voice-main[data-voice-state="hearing"] {
  border-color: rgba(110, 231, 183, 0.64);
  background: rgba(110, 231, 183, 0.16);
  color: #effff9;
  box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.08), 0 0 28px rgba(110, 231, 183, 0.24);
  animation: agent-voice-listen-pulse 1.05s ease-in-out infinite;
}

.agent-voice-main[data-voice-state="processing"],
.agent-voice-main[data-voice-state="speaking"],
.agent-voice-main[data-voice-state="fallback"] {
  border-color: rgba(125, 211, 252, 0.5);
  background: rgba(125, 211, 252, 0.11);
  color: #e1f4ff;
}

.agent-voice-main[data-voice-state="muted"],
.agent-voice-main[data-voice-state="error"] {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.10);
  color: #ffd7d7;
}

.agent-voice-wave {
  height: 30px;
  min-width: 92px;
  max-width: 148px;
  flex: 1 1 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 8px;
  border: 1px solid rgba(125, 211, 252, 0.12);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  overflow: hidden;
}

.agent-voice-bar {
  width: 2px;
  height: var(--bar-h, 2px);
  min-height: 2px;
  border-radius: 999px;
  background: rgba(145, 163, 184, 0.46);
  transition: height .08s linear, background .18s ease, opacity .18s ease;
}

.agent-voice-wave[data-voice-state="listening"] .agent-voice-bar {
  background: rgba(110, 231, 183, 0.55);
}

.agent-voice-wave[data-voice-state="hearing"] .agent-voice-bar {
  background: linear-gradient(180deg, rgba(125,211,252,.95), rgba(110,231,183,.92));
  box-shadow: 0 0 8px rgba(110, 231, 183, 0.28);
}

.agent-voice-wave[data-voice-state="processing"] .agent-voice-bar {
  height: calc(5px + (var(--i) % 7) * 2px);
  background: rgba(125, 211, 252, 0.72);
  animation: agent-voice-wave-wait .9s ease-in-out infinite;
  animation-delay: calc(var(--i) * 28ms);
}

.agent-voice-wave[data-voice-state="speaking"] .agent-voice-bar,
.agent-voice-wave[data-voice-state="fallback"] .agent-voice-bar {
  height: calc(7px + (var(--i) % 5) * 3px);
  background: rgba(125, 211, 252, 0.7);
  animation: agent-voice-wave-speak 1.15s ease-in-out infinite;
  animation-delay: calc(var(--i) * 34ms);
}

.agent-voice-wave[data-voice-state="muted"] .agent-voice-bar,
.agent-voice-wave[data-voice-state="error"] .agent-voice-bar {
  background: rgba(248, 113, 113, 0.48);
}

.agent-panel.embedded .agent-voice-main-label {
  display: none;
}

.agent-panel.embedded .agent-voice-wave {
  min-width: 70px;
  max-width: 110px;
  padding-inline: 6px;
}

.agent-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--agent-dim);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agent-hide-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--agent-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  transition: background 0.2s, color 0.2s;
}
.agent-hide-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--agent-text);
}

.agent-resize-handle {
  height: 8px;
  cursor: ns-resize;
  background: transparent;
  position: relative;
  flex-shrink: 0;
  border-radius: 14px 14px 0 0;
}

.agent-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s, width 0.2s;
}

.agent-resize-handle:hover::after {
  background: rgba(110, 231, 183, 0.6);
  width: 50px;
}

.agent-body {
  padding: 12px;
  overflow: auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.agent-panel.embedded .agent-head {
  padding: 12px 12px 10px;
}

.agent-panel.embedded .agent-body {
  min-height: 140px;
  max-height: min(30vh, 380px);
  padding: 8px 10px;
}

.agent-panel.embedded .agent-foot {
  padding: 9px 10px 10px;
}

.agent-panel.embedded .agent-input {
  min-height: 38px;
}

.agent-panel.embedded .agent-close {
  display: none;
}

.agent-msg {
  max-width: 92%;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.agent-msg.agent-markdown {
  white-space: normal;
  overflow-wrap: anywhere;
}

.agent-markdown > :first-child { margin-top: 0; }
.agent-markdown > :last-child { margin-bottom: 0; }
.agent-markdown p { margin: 0 0 8px; }
.agent-markdown h1,
.agent-markdown h2,
.agent-markdown h3,
.agent-markdown h4 {
  margin: 12px 0 6px;
  color: inherit;
  line-height: 1.35;
}
.agent-markdown h1 { font-size: 17px; }
.agent-markdown h2 { font-size: 15px; }
.agent-markdown h3,
.agent-markdown h4 { font-size: 14px; }
.agent-markdown ul,
.agent-markdown ol { margin: 7px 0; padding-left: 20px; }
.agent-markdown li + li { margin-top: 3px; }
.agent-markdown blockquote {
  margin: 8px 0;
  padding: 5px 10px;
  border-left: 3px solid var(--agent-blue);
  color: var(--agent-dim);
}
.agent-markdown pre {
  margin: 8px 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--agent-line);
  border-radius: 8px;
  background: rgba(0, 0, 0, .22);
  white-space: pre;
}
.agent-markdown code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .92em;
}
.agent-markdown :not(pre) > code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(125, 211, 252, .1);
}
.agent-markdown table {
  width: 100%;
  margin: 8px 0;
  border-collapse: collapse;
  font-size: 12px;
}
.agent-markdown th,
.agent-markdown td {
  padding: 6px 8px;
  border: 1px solid var(--agent-line);
  text-align: left;
}
.agent-markdown a {
  color: var(--agent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agent-msg.user {
  margin-left: auto;
  background: rgba(125, 211, 252, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.24);
}

.agent-msg.assistant {
  background: rgba(110, 231, 183, 0.09);
  border: 1px solid rgba(110, 231, 183, 0.20);
}

.agent-tutorial-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-template-choice {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin: 2px 4px 6px 0;
}

.agent-chip.agent-chip-muted,
.agent-chip.agent-tutorial-link {
  border-color: rgba(125, 211, 252, 0.18);
  background: rgba(125, 211, 252, 0.08);
  color: #c7e9ff;
}

.agent-chip.agent-chip-muted {
  padding-inline: 8px;
  font-size: 11px;
}

.agent-msg.system {
  max-width: 100%;
  color: var(--agent-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

.agent-status {
  padding: 7px 12px;
  border-top: 1px solid var(--agent-line);
  color: var(--agent-dim);
  font-size: 12px;
  min-height: 30px;
}

.agent-foot {
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border-top: 1px solid var(--agent-line);
}

.agent-input {
  min-width: 0;
  border: 1px solid rgba(145, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--agent-text);
  padding: 10px 11px;
  outline: none;
  font-size: 13px;
}

.agent-send {
  border: 0;
  border-radius: 10px;
  background: var(--agent-accent);
  color: #03110d;
  padding: 0 13px;
  cursor: pointer;
  font-weight: 700;
}

.agent-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-chip {
  border: 1px solid rgba(125, 211, 252, 0.24);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.08);
  color: var(--agent-text);
  padding: 6px 9px;
  font-size: 11px;
  cursor: pointer;
}

.agent-chip[data-agent-quick="control"] {
  border-color: rgba(110, 231, 183, 0.34);
  background: linear-gradient(180deg, rgba(110, 231, 183, 0.18), rgba(125, 211, 252, 0.12));
  color: #eefef8;
  box-shadow: 0 10px 24px rgba(6, 24, 30, 0.22), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.agent-chip[data-agent-quick="control"]:hover {
  border-color: rgba(125, 211, 252, 0.58);
  transform: translateY(-1px);
}

.agent-chip.takeover-active {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.16);
  color: #fee2e2;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.12) inset;
}

.agent-chip[data-agent-quick="control"].takeover-active {
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.22), rgba(127, 29, 29, 0.18));
  box-shadow: 0 12px 26px rgba(127, 29, 29, 0.26), 0 0 0 1px rgba(248, 113, 113, 0.14) inset;
}

.agent-file-ghost {
  position: fixed;
  z-index: 2147483001;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid rgba(110, 231, 183, 0.38);
  border-radius: 8px;
  background: rgba(8, 13, 22, 0.94);
  color: var(--agent-text);
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  transition: transform 0.68s cubic-bezier(.2,.8,.2,1), opacity 0.68s ease;
}

.agent-file-ghost.stack-2 {
  transform: translate(0, 0) rotate(-4deg);
}

.agent-file-ghost.stack-3 {
  transform: translate(0, 0) rotate(3deg);
}

.agent-demo-upload-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  margin-bottom: 6px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 8px;
  background: rgba(125, 211, 252, 0.06);
  color: var(--fg, #e5e7eb);
  font-size: 12px;
}

.agent-demo-upload-row.pending {
  background: rgba(125, 211, 252, 0.06);
}

.agent-demo-upload-row.uploading {
  background: rgba(110, 231, 183, 0.08);
  border-color: rgba(110, 231, 183, 0.28);
}

.agent-demo-upload-row.done {
  background: rgba(110, 231, 183, 0.12);
  border-color: rgba(110, 231, 183, 0.34);
}

.agent-drop-targeting {
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.22), 0 0 32px rgba(110, 231, 183, 0.18);
  border-color: rgba(110, 231, 183, 0.55) !important;
  background: rgba(110, 231, 183, 0.04) !important;
  animation: agent-drop-pulse 1.5s ease-in-out infinite;
}
@keyframes agent-drop-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(110,231,183,0.22), 0 0 32px rgba(110,231,183,0.18); }
  50% { box-shadow: 0 0 0 5px rgba(110,231,183,0.30), 0 0 48px rgba(110,231,183,0.25); }
}

.upload-progress-item.demo-upload-running {
  border-color: rgba(125, 211, 252, 0.28);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.06) inset;
}

.upload-progress-item.demo-upload-done {
  border-color: rgba(110, 231, 183, 0.26);
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.08) inset;
}

.agent-visual-pressed {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.22) inset;
}

.agent-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147482999;
  width: 28px;
  height: 28px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(24px, 24px, 0);
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.45));
  transition: opacity 0.2s ease;
}

.agent-cursor.visible {
  opacity: 1;
}

.agent-cursor svg {
  width: 28px;
  height: 28px;
}

.agent-cursor-wheel {
  position: absolute;
  left: 25px;
  top: 10px;
  width: 12px;
  height: 22px;
  border: 1px solid rgba(237, 244, 255, 0.92);
  border-radius: 7px;
  background: rgba(11, 18, 32, 0.9);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(2px) scale(0.88);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.agent-cursor-wheel::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 2px;
  height: 6px;
  border-radius: 2px;
  background: var(--agent-accent);
}

.agent-cursor.wheel-active .agent-cursor-wheel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.agent-cursor.wheel-down .agent-cursor-wheel::after {
  animation: agent-wheel-down 0.18s ease-in-out infinite alternate;
}

.agent-cursor.wheel-up .agent-cursor-wheel::after {
  animation: agent-wheel-up 0.18s ease-in-out infinite alternate;
}

@keyframes agent-wheel-down {
  from { transform: translateY(-1px); }
  to { transform: translateY(5px); }
}

@keyframes agent-wheel-up {
  from { transform: translateY(5px); }
  to { transform: translateY(-1px); }
}

.agent-target-ring {
  position: fixed;
  z-index: 2147482998;
  pointer-events: none;
  border: 1.5px solid var(--agent-accent);
  border-radius: 9px;
  box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.12), 0 0 30px rgba(110, 231, 183, 0.18);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.agent-target-ring.visible {
  opacity: 1;
}

.agent-target-ring.scanning {
  animation: agent-scan 0.72s ease-in-out infinite;
}

.agent-click-ripple {
  position: fixed;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--agent-accent);
  pointer-events: none;
  z-index: 2147482998;
  transform: translate(-50%, -50%) scale(0.4);
  animation: agent-ripple 0.52s ease-out forwards;
}

.agent-voice-setting,
.agent-voice-range {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  min-height: 32px;
  color: var(--agent-text);
  font-size: 12px;
}

.agent-voice-setting input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--agent-accent);
}

.agent-voice-range {
  display: grid;
  grid-template-columns: 74px 1fr;
}

.agent-voice-range input[type="range"] {
  width: 100%;
  accent-color: var(--agent-blue);
}

.agent-voice-range select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: var(--agent-text);
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}

.agent-voice-range select:focus {
  border-color: rgba(125, 211, 252, 0.55);
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.12);
}

.agent-voice-state {
  margin: 6px 8px 4px;
  padding: 6px 8px;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 8px;
  background: rgba(125, 211, 252, 0.06);
  color: var(--agent-dim);
  font-size: 11px;
}

.agent-voice-state[data-voice-state="listening"],
.agent-voice-state[data-voice-state="speaking"] {
  border-color: rgba(110, 231, 183, 0.24);
  background: rgba(110, 231, 183, 0.08);
  color: #d7fff1;
}

.agent-voice-state[data-voice-state="hearing"],
.agent-voice-state[data-voice-state="processing"] {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.08);
  color: #fdecb5;
}

.agent-voice-state[data-voice-state="fallback"],
.agent-voice-state[data-voice-state="muted"] {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(248, 113, 113, 0.08);
  color: #ffd5d5;
}

.agent-workflow-ghost {
  position: fixed;
  z-index: 2147483001;
  min-width: 168px;
  max-width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(13, 19, 32, 0.96), rgba(7, 11, 20, 0.96));
  color: var(--agent-text);
  box-shadow: 0 20px 52px rgba(0,0,0,0.48), 0 0 0 1px rgba(255,255,255,0.05) inset;
  pointer-events: none;
  transform-origin: center;
}

.agent-workflow-ghost-title {
  font-size: 12px;
  font-weight: 800;
  color: #eaf6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-workflow-ghost-type {
  margin-top: 4px;
  font-size: 10px;
  color: var(--agent-dim);
}

.agent-workflow-drop {
  position: fixed;
  z-index: 2147482998;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(110, 231, 183, 0.52);
  background: radial-gradient(circle, rgba(110,231,183,0.20), rgba(125,211,252,0.08) 52%, transparent 72%);
  box-shadow: 0 0 34px rgba(110,231,183,0.24);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  transition: opacity .18s ease, transform .22s ease;
}

.agent-workflow-drop.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.agent-workflow-edge-beam {
  position: fixed;
  z-index: 2147482998;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(110,231,183,0.15), rgba(125,211,252,0.9), rgba(110,231,183,0.25));
  box-shadow: 0 0 18px rgba(125,211,252,0.58);
  pointer-events: none;
  transform-origin: left center;
  opacity: 0;
  transition: opacity .18s ease;
}

.agent-workflow-node-pop {
  animation: agent-workflow-pop .62s cubic-bezier(.2,.85,.2,1);
}

@keyframes agent-pulse {
  0%, 100% { transform: scale(0.94); opacity: 0.35; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

@keyframes agent-orbit {
  to { transform: rotate(332deg); }
}

@keyframes agent-voice-listen-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.06), 0 0 22px rgba(110, 231, 183, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(110, 231, 183, 0.12), 0 0 32px rgba(110, 231, 183, 0.28); }
}

@keyframes agent-voice-wave-wait {
  0%, 100% { transform: scaleY(.42); opacity: .45; }
  50% { transform: scaleY(1); opacity: .95; }
}

@keyframes agent-voice-wave-speak {
  0%, 100% { transform: scaleY(.64); opacity: .68; }
  35% { transform: scaleY(1.18); opacity: .98; }
  70% { transform: scaleY(.82); opacity: .78; }
}

@keyframes agent-scan {
  0%, 100% { transform: scale(1); border-color: var(--agent-accent); }
  50% { transform: scale(1.018); border-color: var(--agent-blue); }
}

@keyframes agent-ripple {
  to { transform: translate(-50%, -50%) scale(3.8); opacity: 0; }
}

@keyframes agent-workflow-pop {
  0% { transform: scale(.84); filter: brightness(1.45); box-shadow: 0 0 0 4px rgba(110,231,183,.24), 0 0 44px rgba(110,231,183,.28); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@media (max-height: 1080px) {
  .agent-panel:not(.embedded) {
    width: min(360px, calc(100vw - 20px));
    font-size: 12px;
  }
  .agent-head { padding: 10px 12px 8px; }
  .agent-title strong { font-size: 13px; }
  .agent-body { padding: 10px; min-height: 180px; }
  .agent-msg { font-size: 12px; padding: 7px 9px; }
  .agent-foot { padding: 8px; }
  .agent-input { font-size: 12px; padding: 8px 10px; }
  .agent-chip { font-size: 10px; padding: 5px 8px; }
  .agent-status { font-size: 11px; padding: 5px 10px; }
  .agent-voice-wave { min-width: 60px; max-width: 90px; height: 24px; }
  .agent-voice-main { padding: 3px 6px 3px 4px; }
  .agent-voice-main-icon { width: 16px; height: 16px; }
  .agent-voice-main-icon svg { width: 12px; height: 12px; }
  .agent-voice-main-label { font-size: 10px; }
  .agent-close, .agent-hide-btn { width: 26px; height: 26px; font-size: 14px; }
  .agent-speed-trigger { font-size: 12px; }
  .agent-speed-dropdown { font-size: 11px; }
  .agent-speed-option { padding: 5px 8px; font-size: 11px; }
  .agent-ask-btn { font-size: 10px; padding: 4px 8px; }
}

@media (max-width: 700px) {
  .agent-panel {
    right: 10px;
    bottom: 78px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 96px);
  }
  .agent-launcher {
    right: 14px;
    bottom: 14px;
  }
  .agent-settings-dropdown,
  .agent-panel.embedded .agent-settings-dropdown {
    right: -34px;
    width: min(300px, calc(100vw - 28px));
    min-width: 0;
    max-height: calc(100vh - 92px);
  }
}

.agent-chip[data-agent-quick="control"].takeover-active {
  animation: agent-takeover-pulse 2s ease-in-out infinite;
}

@keyframes agent-takeover-pulse {
  0%, 100% { box-shadow: 0 12px 26px rgba(127, 29, 29, 0.26), 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 12px 26px rgba(127, 29, 29, 0.26), 0 0 0 6px rgba(248, 113, 113, 0); }
}

.agent-speed-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.agent-speed-trigger {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--agent-dim);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.agent-speed-trigger:hover {
  color: var(--agent-text);
  border-color: rgba(125, 211, 252, 0.4);
  transform: rotate(35deg);
}

.agent-speed-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 154px;
  max-height: 520px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--agent-line);
  border-radius: 10px;
  background: rgba(9, 13, 22, 0.97);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 4px;
  z-index: 2147483002;
}

.agent-speed-dropdown[hidden] {
  display: none;
}

.agent-settings-dropdown {
  top: calc(100% + 8px);
  bottom: auto;
  width: min(320px, calc(100vw - 32px));
  min-width: 280px;
  max-height: min(520px, calc(100vh - 110px));
  overscroll-behavior: contain;
}

.agent-panel.embedded .agent-settings-dropdown {
  width: min(320px, calc(100vw - 80px));
  max-height: min(520px, calc(100vh - 96px));
}

.agent-speed-option {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--agent-dim);
  padding: 7px 10px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.agent-speed-option:hover,
.agent-speed-option.active {
  background: rgba(110, 231, 183, 0.12);
  color: var(--agent-accent);
}

.agent-speed-option.danger:hover {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

.agent-settings-label {
  padding: 4px 6px 2px;
  font-size: 11px;
  color: var(--agent-dim);
}

.agent-settings-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--agent-line);
}

.agent-settings-note {
  padding: 4px 6px 2px;
  font-size: 10px;
  color: rgba(148, 163, 184, 0.72);
}

.agent-chip.takeover-paused {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.12);
  color: #fef3c7;
}

.agent-ask-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.agent-ask-btn {
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.08);
  color: var(--agent-text);
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
}

.agent-ask-btn:hover {
  background: rgba(125, 211, 252, 0.18);
  border-color: rgba(125, 211, 252, 0.45);
}

/* ===== Agent Modal ===== */
.agent-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2147483003;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: agent-modal-in 0.2s ease;
}
@keyframes agent-modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.agent-modal-box {
  background: rgba(13, 13, 26, 0.98);
  border: 1px solid var(--agent-line);
  border-radius: 14px;
  padding: 24px;
  min-width: 360px;
  max-width: 460px;
  width: 90vw;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
  animation: agent-modal-scale-in 0.22s ease;
}
@keyframes agent-modal-scale-in {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.agent-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--agent-text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-modal-field {
  margin-bottom: 14px;
}
.agent-modal-field label {
  display: block;
  font-size: 12px;
  color: var(--agent-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.agent-modal-field input,
.agent-modal-field textarea,
.agent-modal-field select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--agent-text);
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.agent-modal-field input:focus,
.agent-modal-field textarea:focus,
.agent-modal-field select:focus {
  border-color: var(--agent-accent);
  box-shadow: 0 0 0 2px rgba(110, 231, 183, 0.12);
}
.agent-modal-field textarea {
  min-height: 90px;
  resize: vertical;
  font-family: inherit;
}
.agent-modal-field select option {
  background: #0d0d1a;
  color: #e2e8f0;
}
.agent-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
.agent-modal-btn {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  transition: all 0.15s;
}
.agent-modal-btn.primary {
  background: var(--agent-accent);
  color: #03110d;
}
.agent-modal-btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.agent-modal-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--agent-text);
  border: 1px solid var(--agent-line);
}
.agent-modal-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ===== Console page integration ===== */
/* When on /chat page, sidebar agent panel is hidden by console.js */
.agent-panel.console-hidden {
  display: none !important;
}
/* ===== Unified workspace dock ===== */
.agent-workbench .agent-panel.embedded,
#console-agent-slot .agent-panel.embedded {
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg-elevated);
  color: var(--fg);
  backdrop-filter: none;
}

.agent-workbench .agent-panel.embedded .agent-body,
#console-agent-slot .agent-panel.embedded .agent-body {
  flex: 1;
  min-height: 0;
  max-height: none;
}

.agent-workbench .agent-panel.embedded .agent-head,
.agent-workbench .agent-panel.embedded .agent-foot,
.agent-workbench .agent-panel.embedded .agent-status,
#console-agent-slot .agent-panel.embedded .agent-head,
#console-agent-slot .agent-panel.embedded .agent-foot,
#console-agent-slot .agent-panel.embedded .agent-status {
  border-color: var(--border);
}

.agent-workbench .agent-panel.embedded .agent-title strong,
.agent-workbench .agent-panel.embedded .agent-msg,
.agent-workbench .agent-panel.embedded .agent-input,
#console-agent-slot .agent-panel.embedded .agent-title strong,
#console-agent-slot .agent-panel.embedded .agent-msg,
#console-agent-slot .agent-panel.embedded .agent-input {
  color: var(--fg);
}

.agent-workbench .agent-panel.embedded .agent-title span,
.agent-workbench .agent-panel.embedded .agent-status,
#console-agent-slot .agent-panel.embedded .agent-title span,
#console-agent-slot .agent-panel.embedded .agent-status {
  color: var(--fg-dim);
}

.agent-workbench .agent-panel.embedded .agent-msg.assistant,
#console-agent-slot .agent-panel.embedded .agent-msg.assistant {
  background: var(--bg-card);
  border-color: var(--border);
}

.agent-workbench .agent-panel.embedded .agent-msg.user,
#console-agent-slot .agent-panel.embedded .agent-msg.user {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.agent-workbench .agent-panel.embedded .agent-input,
#console-agent-slot .agent-panel.embedded .agent-input {
  background: var(--bg-input);
  border-color: var(--border);
}

.agent-workbench .agent-panel.embedded .agent-send,
#console-agent-slot .agent-panel.embedded .agent-send {
  color: #fff;
  background: var(--accent);
}

.agent-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.agent-status-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 1px;
  background: var(--fg-muted);
}

.agent-status[data-phase="thinking"] .agent-status-indicator,
.agent-status[data-phase="running"] .agent-status-indicator {
  background: var(--agent-blue);
  animation: agent-pulse 1.4s ease-in-out infinite;
}

.agent-status[data-phase="paused"] .agent-status-indicator { background: var(--agent-warn); }
.agent-status[data-phase="complete"] .agent-status-indicator { background: var(--agent-accent); }
.agent-status[data-phase="failed"] .agent-status-indicator { background: #f87171; }

.agent-status-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-status-page {
  margin-left: auto;
  color: var(--fg-muted);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 10px;
}

.agent-status-controls {
  display: none;
  gap: 4px;
}

body.agent-takeover-active .agent-status-controls { display: inline-flex; }

.agent-status-controls button {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--fg-dim);
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
}

html[data-theme="axiom"] .agent-panel,
html[data-theme="axiom"] .agent-msg,
html[data-theme="axiom"] .agent-input,
html[data-theme="axiom"] .agent-send,
html[data-theme="axiom"] .agent-chip,
html[data-theme="axiom"] .agent-status-controls button,
html[data-theme="axiom"] .agent-speed-dropdown,
html[data-theme="axiom"] .agent-modal-box {
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

html[data-theme="axiom"] .agent-head,
html[data-theme="axiom"] .agent-status {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

html[data-theme="light"] .agent-panel,
html[data-theme="axiom"] .agent-panel {
  --agent-panel: #ffffff;
  --agent-panel-2: #f5f3f3;
  --agent-line: var(--border);
  --agent-text: var(--fg);
  --agent-dim: var(--fg-dim);
  --agent-accent: var(--accent);
  --agent-blue: var(--accent);
  background: var(--bg-elevated);
  color: var(--fg);
}

html[data-theme="axiom"] .agent-chip {
  color: #000;
  background: #fff;
  border-color: #000;
}

html[data-theme="axiom"] .agent-chip:hover,
html[data-theme="axiom"] .agent-chip[data-agent-quick="control"] {
  color: #000;
  background: #fff;
  border-color: var(--accent);
}

html[data-theme="axiom"] .agent-send {
  color: #fff !important;
  background: #000 !important;
}

/* Independent user/teacher voice lanes. */
.agent-head {
  flex-wrap: wrap;
}

.agent-title {
  flex: 1 1 auto;
}

.agent-voice-head {
  order: 3;
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  justify-content: stretch;
}

.agent-voice-main {
  max-width: 144px;
}

.agent-voice-main-label {
  max-width: 100px;
}

.agent-user-voice-wave,
.agent-panel.embedded .agent-user-voice-wave {
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
}

.agent-panel.embedded .agent-voice-main-label {
  display: inline;
}

.agent-status {
  display: block;
  min-height: 52px;
  position: relative;
  overflow: visible;
  z-index: 4;
}

.agent-status-content {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.agent-teacher-voice-lane {
  position: absolute;
  z-index: 2;
  left: 8px;
  right: 8px;
  bottom: -13px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 999px;
  background: rgba(8, 13, 22, 0.46);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.agent-teacher-voice-label {
  flex: 0 0 auto;
  color: rgba(125, 211, 252, 0.78);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.agent-teacher-voice-wave,
.agent-panel.embedded .agent-teacher-voice-wave {
  width: 100%;
  height: 22px;
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.agent-teacher-voice-wave[data-voice-state="idle"] .agent-voice-bar {
  background: rgba(125, 211, 252, 0.22);
}

.agent-teacher-voice-wave[data-voice-state="muted"] .agent-voice-bar {
  background: rgba(148, 163, 184, 0.18);
}

.agent-foot,
.agent-panel.embedded .agent-foot {
  padding-top: 19px;
}

html[data-theme="light"] .agent-teacher-voice-lane,
html[data-theme="axiom"] .agent-teacher-voice-lane {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--border);
}

@media (max-height: 1080px) {
  .agent-user-voice-wave {
    max-width: none;
  }
}
