:root {
  /* Product theme — blue & black (matches engineering-runtime-docs) */
  --ink: #000616;
  --panel: #010c20;
  --panel-2: #061428;
  --line: rgba(147, 197, 253, 0.14);
  --text: #e8eef9;
  --muted: #8b9bb8;
  --soft: #c5d0e6;
  --accent: #3b82f6;
  --accent-bright: #60a5fa;
  --accent-2: #2563eb;
  --deny: #f07178;
  --allow: #38bdf8;
  --warn: #f0b429;
  --offline: #64748b;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background-color: var(--ink);
  background-image:
    radial-gradient(1000px 520px at 70% -10%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(800px 420px at 10% 0%, rgba(37, 99, 235, 0.12), transparent 50%),
    radial-gradient(circle at 1px 1px, rgba(59, 130, 246, 0.12) 1px, transparent 0),
    linear-gradient(165deg, #000616 0%, #010c20 42%, #020a1d 100%);
  background-size:
    auto,
    auto,
    28px 28px,
    auto;
  background-attachment: fixed;
}

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

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.rail {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(1, 12, 32, 0.96), rgba(0, 6, 22, 0.98));
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.25rem 0.5rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 18px rgba(59, 130, 246, 0.35));
}

.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  color: var(--soft);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav button:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

.nav button.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--text);
  font-weight: 600;
}

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
  padding: 0.5rem;
}

.main {
  padding: 1.5rem 2rem 2.5rem;
  min-width: 0;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.4rem;
  animation: rise 420ms ease both;
}

.top h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 2.4vw, 2.4rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}

.lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view { animation: rise 480ms ease both; }

.grid {
  display: grid;
  gap: 1rem;
}

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

.stat {
  background: linear-gradient(160deg, rgba(6, 20, 40, 0.95), rgba(1, 12, 32, 0.8));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 70%);
  pointer-events: none;
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat .value {
  margin-top: 0.45rem;
  font-family: var(--serif);
  font-size: 1.9rem;
  letter-spacing: -0.03em;
}

.stat .hint {
  margin-top: 0.25rem;
  color: var(--soft);
  font-size: 0.85rem;
}

.panel {
  background: rgba(1, 12, 32, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  backdrop-filter: blur(8px);
}

.panel h3 {
  margin: 0 0 0.85rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.two-col {
  grid-template-columns: 1.2fr 1fr;
}

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

.mono { font-family: var(--mono); font-size: 0.85rem; }
.muted { color: var(--muted); font-size: 0.85rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.ok, .pill.allowed, .pill.connected, .pill.online, .pill.idle { color: var(--allow); }
.pill.denied, .pill.degraded { color: var(--deny); }
.pill.warn { color: var(--warn); }
.pill.offline { color: var(--offline); }

.btn {
  appearance: none;
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.18);
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.btn:hover { background: rgba(59, 130, 246, 0.28); transform: translateY(-1px); }
.btn.ghost {
  background: transparent;
  border-color: var(--line);
}
.btn.danger {
  border-color: rgba(240, 113, 120, 0.45);
  background: rgba(240, 113, 120, 0.12);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.toolbar input, .toolbar select, .toolbar textarea {
  background: rgba(0, 6, 22, 0.75);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  min-width: 140px;
}

.toolbar input { min-width: 220px; flex: 1; }

.provider-grid, .cap-grid, .fleet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  background: linear-gradient(165deg, rgba(6, 20, 40, 0.9), rgba(0, 6, 22, 0.65));
  transition: transform 180ms ease, border-color 180ms ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.45);
}

.tile h4 {
  margin: 0.55rem 0 0.25rem;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.policy-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

.policy-list {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

.policy-item {
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(1, 12, 32, 0.75);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
}

.policy-item.active-item {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.14);
}

.policy-yaml {
  width: 100%;
  min-height: 360px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  background: #000616;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  resize: vertical;
  color: #dbe7fb;
}

.bars {
  display: grid;
  gap: 0.55rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.88rem;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  width: 0;
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100vh;
  background: #010c20;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 40;
  padding: 1.2rem;
  transform: translateX(0);
  transition: transform 220ms ease;
}

.drawer.hidden { transform: translateX(105%); }
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 6, 22, 0.65);
  z-index: 30;
}
.backdrop.hidden { display: none; }

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3rem;
}

.kv {
  display: grid;
  gap: 0.65rem;
}

.kv div {
  display: grid;
  gap: 0.2rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.kv dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.kv dd { margin: 0; }

.empty {
  color: var(--muted);
  padding: 1.5rem 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .stats, .two-col, .policy-layout { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}
