/* ============================================================================
   QUANTUS INTEL — Space Intelligence Platform
   Unified design system  ·  assets/css/app.css
   Dark-first, single stylesheet, no build step. Consumed by the vanilla ESM SPA.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  /* Surfaces */
  --bg-0: #050810;
  --bg-1: #0a0f1a;
  --bg-2: #111827;
  --bg-3: #161f30;
  --card: rgba(17, 24, 39, 0.72);
  --card-solid: #0e1626;
  --overlay: rgba(3, 6, 12, 0.72);

  /* Lines */
  --line: rgba(55, 65, 81, 0.5);
  --line-2: rgba(75, 85, 101, 0.35);
  --line-strong: rgba(0, 212, 255, 0.4);

  /* Text */
  --tx-0: #f9fafb;
  --tx-1: #d1d5db;
  --tx-2: #9ca3af;
  --tx-3: #6b7280;

  /* Brand + accents */
  --cyan: #00d4ff;
  --blue: #3b82f6;
  --indigo: #6366f1;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --emerald: #10b981;
  --teal: #14b8a6;
  --amber: #f59e0b;
  --orange: #f97316;
  --red: #ef4444;
  --rose: #f43f5e;

  /* Semantic */
  --ok: var(--emerald);
  --warn: var(--amber);
  --crit: var(--red);
  --info: var(--cyan);

  /* Threat scale */
  --t-low: #10b981;
  --t-guarded: #3b82f6;
  --t-elevated: #f59e0b;
  --t-high: #f97316;
  --t-severe: #ef4444;
  --t-critical: #db2777;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, var(--cyan) 0%, var(--blue) 50%, var(--purple) 100%);
  --grad-line: linear-gradient(90deg, var(--cyan), var(--blue), var(--purple));

  /* Type */
  --f-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --f-display: 'Orbitron', var(--f-sans);

  /* Metrics */
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.45), 0 0 30px rgba(0, 212, 255, 0.06);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.6);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--f-sans);
  background: var(--bg-0);
  color: var(--tx-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(0, 212, 255, 0.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 140, 170, 0.25); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 140, 170, 0.4); }

/* ---------- Ambient background ---------- */
.bg-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-fx::before {
  content: ''; position: absolute; top: -10%; left: 15%; width: 60%; height: 55%;
  background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.08), transparent 70%);
}
.bg-fx::after {
  content: ''; position: absolute; bottom: -10%; right: 5%; width: 55%; height: 45%;
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.07), transparent 70%);
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.028) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 40%, transparent 90%);
}

/* ============================================================================
   APP SHELL
   ========================================================================== */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: 'sidebar topbar' 'sidebar main';
  height: 100vh;
  transition: grid-template-columns 0.25s var(--ease);
}
.app.nav-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, rgba(10, 15, 26, 0.96), rgba(5, 8, 16, 0.98));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; height: var(--topbar-h);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: var(--grad-brand);
  display: grid; place-items: center;
  box-shadow: 0 0 26px rgba(0, 212, 255, 0.35);
  font-size: 18px; color: #fff;
}
.brand-text { overflow: hidden; }
.brand-text h1 {
  font-family: var(--f-display); font-size: 15px; font-weight: 800; letter-spacing: 2px;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.brand-text p { font-size: 9.5px; color: var(--tx-3); letter-spacing: 2.5px; text-transform: uppercase; }
.nav-collapsed .brand-text { display: none; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; }
.nav-group { margin-bottom: 6px; }
.nav-group-label {
  font-size: 9.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--tx-3);
  padding: 14px 12px 6px; font-weight: 600;
}
.nav-collapsed .nav-group-label { text-align: center; padding: 14px 0 6px; font-size: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--tx-2); font-size: 13px; font-weight: 500;
  transition: all 0.15s var(--ease); white-space: nowrap; position: relative;
}
.nav-item .ico { width: 20px; flex-shrink: 0; text-align: center; font-size: 15px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--tx-0); }
.nav-item.active { background: rgba(0, 212, 255, 0.1); color: var(--cyan); }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 20%; bottom: 20%; width: 3px;
  background: var(--cyan); border-radius: 0 3px 3px 0; box-shadow: 0 0 10px var(--cyan);
}
.nav-item .badge-mini {
  margin-left: auto; font-size: 9px; padding: 1px 6px; border-radius: 20px;
  background: rgba(0, 212, 255, 0.15); color: var(--cyan); font-family: var(--f-mono);
}
.nav-collapsed .nav-item { justify-content: center; padding: 10px; }
.nav-collapsed .nav-item span:not(.ico), .nav-collapsed .badge-mini { display: none; }

.sidebar-foot {
  padding: 12px 14px; border-top: 1px solid var(--line); flex-shrink: 0;
  font-size: 10px; color: var(--tx-3); font-family: var(--f-mono);
}
.nav-collapsed .sidebar-foot { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: rgba(10, 15, 26, 0.75); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--tx-2); font-size: 16px; transition: all 0.15s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--tx-0); border-color: var(--line); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--tx-2); }
.crumb strong { color: var(--tx-0); font-weight: 600; }
.crumb .sep { color: var(--tx-3); }
.topbar-search {
  margin-left: auto; position: relative; width: 300px; max-width: 34vw;
}
.topbar-search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--tx-0); font-size: 13px; outline: none; transition: border 0.15s;
}
.topbar-search input:focus { border-color: var(--line-strong); }
.topbar-search .s-ico { position: absolute; left: 11px; top: 9px; color: var(--tx-3); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.env-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 20px; font-size: 11px; font-family: var(--f-mono);
  background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--emerald);
}
.env-pill.offline { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); color: var(--red); }

/* ---------- Main content ---------- */
.main { grid-area: main; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.view { max-width: 1640px; margin: 0 auto; padding: 26px 30px 80px; animation: fade 0.35s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 24px; }
.page-title {
  font-family: var(--f-display); font-size: 24px; font-weight: 700; letter-spacing: 1px;
  display: flex; align-items: center; gap: 14px;
}
.page-title .t-ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
}
.page-sub { color: var(--tx-2); font-size: 13.5px; margin-top: 8px; max-width: 920px; }

.section-title {
  font-family: var(--f-display); font-size: 15px; font-weight: 600; letter-spacing: 1.5px;
  display: flex; align-items: center; gap: 14px; margin: 30px 0 16px; color: var(--tx-0);
}
.section-title::before { content: '◆'; color: var(--cyan); font-size: 11px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* ============================================================================
   COMPONENTS
   ========================================================================== */

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative; transition: all 0.25s var(--ease);
}
.card.hover:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-family: var(--f-display); font-size: 14px; font-weight: 600; letter-spacing: 1px; }
.card-head .sub { font-size: 11.5px; color: var(--tx-3); }
.card-head .head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 20px; }
.card-topline::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--grad-line); opacity: 0; transition: opacity 0.25s;
}
.card.hover:hover.card-topline::after { opacity: 1; }

/* Grids */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Stat tiles */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat .stat-label { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--tx-3); }
.stat .stat-value { font-family: var(--f-display); font-size: 30px; font-weight: 700; margin-top: 6px; color: var(--tx-0); }
.stat .stat-meta { font-size: 11.5px; color: var(--tx-2); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.stat .stat-ico { position: absolute; right: 16px; top: 16px; font-size: 22px; opacity: 0.5; }
.stat.accent-cyan .stat-value { color: var(--cyan); }
.stat.accent-emerald .stat-value { color: var(--emerald); }
.stat.accent-amber .stat-value { color: var(--amber); }
.stat.accent-red .stat-value { color: var(--red); }
.stat.accent-purple .stat-value { color: var(--purple); }
.trend-up { color: var(--emerald); } .trend-down { color: var(--red); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); color: var(--tx-1);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.3px; transition: all 0.15s var(--ease); white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--tx-0); border-color: var(--line-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(59, 130, 246, 0.16));
  border-color: rgba(0, 212, 255, 0.3); color: var(--cyan);
}
.btn-primary:hover { background: linear-gradient(135deg, rgba(0, 212, 255, 0.28), rgba(59, 130, 246, 0.28)); border-color: var(--cyan); box-shadow: 0 0 20px rgba(0, 212, 255, 0.25); color: #fff; }
.btn-danger { color: var(--red); border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.08); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.16); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; }
.btn-xs { padding: 4px 9px; font-size: 10.5px; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; border-right-width: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-right-width: 1px; }

/* Badges + chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--tx-2);
}
.badge.b-ok { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); color: var(--emerald); }
.badge.b-warn { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); color: var(--amber); }
.badge.b-crit { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); color: var(--red); }
.badge.b-info { background: rgba(0, 212, 255, 0.12); border-color: rgba(0, 212, 255, 0.3); color: var(--cyan); }
.badge.b-purple { background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.3); color: var(--purple); }
.badge.b-free { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); color: var(--emerald); }
.badge.b-freemium { background: rgba(0, 212, 255, 0.12); border-color: rgba(0, 212, 255, 0.3); color: var(--cyan); }
.badge.b-paid { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); color: var(--amber); }
.badge.b-gov { background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.3); color: var(--purple); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-xs); font-size: 10.5px; letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.09); color: var(--tx-2);
  text-transform: uppercase; transition: all 0.15s;
}
.chip.clickable:hover { border-color: var(--line-strong); color: var(--cyan); cursor: pointer; }
.chip.active { background: rgba(0, 212, 255, 0.14); border-color: rgba(0, 212, 255, 0.4); color: var(--cyan); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }

/* Status dot */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); }
.dot.warn { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot.crit { background: var(--red); box-shadow: 0 0 8px var(--red); }
.dot.idle { background: var(--tx-3); }
.dot.pulse { animation: dotpulse 1.6s infinite; }
@keyframes dotpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; padding: 12px 14px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--tx-3); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; background: var(--card-solid); z-index: 2;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--cyan); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); color: var(--tx-1); vertical-align: middle; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: rgba(0, 212, 255, 0.04); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td .mono { font-family: var(--f-mono); font-size: 11.5px; color: var(--tx-2); }

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11.5px; color: var(--tx-2); margin-bottom: 6px; font-weight: 500; letter-spacing: 0.3px; }
.field label .req { color: var(--red); }
.field .hint { font-size: 11px; color: var(--tx-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--tx-0); font-size: 13px; font-family: var(--f-sans); outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08); }
.input.mono, .textarea.mono { font-family: var(--f-mono); font-size: 12px; }
.textarea { resize: vertical; min-height: 90px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L2 4h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.toggle { position: relative; width: 42px; height: 23px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: rgba(255,255,255,0.1); border: 1px solid var(--line); border-radius: 20px; transition: 0.2s; }
.toggle .track::before { content: ''; position: absolute; left: 3px; top: 2px; width: 17px; height: 17px; background: var(--tx-2); border-radius: 50%; transition: 0.2s; }
.toggle input:checked + .track { background: rgba(0, 212, 255, 0.3); border-color: var(--cyan); }
.toggle input:checked + .track::before { transform: translateX(19px); background: var(--cyan); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 16px; font-size: 12.5px; font-weight: 500; color: var(--tx-2); white-space: nowrap;
  border-bottom: 2px solid transparent; transition: all 0.15s; letter-spacing: 0.3px;
}
.tab:hover { color: var(--tx-0); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* Segmented */
.seg { display: inline-flex; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.seg button { padding: 6px 13px; font-size: 11.5px; color: var(--tx-2); border: none; background: transparent; border-radius: var(--radius-xs); transition: all 0.15s; }
.seg button.active { background: rgba(0, 212, 255, 0.15); color: var(--cyan); }

/* Code / debug blocks */
pre.code {
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: var(--f-mono); font-size: 11.5px; color: var(--tx-1);
  overflow-x: auto; line-height: 1.7; white-space: pre; tab-size: 2;
}
pre.code .k { color: var(--cyan); } pre.code .s { color: var(--emerald); }
pre.code .n { color: var(--amber); } pre.code .c { color: var(--tx-3); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: 12.5px; }
.kv dt { color: var(--tx-3); } .kv dd { color: var(--tx-1); font-family: var(--f-mono); font-size: 12px; word-break: break-all; }

/* Method pills */
.method { font-family: var(--f-mono); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.5px; }
.method.GET { background: rgba(16,185,129,0.15); color: var(--emerald); }
.method.POST { background: rgba(0,212,255,0.15); color: var(--cyan); }
.method.PUT { background: rgba(245,158,11,0.15); color: var(--amber); }
.method.DELETE { background: rgba(239,68,68,0.15); color: var(--red); }

/* Loaders + skeletons */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(0,212,255,0.2); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.08), rgba(255,255,255,0.03)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-xs); }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading-full { display: grid; place-items: center; gap: 14px; padding: 60px; color: var(--tx-2); font-size: 13px; }

/* Empty / error states */
.empty { text-align: center; padding: 54px 20px; color: var(--tx-3); }
.empty .em-ico { font-size: 40px; opacity: 0.4; margin-bottom: 12px; }
.empty h4 { color: var(--tx-1); font-size: 15px; margin-bottom: 6px; font-family: var(--f-display); }
.empty p { font-size: 12.5px; max-width: 400px; margin: 0 auto; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); font-size: 12.5px; border: 1px solid var(--line); background: var(--card); align-items: flex-start; }
.callout .co-ico { flex-shrink: 0; font-size: 16px; }
.callout.warn { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.3); color: var(--amber); }
.callout.crit { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.3); color: #fca5a5; }
.callout.info { background: rgba(0,212,255,0.07); border-color: rgba(0,212,255,0.25); color: var(--tx-1); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: var(--overlay); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; animation: fade 0.2s; }
.modal { background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 620px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.lg { max-width: 900px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-family: var(--f-display); font-size: 16px; font-weight: 600; letter-spacing: 0.5px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* Toasts */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 400px; padding: 13px 16px; background: var(--card-solid); border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 13px; animation: slideIn 0.3s var(--ease); }
.toast.ok { border-left-color: var(--emerald); } .toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); } .toast.info { border-left-color: var(--cyan); }
.toast .t-ico { font-size: 16px; } .toast .t-msg { flex: 1; color: var(--tx-1); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Threat scale bar */
.threat-scale { display: flex; border-radius: var(--radius-sm); overflow: hidden; height: 10px; }
.threat-scale span { flex: 1; }
.threat-scale .s0 { background: var(--t-low); } .threat-scale .s1 { background: var(--t-guarded); }
.threat-scale .s2 { background: var(--t-elevated); } .threat-scale .s3 { background: var(--t-high); }
.threat-scale .s4 { background: var(--t-severe); } .threat-scale .s5 { background: var(--t-critical); }
.threat-level { font-family: var(--f-display); font-weight: 800; letter-spacing: 2px; }
.tl-low { color: var(--t-low); } .tl-guarded { color: var(--t-guarded); } .tl-elevated { color: var(--t-elevated); }
.tl-high { color: var(--t-high); } .tl-severe { color: var(--t-severe); } .tl-critical { color: var(--t-critical); }

/* Meters / bars */
.meter { height: 7px; background: rgba(255,255,255,0.06); border-radius: 20px; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 20px; background: var(--grad-line); transition: width 0.5s var(--ease); }
.meter.ok > span { background: var(--emerald); } .meter.warn > span { background: var(--amber); } .meter.crit > span { background: var(--red); }

/* Progress log (debug console) */
.console { background: #04070e; border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--f-mono); font-size: 11.5px; padding: 12px 14px; max-height: 320px; overflow-y: auto; line-height: 1.8; }
.console .ln { display: flex; gap: 10px; }
.console .ts { color: var(--tx-3); flex-shrink: 0; }
.console .lv-info { color: var(--cyan); } .console .lv-ok { color: var(--emerald); }
.console .lv-warn { color: var(--amber); } .console .lv-err { color: var(--red); } .console .lv-dim { color: var(--tx-3); }

/* Category accent backgrounds (icons) */
.cat-space { background: linear-gradient(135deg, var(--cyan), var(--blue)); }
.cat-earth { background: linear-gradient(135deg, var(--emerald), var(--teal)); }
.cat-threat { background: linear-gradient(135deg, var(--red), var(--orange)); }
.cat-intel { background: linear-gradient(135deg, var(--purple), var(--pink)); }
.cat-science { background: linear-gradient(135deg, var(--amber), var(--orange)); }
.cat-aero { background: linear-gradient(135deg, var(--blue), var(--purple)); }
.cat-data { background: linear-gradient(135deg, var(--indigo), var(--cyan)); }

/* Utilities */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.ml-auto { margin-left: auto; } .mt-0 { margin-top: 0; }
.gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mono { font-family: var(--f-mono); } .muted { color: var(--tx-3); } .dim { color: var(--tx-2); }
.small { font-size: 11.5px; } .xs { font-size: 10.5px; }
.nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.text-cyan { color: var(--cyan); } .text-emerald { color: var(--emerald); } .text-amber { color: var(--amber); }
.text-red { color: var(--red); } .text-purple { color: var(--purple); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.scroll-x { overflow-x: auto; }

/* Map + viz containers */
.map-box { width: 100%; height: 460px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg-1); }
.viz-box { position: relative; width: 100%; min-height: 260px; }
.globe-box { width: 100%; height: 520px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: radial-gradient(ellipse at center, #0a1428, #04070e); }
.leaflet-container { background: #04070e !important; }

/* Mobile nav */
.nav-scrim { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 0 1fr; }
  .sidebar { position: fixed; z-index: 150; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 0.25s var(--ease); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 140; background: rgba(0,0,0,0.5); }
  .topbar-search { display: none; }
  .view { padding: 18px 16px 70px; }
}

/* ========== ENTERPRISE v5 POLISH ========== */
.bg-stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 80px 120px, rgba(255,255,255,0.25), transparent),
    radial-gradient(1.2px 1.2px at 160px 60px, rgba(0,212,255,0.4), transparent),
    radial-gradient(1px 1px at 240px 180px, rgba(255,255,255,0.2), transparent),
    radial-gradient(1.5px 1.5px at 320px 90px, rgba(139,92,246,0.35), transparent),
    radial-gradient(1px 1px at 400px 200px, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.2px 1.2px at 480px 40px, rgba(0,212,255,0.3), transparent),
    radial-gradient(1px 1px at 560px 150px, rgba(255,255,255,0.2), transparent);
  background-size: 600px 250px;
  opacity: 0.55;
  animation: starDrift 120s linear infinite;
}
@keyframes starDrift {
  from { background-position: 0 0; }
  to { background-position: 600px 250px; }
}

.edition-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(0,212,255,0.25), rgba(139,92,246,0.25));
  border: 1px solid rgba(0,212,255,0.35);
  color: var(--cyan);
  margin-bottom: 4px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.feature-list li {
  position: relative;
  padding: 8px 0 8px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--tx-1);
  line-height: 1.5;
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--cyan);
  font-weight: 700;
}

.card:hover {
  border-color: rgba(0, 212, 255, 0.25);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 20px rgba(0,212,255,0.05);
}

.stat::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-line);
  opacity: 0.7;
}
.stat { position: relative; overflow: hidden; }

.nav-item:hover { transform: translateX(2px); }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.tab {
  background: transparent;
  border: none;
  color: var(--tx-2);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--tx-0); }
.tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tx-3);
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
}
table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--tx-1);
}
table.data tr:hover td { background: rgba(0, 212, 255, 0.04); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(100,120,150,0.2);
  color: var(--tx-1);
}
.badge.ok { background: rgba(16,185,129,0.2); color: var(--emerald); }
.badge.warn { background: rgba(245,158,11,0.2); color: var(--amber); }
.badge.crit { background: rgba(239,68,68,0.2); color: var(--red); }

.input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--tx-0);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  outline: none;
}
.input:focus { border-color: var(--cyan); }

.btn {
  background: linear-gradient(135deg, rgba(0,212,255,0.2), rgba(59,130,246,0.25));
  border: 1px solid rgba(0,212,255,0.4);
  color: var(--cyan);
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: linear-gradient(135deg, rgba(0,212,255,0.3), rgba(59,130,246,0.35)); transform: translateY(-1px); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--tx-1); }
.btn-block { display: block; width: 100%; text-align: center; }

.row { display: flex; align-items: center; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }

.meter {
  height: 6px;
  background: rgba(100,120,150,0.15);
  border-radius: 3px;
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  background: var(--grad-line);
  border-radius: 3px;
}
.meter.ok span { background: var(--emerald); }
.meter.warn span { background: var(--amber); }

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(17,24,39,0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 10px;
}
.callout.info { border-color: rgba(0,212,255,0.25); }
.callout.warn { border-color: rgba(245,158,11,0.3); }
.callout.crit { border-color: rgba(239,68,68,0.3); }
.callout.ok { border-color: rgba(16,185,129,0.3); }
.co-ico { font-size: 18px; flex-shrink: 0; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--tx-2);
}
.em-ico { font-size: 40px; margin-bottom: 12px; opacity: 0.7; }
.empty h4 { color: var(--tx-0); margin-bottom: 8px; }

.card-solid { background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--radius); }
.card-topline { border-top: 2px solid var(--cyan); }

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx-2);
  margin: 24px 0 12px;
}

.page-head { margin-bottom: 22px; }
.page-title {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.page-sub { color: var(--tx-2); font-size: 13.5px; max-width: 820px; line-height: 1.55; }
.t-ico { font-size: 24px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  backdrop-filter: blur(12px);
}
.stat-ico { font-size: 20px; margin-bottom: 6px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tx-3); }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--f-display); margin: 4px 0; }
.stat-meta { font-size: 11.5px; color: var(--tx-3); }
.stat.accent-cyan .stat-value { color: var(--cyan); }
.stat.accent-emerald .stat-value { color: var(--emerald); }
.stat.accent-purple .stat-value { color: var(--purple); }
.stat.accent-amber .stat-value { color: var(--amber); }

.mono { font-family: var(--f-mono); }
.small { font-size: 12px; }
.dim { color: var(--tx-3); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.loading-full {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 40px; color: var(--tx-2); font-size: 13px;
}
.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid rgba(0,212,255,0.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.lg { width: 40px; height: 40px; }
@keyframes spin { to { transform: rotate(360deg); } }

.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--tx-3);
}
.dot.ok { background: var(--emerald); }
.dot.warn { background: var(--amber); }
.dot.pulse { animation: pulse 1.5s ease infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.threat-level { font-size: 18px !important; letter-spacing: 0.04em; }
.tl-guarded { color: var(--t-guarded); }

.view { padding: 22px 26px 80px; overflow-y: auto; height: 100%; }
