/* MissionOS — Command Center
   Navy / cyan HUD palette, departing from Gcore brand by request. */

:root {
  /* Surfaces */
  --bg-0: #03060d;
  --bg-1: #05080f;
  --bg-2: #070b16;
  --panel: rgba(12, 18, 32, 0.72);
  --panel-solid: #0a1020;
  --panel-raised: rgba(18, 26, 44, 0.78);
  --panel-border: rgba(96, 165, 250, 0.18);
  --panel-border-strong: rgba(96, 165, 250, 0.32);
  --divider: rgba(96, 165, 250, 0.10);

  /* Accents */
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --cyan-glow: rgba(34, 211, 238, 0.45);
  --blue: #3b82f6;
  --teal: #14b8a6;
  --accent: var(--cyan);
  --accent-soft: var(--cyan-soft);
  --accent-glow: var(--cyan-glow);

  /* Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Text */
  --fg: #e5f0ff;
  --fg-muted: #7f8ea3;
  --fg-dim: #4d5a72;

  /* Type */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Inter', system-ui, sans-serif;

  /* Density (mutable via Tweaks) */
  --density: 1;
  --pad-card: calc(20px * var(--density));
  --pad-card-sm: calc(14px * var(--density));
  --gap-card: calc(14px * var(--density));

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --d-fast: 120ms;
  --d-base: 220ms;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 700px at 18% -10%, rgba(34, 211, 238, 0.08), transparent 60%),
    radial-gradient(1000px 600px at 95% 110%, rgba(59, 130, 246, 0.06), transparent 60%),
    var(--bg-0);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle scanline / grid texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  z-index: 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(96, 165, 250, 0.18); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(96, 165, 250, 0.32); background-clip: padding-box; border: 2px solid transparent; }

.mono { font-family: var(--font-mono); }

/* ==========  App shell  ========== */
.app {
  display: grid;
  grid-template-columns: 244px 1fr 360px;
  grid-template-rows: 64px 1fr;
  grid-template-areas:
    "sidebar topbar topbar"
    "sidebar main rightrail";
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* Responsive — collapse right rail / sidebar at narrow widths */
@media (max-width: 1400px) {
  .app { grid-template-columns: 224px 1fr 320px; }
  .tb-stats { gap: 16px; }
}
@media (max-width: 1280px) {
  .app {
    grid-template-columns: 220px 1fr 300px;
  }
  .tb-stats { gap: 14px; }
  .tb-stat-inline { font-size: 12px; }
}
@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px 1fr !important;
    grid-template-areas:
      "sidebar topbar"
      "sidebar main" !important;
  }
  .rightrail { display: none !important; }
  .tb-stat-inline:nth-child(2) .lbl,
  .tb-stat-inline:nth-child(3) .lbl,
  .tb-stat-inline:nth-child(4) .lbl { display: none; }
  .tb-stat-inline { gap: 4px; }
  .tb-command { max-width: 320px; }
}
@media (max-width: 880px) {
  .app {
    grid-template-columns: 64px 1fr !important;
  }
  .sidebar { padding: 14px 8px; }
  .sb-brand-name, .sb-item span, .sb-item .count,
  .sb-section-label, .sb-primary span,
  .sb-core-name, .sb-core-version, .sb-stat-row, .sb-uptime { display: none; }
  .sb-item, .sb-primary { justify-content: center; padding: 9px; }
  .sb-brand { justify-content: center; padding: 4px 0 14px; }
  .sb-core { justify-content: center; padding: 6px; }
  .sb-footer { padding: 8px 0; }
}

.app.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr) 360px;
}
@media (max-width: 1400px) {
  .app.sidebar-collapsed { grid-template-columns: 72px minmax(0, 1fr) 320px; }
}
@media (max-width: 1280px) {
  .app.sidebar-collapsed { grid-template-columns: 72px minmax(0, 1fr) 300px; }
}
@media (max-width: 1180px) {
  .app.sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr) !important;
  }
}

/* ==========  Sidebar: instance switcher  ========== */
.sb-instance-wrap {
  position: relative;
  margin: 0 2px 10px;
}
.sb-instance {
  width: 100%;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  padding: 10px 11px 9px;
  cursor: pointer;
  transition: border-color var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out);
  text-align: left;
  font-family: inherit;
  display: block;
}
.sb-instance:hover {
  border-color: var(--panel-border-strong);
  background: rgba(8, 12, 22, 0.75);
}
.sb-instance.is-open {
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(8, 12, 22, 0.85);
}

.sb-instance-label {
  display: flex;
  align-items: center;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  margin-bottom: 7px;
  gap: 6px;
}
.sb-instance-label > span:first-child { white-space: nowrap; }
.sb-env {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  border: 1px solid var(--divider);
  color: var(--fg-muted);
  background: rgba(96, 165, 250, 0.05);
}
.sb-env.env-production {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.08);
}
.sb-env.env-staging {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
}
.sb-env.env-dev {
  color: var(--blue);
  border-color: rgba(59, 130, 246, 0.32);
  background: rgba(59, 130, 246, 0.08);
}

.sb-instance-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--divider);
  min-width: 0;
}
.sb-instance-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(59, 130, 246, 0.12));
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.sb-instance-meta { flex: 1; min-width: 0; }
.sb-instance-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-instance-slug {
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-instance-chev {
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: color var(--d-fast) var(--ease-out);
}
.sb-instance:hover .sb-instance-chev,
.sb-instance.is-open .sb-instance-chev { color: var(--accent); }

.sb-instance-endpoint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 9px;
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}
.sb-instance-endpoint .ico { flex-shrink: 0; color: var(--fg-dim); }
.sb-instance-endpoint .mono {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Switcher dropdown menu */
.sb-instance-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.98), rgba(8, 12, 22, 0.98));
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--r-md);
  box-shadow: 0 14px 32px -8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(34, 211, 238, 0.08);
  padding: 6px;
  z-index: 50;
  min-width: 280px;
  opacity: 1;
}
.sb-instance-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  border-bottom: 1px solid var(--divider);
  margin-bottom: 4px;
}
.sb-instance-menu-head .muted { color: var(--fg-dim); }

.sb-instance-menu-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: background var(--d-fast) var(--ease-out);
  font-family: inherit;
}
.sb-instance-menu-row:hover { background: rgba(96, 165, 250, 0.06); }
.sb-instance-menu-row.is-active { background: var(--accent-soft); }
.sb-instance-menu-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(59, 130, 246, 0.10));
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.sb-instance-menu-row.is-active .sb-instance-menu-icon {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: var(--bg-0);
}
.sb-instance-menu-name {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-status-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
  flex-shrink: 0;
}
.sb-status-dot.idle { background: var(--fg-muted); box-shadow: none; }
.sb-status-dot.warning { background: var(--warning); box-shadow: 0 0 4px var(--warning); }
.sb-status-dot.offline { background: var(--danger); box-shadow: 0 0 4px var(--danger); }
.sb-instance-menu-sub {
  font-size: 10.5px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-instance-menu-foot {
  border-top: 1px solid var(--divider);
  padding: 6px 0 0;
  margin-top: 4px;
  display: flex;
  gap: 4px;
}

/* ==========  Sidebar  ========== */
.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--divider);
  background: linear-gradient(180deg, rgba(8, 12, 22, 0.78), rgba(3, 5, 11, 0.96));
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  gap: 4px;
  overflow: visible;
  position: relative;
  z-index: 10;
}
.sb-brand-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 0 10px;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: inherit;
  flex: 1;
  min-width: 0;
  border-radius: var(--r-sm);
  transition: background var(--d-fast) var(--ease-out);
}
.sb-brand:hover { background: rgba(96, 165, 250, 0.04); }
.sb-brand:hover .sb-brand-mark { filter: drop-shadow(0 0 10px var(--accent-glow)); }
.sb-brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  position: relative;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.sb-brand-name {
  font-weight: 700;
  letter-spacing: -0.005em;
  font-size: 17px;
  color: var(--fg);
}
.sb-collapse {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--panel-border);
  background: rgba(8, 12, 22, 0.55);
  color: var(--fg-muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out);
}
.sb-collapse:hover,
.sb-collapse:focus-visible {
  color: var(--accent);
  border-color: var(--panel-border-strong);
  background: rgba(96, 165, 250, 0.08);
  outline: none;
}

.sb-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 0 2px 6px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.18);
  cursor: pointer;
  transition: all var(--d-fast) var(--ease-out);
  width: calc(100% - 4px);
  text-align: left;
  white-space: nowrap;
}
.sb-primary:hover { background: rgba(34, 211, 238, 0.14); border-color: rgba(34, 211, 238, 0.32); }
.sb-primary.is-active {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.16), rgba(34, 211, 238, 0.06) 90%);
  border-color: rgba(34, 211, 238, 0.4);
  color: var(--accent);
  box-shadow: 0 0 18px -4px var(--accent-glow), inset 0 0 0 1px rgba(34, 211, 238, 0.15);
}
.sb-primary .ico { color: var(--accent); }

.sb-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 -4px;
  padding: 0 4px;
}
.sb-group { margin-bottom: 6px; }

.sb-section-label {
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 12px 12px 4px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out);
  white-space: nowrap;
}
.sb-item:hover { color: var(--fg); background: rgba(96, 165, 250, 0.04); }
.sb-item.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}
.sb-item.is-active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  border-radius: 999px;
}
.sb-item .ico { width: 15px; height: 15px; flex-shrink: 0; }
.sb-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.sb-item.is-active .count { color: var(--accent); }

.sb-footer {
  margin-top: auto;
  padding: 12px 4px 2px;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sb-core {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: var(--r-md);
  position: relative;
}
.sb-core-mark {
  position: relative;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.sb-core-pulse {
  position: absolute;
  right: -2px; top: -2px;
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 999px;
  box-shadow: 0 0 6px var(--success);
  border: 1.5px solid var(--bg-0);
  animation: pulse-dot 2s var(--ease-out) infinite;
}
.sb-core-name { font-size: 12.5px; font-weight: 600; color: var(--fg); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-core-version { font-size: 10.5px; color: var(--fg-muted); font-family: var(--font-mono); margin-top: 2px; white-space: nowrap; }

.sb-stat-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
  padding: 0 8px;
  letter-spacing: 0.02em;
}
.sb-uptime {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 8px;
}
.sb-uptime .lbl { color: var(--fg-dim); }
.sb-uptime .val { color: var(--fg); }

.app.sidebar-collapsed .sidebar {
  padding: 16px 8px 14px;
}
.app.sidebar-collapsed .sb-brand-row {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
}
.app.sidebar-collapsed .sb-brand {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  justify-content: center;
  padding: 4px;
}
.app.sidebar-collapsed .sb-collapse {
  width: 32px;
  height: 28px;
}
.app.sidebar-collapsed .sb-brand-name,
.app.sidebar-collapsed .sb-item span,
.app.sidebar-collapsed .sb-item .count,
.app.sidebar-collapsed .sb-section-label,
.app.sidebar-collapsed .sb-primary span,
.app.sidebar-collapsed .sb-core-name,
.app.sidebar-collapsed .sb-core-version,
.app.sidebar-collapsed .sb-stat-row,
.app.sidebar-collapsed .sb-uptime,
.app.sidebar-collapsed .sb-instance-wrap {
  display: none;
}
.app.sidebar-collapsed .sb-scroll {
  margin: 0;
  padding: 0;
}
.app.sidebar-collapsed .sb-group {
  margin-bottom: 6px;
}
.app.sidebar-collapsed .sb-item,
.app.sidebar-collapsed .sb-primary {
  justify-content: center;
  padding: 9px;
}
.app.sidebar-collapsed .sb-item.is-active::before {
  left: -8px;
}
.app.sidebar-collapsed .sb-footer {
  padding: 8px 0;
}
.app.sidebar-collapsed .sb-core {
  justify-content: center;
  padding: 6px;
}

/* ==========  Top bar  ========== */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  border-bottom: 1px solid var(--divider);
  background: linear-gradient(180deg, rgba(8, 12, 22, 0.78), rgba(5, 8, 15, 0.5));
  backdrop-filter: blur(12px);
}
.tb-mobile-home {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--panel-border);
  background: rgba(8, 12, 22, 0.6);
  color: var(--fg-muted);
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--d-fast) var(--ease-out);
}
.tb-mobile-home:hover,
.tb-mobile-home:focus-visible {
  color: var(--accent);
  border-color: var(--panel-border-strong);
  background: rgba(96, 165, 250, 0.08);
  outline: none;
}
.tb-command {
  flex: 1;
  max-width: 540px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 36px;
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
.tb-command:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.tb-command .ico { color: var(--fg-muted); flex-shrink: 0; }
.tb-command input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--fg);
}
.tb-command input::placeholder { color: var(--fg-dim); }
.tb-command .kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  padding: 2px 6px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-xs);
}

.tb-stats {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}
.tb-stat-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
  border-radius: var(--r-sm);
}
.tb-stat-link {
  padding: 5px 7px;
  margin: -5px -7px;
  cursor: pointer;
  transition: color var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out);
}
.tb-stat-link:hover,
.tb-stat-link:focus-visible {
  background: rgba(245, 158, 11, 0.10);
  outline: none;
}
.tb-stat-link:hover .lbl,
.tb-stat-link:focus-visible .lbl,
.tb-stat-link:hover .val,
.tb-stat-link:focus-visible .val {
  color: var(--warning);
}
.tb-stat-inline .dot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; }
.tb-stat-inline .val {
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.tb-stat-inline .lbl {
  color: var(--fg-muted);
  font-weight: 500;
}

.tb-bell {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--panel-border);
  background: rgba(8, 12, 22, 0.6);
  color: var(--fg-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--d-fast) var(--ease-out);
  flex-shrink: 0;
}
.tb-bell:hover { color: var(--fg); border-color: var(--panel-border-strong); background: rgba(96, 165, 250, 0.08); }

.tb-theme {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--panel-border);
  background: rgba(8, 12, 22, 0.6);
  color: var(--fg-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--d-fast) var(--ease-out);
  flex-shrink: 0;
}
.tb-theme:hover {
  color: var(--accent);
  border-color: var(--panel-border-strong);
  background: rgba(96, 165, 250, 0.08);
}
.tb-bell-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg-0);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.45);
}

.tb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(8, 12, 22, 0.85);
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg);
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========  Main  ========== */
.main {
  grid-area: main;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Generic panel */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(6px);
  position: relative;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
}
.panel-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
}
.panel-sub {
  font-size: 11px;
  color: var(--fg-muted);
}
.panel-eyebrow {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  font-family: var(--font-mono);
}
.panel-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }

/* ==========  Hero: core + topology  ========== */
.hero {
  position: relative;
  height: 420px;
  overflow: hidden;
  padding: 0;
  background:
    radial-gradient(ellipse 800px 500px at 50% 50%, rgba(34, 211, 238, 0.08), transparent 65%),
    linear-gradient(180deg, rgba(8, 14, 26, 0.85), rgba(5, 8, 15, 0.95));
}
.hero-head {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 4;
  pointer-events: none;
}
.hero-head > * { pointer-events: auto; }

.hero-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-muted);
}
.hero-status .pip {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-dot 2s var(--ease-out) infinite;
}

.hero-readout {
  display: flex;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
}
.hero-readout span b { color: var(--fg); font-weight: 600; }

.hero-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* The orb */
.orb {
  position: relative;
  width: 280px;
  height: 280px;
  display: grid;
  place-items: center;
}
.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.orb-ring.r1 { inset: 0; animation: spin-slow 60s linear infinite; border-style: dashed; border-color: rgba(34, 211, 238, 0.20); }
.orb-ring.r2 { inset: 24px; animation: spin-slow 80s linear infinite reverse; border-color: rgba(59, 130, 246, 0.28); }
.orb-ring.r3 { inset: 54px; border-color: rgba(34, 211, 238, 0.35); animation: pulse-ring 4s var(--ease-out) infinite; }
.orb-ring.r4 { inset: 80px; border-color: rgba(20, 184, 166, 0.3); }

.orb-core {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 35%, rgba(255,255,255,0.4) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, var(--cyan) 0%, var(--blue) 60%, #1e3a8a 100%);
  box-shadow:
    0 0 40px var(--accent-glow),
    0 0 80px rgba(34, 211, 238, 0.25),
    inset 0 0 30px rgba(255,255,255,0.18);
  animation: core-breathe 3.6s var(--ease-out) infinite;
  position: relative;
}
.orb-core::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid rgba(34, 211, 238, 0.4);
  animation: ping-out 2.4s var(--ease-out) infinite;
}

/* Orbiting dots */
.orb-orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: spin-slow 24s linear infinite;
}
.orb-orbit.fast { animation-duration: 14s; animation-direction: reverse; inset: 28px; }
.orb-orbit .dot {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transform: translateX(-50%);
}
.orb-orbit .dot.b { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.orb-orbit .dot.t { background: var(--teal); box-shadow: 0 0 8px var(--teal); }

/* Radial labels around orb */
.orb-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 4px 10px;
  background: rgba(8, 12, 22, 0.85);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-pill);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.orb-label::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* Topology spokes (SVG layer) */
.topology-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

/* Topology nodes positioned around the orb */
.topo-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: rgba(10, 16, 32, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  font-size: 11px;
  font-weight: 500;
  z-index: 3;
  cursor: pointer;
  transition: transform var(--d-base) var(--ease-out), border-color var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out);
  max-width: 180px;
}
.topo-node:hover,
.topo-node.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 0 18px rgba(34, 211, 238, 0.18);
  transform: translateY(-1px);
}
.topo-node .node-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  flex-shrink: 0;
}
.topo-node.is-warning .node-dot { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.topo-node.is-idle .node-dot { background: var(--fg-muted); box-shadow: none; }
.topo-node .node-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topo-node .node-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-muted);
  padding: 1px 5px;
  border: 1px solid var(--divider);
  border-radius: var(--r-xs);
  margin-left: 2px;
}

.topo-link-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(5, 8, 15, 0.85);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  z-index: 2;
}

/* ==========  Section title bar  ========== */
.section-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.section-bar h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
}
.section-bar .count-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  font-weight: 600;
}
.section-bar .spacer { flex: 1; }
.section-bar .filters {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid var(--divider);
  border-radius: var(--r-pill);
}
.section-bar .filters button {
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  transition: color var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out);
}
.section-bar .filters button:hover { color: var(--fg); }
.section-bar .filters button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.section-filter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: rgba(8, 12, 22, 0.7);
  border: 1px solid var(--divider);
  border-radius: var(--r-pill);
}
.section-filter button {
  padding: 4px 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
  transition: color var(--d-fast) var(--ease-out), background var(--d-fast) var(--ease-out);
}
.section-filter button:hover {
  color: var(--fg);
}
.section-filter button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ==========  Agent cards  ========== */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-card);
}
@media (max-width: 1400px) { .agent-grid { grid-template-columns: repeat(2, 1fr); } }

.agent-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  position: relative;
  cursor: pointer;
  transition: border-color var(--d-base) var(--ease-out), transform var(--d-base) var(--ease-out), box-shadow var(--d-base) var(--ease-out);
  overflow: hidden;
}
.agent-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(400px 200px at 0% 0%, rgba(34, 211, 238, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity var(--d-base) var(--ease-out);
  pointer-events: none;
}
.agent-card:hover { border-color: var(--panel-border-strong); }
.agent-card:hover::before { opacity: 1; }
.agent-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft), 0 8px 32px -8px rgba(34, 211, 238, 0.25);
}
.agent-card.is-selected::before { opacity: 1; }

.ac-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.ac-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(59, 130, 246, 0.12));
  border: 1px solid var(--panel-border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent);
}
.ac-title-block { flex: 1; min-width: 0; }
.ac-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ac-status-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.ac-status-dot.online {
  animation: pulse-dot 2s var(--ease-out) infinite;
}
.ac-status-dot.idle { background: var(--fg-muted); box-shadow: none; }
.ac-status-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.ac-status-dot.offline { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.ac-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.06em;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ac-meta .sep { opacity: 0.4; }

.ac-mission {
  font-size: 12px;
  color: var(--fg);
  background: rgba(96, 165, 250, 0.05);
  border: 1px solid var(--divider);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ac-mission .ico { color: var(--accent); flex-shrink: 0; }
.ac-mission-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 500;
  color: var(--fg-muted);
  background: rgba(96, 165, 250, 0.06);
  border: 1px solid var(--divider);
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.badge .ico { width: 10px; height: 10px; }
.badge.ok { color: var(--success); border-color: rgba(34, 197, 94, 0.2); background: rgba(34, 197, 94, 0.06); }
.badge.warn { color: var(--warning); border-color: rgba(245, 158, 11, 0.2); background: rgba(245, 158, 11, 0.06); }

.ac-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.ac-metric {
  background: rgba(5, 8, 15, 0.5);
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  padding: 6px 8px;
}
.ac-metric-label {
  font-size: 9.5px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
}
.ac-metric-label .v { color: var(--fg); }
.ac-metric-bar {
  height: 4px;
  background: rgba(96, 165, 250, 0.1);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.ac-metric-bar > span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  border-radius: 999px;
  box-shadow: 0 0 6px var(--accent-glow);
}
.ac-metric-bar.high > span { background: linear-gradient(90deg, var(--warning), var(--danger)); box-shadow: 0 0 6px rgba(245, 158, 11, 0.4); }

.ac-sparkline {
  height: 32px;
  margin-bottom: 10px;
  position: relative;
}
.ac-sparkline svg { width: 100%; height: 100%; display: block; overflow: visible; }

.ac-footer {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}
.ac-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-muted);
  background: rgba(96, 165, 250, 0.05);
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  transition: all var(--d-fast) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.ac-btn:hover {
  color: var(--fg);
  background: rgba(96, 165, 250, 0.1);
  border-color: var(--panel-border-strong);
}
.ac-btn.primary {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(34, 211, 238, 0.3);
}
.ac-btn.primary:hover { background: rgba(34, 211, 238, 0.22); }

.ac-heartbeat {
  position: absolute;
  top: var(--pad-card);
  right: var(--pad-card);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-dim);
  letter-spacing: 0.06em;
}

/* ==========  Mission queue  ========== */
.missions {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mission {
  display: grid;
  grid-template-columns: 26px 1.2fr 1fr 80px 60px 1.2fr;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--d-fast) var(--ease-out);
}
.mission:last-child { border-bottom: none; }
.mission:hover { background: rgba(96, 165, 250, 0.04); }
.mission-check {
  width: 16px; height: 16px;
  border-radius: var(--r-xs);
  border: 1.5px solid var(--fg-dim);
  display: grid;
  place-items: center;
  transition: all var(--d-fast) var(--ease-out);
}
.mission.done .mission-check {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg-0);
}
.mission.done .mission-title { color: var(--fg-muted); text-decoration: line-through; text-decoration-color: var(--fg-dim); }
.mission-title { color: var(--fg); font-weight: 500; }
.mission-agent {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.mission-agent .agent-pip {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--accent);
}
.mission-priority {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  text-align: center;
  display: inline-block;
  letter-spacing: 0.08em;
}
.mission-priority.p1 { color: var(--danger); background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); }
.mission-priority.p2 { color: var(--warning); background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.3); }
.mission-priority.p3 { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(34, 211, 238, 0.3); }
.mission-priority.p4 { color: var(--fg-muted); background: rgba(127, 142, 163, 0.1); border: 1px solid var(--divider); }

.mission-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mission-progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(96, 165, 250, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.mission-progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  border-radius: 999px;
  transition: width 600ms var(--ease-out);
}
.mission-progress-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  width: 32px;
  text-align: right;
}

.mission.add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  cursor: text;
}
.mission.add-row .ico { color: var(--fg-dim); }
.mission.add-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--fg);
}
.mission.add-row input::placeholder { color: var(--fg-dim); }

/* ==========  Right rail  ========== */
.rightrail {
  grid-area: rightrail;
  border-left: 1px solid var(--divider);
  background: linear-gradient(180deg, rgba(8, 12, 22, 0.5), rgba(5, 8, 15, 0.85));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.rr-section { border-bottom: 1px solid var(--divider); padding: 16px 18px; }
.rr-section:last-child { border-bottom: none; }

.rr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.rr-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
}
.rr-head .indicator {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 2s var(--ease-out) infinite;
}
.rr-head .ico-btn {
  margin-left: auto;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  border-radius: var(--r-xs);
  transition: all var(--d-fast) var(--ease-out);
}
.rr-head .ico-btn:hover { color: var(--fg); background: rgba(96, 165, 250, 0.08); }

/* Selected agent detail */
.detail-empty {
  text-align: center;
  padding: 18px 8px;
  color: var(--fg-muted);
  font-size: 12px;
}
.detail-empty .hint {
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 4px;
  font-family: var(--font-mono);
}

.detail-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
}
.detail-card-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: grid;
  place-items: center;
  color: var(--bg-0);
  flex-shrink: 0;
}
.detail-card-name { font-weight: 600; font-size: 14px; }
.detail-card-sub { font-size: 11px; color: var(--fg-muted); font-family: var(--font-mono); }

.detail-kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  font-size: 12px;
  margin-top: 4px;
}
.detail-kv dt { color: var(--fg-muted); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; align-self: center; }
.detail-kv dd { margin: 0; color: var(--fg); text-align: right; }
.detail-kv dd code { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }

.detail-resource {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}
.detail-resource-row {
  display: grid;
  grid-template-columns: 34px 1fr 36px;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
}
.detail-resource-row .bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  overflow: hidden;
}
.detail-resource-row .bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  box-shadow: 0 0 6px var(--accent-glow);
}
.detail-resource-row b {
  color: var(--fg);
  font-weight: 600;
  text-align: right;
}

.detail-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.detail-mini-grid > div {
  padding: 7px 8px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: rgba(96, 165, 250, 0.04);
  min-width: 0;
}
.detail-mini-grid span {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-mini-grid b {
  display: block;
  margin-top: 2px;
  color: var(--fg);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.detail-profile-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.detail-profile-list span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-muted);
  padding: 2px 7px;
  border: 1px solid var(--divider);
  border-radius: var(--r-pill);
  background: rgba(96, 165, 250, 0.04);
}
.detail-profile-list span.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(34, 211, 238, 0.32);
}

/* Events feed */
.events { display: flex; flex-direction: column; gap: 8px; }
.event {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  position: relative;
}
.event-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  width: 38px;
  padding-top: 2px;
}
.event-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid var(--divider);
  display: grid;
  place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.event-icon.ok { color: var(--success); border-color: rgba(34, 197, 94, 0.3); }
.event-icon.warn { color: var(--warning); border-color: rgba(245, 158, 11, 0.3); }
.event-icon.info { color: var(--blue); border-color: rgba(59, 130, 246, 0.3); }
.event-icon.user { color: var(--teal); border-color: rgba(20, 184, 166, 0.3); }
.event-body { flex: 1; min-width: 0; }
.event-msg { color: var(--fg); line-height: 1.4; font-size: 12px; }
.event-meta { font-size: 10.5px; color: var(--fg-muted); margin-top: 2px; font-family: var(--font-mono); }

.event.new {
  animation: slide-in 320ms var(--ease-out);
}

/* Approvals */
.approval {
  background: rgba(245, 158, 11, 0.04);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: var(--r-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  transition: all var(--d-base) var(--ease-out);
}
.approval.approved { background: rgba(34, 197, 94, 0.06); border-color: rgba(34, 197, 94, 0.28); }
.approval.denied { background: rgba(239, 68, 68, 0.04); border-color: rgba(239, 68, 68, 0.22); opacity: 0.65; }
.approval:last-child { margin-bottom: 0; }
.approval-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.approval-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--warning);
  padding: 2px 6px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: var(--r-xs);
}
.approval.approved .approval-tag { color: var(--success); background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.32); }
.approval.denied .approval-tag { color: var(--danger); background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.32); }
.approval-title { font-size: 13px; font-weight: 500; color: var(--fg); }
.approval-meta { font-size: 11px; color: var(--fg-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.approval-meta .sep { opacity: 0.4; }
.approval-actions { display: flex; gap: 6px; margin-top: 2px; }
.approval-btn {
  flex: 1;
  padding: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  background: rgba(96, 165, 250, 0.05);
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  transition: all var(--d-fast) var(--ease-out);
}
.approval-btn:hover { color: var(--fg); background: rgba(96, 165, 250, 0.12); }
.approval-btn.approve:hover { color: var(--success); background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.32); }
.approval-btn.deny:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.32); }
.approval-resolved {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-muted);
  text-align: center;
  padding: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ==========  Animations  ========== */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.04); opacity: 0.6; }
}
@keyframes spin-slow {
  to { transform: rotate(360deg); }
}
@keyframes core-breathe {
  0%, 100% {
    box-shadow:
      0 0 40px var(--accent-glow),
      0 0 80px rgba(34, 211, 238, 0.25),
      inset 0 0 30px rgba(255,255,255,0.18);
  }
  50% {
    box-shadow:
      0 0 60px var(--accent-glow),
      0 0 110px rgba(34, 211, 238, 0.35),
      inset 0 0 36px rgba(255,255,255,0.22);
  }
}
@keyframes ping-out {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes dash-flow {
  to { stroke-dashoffset: -200; }
}

/* Topology flow lines */
.topo-link {
  stroke: rgba(34, 211, 238, 0.35);
  stroke-width: 1;
  fill: none;
}
.topo-link-flow {
  stroke: var(--accent);
  stroke-width: 1.2;
  fill: none;
  stroke-dasharray: 3 6;
  animation: dash-flow 4s linear infinite;
  opacity: 0.85;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

@media (prefers-reduced-motion: reduce) {
  .orb-orbit, .orb-ring, .topo-link-flow, .ac-status-dot.online, .rr-head .indicator, .hero-status .pip, .orb-core, .orb-core::after { animation: none !important; }
}

@media (max-width: 720px) {
  body {
    overflow: hidden;
  }

  .app {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 56px minmax(0, 1fr) 64px;
    grid-template-areas:
      "topbar"
      "main"
      "sidebar" !important;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
  }

  .app.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .topbar {
    min-width: 0;
    width: 100%;
    gap: 8px;
    padding: 0 10px;
  }

  .tb-mobile-home {
    display: grid;
  }

  .tb-command {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
  }

  .tb-command input::placeholder {
    color: transparent;
  }

  .tb-command .kbd,
  .tb-stats,
  .tb-avatar {
    display: none !important;
  }

  .tb-theme,
  .tb-bell {
    width: 34px;
    height: 34px;
  }

  .sidebar {
    grid-area: sidebar;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    height: 64px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--divider);
    background: linear-gradient(180deg, rgba(8, 12, 22, 0.96), rgba(3, 5, 11, 0.98));
    overflow: hidden;
  }

  .sb-brand-row,
  .sb-brand,
  .sb-instance-wrap,
  .sb-footer {
    display: none !important;
  }

  .sb-scroll {
    flex: 1;
    display: flex;
    gap: 6px;
    align-items: stretch;
    min-width: 0;
    margin: 0;
    padding: 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .sb-scroll::-webkit-scrollbar {
    display: none;
  }

  .sb-group {
    display: flex;
    gap: 6px;
    margin: 0;
  }

  .sb-section-label {
    display: none;
  }

  .sb-item {
    width: 46px;
    min-width: 46px;
    height: 48px;
    padding: 0;
    justify-content: center;
    align-items: center;
    border-radius: var(--r-md);
  }

  .sb-item.is-active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 4px;
    width: auto;
    height: 2px;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 14px 12px 20px;
    gap: 14px;
    overflow-x: hidden;
  }

  .hero {
    height: 340px;
  }

  .hero-head {
    left: 12px;
    right: 12px;
    top: 12px;
    align-items: flex-start;
    gap: 8px;
  }

  .hero-status {
    min-width: 0;
    max-width: 58%;
    gap: 7px;
    font-size: 10px;
    line-height: 1.3;
    flex-wrap: wrap;
  }

  .hero-readout {
    justify-content: flex-end;
    gap: 8px;
    max-width: 42%;
    flex-wrap: wrap;
    font-size: 10px;
  }

  .orb {
    width: 210px;
    height: 210px;
    transform: translateY(16px);
  }

  .orb-core {
    width: 72px;
    height: 72px;
  }

  .orb-label {
    display: none;
  }

  .topo-node {
    max-width: 132px;
    padding: 6px 8px;
    gap: 6px;
    font-size: 10px;
  }

  .topo-node .node-badge,
  .topo-link-label {
    display: none;
  }

  .section-bar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .section-bar .spacer {
    display: none;
  }

  .section-bar .filters,
  .section-filter {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--r-md);
  }

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

  .agent-card {
    padding: 14px;
  }

  .ac-head {
    padding-right: 0;
  }

  .ac-name,
  .ac-meta {
    min-width: 0;
    flex-wrap: wrap;
  }

  .ac-heartbeat {
    position: static;
    margin-bottom: 8px;
  }

  .ac-footer {
    flex-wrap: wrap;
  }

  .ac-btn {
    min-width: calc(50% - 3px);
  }

  .mission {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 7px 10px;
    align-items: flex-start;
    padding: 12px 14px;
  }

  .mission-title,
  .mission-agent,
  .mission-progress,
  .mission > div:nth-child(n + 4) {
    grid-column: 2;
  }

  .mission-title {
    min-width: 0;
    line-height: 1.35;
  }

  .mission-agent {
    min-width: 0;
    flex-wrap: wrap;
  }

  .mission-progress {
    width: 100%;
  }

  .mission.add-row {
    display: flex;
    padding: 12px 14px;
  }

  .mission.add-row input {
    min-width: 0;
  }

  .panel-head {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 13px 14px;
  }

  .panel-actions {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }
}
