:root,
[data-theme="light"] {
  --bg: #edf4f6;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-2: rgba(255, 255, 255, 0.9);
  --surface-3: rgba(231, 242, 245, 0.92);
  --border: rgba(0, 64, 79, 0.16);
  --text: #101923;
  --muted: #5c6a72;
  --faint: #9aadb6;
  --primary: #027b96;
  --primary-hover: #005e73;
  --success: #227a42;
  --warning: #b56b00;
  --error: #b83e73;
  --glow: rgba(0, 189, 214, 0.2);
  --shadow: 0 24px 80px rgba(0, 49, 66, 0.13);
}

[data-theme="dark"] {
  --bg: #07090d;
  --surface: rgba(15, 17, 23, 0.82);
  --surface-2: rgba(22, 25, 32, 0.88);
  --surface-3: rgba(29, 32, 40, 0.92);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f3f4f6;
  --muted: #a1a8b3;
  --faint: #5d6470;
  --primary: #d7dde8;
  --primary-hover: #ffffff;
  --success: #85d39b;
  --warning: #d7b46a;
  --error: #e8799b;
  --glow: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Satoshi", Inter, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 28rem),
    radial-gradient(circle at 20% 10%, rgba(148, 163, 184, 0.08), transparent 24rem),
    radial-gradient(circle at 60% 90%, rgba(255, 255, 255, 0.04), transparent 28rem),
    var(--bg);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 70% 20%, black, transparent 68%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    opacity var(--transition-fast),
    transform var(--transition-fast);
}

button {
  border: 1px solid color-mix(in oklab, var(--primary), transparent 64%);
  border-radius: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #ffffff, #d9dde5);
  color: #07090d;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 12px;
  padding: 10px 14px;
}

button:hover {
  background: #ffffff;
  transform: translateY(-1px);
}

button:active,
a:active {
  transform: translateY(0) scale(0.99);
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
}

.ghost {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
}

.ghost:hover {
  background: color-mix(in oklab, var(--surface-3), white 4%);
  border-color: color-mix(in oklab, var(--primary), transparent 58%);
}

.dashboard {
  display: grid;
  grid-template-columns: 292px 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh;
}

.sidebar {
  grid-row: 1 / -1;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 36%),
    var(--surface);
  backdrop-filter: blur(22px);
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 64%),
    var(--surface-2);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.05), 0 0 34px rgba(255, 255, 255, 0.04);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

nav {
  display: grid;
  gap: 7px;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.nav-link.active,
.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: color-mix(in oklab, var(--surface-2), white 4%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

.token-card {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  display: grid;
  gap: 10px;
  background: var(--surface-2);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox input {
  width: auto;
}

.header {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg), transparent 18%);
  backdrop-filter: blur(22px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signal-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.signal-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 16px rgba(133, 211, 155, 0.42);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  max-width: 780px;
}

h2 {
  font-size: 22px;
}

.main {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px;
}

.section {
  display: none;
}

.section.active {
  display: grid;
  gap: 16px;
  animation: section-enter 260ms var(--ease-out) both;
}

@keyframes section-enter {
  from {
    opacity: 0;
    filter: blur(6px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grid-two,
.grid-three {
  display: grid;
  gap: 16px;
}

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

.grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.command-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: stretch;
}

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

.ops-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ops-strip article {
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--surface-2);
  padding: 16px;
  box-shadow: var(--shadow);
}

.ops-strip span,
.ops-strip strong {
  display: block;
}

.ops-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ops-strip strong {
  margin-top: 8px;
  color: var(--text);
  font-size: 32px;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums lining-nums;
}

.setup-hero,
.jarvis-hero,
.studio-shell {
  display: grid;
  gap: 16px;
}

.setup-hero,
.jarvis-hero {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 46%),
    radial-gradient(circle at 90% 10%, rgba(148, 163, 184, 0.12), transparent 25rem),
    var(--surface);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.setup-hero::after,
.jarvis-hero::after {
  content: "";
  position: absolute;
  inset: auto -20% -45% 30%;
  height: 160px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(50px);
  pointer-events: none;
}

.setup-hero p,
.jarvis-hero p {
  color: var(--muted);
  line-height: 1.55;
  max-width: 70ch;
}

.setup-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.command-box {
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  background: #0f1115;
  color: #d7f4e3;
  border-radius: 16px;
  padding: 16px;
}

.wizard-list,
.hint-list {
  display: grid;
  gap: 12px;
}

.wizard-step,
.hint-list article {
  display: grid;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 14px;
}

.wizard-step {
  grid-template-columns: auto 1fr auto;
}

.wizard-step strong,
.wizard-step span,
.hint-list strong,
.hint-list span {
  display: block;
}

.wizard-step span,
.hint-list span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

.step-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.quick-launch,
.gateway-grid,
.action-grid {
  display: grid;
  gap: 10px;
}

.quick-launch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-launch a,
.gateway-grid a {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 14px;
}

.quick-launch a:hover,
.gateway-grid a:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.command-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.command-chips button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.orbital-status {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
}

.orbital-core {
  position: relative;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.1) 0 28%, transparent 29%),
    var(--surface-2);
  box-shadow: inset 0 0 50px rgba(255, 255, 255, 0.05), 0 0 70px rgba(0, 0, 0, 0.28);
}

.orbital-core span {
  font-weight: 900;
  letter-spacing: 0.16em;
  color: var(--primary);
}

.orbital-core i {
  position: absolute;
  inset: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  animation: rotate 18s linear infinite;
}

.orbital-core i + i {
  inset: 44px;
  animation-duration: 11s;
  animation-direction: reverse;
}

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

.telemetry-stack {
  display: grid;
  gap: 10px;
}

.telemetry-stack article {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 12px 14px;
}

.telemetry-stack strong {
  color: var(--primary);
  font-size: 28px;
}

.telemetry-stack span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.voice-bar {
  display: grid;
  grid-template-columns: auto auto minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.voice-button.listening {
  animation: pulse 1.2s ease-in-out infinite;
}

.voice-readback {
  white-space: nowrap;
}

.operator-brief {
  display: grid;
  align-content: start;
  gap: 14px;
}

.operator-brief pre {
  max-height: 260px;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--glow);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.08);
  }
}

.gateway-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.autopilot-console {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin: 14px 0;
}

.autopilot-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.autopilot-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.toggle-row {
  min-height: 52px;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 0 12px;
  font-weight: 800;
}

.autopilot-feed {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.autopilot-event {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 12px;
}

.autopilot-event strong,
.autopilot-event span {
  display: block;
}

.autopilot-event span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

.autopilot-event.task_queued {
  border-color: rgba(121, 225, 177, 0.34);
}

.autopilot-event.blocked {
  border-color: rgba(255, 198, 109, 0.4);
}

.autopilot-next-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.gateway-grid strong,
.gateway-grid span {
  display: block;
}

.gateway-grid span {
  color: var(--muted);
  margin-top: 6px;
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
}

.studio-shell {
  grid-template-columns: 300px 260px minmax(420px, 1fr);
  grid-template-areas:
    "apps files editor"
    "appchat files editor"
    "preview preview preview"
    "evals actions actions";
}

.studio-sidebar {
  grid-area: apps;
}

.studio-files {
  grid-area: files;
}

.studio-editor {
  grid-area: editor;
}

.studio-preview {
  grid-area: preview;
}

.studio-actions {
  grid-area: actions;
  display: grid;
  gap: 14px;
}

.studio-evals {
  grid-area: evals;
}

.studio-agent-chat {
  grid-area: appchat;
}

.muted-copy {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 12px;
}

.mini-agent-form {
  display: grid;
  gap: 10px;
}

.mini-agent-form textarea {
  min-height: 120px;
}

.file-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
}

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}

.file-row:hover,
.file-row.active {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  transform: none;
}

.file-row small {
  color: var(--muted);
  white-space: nowrap;
}

.code-editor {
  min-height: 420px;
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}

.studio-preview iframe {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
}

.action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.runner-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
  padding: 16px;
}

.runner-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.runner-grid button {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}

.eval-score {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.eval-score strong {
  color: var(--primary);
  font-size: 34px;
  letter-spacing: -0.05em;
}

.eval-score span {
  color: var(--muted);
  font-weight: 700;
}

.tight {
  gap: 12px;
}

.kpi,
.panel,
.business-card,
.agent-card,
.approval-card,
.list-item {
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: auto 14px 12px 14px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.7;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--primary);
}

.panel {
  padding: 20px;
  min-width: 0;
  position: relative;
}

.panel-header,
.approval-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.form {
  display: grid;
  gap: 14px;
}

.business-list,
.agent-list,
.list,
.policy-list,
.status-grid {
  display: grid;
  gap: 12px;
}

.business-card,
.agent-card,
.approval-card,
.list-item {
  padding: 16px;
  background: var(--surface-2);
}

.business-card {
  display: grid;
  gap: 14px;
}

.business-card p,
.approval-card p {
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.5;
}

.meta-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.meta-row span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: color-mix(in srgb, var(--surface-2), transparent 10%);
}

.badge.ok,
.status-pill.ok strong {
  color: var(--success);
}

.badge.warning {
  color: var(--warning);
}

.badge.warning,
.status-pill.missing {
  border-color: color-mix(in srgb, var(--warning), transparent 55%);
}

.badge.danger {
  color: var(--error);
}

code,
pre {
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
}

code {
  color: var(--primary);
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent),
    var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  color: var(--muted);
  max-height: 540px;
  overflow: auto;
}

.policy-row,
.status-pill,
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.policy-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.policy-row span,
.list-item span,
.approval-head span {
  color: var(--muted);
  font-size: 13px;
}

.policy-row strong {
  text-align: right;
}

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

.status-pill {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.status-pill.ok {
  border-color: color-mix(in srgb, var(--success), transparent 58%);
}

.status-pill.missing strong {
  color: var(--warning);
}

.approval-card {
  display: grid;
  gap: 12px;
}

.approval-card pre {
  max-height: 180px;
}

.empty {
  justify-content: flex-start;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 460px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  opacity: 0;
  transform: translateY(8px);
  transition: 180ms ease;
  pointer-events: none;
  z-index: 99;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.flow-rail {
  display: grid;
  grid-template-columns: 1fr 18px 1fr 18px 1fr 18px 1fr 18px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    rgba(255, 255, 255, 0.025);
  box-shadow: var(--shadow);
}

.flow-rail article {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface-2);
}

.flow-rail i {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, var(--border), var(--primary));
  opacity: 0.8;
}

.flow-rail span,
.flow-rail small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-rail strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.daily-cockpit,
.flow-grid,
.computer-shell {
  display: grid;
  gap: 16px;
}

.daily-cockpit {
  grid-template-columns: minmax(360px, 1.15fr) minmax(280px, 0.85fr) minmax(260px, 0.75fr);
}

.priority-stack,
.agent-constellation,
.loop-steps,
.pipeline-board,
.sandbox-capabilities {
  display: grid;
  gap: 10px;
}

.priority-stack article {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.priority-stack b {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12px;
  flex: 0 0 auto;
}

.priority-stack strong,
.priority-stack span,
.loop-steps strong,
.loop-steps span,
.agent-constellation strong,
.agent-constellation span {
  display: block;
}

.priority-stack span,
.loop-steps span,
.agent-constellation span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.45;
}

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

.agent-constellation article,
.loop-steps article {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.agent-constellation .chief-node {
  grid-column: 1 / -1;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 55%),
    var(--surface-3);
}

.loop-steps {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-prompt {
  white-space: nowrap;
}

.flow-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.flow-header p,
.computer-hero p {
  color: var(--muted);
  max-width: 76ch;
  line-height: 1.6;
}

.mission-map {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(240px, 0.9fr) minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.map-column,
.map-core {
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
    var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.map-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

.map-column article {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.03);
}

.map-column strong,
.map-column span {
  display: block;
}

.map-column span {
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.45;
}

.map-core {
  display: grid;
  place-items: center;
  min-height: 280px;
}

.core-ring {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 58%),
    repeating-radial-gradient(circle, transparent 0 20px, rgba(255, 255, 255, 0.08) 21px 22px);
}

.core-ring strong,
.core-ring span {
  display: block;
}

.core-ring span {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.4;
}

.flow-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.pipeline-board {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.pipeline-board article {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  min-height: 132px;
  background: rgba(255, 255, 255, 0.03);
}

.pipeline-board article.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    var(--surface-3);
}

.pipeline-board span,
.pipeline-board strong,
.pipeline-board em,
.pipeline-board small {
  display: block;
}

.pipeline-board span,
.pipeline-board small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pipeline-board strong {
  margin-top: 12px;
  font-size: 17px;
}

.pipeline-board em {
  margin: 10px 0;
  font-style: normal;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.computer-shell {
  grid-template-columns: 0.85fr 1.15fr;
  align-items: start;
}

.computer-hero,
.computer-panel {
  min-height: 100%;
}

.sandbox-capabilities {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

.sandbox-capabilities span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  font-weight: 800;
}

.computer-shell .result-panel {
  grid-column: 1 / -1;
}

.agent-chat-shell {
  display: grid;
  grid-template-columns: 260px minmax(360px, 1fr) 280px;
  gap: 16px;
  align-items: stretch;
}

.agent-chat-roster,
.heartbeat-list,
.agent-chat-thread {
  display: grid;
  gap: 10px;
}

.agent-chat-roster button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: 16px;
  padding: 12px;
}

.agent-chat-roster button.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent),
    var(--surface-3);
  border-color: color-mix(in oklab, var(--primary), transparent 45%);
}

.agent-chat-roster strong,
.agent-chat-roster span,
.agent-chat-roster i,
.heartbeat-list strong,
.heartbeat-list span {
  display: block;
}

.agent-chat-roster span,
.agent-chat-roster i,
.heartbeat-list span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
  font-style: normal;
}

.agent-chat-thread {
  max-height: 480px;
  overflow: auto;
  padding-right: 4px;
}

.agent-chat-thread article {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.agent-chat-thread article.user {
  margin-left: 10%;
  background: var(--surface-3);
}

.agent-chat-thread article.assistant {
  margin-right: 10%;
}

.agent-chat-thread strong,
.agent-chat-thread p,
.agent-chat-thread small {
  display: block;
  margin: 0;
}

.agent-chat-thread p {
  color: var(--muted);
  line-height: 1.55;
  margin-top: 8px;
}

.agent-chat-thread small {
  color: var(--faint);
  margin-top: 10px;
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
}

.agent-chat-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.agent-suggestions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.suggestion-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggestion-heading small {
  color: var(--faint);
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
}

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

.agent-suggestions.compact .suggestion-grid {
  grid-template-columns: 1fr;
}

.suggestion-chip {
  display: grid;
  gap: 5px;
  text-align: left;
  justify-content: stretch;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px;
  box-shadow: none;
}

.suggestion-chip:hover {
  border-color: color-mix(in oklab, var(--primary), transparent 45%);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.suggestion-chip strong,
.suggestion-chip span {
  display: block;
}

.suggestion-chip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.next-action-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.next-action-list.compact {
  grid-template-columns: 1fr;
}

.next-action-list.empty {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.next-action-card {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 48%),
    rgba(255, 255, 255, 0.035);
  color: var(--text);
  padding: 8px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.next-action-card:hover {
  border-color: color-mix(in oklab, var(--primary), transparent 42%);
  background:
    linear-gradient(135deg, rgba(79, 152, 163, 0.13), transparent 52%),
    rgba(255, 255, 255, 0.055);
  transform: translateY(-1px);
}

.next-action-chat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 3px;
  text-align: left;
}

.next-action-chat:focus-visible,
.next-action-queue:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--primary), white 8%);
  outline-offset: 2px;
}

.next-action-queue {
  justify-self: end;
  border: 1px solid color-mix(in oklab, var(--primary), transparent 52%);
  border-radius: 999px;
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--primary), transparent 78%), transparent),
    rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.02em;
  padding: 7px 10px;
}

.next-action-queue:hover {
  border-color: color-mix(in oklab, var(--primary), transparent 24%);
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--primary), transparent 62%), transparent),
    rgba(255, 255, 255, 0.07);
}

.next-action-queue:disabled {
  cursor: wait;
  opacity: 0.62;
}

.next-action-card.priority-critical {
  border-color: color-mix(in oklab, var(--warning), transparent 46%);
}

.next-action-card.priority-high {
  border-color: color-mix(in oklab, var(--primary), transparent 54%);
}

.next-action-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.next-action-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.next-action-body strong,
.next-action-body small {
  display: block;
}

.next-action-body strong {
  font-size: 13px;
  line-height: 1.2;
}

.next-action-body small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.next-action-card em {
  align-self: start;
  color: var(--faint);
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.next-action-panel {
  display: grid;
  gap: 10px;
}

.agent-chat-form textarea {
  min-height: 130px;
}

.agent-chat-controls {
  display: grid;
  grid-template-columns: 160px minmax(140px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.heartbeat-list article {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.heartbeat-list article.active {
  background:
    radial-gradient(circle at 10% 10%, rgba(133, 211, 155, 0.14), transparent 55%),
    var(--surface-2);
}

.business-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.business-dashboard .business-summary {
  grid-column: 1 / -1;
}

.agent-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.agent-setting-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 45%),
    var(--surface);
  padding: 18px;
}

.agent-setting-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.agent-setting-top h3,
.agent-setting-top p,
.agent-setting-top span {
  display: block;
  margin: 0;
}

.agent-setting-top h3 {
  margin: 4px 0;
  font-size: 18px;
}

.agent-setting-top span,
.agent-setting-status span {
  color: var(--muted);
  line-height: 1.45;
}

.agent-enabled {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 8px 10px;
  white-space: nowrap;
  font-weight: 800;
}

.agent-setting-status {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  padding: 12px;
}

.agent-setting-status strong {
  color: var(--primary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.agent-setting-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.agent-setting-card textarea {
  min-height: 88px;
}

.global-agent-dock {
  position: fixed;
  right: 26px;
  top: 96px;
  bottom: 18px;
  z-index: 40;
  width: min(500px, calc(100vw - 36px));
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 255, 255, 0.08), transparent 38%),
    rgba(16, 17, 20, 0.94);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px);
  overflow: hidden;
  opacity: 1;
  transform: translateX(0) scale(1);
  transition:
    opacity 240ms var(--ease-out),
    transform 280ms var(--ease-out),
    border-color var(--transition-fast);
}

.global-chat-body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 12px;
  height: 100%;
  padding: 16px;
}

.global-agent-dock.collapsed .global-chat-body {
  pointer-events: none;
}

.global-agent-dock.collapsed {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 32px)) scale(0.98);
}

.global-chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
}

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

#global-chat-form .global-agent-row {
  grid-template-columns: minmax(0, 0.7fr) auto auto;
}

.global-chat-thread {
  display: grid;
  align-content: end;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.global-chat-thread article {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  padding: 11px;
}

.global-chat-thread article.user {
  margin-left: 10%;
  background: var(--surface-3);
}

.global-chat-thread p,
.global-chat-thread strong,
.global-chat-thread small {
  display: block;
  margin: 0;
}

.global-chat-thread p {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 5px;
}

.global-chat-form {
  display: grid;
  gap: 8px;
}

.global-chat-form textarea {
  min-height: 90px;
}

@media (max-width: 1100px) {
  .kpi-grid,
  .grid-two,
  .grid-three,
  .command-layout,
  .management-grid,
  .ops-strip,
  .daily-cockpit,
  .autopilot-console,
  .mission-map,
  .flow-grid,
  .computer-shell,
  .agent-chat-shell,
  .agent-chat-controls,
  .gateway-grid,
  .action-grid,
  .quick-launch,
  .mission-grid,
  .setup-hero,
  .jarvis-hero,
  .orbital-status,
  .voice-bar {
    grid-template-columns: 1fr;
  }

  .autopilot-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-settings-grid,
  .agent-setting-controls,
  .suggestion-grid,
  .next-action-list {
    grid-template-columns: 1fr;
  }

  .flow-rail {
    grid-template-columns: 1fr;
  }

  .flow-rail i {
    width: 1px;
    height: 16px;
    justify-self: center;
    background: linear-gradient(180deg, var(--border), var(--primary));
  }

  .pipeline-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .studio-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "apps"
      "files"
      "editor"
      "preview"
      "evals"
      "actions";
  }
}

@media (max-width: 820px) {
  html,
  body {
    overflow: hidden;
  }

  .dashboard {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 100dvh;
  }

  .sidebar {
    grid-row: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px;
    max-height: none;
    overflow: hidden;
  }

  .brand {
    margin-bottom: 14px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 10px 13px;
    white-space: nowrap;
  }

  .token-card {
    margin-top: 12px;
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .token-card label {
    grid-column: 1 / -1;
  }

  .header {
    grid-column: 1;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .main,
  .header,
  .sidebar {
    padding: 18px;
  }

  .main {
    grid-column: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 96px;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  h1 {
    font-size: clamp(26px, 8vw, 34px);
  }

  h2 {
    font-size: 21px;
  }

  button,
  .button-link,
  input,
  select {
    min-height: 44px;
  }

  textarea {
    min-height: 140px;
  }

  .setup-hero,
  .jarvis-hero,
  .panel,
  .kpi,
  .ops-strip article {
    border-radius: 18px;
  }

  .jarvis-hero,
  .setup-hero {
    padding: 18px;
  }

  .orbital-status {
    display: none;
  }

  .ops-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-strip strong {
    font-size: 28px;
  }

  .voice-bar {
    grid-template-columns: 1fr 1fr;
  }

  .voice-bar select,
  .voice-readback {
    grid-column: 1 / -1;
  }

  .autopilot-controls {
    grid-template-columns: 1fr;
  }

  .global-agent-dock {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    transform: none;
    width: auto;
    max-height: min(76dvh, 680px);
    border-radius: 20px;
  }

  .global-agent-dock.collapsed {
    transform: translateY(calc(100% + 24px)) scale(0.98);
  }

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

  .command-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .management-grid,
  .command-layout,
  .daily-cockpit,
  .mission-map,
  .flow-grid,
  .computer-shell,
  .pipeline-board {
    grid-template-columns: 1fr;
  }

  .flow-header {
    align-items: stretch;
    flex-direction: column;
  }

  .sandbox-capabilities,
  .agent-constellation,
  .loop-steps,
  .business-dashboard,
  .next-action-list {
    grid-template-columns: 1fr;
  }

  .next-action-card {
    min-height: 74px;
  }

  .map-core {
    min-height: 220px;
  }

  .list-item,
  .policy-row,
  .status-pill {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .studio-shell {
    gap: 12px;
  }

  .file-list {
    max-height: 260px;
  }

  .code-editor {
    min-height: 320px;
    font-size: 12px;
  }

  .studio-preview iframe {
    min-height: 300px;
  }

  pre {
    max-height: 360px;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }
}
