/**
 * gardai labs · Enterprise AI Security & Governance Platform
 * Command Center Design System
 */

:root {
  /* Brand Core Palette */
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-primary-dark: #1e40af;
  --brand-primary-soft: rgba(37, 99, 235, 0.08);
  --brand-primary-border: rgba(37, 99, 235, 0.22);
  --brand-gold: #f59e0b;
  --brand-gold-glow: #fbbf24;
  --brand-navy: #0b1329;
  --brand-navy-surface: #101c38;
  --brand-navy-border: #1e2f56;

  /* Semantic Security States */
  --accent: #10b981;              /* Safe / Allowed / Enforced */
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-border: rgba(16, 185, 129, 0.28);
  --accent-dark: #059669;
  --green: #10b981;

  --violet: #8b5cf6;              /* Registered / System Profile */
  --violet-soft: rgba(139, 92, 246, 0.12);
  --violet-border: rgba(139, 92, 246, 0.28);

  --amber: #f59e0b;               /* Warning / Needs Review */
  --amber-soft: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.28);

  --blue: #2563eb;                /* Shadow Monitoring / In Flight */
  --blue-soft: rgba(37, 99, 235, 0.10);
  --blue-border: rgba(37, 99, 235, 0.25);

  --red: #ef4444;                 /* Threat / Blocked / Critical */
  --red-soft: rgba(239, 68, 68, 0.12);
  --red-border: rgba(239, 68, 68, 0.28);
  --red-dark: #b91c1c;

  /* Neutrals & Surfaces */
  --ink: #0f172a;                 /* Slate 900 */
  --ink-light: #334155;           /* Slate 700 */
  --muted: #64748b;               /* Slate 500 */
  --muted-light: #94a3b8;         /* Slate 400 */
  --line: #e2e8f0;                /* Slate 200 */
  --line-subtle: #f1f5f9;         /* Slate 100 */
  --paper: #f8fafc;               /* Slate 50 */
  --sunk: #f1f5f9;                /* Inset Background */
  --white: #ffffff;
  --deep: #0f172a;

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 18px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 14px 34px -4px rgba(15, 23, 42, 0.10), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.55 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

/* =====================================================================
   SHELL & LAYOUT
   ===================================================================== */
.shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  background: linear-gradient(180deg, #0b1329 0%, #070d1e 100%);
  color: #dbe4f0;
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid var(--brand-navy-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: white;
  text-decoration: none;
  padding: 4px 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font: 800 15px 'IBM Plex Sans', sans-serif;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fbbf24;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font: 700 17px/1.2 'IBM Plex Sans', sans-serif;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8da2c0;
  margin-top: 2px;
  font-weight: 600;
}

/* Sidebar Navigation */
nav {
  display: grid;
  gap: 4px;
}

.nav-section-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5d7292;
  padding: 14px 10px 4px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #9cb1ce;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s ease;
  border: 1px solid transparent;
}

nav a span {
  width: 20px;
  text-align: center;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #728aa9;
  transition: color 0.16s;
}

nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

nav a:hover span {
  color: #a8c4ea;
}

nav a.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.24) 0%, rgba(37, 99, 235, 0.08) 100%);
  color: #ffffff;
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: inset 3px 0 0 #3b82f6, 0 2px 10px rgba(37, 99, 235, 0.15);
}

nav a.active span {
  color: #60a5fa;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.environment i,
.api-state i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18), 0 0 10px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
  animation: pulse-ring 2.5s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.08); }
  100% { box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
}

.environment strong {
  display: block;
  font-size: 11px;
  color: #e2e8f0;
  font-weight: 600;
}

.environment small {
  display: block;
  font-size: 10px;
  color: #8298b6;
}

.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #a3b7d2;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.18s;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* =====================================================================
   MAIN CONTAINER & TOPBAR
   ===================================================================== */
main {
  margin-left: 256px;
  min-height: 100vh;
  flex: 1;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 70px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.eyebrow,
.kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 7px;
}

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

.api-state {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.api-state.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--red);
}

.api-state.error i {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
  animation: none;
}

.org-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.org-switch select {
  width: auto;
  min-width: 160px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}

/* Common Buttons */
.button {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 16px;
  font: 700 12px/1.4 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button.primary {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  border-color: rgba(255, 255, 255, 0.1);
}

.button.primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.button.secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover {
  background: #f8fafc;
  color: var(--ink);
  border-color: #cbd5e1;
}

.button.wide {
  width: 100%;
  padding: 12px;
  font-size: 13px;
}

.mobile-nav {
  display: none;
}

/* =====================================================================
   PAGES
   ===================================================================== */
.page {
  display: none;
  padding: 36px 36px 60px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.page.active {
  display: block;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
}

.page-title h1 {
  font: 700 28px/1.2 'IBM Plex Sans', sans-serif;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.page-title p,
.subhead {
  color: var(--muted);
  max-width: 680px;
  margin: 8px 0 0;
  font-size: 14px;
}

/* =====================================================================
   OVERVIEW COMMAND CENTER
   ===================================================================== */
.hero {
  background: linear-gradient(135deg, #ffffff 0%, #f0f4fc 100%);
  border: 1px solid #dce4f2;
  border-radius: 16px;
  padding: 32px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
  right: -50px;
  top: -90px;
  pointer-events: none;
}

.hero h1 {
  font: 700 30px/1.25 'IBM Plex Sans', sans-serif;
  margin: 0;
  letter-spacing: -0.025em;
  color: #0b1329;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent-dark);
}

.score-ring {
  position: relative;
  z-index: 1;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) 0deg, #e2e8f0 0);
  margin-right: 20px;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.22);
  flex-shrink: 0;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

.score-ring div {
  z-index: 1;
  text-align: center;
}

.score-ring strong {
  display: block;
  font: 800 32px/1 'IBM Plex Sans', sans-serif;
  color: var(--ink);
}

.score-ring small {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Stats Metrics Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.stats article {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.stats article:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-icon.violet { background: var(--violet-soft); color: var(--violet); border: 1px solid var(--violet-border); }
.stat-icon.green  { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid var(--accent-border); }
.stat-icon.amber  { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.stat-icon.blue   { background: var(--blue-soft); color: var(--blue); border: 1px solid var(--blue-border); }
.stat-icon.red    { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }

.stats small {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.stats strong {
  display: block;
  font: 800 28px/1.1 'IBM Plex Sans', sans-serif;
  color: var(--ink);
  margin: 3px 0 2px;
}

.stats p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 18px;
  margin: 20px 0;
}

.two-one {
  grid-template-columns: 2fr 1fr;
}

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

/* Panels */
.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  font: 700 18px/1.3 'IBM Plex Sans', sans-serif;
  margin: 0;
  color: var(--ink);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.text-button {
  border: 0;
  background: none;
  color: var(--brand-primary);
  font: 700 12px 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  padding: 0;
}

.text-button:hover {
  text-decoration: underline;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 38px 20px;
  font-size: 13px;
}

/* Risk Distribution Bars */
.risk-row {
  display: grid;
  grid-template-columns: 85px 1fr 34px;
  gap: 14px;
  align-items: center;
  margin: 14px 0;
  text-transform: capitalize;
  font-size: 12px;
  font-weight: 600;
}

.bar {
  height: 9px;
  background: #edf2f7;
  border-radius: 99px;
  overflow: hidden;
}

.bar i {
  height: 100%;
  display: block;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.bar .low { background: linear-gradient(90deg, #10b981 0%, #34d399 100%); }
.bar .medium { background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%); }
.bar .high { background: linear-gradient(90deg, #f97316 0%, #fb923c 100%); }
.bar .critical { background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%); }

/* Governance Gate Readiness */
.gate {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #f1f5f9;
}

.gate:last-child {
  border-bottom: 0;
}

.gate span:first-child {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 12px;
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}

.gate strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.gate small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* =====================================================================
   AI SYSTEMS REGISTRY & LIFECYCLE STAGE RAIL
   ===================================================================== */
.stage-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 0 0 28px;
}

.stage-chip {
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  display: grid;
  gap: 4px;
  transition: all 0.18s ease;
  border-left: 4px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.stage-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stage-chip.on {
  border-color: #93c5fd;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
  background: #f8fbff;
}

.stage-chip small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #64748b;
  text-transform: uppercase;
}

.stage-chip strong {
  font: 800 28px/1 'IBM Plex Sans', sans-serif;
  color: var(--ink);
}

.stage-chip span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.stage-chip.violet { border-left-color: var(--violet); }
.stage-chip.amber  { border-left-color: var(--amber); }
.stage-chip.blue   { border-left-color: var(--blue); }
.stage-chip.green  { border-left-color: var(--accent); }
.stage-chip.draft  { border-left-color: #94a3b8; border-style: dashed; }

.stage-group {
  margin: 0 0 36px;
}

.stage-head {
  margin: 0 0 16px;
}

.stage-head h2 {
  font: 700 20px/1.3 'IBM Plex Sans', sans-serif;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.stage-head p {
  color: var(--muted);
  margin: 4px 0 0;
  font-size: 13px;
  max-width: 680px;
}

.stage-count {
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 3px 10px;
}

/* Registry Toolbar */
.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.systems-toolbar {
  align-items: flex-end;
}

.search {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s;
}

.search:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search input {
  border: 0;
  outline: 0;
  width: 100%;
  font: 13px 'IBM Plex Sans', sans-serif;
  background: transparent;
  color: var(--ink);
}

.filter {
  display: grid;
  flex: 0 0 220px;
  gap: 6px;
}

.filter span {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter select {
  height: 42px;
}

/* System Cards Grid */
.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.system-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.system-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #93c5fd;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.system-card h3 {
  font: 700 17px/1.3 'IBM Plex Sans', sans-serif;
  margin: 6px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.system-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  height: 40px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
  margin-top: auto;
}

.meta small {
  display: block;
  color: #7d8ea6;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.meta strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges & Pills */
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.high,
.badge.critical,
.badge.fail {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid var(--red-border);
}

.badge.medium {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid var(--amber-border);
}

.badge.low,
.badge.pass {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid var(--accent-border);
}

.badge.not_evaluated {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* =====================================================================
   GATEWAY LAB (CONTROLLED RUNTIME TESTBENCH)
   ===================================================================== */
.gateway-presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.presets-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-right: 6px;
}

.preset-btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
  border-radius: 8px;
  padding: 6px 12px;
  font: 600 12px 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-btn:hover {
  background: #ffffff;
  border-color: #93c5fd;
  color: var(--brand-primary);
  transform: translateY(-1px);
}

.preset-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  font: 13px 'IBM Plex Sans', sans-serif;
  outline: none;
  transition: all 0.18s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.terminal-panel {
  background: #0b1329;
  color: #e2e8f0;
  border-color: #1e2f56;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.terminal-panel h2 {
  color: #ffffff;
}

.terminal-panel .tag {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.terminal-panel .tag.highlight {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
}

.terminal {
  font: 12px/1.7 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  text-align: left;
  overflow: auto;
  max-height: 520px;
  background: #070d1e;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid #162340;
}

.terminal.empty-state {
  text-align: center;
  font-family: 'IBM Plex Sans', sans-serif;
  background: transparent;
  color: #64748b;
  border: 1px dashed #1e293b;
  padding: 60px 20px;
}

/* =====================================================================
   POLICY CONTROLS
   ===================================================================== */
.policy-view {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 18px;
}

.policy-card {
  background: linear-gradient(135deg, #0b1329 0%, #111c38 100%);
  color: #ffffff;
  border-radius: 14px;
  padding: 30px;
  border: 1px solid #1e2f56;
  box-shadow: var(--shadow);
}

.policy-card .kicker {
  color: #60a5fa;
}

.policy-card strong {
  display: block;
  font: 800 36px/1.1 'IBM Plex Sans', sans-serif;
  text-transform: capitalize;
  margin: 10px 0 16px;
  color: #ffffff;
}

.policy-card p {
  color: #94a3b8;
  font-size: 13px;
  margin: 6px 0;
}

.control-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.control {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}

.control i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 50%;
  font-style: normal;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}

.control strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  text-transform: capitalize;
}

.control small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
}

/* =====================================================================
   EVALUATIONS GATES
   ===================================================================== */
.field-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* =====================================================================
   TABLES & AUDIT EVIDENCE
   ===================================================================== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 2px solid var(--line);
  background: #f8fafc;
}

td {
  font-size: 13px;
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  color: #334155;
}

tr:hover td {
  background: #fbfdff;
}

code {
  font-size: 12px;
  color: var(--brand-primary);
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 5px;
  padding: 2px 6px;
  font-family: 'IBM Plex Mono', monospace;
}

.decision {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 12px;
  text-transform: capitalize;
}

.decision i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.decision.allowed i,
.decision.allow i {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.decision.redacted i {
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.decision.blocked i,
.decision.block i {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.decision.flag i {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* =====================================================================
   DOCUMENTATION & API REFERENCE
   ===================================================================== */
.doc-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 36px;
  align-items: start;
}

.doc-nav {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 3px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.doc-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}

.doc-nav a:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.doc-nav a span {
  color: #94a3b8;
  font-size: 11px;
}

.doc-body {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.help-topic,
.ref-area {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 32px;
  scroll-margin-top: 100px;
  box-shadow: var(--shadow-sm);
}

.help-topic h2,
.ref-area h2 {
  font: 700 22px/1.3 'IBM Plex Sans', sans-serif;
  margin: 0 0 14px;
  color: var(--ink);
}

.help-topic p,
.ref-area > p {
  color: #334155;
  max-width: 68ch;
  margin: 0 0 14px;
  line-height: 1.6;
}

.help-steps,
.help-list {
  color: #334155;
  max-width: 68ch;
  padding-left: 20px;
  margin: 0 0 14px;
  line-height: 1.6;
}

.help-note {
  border-left: 3px solid var(--brand-primary);
  background: #eff6ff;
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: #1e3a8a;
  margin: 14px 0;
}

.help-defs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  margin: 0 0 14px;
  max-width: 68ch;
}

.help-defs dt {
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
}

.help-defs dd {
  margin: 0;
  color: #334155;
  font-size: 13px;
}

.ref-route {
  border-top: 1px solid #f1f5f9;
  padding: 16px 0 6px;
}

.ref-route:first-of-type {
  border-top: 0;
}

.ref-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ref-method {
  font: 800 10px 'IBM Plex Mono', monospace;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.ref-method.get { background: #dbeafe; color: #1e40af; }
.ref-method.post { background: #d1fae5; color: #065f46; }
.ref-method.put, .ref-method.patch { background: #fef3c7; color: #92400e; }
.ref-method.delete { background: #fee2e2; color: #991b1b; }

.ref-path {
  font: 13px 'IBM Plex Mono', monospace;
  color: var(--ink);
  font-weight: 600;
}

.ref-meta {
  font-size: 11px;
  color: #8a99ad;
  margin-top: 6px;
}

.sdk-tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 12px;
}

.sdk-tab {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 7px 14px;
  font: 700 12px 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}

.sdk-tab.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.sdk-code {
  background: #0b1329;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 20px 22px;
  overflow: auto;
  font: 12px/1.7 'IBM Plex Mono', monospace;
  margin: 0;
  border: 1px solid #1e2f56;
}

/* =====================================================================
   SIGN-IN & AUTHENTICATION
   ===================================================================== */
.signin {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 30%, #172554 0%, #070d1e 100%);
  z-index: 100;
  padding: 24px;
}

.signin-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px;
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

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

.signin-brand strong {
  font: 700 19px 'IBM Plex Sans', sans-serif;
  color: var(--ink);
}

.signin-card h1 {
  font: 700 24px/1.2 'IBM Plex Sans', sans-serif;
  margin: 0;
  color: var(--ink);
}

.signin-card > p {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.signin-card label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.signin-error {
  margin: 0;
  font-size: 12px;
  color: var(--red);
  font-weight: 600;
  min-height: 1.2em;
}

.ob-link {
  border: 0;
  background: none;
  color: var(--brand-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
}

.ob-link:hover {
  text-decoration: underline;
}

/* Dialogs & Modals */
dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  box-shadow: 0 30px 90px rgba(15, 25, 45, 0.35);
  background: #ffffff;
}

dialog::backdrop {
  background: rgba(11, 19, 41, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

dialog form {
  padding: 28px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.dialog-head h2 {
  font: 700 22px 'IBM Plex Sans', sans-serif;
  margin: 0;
  color: var(--ink);
}

.close {
  border: 0;
  background: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.close:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.helper {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* Toast */
#toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  background: #0f172a;
  color: #ffffff;
  padding: 14px 22px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transform: translateY(120px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid #1e293b;
}

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

#toast.error {
  background: #991b1b;
  border-color: #b91c1c;
}

/* =====================================================================
   RESPONSIVENESS
   ===================================================================== */
@media (max-width: 1100px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .system-grid { grid-template-columns: 1fr 1fr; }
  .two-one { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: none;
    font-size: 20px;
    margin-right: 12px;
    cursor: pointer;
  }
  main {
    margin-left: 0;
  }
  .topbar {
    padding: 0 18px;
  }
  .topbar .eyebrow,
  .api-state,
  .top-actions .secondary,
  .org-switch {
    display: none;
  }
  .page {
    padding: 24px 16px;
  }
  .hero {
    padding: 24px;
  }
  .score-ring {
    display: none;
  }
  .stats,
  .half,
  .system-grid,
  .policy-view,
  .control-list {
    grid-template-columns: 1fr;
  }
}
