/* ====================================================================
   HUBS MANAGER — CLICKHOUSE-INSPIRED TACTICAL COMMAND (PORT GEOALERT)
   Design System — Neutral Monochrome + Dark Canvas
   Dark · Glass · Monospaced · Semantic Colors Only
   ==================================================================== */

/* === DESIGN TOKENS (CSS Custom Properties) === */
/* === LOCAL FONTS === */
@font-face {
  font-family: "Phosphor-Fill";
  src: url("/fonts/Phosphor-Fill.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

:root {
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Surface — ClickHouse canvas */
  --surface: #0a0a0a;
  --surface-dim: #0a0a0a;
  --surface-bright: #1a1a1a;
  --surface-container-lowest: #050505;
  --surface-container-low: #101010;
  --surface-container: #1a1a1a;
  --surface-container-high: #242424;
  --surface-container-highest: #2a2a2a;
  --on-surface: #ffffff;
  --on-surface-variant: #cccccc;
  --outline: #888888;
  --outline-variant: #2a2a2a;

  /* Neutral Primary — Monochrome accent (Hubs remapea a teal en hubs-tokens.css) */
  --primary: #ffffff;
  --on-primary: #0a0a0a;
  --primary-container: #ffffff;
  --on-primary-container: #0a0a0a;
  --primary-fixed: #cccccc;

  /* Secondary */
  --secondary: #cccccc;
  --secondary-container: #2a2a2a;

  /* Status — semantic colors maintained */
  --error: #ffb4ab;
  --error-container: #93000a;
  --on-error-container: #ffdad6;
  --warning: #f59e0b;
  --tertiary: #adc6ff;
  --tertiary-container: #71a1ff;
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
  --color-orange: #f97316;
  --color-transit: #34d399;
  --color-idle: #eab308;
  --color-lila: #a855f7;
  --color-teal: #14b8a6;
  --color-done: #6b7280;
  --color-cancelled: #4b5563;
  --color-pending: #9ca3af;

  /* Glass defaults */
  --glass-bg: rgba(10, 10, 10, 0.60);
  --glass-border: rgba(255, 255, 255, 0.04);
  --glass-blur: 10px;
  --glass-saturate: 1.2;

  /* Sidebar */
  --sidebar-bg: rgba(10, 10, 10, 0.85);

  /* Layout */
  --sidebar-width: 220px;
  --gutter: 16px;
  --margin-page: 24px;

  /* Derived aliases */
  --color-base: #0a0a0a;
  --color-panel: #101010;
  --color-panel-alt: #1a1a1a;
  --color-border: #242424;
  --color-border-light: rgba(255,255,255,0.04);
  --color-text: #ffffff;
  --color-text-secondary: #cccccc;
  --color-text-muted: #888888;
  --color-accent: #ffffff;
  --color-accent-dim: #cccccc;
  --color-accent-bg: rgba(255, 255, 255, 0.06);
  --color-accent-glow: rgba(255, 255, 255, 0.15);
  --color-glass: rgba(10, 10, 10, 0.60);
  --color-glass-border: rgba(255, 255, 255, 0.04);
  --map-glass: rgba(10,10,10,0.66);
  --map-border: rgba(255,255,255,0.08);
  --marker-border: #000000;
}

/* === LIGHT THEME OVERRIDES — ClickHouse Inverse === */
:root:not(.dark) {
  --surface: #fafafa;
  --surface-dim: #f0f0f0;
  --surface-bright: #ffffff;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f5f5f5;
  --surface-container: #f0f0f0;
  --surface-container-high: #e8e8e8;
  --surface-container-highest: #e0e0e0;
  --on-surface: #0a0a0a;
  --on-surface-variant: #333333;
  --outline: #666666;
  --outline-variant: #d4d4d4;
  --primary: #000000;
  --on-primary: #ffffff;
  --primary-container: #000000;
  --on-primary-container: #ffffff;
  --primary-fixed: #333333;
  --secondary: #333333;
  --secondary-container: #e8e8e8;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #410002;
  --warning: #a16207;
  --color-base: #fafafa;
  --color-panel: #f5f5f5;
  --color-panel-alt: #eeeeee;
  --color-border: #e0e0e0;
  --color-border-light: rgba(0,0,0,0.06);
  --color-text: #0a0a0a;
  --color-text-secondary: #333333;
  --color-text-muted: #666666;
  --color-accent: #000000;
  --color-accent-dim: #555555;
  --color-accent-bg: rgba(0, 0, 0, 0.05);
  --color-accent-glow: rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.60);
  --glass-border: rgba(0, 0, 0, 0.06);
  --sidebar-bg: rgba(255, 255, 255, 0.88);
  --color-glass: rgba(255, 255, 255, 0.60);
  --color-glass-border: rgba(0, 0, 0, 0.06);
  --map-glass: rgba(245,244,240,0.9);
  --map-border: rgba(0,0,0,0.1);
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --color-info: #2563eb;
  --color-orange: #ea580c;
  --color-transit: #16a34a;
  --color-idle: #ca8a04;
  --color-lila: #9333ea;
  --color-teal: #0d9488;
}

/* === BASE RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --theme-transition: 0.25s; }
html { transition: background var(--theme-transition) ease; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

body::-webkit-scrollbar { display: none; }
body { -ms-overflow-style: none; scrollbar-width: none; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
ul, ol { list-style: none; }
i.ph-fill { font-style: normal; }

/* === SPLASH === */
#app-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: var(--surface);
  transition: opacity 0.5s ease;
}
#app-splash.splash-hidden { opacity: 0; pointer-events: none; }
.splash-wrap { display: flex; flex-direction: column; align-items: center; gap: 32px; }
.splash-shield {
  width: 72px; height: 72px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-glow);
  animation: splashPulse 2s ease-in-out infinite;
}
.splash-ring {
  position: absolute; inset: -4px; border-radius: 24px;
  border: 2px solid var(--color-accent-glow);
  border-top-color: var(--primary);
  animation: splashSpin 1.2s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}
.splash-bar {
  position: absolute; bottom: 0; left: 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: splashScan 2.5s ease-in-out infinite;
}
.splash-dots {
  display: flex; gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
}
.splash-dot { animation: splashDot 1.4s steps(4) infinite; }
@keyframes splashSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes splashScan { 0% { left: -50%; width: 50%; } 50% { width: 80%; } 100% { left: 100%; width: 50%; } }
@keyframes splashDot { 0%, 75% { opacity: 0.2; } 25% { opacity: 1; } }
@keyframes splashPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-accent-bg); }
  50% { box-shadow: 0 0 12px 2px var(--color-accent-glow); }
}

/* === FONT / TEXT UTILITIES === */
.font-mono { font-family: var(--font-mono) !important; }
.text-body { font-family: var(--font-body); font-size: 16px; line-height: 24px; }
.text-data-lg { font-family: var(--font-mono); font-size: 32px; font-weight: 500; line-height: 40px; }
.text-data-sm { font-family: var(--font-mono); font-size: 14px; font-weight: 500; line-height: 20px; }
.text-label {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600;
  line-height: 16px; letter-spacing: 0.05em; text-transform: uppercase;
}
.nowrap { white-space: nowrap !important; }

/* === SCROLLBAR === */
.custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: var(--outline); }

/* === GLASS PANELS === */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
}

/* === CARDS === */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: var(--gutter);
  transition: all 0.2s ease;
}
.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
:root:not(.dark) .card:hover { border-color: rgba(0, 0, 0, 0.12); }

/* === STAT CARDS === */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.stat-card:hover {
  border-color: var(--color-accent-bg);
  box-shadow: 0 0 15px var(--color-accent-glow);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 500;
  line-height: 40px;
  color: var(--color-text);
}
.stat-sub { font-size: 12px; color: var(--color-text-muted); font-family: var(--font-mono); }

/* === BADGES / CHIPS === */
.badge, .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-surface-variant);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
:root:not(.dark) .badge, :root:not(.dark) .chip {
  background: rgba(0, 0, 0, 0.05);
  color: var(--on-surface-variant);
  border-color: rgba(0, 0, 0, 0.08);
}
.badge-success, .chip-success { background: rgba(34, 197, 94, 0.12); color: #22c55e; border-color: rgba(34, 197, 94, 0.2); }
.badge-danger, .chip-danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.badge-warning, .chip-warning { background: rgba(234, 179, 8, 0.12); color: #eab308; border-color: rgba(234, 179, 8, 0.2); }
.badge-info, .chip-info { background: rgba(59, 130, 246, 0.12); color: #3b82f6; border-color: rgba(59, 130, 246, 0.2); }
.badge-teal, .chip-teal { background: rgba(20, 184, 166, 0.12); color: #14b8a6; border-color: rgba(20, 184, 166, 0.25); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--on-surface);
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary-container);
  color: var(--on-primary);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 15px var(--color-accent-glow);
}
.btn-secondary {
  background: transparent;
  color: var(--on-surface-variant);
  border: 1px solid var(--outline);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-surface);
  border-color: var(--on-surface-variant);
}
:root:not(.dark) .btn-secondary:hover { background: rgba(0, 0, 0, 0.04); }
.btn-ghost { background: transparent; color: var(--on-surface-variant); border: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--on-surface); }
:root:not(.dark) .btn-ghost:hover { background: rgba(0, 0, 0, 0.05); }
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }

/* === FILTER PILLS === */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-surface-variant);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
:root:not(.dark) .filter-pill { background: rgba(0, 0, 0, 0.05); }
.filter-pill:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-surface); }
.filter-pill.active {
  background: var(--color-accent-bg);
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--color-accent-glow);
}

/* === TOP HEADER BAR === */
.top-header {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 var(--margin-page);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-bottom: 1px solid var(--glass-border);
  gap: var(--gutter);
  flex-shrink: 0;
  z-index: 30;
}
.top-header-left { display: flex; align-items: center; gap: 0; flex: 1; }
.top-header-center { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.top-header-right { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }

.top-header-brand {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.top-header-brand em { font-style: normal; color: var(--on-surface); }

.th-btn-icon {
  width: 34px; height: 34px;
  border: none; border-radius: 8px;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.th-btn-icon:hover { background: var(--color-accent-bg); color: var(--on-surface); }

.th-user-menu { position: relative; }
.th-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  transition: box-shadow 0.2s;
}
.th-user-avatar:hover { box-shadow: 0 0 0 2px var(--primary-fixed); }
.th-dropdown { position: absolute; top: 100%; right: 0; margin-top: 8px; z-index: 50; min-width: 200px; }
.th-dropdown-card {
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.th-dropdown-name { font-weight: 700; font-size: 14px; color: var(--on-surface); margin: 0 0 2px; }
.th-dropdown-role { color: var(--on-surface-variant); margin: 0 0 2px; }
.th-dropdown-rol { margin: 0; }
.th-dropdown-rol-badge { color: var(--primary); }
.th-dropdown-divider { border: none; border-top: 1px solid var(--glass-border); margin: 8px 0; }
.th-btn-logout {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--outline-variant); border-radius: 8px;
  background: transparent;
  color: var(--on-surface-variant);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.th-btn-logout:hover { background: rgba(239,68,68,0.08); color: #ef4444; border-color: rgba(239,68,68,0.2); }

/* === HUD BADGES (topbar) === */
.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.hud-badge strong { color: var(--color-text); }

/* === APP LAYOUT === */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#app-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  left: -280px;
  top: 0; bottom: 0;
  width: 220px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--gutter);
  z-index: 200;
  gap: 4px;
  transition: left 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}
.sidebar.open { left: 0; }
.sidebar.open ~ .sidebar-overlay { display: block; }
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
.sidebar-overlay.visible { display: block; }

.sidebar-brand {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; padding: 0 12px; margin-bottom: 4px;
}
.sidebar-brand-icon-wrap {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-bottom: 10px; position: relative;
  background: var(--color-accent-bg);
  border: 1px solid var(--color-accent-glow);
}
.sidebar-brand-img {
  width: 40px; height: 40px; object-fit: contain;
  filter: drop-shadow(0 0 6px var(--primary)) drop-shadow(0 0 2px var(--primary));
  opacity: 0.92;
}
:root.light .sidebar-brand-img {
  filter: drop-shadow(0 0 5px rgba(0,0,0,0.3)) drop-shadow(0 0 2px rgba(0,0,0,0.15));
}
.sidebar-brand-title {
  font-family: var(--font-mono);
  font-size: 15px; font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--on-surface);
  text-align: center; margin-bottom: 2px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.sidebar-brand-subtitle {
  font-family: var(--font-mono);
  font-size: 8px; font-weight: 500;
  color: var(--on-surface-variant);
  text-align: center; letter-spacing: 0.08em;
  opacity: 0.6; margin-bottom: 12px;
}
.sidebar-brand-divider {
  width: 80%; height: 1px;
  background: var(--glass-border);
  margin-bottom: 8px; align-self: center;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; width: 100%; flex: 1; }
.sidebar-nav-spacer { flex: 1; }
.sidebar-credit-nav {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--on-surface-variant);
  opacity: 0.4;
  text-align: center;
  line-height: 1.4;
  padding: 8px 0;
  width: 100%;
  user-select: none;
  letter-spacing: 0.05em;
}
.sidebar-credit-nav strong { color: var(--primary); opacity: 0.7; }

/* === NAVIGATION === */
.nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--on-surface-variant);
  transition: all 0.2s ease;
  position: relative;
}
.nav-link:hover { background: var(--color-accent-bg); color: var(--primary); }
.nav-link.active-nav { background: var(--color-accent-bg); color: var(--primary); }
.nav-link.active-nav::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-link .ph-fill { font-size: 18px; width: 24px; text-align: center; }
.nav-label {
  display: inline;
  font-size: 14px;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}

/* === TABLES === */
table { border-collapse: collapse; width: 100%; }
th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--on-surface-variant);
  user-select: none;
  padding: 10px 12px;
  text-align: left;
  background: var(--surface-container-low);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 5;
}
td {
  padding: 8px 12px;
  vertical-align: middle;
  font-size: 13px;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--glass-border);
  line-height: 20px;
  color: var(--on-surface);
}
tr { transition: background 0.15s ease; }
tr:hover { background: var(--color-accent-bg); }
tr:last-child td { border-bottom: none; }

.data-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
}
.data-grid th {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-container-low);
  padding: 8px 12px;
  font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--on-surface-variant);
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}
.data-grid td {
  padding: 6px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--glass-border);
  color: var(--on-surface);
  font-size: 13px;
}
.data-grid tr:hover { background: var(--color-accent-bg); }
.data-grid tr:last-child td { border-bottom: none; }

/* === FORM ELEMENTS === */
input, select, textarea {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface-container-low);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
  padding: 6px 10px;
  transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--color-accent-glow) !important;
  outline: none !important;
}
input::placeholder, textarea::placeholder { color: var(--outline); }

.form-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  display: block;
}
.form-label .req { color: var(--color-danger); }

/* === MAP CONTAINER === */
.map-container {
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.map-container::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.5;
}

/* === MAPBOX OVERRIDES === */
.mapboxgl-ctrl-attrib { display: none !important; }
.mapboxgl-ctrl-bottom-right { display: none !important; }
.mapboxgl-popup-content {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.mapboxgl-popup-tip {
  border-top-color: var(--surface) !important;
  border-bottom-color: var(--surface) !important;
}
.um-tooltip {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  color: var(--on-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  min-width: 140px;
}
.um-tooltip-title { font-weight: 700; margin-bottom: 2px; }
.um-tooltip-row { color: var(--on-surface-variant); font-size: 11px; }
:root:not(.dark) .um-tooltip {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.mapboxgl-ctrl-group {
  background: rgba(10,10,10,0.85) !important;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: none !important;
}
.mapboxgl-ctrl-group button {
  background: transparent !important;
  border: none !important;
  width: 30px !important; height: 30px !important;
}
.mapboxgl-ctrl-group button+button { border-top: 1px solid rgba(255,255,255,0.06) !important; }
.mapboxgl-ctrl-group button:hover { background: rgba(255,255,255,0.08) !important; }
.mapboxgl-ctrl-group button span { filter: brightness(0) invert(0.75) !important; }
.mapboxgl-ctrl-group button:hover span { filter: brightness(0) invert(1) !important; }
:root:not(.dark) .mapboxgl-ctrl-group {
  background: rgba(245, 244, 240, 0.9) !important;
  border-color: rgba(0,0,0,0.1) !important;
}
:root:not(.dark) .mapboxgl-ctrl-group button span { filter: brightness(0.3) !important; }
:root:not(.dark) .mapboxgl-ctrl-group button:hover span { filter: brightness(0.15) !important; }

/* === TABS === */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(255, 255, 255, 0.04); border-radius: 20px; }
:root:not(.dark) .tabs { background: rgba(0, 0, 0, 0.04); }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 14px;
  border-radius: 16px;
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 600;
  color: var(--on-surface-variant);
  background: transparent; border: none;
  cursor: pointer; transition: all 0.2s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--on-surface); background: rgba(255, 255, 255, 0.05); }
.tab.active { background: var(--primary); color: var(--on-primary); }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  animation: fadeIn 0.2s ease-out;
}
.modal-card {
  background: var(--surface);
  color: var(--on-surface);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 24px;
  min-width: 360px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.25s ease-out;
  font-size: 13px;
}
.modal-card::-webkit-scrollbar { width: 4px; }
.modal-card::-webkit-scrollbar-track { background: transparent; }
.modal-card::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 10px; }
.modal-close {
  position: absolute;
  top: 0; right: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all 0.2s ease;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-surface); }
.modal-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface-container-high);
  color: var(--on-surface);
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  z-index: 10000000;
  border-left: 4px solid var(--primary);
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  animation: slideInRight 0.2s ease;
  max-width: min(420px, calc(100vw - 48px));
}

/* === STATUS DOTS === */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.active { background: var(--color-success); box-shadow: 0 0 6px var(--color-success); }
.status-dot.inactive { background: var(--outline); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.danger { background: var(--color-danger); box-shadow: 0 0 6px var(--color-danger); }
.status-dot.info { background: var(--color-info); box-shadow: 0 0 6px var(--color-info); }

/* === DIVIDER / GLOW === */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  margin: var(--gutter) 0;
}
.glow-accent { box-shadow: 0 0 20px var(--color-accent-glow); }

/* === ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.animate-slide-up { animation: slideUp 0.4s ease-out; }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }
.shimmer {
  background: linear-gradient(90deg, var(--surface-container-low) 25%, var(--surface-container) 50%, var(--surface-container-low) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  body { overflow: auto !important; }
  .top-header { height: 44px; padding: 0 12px; }
  .top-header-center { display: none; }
  .hub-shell { padding: 20px 20px 40px; }
  .modal-card { min-width: 100vw; max-width: 100vw; width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0 !important; border: none; }
}