:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151b23;
  --surface-strong: #1d2631;
  --line: #2a3441;
  --text: #edf2f7;
  --muted: #96a3b5;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --blue: #38bdf8;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 9, 13, 0.92);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 6px;
}

.auth-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: #fca5a5;
  font-size: 0.88rem;
}

.app-shell.locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.user-chip {
  display: grid;
  gap: 2px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-chip strong,
.user-chip small {
  line-height: 1.1;
}

.user-chip small {
  color: var(--muted);
  font-size: 0.76rem;
}


button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #0a0f14;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  color: #061014;
  font-weight: 900;
}

.brand strong,
.brand span,
.sidebar-status strong,
.sidebar-status span {
  display: block;
}

.brand span,
.sidebar-status span,
.eyebrow,
.metric-card small {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  background: var(--surface);
  color: var(--text);
}

.icon {
  width: 22px;
  text-align: center;
  color: var(--blue);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse 1.8s infinite;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

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

.sync-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.sync-status span:first-child {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
}

.sync-status.online span:first-child {
  background: var(--accent);
}

.sync-status.offline span:first-child {
  background: var(--red);
}

.sync-status strong,
.sync-status small {
  display: block;
  line-height: 1.1;
}

.sync-status small {
  color: var(--muted);
  font-size: 0.76rem;
}

.sidebar-status.offline .pulse {
  background: var(--red);
  animation: none;
  box-shadow: none;
}

.sidebar-status.syncing .pulse {
  background: var(--amber);
}


.primary-button,
.secondary-button,
.icon-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
}

.primary-button {
  padding: 0 16px;
  background: var(--accent-strong);
  color: #03130a;
  font-weight: 800;
}

.secondary-button {
  padding: 0 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.icon-button {
  width: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 1rem;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 32px;
  min-height: 270px;
  margin-bottom: 20px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 28%),
    linear-gradient(135deg, #111923, #121a16 62%, #18212a);
  box-shadow: var(--shadow);
}

.command-visual {
  position: relative;
  aspect-ratio: 1;
  min-height: 220px;
}

.orbit,
.core-node,
.node {
  position: absolute;
  border-radius: 50%;
}

.orbit {
  inset: 18%;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.orbit-two {
  inset: 5%;
  border-color: rgba(34, 197, 94, 0.35);
  transform: rotate(35deg) scaleY(0.66);
}

.core-node {
  inset: 38%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  box-shadow: 0 0 34px rgba(34, 197, 94, 0.52);
}

.node {
  width: 18px;
  height: 18px;
  background: var(--text);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.72);
}

.node-a { left: 18%; top: 22%; }
.node-b { right: 9%; top: 44%; background: var(--accent); }
.node-c { left: 43%; bottom: 7%; background: var(--amber); }
.node-d { right: 26%; top: 8%; background: var(--blue); }

.hero-copy h2 {
  max-width: 760px;
  margin: 14px 0 12px;
  font-size: clamp(1.45rem, 3vw, 2.55rem);
  line-height: 1.12;
}

.hero-copy p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  font-size: 0.82rem;
  font-weight: 800;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 2rem;
}

.metric-card.warning strong {
  color: var(--amber);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.panel {
  min-width: 0;
  padding: 18px;
}

select,
input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1218;
  color: var(--text);
  padding: 0 10px;
}

.agent-table,
.mission-list,
.log-feed,
.server-stack {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.agent-row,
.mission-item,
.log-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 15, 20, 0.56);
}

.agent-row {
  grid-template-columns: 1.3fr 0.7fr 0.8fr auto;
  align-items: center;
}

.agent-title strong,
.agent-title span,
.mission-item strong,
.mission-item span,
.log-item span {
  display: block;
}

.agent-title span,
.mission-item span,
.log-item {
  color: var(--muted);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  width: max-content;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.running {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.badge.review {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

.badge.idle {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.server-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

meter {
  width: 100%;
  height: 12px;
}

.mission-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.priority {
  color: var(--amber);
  font-weight: 800;
}

.log-feed {
  max-height: 340px;
  overflow: auto;
}

.log-item {
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: start;
}

dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.mission-form {
  display: grid;
  gap: 16px;
}

.mission-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 16px;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item .icon {
    display: none;
  }

  .hero-band,
  .workspace,
  .two-column {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .nav-list {
    width: 100%;
  }

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

  .sync-status {
    flex: 1 1 100%;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .metrics-grid,
  .agent-row,
  .mission-item,
  .log-item {
    grid-template-columns: 1fr;
  }

  .hero-band {
    padding: 18px;
  }
}

.single-column {
  grid-template-columns: 1fr;
}

.approval-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.approval-item {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 15, 20, 0.56);
}

.approval-item strong,
.approval-item span,
.approval-item small {
  display: block;
}

.approval-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.approval-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.danger-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(239, 68, 68, 0.48);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.approval-section {
  display: grid;
  gap: 10px;
}

.approval-section + .approval-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.approval-section h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
}

.approval-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.approval-state {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.approval-state.pending {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fbbf24;
}

.approval-state.approved {
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
}

.approval-state.rejected {
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.approval-payload {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
}

.approval-payload div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.approval-payload dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.approval-payload dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.86rem;
}

.approval-note {
  padding: 8px;
  border-left: 2px solid var(--accent);
  background: rgba(45, 212, 191, 0.08);
  color: var(--text);
}
