/* =====================================================
   Lato Web Font — Royal Navy Design System
   ===================================================== */
@font-face { font-family: 'Lato'; font-weight: 300; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Light.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 300; font-style: italic;  src: url('../gfx/fonts/lato/Lato-LightItalic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 400; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 400; font-style: italic;  src: url('../gfx/fonts/lato/Lato-Italic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 500; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Medium.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 500; font-style: italic;  src: url('../gfx/fonts/lato/Lato-MediumItalic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 600; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Semibold.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 600; font-style: italic;  src: url('../gfx/fonts/lato/Lato-SemiboldItalic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 700; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Bold.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 700; font-style: italic;  src: url('../gfx/fonts/lato/Lato-BoldItalic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 800; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Heavy.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Lato'; font-weight: 900; font-style: normal;  src: url('../gfx/fonts/lato/Lato-Black.woff2') format('woff2'); font-display: swap; }

/* =====================================================
   Control Room - Dark Intelligence Theme
   ===================================================== */

:root {
  /* == Layout == */
  --ui-radius: 7px;
  --ui-radius-sm: 5px;
  --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  /* == Backgrounds == */
  --ui-bg-body: #070b11;
  --ui-bg: rgba(7, 11, 17, 0.97);
  --ui-bg-solid: #070b11;
  --ui-surface: rgba(11, 17, 28, 0.94);
  --ui-card-bg: rgba(255, 255, 255, 0.028);
  --ui-input-bg: rgba(255, 255, 255, 0.045);
  --ui-popup-bg: rgba(7, 11, 17, 0.98);

  /* == Borders == */
  --ui-border: rgba(56, 90, 120, 0.35);
  --ui-border-subtle: rgba(255, 255, 255, 0.055);
  --ui-card-border: rgba(255, 255, 255, 0.04);
  --ui-input-border: rgba(100, 140, 170, 0.22);
  --ui-popup-border: rgba(56, 90, 120, 0.28);
  --ui-accent-border: rgba(14, 165, 233, 0.32);

  /* == Text == */
  --ui-text: #bfcdd8;
  --ui-text-bright: #e2ecf4;
  --ui-subtle: #6a8196;
  --ui-text-muted: #3d5060;

  /* == Primary accent (tactical sky-cyan) == */
  --ui-accent: #22d3ee;
  --ui-accent-strong: #0891b2;
  --ui-accent-glow: rgba(14, 165, 233, 0.32);
  --ui-accent-soft: rgba(14, 165, 233, 0.08);

  /* == Secondary (reference blue) == */
  --ui-secondary: #60a5fa;
  --ui-secondary-soft: rgba(96, 165, 250, 0.1);

  /* == Buttons == */
  --ui-btn-primary-from: #0369a1;
  --ui-btn-primary-to: #0891b2;

  /* == Status == */
  --ui-alert: #ef4444;
  --ui-ok: #22c55e;
  --ui-gold: #f59e0b;

  /* == Intelligence-specific == */
  --ui-critical: #dc2626;
  --ui-high: #ea580c;
  --ui-medium: #d97706;
  --ui-low: #16a34a;
  --ui-classified-border: rgba(239, 68, 68, 0.45);
}

/* == Theme: Warm Intelligence == */
[data-theme="warm"] {
  --ui-bg-body: #0d0c0a;
  --ui-bg: rgba(13, 12, 10, 0.96);
  --ui-bg-solid: #0d0c0a;
  --ui-surface: rgba(24, 22, 18, 0.88);
  --ui-card-bg: rgba(255, 255, 255, 0.025);
  --ui-input-bg: rgba(255, 255, 255, 0.04);
  --ui-popup-bg: rgba(13, 12, 10, 0.97);
  --ui-border: rgba(245, 158, 11, 0.18);
  --ui-border-subtle: rgba(255, 255, 255, 0.06);
  --ui-card-border: rgba(255, 255, 255, 0.05);
  --ui-input-border: rgba(200, 180, 140, 0.18);
  --ui-popup-border: rgba(245, 158, 11, 0.15);
  --ui-accent-border: rgba(245, 158, 11, 0.3);
  --ui-text: #f5e6d0;
  --ui-text-bright: #fef3c7;
  --ui-subtle: #a09080;
  --ui-text-muted: #6b5e50;
  --ui-accent: #fbbf24;
  --ui-accent-strong: #f59e0b;
  --ui-accent-glow: rgba(245, 158, 11, 0.35);
  --ui-accent-soft: rgba(245, 158, 11, 0.1);
  --ui-secondary: #f97316;
  --ui-secondary-soft: rgba(249, 115, 22, 0.1);
  --ui-btn-primary-from: #b45309;
  --ui-btn-primary-to: #d97706;
}

/* == Theme: Arctic Command == */
[data-theme="arctic"] {
  --ui-bg-body: #060d14;
  --ui-bg: rgba(6, 13, 20, 0.96);
  --ui-bg-solid: #060d14;
  --ui-surface: rgba(12, 24, 38, 0.88);
  --ui-card-bg: rgba(255, 255, 255, 0.025);
  --ui-input-bg: rgba(255, 255, 255, 0.04);
  --ui-popup-bg: rgba(6, 13, 20, 0.97);
  --ui-border: rgba(125, 211, 252, 0.18);
  --ui-border-subtle: rgba(255, 255, 255, 0.06);
  --ui-card-border: rgba(255, 255, 255, 0.05);
  --ui-input-border: rgba(140, 200, 240, 0.18);
  --ui-popup-border: rgba(125, 211, 252, 0.15);
  --ui-accent-border: rgba(125, 211, 252, 0.3);
  --ui-text: #e0f2fe;
  --ui-text-bright: #f0f9ff;
  --ui-subtle: #7da5c0;
  --ui-text-muted: #4b7590;
  --ui-accent: #7dd3fc;
  --ui-accent-strong: #38bdf8;
  --ui-accent-glow: rgba(125, 211, 252, 0.35);
  --ui-accent-soft: rgba(125, 211, 252, 0.1);
  --ui-secondary: #a5b4fc;
  --ui-secondary-soft: rgba(165, 180, 252, 0.1);
  --ui-btn-primary-from: #0284c7;
  --ui-btn-primary-to: #0ea5e9;
}

/* == Theme: Teal Operations == */
[data-theme="teal"] {
  --ui-bg-body: #04080d;
  --ui-bg: rgba(6, 12, 20, 0.95);
  --ui-bg-solid: #060c14;
  --ui-surface: rgba(12, 22, 35, 0.88);
  --ui-card-bg: rgba(255, 255, 255, 0.02);
  --ui-input-bg: rgba(255, 255, 255, 0.04);
  --ui-popup-bg: rgba(8, 12, 20, 0.97);
  --ui-border: rgba(45, 212, 191, 0.18);
  --ui-border-subtle: rgba(255, 255, 255, 0.05);
  --ui-card-border: rgba(255, 255, 255, 0.035);
  --ui-input-border: rgba(180, 214, 238, 0.18);
  --ui-popup-border: rgba(45, 212, 191, 0.12);
  --ui-accent-border: rgba(45, 212, 191, 0.3);
  --ui-text: #d6e3ef;
  --ui-text-bright: #f1f5f9;
  --ui-subtle: #7e95a8;
  --ui-text-muted: #64748b;
  --ui-accent: #2dd4bf;
  --ui-accent-strong: #06b6d4;
  --ui-accent-glow: rgba(45, 212, 191, 0.35);
  --ui-accent-soft: rgba(45, 212, 191, 0.1);
  --ui-secondary: #818cf8;
  --ui-secondary-soft: rgba(99, 102, 241, 0.1);
  --ui-btn-primary-from: #0891b2;
  --ui-btn-primary-to: #0d9488;
}

/* == Theme: Light Command == */
[data-theme="light"] {
  --ui-bg-body: #e8eef6;
  --ui-bg: rgba(247, 250, 255, 0.94);
  --ui-bg-solid: #f5f8fd;
  --ui-surface: rgba(236, 243, 252, 0.92);
  --ui-card-bg: rgba(255, 255, 255, 0.88);
  --ui-input-bg: rgba(255, 255, 255, 0.94);
  --ui-popup-bg: rgba(249, 252, 255, 0.98);
  --ui-border: rgba(37, 99, 235, 0.2);
  --ui-border-subtle: rgba(30, 41, 59, 0.12);
  --ui-card-border: rgba(30, 41, 59, 0.12);
  --ui-input-border: rgba(37, 99, 235, 0.25);
  --ui-popup-border: rgba(37, 99, 235, 0.2);
  --ui-accent-border: rgba(37, 99, 235, 0.35);
  --ui-text: #10223d;
  --ui-text-bright: #06142d;
  --ui-subtle: #3f5674;
  --ui-text-muted: #637b96;
  --ui-accent: #2563eb;
  --ui-accent-strong: #1d4ed8;
  --ui-accent-glow: rgba(37, 99, 235, 0.24);
  --ui-accent-soft: rgba(37, 99, 235, 0.12);
  --ui-secondary: #0891b2;
  --ui-secondary-soft: rgba(8, 145, 178, 0.12);
  --ui-btn-primary-from: #2563eb;
  --ui-btn-primary-to: #0284c7;
}

/* == Theme: Noir Grid == */
[data-theme="noir"] {
  --ui-bg-body: #030407;
  --ui-bg: rgba(4, 5, 9, 0.96);
  --ui-bg-solid: #040509;
  --ui-surface: rgba(10, 12, 18, 0.9);
  --ui-card-bg: rgba(255, 255, 255, 0.015);
  --ui-input-bg: rgba(255, 255, 255, 0.03);
  --ui-popup-bg: rgba(3, 4, 7, 0.97);
  --ui-border: rgba(148, 163, 184, 0.22);
  --ui-border-subtle: rgba(255, 255, 255, 0.07);
  --ui-card-border: rgba(255, 255, 255, 0.045);
  --ui-input-border: rgba(148, 163, 184, 0.2);
  --ui-popup-border: rgba(148, 163, 184, 0.2);
  --ui-accent-border: rgba(148, 163, 184, 0.3);
  --ui-text: #dde4ef;
  --ui-text-bright: #f8fafc;
  --ui-subtle: #91a1b7;
  --ui-text-muted: #6b7a8e;
  --ui-accent: #94a3b8;
  --ui-accent-strong: #cbd5e1;
  --ui-accent-glow: rgba(203, 213, 225, 0.24);
  --ui-accent-soft: rgba(203, 213, 225, 0.08);
  --ui-secondary: #64748b;
  --ui-secondary-soft: rgba(100, 116, 139, 0.12);
  --ui-btn-primary-from: #334155;
  --ui-btn-primary-to: #0f172a;
}

/* == Theme: Rose Intelligence == */
[data-theme="rose"] {
  --ui-bg-body: #130813;
  --ui-bg: rgba(20, 8, 20, 0.95);
  --ui-bg-solid: #160a16;
  --ui-surface: rgba(34, 10, 32, 0.9);
  --ui-card-bg: rgba(255, 255, 255, 0.02);
  --ui-input-bg: rgba(255, 255, 255, 0.04);
  --ui-popup-bg: rgba(22, 8, 20, 0.97);
  --ui-border: rgba(244, 114, 182, 0.22);
  --ui-border-subtle: rgba(255, 255, 255, 0.07);
  --ui-card-border: rgba(255, 255, 255, 0.05);
  --ui-input-border: rgba(251, 113, 133, 0.24);
  --ui-popup-border: rgba(244, 114, 182, 0.24);
  --ui-accent-border: rgba(244, 114, 182, 0.34);
  --ui-text: #ffe4f2;
  --ui-text-bright: #fff1f7;
  --ui-subtle: #d4a2bd;
  --ui-text-muted: #ab7d95;
  --ui-accent: #f472b6;
  --ui-accent-strong: #fb7185;
  --ui-accent-glow: rgba(244, 114, 182, 0.28);
  --ui-accent-soft: rgba(244, 114, 182, 0.1);
  --ui-secondary: #f9a8d4;
  --ui-secondary-soft: rgba(249, 168, 212, 0.14);
  --ui-btn-primary-from: #db2777;
  --ui-btn-primary-to: #ec4899;
}


*, *::before, *::after {
  box-sizing: border-box;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
}
html, body { margin: 0; padding: 0; height: 100%; min-height: 100dvh; }
body {
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ui-bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
#map {
  position: absolute; inset: 0; width: 100vw; height: 100dvh;
  will-change: transform;
}
#map-theme-overlay {
  position: absolute;
  inset: 0;
  z-index: 250;
  pointer-events: none;
  background: transparent;
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity var(--transition-smooth), background var(--transition-smooth);
}
.leaflet-container { touch-action: pan-x pan-y; }

/* Leaflet zoom controls - dark theme */
.leaflet-control-zoom {
  border: 1px solid var(--ui-border-subtle) !important;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}
.leaflet-control-zoom a {
  background: rgba(2, 8, 23, 0.85) !important;
  color: var(--ui-subtle) !important;
  border-color: var(--ui-border-subtle) !important;
  backdrop-filter: blur(12px);
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 16px !important;
  transition: all 0.15s;
}
.leaflet-control-zoom a:hover {
  background: rgba(14, 165, 233, 0.15) !important;
  color: var(--ui-accent) !important;
}
.leaflet-control-zoom a:active {
  transform: scale(0.92);
}

/* Leaflet attribution - minimal dark */
.leaflet-control-attribution {
  background: rgba(2, 8, 23, 0.6) !important;
  color: #475569 !important;
  font-size: 9px !important;
  backdrop-filter: blur(8px);
}
.leaflet-control-attribution a { color: #64748b !important; }

/* GPU acceleration for animated elements */
.kpi-bar, .bottom-panel, .entity-panel, #control-panel,
.toast-msg, .intel-report-overlay, .shortcuts-overlay {
  transform: translateZ(0);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== Dark tile readability boost ====================
   Brighten dark tiles so roads/labels are legible */
.dark-tiles-boosted {
  filter: brightness(1.35) contrast(0.95) saturate(1.1);
}

[data-theme="light"] #map { filter: none; }
[data-theme="light"] .leaflet-tile { filter: none !important; }
[data-theme="light"] #map-theme-overlay {
  opacity: 0.12;
  mix-blend-mode: soft-light;
  background:
    linear-gradient(180deg, rgba(210, 228, 255, 0.18), rgba(200, 220, 250, 0.08));
}

[data-theme="noir"] #map { filter: none; }
[data-theme="noir"] .leaflet-tile { filter: none !important; }
[data-theme="noir"] #map-theme-overlay {
  opacity: 0.1;
  mix-blend-mode: multiply;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.2), rgba(15, 23, 42, 0.08));
}

[data-theme="rose"] #map { filter: none; }
[data-theme="rose"] .leaflet-tile { filter: none !important; }
[data-theme="rose"] #map-theme-overlay {
  opacity: 0.12;
  mix-blend-mode: screen;
  background:
    linear-gradient(180deg, rgba(251, 113, 133, 0.16), rgba(244, 114, 182, 0.08));
}

[data-theme="warm"] .leaflet-tile {
  filter: hue-rotate(345deg) saturate(1.14) brightness(0.98) contrast(1.04) !important;
}
[data-theme="warm"] #map-theme-overlay {
  opacity: 0.1;
  mix-blend-mode: soft-light;
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.16), rgba(146, 64, 14, 0.07));
}

[data-theme="teal"] .leaflet-tile {
  filter: hue-rotate(8deg) saturate(1.22) brightness(0.95) contrast(1.08) !important;
}
[data-theme="teal"] #map-theme-overlay {
  opacity: 0.08;
  mix-blend-mode: screen;
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.14), rgba(8, 47, 73, 0.05));
}

[data-theme="arctic"] .leaflet-tile {
  filter: hue-rotate(6deg) brightness(1.03) contrast(1.03) saturate(1.05) !important;
}
[data-theme="arctic"] #map-theme-overlay {
  opacity: 0.08;
  mix-blend-mode: screen;
  background: linear-gradient(180deg, rgba(125, 211, 252, 0.12), rgba(8, 24, 43, 0.04));
}

/* Explicit basemap tile classes for hard theme coloration */
.cr-theme-tiles-light {
  filter: brightness(1.04) contrast(0.98) saturate(0.96) !important;
}
.cr-theme-tiles-noir {
  filter: grayscale(0.08) brightness(0.94) contrast(1.05) saturate(0.9) !important;
}
.cr-theme-tiles-warm {
  filter: hue-rotate(356deg) saturate(1.06) brightness(1) contrast(1.01) !important;
}
.cr-theme-tiles-arctic {
  filter: hue-rotate(6deg) saturate(1.05) brightness(1.02) contrast(1.01) !important;
}
.cr-theme-tiles-teal {
  filter: hue-rotate(5deg) saturate(1.08) brightness(0.98) contrast(1.03) !important;
}
.cr-theme-tiles-rose {
  filter: hue-rotate(330deg) saturate(1.12) brightness(0.98) contrast(1.02) !important;
}

/* == Panel shell == */
#control-panel {
  position: absolute; top: 12px; left: 12px; z-index: 1000;
  width: 320px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  color: var(--ui-text);
  font-size: 13px;
  backdrop-filter: blur(28px) saturate(1.3);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 16px 56px rgba(0, 0, 0, 0.65);
  max-height: calc(100dvh - 60px);
  display: flex; flex-direction: column;
  transition: box-shadow var(--transition-smooth);
}

#control-panel.control-panel-layers-docked {
  left: auto;
  right: 12px;
  width: 360px;
}

/* == Header == */
.cp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ui-border-subtle);
  flex-shrink: 0;
  position: relative;
}
.cp-header.panel-draggable-handle {
  cursor: move;
  user-select: none;
}
.cp-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cp-menu-btn {
  min-width: 54px;
  height: 24px;
  padding: 0 8px;
  background: var(--ui-accent-soft);
  border: 1px solid var(--ui-accent-border);
  border-radius: 6px;
  color: var(--ui-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
}
.cp-menu-btn:hover {
  background: var(--ui-accent-glow);
}
.cp-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 42px;
  z-index: 1205;
  min-width: 150px;
  background: var(--ui-popup-bg);
  border: 1px solid var(--ui-accent-border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  padding: 6px;
}
.cp-menu.hidden {
  display: none;
}
.cp-menu-item {
  width: 100%;
  display: block;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ui-text);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 10px;
  cursor: pointer;
}
.cp-menu-item:hover {
  background: var(--ui-accent-soft);
  border-color: var(--ui-border);
}
.cp-title {
  font-weight: 700; font-size: 11px; letter-spacing: 3px;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
  background: linear-gradient(135deg, var(--ui-accent-strong), var(--ui-accent), var(--ui-accent-strong));
  background-size: 200% 200%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 4s ease infinite;
}
@keyframes titleShimmer { 0%,100%{background-position:0% 50%} 50%{background-position:100% 50%} }

.cp-meta-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--ui-border-subtle);
}

.cp-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.44);
  color: var(--ui-text);
  font-size: 10px;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.cp-meta-chip strong {
  color: var(--ui-accent);
  font-size: 11px;
  font-weight: 700;
}

.cp-meta-chip-score {
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(135deg, rgba(55, 48, 20, 0.52), rgba(31, 41, 55, 0.44));
}

.cp-meta-chip-score em {
  font-style: normal;
  color: #fcd34d;
  letter-spacing: 0.45px;
}

.cp-meta-btn {
  margin-left: auto;
  cursor: pointer;
  border-color: rgba(34, 211, 238, 0.45);
  background: linear-gradient(135deg, rgba(12, 74, 110, 0.5), rgba(15, 23, 42, 0.62));
  color: #dbeafe;
  font-weight: 700;
  transition: all 0.18s ease;
}

.cp-meta-btn:hover {
  border-color: rgba(34, 211, 238, 0.7);
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.62), rgba(15, 23, 42, 0.72));
}

#cp-toggle {
  width: 24px; height: 24px;
  background: var(--ui-input-bg); border: 1px solid var(--ui-border-subtle);
  border-radius: 5px; color: #475569; font-size: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1; transition: all 0.15s;
}
#cp-toggle:hover { background: rgba(255,255,255,0.08); color: var(--ui-subtle); }

.cp-body { padding: 0 10px 10px; overflow-y: auto; flex: 1; min-height: 0; }
.cp-body.collapsed { display: none; }

/* == Tabs == */
.cp-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--ui-border-subtle);
  margin: 0 -14px; padding: 0 14px;
}
.cp-tab {
  flex: 1; padding: 9px 4px; background: none; border: none;
  color: var(--ui-text-muted); font-size: 10px; font-weight: 700; font-family: inherit;
  text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.tab-icon {
  width: 13px;
  height: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.cp-tab:hover .tab-icon,
.cp-tab.active .tab-icon { opacity: 1; }
.cp-tab:hover { color: var(--ui-text); background: var(--ui-card-bg); }
.cp-tab.active { color: var(--ui-accent); border-bottom-color: var(--ui-accent-strong); background: var(--ui-accent-soft); }

.cp-tab-pane { display: none; padding-top: 10px; }
.cp-tab-pane.active { display: block; }


.cp-quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: 6px 0 8px;
}

.quick-action-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  white-space: nowrap;
}

.quick-action-btn:hover {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent-border);
  color: var(--ui-text-bright);
}

.quick-action-btn:active {
  transform: scale(0.97);
}

.quick-action-btn::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 8px;
  letter-spacing: 0.5px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  content: "OPS";
  flex-shrink: 0;
}

#quick-search-company::before { content: "CH"; }
#quick-search-officer::before { content: "PSC"; }
#quick-search-dvla::before { content: "DVLA"; }
#quick-entity-place::before { content: "NEW"; background: var(--ui-secondary-soft); color: var(--ui-secondary); }
#quick-entity-import::before { content: "FILE"; }
#quick-entity-export::before { content: "OUT"; background: rgba(148,163,184,0.12); color: var(--ui-subtle); }
#quick-layer-underground::before { content: "TFL"; }
#quick-layer-flights::before { content: "FR24"; }
#quick-layer-health::before { content: "SYS"; }

.cp-quick-hint {
  margin: 0 0 10px;
  padding: 7px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-subtle);
  font-size: 10px;
  line-height: 1.45;
}

#layer-preset-transport,
#layer-preset-intel,
#layer-preset-clear {
  position: relative;
  overflow: hidden;
}

#layer-preset-transport::after,
#layer-preset-intel::after,
#layer-preset-clear::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  opacity: 0.75;
}

#layer-preset-transport::after {
  background: linear-gradient(90deg, #06b6d4, #38bdf8);
}

#layer-preset-intel::after {
  background: linear-gradient(90deg, #22c55e, #84cc16);
}

#layer-preset-clear::after {
  background: linear-gradient(90deg, #f59e0b, #f97316);
}

/* == Help Text == */
.psc-help-text {
  background: var(--ui-accent-soft);
  border-left: 3px solid #818cf8;
  padding: 8px 10px;
  margin: 10px 0;
  font-size: 10px;
  color: var(--ui-subtle);
  line-height: 1.5;
  border-radius: 4px;
}

/* == Labels & Inputs == */
#control-panel label:not(.layer-row) {
  display: block; font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: #b1c7d7; margin-top: 8px; margin-bottom: 3px;
}
#control-panel input[type="text"] {
  width: 100%; padding: 7px 9px;
  background: var(--ui-input-bg);
  border: 1px solid rgba(180, 214, 238, 0.18);
  border-radius: 7px; color: var(--ui-text-bright); font-size: 12px;
  font-family: inherit; outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
#control-panel input[type="text"]:focus {
  border-color: rgba(125, 211, 252, 0.7);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
#control-panel input[type="text"]::placeholder { color: var(--ui-text-muted); }

/* == Select elements == */
#control-panel select {
  width: 100%; padding: 7px 9px;
  background: var(--ui-input-bg);
  border: 1px solid rgba(180, 214, 238, 0.18);
  border-radius: 7px; color: var(--ui-text-bright); font-size: 12px;
  font-family: inherit; outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
#control-panel select:focus {
  border-color: rgba(125, 211, 252, 0.7);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}
#control-panel select option {
  background: #1e293b;
  color: #e2e8f0;
}

/* == Buttons == */
.cp-btn-row { display: flex; gap: 6px; margin-top: 9px; }
.btn-primary, .btn-secondary {
  flex: 1; min-height: 32px; padding: 8px 0; border: none; border-radius: var(--ui-radius-sm);
  font-size: 10.5px; font-weight: 700; font-family: inherit;
  letter-spacing: 0.6px; cursor: pointer; transition: all var(--transition-fast);
  text-transform: uppercase;
}
.btn-primary {
  background: linear-gradient(135deg, var(--ui-btn-primary-from) 0%, var(--ui-btn-primary-to) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(8,145,178,0.3), 0 0 0 1px rgba(45, 212, 191, 0.1) inset;
}
.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(13,148,136,0.4), 0 0 0 1px rgba(45, 212, 191, 0.15) inset;
  transform: translateY(-1px);
  filter: brightness(1.1);
}
.btn-primary:active { transform: translateY(0); filter: brightness(0.95); }
.btn-secondary {
  background: var(--ui-card-bg); color: var(--ui-subtle);
  border: 1px solid var(--ui-border-subtle);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.06); color: var(--ui-text);
  border-color: rgba(255,255,255,0.1);
}
.btn-secondary:active { transform: scale(0.97); filter: brightness(0.9); }

/* Button loading spinner - add .btn-loading to any button */
.btn-loading { pointer-events: none; opacity: 0.7; position: relative; }
.btn-loading::after {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
  margin-left: 6px;
  vertical-align: middle;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* == Progress bar == */
.cp-progress { margin-bottom: 10px; padding: 8px 10px; background: rgba(6,182,212,0.05); border: 1px solid rgba(6,182,212,0.12); border-radius: var(--ui-radius-sm); }
.cp-progress.done { display: none; }
.cp-progress-label { display: flex; justify-content: space-between; font-size: 9px; font-weight: 700; color: var(--ui-accent); margin-bottom: 5px; letter-spacing: 0.3px; }
.cp-progress-track { height: 3px; background: var(--ui-input-bg); border-radius: 2px; overflow: hidden; }
.cp-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #06b6d4, #2dd4bf, #06b6d4);
  background-size: 200% 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  box-shadow: 0 0 6px rgba(6,182,212,0.4);
  animation: progressGlow 2s ease infinite;
}
@keyframes progressGlow {
  0%, 100% { background-position: 0% 0; }
  50% { background-position: 100% 0; }
}

/* == Results == */
#ch_results { max-height: 260px; overflow-y: auto; margin-top: 10px; }
#ch_results:empty { display: none; }
.ch-result-count { font-size: 10px; color: var(--ui-secondary); padding: 6px 0 8px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.ch-result-item {
  padding: 9px 10px; margin: 3px 0; border-radius: var(--ui-radius-sm);
  background: var(--ui-card-bg); border: 1px solid rgba(255,255,255,0.035);
  cursor: pointer; transition: all var(--transition-fast);
  position: relative;
  display: flex; align-items: flex-start; gap: 8px;
}
.ch-r-icon {
  min-width: 30px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  font-size: 8px;
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

.cr-mono-icon {
  vertical-align: -2px;
  color: currentColor;
}

.btn-icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -1px;
}

.popup-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -1px;
}
.ch-r-text { flex: 1; min-width: 0; }
.ch-result-item::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px; border-radius: 1px;
  background: transparent;
  transition: background var(--transition-fast);
}
.ch-result-item:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(45, 212, 191, 0.15);
  transform: translateX(2px);
}
.ch-result-item:hover::before {
  background: var(--ui-accent);
}
.ch-result-item:active { transform: translateX(2px) scale(0.99); }
.ch-result-item .ch-r-name { font-weight: 600; font-size: 11.5px; color: var(--ui-text-bright); line-height: 1.3; }
.ch-result-item .ch-r-detail { font-size: 10px; color: var(--ui-subtle); margin-top: 3px; }

.ch-loading { text-align: center; padding: 18px 0; color: var(--ui-text); font-size: 11px; font-weight: 500; }
.ch-loading::before {
  content: ""; display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(99,102,241,0.2); border-top-color: #a78bfa;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* == PSC results == */
#psc_results { max-height: 320px; overflow-y: auto; margin-top: 10px; }
#psc_results:empty { display: none; }
#psc_results::-webkit-scrollbar { width: 4px; }
#psc_results::-webkit-scrollbar-track { background: transparent; }
#psc_results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }

/* PSC Results Header */
.psc-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ui-border-subtle);
}

.btn-download-pdf {
  padding: 6px 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}

.btn-download-pdf:hover {
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
  transform: translateY(-1px);
}

/* PSC Cards */
.psc-card {
  background: var(--ui-card-bg);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.15s;
}

.psc-card:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(99,102,241,0.2);
}

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

.psc-name {
  font-size: 13px;
  font-weight: 700;
  color: #c4b5fd;
  line-height: 1.3;
  flex: 1;
}

.psc-detail {
  font-size: 10px;
  color: var(--ui-text);
  margin-bottom: 4px;
  line-height: 1.4;
}

.psc-detail-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.psc-flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.22);
  background: linear-gradient(180deg, rgba(15,23,42,0.56), rgba(2,6,23,0.65));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.psc-label {
  color: var(--ui-subtle);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.5px;
}

.psc-natures {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.psc-nature-tag {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(99,102,241,0.1);
  color: var(--ui-secondary);
  border: 1px solid var(--ui-accent-border);
  border-radius: 4px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: capitalize;
}

.psc-person-name { color: #c4b5fd !important; }
.psc-natures { font-size: 9px !important; color: #475569 !important; font-style: italic; margin-top: 2px; }

.psc-tag-individual { background: rgba(34,197,94,0.12) !important; color: #4ade80 !important; }
.psc-tag-corporate { background: rgba(251,146,60,0.12) !important; color: #fb923c !important; }

/* == OpenSanctions ======================================= */
.os-schema-select {
  width: 100%; padding: 5px 8px; background: #1e293b; color: #cbd5e1;
  border: 1px solid rgba(99,102,241,0.3); border-radius: 6px; font-size: 11px;
}
.os-result-card {
  background: #1a2035; border: 1px solid rgba(239,68,68,0.25);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; font-size: 11px;
  transition: border-color 0.15s;
}
.os-result-card:hover { border-color: rgba(239,68,68,0.55); }
.os-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 4px;
}
.os-name { font-weight: 600; color: #e2e8f0; font-size: 12px; line-height: 1.3; flex: 1; }
.os-schema-badge {
  font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 4px;
  white-space: nowrap; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.03em;
}
.os-schema-person  { background: rgba(99,102,241,0.18); color: #818cf8; }
.os-schema-company { background: rgba(16,185,129,0.18); color: #34d399; }
.os-schema-org     { background: rgba(16,185,129,0.18); color: #34d399; }
.os-schema-legal   { background: rgba(148,163,184,0.18); color: #94a3b8; }
.os-schema-vessel  { background: rgba(34,211,238,0.18); color: #22d3ee; }
.os-schema-crypto  { background: rgba(251,191,36,0.18); color: #fbbf24; }
.os-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.os-tag {
  font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.os-tag-sanction { background: rgba(239,68,68,0.20); color: #f87171; }
.os-tag-pep      { background: rgba(251,146,60,0.20); color: #fb923c; }
.os-tag-crime    { background: rgba(168,85,247,0.20); color: #c084fc; }
.os-tag-wanted   { background: rgba(239,68,68,0.30); color: #fca5a5; }
.os-tag-poi      { background: rgba(148,163,184,0.15); color: #94a3b8; }
.os-countries { display: inline-flex; align-items: center; gap: 3px; }
.os-flag-icon { width: 18px; height: 13px; object-fit: cover; border-radius: 2px; vertical-align: middle; border: 1px solid rgba(255,255,255,0.08); }
.os-flag-txt  { font-size: 9px; font-weight: 700; color: #64748b; letter-spacing: .5px; }
.os-birth { font-size: 10px; color: #64748b; }
.os-datasets { font-size: 10px; color: #475569; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.os-hint { color: #475569; font-size: 11px; padding: 6px 2px; }
.os-error { color: #f87171 !important; }

/* Place button & detail pills */
.os-card-header-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.os-place-btn {
  font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; cursor: pointer;
  background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.35);
  white-space: nowrap; transition: background 0.15s;
}
.os-place-btn:hover { background: rgba(99,102,241,0.35); color: #c7d2fe; }
.os-detail-row { font-size: 10px; color: #64748b; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.os-detail-pill {
  background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 3px;
  padding: 1px 5px; font-size: 9px; color: #94a3b8; font-family: 'Courier New', monospace;
}

/* Inline results in Person pane */
.intel-results-inline {
  display: none; max-height: 55vh; overflow-y: auto; margin-top: 4px;
  scrollbar-width: thin; scrollbar-color: #1e293b transparent;
}
.intel-results-inline .us-result-card { font-size: 10px; }
.intel-results-inline .os-hint { padding: 8px 2px; }

/* Pop-out results panel */
.os-results-popout {
  position: fixed; z-index: 8000; display: none; flex-direction: column;
  width: 380px; max-height: 70vh;
  background: #0f172a; border: 1px solid rgba(99,102,241,0.4); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(99,102,241,0.1);
  overflow: hidden;
}
.os-popout-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid #1e293b;
  background: #0a1628; flex-shrink: 0;
}
.os-popout-title { font-size: 11px; font-weight: 700; color: #818cf8; letter-spacing: .5px; text-transform: uppercase; }
.os-popout-close {
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(239,68,68,0.15); color: #f87171; font-size: 11px; line-height: 1;
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; justify-content: center;
}
.os-popout-close:hover { background: rgba(239,68,68,0.4); }
.os-popout-body {
  overflow-y: auto; flex: 1; padding: 8px 10px;
  scrollbar-width: thin; scrollbar-color: #334155 transparent;
}

/* == Unified Intelligence Search Panel ========================== */
#us-panel {
  position: fixed; z-index: 8500;
  top: 58px; left: 310px;         /* right of left nav */
  width: 480px; max-height: calc(100vh - 70px);
  display: none; flex-direction: column;
  background: #0a1628; border: 1px solid rgba(99,102,241,0.45);
  border-radius: 12px; box-shadow: 0 12px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(99,102,241,0.1);
  font-family: 'Bahnschrift', 'Lato', 'Segoe UI', sans-serif; overflow: hidden;
}
.us-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #060e1c;
  border-bottom: 1px solid rgba(99,102,241,0.2); flex-shrink: 0;
}
.us-panel-title {
  font-size: 11px;
  font-weight: 800;
  color: #818cf8;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.us-panel-controls { display: flex; align-items: center; gap: 8px; }
.us-shortcut-hint { font-size: 9px; color: #334155; border: 1px solid #334155; border-radius: 3px; padding: 1px 5px; font-family: monospace; }
.us-close-btn {
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(239,68,68,0.15); color: #f87171; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.us-close-btn:hover { background: rgba(239,68,68,0.4); }

/* == Bucket bar (entity type row) == */
.us-bucket-bar {
  display: flex; gap: 3px; padding: 8px 10px 6px; overflow-x: auto; flex-shrink: 0;
  border-bottom: 1px solid #0f1f38; background: #080f1e;
  scrollbar-width: none;
}
.us-bucket-bar::-webkit-scrollbar { display: none; }
.us-bucket-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: 8px; border: 1px solid #1e293b; cursor: pointer;
  background: rgba(30,41,59,0.4); color: #64748b; transition: all 0.15s;
  white-space: nowrap; min-width: 58px; flex-shrink: 0;
}
.us-bucket-chip:hover  { border-color: rgba(99,102,241,0.4); color: #a5b4fc; background: rgba(99,102,241,0.08); }
.us-bucket-chip.active { border-color: #6366f1; color: #c7d2fe; background: rgba(99,102,241,0.18); }
.us-bucket-icon  {
  min-width: 30px;
  min-height: 18px;
  border: 1px solid rgba(148,163,184,0.28);
  border-radius: 999px;
  background: rgba(15,23,42,0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-family: "JetBrains Mono", monospace;
}

.us-bucket-icon .cr-mono-icon {
  vertical-align: 0;
}
.us-bucket-label { font-size: 9px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; }

/* == Source bar (data source sub-row) == */
.us-source-bar {
  display: flex; gap: 4px; padding: 5px 10px; flex-wrap: wrap; flex-shrink: 0;
  border-bottom: 1px solid #0f1f38; min-height: 30px; background: #07111f;
}
.us-src-chip {
  padding: 3px 9px; border-radius: 12px; border: 1px solid #1e293b; cursor: pointer;
  background: rgba(30,41,59,0.4); color: #64748b; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px; transition: all 0.15s; white-space: nowrap;
}
.us-src-chip:hover        { border-color: rgba(99,102,241,0.4); color: #a5b4fc; background: rgba(99,102,241,0.1); }
.us-src-chip.active       { border-color: #6366f1; color: #c7d2fe; background: rgba(99,102,241,0.2); }
/* Filter chips (post-search toggles) */
.us-filter-chip.off       { border-color: #1e293b; color: #374151; background: rgba(15,23,42,0.4); text-decoration: line-through; opacity: 0.5; }
.us-filter-chip.off:hover { opacity: 0.8; border-color: rgba(99,102,241,0.3); text-decoration: none; }
.us-filter-count          { display: inline-block; background: rgba(255,255,255,0.08); border-radius: 8px; padding: 0 5px; margin-left: 3px; font-size: 9px; }

/* == External source hint == */
.us-external-hint {
  margin: 8px 4px; padding: 10px 12px; border-radius: 6px;
  background: rgba(251,191,36,0.06); border: 1px solid rgba(251,191,36,0.2);
  color: #94a3b8; font-size: 11px; line-height: 1.6;
}
.us-external-hint strong { color: #fbbf24; }

/* == Place toast == */
.us-place-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #0f2041; color: #e2e8f0;
  border: 1px solid rgba(99,102,241,0.5); padding: 10px 16px;
  border-radius: 8px; font-size: 12px; font-family: 'Bahnschrift','Lato','Segoe UI',sans-serif;
  z-index: 9999; box-shadow: 0 4px 16px rgba(0,0,0,.6); max-width: 320px;
}

.us-search-row {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; flex-shrink: 0;
}
.us-input {
  flex: 1; height: 34px; padding: 0 10px; border-radius: 6px;
  background: #0f1f38; border: 1px solid #1e3a5f; color: #e2e8f0;
  font-size: 12px; font-family: inherit; outline: none;
}
.us-input:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }
.us-search-btn {
  height: 34px; padding: 0 14px; border-radius: 6px; border: none; cursor: pointer;
  background: #6366f1; color: #fff; font-size: 11px; font-weight: 700;
  font-family: inherit; transition: background 0.15s; white-space: nowrap;
}
.us-search-btn:hover { background: #4f46e5; }
.us-clear-btn {
  height: 34px; width: 34px; border-radius: 6px; border: 1px solid #1e293b; cursor: pointer;
  background: rgba(239,68,68,0.08); color: #64748b; font-size: 13px; font-family: inherit;
}
.us-clear-btn:hover { color: #f87171; border-color: rgba(239,68,68,0.4); }

.us-desc-row { font-size: 10px; color: #334155; padding: 0 13px 6px; flex-shrink: 0; }
.us-status-row { display: flex; align-items: center; padding: 0 13px 4px; flex-shrink: 0; }
.us-count { font-size: 10px; color: #475569; }

.us-results {
  overflow-y: auto; flex: 1; padding: 6px 10px 10px;
  scrollbar-width: thin; scrollbar-color: #1e293b transparent;
}

/* Result cards */
.us-result-card {
  background: #0d1b2e; border: 1px solid rgba(99,102,241,0.18);
  border-radius: 8px; padding: 9px 11px; margin-bottom: 6px;
  transition: border-color 0.15s;
}
.us-result-card:hover { border-color: rgba(99,102,241,0.45); }
.us-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; margin-bottom: 5px;
}
.us-card-name { font-size: 12px; font-weight: 700; color: #e2e8f0; flex: 1; line-height: 1.3; }
.us-dob { font-size: 10px; font-weight: 400; color: #94a3b8; margin-left: 5px; white-space: nowrap; }
.us-card-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.us-place-btn {
  font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 4px; cursor: pointer;
  background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.35);
  white-space: nowrap; transition: background 0.15s;
}
.us-place-btn:hover { background: rgba(99,102,241,0.35); color: #c7d2fe; }
.us-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 4px;
}
.us-countries { display: inline-flex; align-items: center; gap: 2px; }
.us-detail-item { font-size: 10px; color: #64748b; }
.us-pill-row { font-size: 10px; color: #64748b; display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; align-items: center; }
.us-notes { color: #475569; font-size: 10px; margin-top: 3px; }
.us-pill {
  background: rgba(15,23,42,0.6); border: 1px solid #1e293b; border-radius: 3px;
  padding: 1px 5px; font-size: 9px; color: #94a3b8; font-family: 'Courier New', monospace;
}
.us-hint { color: #475569; font-size: 11px; padding: 8px 2px; }
.us-hint-error { color: #f87171; }

/* Source badges */
.us-src-badge { font-size: 8px; font-weight: 700; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.us-src-os  { background: rgba(239,68,68,0.12);  color: #f87171; }
.us-src-ch  { background: rgba(16,185,129,0.12); color: #34d399; }
.us-src-psc { background: rgba(251,191,36,0.12); color: #fbbf24; }

/* Topic badges */
.us-badge { font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.us-badge-sanction { background: rgba(239,68,68,0.20); color: #f87171; }
.us-badge-pep      { background: rgba(251,146,60,0.20); color: #fb923c; }
.us-badge-crime    { background: rgba(168,85,247,0.20); color: #c084fc; }
.us-badge-wanted   { background: rgba(239,68,68,0.30); color: #fca5a5; }
.us-badge-psc      { background: rgba(251,191,36,0.15); color: #fbbf24; }
.us-badge-poi      { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* Trigger button (in top bar) */
#us-trigger-btn {
  display: flex; align-items: center; gap: 5px; padding: 0 10px; height: 28px;
  border-radius: 5px; border: 1px solid rgba(99,102,241,0.35); cursor: pointer;
  background: rgba(99,102,241,0.1); color: #818cf8; font-size: 10px; font-weight: 700;
  font-family: inherit; letter-spacing: .5px; transition: all 0.15s; white-space: nowrap;
}
#us-trigger-btn:hover { background: rgba(99,102,241,0.25); color: #c7d2fe; }

/* View PSC button in popup */
.popup-psc-btn {
  display: inline-block; margin-top: 4px; padding: 5px 10px;
  background: var(--ui-accent-soft);
  color: var(--ui-secondary); border: 1px solid rgba(99,102,241,0.25); border-radius: 5px;
  font-size: 10px; font-weight: 600; font-family: inherit;
  letter-spacing: 0.3px; cursor: pointer; transition: all 0.15s;
}
.popup-psc-btn:hover { background: rgba(99,102,241,0.25); color: #c4b5fd; border-color: rgba(99,102,241,0.4); transform: translateY(-1px); }

.popup-flag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.28);
  background: linear-gradient(180deg, rgba(15,23,42,0.52), rgba(2,6,23,0.72));
  color: #dbeafe;
  letter-spacing: 0.2px;
}

/* Company profile PDF preview dock (right side) */
.company-profile-preview-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1200;
  width: min(520px, calc(100vw - 24px));
  height: calc(100dvh - 72px);
  background: var(--ui-popup-bg);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.56);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.company-profile-preview-panel.open {
  display: flex;
}

.company-profile-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.company-profile-preview-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--ui-accent);
}

.company-profile-preview-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: var(--ui-card-bg);
  color: var(--ui-subtle);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.company-profile-preview-close:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
}

.company-profile-preview-meta {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--ui-text);
  border-bottom: 1px solid var(--ui-border-subtle);
}

.company-profile-preview-body {
  flex: 1;
  min-height: 0;
}

.company-profile-preview-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #0b1320;
}

.company-profile-preview-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* PSC quick panel (right side) */
.psc-quick-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1190;
  width: min(460px, calc(100vw - 24px));
  max-height: calc(100dvh - 72px);
  background: var(--ui-popup-bg);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.56);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.psc-quick-panel.open {
  display: flex;
}

.psc-quick-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.psc-quick-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--ui-accent);
}

.psc-quick-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: var(--ui-card-bg);
  color: var(--ui-subtle);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.psc-quick-close:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
}

.psc-quick-meta {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--ui-text);
  border-bottom: 1px solid var(--ui-border-subtle);
}

.psc-quick-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
}

.psc-quick-body::-webkit-scrollbar {
  width: 5px;
}

.psc-quick-body::-webkit-scrollbar-track {
  background: var(--ui-card-bg);
}

.psc-quick-body::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
}

.psc-quick-body::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.35);
}

@media (max-width: 900px) {
  .psc-quick-panel {
    top: 8px;
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 52vh;
  }
}

/* == Scrollbar == */
/* Global dark scrollbar theme */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ui-accent-soft); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(45, 212, 191, 0.25); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--ui-accent-soft) transparent; }

/* =======================================================
   Layers Tab
   ======================================================= */

.layer-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--ui-subtle); margin: 14px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(99,102,241,0.1);
}
.layer-section-title:first-child { margin-top: 6px; }

.panel-disclosure {
  margin: 7px 0 9px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: rgba(15,23,42,0.22);
  overflow: hidden;
}

.panel-disclosure > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding: 8px 28px 8px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ui-text);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  line-height: 1.2;
  background: rgba(30,41,59,0.35);
  border-bottom: 1px solid rgba(99,102,241,0.15);
}

.panel-disclosure > summary::-webkit-details-marker {
  display: none;
}

.panel-disclosure > summary::after {
  content: "+";
  color: var(--ui-accent);
  font-size: 13px;
  line-height: 1;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.panel-disclosure[open] > summary::after {
  content: "-";
}

.panel-disclosure > :not(summary) {
  padding: 7px;
  animation: detailsSlide 0.15s ease-out;
}

@keyframes detailsSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-disclosure.hidden {
  display: none !important;
}

.layer-group {
  margin: 10px 0;
}

.layer-tool-block.hidden {
  display: none;
}

/* Base map pills */
.base-pills { display: flex; gap: 4px; margin-bottom: 4px; }
.bl-pill {
  flex: 1; padding: 7px 0; border: 1px solid var(--ui-border-subtle);
  border-radius: 6px; background: var(--ui-card-bg);
  color: var(--ui-subtle); font-size: 10px; font-weight: 600; font-family: inherit;
  letter-spacing: 0.3px; cursor: pointer; transition: all 0.2s; text-align: center;
}
.bl-pill:hover { background: rgba(255,255,255,0.05); color: var(--ui-text); }
.bl-pill.active {
  background: var(--ui-accent-soft); color: var(--ui-accent);
  border-color: var(--ui-accent-border); box-shadow: 0 0 8px var(--ui-accent-soft);
}

/* Layer rows with toggle switches */
.layer-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 32px;
  padding: 7px 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.layer-row:hover { opacity: 0.85; }
.layer-row input[type="checkbox"] { display: none; }

.toggle-track {
  position: relative; width: 34px; height: 18px; flex-shrink: 0;
  background: rgba(255,255,255,0.08); border-radius: 9px; transition: background 0.2s;
}
.layer-row input:checked + .toggle-track { background: #6366f1; }

.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; background: #94a3b8; border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.layer-row input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px); background: #fff;
}

.layer-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 6px currentColor, 0 0 0 1.5px var(--ui-bg-solid);
  outline: 1.5px solid transparent;
}

/* ==================== Layer icons  Maki SVG via CSS mask-image ====================
   Each layer row shows a meaningful SVG icon tinted with the layer colour.
   background-color provides the tint; mask-image provides the shape.          */
.layer-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--lc, var(--ui-subtle));
  -webkit-mask-image: var(--li, none);
  mask-image: var(--li, none);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  transition: opacity var(--transition-fast);
}
.layer-row:hover .layer-icon { opacity: 0.85; }

/* Icon URL registry keyed by data-icon */
.layer-icon[data-icon="building"]              { --li: url("../gfx/entity_icons/phosphor/buildings-light.svg"); }
.layer-icon[data-icon="town-hall"]             { --li: url("../gfx/entity_icons/phosphor/flag-light.svg"); }
.layer-icon[data-icon="star"]                  { --li: url("../gfx/entity_icons/phosphor/sword-light.svg"); }
.layer-icon[data-icon="marker"]                { --li: url("../gfx/entity_icons/phosphor/map-pin-light.svg"); }
.layer-icon[data-icon="rail-metro"]            { --li: url("../gfx/entity_icons/phosphor/train-light.svg"); }
.layer-icon[data-icon="rail"]                  { --li: url("../gfx/entity_icons/phosphor/train-light.svg"); }
.layer-icon[data-icon="fuel"]                  { --li: url("../gfx/entity_icons/phosphor/gas-pump-light.svg"); }
.layer-icon[data-icon="bicycle-share"]         { --li: url("../gfx/entity_icons/phosphor/bicycle-light.svg"); }
.layer-icon[data-icon="airport"]               { --li: url("../gfx/entity_icons/phosphor/airplane-light.svg"); }
.layer-icon[data-icon="ferry"]                 { --li: url("../gfx/entity_icons/phosphor/boat-light.svg"); }
.layer-icon[data-icon="harbor"]                { --li: url("../gfx/entity_icons/phosphor/anchor-light.svg"); }
.layer-icon[data-icon="communications-tower"]  { --li: url("../gfx/entity_icons/phosphor/cell-tower-light.svg"); }
.layer-icon[data-icon="police"]                { --li: url("../gfx/entity_icons/phosphor/shield-light.svg"); }
.layer-icon[data-icon="danger"]                { --li: url("../gfx/entity_icons/phosphor/warning-light.svg"); }
.layer-icon[data-icon="bus"]                   { --li: url("../gfx/entity_icons/phosphor/bus-light.svg"); }
.layer-icon[data-icon="car"]                   { --li: url("../gfx/entity_icons/phosphor/car-light.svg"); }
.layer-icon[data-icon="globe"]                 { --li: url("../gfx/entity_icons/phosphor/globe-light.svg"); }
.layer-icon[data-icon="bank"]                  { --li: url("../gfx/entity_icons/phosphor/bank-light.svg"); }
.layer-icon[data-icon="financial"]             { --li: url("../gfx/entity_icons/phosphor/chart-line-up-light.svg"); }

.layer-icon.layer-icon-svg {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

.layer-icon.layer-icon-svg .cr-mono-icon {
  vertical-align: 0;
}

/* Entity palette icon - Maki SVG via CSS mask, sized for the entity-btn grid */
.entity-palette-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.entity-palette-icon.entity-palette-icon-svg {
  background: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* == Solo layer section (no collapsible group needed for a single row) == */
.layer-solo-group {
  padding: 0 0 2px;
}
.layer-solo-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ui-subtle);
  padding: 8px 2px 3px;
  pointer-events: none;
  user-select: none;
}

/* == Nested tool block inside a layer group == */
.layer-tool-nested {
  margin-left: 6px;
  border-left: 2px solid rgba(255,255,255,0.05);
  padding-left: 6px;
  margin-top: 4px;
}
.layer-tool-nested > summary {
  font-size: 10.5px;
  opacity: 0.75;
}
.layer-tool-nested > summary:hover,
.panel-disclosure.layer-tool-nested[open] > summary {
  opacity: 1;
}

.layer-inline-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 8px 32px;
  flex-wrap: wrap;
}
/* == Floating map toolbar == */
.map-toolbar {
  position: fixed;
  left: 12px;
  bottom: 92px;   /* sits above the Leaflet zoom control (~78px tall at bottom-left) */
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}
.map-tb-btn {
  pointer-events: all;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: var(--ui-text, #e2e8f0);
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}
.map-tb-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
}
.map-tb-btn[aria-pressed="true"] {
  background: rgba(99, 102, 241, 0.28);
  border-color: rgba(99, 102, 241, 0.7);
  color: #a5b4fc;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
}

/* ==================== Summary-level icons in layer group headers  slightly smaller, muted by default, ====================
   switches to accent colour when the group is expanded                           */
.summary-icon {
  width: 12px;
  height: 12px;
  margin-right: 8px;
  background-color: var(--ui-subtle);
  position: relative;
  top: 0;
}
.panel-disclosure[open] > summary .summary-icon {
  background-color: var(--ui-accent);
}

.layer-name {
  font-size: 12px;
  color: var(--ui-text);
  font-weight: 500;
  line-height: 1.25;
}

.battle-legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.6), 0 0 6px currentColor;
  vertical-align: middle;
}
.battle-legend-dot-attacker { background: #22c55e; color: #22c55e; }
.battle-legend-dot-defender { background: #ef4444; color: #ef4444; }
.battle-legend-dot-unknown { background: #94a3b8; color: #94a3b8; }
/* Layer sub-pills (railway mode etc) */
.layer-sub-pills {
  display: flex;
  gap: 3px;
  padding: 2px 0 6px 42px;
}
.layer-sub-pill {
  padding: 3px 8px;
  border: 1px solid var(--ui-border-subtle);
  border-radius: 4px;
  background: transparent;
  color: var(--ui-text-muted);
  font-size: 9px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s;
}
.layer-sub-pill:hover { background: var(--ui-card-bg); color: var(--ui-subtle); }
.layer-sub-pill.active {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  border-color: var(--ui-accent-border);
}

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

.layer-status-card {
  padding: 10px 12px;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.layer-status-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ui-text-muted);
}

.layer-status-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--ui-accent);
  margin: 4px 0 2px;
}

.layer-status-sub {
  font-size: 10px;
  color: var(--ui-subtle);
}

.layer-status-card-compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.layer-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px 10px;
  margin: 4px 0;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 11px;
  color: var(--ui-text);
  border: 1px solid rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.18);
  text-transform: uppercase;
}

.layer-search-panel {
  margin: 12px 0 14px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.32);
}

.layer-search-input {
  display: flex;
  gap: 8px;
  align-items: center;
}

.layer-search-input input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--ui-border-subtle);
  background: var(--ui-input-bg);
  color: var(--ui-text);
  font-size: 12px;
}

.layer-search-input input:focus {
  border-color: rgba(129, 140, 248, 0.35);
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.12);
}

.layer-search-meta {
  margin-top: 6px;
  font-size: 10px;
  color: var(--ui-text-muted);
}

.layer-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}

.layer-preset-btn {
  position: relative;
  text-align: left;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.4);
  color: var(--ui-text);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.layer-preset-btn:hover {
  border-color: rgba(129, 140, 248, 0.4);
  background: rgba(15, 23, 42, 0.6);
}

.layer-preset-btn.active {
  border-color: rgba(99, 102, 241, 0.6);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(129, 140, 248, 0.15));
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.preset-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.preset-sub {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ui-subtle);
}

.layer-preset-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.layer-reset-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
}

.layer-reset-btn:hover {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.22);
}

.layer-preset-hint {
  font-size: 10px;
  color: var(--ui-text-muted);
}

.layer-search-empty {
  font-size: 11px;
  color: var(--ui-text-muted);
  margin-bottom: 8px;
}

.layer-row-hidden,
.layer-row.hidden {
  display: none !important;
}

.layer-group-hidden,
.layer-group.hidden {
  display: none !important;
}

.crime-filter-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.crime-force-search-input {
  min-width: 260px;
  flex: 1 1 280px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  padding: 7px 10px;
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
}
.crime-force-search-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.8);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}
.crime-box-active {
  border-color: rgba(34, 197, 94, 0.7) !important;
  background: rgba(34, 197, 94, 0.18) !important;
  color: #dcfce7 !important;
}

.crime-intel-tools {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 0 2px;
}

.crime-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.crime-summary-card {
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
}

.crime-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ui-subtle);
}

.crime-summary-value {
  font-size: 20px;
  font-weight: 700;
  color: #e0e7ff;
}

.crime-filter-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.crime-filter-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crime-filter-field select {
  width: 100%;
  min-height: 140px;
}

.crime-timeline-card {
  min-height: 160px;
}

.crime-timeline-slider input[type="range"] {
  width: 100%;
}

.crime-timeline-label {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ui-text-muted);
}

.crime-window-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.crime-window-pill {
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 999px;
  background: transparent;
  color: #c7d2fe;
  font-size: 10px;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.crime-window-pill.active,
.crime-window-pill:hover {
  border-color: rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.15);
}

.crime-filter-columns select {
  width: 100%;
  min-height: 120px;
}

.crime-filter-status {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ui-text);
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.35);
  padding: 8px 10px;
}

.crime-inspector {
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 12px;
  background: rgba(8, 47, 73, 0.35);
  padding: 14px;
}

.crime-inspector-empty {
  font-size: 12px;
  color: var(--ui-text-muted);
}

.crime-inspector-body.hidden {
  display: none;
}

.crime-inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.crime-inspector-title {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.crime-inspector-subtitle {
  font-size: 11px;
  color: var(--ui-text-muted);
}

.crime-inspector-range {
  margin: 8px 0;
  font-size: 11px;
  color: var(--ui-subtle);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.crime-inspector-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.crime-inspector-stat {
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(15, 118, 110, 0.2);
}

.crime-inspector-value {
  font-size: 18px;
  font-weight: 700;
  display: block;
  color: #99f6e4;
}

.crime-inspector-label {
  font-size: 11px;
  color: var(--ui-subtle);
}

.crime-inspector-timeline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 50px;
  margin-bottom: 12px;
}

.crime-inspector-timeline-bar {
  flex: 1;
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.85), rgba(56, 189, 248, 0.15));
  border-radius: 4px 4px 0 0;
  position: relative;
}

.crime-inspector-timeline-bar span {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--ui-subtle);
  white-space: nowrap;
}

.crime-incident-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.crime-incident-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crime-incident-card {
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 10px;
  padding: 10px;
  background: rgba(30, 64, 175, 0.2);
}

.crime-incident-type {
  font-size: 13px;
  font-weight: 600;
  color: #bfdbfe;
}

.crime-incident-meta {
  font-size: 11px;
  color: var(--ui-subtle);
  display: flex;
  gap: 8px;
  margin: 4px 0;
}

.crime-incident-location {
  font-size: 12px;
  color: #e2e8f0;
}

.crime-incident-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.crime-popup-timeline {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(6, minmax(6px, 1fr));
  gap: 2px;
}

.crime-popup-timeline-bar {
  height: 22px;
  background: rgba(248, 113, 113, 0.5);
  border-radius: 2px;
}

.crime-popup-timeline-bar.stop {
  background: rgba(14, 165, 233, 0.5);
}

@media (max-width: 520px) {
  .layer-search-input {
    flex-direction: column;
    align-items: stretch;
  }

  .layer-status-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}


/* =======================================================
   Status Bar
   ======================================================= */

#status-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: linear-gradient(180deg, rgba(6, 12, 20, 0.9), rgba(6, 12, 20, 0.95));
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(45, 212, 191, 0.08);
  padding: 4px 14px;
  font-size: 10px; color: var(--ui-subtle);
  pointer-events: none;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 26px;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ui-ok);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
  animation: statusPulse 3s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-center {
  flex-shrink: 0;
}

.status-session-chip {
  font-size: 9px;
  font-weight: 600;
  color: #4b6478;
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}

.layer-row-disabled,
.layer-row.disabled {
  opacity: 0.55;
}

#status-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-health-mini {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow: hidden;
  flex-wrap: nowrap;
}

.status-health-chip {
  font-size: 9px;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(148,163,184,0.25);
  background: rgba(15,23,42,0.45);
  color: var(--ui-text);
  white-space: nowrap;
}

#people-ops-block {
  margin-top: 10px;
}

/* Search source category switcher - 8 i2-schema entity-type tabs */
.ops-source-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin: 6px 0 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ui-border-subtle);
  border-radius: var(--ui-radius-sm);
  padding: 3px;
}

.ops-source-tab {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-subtle);
  border-radius: 4px;
  padding: 5px 3px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: var(--transition-fast);
  min-width: 0;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: Bahnschrift, "Lato", "Segoe UI", sans-serif;
}

.ops-source-tab:hover {
  background: var(--ui-card-bg);
  border-color: var(--ui-border);
  color: var(--ui-text);
}
.ops-source-tab:active { transform: scale(0.96); }

.ops-source-tab.active {
  border-color: var(--ui-accent-border);
  background: rgba(14, 165, 233, 0.12);
  color: var(--ui-accent);
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.08);
}

/* Icon inside each source tab */
.ops-tab-code { display: none; }
.ops-tab-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  margin-bottom: 2px;
}

.ops-tab-icon.ops-tab-icon-svg {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  font-size: 0;
}

.ops-tab-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1;
}

/* Tab accent bar */
.ops-source-tab.active::after {
  content: "";
  display: block;
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--ui-accent);
  border-radius: 1px;
  opacity: 0.7;
}

.ops-source-pane {
  display: none;
}

.ops-source-pane.active {
  display: block;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  animation: paneFadeIn 0.15s ease-out;
}

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

/* Intel pane bucket + source bars - adapt to left panel width */
#intel-bucket-bar.us-bucket-bar {
  background: transparent !important;
  border-bottom: 1px solid #0f1f38 !important;
  padding: 4px 0 6px !important;
  margin-bottom: 0 !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
}
#intel-source-bar.us-source-bar {
  background: transparent !important;
  border-bottom: 1px solid #0f1f38 !important;
  padding: 4px 0 6px !important;
  flex-wrap: wrap !important;
}
/* Compact bucket chips for narrow left panel */
#intel-bucket-bar .us-bucket-chip {
  min-width: 46px !important;
  padding: 5px 7px !important;
}
#intel-bucket-bar .us-bucket-icon { font-size: 13px !important; }
#intel-bucket-bar .us-bucket-label { font-size: 8px !important; }

/* =======================================================
   Leaflet Overrides
   ======================================================= */

/* Popups */
.leaflet-popup-content-wrapper {
  background: var(--ui-popup-bg) !important; color: #e2e8f0 !important;
  border-radius: var(--ui-radius) !important; border: 1px solid var(--ui-popup-border) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.03) inset !important;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif !important; font-size: 12px !important;
  max-width: 340px !important;
  backdrop-filter: blur(20px) !important;
}
.lords-popup-wrapper .leaflet-popup-content-wrapper { max-width: 700px !important; }
.lords-popup-wrapper .leaflet-popup-content { margin: 8px 10px !important; line-height: 1.4 !important; }
.leaflet-popup-tip { background: var(--ui-popup-bg) !important; }
.leaflet-popup-content { margin: 12px 16px !important; line-height: 1.7 !important; }
.leaflet-popup-content strong { color: var(--ui-text-bright); font-size: 14px; display: block; margin-bottom: 4px; }
.leaflet-popup-content .popup-label {
  color: var(--ui-subtle); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.25;
}

.leaflet-popup-content .popup-label .cr-mono-icon {
  display: inline-flex;
  width: 10px;
  height: 10px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.popup-flag-icon {
  width: 16px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25) inset;
  flex-shrink: 0;
}
.leaflet-popup-content .popup-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  background: rgba(99,102,241,0.15); color: var(--ui-secondary);
}

.conn-detail-wrap { margin-top: 4px; max-width: 340px; word-wrap: break-word; }

.entity-hover-tooltip {
  background: var(--ui-popup-bg);
  border: 1px solid var(--ui-accent-border);
  border-radius: 8px;
  color: var(--ui-text);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.entity-hover-tooltip .leaflet-tooltip-content {
  margin: 6px 8px;
}

.entity-hover-card {
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
}
/* Popup button row - wrap horizontally */
.leaflet-popup-content .popup-btn-row {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px;
}

/* Popup close button */
.leaflet-popup-close-button {
  color: var(--ui-subtle) !important;
  font-size: 20px !important;
  padding: 6px 8px 0 0 !important;
  transition: color 0.15s !important;
}
.leaflet-popup-close-button:hover {
  color: #f87171 !important;
}

/* Zoom */
.leaflet-control-zoom {
  border: 1px solid var(--ui-border) !important;
  border-radius: 8px !important; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}
.leaflet-control-zoom a {
  background: var(--ui-popup-bg) !important; color: var(--ui-subtle) !important;
  border-color: rgba(255,255,255,0.08) !important;
  width: 34px !important; height: 34px !important; line-height: 34px !important; font-size: 16px !important;
  transition: all 0.15s !important;
}
.leaflet-control-zoom a:hover { background: rgba(99,102,241,0.15) !important; color: #e2e8f0 !important; }

/* Attribution */
.leaflet-control-attribution {
  background: rgba(10,12,18,0.7) !important; color: #475569 !important; font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--ui-text-muted) !important; }

/* Hide default layer control (we have our own) */
.leaflet-control-layers { display: none !important; }

/* == Marker cluster == */
.marker-cluster-small { background-color: rgba(129,140,248,0.35) !important; box-shadow: 0 0 12px rgba(129,140,248,0.4) !important; }
.marker-cluster-small div { background-color: rgba(129,140,248,0.8) !important; color: #fff !important; font-weight: 700; font-size: 12px; }
.marker-cluster-medium { background-color: rgba(168,85,247,0.35) !important; box-shadow: 0 0 14px rgba(168,85,247,0.4) !important; }
.marker-cluster-medium div { background-color: rgba(168,85,247,0.8) !important; color: #fff !important; font-weight: 700; font-size: 12px; }
.marker-cluster-large { background-color: rgba(244,63,94,0.35) !important; box-shadow: 0 0 16px rgba(244,63,94,0.4) !important; }
.marker-cluster-large div { background-color: rgba(244,63,94,0.8) !important; color: #fff !important; font-weight: 700; font-size: 13px; }

/* =======================================================
   API SEARCH (NEW)
   ======================================================= */

.api-search-divider {
  text-align: center;
  margin: 18px 0 14px;
  color: var(--ui-text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  position: relative;
}

.api-search-divider::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--ui-accent-soft);
  z-index: -1;
}

.api-search-divider span {
  background: rgba(10, 12, 18, 0.94);
  padding: 0 8px;
}

/* Autocomplete wrapper */
.autocomplete-wrapper {
  position: relative;
}

/* Suggestions dropdown */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: rgba(15, 17, 25, 0.98);
  border: 1px solid var(--ui-accent-border);
  border-radius: 7px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(99,102,241,0.05) inset;
  backdrop-filter: blur(16px);
  display: none;
}

.suggestions-dropdown.active {
  display: block;
}

.suggestions-dropdown::-webkit-scrollbar {
  width: 4px;
}

.suggestions-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.suggestions-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.suggestion-item {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  transition: all 0.15s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: var(--ui-accent-soft);
}

.suggestion-title {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.3;
  margin-bottom: 3px;
}

.suggestion-detail {
  font-size: 10px;
  color: var(--ui-subtle);
  line-height: 1.3;
}

/* Selected company card */
.ch-selected-card {
  margin-top: 10px;
  padding: 12px;
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.15);
  border-radius: 7px;
}

.ch-selected-name {
  font-size: 13px;
  font-weight: 700;
  color: #4ade80;
  margin-bottom: 6px;
  line-height: 1.3;
}

.ch-selected-detail {
  font-size: 11px;
  color: var(--ui-text);
  line-height: 1.5;
  margin-bottom: 4px;
}

.ch-selected-detail:last-of-type {
  margin-bottom: 8px;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 10px !important;
}

.ch-error {
  text-align: center;
  padding: 14px;
  color: #fca5a5;
  font-size: 11px;
  font-weight: 500;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: 7px;
  margin-top: 10px;
}

/* Officer card expansion */
.officer-card {
  cursor: pointer;
}

.expand-icon {
  float: right;
  color: var(--ui-secondary);
  font-size: 10px;
  transition: transform 0.2s;
}

.officer-companies {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.officer-loading {
  text-align: center;
  padding: 8px;
  color: var(--ui-subtle);
  font-size: 10px;
}

.officer-no-companies {
  text-align: center;
  padding: 8px;
  color: var(--ui-text-muted);
  font-size: 10px;
  font-style: italic;
}

.officer-company-item {
  background: var(--ui-accent-soft);
  border: 1px solid rgba(99,102,241,0.08);
  border-radius: 6px;
  padding: 8px;
  margin: 4px 0;
  transition: all 0.15s;
}

.officer-company-item:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(99,102,241,0.15);
}

.officer-company-name {
  font-size: 11px;
  font-weight: 600;
  color: #c4b5fd;
  margin-bottom: 3px;
  line-height: 1.3;
}

.officer-company-detail {
  font-size: 9px;
  color: var(--ui-subtle);
  margin-bottom: 6px;
  line-height: 1.3;
}

.btn-add-company {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 9px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
  width: 100%;
  margin-top: 4px;
}

.btn-add-company:hover {
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
  transform: translateY(-1px);
}

.btn-add-company:active {
  transform: translateY(0);
}

/* =======================================================
   ENTITY SYSTEM STYLES
   ======================================================= */

/* Entity Tab */
.entity-help {
  background: var(--ui-accent-soft);
  border: 1px solid var(--ui-accent-border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.entity-help strong {
  color: var(--ui-secondary);
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.entity-help p {
  color: var(--ui-subtle);
  font-size: 11px;
  margin: 0;
  line-height: 1.5;
}

.entity-import-panel {
  margin: 10px 0 12px;
  padding: 10px;
  border-radius: 7px;
  border: 1px solid rgba(34,211,238,0.2);
  background: rgba(8,145,178,0.08);
}

.entity-import-panel.dragover {
  border-color: rgba(34, 211, 238, 0.75);
  background: rgba(8, 145, 178, 0.16);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.28);
}

.entity-import-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ui-accent);
  margin-bottom: 8px;
}

#entity-import-file {
  width: 100%;
  font-size: 11px;
  color: var(--ui-text);
  margin-bottom: 8px;
}

.entity-import-summary {
  margin-top: 8px;
  font-size: 10px;
  color: var(--ui-subtle);
  line-height: 1.45;
}

#entity-select-box[aria-pressed="true"] {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.38);
  color: #86efac;
}

.entity-selected-marker {
  filter: drop-shadow(0 0 7px rgba(34, 197, 94, 0.8)) drop-shadow(0 0 14px rgba(34, 197, 94, 0.45));
  transform: scale(1.06);
}

/* Entity Grid */
.entity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.entity-category {
  width: 100%;
}

.entity-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  width: 100%;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border-subtle);
  border-radius: 6px;
  color: var(--ui-text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.entity-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.entity-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.entity-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.entity-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-count {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ui-secondary);
  min-width: 22px;
  text-align: center;
}

/* Entity Stats */
.entity-stats {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--ui-card-bg);
  border-radius: 6px;
  margin-bottom: 10px;
}

.entity-stat-item {
  flex: 1;
  text-align: center;
}

.entity-stat-label {
  display: block;
  font-size: 10px;
  color: var(--ui-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.entity-stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--ui-secondary);
}

/* Connection Labels on Map */
.connection-label {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

.connection-label-text {
  background: var(--ui-popup-bg);
  border: 1px solid rgba(167, 139, 250, 0.5);
  border-radius: 5px;
  padding: 5px 10px;
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  text-align: center;
  letter-spacing: 0.3px;
  pointer-events: none;
}

/* Cluster Expansion Styles */
.marker-cluster {
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.marker-cluster:hover {
  transform: scale(1.15);
  filter: brightness(1.2);
}

.marker-cluster-small div {
  background-color: rgba(129, 140, 248, 0.8);
}

.marker-cluster-medium div {
  background-color: rgba(129, 140, 248, 0.85);
}

.marker-cluster-large div {
  background-color: rgba(129, 140, 248, 0.9);
}

.entity-cluster-icon .entity-cluster-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  padding-top: 2px;
}

.entity-cluster-icon .entity-cluster-count {
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
}

.entity-cluster-icon .entity-cluster-title {
  margin-top: 1px;
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9px;
  color: #dbeafe;
}

.entity-cluster-icon .entity-cluster-subtitle {
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 8px;
  color: #bfdbfe;
  opacity: 0.95;
}

/* Map Crosshair Cursor */
.leaflet-container.leaflet-crosshair {
  cursor: crosshair !important;
}

/* =======================================================
   Entity Placement Panel
   ======================================================= */

.entity-panel {
  position: absolute;
  top: 12px;
  right: -350px;
  z-index: 1001;
  width: 340px;
  background: var(--ui-popup-bg);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  color: var(--ui-text);
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04) inset;
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.entity-panel.open {
  right: 12px;
}

.entity-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ui-border-subtle);
  flex-shrink: 0;
}
.entity-panel-header.panel-draggable-handle {
  cursor: move;
  user-select: none;
}

.panel-dragging {
  opacity: 0.98;
}

.entity-panel-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #818cf8, #a78bfa, #818cf8);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 4s ease infinite;
}

.entity-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.entity-panel-min-btn,
.entity-panel-close-btn {
  width: 28px;
  height: 28px;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border-subtle);
  border-radius: 6px;
  color: var(--ui-subtle);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s;
}

.entity-panel-min-btn:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.35);
  color: #c4b5fd;
}

.entity-panel-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.entity-panel-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.entity-panel-body::-webkit-scrollbar {
  width: 4px;
}

.entity-panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.entity-panel-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
}

.entity-panel.minimized {
  width: 240px;
  max-height: none;
}

.entity-panel.minimized .entity-panel-body {
  display: none;
}

#entity-placement-form label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ui-subtle);
  margin-top: 12px;
  margin-bottom: 4px;
}

#entity-placement-form label:first-of-type {
  margin-top: 0;
}

#entity-placement-form input[type="text"],
#entity-placement-form input[type="date"],
#entity-placement-form input[type="datetime-local"],
#entity-placement-form input[type="number"],
#entity-placement-form select,
#entity-placement-form textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--ui-card-bg);
  border: 1px solid var(--ui-border-subtle);
  border-radius: 7px;
  color: #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#entity-placement-form textarea {
  resize: vertical;
  min-height: 60px;
}

#entity-placement-form input[type="text"]:focus,
#entity-placement-form input[type="date"]:focus,
#entity-placement-form input[type="datetime-local"]:focus,
#entity-placement-form input[type="number"]:focus,
#entity-placement-form select:focus,
#entity-placement-form textarea:focus {
  border-color: rgba(129, 140, 248, 0.4);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

#entity-placement-form input::placeholder,
#entity-placement-form textarea::placeholder {
  color: #475569;
}

#entity-placement-form select option {
  background: #1e293b;
  color: #e2e8f0;
}

.entity-icon-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.45);
}

.entity-icon-preview img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 28px;
  border-radius: 4px;
}
/* SVG previews inverted; PNG previews shown in natural colour */
.entity-icon-preview img.svg-preview {
  filter: brightness(0) invert(0.9);
}

.entity-icon-preview span {
  font-size: 11px;
  color: var(--ui-text);
  line-height: 1.35;
}

/* == Entity type pills (replaces Category + i2 Type dropdowns) == */
.entity-type-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.entity-type-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
  font-size: 9.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.entity-type-btn:hover {
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.4);
}
.entity-type-btn.active {
  border-color: rgba(99, 102, 241, 0.65);
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
}
.entity-type-btn .type-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* == Icon trigger button (opens flyout) == */
.entity-icon-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 7px;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.entity-icon-trigger:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
}
.entity-icon-trigger.has-icon {
  border-color: rgba(34, 211, 238, 0.35);
}
.entity-icon-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  border-radius: 5px;
  border: 1px solid rgba(148,163,184,0.15);
}
.entity-icon-preview-wrap img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.entity-icon-preview-wrap img.svg-preview {
  filter: brightness(0) invert(0.85);
}
.entity-icon-preview-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-trigger-chevron {
  flex-shrink: 0;
  opacity: 0.4;
  transition: transform 0.15s;
}
.entity-icon-trigger[aria-expanded="true"] .icon-trigger-chevron {
  transform: rotate(180deg);
}

/* == Icon picker flyout panel == */
.entity-icon-flyout {
  position: fixed;
  width: 228px;
  max-height: 340px;
  background: rgba(8, 16, 32, 0.97);
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.03) inset;
  backdrop-filter: blur(18px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.entity-icon-flyout.open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.icon-flyout-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 7px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  flex-shrink: 0;
}
.icon-flyout-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #64748b;
  text-transform: uppercase;
  flex-shrink: 0;
}
.icon-flyout-search {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 5px;
  color: #cbd5e1;
  font-size: 11px;
  padding: 3px 7px;
  outline: none;
  font-family: inherit;
}
.icon-flyout-search:focus {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.06);
}
.icon-flyout-close {
  background: none;
  border: none;
  color: #475569;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.icon-flyout-close:hover { color: #94a3b8; }

/* == Icon grid (inside flyout) == */
.entity-icon-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  padding: 6px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

.entity-icon-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid rgba(125, 211, 252, 0.32);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(9, 20, 40, 0.92), rgba(6, 16, 34, 0.96));
  cursor: pointer;
  padding: 0;
}

.entity-icon-pick .entity-icon-pick-mono .cr-mono-icon {
  color: #bfe8ff;
  filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.35));
}

.entity-icon-pick:hover .entity-icon-pick-mono .cr-mono-icon,
.entity-icon-pick.active .entity-icon-pick-mono .cr-mono-icon {
  color: #ecf8ff;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.55));
}

.entity-icon-pick img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  transition: filter 0.15s, opacity 0.15s;
  pointer-events: none;
}

/* SVG icons (black stroke) - invert to light on dark background */
.entity-icon-pick.svg-icon img {
  filter: brightness(0) invert(0.72);
}
.entity-icon-pick.svg-icon:hover img,
.entity-icon-pick.svg-icon.active img {
  filter: brightness(0) invert(1);
}

/* PNG icons (already coloured) - just dim slightly, full colour on hover */
.entity-icon-pick.png-icon img {
  opacity: 0.8;
}
.entity-icon-pick.png-icon:hover img,
.entity-icon-pick.png-icon.active img {
  opacity: 1;
}

.entity-icon-pick.active {
  border-color: rgba(34, 211, 238, 0.85);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45), 0 0 12px rgba(34, 211, 238, 0.32);
}

.entity-i2-fields {
  margin-top: 10px;
  border: 1px solid var(--ui-accent-border);
  border-radius: 8px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.5);
}

.entity-i2-fields-empty {
  font-size: 12px;
  color: var(--ui-subtle);
}

.entity-i2-fields-title {
  font-size: 11px;
  color: var(--ui-text);
  margin-bottom: 6px;
}

.entity-i2-field-row {
  margin-top: 8px;
}

.entity-i2-field-row:first-child {
  margin-top: 0;
}

.entity-i2-advanced {
  margin-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  padding-top: 8px;
}

.entity-i2-advanced summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--ui-subtle);
  user-select: none;
}

.entity-panel-actions-top {
  position: sticky;
  top: 0;
  z-index: 3;
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 8px 0;
  background: linear-gradient(180deg, rgba(11,16,27,0.95) 0%, rgba(11,16,27,0.72) 100%);
  border-top: 1px solid rgba(148,163,184,0.18);
  border-bottom: 1px solid rgba(148,163,184,0.18);
}

.entity-i2-field-row label {
  margin-top: 0 !important;
}

.entity-i2-meta {
  font-size: 10px;
  color: var(--ui-text-muted);
  margin-top: 2px;
}

.entity-panel-coords {
  margin-top: 12px;
  padding: 8px 10px;
  background: var(--ui-accent-soft);
  border-left: 3px solid #818cf8;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.entity-panel-coords .popup-label {
  color: var(--ui-subtle);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.entity-panel-coords #entity-coords {
  color: #e2e8f0;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
}

/* =======================================================
   Connection Highlighting & Pulse Effects
   ======================================================= */

/* Pulse animation for highlighted connections */
@keyframes pulse-grow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

.pulse-circle {
  animation: pulse-grow 2s ease-in-out infinite;
}

/* =======================================================
   TfL Line Routes
   ======================================================= */

.tfl-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
  transition: opacity 0.2s, filter 0.2s, stroke-width 0.2s;
}

.tfl-line:hover {
  opacity: 1 !important;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.92));
}

.tfl-line.tfl-status-good {
  filter: drop-shadow(0 0 4px rgba(34,197,94,0.7)) drop-shadow(0 0 9px rgba(34,197,94,0.35));
  animation: tflGlowGood 2.8s ease-in-out infinite;
}

.tfl-line.tfl-status-warning {
  filter: drop-shadow(0 0 4px rgba(245,158,11,0.72)) drop-shadow(0 0 9px rgba(245,158,11,0.34));
}

.tfl-line.tfl-status-bad {
  filter: drop-shadow(0 0 4px rgba(239,68,68,0.78)) drop-shadow(0 0 9px rgba(239,68,68,0.4));
  animation: tflGlowBad 1.4s ease-in-out infinite;
}

.tfl-line.tfl-line-selected {
  filter: drop-shadow(0 0 5px var(--tfl-glow, rgba(255,255,255,0.8))) drop-shadow(0 0 14px var(--tfl-glow, rgba(255,255,255,0.55)));
}

.tfl-line.tfl-line-dimmed {
  filter: none;
  animation: none;
}

@keyframes tflGlowGood {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(34,197,94,0.5)) drop-shadow(0 0 7px rgba(34,197,94,0.28)); }
  50% { filter: drop-shadow(0 0 6px rgba(34,197,94,0.86)) drop-shadow(0 0 12px rgba(34,197,94,0.52)); }
}

@keyframes tflGlowBad {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(239,68,68,0.55)) drop-shadow(0 0 8px rgba(239,68,68,0.28)); }
  50% { filter: drop-shadow(0 0 8px rgba(239,68,68,0.96)) drop-shadow(0 0 16px rgba(239,68,68,0.6)); }
}

/* =======================================================
   TfL Roundel Icons
   ======================================================= */

.tfl-roundel-icon {
  cursor: pointer;
  transition: transform 0.15s ease-out, filter 0.15s ease-out;
}

.tfl-roundel-icon:hover {
  transform: scale(1.4);
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.95)) 
          drop-shadow(0 0 16px rgba(255,255,255,0.7));
  z-index: 1000 !important;
}

/* Prevent blur on roundel images */
.tfl-roundel-icon img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* =======================================================
   Circle Marker Glow Effects (dark map)
   ======================================================= */

.company-circle-marker {
  filter: drop-shadow(0 0 4px rgba(167,139,250,0.5));
}
.company-api-circle-marker {
  filter: drop-shadow(0 0 4px rgba(74,222,128,0.5));
}
.person-circle-marker {
  filter: drop-shadow(0 0 4px rgba(251,191,36,0.5));
}

/* =======================================================
   Leaflet Scale Control (dark theme)
   ======================================================= */

.leaflet-control-scale-line {
  background: rgba(10, 12, 18, 0.8) !important;
  color: var(--ui-subtle) !important;
  border-color: rgba(99,102,241,0.3) !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
}

/* =======================================================
   Empty / No Results States
   ======================================================= */

.ch-empty-state,
.psc-empty-state,
.results-empty-state {
  text-align: center;
  padding: 20px 10px;
  color: var(--ui-text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.ch-empty-state::before,
.psc-empty-state::before,
.results-empty-state::before {
  content: "";
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 8px;
  border: 2px dashed rgba(99,102,241,0.2);
  border-radius: 50%;
}

/* =======================================================
   TfL Line Status Grid
   ======================================================= */

.tfl-status-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.tfl-status-loading {
  font-size: 10px;
  color: var(--ui-text-muted);
  padding: 8px 0;
  text-align: center;
}

.tfl-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.tfl-status-row:hover {
  background: var(--ui-card-bg);
  border-color: rgba(34,211,238,0.18);
}

.tfl-status-row.active {
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.35);
}

.tfl-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tfl-status-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--ui-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tfl-status-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tfl-badge-good {
  background: rgba(34,197,94,0.12);
  color: #4ade80;
}
.tfl-badge-minor {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
}
.tfl-badge-severe {
  background: rgba(239,68,68,0.15);
  color: #f87171;
}
.tfl-badge-closed {
  background: rgba(239,68,68,0.2);
  color: #fca5a5;
}
.tfl-badge-info {
  background: var(--ui-accent-soft);
  color: var(--ui-secondary);
}

.tfl-status-time {
  font-size: 8px;
  font-weight: 500;
  color: var(--ui-text-muted);
  letter-spacing: 0;
  text-transform: none;
  margin-left: 8px;
  float: right;
}

/* TfL line status rows are interactive selectors */
.tfl-status-row[role="button"] {
  cursor: pointer;
}

.tfl-selected-line {
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid rgba(99,102,241,0.22);
  border-radius: 6px;
  background: var(--ui-accent-soft);
  color: var(--ui-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.25px;
}

/* =======================================================
   TfL Live Arrivals (popup enhancement)
   ======================================================= */

.tfl-arrivals {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 6px;
}

.tfl-arrivals-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--ui-subtle);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.tfl-arrival-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
}

.tfl-arrival-line {
  width: 4px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tfl-arrival-dest {
  color: #e2e8f0;
  flex: 1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tfl-arrival-time {
  color: #4ade80;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.tfl-arrivals-loading {
  font-size: 10px;
  color: var(--ui-text-muted);
  padding: 6px 0;
  text-align: center;
}

.tfl-arrivals-empty {
  font-size: 10px;
  color: #475569;
  padding: 4px 0;
  font-style: italic;
}

/* TfL StopPoint tools */
.tfl-stop-tools {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--ui-accent-border);
  background: rgba(15,23,42,0.28);
}

.tfl-stop-tools label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ui-subtle);
  margin-bottom: 5px;
}

.tfl-stop-tools input,
.tfl-stop-tools select {
  margin-bottom: 8px;
  font-size: 11px;
}

.tfl-stop-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

#tfl-stop-nearby-btn {
  grid-column: 1 / span 1;
}

#tfl-stop-clear-btn {
  grid-column: 2 / span 1;
}

.tfl-stop-results {
  max-height: 220px;
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 6px;
}

.tfl-stop-results-empty {
  font-size: 10px;
  color: var(--ui-text-muted);
  padding: 6px 2px;
}

.tfl-stop-item {
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 6px;
  background: var(--ui-card-bg);
}

.tfl-stop-item:hover {
  border-color: rgba(34,211,238,0.35);
  background: rgba(34,211,238,0.06);
}

.tfl-stop-item-name {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.35;
}

.tfl-stop-item-meta {
  font-size: 10px;
  color: var(--ui-subtle);
  margin-top: 3px;
  line-height: 1.35;
}

.tfl-stop-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.tfl-stop-item-actions .btn-secondary.btn-sm {
  flex: 1;
}

.nr-tools {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(56,189,248,0.24);
  background: rgba(15,23,42,0.28);
}

.nr-tools label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ui-subtle);
  margin-bottom: 5px;
}

.nr-tools input {
  margin-bottom: 8px;
  font-size: 11px;
}

.nr-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.nr-results {
  max-height: 220px;
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 6px;
}

/* Most Wanted panel: roomier layout with compact non-box status text */
#mostwanted-block .roads-row {
  gap: 8px;
  align-items: center;
}

#sanvessel-block .roads-row {
  gap: 8px;
  align-items: center;
}

#warrants-block .roads-row {
  gap: 8px;
  align-items: center;
}

#mostwanted-block #mostwanted-name {
  min-height: 38px;
  font-size: 13px;
}

#warrants-block #warrants-name {
  min-height: 38px;
  font-size: 13px;
}

#sanvessel-block #sanvessel-name {
  min-height: 38px;
  font-size: 13px;
}

#mostwanted-block .btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}

#warrants-block .btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}

.warrants-datasets-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 12px 4px;
}

.warrants-dataset-list {
  max-height: none;
  min-height: 130px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px 8px;
  display: block;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(5, 13, 28, 0.35);
  overscroll-behavior: contain;
}

.warrants-dataset-group {
  margin-bottom: 10px;
}

.warrants-dataset-group:last-child {
  margin-bottom: 2px;
}

.warrants-dataset-cluster {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: rgba(8, 20, 38, 0.46);
  margin-bottom: 8px;
  overflow: hidden;
}

.warrants-dataset-cluster > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 700;
  color: #d7e6fb;
  background: rgba(30, 41, 59, 0.45);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.warrants-dataset-cluster > summary::-webkit-details-marker {
  display: none;
}

.warrants-dataset-cluster-count {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #9fb5cc;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.55);
}

.warrants-dataset-cluster-items {
  padding: 6px 6px 4px;
}

.warrants-dataset-heading {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9fb5cc;
  margin: 6px 2px 7px;
  font-weight: 700;
}

.warrants-dataset-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--ui-text-bright);
  padding: 7px 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.42);
  margin-bottom: 6px;
  cursor: pointer;
}

.warrants-dataset-item:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(30, 41, 59, 0.55);
}

.warrants-dataset-item.uk {
  border-left: 3px solid rgba(45, 212, 191, 0.65);
}

.warrants-dataset-item.global {
  border-left: 3px solid rgba(148, 163, 184, 0.45);
}

.warrants-dataset-item input[type="checkbox"] {
  margin: 2px 0 0;
  transform: scale(1.05);
}

.warrants-dataset-copy {
  min-width: 0;
}

.warrants-dataset-title {
  display: block;
  font-size: 12.5px;
  line-height: 1.25;
  color: #e2e8f0;
  white-space: normal;
  word-break: break-word;
}

.warrants-dataset-sub {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: #93a4b9;
}

.warrants-themes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 12px 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.warrants-theme-list {
  max-height: none;
  min-height: 130px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 8px 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  overscroll-behavior: contain;
}

.warrants-theme-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.38);
  cursor: pointer;
}

.warrants-theme-item:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(30, 41, 59, 0.55);
}

.warrants-theme-item input[type="checkbox"] {
  margin: 0;
}

.warrants-theme-title {
  font-size: 12px;
  color: #dbeafe;
  overflow-wrap: anywhere;
}

.warrants-theme-count {
  font-size: 10px;
  color: #9fb5cc;
}

#sanvessel-block .btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}

#sanvessel-highlight-btn {
  width: 100%;
}

#mostwanted-results {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: none;
  padding-top: 8px;
  padding-right: 4px;
}

#warrants-results {
  max-height: 320px;
  min-height: 96px;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 8px;
  padding-right: 4px;
}

.warrants-side-panel {
  position: fixed;
  top: 86px;
  right: 18px;
  width: min(500px, 38vw);
  max-height: calc(100vh - 150px);
  z-index: 2600;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 12px;
  background: rgba(4, 16, 34, 0.96);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(10px);
  display: grid;
  grid-template-rows: auto auto auto minmax(130px, 34vh) auto auto minmax(130px, 32vh);
  overflow: hidden;
}

.warrants-side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  color: #d5ecff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

#warrants-datasets-side-close {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  border-radius: 8px;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

#sanvessel-results {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  border-top: none;
  padding-top: 8px;
  padding-right: 4px;
}

#mostwanted-results .ch-result-item {
  padding: 11px 12px;
  margin: 5px 0;
}

#warrants-results .ch-result-item {
  padding: 11px 12px;
  margin: 5px 0;
}

#sanvessel-results .ch-result-item {
  padding: 11px 12px;
  margin: 5px 0;
}

#mostwanted-results .ch-r-name {
  font-size: 13px;
  line-height: 1.35;
}

#warrants-results .ch-r-name {
  font-size: 13px;
  line-height: 1.35;
}

#sanvessel-results .ch-r-name {
  font-size: 13px;
  line-height: 1.35;
}

#mostwanted-results .ch-r-detail {
  font-size: 11px;
  line-height: 1.4;
}

#warrants-results .ch-r-detail {
  font-size: 11px;
  line-height: 1.4;
}

#sanvessel-results .ch-r-detail {
  font-size: 11px;
  line-height: 1.4;
}

.mostwanted-status {
  margin: 6px 2px 8px;
  font-size: 11px;
  color: var(--ui-text-muted);
}

.mostwanted-status.inline {
  margin: 2px 2px 8px;
}

#warrants-block #warrants-datasets-summary,
#warrants-block #warrants-meta {
  display: block;
  line-height: 1.4;
  white-space: normal;
  word-break: break-word;
  margin-left: 2px;
  margin-right: 2px;
}

#warrants-block #warrants-meta {
  margin-bottom: 6px;
}

#warrants-block .nr-empty {
  line-height: 1.45;
}

#mostwanted-results::-webkit-scrollbar {
  width: 8px;
}

#warrants-results::-webkit-scrollbar {
  width: 8px;
}

#sanvessel-results::-webkit-scrollbar {
  width: 8px;
}

#mostwanted-results::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 6px;
}

#warrants-results::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 6px;
}

#sanvessel-results::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 6px;
}

#mostwanted-results::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.55);
  border-radius: 6px;
}

#warrants-results::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.55);
  border-radius: 6px;
}

#sanvessel-results::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.55);
  border-radius: 6px;
}

#mostwanted-results::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 212, 191, 0.75);
}

#warrants-results::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 212, 191, 0.75);
}

.mostwanted-side-panel {
  position: fixed;
  top: 86px;
  right: 18px;
  width: min(420px, 34vw);
  max-height: calc(100vh - 160px);
  z-index: 2600;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 12px;
  background: rgba(4, 16, 34, 0.94);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.mostwanted-side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  color: #d5ecff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

#mostwanted-side-close {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  border-radius: 8px;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

#mostwanted-side-close:hover {
  border-color: rgba(45, 212, 191, 0.55);
  color: #9ff9ea;
}

#mostwanted-side-meta {
  margin: 6px 10px 8px;
}

.mostwanted-side-results {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 10px 10px;
}

.mostwanted-side-results .ch-result-item {
  padding: 10px 12px;
  margin: 5px 0;
}

.mostwanted-side-results .ch-r-name {
  font-size: 13px;
  line-height: 1.35;
}

.mostwanted-side-results .ch-r-detail {
  font-size: 11px;
  line-height: 1.4;
}

/* UX polish pass: readability and click-target consistency */
body.ux-revamp #control-panel {
  font-size: 13px;
}

body.ux-revamp #control-panel input[type="text"],
body.ux-revamp #control-panel select {
  min-height: 36px;
  font-size: 13px;
}

body.ux-revamp .btn-primary,
body.ux-revamp .btn-secondary {
  min-height: 36px;
}

body.ux-revamp .ch-result-item {
  border-width: 1px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

body.ux-revamp .ch-result-item:hover {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.22);
}

body.ux-revamp .leaflet-popup-content {
  line-height: 1.55 !important;
}

body.ux-revamp .entity-hover-card {
  white-space: normal;
  max-width: 220px;
}

@media (max-width: 1180px) {
  .mostwanted-side-panel {
    width: min(420px, calc(100vw - 30px));
    right: 10px;
    top: 70px;
  }
  .warrants-side-panel {
    width: min(500px, calc(100vw - 30px));
    right: 10px;
    top: 70px;
    max-height: calc(100vh - 120px);
  }
}

#sanvessel-results::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 212, 191, 0.75);
}

.nr-empty {
  font-size: 10px;
  color: var(--ui-text-muted);
  padding: 6px 2px;
}

.nr-station-item {
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 7px;
  padding: 7px;
  margin-bottom: 6px;
  background: rgba(2,132,199,0.09);
}

.nr-station-item:hover {
  border-color: rgba(34,211,238,0.42);
  background: rgba(34,211,238,0.13);
}

.nr-station-item-name {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.nr-station-item-meta {
  font-size: 10px;
  color: #93c5fd;
  margin-top: 2px;
}

.nr-station-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.nr-station-item-actions .btn-secondary.btn-sm {
  flex: 1;
}

.nr-selected-line {
  margin: 4px 0 7px;
  padding: 5px 7px;
  border-radius: 6px;
  border: 1px solid rgba(56,189,248,0.28);
  background: rgba(2,132,199,0.16);
  font-size: 10px;
  color: #dbeafe;
}

.nr-major-line-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.nr-major-line-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
}

.nr-major-line-section {
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 8px;
  padding: 6px;
  background: rgba(15,23,42,0.22);
}

.nr-major-line-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #bfdbfe;
}

.nr-major-line-section-btns {
  display: flex;
  gap: 6px;
}

.nr-major-line-section-btns .btn-secondary.btn-sm {
  padding: 4px 7px;
  min-height: 0;
}

.nr-major-line-btn {
  border: 1px solid rgba(148,163,184,0.26);
  border-radius: 7px;
  background: rgba(15,23,42,0.45);
  color: #dbeafe;
  font-size: 10px;
  padding: 6px 7px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.nr-major-line-btn.disabled {
  opacity: 0.45;
}

.nr-major-line-btn:hover {
  border-color: rgba(56,189,248,0.5);
  background: rgba(2,132,199,0.22);
}

.nr-major-line-btn.active {
  border-color: rgba(224,242,254,0.9);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.32), 0 0 9px rgba(56,189,248,0.4);
}

.nr-major-line-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
  box-shadow: 0 0 6px rgba(255,255,255,0.45);
}

.airport-tools {
  margin-top: 6px;
  margin-bottom: 8px;
}

.airport-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}

.airport-results {
  max-height: 190px;
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 6px;
}

.airport-result-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 7px;
  margin-bottom: 6px;
  padding: 7px 8px;
  background: rgba(2,132,199,0.09);
  color: #dbeafe;
  cursor: pointer;
  display: block;
}

.airport-result-item:hover {
  border-color: rgba(34,211,238,0.45);
  background: rgba(34,211,238,0.13);
}

.airport-result-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.airport-result-meta {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: #93c5fd;
}

.nr-card {
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 7px;
  padding: 7px;
  margin-bottom: 7px;
  background: rgba(2,132,199,0.08);
}

.nr-card-title {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.nr-card-meta {
  font-size: 10px;
  color: var(--ui-subtle);
  margin-top: 2px;
}

.nr-service {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 7px;
  align-items: center;
  font-size: 10px;
  color: #dbeafe;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(148,163,184,0.16);
}

.nr-service:last-child {
  border-bottom: 0;
}

.nr-eta {
  min-width: 44px;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
  font-weight: 700;
  color: var(--ui-accent);
}

.nr-plat {
  min-width: 36px;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
  color: #93c5fd;
}

.nr-dest {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nr-alert {
  margin-top: 6px;
  font-size: 10px;
  color: #fca5a5;
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid rgba(239,68,68,0.24);
  background: rgba(127,29,29,0.22);
}

/* WebTRIS roads tools */
.roads-tools {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(249,115,22,0.24);
  background: rgba(15,23,42,0.28);
}

.roads-tools label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ui-subtle);
  margin-bottom: 5px;
}

.roads-tools input {
  margin-bottom: 8px;
  font-size: 11px;
}

.roads-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.roads-results {
  max-height: 240px;
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 6px;
}

.roads-result-item {
  border: 1px solid rgba(249,115,22,0.25);
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 6px;
  background: rgba(124,45,18,0.18);
}

.roads-result-title {
  font-size: 11px;
  font-weight: 700;
  color: #fed7aa;
}

.roads-result-meta {
  font-size: 10px;
  color: var(--ui-text);
  margin-top: 3px;
}

.dvla-card {
  background: var(--ui-card-bg);
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 8px;
  padding: 10px;
}

.dvla-title {
  color: #93c5fd;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}

.dvla-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 6px 0 8px;
}

.dvla-media-wrap {
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(2, 10, 18, 0.55);
  margin: 6px 0 10px;
}

.dvla-vehicle-image {
  width: 100%;
  height: 132px;
  object-fit: cover;
  display: block;
  background: rgba(15, 23, 42, 0.72);
}

.dvla-media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  background: rgba(7, 16, 23, 0.9);
  border-top: 1px solid rgba(56,189,248,0.18);
}

.dvla-media-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dvla-map-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(56,189,248,0.5));
}

.dvla-logo {
  max-width: 96px;
  max-height: 30px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(2, 10, 18, 0.7));
}

.dvla-media-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: #93c5fd;
  background: rgba(30,64,175,0.3);
  border: 1px solid rgba(59,130,246,0.35);
  border-radius: 999px;
  padding: 2px 7px;
}

.dvla-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 0;
  font-size: 11px;
}

.dvla-key {
  color: var(--ui-subtle);
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.dvla-val {
  color: #e2e8f0;
  text-align: right;
}

.vehicle-popup-media {
  margin: 7px 0 8px;
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(2, 10, 18, 0.52);
}

.vehicle-popup-image {
  width: 100%;
  max-width: 260px;
  height: 112px;
  object-fit: cover;
  display: block;
}

.vehicle-popup-media-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  background: rgba(7, 16, 23, 0.88);
  border-top: 1px solid rgba(56,189,248,0.16);
}

.vehicle-popup-media-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.vehicle-popup-map-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(56,189,248,0.48));
}

.vehicle-popup-logo {
  max-width: 88px;
  max-height: 20px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.vehicle-popup-media-tag {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.65px;
  color: #93c5fd;
  border: 1px solid rgba(56,189,248,0.28);
  border-radius: 999px;
  padding: 2px 6px;
}

.system-health-results {
  margin-top: 8px;
}

.system-health-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  border: 1px solid rgba(148,163,184,0.22);
  background: rgba(15,23,42,0.28);
  font-size: 11px;
}

.system-health-name {
  color: var(--ui-text);
}

.system-health-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 8px;
}

.system-health-ok {
  color: #22c55e;
  background: rgba(34,197,94,0.14);
  border: 1px solid rgba(34,197,94,0.3);
}

.system-health-warn {
  color: #f59e0b;
  background: rgba(245,158,11,0.14);
  border: 1px solid rgba(245,158,11,0.3);
}

.system-health-bad {
  color: #ef4444;
  background: rgba(239,68,68,0.14);
  border: 1px solid rgba(239,68,68,0.3);
}

.mobile-panel-toggle {
  display: none;
}

.cp-skeleton-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.cp-skeleton-row {
  height: 34px;
  border-radius: var(--ui-radius-sm);
  background: linear-gradient(90deg, rgba(45,212,191,0.04), rgba(45,212,191,0.1), rgba(45,212,191,0.04));
  background-size: 240px 100%;
  animation: skeletonShift 1.4s ease-in-out infinite;
}

@keyframes skeletonShift {
  from { background-position: -240px 0; }
  to { background-position: 240px 0; }
}

.hidden {
  display: none !important;
}

.toast-stack {
  position: absolute;
  right: 14px;
  bottom: 44px;
  z-index: 1300;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
  pointer-events: none;
}

.toast-msg {
  padding: 10px 14px;
  border-radius: 8px;
  color: #e2e8f0;
  background: var(--ui-popup-bg);
  border: 1px solid rgba(148,163,184,0.2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.02) inset;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-msg::before {
  content: "";
  width: 3px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
  background: #94a3b8;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-msg.toast-info {
  border-color: rgba(56,189,248,0.3);
}

.toast-msg.toast-info::before {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.toast-msg.toast-success {
  border-color: rgba(34,197,94,0.3);
}

.toast-msg.toast-success::before {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.toast-msg.toast-error {
  border-color: rgba(239,68,68,0.35);
}

.toast-msg.toast-error::before {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.toast-msg.toast-warn {
  border-color: rgba(234,179,8,0.35);
}
.toast-msg.toast-warn::before {
  background: #eab308;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.cp-menu-item:focus-visible {
  outline: 2px solid rgba(125,211,252,0.95);
  outline-offset: 2px;
}

.nr-service-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 7px rgba(56,189,248,0.42));
}

.nr-station-node {
  filter: drop-shadow(0 0 6px rgba(56,189,248,0.5));
}

.nr-station-logo-wrap {
  filter: drop-shadow(0 0 5px rgba(56,189,248,0.58));
}

.nr-station-logo {
  display: block;
  border-radius: 999px;
  border: 1px solid rgba(224,242,254,0.92);
  background: rgba(2,132,199,0.75);
  box-shadow: 0 0 0 1px rgba(2,132,199,0.58);
}

.nr-major-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(56,189,248,0.4)) drop-shadow(0 0 12px rgba(56,189,248,0.28));
}

.nr-major-line-selected {
  filter: drop-shadow(0 0 7px rgba(255,255,255,0.9)) drop-shadow(0 0 16px rgba(56,189,248,0.65));
}

.nr-major-line-dimmed {
  filter: none;
}

.nr-minor-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 3px rgba(100,116,139,0.32));
}

.nr-station-marker {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(191,219,254,0.95);
  background: #0ea5e9;
  box-shadow: 0 0 0 1px rgba(2,132,199,0.52), 0 0 8px rgba(56,189,248,0.52);
}

.os-road-static-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(251,146,60,0.45)) drop-shadow(0 0 10px rgba(249,115,22,0.26));
}

.os-road-line-interactive {
  cursor: pointer;
  transition: opacity 0.18s ease, stroke-width 0.18s ease, filter 0.18s ease;
}

.os-road-line-interactive:hover {
  opacity: 1 !important;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.88)) drop-shadow(0 0 12px rgba(251,146,60,0.42));
}

.os-road-line-selected {
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.9)) drop-shadow(0 0 14px rgba(251,146,60,0.7));
}

.os-road-line-dimmed {
  filter: none;
}

.os-road-static-connector {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 2 3;
  filter: drop-shadow(0 0 5px rgba(249,115,22,0.24));
}

.os-rail-static-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(56,189,248,0.62)) drop-shadow(0 0 13px rgba(56,189,248,0.44));
}

.os-rail-line-interactive {
  cursor: pointer;
  transition: opacity 0.18s ease, stroke-width 0.18s ease, filter 0.18s ease;
}

.os-rail-line-interactive:hover {
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.9)) drop-shadow(0 0 16px rgba(56,189,248,0.62));
}

.os-rail-line-selected {
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.92)) drop-shadow(0 0 16px rgba(56,189,248,0.74));
}

.os-rail-line-dimmed {
  filter: none;
}

.os-rail-static-connector {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 5px rgba(56,189,248,0.46));
}

.os-rail-static-node {
  filter: drop-shadow(0 0 4px rgba(56,189,248,0.35));
}

.rail-node-popup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.rail-node-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.service-station-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.45);
  font-size: 9px;
  font-weight: 700;
  color: #e2e8f0;
  background: #334155;
}

.service-station-fuel {
  background: #f97316;
}

.service-station-charging {
  background: #10b981;
}

.service-station-vehicle {
  background: #3b82f6;
}

.service-station-truck {
  background: #8b5cf6;
}

.service-filter-tools {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(250,204,21,0.28);
  background: rgba(15,23,42,0.28);
}

.os-rail-station-link {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(56,189,248,0.5));
}

/* =======================================================
   Santander Cycles Markers
   ======================================================= */

.bike-dock-marker {
  filter: drop-shadow(0 0 3px rgba(34,197,94,0.4));
}

/* =======================================================
   Live Flight Markers (FlightRadar24)
   ======================================================= */

.flight-marker {
  cursor: pointer;
  filter: drop-shadow(0 0 4px rgba(0,255,255,0.55));
}

.flight-icon {
  width: var(--flight-icon-size, 18px);
  height: var(--flight-icon-size, 18px);
  pointer-events: auto;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  box-shadow: 0 0 0 1px rgba(0,255,255,0.18), 0 0 10px rgba(0,255,255,0.12);
  filter: drop-shadow(0 0 5px rgba(0,255,255,0.55)) drop-shadow(0 0 12px rgba(0,255,0,0.10));
}

.flight-icon .flight-inner {
  width: var(--flight-icon-size, 18px);
  height: var(--flight-icon-size, 18px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flight-icon .flight-inner svg {
  width: calc(var(--flight-icon-size, 18px) - 2px);
  height: calc(var(--flight-icon-size, 18px) - 2px);
  display: block;
  fill: currentColor;
}

.flight-icon.flight-inbound { color: #22c55e; }
.flight-icon.flight-outbound { color: #e879f9; }
.flight-icon.flight-transit { color: var(--ui-accent); }
.flight-icon.flight-ground { color: #facc15; }

.flight-board {
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
  font-size: 12px;
  color: #f8fafc;
  letter-spacing: 0.15px;
  background: rgba(0,0,0,0.88);
  border: 1px solid rgba(0,255,0,0.35);
  border-radius: 10px;
  padding: 8px 10px 10px;
  min-width: 300px;
  box-shadow: 0 0 18px rgba(0,0,0,0.45);
}

.fb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fb-title-text {
  font-weight: 700;
  color: #e2e8f0;
}

.fb-status {
  font-size: 10px;
  color: var(--ui-accent);
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 999px;
  padding: 2px 8px;
  text-transform: uppercase;
}

.fb-subhead {
  margin-top: 5px;
  margin-bottom: 6px;
  font-size: 10px;
  color: #86efac;
}

.fb-route-logos {
  margin-top: 6px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.fb-airport-logo {
  width: auto;
  height: 18px;
  max-width: 72px;
  object-fit: contain;
  background: rgba(8, 16, 20, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.26);
  border-radius: 5px;
  padding: 2px 6px;
  filter: contrast(1.1) saturate(1.06);
}

.fb-airport-code {
  font-size: 10px;
  color: #93c5fd;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 5px;
  padding: 2px 6px;
}

.fb-route-arrow {
  color: var(--ui-accent);
  font-size: 12px;
  line-height: 1;
}

.fb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--ui-accent);
  margin: 2px 0 7px;
}

.fb-carrier {
  color: var(--ui-accent);
  border: 1px solid rgba(0, 255, 255, 0.28);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 9px;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-table {
  display: grid;
  gap: 4px;
}

.fb-row {
  display: grid;
  grid-template-columns: 102px 1fr;
  gap: 7px;
}

.fb-row-head {
  color: var(--ui-subtle);
  font-size: 10px;
  letter-spacing: 0.4px;
}

.fb-row-data {
  border-bottom: 1px dotted rgba(148,163,184,0.16);
  padding-bottom: 2px;
}

.flight-trail {
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(34,211,238,0.45));
}

#tab-entities .entity-help,
#tab-entities .entity-import-panel {
  display: none;
}

#tab-entities .entity-count {
  display: none;
}

.flight-info-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  width: 300px;
  background: linear-gradient(135deg, rgba(6,14,22,0.94), rgba(2,10,18,0.96));
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(34,211,238,0.12) inset;
  padding: 0 0 8px;
  overflow: hidden;
}

.flight-info-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(34,211,238,0.04),
    rgba(34,211,238,0.04) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
  opacity: 0.35;
}

.flight-info-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(34,211,238,0.25);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: var(--ui-accent);
  background: rgba(2,10,18,0.7);
}

.flight-info-header::after {
  content: "";
  margin-left: 4px;
  width: 18px;
  height: 18px;
  opacity: 0;
}

.flight-info-time {
  margin-left: auto;
  color: var(--ui-subtle);
  font-size: 9px;
  letter-spacing: 0;
  text-transform: none;
}

.flight-stats {
  position: relative;
  padding: 8px 10px 0;
  min-height: 110px;
}

.flight-radar-ring {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(34,211,238,0.35);
  box-shadow: 0 0 0 1px rgba(34,211,238,0.14) inset;
  overflow: hidden;
  background: radial-gradient(circle, rgba(34,211,238,0.16), rgba(2,10,18,0.04) 65%);
}

.flight-radar-ring::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(
    from 0deg,
    rgba(34,211,238,0.0) 0deg,
    rgba(34,211,238,0.0) 320deg,
    rgba(34,211,238,0.8) 345deg,
    rgba(34,211,238,0.0) 360deg
  );
  animation: radarSweep 2.8s linear infinite;
}

@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.flight-info-text {
  font-size: 10px;
  color: var(--ui-text-muted);
}

.flight-info-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-right: 86px;
}

.flight-stat {
  font-size: 10px;
  color: #cfe5f4;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(34,211,238,0.16);
  padding-bottom: 2px;
}

.flight-stat-value {
  color: var(--ui-accent);
  font-weight: 700;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
}

.flight-tracklist {
  margin-top: 7px;
  border-top: 1px solid rgba(34,211,238,0.2);
  padding-top: 6px;
  font-size: 10px;
  background: linear-gradient(180deg, rgba(2,10,18,0.25), rgba(2,10,18,0.55));
  border-radius: 6px;
  padding: 6px;
}

.flight-track-title {
  color: #7dd3fc;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.flight-track-item {
  display: flex;
  justify-content: space-between;
  color: var(--ui-text);
  line-height: 1.45;
  border-bottom: 1px dotted rgba(148,163,184,0.15);
}

.flight-refresh-btn {
  background: rgba(34,211,238,0.14);
  border: 1px solid rgba(34,211,238,0.28);
  color: var(--ui-accent);
  font-size: 9px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.flight-refresh-btn:hover {
  background: rgba(34,211,238,0.25);
  border-color: rgba(34,211,238,0.48);
}
.flight-refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.flight-intel-tools {
  margin: 8px 0 10px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(56,189,248,0.24);
  background: rgba(15,23,42,0.26);
}

.flight-intel-tools label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ui-subtle);
  margin-bottom: 4px;
}

.flight-intel-tools input {
  margin-bottom: 7px;
  font-size: 11px;
}

.flight-intel-tools .inline-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0.2px;
  color: var(--ui-text);
}

.flight-intel-tools .inline-checkbox input[type="checkbox"] {
  margin: 0;
}

.flight-intel-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.flight-intel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.flight-filter-results {
  margin-top: 6px;
  max-height: 140px;
  overflow: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 6px;
}

.flight-filter-item {
  font-size: 10px;
  color: #dbeafe;
  padding: 4px 0;
  border-bottom: 1px dotted rgba(148,163,184,0.16);
}

button.flight-filter-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(56,189,248,0.18);
  border-radius: 6px;
  margin-bottom: 6px;
  padding: 6px 7px;
  background: rgba(2,132,199,0.1);
  color: #dbeafe;
  cursor: pointer;
}

button.flight-filter-item:hover {
  border-color: rgba(34,211,238,0.4);
  background: rgba(34,211,238,0.14);
}

button.flight-filter-item span {
  color: #93c5fd;
  font-size: 9px;
  margin-left: 5px;
}

.airport-intel-popup {
  min-width: 260px;
  background: linear-gradient(180deg, rgba(2,10,18,0.78), rgba(2,10,18,0.92));
  border: 1px solid rgba(56,189,248,0.18);
  border-radius: 7px;
  padding: 8px;
}

.airport-logo-icon {
  filter: contrast(1.15) saturate(1.08) drop-shadow(0 1px 6px rgba(2, 10, 18, 0.9));
  background: rgba(5, 12, 18, 0.86);
  border: 1px solid rgba(56,189,248,0.35);
  border-radius: 7px;
  padding: 2px;
}

.airport-logo-popup-wrap {
  margin-bottom: 7px;
  display: flex;
  justify-content: center;
}

.airport-logo-popup {
  max-width: 180px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: linear-gradient(180deg, rgba(4,10,18,0.88), rgba(1,7,14,0.92));
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 7px;
  padding: 6px 10px;
  filter: contrast(1.16) saturate(1.06) drop-shadow(0 1px 5px rgba(2,10,18,0.9));
}

.flight-intel-meta {
  font-size: 11px;
  line-height: 1.45;
  color: #dbeafe;
}

.flight-detail-panel {
  position: absolute;
  top: 88px;
  right: 12px;
  z-index: 1600;
  width: 320px;
  max-width: calc(100vw - 24px);
  border-radius: 10px;
  border: 1px solid rgba(0,255,0,0.34);
  background: rgba(0,0,0,0.93);
  box-shadow: 0 12px 30px rgba(0,0,0,0.58), 0 0 0 1px rgba(0,255,255,0.08) inset;
  backdrop-filter: blur(8px);
}

.flight-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(0,255,255,0.22);
  font-size: 11px;
  font-weight: 700;
  color: #86efac;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.flight-detail-close {
  border: 1px solid rgba(148,163,184,0.34);
  background: rgba(15,23,42,0.35);
  color: #e2e8f0;
  border-radius: 5px;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.flight-detail-close:hover {
  border-color: rgba(0,255,255,0.5);
  color: var(--ui-accent);
}

.flight-detail-body {
  padding: 10px;
  font-family: Bahnschrift, "Bahnschrift SemiBold", "Lato", "Segoe UI", sans-serif;
}


/* I2 workspace panel */
.i2-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.i2-stat-card {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.12);
  border: 1px solid rgba(45,212,191,0.2);
}

.i2-stat-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #99f6e4;
  margin-bottom: 2px;
}

.i2-stat-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.i2-panel-block {
  margin-top: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(45,212,191,0.2);
  background: rgba(15,23,42,0.48);
  font-size: 11px;
  color: var(--ui-text);
  line-height: 1.45;
}

.i2-entity-card {
  padding: 7px 8px;
  margin-bottom: 6px;
  border-radius: 6px;
  border: 1px solid var(--ui-accent-border);
  background: var(--ui-accent-soft);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.i2-entity-card:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.16);
}

.i2-entity-title {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 3px;
}

.i2-entity-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 9px;
  color: #a5b4fc;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

.i2-entity-props {
  font-size: 10px;
  color: var(--ui-subtle);
  line-height: 1.4;
}

@media (max-width: 920px) {
  .mobile-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    z-index: 1200;
    right: max(9px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    min-width: 84px;
    min-height: 42px;
    border: 1px solid rgba(45,212,191,0.35);
    border-radius: 999px;
    background: rgba(7,16,23,0.92);
    color: var(--ui-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  }

  #control-panel {
    width: calc(100vw - max(18px, env(safe-area-inset-left) + env(safe-area-inset-right) + 18px));
    left: max(9px, env(safe-area-inset-left));
    top: max(9px, env(safe-area-inset-top));
    max-height: 60dvh;
  }

  #control-panel.control-panel-layers-docked {
    right: 9px;
    width: calc(100vw - 18px);
  }

  .entity-panel {
    width: calc(100vw - 18px);
    right: calc(-100vw - 24px);
    top: auto;
    bottom: 12px;
    max-height: 52vh;
  }

  .entity-panel.open {
    right: 9px;
  }

  .flight-info-panel {
    width: calc(100vw - 18px);
    right: max(9px, env(safe-area-inset-right));
    top: auto;
    bottom: max(65px, env(safe-area-inset-bottom) + 52px);
  }

  #control-panel.mobile-hidden {
    transform: translateY(calc(100dvh + 36px));
    pointer-events: none;
    transition: transform 0.2s ease;
  }

  #control-panel {
    transition: transform 0.2s ease;
  }

  #status-bar {
    font-size: 10px;
    padding: 5px 10px;
  }

  .cp-quick-actions {
    grid-template-columns: 1fr;
  }

  .quick-action-btn {
    min-height: 38px;
  }

  .layer-row {
    min-height: 38px;
  }

  .status-health-mini {
    display: none;
  }

  .toast-stack {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(58px, env(safe-area-inset-bottom) + 56px);
  }
}

@media (max-width: 680px) {
  #control-panel {
    width: calc(100vw - 10px);
    left: 5px;
    top: 5px;
    max-height: 58vh;
    border-radius: 10px;
  }

  #control-panel.control-panel-layers-docked {
    right: auto;
    width: calc(100vw - 10px);
  }

  .cp-header {
    padding: 9px 10px;
  }

  .cp-meta-strip {
    padding: 7px 10px 8px;
    gap: 5px;
  }

  .cp-meta-chip {
    min-height: 22px;
    padding: 0 7px;
    font-size: 9px;
  }

  .cp-meta-chip strong {
    font-size: 10px;
  }

  .cp-title {
    font-size: 10px;
    letter-spacing: 2px;
  }

  .cp-menu-btn {
    min-width: 50px;
    height: 22px;
    font-size: 9px;
  }

  .cp-menu {
    right: 36px;
    min-width: 132px;
  }

  .cp-body {
    padding: 0 10px 10px;
  }

  .cp-tabs {
    margin: 0 -10px;
    padding: 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .cp-tab {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 10px 8px;
    font-size: 10px;
  }

  #control-panel input[type="text"],
  #control-panel select,
  #control-panel input[type="date"],
  #control-panel input[type="time"] {
    font-size: 14px;
    min-height: 38px;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 42px;
    font-size: 12px;
  }

  .cp-btn-row {
    gap: 7px;
  }

  #ch_results,
  #psc_results,
  .nr-results,
  .roads-results,
  .tfl-stop-results {
    max-height: 180px;
  }

  .entity-panel {
    width: calc(100vw - 10px);
    right: calc(-100vw - 20px);
    bottom: 5px;
    max-height: 62vh;
    border-radius: 10px;
  }

  .entity-panel.open {
    right: 5px;
  }

  .flight-info-panel {
    width: calc(100vw - 10px);
    right: 5px;
    bottom: 58px;
  }

  #status-bar {
    padding: 4px 8px;
    font-size: 9.5px;
  }

  .mobile-panel-toggle {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    min-width: 74px;
    min-height: 40px;
  }

  #control-panel.mobile-hidden {
    transform: translateY(calc(100dvh + 36px));
    pointer-events: none;
    transition: transform 0.2s ease;
  }

  #control-panel {
    transition: transform 0.2s ease;
  }

  .leaflet-popup-content-wrapper {
    max-width: min(92vw, 360px) !important;
  }

  .leaflet-popup-content {
    margin: 10px 12px !important;
    line-height: 1.55 !important;
  }

  .airport-logo-popup {
    max-width: min(76vw, 220px);
    max-height: 96px;
  }
}

/* =======================================================
   CONTROL ROOM v2 - INTELLIGENCE DASHBOARD ADDITIONS
   ======================================================= */

/* == KPI Dashboard Bar == */
.kpi-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1200;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 14px;
  background:
    linear-gradient(180deg, rgba(8, 18, 32, 0.98) 0%, rgba(6, 12, 22, 0.96) 100%);
  border-bottom: 1px solid rgba(45, 212, 191, 0.12);
  backdrop-filter: blur(24px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 4px 24px rgba(0, 0, 0, 0.5);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.kpi-separator {
  width: 1px;
  height: 22px;
  margin: 0 10px;
  background: linear-gradient(180deg, transparent, rgba(45, 212, 191, 0.2), transparent);
  flex-shrink: 0;
}

.kpi-brand {
  display: flex;
  flex-direction: column;
  min-width: 110px;
}

.kpi-brand-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3.5px;
  background: linear-gradient(135deg, #06b6d4 0%, #2dd4bf 50%, #06b6d4 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 6s ease infinite;
  line-height: 1.1;
}

.kpi-brand-sub {
  font-size: 7.5px;
  color: #4b6478;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}

.kpi-grid {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: max-content;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 2px 8px;
  border-radius: var(--ui-radius-sm);
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: all var(--transition-fast);
  cursor: default;
}

.kpi-card:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(45, 212, 191, 0.15);
}

.kpi-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--ui-accent);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s, transform 0.3s;
}

.kpi-value.kpi-flash {
  color: var(--ui-accent);
  transform: scale(1.25);
}

.kpi-label {
  font-size: 7.5px;
  color: #4b6478;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 700;
}

.kpi-card-alert .kpi-value { color: #f87171; }
.kpi-card-ops .kpi-value { color: #fbbf24; }

.kpi-live-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.kpi-clock {
  font-size: 12px;
  font-weight: 700;
  color: var(--ui-subtle);
  letter-spacing: 0.5px;
}

.kpi-coords {
  font-size: 10px;
  color: #4b6478;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.kpi-zoom {
  font-size: 10px;
  color: #4b6478;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--ui-card-bg);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* == KPI bar pill groups (base map + theme) == */
.kpi-pill-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.kpi-pill-label {
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ui-text-muted);
  white-space: nowrap;
}
.kpi-pills { display: flex; gap: 2px; }
.kpi-pill {
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--ui-border-subtle);
  border-radius: 4px;
  background: transparent;
  color: var(--ui-text-muted);
  font-size: 9px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.kpi-pill:hover {
  background: var(--ui-card-bg);
  color: var(--ui-subtle);
}
.kpi-pill:active { transform: scale(0.95); }
.kpi-pill.active {
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  border-color: var(--ui-accent-border);
}

.kpi-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

.kpi-action-btn {
  height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(45, 212, 191, 0.2);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-accent-soft);
  color: var(--ui-accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.kpi-action-btn:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(45, 212, 191, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(45, 212, 191, 0.15);
}
.kpi-action-btn:active { transform: translateY(0); box-shadow: none; filter: brightness(0.9); }

/* == KPI button inline icons == */
.kpi-btn-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  margin-right: 3px;
  position: relative;
  top: -0.5px;
  opacity: 0.85;
}
.kpi-action-btn {
  display: inline-flex;
  align-items: center;
}

/* == Theme swatch dots inside pill buttons == */
.theme-swatch {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
  flex-shrink: 0;
  position: relative;
  top: -0.5px;
}
.kpi-pill {
  display: inline-flex;
  align-items: center;
}

/* == Theme compact dropdown == */
.kpi-theme-group {
  gap: 5px;
}
.theme-swatch-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.25);
}
.kpi-theme-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 5px;
  color: #94a3b8;
  font-size: 9.5px;
  font-family: inherit;
  font-weight: 600;
  padding: 2px 18px 2px 6px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%2394a3b8' stroke-width='1.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
}
.kpi-theme-select:hover {
  border-color: rgba(148, 163, 184, 0.5);
  color: #cbd5e1;
}
.kpi-theme-select:focus {
  border-color: rgba(99, 102, 241, 0.6);
  color: #e2e8f0;
}
.kpi-mini-sep {
  width: 1px;
  height: 14px;
  background: rgba(148, 163, 184, 0.2);
  flex-shrink: 0;
  margin: 0 2px;
}

.kpi-action-intel {
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.06);
  color: #fde68a;
}

.kpi-action-intel:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.12);
}

.kpi-action-danger {
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.06);
  color: #fca5a5;
}

.kpi-action-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.kpi-action-help {
  min-width: 30px;
  padding: 0 6px;
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.04);
  color: var(--ui-text-muted);
}

.kpi-action-help:hover {
  color: var(--ui-subtle);
}

/* Adjust existing layout for KPI bar */
#map { top: 42px !important; height: calc(100dvh - 42px) !important; }
#control-panel { top: 54px !important; max-height: calc(100dvh - 100px) !important; }
.entity-panel { top: 54px !important; }
#status-bar { bottom: 0 !important; }

/* == Bottom Analysis Panel == */
.bottom-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1100;
  height: 0;
  background: linear-gradient(180deg, rgba(8, 16, 28, 0.97), rgba(6, 12, 20, 0.98));
  border-top: 1px solid rgba(45, 212, 191, 0.1);
  backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5), 0 -1px 0 rgba(255, 255, 255, 0.02) inset;
  transition: height var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottom-panel.open {
  height: 320px;
}

/* When bottom panel is open, map must be resized via JS class */
#map.bp-open {
  height: calc(100dvh - 42px - 320px) !important;
}

.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 36px;
  min-height: 36px;
  border-bottom: 1px solid var(--ui-border-subtle);
}

.bp-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

.bp-tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ui-text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.bp-tab-btn:hover {
  color: var(--ui-text);
  background: var(--ui-card-bg);
}

.bp-tab-btn.active {
  color: var(--ui-accent);
  border-bottom-color: var(--ui-accent-strong);
  background: rgba(34, 211, 238, 0.06);
}

.bp-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bp-stats {
  display: flex;
  gap: 14px;
  font-size: 10px;
  color: var(--ui-subtle);
}

.bp-stats strong {
  color: var(--ui-accent);
}

.bp-close-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border-subtle);
  border-radius: 6px;
  color: var(--ui-text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.bp-close-btn:hover { background: rgba(255, 255, 255, 0.08); color: #ef4444; }

.bp-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.bp-tab-pane {
  display: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.bp-tab-pane.active {
  display: flex;
  flex-direction: column;
}

.bp-layer-state {
  padding: 10px 12px;
  overflow-y: auto;
}

.bp-layer-state .layer-status-grid {
  margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* == Network Graph == */
.network-graph-container {
  flex: 1;
  background: #0a0f1a;
  min-height: 0;
}

.graph-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.graph-tool-btn {
  height: 24px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: var(--ui-input-bg);
  color: var(--ui-subtle);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.graph-tool-btn:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(45, 212, 191, 0.3);
  color: var(--ui-text);
}

.graph-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ui-text-muted);
  font-size: 12px;
}

/* == Timeline == */
.timeline-container {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  background: #0a0f1a;
  position: relative;
  min-height: 0;
}

.timeline-scroll {
  position: relative;
  min-height: 100%;
}

.timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--ui-text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.tl-event {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tl-event:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.tl-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tl-label {
  font-size: 10px;
  color: var(--ui-text);
  font-weight: 600;
}

.tl-date {
  font-size: 9px;
  color: var(--ui-text-muted);
}

.tl-axis-mark {
  position: absolute;
  top: 0;
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.tl-axis-year {
  border-left-color: rgba(45, 212, 191, 0.3);
}

.tl-axis-label {
  font-size: 9px;
  color: var(--ui-text-muted);
  padding-left: 4px;
  font-weight: 600;
}

.tl-axis-year .tl-axis-label {
  color: var(--ui-accent);
  font-size: 10px;
}

.tl-gridline {
  position: absolute;
  width: 1px;
  background: var(--ui-card-bg);
}

.tl-gridline-year {
  background: var(--ui-accent-soft);
}

.tl-today {
  position: absolute;
  width: 2px;
  background: rgba(239, 68, 68, 0.5);
  z-index: 10;
}

.tl-today-label {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 8px;
  font-weight: 800;
  color: #ef4444;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tl-zoom-label {
  font-size: 9px;
  color: var(--ui-text-muted);
  margin-left: 8px;
}

.tl-breakdown {
  font-size: 9px;
  color: #475569;
}

/* == Activity Log == */
.activity-log-list {
  padding: 8px 16px;
  overflow-y: auto;
  max-height: 100%;
}

.activity-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(148,163,184,0.14);
  background: rgba(6, 12, 20, 0.42);
}

.activity-toolbar select,
.activity-toolbar input[type="text"] {
  min-height: 30px;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 6px;
  background: rgba(15,23,42,0.45);
  color: var(--ui-text);
  font-size: 11px;
  font-family: inherit;
  padding: 4px 8px;
}

.activity-toolbar select {
  min-width: 136px;
}

.activity-toolbar input[type="text"] {
  flex: 1;
  min-width: 120px;
}

.activity-count {
  margin-left: auto;
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

.activity-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  font-size: 11px;
}

.activity-entry:hover {
  background: var(--ui-card-bg);
}

.activity-time {
  font-size: 10px;
  color: #475569;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 55px;
}

.activity-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 999px;
  background: rgba(15,23,42,0.35);
}

.activity-action {
  color: var(--ui-text);
  font-weight: 600;
}

.activity-detail {
  color: var(--ui-text-muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.activity-empty {
  color: #475569;
  font-size: 11px;
  padding: 16px;
  text-align: center;
}

.activity-cat-search .activity-action { color: var(--ui-secondary); }
.activity-cat-entity .activity-action { color: #22c55e; }
.activity-cat-connection .activity-action { color: #fbbf24; }
.activity-cat-layer .activity-action { color: #38bdf8; }
.activity-cat-export .activity-action { color: #f59e0b; }
.activity-cat-alert .activity-action { color: #ef4444; }
.activity-cat-search .activity-icon { color: #60a5fa; border-color: rgba(96,165,250,0.45); }
.activity-cat-entity .activity-icon { color: #22c55e; border-color: rgba(34,197,94,0.4); }
.activity-cat-connection .activity-icon { color: #fbbf24; border-color: rgba(251,191,36,0.45); }
.activity-cat-layer .activity-icon { color: #38bdf8; border-color: rgba(56,189,248,0.45); }
.activity-cat-export .activity-icon { color: #f59e0b; border-color: rgba(245,158,11,0.45); }
.activity-cat-alert .activity-icon { color: #ef4444; border-color: rgba(239,68,68,0.45); }

/* == Search History == */
.search-history-list {
  max-height: 280px;
  overflow-y: auto;
}

.sh-section-label {
  font-size: 9px;
  font-weight: 800;
  color: #475569;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 8px 0 4px;
}

.sh-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.sh-entry:hover {
  background: var(--ui-accent-soft);
  border-color: rgba(99, 102, 241, 0.15);
}

.sh-type {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  min-width: 35px;
}

.sh-query {
  font-size: 11px;
  color: var(--ui-text);
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-count {
  font-size: 9px;
  color: #475569;
  white-space: nowrap;
}

.sh-time {
  font-size: 9px;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.sh-bookmark-btn {
  background: none;
  border: none;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: color 0.15s;
}

.sh-bookmark-btn:hover { color: #fbbf24; }
.sh-bookmark-btn.bookmarked { color: #fbbf24; }

/* == Workspace Manager == */
/* Tools & Workspace merged sub-tabs */
.tools-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(148,163,184,0.15);
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tools-tab-btn {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 4px 6px;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 6px;
  background: rgba(15,23,42,0.4);
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tools-tab-btn.active {
  background: rgba(99,102,241,0.22);
  border-color: rgba(99,102,241,0.5);
  color: #a5b4fc;
}
.tools-tab-pane { display: none; }
.tools-tab-pane.active { display: block; }

.casebook-grid {
  display: grid;
  gap: 6px;
}

.casebook-grid label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8aa6bb;
}

.casebook-grid textarea {
  min-height: 72px;
  resize: vertical;
}

.casebook-actions-row {
  margin-top: 8px;
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .activity-toolbar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .activity-toolbar select,
  .activity-toolbar input[type="text"] {
    width: 100%;
  }

  .activity-count {
    width: 100%;
    margin-left: 0;
  }
}

.workspace-list {
  max-height: 200px;
  overflow-y: auto;
}

.ws-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 4px;
  transition: all 0.15s;
}

.ws-entry:hover {
  background: var(--ui-card-bg);
  border-color: rgba(45, 212, 191, 0.15);
}

.ws-info { flex: 1; }

.ws-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ui-text);
}

.ws-meta {
  display: block;
  font-size: 9px;
  color: #475569;
  margin-top: 2px;
}

.ws-actions {
  display: flex;
  gap: 4px;
}

.ws-load-btn {
  padding: 4px 10px;
  border: 1px solid rgba(45, 212, 191, 0.25);
  border-radius: 4px;
  background: rgba(45, 212, 191, 0.1);
  color: var(--ui-accent);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.ws-load-btn:hover { background: rgba(45, 212, 191, 0.2); }

.ws-delete-btn {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.05);
  color: var(--ui-text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.ws-delete-btn:hover { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* == Context Menu == */
.ctx-menu {
  position: fixed;
  z-index: 10000;
  min-width: 200px;
  max-width: 320px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 1px rgba(45, 212, 191, 0.1) inset;
  backdrop-filter: blur(20px);
  animation: ctxFadeIn 0.12s ease;
}

@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--ui-text);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.12s;
}

.ctx-item:hover {
  background: rgba(45, 212, 191, 0.1);
  color: #fff;
}

.ctx-item:disabled {
  opacity: 0.35;
  cursor: default;
}

.ctx-item:disabled:hover {
  background: none;
  color: var(--ui-text);
}

.ctx-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.ctx-icon {
  font-size: 14px;
  min-width: 20px;
  text-align: center;
}

.ctx-label { flex: 1; }

.ctx-shortcut {
  font-size: 9px;
  color: #475569;
  font-weight: 600;
}

.ctx-sep {
  height: 1px;
  margin: 4px 8px;
  background: rgba(255, 255, 255, 0.06);
}

/* == Data Sources Grid == */
.data-sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.ds-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: all var(--transition-fast);
}

.ds-item:hover {
  background: rgba(255, 255, 255, 0.035);
}

.ds-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ds-dot-green {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.ds-dot-amber {
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.5);
}

.ds-name {
  font-size: 9px;
  font-weight: 600;
  color: var(--ui-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-badge {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(45, 212, 191, 0.1);
  color: var(--ui-accent);
  border: 1px solid rgba(45, 212, 191, 0.15);
}

.ds-badge-restricted {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

/* == Keyboard Shortcuts Overlay == */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: ctxFadeIn 0.15s ease;
}

.shortcuts-dialog {
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ui-border-subtle);
  font-size: 13px;
  font-weight: 700;
  color: var(--ui-accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.shortcuts-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border-subtle);
  border-radius: 6px;
  color: var(--ui-text-muted);
  font-size: 16px;
  cursor: pointer;
}

.shortcuts-close:hover { background: rgba(255, 255, 255, 0.08); color: #ef4444; }

.shortcuts-body {
  padding: 12px 18px;
  overflow-y: auto;
  flex: 1;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  align-items: center;
}

.shortcut-keys kbd {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--ui-accent);
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  min-width: 24px;
  text-align: center;
}

.shortcut-desc {
  color: var(--ui-subtle);
  font-size: 11px;
}

/* == 3x5x2 Intelligence Report Modal == */
.intel-report-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: ctxFadeIn 0.2s ease;
}

.intel-report-dialog {
  width: 740px;
  max-width: 95vw;
  max-height: 90vh;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(251, 191, 36, 0.05) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.intel-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.3), rgba(30, 41, 55, 0.6));
  border-bottom: 1px solid rgba(251, 191, 36, 0.15);
}

.intel-report-title {
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 2px;
}

.intel-report-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ui-input-bg);
  border: 1px solid var(--ui-border-subtle);
  border-radius: 6px;
  color: var(--ui-text-muted);
  font-size: 16px;
  cursor: pointer;
}

.intel-report-close:hover { color: #ef4444; }

.intel-report-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.intel-report-section {
  margin-bottom: 14px;
}

.intel-report-section label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ui-subtle);
  margin-bottom: 4px;
}

.intel-report-section input[type="text"],
.intel-report-section input[type="datetime-local"],
.intel-report-section textarea,
.intel-report-section select {
  width: 100%;
  padding: 8px 10px;
  background: var(--ui-input-bg);
  border: 1px solid rgba(180, 214, 238, 0.18);
  border-radius: 7px;
  color: var(--ui-text-bright);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.intel-report-section input:focus,
.intel-report-section textarea:focus,
.intel-report-section select:focus {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

.intel-report-section select option {
  background: #1e293b;
  color: #e2e8f0;
}

.intel-report-section textarea {
  resize: vertical;
  min-height: 80px;
}

.intel-report-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.ir-entity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 80px;
  overflow-y: auto;
}

.ir-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--ui-accent-soft);
  border: 1px solid var(--ui-accent-border);
  color: #c4b5fd;
  font-size: 9px;
  font-weight: 600;
}

.intel-report-subtitle {
  font-size: 9px;
  font-weight: 600;
  color: var(--ui-subtle);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.intel-report-divider {
  margin: 18px 0 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(251, 191, 36, 0.18);
  border-bottom: 1px solid rgba(251, 191, 36, 0.08);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fbbf24;
  text-align: center;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.06), transparent);
}

.intel-entries-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.intel-entries-toolbar select {
  flex: 1;
  padding: 7px 10px;
  background: var(--ui-input-bg);
  border: 1px solid rgba(180, 214, 238, 0.18);
  border-radius: 7px;
  color: var(--ui-text-bright);
  font-size: 11px;
  font-family: inherit;
}

.intel-entries-toolbar select option {
  background: #1e293b;
  color: #e2e8f0;
}

.intel-entries-toolbar select option.ir-restricted {
  color: #f59e0b;
}

.ir-entries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 340px;
  overflow-y: auto;
}

.ir-entries-empty {
  padding: 16px;
  text-align: center;
  color: var(--ui-text-muted);
  font-size: 11px;
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: 8px;
}

.ir-entry-card {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  overflow: hidden;
}

.ir-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(30, 41, 55, 0.6), rgba(15, 23, 42, 0.4));
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
}

.ir-entry-number {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.2);
  color: var(--ui-secondary);
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.ir-entry-type-label {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  flex: 1;
}

.ir-restricted-badge {
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.ir-entry-remove {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 4px;
  background: transparent;
  color: var(--ui-text-muted);
  font-size: 14px;
  cursor: pointer;
}

.ir-entry-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.ir-entry-desc {
  padding: 6px 12px;
  font-size: 9px;
  color: var(--ui-subtle);
  font-style: italic;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.ir-entry-fields {
  padding: 10px 12px;
}

.ir-entry-fields label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ui-subtle);
  margin-bottom: 3px;
  margin-top: 8px;
}

.ir-entry-fields label:first-child {
  margin-top: 0;
}

.ir-entry-fields input,
.ir-entry-fields textarea {
  width: 100%;
  padding: 7px 9px;
  background: var(--ui-card-bg);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.ir-entry-fields input:focus,
.ir-entry-fields textarea:focus {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.08);
}

.ir-entry-fields textarea {
  resize: vertical;
  min-height: 50px;
}

.ir-entry-restricted-note {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.06);
  font-size: 9px;
  color: #fcd34d;
  line-height: 1.4;
}

.intel-report-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* == Adjust map height when bottom panel is open == */
/* When bottom panel is open, map must be resized via JS class */
#map.bp-open {
  height: calc(100dvh - 42px - 320px) !important;
}

/* == Responsive adjustments for KPI bar == */
@media (max-width: 1024px) {
  .kpi-bar { padding: 0 8px; }
  .kpi-separator { margin: 0 6px; }
  .kpi-brand { min-width: 80px; }
  .kpi-card { min-width: 42px; padding: 2px 6px; }
  .kpi-value { font-size: 12px; }
  .kpi-actions { gap: 2px; }
  .kpi-action-btn { padding: 0 6px; font-size: 8px; }
  .kpi-live-info { gap: 6px; }
  .kpi-coords { display: none; }
}

@media (max-width: 1460px) {
  .kpi-brand-sub { display: none; }
  .kpi-pill-group:last-of-type { display: none; }
  .kpi-separator { margin: 0 5px; }
  .kpi-card { min-width: 44px; padding: 2px 5px; }
  .kpi-action-btn { padding: 0 6px; font-size: 8px; }
}

@media (max-width: 768px) {
  .kpi-bar {
    height: 36px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .kpi-brand-sub { display: none; }
  .kpi-grid { flex-wrap: nowrap; }
  .kpi-card { min-width: 38px; }
  .kpi-live-info { display: none; }
  .kpi-separator:nth-child(4), .kpi-separator:nth-child(6) { display: none; }
  .bottom-panel.open { height: 240px; }
  #map.bp-open { height: calc(100dvh - 36px - 240px) !important; }
  #control-panel { top: 48px !important; }
  .intel-report-row-3 { grid-template-columns: 1fr; }
}

/* =======================================================
   Intel Report Import - Summary Modal
   ======================================================= */
.intel-import-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.intel-import-modal-content {
  background: #1a1d23;
  border: 1px solid #2d3748;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 520px;
  width: 92vw;
  color: #e2e8f0;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.iis-header { text-align: center; margin-bottom: 20px; }
.iis-title {
  font-family: 'Bahnschrift', 'Lato', 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #6366f1;
  letter-spacing: 0.5px;
}
.iis-ref {
  font-family: 'Bahnschrift Light', 'Lato', 'Segoe UI', sans-serif;
  font-size: 13px;
  color: var(--ui-subtle);
  margin-top: 4px;
}
.iis-date { font-size: 12px; color: var(--ui-text-muted); margin-top: 2px; }
.iis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.iis-stat {
  background: #0f1218;
  border: 1px solid #2d3748;
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
}
.iis-value {
  font-family: 'Bahnschrift', 'Lato', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #6366f1;
  line-height: 1.1;
}
.iis-label {
  font-size: 10px;
  color: var(--ui-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.iis-gradings {
  background: #0f1218;
  border: 1px solid #2d3748;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--ui-text);
  line-height: 1.6;
  margin-bottom: 12px;
}
.iis-gradings-title {
  font-weight: 600;
  color: #6366f1;
  margin-bottom: 8px;
  font-size: 13px;
}
.iis-grading-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  flex-wrap: wrap;
}
.iis-grading-num {
  color: var(--ui-text-muted);
  font-weight: 600;
  min-width: 18px;
}
.iis-grading-code {
  display: inline-block;
  background: #374151;
  color: #f9fafb;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 11px;
  font-family: monospace;
  letter-spacing: 0.5px;
}
.iis-grading-decode {
  font-size: 10px;
  color: var(--ui-subtle);
  font-style: italic;
}
.iis-provenance {
  font-size: 12px;
  color: #f59e0b;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.iis-close-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Bahnschrift', 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.iis-close-btn:hover { background: #4f46e5; }

#quick-intel-import {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent-border);
  color: var(--ui-accent);
}
#quick-intel-import:hover {
  background: var(--ui-accent-glow);
  border-color: var(--ui-accent);
  color: var(--ui-text-bright);
}
#quick-intel-import::before { content: "INTEL"; background: var(--ui-accent-soft); color: var(--ui-accent); }

/* -------------------------------------------------------
   Document Converter Panel
   ------------------------------------------------------- */
.doc-converter-panel {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
}
.doc-converter-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #a5b4fc;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.doc-converter-hint {
  font-size: 0.72rem;
  color: var(--ui-subtle);
  margin-bottom: 8px;
}
.doc-converter-hint code {
  background: rgba(99, 102, 241, 0.15);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.7rem;
  color: #c7d2fe;
}
.dc-results {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
}
.dc-empty {
  color: var(--ui-text-muted);
  font-size: 0.72rem;
  text-align: center;
  padding: 12px 0;
}
.dc-loading {
  color: #a5b4fc;
  font-size: 0.72rem;
  text-align: center;
  padding: 12px 0;
}
.dc-result {
  background: rgba(15, 17, 26, 0.7);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.dc-result.dc-error {
  border-color: rgba(239, 68, 68, 0.3);
}
.dc-original {
  font-size: 0.7rem;
  color: #ef4444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: line-through;
  opacity: 0.7;
}
.dc-arrow {
  text-align: center;
  color: #6366f1;
  font-size: 0.8rem;
  line-height: 1;
  margin: 2px 0;
}
.dc-converted {
  font-size: 0.72rem;
  color: #22c55e;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dc-desc {
  font-size: 0.68rem;
  color: var(--ui-subtle);
  margin-top: 3px;
  font-style: italic;
}
.dc-label {
  color: var(--ui-text-muted);
  font-weight: 600;
  font-style: normal;
}
.dc-meta {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.dc-badge {
  font-size: 0.62rem;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dc-badge-orig {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}
.dc-badge-date {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}
.dc-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.dc-dl-btn, .dc-dl-desc-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: #c7d2fe;
  cursor: pointer;
  transition: background 0.15s;
}
.dc-dl-btn:hover, .dc-dl-desc-btn:hover, .dc-preview-btn:hover {
  background: rgba(99, 102, 241, 0.25);
}
.dc-preview-btn {
  font-size: 0.65rem;
  padding: 2px 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: #c7d2fe;
  cursor: pointer;
  transition: background 0.15s;
}
.dc-preview {
  margin-top: 6px;
  border-top: 1px solid var(--ui-border);
  padding-top: 6px;
}
.dc-preview-text {
  font-family: 'Bahnschrift Light', 'Lato', 'Segoe UI', monospace;
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--ui-subtle);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}
.dc-preview-more {
  font-size: 0.62rem;
  padding: 2px 8px;
  margin-top: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.08);
  color: #a5b4fc;
  cursor: pointer;
}
.dc-preview-more:hover { background: rgba(99, 102, 241, 0.2); }

/* Document preview card (entity import panel) */
.doc-preview-card {
  background: rgba(15, 17, 26, 0.7);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 6px;
}
.doc-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.doc-preview-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ui-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.doc-preview-subject {
  font-size: 0.7rem;
  color: var(--ui-accent);
  margin-bottom: 2px;
}
.doc-preview-desc {
  font-size: 0.68rem;
  color: var(--ui-subtle);
  font-style: italic;
  margin-bottom: 6px;
}
.doc-preview-body {
  max-height: 300px;
  overflow-y: auto;
}
.doc-preview-expand {
  font-size: 0.62rem;
  padding: 2px 8px;
  margin-top: 4px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.08);
  color: #a5b4fc;
  cursor: pointer;
}
.doc-preview-expand:hover { background: rgba(99, 102, 241, 0.2); }

/* =======================================================
   Ship DivIcon - heading rotation + vessel type colours
   ======================================================= */
.ship-marker { cursor: pointer; filter: drop-shadow(0 0 4px rgba(6,182,212,0.55)); }
.ship-icon {
  width: var(--ship-icon-size, 20px);
  height: var(--ship-icon-size, 20px);
  pointer-events: auto;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  box-shadow: 0 0 0 1px rgba(6,182,212,0.18), 0 0 10px rgba(6,182,212,0.12);
}
.ship-icon .ship-inner {
  width: var(--ship-icon-size, 20px);
  height: var(--ship-icon-size, 20px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ship-icon .ship-inner svg {
  width: calc(var(--ship-icon-size, 20px) - 4px);
  height: calc(var(--ship-icon-size, 20px) - 4px);
  display: block;
  fill: currentColor;
}
/* Vessel type colours */
.ship-icon.ship-cargo     { color: #f59e0b; box-shadow: 0 0 0 1px rgba(245,158,11,0.3); }
.ship-icon.ship-tanker    { color: #ef4444; box-shadow: 0 0 0 1px rgba(239,68,68,0.3); }
.ship-icon.ship-passenger { color: #22c55e; box-shadow: 0 0 0 1px rgba(34,197,94,0.3); }
.ship-icon.ship-fishing   { color: #3b82f6; box-shadow: 0 0 0 1px rgba(59,130,246,0.3); }
.ship-icon.ship-special   { color: #a855f7; box-shadow: 0 0 0 1px rgba(168,85,247,0.3); }
.ship-icon.ship-pleasure  { color: #ec4899; box-shadow: 0 0 0 1px rgba(236,72,153,0.3); }
.ship-icon.ship-other     { color: #06b6d4; box-shadow: 0 0 0 1px rgba(6,182,212,0.3); }
.ship-icon.ship-sanctioned {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.9), 0 0 16px rgba(239,68,68,0.75), 0 0 30px rgba(220,38,38,0.45);
  background: rgba(52, 7, 7, 0.94);
  transform: scale(1.32);
  animation: ship-sanction-pulse 1.25s ease-in-out infinite;
}

.ais-filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-bottom: 6px;
}

.ais-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 6px;
}

@keyframes ship-sanction-pulse {
  0% { box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.9), 0 0 10px rgba(239,68,68,0.5), 0 0 20px rgba(220,38,38,0.28); }
  50% { box-shadow: 0 0 0 2px rgba(250, 204, 21, 1), 0 0 22px rgba(239,68,68,0.95), 0 0 36px rgba(220,38,38,0.58); }
  100% { box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.9), 0 0 10px rgba(239,68,68,0.5), 0 0 20px rgba(220,38,38,0.28); }
}

/* =======================================================
   Maki Entity Icons (from icon_system.js)
   ======================================================= */
.entity-maki-marker { background: none !important; border: none !important; }
.entity-maki-icon { transition: transform 0.15s ease, box-shadow 0.15s ease; cursor: pointer; }
.entity-maki-icon:hover { transform: scale(1.15); }
.entity-circle-fallback { background: none !important; border: none !important; }

/* Entity selection glow */
.entity-selected-marker .entity-maki-icon,
.entity-selected-marker img {
  box-shadow: 0 0 0 3px #22c55e, 0 0 12px rgba(34,197,94,0.5) !important;
  border-radius: 50%;
}

/* =======================================================
   Entity Inspector Panel (Sprint 5)
   ======================================================= */
#entity-inspector {
  position: fixed;
  right: -380px;
  top: 56px;
  width: 360px;
  height: calc(100vh - 56px - 220px);
  background: rgba(15,23,42,0.96);
  border-left: 1px solid rgba(99,102,241,0.15);
  backdrop-filter: blur(12px);
  z-index: 1200;
  transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  font-family: Bahnschrift, "Lato", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: #e2e8f0;
  padding: 16px;
}
#entity-inspector.open { right: 0; }
.inspector-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inspector-close:hover { color: #f8fafc; border-color: rgba(255,255,255,0.3); }
.inspector-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
.inspector-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 12px;
}
.inspector-section {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.inspector-section h4 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin: 0 0 6px;
}
.inspector-attr-table {
  width: 100%;
  font-size: 0.72rem;
}
.inspector-attr-table td {
  padding: 2px 0;
  vertical-align: top;
}
.inspector-attr-table td:first-child {
  color: #94a3b8;
  width: 40%;
  padding-right: 8px;
}
.inspector-streetview {
  width: 100%;
  border-radius: 6px;
  margin-top: 6px;
  border: 1px solid rgba(255,255,255,0.08);
}
.inspector-relationships {
  list-style: none;
  padding: 0;
  margin: 0;
}
.inspector-relationships li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.72rem;
}
.inspector-rel-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  margin-right: 4px;
}

/* =======================================================
   Entity Search
   ======================================================= */
.entity-search-panel {
  margin-bottom: 10px;
  padding: 8px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.entity-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.entity-search-input {
  flex: 1;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 6px;
  padding: 6px 10px;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-family: inherit;
  outline: none;
}
.entity-search-input:focus {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.entity-search-filter {
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 6px;
  padding: 5px 6px;
  color: #e2e8f0;
  font-size: 0.72rem;
  font-family: inherit;
  min-width: 90px;
}
.entity-search-results-container {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 6px;
}
.entity-search-empty {
  color: #64748b;
  font-size: 0.72rem;
  padding: 8px 0;
  text-align: center;
}
.entity-search-results {
  list-style: none;
  padding: 0;
  margin: 0;
}
.entity-search-result {
  padding: 5px 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.74rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.1s;
}
.entity-search-result:hover {
  background: rgba(99,102,241,0.08);
}
.entity-search-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.entity-search-label {
  color: #f8fafc;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entity-search-match {
  color: #94a3b8;
  font-size: 0.65rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =======================================================
   Street View
   ======================================================= */
.sv-unavailable {
  color: #64748b;
  font-size: 0.7rem;
  padding: 8px;
  text-align: center;
  background: rgba(15,23,42,0.5);
  border-radius: 6px;
  border: 1px dashed rgba(255,255,255,0.08);
}
.sv-popup-thumb {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  margin-top: 6px;
}

/* ==========================================================================
   UX Revamp Layer (non-breaking)
   ========================================================================== */
body.ux-revamp {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  letter-spacing: 0.01em;
  background:
    radial-gradient(1200px 700px at 8% 15%, rgba(34, 197, 94, 0.10), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(14, 165, 233, 0.10), transparent 45%),
    #020617;
}

body.ux-revamp #map {
  filter: saturate(1.04) contrast(1.02);
}

body.ux-revamp .kpi-bar {
  height: 52px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.18);
  background: linear-gradient(90deg, rgba(2, 6, 23, 0.96), rgba(6, 14, 31, 0.88));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  overflow-x: auto;
  overflow-y: hidden;
}

body.ux-revamp .kpi-brand-title {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.24em;
  font-size: 12px;
}

body.ux-revamp .kpi-card {
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.15);
  background: rgba(15, 23, 42, 0.72);
}

body.ux-revamp .kpi-pill,
body.ux-revamp .kpi-action-btn {
  border-radius: 10px;
}

body.ux-revamp #control-panel {
  top: 62px;
  left: 12px;
  width: 336px;
  max-height: calc(100vh - 74px);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(2, 10, 27, 0.96), rgba(3, 12, 30, 0.92));
  box-shadow:
    0 18px 44px rgba(2, 6, 23, 0.55),
    0 0 0 1px rgba(14, 165, 233, 0.08) inset;
  overflow: hidden;
}

body.ux-revamp .cp-header {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.14);
  background: rgba(2, 8, 23, 0.68);
}

body.ux-revamp .cp-title {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.20em;
  font-size: 12px;
}

body.ux-revamp .cp-meta-strip {
  padding: 6px 10px 5px;
  gap: 5px;
}

body.ux-revamp .cp-meta-chip {
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(15, 23, 42, 0.65);
}

body.ux-revamp .cp-command-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 3px 10px 7px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}

body.ux-revamp .cp-command-btn {
  appearance: none;
  border: 1px solid rgba(45, 212, 191, 0.22);
  background: linear-gradient(180deg, rgba(13, 31, 48, 0.92), rgba(9, 21, 37, 0.9));
  color: #9ff3dd;
  border-radius: 9px;
  padding: 6px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

body.ux-revamp .cp-command-btn:hover {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.24) inset;
  transform: translateY(-1px);
}

body.ux-revamp .cp-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 6px 10px 7px;
  background: rgba(2, 10, 27, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
  gap: 6px;
}

body.ux-revamp .cp-tab {
  border-radius: 10px;
  border: 1px solid rgba(71, 85, 105, 0.35);
  background: rgba(15, 23, 42, 0.75);
  color: #9fb0c8;
  font-weight: 700;
}

body.ux-revamp .cp-tab.active {
  color: #0b1220;
  border-color: rgba(45, 212, 191, 0.8);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.95), rgba(20, 184, 166, 0.92));
}

body.ux-revamp .cp-tab-pane {
  padding: 9px;
  gap: 8px;
}

body.ux-revamp .panel-disclosure {
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.16);
  background: linear-gradient(180deg, rgba(4, 14, 30, 0.84), rgba(2, 9, 24, 0.86));
}

body.ux-revamp .panel-disclosure > summary {
  font-weight: 700;
  color: #b8d2ea;
  font-size: 9.5px;
}

body.ux-revamp input,
body.ux-revamp select,
body.ux-revamp textarea {
  border-radius: 10px;
  border: 1px solid rgba(71, 85, 105, 0.45);
  background: rgba(2, 8, 23, 0.82);
  color: #d8e6f8;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

body.ux-revamp input:focus,
body.ux-revamp select:focus,
body.ux-revamp textarea:focus {
  border-color: rgba(45, 212, 191, 0.72);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
  outline: none;
}

body.ux-revamp .btn-primary,
body.ux-revamp .btn-secondary,
body.ux-revamp .quick-action-btn,
body.ux-revamp .popup-psc-btn {
  border-radius: 10px;
}

body.ux-revamp .btn-primary {
  background: linear-gradient(180deg, #22d3ee, #06b6d4);
  border-color: rgba(34, 211, 238, 0.85);
  color: #04202a;
  font-weight: 700;
}

body.ux-revamp .btn-secondary {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(71, 85, 105, 0.56);
  color: #b8c6d9;
}

body.ux-revamp .entity-panel {
  top: 72px;
  border-radius: 16px;
  border: 1px solid rgba(45, 212, 191, 0.22);
  background: linear-gradient(180deg, rgba(3, 10, 27, 0.96), rgba(2, 8, 22, 0.94));
  box-shadow: 0 20px 48px rgba(2, 6, 23, 0.6);
}

body.ux-revamp .leaflet-popup-content-wrapper {
  border-radius: 14px;
  border: 1px solid rgba(45, 212, 191, 0.18);
  background: linear-gradient(180deg, rgba(2, 9, 24, 0.98), rgba(3, 14, 33, 0.95));
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.64);
}

body.ux-revamp .leaflet-popup-content {
  margin: 12px;
}

.entity-popup-shell {
  max-height: 54vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.entity-popup-shell::-webkit-scrollbar {
  width: 7px;
}

.entity-popup-shell::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.14);
  border-radius: 6px;
}

.entity-popup-shell::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.58);
  border-radius: 6px;
}

body.ux-revamp .mobile-panel-toggle {
  border-radius: 12px;
  border: 1px solid rgba(45, 212, 191, 0.35);
  background: rgba(2, 10, 27, 0.9);
}

@media (max-width: 980px) {
  body.ux-revamp #control-panel {
    width: 92vw;
    left: 4vw;
    top: 62px;
  }

  body.ux-revamp .cp-command-strip {
    grid-template-columns: 1fr 1fr;
  }

  body.ux-revamp .kpi-brand-sub,
  body.ux-revamp .kpi-live-info,
  body.ux-revamp .kpi-pill-group {
    display: none;
  }
}

/* Strong popup + map HUD polish so UX uplift is immediately visible */
body.ux-revamp .leaflet-popup-content strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
  color: #e6f5ff;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

body.ux-revamp .popup-label {
  color: #7dd3fc !important;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.11em;
}

body.ux-revamp .popup-tag {
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.1) inset;
}

body.ux-revamp .leaflet-popup-content-wrapper {
  min-width: 340px;
}

body.ux-revamp .popup-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

body.ux-revamp .popup-psc-btn {
  background: linear-gradient(180deg, rgba(15, 35, 56, 0.95), rgba(8, 23, 41, 0.95));
  color: #8be9ff;
  border: 1px solid rgba(14, 165, 233, 0.42);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

body.ux-revamp .popup-psc-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(45, 212, 191, 0.7);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.24) inset;
}

body.ux-revamp .leaflet-popup-tip {
  background: rgba(3, 14, 33, 0.95);
  border: 1px solid rgba(45, 212, 191, 0.2);
}

body.ux-revamp #control-panel {
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

body.ux-revamp #control-panel:hover {
  box-shadow:
    0 22px 54px rgba(2, 6, 23, 0.66),
    0 0 0 1px rgba(45, 212, 191, 0.14) inset;
}

body.ux-revamp .entity-panel {
  background:
    radial-gradient(120% 90% at 90% -20%, rgba(56, 189, 248, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(2, 10, 28, 0.97), rgba(1, 8, 24, 0.97));
  border-color: rgba(56, 189, 248, 0.28);
}

body.ux-revamp .entity-panel.is-editing {
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow:
    0 28px 64px rgba(2, 6, 23, 0.76),
    0 0 0 1px rgba(251, 191, 36, 0.24) inset;
}

body.ux-revamp .entity-panel.is-editing .entity-panel-title {
  color: #fde68a;
}

/* entity-icon-picker lives in flyout; no extra override needed */

body.ux-revamp .entity-panel .entity-i2-fields-title {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 8px;
  padding: 7px 9px;
  margin-bottom: 8px;
  line-height: 1.35;
}

body.ux-revamp .sv-popup-wrap {
  margin-top: 8px;
}

body.ux-revamp .sv-popup-thumb {
  width: 100%;
  min-height: 150px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(125, 211, 252, 0.35);
  background: rgba(15, 23, 42, 0.75);
}

body.ux-revamp .sv-popup-fallback {
  min-height: 150px;
  border-radius: 8px;
  border: 1px dashed rgba(125, 211, 252, 0.35);
  background: linear-gradient(135deg, rgba(8, 47, 73, 0.55), rgba(3, 37, 65, 0.38));
  color: #bae6fd;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px;
  text-align: center;
}

.google-api-dashboard {
  margin-top: 12px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 10px;
  background: rgba(3, 15, 33, 0.45);
}
.google-api-state {
  margin-bottom: 10px;
  font-size: 11px;
  border-radius: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #bfd8ea;
  background: rgba(15, 23, 42, 0.55);
}
.google-api-state.ok {
  border-color: rgba(34, 197, 94, 0.34);
  color: #86efac;
  background: rgba(20, 83, 45, 0.3);
}
.google-api-state.error {
  border-color: rgba(239, 68, 68, 0.34);
  color: #fecaca;
  background: rgba(127, 29, 29, 0.24);
}

.google-api-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #cfefff;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.google-api-capability-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.google-matrix-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #b8d8ef;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 6px 8px;
}

.google-api-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid transparent;
}

.google-api-badge.ok {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.35);
}

.google-api-badge.down {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.google-api-dashboard-list {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.google-api-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 6px;
  padding: 5px 8px;
  background: rgba(8, 23, 41, 0.45);
}

.google-api-name {
  font-weight: 700;
  font-size: 11px;
  color: #e5f3ff;
}

.google-api-cap {
  font-size: 10px;
  color: #9bb9d0;
}
.google-tools-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}
.google-tool-card {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: rgba(2, 9, 23, 0.52);
  padding: 9px;
}
.google-tool-card h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #d7ebff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.google-tool-row {
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
  align-items: center;
}
.google-tool-row input,
.google-tool-row select {
  flex: 1 1 auto;
  min-width: 0;
}
.google-tool-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a8c0d6;
  font-size: 11px;
}
.google-tool-output {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  color: #c8dff2;
  padding: 8px;
  font-size: 11px;
  min-height: 54px;
  max-height: 190px;
  overflow: auto;
}
.google-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.google-kv-grid div {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  padding: 6px 7px;
  background: rgba(30, 41, 59, 0.38);
}
.google-kv-grid span {
  display: block;
  color: #9fb8cf;
  font-size: 10px;
  margin-bottom: 2px;
}
.google-kv-grid strong {
  color: #ecf6ff;
  font-size: 11px;
}
.google-tool-link-row {
  margin-top: 7px;
}
.google-tool-link-row a {
  color: #7dd3fc;
  text-decoration: none;
}
.google-tool-link-row a:hover {
  text-decoration: underline;
}
.google-tool-note {
  margin-top: 7px;
  color: #fde68a;
  font-size: 10px;
}
.google-result-row {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.35);
  padding: 7px;
  margin-bottom: 6px;
}
.google-result-title {
  color: #eaf6ff;
  font-size: 12px;
  font-weight: 700;
}
.google-result-meta {
  color: #abc4da;
  font-size: 10px;
  margin-top: 2px;
}
.google-result-actions {
  margin-top: 7px;
  display: flex;
  justify-content: flex-end;
}

.cr-cmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 4100;
  background: rgba(2, 6, 16, 0.66);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: start center;
  padding-top: min(16vh, 140px);
}
.cr-cmd-overlay.hidden {
  display: none;
}
.cr-cmd-modal {
  width: min(760px, 92vw);
  max-height: min(72vh, 720px);
  border-radius: 14px;
  border: 1px solid rgba(96, 165, 250, 0.34);
  background: linear-gradient(180deg, rgba(6, 18, 36, 0.96), rgba(8, 14, 28, 0.95));
  box-shadow: 0 34px 72px rgba(1, 8, 20, 0.6);
  overflow: hidden;
}
.cr-cmd-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.cr-cmd-top input {
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.32);
  background: rgba(15, 23, 42, 0.74);
  color: #e2e8f0;
  outline: none;
}
.cr-cmd-top input:focus {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.cr-cmd-close {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.8);
  color: #cbd5e1;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.cr-cmd-hint {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  color: #93c5fd;
  font-size: 11px;
}
.cr-cmd-list {
  max-height: min(56vh, 560px);
  overflow: auto;
  padding: 8px;
}
.cr-cmd-item {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  color: #dbeafe;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  margin-bottom: 8px;
  display: grid;
  gap: 3px;
}
.cr-cmd-item.active,
.cr-cmd-item:hover {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(8, 47, 73, 0.56);
}
.cr-cmd-title {
  font-size: 13px;
  font-weight: 700;
  color: #e0f2fe;
}
.cr-cmd-sub {
  font-size: 11px;
  color: #9ec6df;
}
.cr-cmd-empty {
  border: 1px dashed rgba(148, 163, 184, 0.36);
  border-radius: 10px;
  padding: 12px;
  color: #a5c0d7;
  font-size: 12px;
  text-align: center;
  background: rgba(15, 23, 42, 0.45);
}


[data-theme="light"] .kpi-bar,
[data-theme="light"] #control-panel,
[data-theme="light"] .entity-panel,
[data-theme="light"] .bottom-panel,
[data-theme="light"] .leaflet-popup-content-wrapper {
  box-shadow:
    0 12px 34px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(37, 99, 235, 0.1) inset;
}

[data-theme="light"] .kpi-brand-title,
[data-theme="light"] .cp-title,
[data-theme="light"] .entity-panel-title,
[data-theme="light"] .kpi-value {
  color: #0f2f5c !important;
}

[data-theme="light"] .kpi-pill,
[data-theme="light"] .kpi-action-btn,
[data-theme="light"] .popup-psc-btn {
  color: #0f2f5c !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.9), rgba(191, 219, 254, 0.8)) !important;
}

[data-theme="light"] .cp-tab.active,
[data-theme="light"] .btn-primary,
[data-theme="light"] .quick-action-btn {
  color: #f8fbff !important;
  background: linear-gradient(135deg, #2563eb, #0284c7) !important;
}

[data-theme="rose"] .kpi-brand-title,
[data-theme="rose"] .cp-title,
[data-theme="rose"] .entity-panel-title {
  text-shadow: 0 0 12px rgba(244, 114, 182, 0.38);
}

[data-theme="rose"] .kpi-pill.active,
[data-theme="rose"] .cp-tab.active,
[data-theme="rose"] .btn-primary {
  box-shadow: 0 0 0 1px rgba(249, 168, 212, 0.25) inset, 0 0 18px rgba(219, 39, 119, 0.35);
}


/* =======================================================
   INTELLIGENCE WORKSTATION OVERRIDES  - NCA/OSINT Grade UI
   Applied on top of theme system. Priority: intelligence clarity.
   ======================================================= */

/* == KPI Bar: operational dashboard feel == */
body.ux-revamp .kpi-bar {
  height: 48px;
  padding: 0 14px;
  background:
    linear-gradient(180deg, rgba(5, 9, 15, 0.99) 0%, rgba(7, 12, 20, 0.97) 100%);
  border-bottom: 1px solid rgba(14, 165, 233, 0.18);
  box-shadow:
    0 1px 0 rgba(14, 165, 233, 0.06) inset,
    0 2px 20px rgba(0, 0, 0, 0.7);
}

/* Branding: CONTROL ROOM - structured, monospace, no animation */
body.ux-revamp .kpi-brand-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 4px;
  background: none;
  -webkit-text-fill-color: unset;
  color: #22d3ee;
  animation: none;
  font-family: "JetBrains Mono", Bahnschrift, monospace;
}

body.ux-revamp .kpi-brand-sub {
  font-size: 7px;
  color: #2d4a5a;
  letter-spacing: 2px;
  font-family: "JetBrains Mono", monospace;
}

/* KPI metric cards */
body.ux-revamp .kpi-card {
  min-width: 48px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(14, 165, 233, 0.04);
  border: 1px solid rgba(14, 165, 233, 0.1);
}

body.ux-revamp .kpi-value {
  font-size: 13px;
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

body.ux-revamp .kpi-label {
  font-size: 7px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #2d4a5a;
  font-weight: 700;
}

/* Clock - monospace for live data */
body.ux-revamp .kpi-clock {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: #22d3ee;
  letter-spacing: 1px;
}

body.ux-revamp .kpi-coords {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  color: #334e60;
  font-weight: 500;
}

body.ux-revamp .kpi-zoom {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  color: #22d3ee;
  border-color: rgba(14, 165, 233, 0.2);
  background: rgba(14, 165, 233, 0.06);
}

/* Action buttons - functional, not decorative */
body.ux-revamp .kpi-action-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(56, 90, 115, 0.45);
  background: rgba(14, 165, 233, 0.04);
  color: #6a8fa0;
  font-size: 8.5px;
  letter-spacing: 0.6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", Bahnschrift, monospace;
}

body.ux-revamp .kpi-action-btn:hover {
  border-color: rgba(14, 165, 233, 0.45);
  background: rgba(14, 165, 233, 0.09);
  color: #22d3ee;
  transform: none;
  box-shadow: none;
}

/* Intel report action - amber highlight */
body.ux-revamp .kpi-action-intel {
  border-color: rgba(245, 158, 11, 0.3);
  color: #92740a;
}

body.ux-revamp .kpi-action-intel:hover {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
}

/* Help */
body.ux-revamp .kpi-action-help {
  border-color: rgba(100, 116, 139, 0.3);
}

/* Unified Search trigger - elevated priority */
body.ux-revamp #us-trigger-btn {
  border-color: rgba(14, 165, 233, 0.4);
  background: rgba(14, 165, 233, 0.08);
  color: #22d3ee;
  font-weight: 700;
}

body.ux-revamp #us-trigger-btn:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.65);
}

/* Map pill buttons */
body.ux-revamp .kpi-pill {
  height: 20px;
  padding: 0 6px;
  font-size: 8.5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  font-family: "JetBrains Mono", monospace;
}

body.ux-revamp .kpi-pill.active {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.45);
  color: #22d3ee;
}

body.ux-revamp .kpi-separator {
  background: linear-gradient(180deg, transparent, rgba(14, 165, 233, 0.15), transparent);
}

/* == Control panel: sharper == */
body.ux-revamp #control-panel {
  width: 330px;
  border-radius: 6px;
  border-color: rgba(14, 165, 233, 0.2);
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(14, 165, 233, 0.04) inset,
    0 20px 60px rgba(0, 0, 0, 0.75),
    0 0 40px rgba(0, 0, 0, 0.4);
}

/* Panel header */
body.ux-revamp .cp-header {
  padding: 9px 12px;
  border-bottom-color: rgba(14, 165, 233, 0.1);
  background: rgba(4, 9, 16, 0.6);
}

body.ux-revamp .cp-title {
  font-size: 9px;
  letter-spacing: 4px;
  font-family: "JetBrains Mono", monospace;
  background: none;
  -webkit-text-fill-color: unset;
  color: #22d3ee;
  animation: none;
  font-weight: 700;
}

/* Panel tabs */
body.ux-revamp .cp-tabs {
  margin: 0 -12px;
  padding: 0 12px;
  background: rgba(4, 8, 14, 0.5);
  border-bottom-color: rgba(14, 165, 233, 0.1);
}

body.ux-revamp .cp-tab {
  font-size: 9px;
  letter-spacing: 1.2px;
  padding: 8px 4px;
}

body.ux-revamp .cp-tab.active {
  border-bottom-color: #22d3ee;
  color: #22d3ee;
  background: rgba(14, 165, 233, 0.06);
}

/* == Primary search inputs == */
body.ux-revamp #intel-q:focus,
body.ux-revamp #psc_name:focus,
body.ux-revamp #psc_company:focus,
body.ux-revamp #ch_name:focus,
body.ux-revamp #ch_number:focus {
  border-color: rgba(14, 165, 233, 0.55);
  background: rgba(14, 165, 233, 0.07);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

body.ux-revamp #control-panel input[type="text"]:focus {
  border-color: rgba(14, 165, 233, 0.55);
  background: rgba(14, 165, 233, 0.07);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* == Buttons == */
body.ux-revamp .btn-primary {
  background: linear-gradient(135deg, #0369a1 0%, #0891b2 100%);
  color: #e0f7ff;
  font-family: "JetBrains Mono", Bahnschrift, monospace;
  font-size: 9px;
  letter-spacing: 1px;
  box-shadow: none;
  border-radius: 4px;
  border: 1px solid rgba(14, 165, 233, 0.35);
}

body.ux-revamp .btn-primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  transform: none;
  filter: none;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.25);
}

body.ux-revamp .btn-primary:active {
  background: #0369a1;
  transform: none;
}

body.ux-revamp .btn-secondary {
  font-family: "JetBrains Mono", Bahnschrift, monospace;
  font-size: 9px;
  letter-spacing: 0.8px;
  border-radius: 4px;
}

body.ux-revamp .btn-secondary:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(100, 140, 170, 0.35);
  color: var(--ui-text);
}

/* == Result cards - intelligence record style == */
body.ux-revamp .ch-result-item {
  border-radius: 4px;
  border-color: rgba(14, 165, 233, 0.08);
  background: rgba(14, 165, 233, 0.03);
  padding: 8px 10px;
  margin: 2px 0;
}

body.ux-revamp .ch-result-item:hover {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.22);
  transform: translateX(1px);
}

body.ux-revamp .ch-result-item:hover::before {
  background: #22d3ee;
  width: 2px;
}

body.ux-revamp .ch-result-item .ch-r-name {
  font-size: 11.5px;
  font-weight: 700;
  color: #d0e8f4;
  letter-spacing: 0.1px;
}

body.ux-revamp .ch-result-item .ch-r-detail {
  font-size: 9.5px;
  color: #445f74;
  font-family: "JetBrains Mono", monospace;
  margin-top: 2px;
}

body.ux-revamp .ch-result-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  color: #2d7a94;
  letter-spacing: 0.5px;
}

/* OpenSanctions result cards */
body.ux-revamp .os-result-card {
  border-radius: 4px;
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(239, 68, 68, 0.03);
}

body.ux-revamp .os-result-card:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
}

body.ux-revamp .os-name {
  font-size: 11.5px;
  color: #dde8f0;
}

body.ux-revamp .os-schema-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  border-radius: 3px;
}

/* Alert tags - severity hierarchy */
body.ux-revamp .os-tag-sanction {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

body.ux-revamp .os-tag-pep {
  background: rgba(234, 88, 12, 0.18);
  color: #fb923c;
  border: 1px solid rgba(234, 88, 12, 0.28);
}

body.ux-revamp .os-tag-wanted {
  background: rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-weight: 800;
}

body.ux-revamp .os-tag-crime {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.28);
}

/* == Panel disclosure sections == */
body.ux-revamp .panel-disclosure {
  border-radius: 5px;
  border-color: rgba(56, 90, 115, 0.28);
  background: rgba(7, 12, 22, 0.3);
  margin: 5px 0 7px;
}

body.ux-revamp .panel-disclosure > summary {
  padding: 7px 10px;
  background: rgba(8, 14, 24, 0.5);
  font-size: 9px;
  letter-spacing: 1.2px;
  color: #5a7a90;
  border-radius: 4px;
}

body.ux-revamp .panel-disclosure > summary:hover {
  background: rgba(14, 165, 233, 0.06);
  color: #22d3ee;
}

body.ux-revamp .panel-disclosure[open] > summary {
  color: #22d3ee;
  border-bottom-color: rgba(14, 165, 233, 0.12);
  border-radius: 4px 4px 0 0;
}

/* == Help text == */
body.ux-revamp .psc-help-text {
  background: rgba(14, 165, 233, 0.05);
  border-left-color: rgba(14, 165, 233, 0.4);
  color: #3d5f72;
  font-size: 9.5px;
  padding: 6px 8px;
  margin: 6px 0;
}

/* == PSC cards == */
body.ux-revamp .psc-card {
  border-color: rgba(14, 165, 233, 0.1);
  border-radius: 4px;
}

body.ux-revamp .psc-card:hover {
  background: rgba(14, 165, 233, 0.06);
  border-color: rgba(14, 165, 233, 0.22);
}

body.ux-revamp .psc-name {
  color: #93c5e0 !important;
  font-size: 12px;
}

body.ux-revamp .psc-nature-tag {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.2);
  color: #3d9ebb;
}

/* == Bottom panel == */
body.ux-revamp .bottom-panel {
  border-top-color: rgba(14, 165, 233, 0.15);
}

body.ux-revamp .bp-header {
  background: rgba(5, 9, 15, 0.96);
  border-bottom-color: rgba(14, 165, 233, 0.1);
}

body.ux-revamp .bp-tab-btn {
  font-size: 9px;
  letter-spacing: 0.8px;
  font-family: "JetBrains Mono", Bahnschrift, monospace;
}

body.ux-revamp .bp-tab-btn.active {
  color: #22d3ee;
  border-bottom-color: #22d3ee;
}

/* == Progress bar == */
body.ux-revamp .cp-progress {
  background: rgba(14, 165, 233, 0.04);
  border-color: rgba(14, 165, 233, 0.12);
  border-radius: 4px;
}

body.ux-revamp .cp-progress-fill {
  background: linear-gradient(90deg, #0369a1, #22d3ee, #0369a1);
  background-size: 200% 100%;
  box-shadow: 0 0 5px rgba(14, 165, 233, 0.4);
}

body.ux-revamp .cp-progress-label {
  color: #22d3ee;
  font-family: "JetBrains Mono", monospace;
}

/* == Layer section titles == */
body.ux-revamp .layer-section-title {
  color: #2d5068;
  border-bottom-color: rgba(14, 165, 233, 0.08);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 2px;
}

body.ux-revamp .layer-name {
  font-size: 11.5px;
  color: #8aaabb;
}

body.ux-revamp input[type="checkbox"].layer-cb {
  accent-color: #22d3ee;
}

/* == Toast notifications == */
body.ux-revamp .toast-msg {
  font-family: "JetBrains Mono", Bahnschrift, monospace;
  font-size: 10px;
  letter-spacing: 0.3px;
  border-radius: 5px;
}

/* == Entity inspector == */
body.ux-revamp #entity-inspector {
  border-left-color: rgba(14, 165, 233, 0.2);
  background: rgba(5, 9, 16, 0.98);
}

body.ux-revamp .inspector-type-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 1.5px;
  border-radius: 3px;
}

body.ux-revamp .inspector-label {
  font-size: 14px;
  font-weight: 700;
  color: #d8ecf7;
  letter-spacing: 0.1px;
}

body.ux-revamp .inspector-section {
  border-color: rgba(14, 165, 233, 0.1);
}

/* == Unified search == */
body.ux-revamp .us-modal-inner {
  border-color: rgba(14, 165, 233, 0.25);
  border-radius: 8px;
}

body.ux-revamp .us-input {
  font-family: "JetBrains Mono", Bahnschrift, monospace;
  font-size: 14px;
}

body.ux-revamp .us-result-item:hover {
  border-color: rgba(14, 165, 233, 0.3);
}

/* == Map toolbar == */
body.ux-revamp .map-tb-btn {
  border-color: rgba(14, 165, 233, 0.2);
  background: rgba(7, 12, 20, 0.9);
  color: #4a6a80;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.5px;
}

body.ux-revamp .map-tb-btn:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.4);
  color: #22d3ee;
}

body.ux-revamp .map-tb-btn[aria-pressed="true"] {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.6);
  color: #22d3ee;
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.2);
}

/* == Quick-action buttons == */
body.ux-revamp .quick-action-btn {
  border-radius: 4px;
  border-color: rgba(56, 90, 115, 0.3);
  background: rgba(7, 14, 24, 0.4);
  font-size: 10.5px;
}

body.ux-revamp .quick-action-btn:hover {
  background: rgba(14, 165, 233, 0.07);
  border-color: rgba(14, 165, 233, 0.3);
}

body.ux-revamp .quick-action-btn::before {
  background: rgba(14, 165, 233, 0.1);
  color: #22d3ee;
  font-family: "JetBrains Mono", monospace;
  font-size: 7.5px;
}

/* == Panel labels == */
body.ux-revamp #control-panel label:not(.layer-row) {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 1.2px;
  color: #2d5068;
}

/* == Scrollbar == */
body.ux-revamp ::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

body.ux-revamp ::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.15);
  border-radius: 2px;
}

body.ux-revamp ::-webkit-scrollbar-thumb:hover {
  background: rgba(14, 165, 233, 0.3);
}

/* == Status bar == */
body.ux-revamp #status-bar {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.4px;
}

/* == Alert priority classes == */
.intel-priority-critical {
  color: var(--ui-critical);
  border-color: var(--ui-classified-border);
  background: rgba(220, 38, 38, 0.08);
}

.intel-priority-high {
  color: var(--ui-high);
  border-color: rgba(234, 88, 12, 0.4);
  background: rgba(234, 88, 12, 0.06);
}

.intel-priority-medium {
  color: var(--ui-medium);
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.05);
}

.intel-priority-low {
  color: var(--ui-low);
  border-color: rgba(22, 163, 74, 0.3);
  background: rgba(22, 163, 74, 0.05);
}

/* == Focus visible - accessibility == */
body.ux-revamp button:focus-visible,
body.ux-revamp input:focus-visible,
body.ux-revamp select:focus-visible {
  outline: 2px solid rgba(14, 165, 233, 0.7);
  outline-offset: 2px;
}

/* == Alerts KPI card - when alerts > 0 == */
body.ux-revamp #kpi-card-alerts.has-alerts {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  animation: alertPulse 2.5s ease infinite;
}

body.ux-revamp #kpi-card-alerts.has-alerts .kpi-value {
  color: #f87171;
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
  50% { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }
}

/* == Layer status cards == */
body.ux-revamp .layer-status-card {
  border-color: rgba(14, 165, 233, 0.12);
  border-radius: 5px;
  background: rgba(7, 12, 20, 0.5);
}

body.ux-revamp .layer-status-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 1.2px;
  color: #2d5068;
}

body.ux-revamp .layer-status-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  color: #22d3ee;
}

/* == OS detail pills (IMO, ICAO codes) == */
body.ux-revamp .os-detail-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
  background: rgba(7, 14, 22, 0.8);
  border-color: rgba(14, 165, 233, 0.15);
  color: #4a7a90;
}

/* == Theme select == */
body.ux-revamp .kpi-theme-select {
  background: rgba(7, 12, 20, 0.8);
  border-color: rgba(56, 90, 115, 0.35);
  color: #4a6a80;
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
}

/* == Network graph == */
body.ux-revamp .network-graph-container {
  background: rgba(5, 8, 14, 0.98);
}

/* == Intel report overlay == */
body.ux-revamp .intel-report-overlay {
  background: rgba(4, 7, 12, 0.97);
}

/* == Entity inspector attr table - data field style == */
body.ux-revamp .inspector-attr-table td:first-child {
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
  letter-spacing: 0.5px;
  color: #2d5068;
  text-transform: uppercase;
  white-space: nowrap;
}

body.ux-revamp .inspector-attr-table td:last-child {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: #c0d8e4;
}

/* == Summary strip == */
body.ux-revamp .cp-meta-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

body.ux-revamp .cp-meta-chip strong {
  font-family: "JetBrains Mono", monospace;
}

/* == Session badge in panel header == */
.cp-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #22d3ee;
  opacity: 0.6;
  padding: 2px 6px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 3px;
  background: rgba(14, 165, 233, 0.06);
  text-transform: uppercase;
  animation: sessionPulse 3s ease infinite;
}

@keyframes sessionPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}

/* == KPI bar map pill labels == */
body.ux-revamp .kpi-pill-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 7px;
  letter-spacing: 1.5px;
  color: #2d4a5a;
}

/* == Ops source pane: better top spacing == */
body.ux-revamp .ops-source-pane.active {
  padding-top: 2px;
}

/* == Result count styling == */
body.ux-revamp .ch-result-count::before {
  content: "// ";
  opacity: 0.4;
}

/* == Input placeholder == */
body.ux-revamp #control-panel input[type="text"]::placeholder {
  color: #4a7a96;
  font-style: normal;
}

/* == Ensure JetBrains Mono loads on key data fields == */
body.ux-revamp .os-detail-row {
  font-family: "JetBrains Mono", monospace;
}

body.ux-revamp .os-birth {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  color: #2d5068;
}

body.ux-revamp .os-datasets {
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
  color: #1e3448;
}

body.ux-revamp .os-hint {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: #2d4a5a;
}

/* == Places button == */
body.ux-revamp .os-place-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  border-radius: 3px;
  background: rgba(14, 165, 233, 0.1);
  color: #22d3ee;
  border-color: rgba(14, 165, 233, 0.3);
}

body.ux-revamp .os-place-btn:hover {
  background: rgba(14, 165, 233, 0.25);
  color: #7dd3fc;
}

/* == Activity log == */
body.ux-revamp .activity-log-entry {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  border-color: rgba(14, 165, 233, 0.06);
}

body.ux-revamp .activity-log-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 8.5px;
  color: #2d4a5a;
}

/* == Entity type grid == */
body.ux-revamp .entity-type-btn {
  border-radius: 4px;
  border-color: rgba(56, 90, 115, 0.3);
}

body.ux-revamp .entity-type-btn:hover {
  border-color: rgba(14, 165, 233, 0.4);
}

body.ux-revamp .entity-type-btn.active {
  border-color: rgba(14, 165, 233, 0.6);
  background: rgba(14, 165, 233, 0.1);
}

/* == Section headers inside panes == */
body.ux-revamp .us-section-header {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 2px;
  color: #2d4a5a;
}

/* ============================================================
   MOBILE OPTIMISATION
   ============================================================ */

/* -- 920px: Leaflet zoom controls reposition + overscroll -- */
@media (max-width: 920px) {
  .leaflet-top.leaflet-left {
    top: auto !important;
    bottom: 60px !important;
    left: 8px !important;
  }

  .leaflet-control-attribution {
    font-size: 8px !important;
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cp-body,
  #entity-inspector,
  .entity-panel-body,
  .bottom-panel .bp-body {
    overscroll-behavior: contain;
  }

  /* Prevent panel drag fighting with scroll on mobile */
  #control-panel.panel-dragging {
    transform: none !important;
  }
}

/* -- 768px: KPI bar essentials only + bottom panel shrink -- */
@media (max-width: 768px) {
  .kpi-bar {
    overflow: hidden;
  }

  .kpi-pill-group {
    display: none;
  }

  .kpi-brand {
    min-width: 60px;
  }

  /* Bottom panel reduced for mobile */
  .bottom-panel.open {
    height: 180px;
  }

  #map.bp-open {
    height: calc(100dvh - 36px - 180px) !important;
  }

  /* Drag handle on bottom panel */
  .bp-header {
    position: relative;
    padding-top: 14px;
  }

  .bp-header::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
  }
}

/* -- 680px: Source tabs tighter + entity inspector bottom sheet -- */
@media (max-width: 680px) {
  .ops-tab-code {
    display: none;
  }

  .ops-source-tab {
    padding: 5px 3px 4px;
  }

  .ops-tab-label {
    font-size: 8.5px;
  }

  /* Entity inspector → bottom sheet */
  #entity-inspector {
    position: fixed;
    right: 0;
    left: 0;
    top: auto;
    bottom: -100vh;
    width: 100%;
    height: auto;
    max-height: 65vh;
    border-left: none;
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px 16px 0 0;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1300;
    padding: 12px 16px 16px;
  }

  #entity-inspector.open {
    right: 0;
    bottom: 0;
  }

  /* Drag handle for inspector bottom sheet */
  #entity-inspector::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto 8px;
    flex-shrink: 0;
  }

  /* Prevent body scroll propagation */
  #entity-inspector {
    overscroll-behavior: contain;
  }
}

/* -- 480px: Small phone optimisation -- */
@media (max-width: 480px) {
  .kpi-bar {
    height: 32px;
    padding: 0 6px;
  }

  .kpi-card {
    min-width: 32px;
    padding: 1px 4px;
  }

  .kpi-label {
    font-size: 6px;
  }

  .kpi-value {
    font-size: 10px;
  }

  .kpi-brand-text {
    font-size: 10px;
  }

  #control-panel {
    top: 38px !important;
    max-height: 62vh;
  }

  .ops-source-tabs {
    gap: 1px;
    padding: 2px;
  }

  .ops-source-tab {
    padding: 4px 2px 3px;
  }

  .ops-tab-label {
    font-size: 7.5px;
  }

  /* Bottom panel even smaller */
  .bottom-panel.open {
    height: 140px;
  }

  #map.bp-open {
    height: calc(100dvh - 32px - 140px) !important;
  }

  .bp-tab-btn {
    padding: 4px 6px;
    font-size: 7px;
    letter-spacing: 0.3px;
  }

  /* Tighter popups */
  .leaflet-popup-content-wrapper {
    max-width: min(88vw, 320px) !important;
  }

  .leaflet-popup-content {
    margin: 8px 10px !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
  }

  .leaflet-popup-content .popup-btn-row {
    flex-wrap: wrap;
    gap: 3px;
  }

  .leaflet-popup-content .popup-btn-row button {
    font-size: 9px;
    padding: 4px 8px;
    min-height: 30px;
  }

  .entity-popup-shell {
    max-height: 40vh;
  }

  /* Mobile toggle smaller */
  .mobile-panel-toggle {
    min-width: 64px;
    min-height: 36px;
    font-size: 10px;
  }
}

/* =======================================================
   UI Usability Pass (2026-03-01)
   Improves legibility, icon consistency, alignment, and hit targets.
   ======================================================= */
body.ux-revamp .kpi-label {
  font-size: 8px;
  letter-spacing: 0.8px;
  color: #47667a;
}

body.ux-revamp .kpi-action-btn {
  min-height: 28px;
  padding: 0 10px;
  font-size: 9.5px;
  color: #8eb0c2;
}

body.ux-revamp .kpi-action-btn .kpi-btn-icon {
  margin-right: 4px;
  opacity: 0.95;
}

body.ux-revamp .cp-tab {
  min-height: 34px;
  font-size: 10.5px;
  letter-spacing: 0.9px;
  padding: 8px 6px;
}

body.ux-revamp .cp-tab .tab-icon {
  width: 14px;
  height: 14px;
}

body.ux-revamp .ops-source-tabs {
  gap: 4px;
  padding: 4px;
  border-color: rgba(14, 165, 233, 0.14);
}

body.ux-revamp .ops-source-tab {
  min-height: 50px;
  padding: 6px 4px 5px;
  border-radius: 6px;
  border-color: rgba(56, 90, 115, 0.22);
  background: rgba(7, 16, 28, 0.35);
  color: #88a4b5;
}

body.ux-revamp .ops-source-tab:hover {
  border-color: rgba(14, 165, 233, 0.34);
  background: rgba(14, 165, 233, 0.08);
  color: #c8deeb;
}

body.ux-revamp .ops-source-tab.active {
  border-color: rgba(14, 165, 233, 0.5);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.18), rgba(14, 165, 233, 0.08));
  color: #ccf0ff;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.18);
}

body.ux-revamp .ops-tab-label {
  font-size: 9.5px;
  letter-spacing: 0.35px;
}

/* Unify search source icons to SVG masks (replaces emoji variance) */
body.ux-revamp .ops-tab-icon-mask {
  width: 15px;
  height: 15px;
  margin-bottom: 2px;
  background-color: currentColor;
  -webkit-mask-image: var(--ops-icon);
  mask-image: var(--ops-icon);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

body.ux-revamp .ops-source-tab[data-ops-tab="person"] { --ops-icon: url("../gfx/entity_icons/phosphor/user-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="organisation"] { --ops-icon: url("../gfx/entity_icons/phosphor/buildings-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="vessel"] { --ops-icon: url("../gfx/entity_icons/phosphor/anchor-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="aircraft"] { --ops-icon: url("../gfx/entity_icons/phosphor/airplane-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="vehicle"] { --ops-icon: url("../gfx/entity_icons/phosphor/car-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="financial"] { --ops-icon: url("../gfx/entity_icons/phosphor/bank-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="communication"] { --ops-icon: url("../gfx/entity_icons/phosphor/broadcast-light.svg"); }
body.ux-revamp .ops-source-tab[data-ops-tab="location"] { --ops-icon: url("../gfx/entity_icons/phosphor/map-pin-light.svg"); }

body.ux-revamp .panel-disclosure > summary {
  min-height: 32px;
  padding: 8px 10px;
}

body.ux-revamp .layer-row {
  min-height: 34px;
  padding: 6px 2px;
  border-radius: 6px;
}

body.ux-revamp .layer-row:hover {
  opacity: 1;
  background: rgba(14, 165, 233, 0.06);
}

body.ux-revamp .layer-name {
  font-size: 12.5px;
  line-height: 1.25;
  color: #d4e2ea;
  flex: 1;
  min-width: 0;
}

body.ux-revamp .toggle-track {
  width: 36px;
  height: 20px;
}

body.ux-revamp .toggle-thumb {
  width: 16px;
  height: 16px;
}

body.ux-revamp .layer-row input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

body.ux-revamp .map-toolbar {
  left: 14px;
  bottom: 108px;
  gap: 6px;
}

body.ux-revamp .map-tb-btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
  border-color: rgba(56, 90, 115, 0.48);
}

body.ux-revamp .leaflet-control-zoom a {
  min-width: 30px;
  min-height: 30px;
  line-height: 28px !important;
}

body.ux-revamp .mobile-panel-toggle {
  border: 1px solid rgba(14, 165, 233, 0.35);
  background: rgba(7, 18, 30, 0.85);
  color: #cde7f7;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.45);
}

@media (max-width: 920px) {
  body.ux-revamp .kpi-action-btn {
    min-height: 24px;
    padding: 0 8px;
    font-size: 8.5px;
  }

  body.ux-revamp .ops-source-tab {
    min-height: 46px;
  }

  body.ux-revamp .ops-tab-label {
    font-size: 9px;
  }
}

@media (max-width: 680px) {
  body.ux-revamp .ops-source-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }

  body.ux-revamp .ops-source-tab {
    min-height: 44px;
    padding: 5px 3px;
  }

  body.ux-revamp .ops-tab-icon-mask {
    width: 13px;
    height: 13px;
    margin-bottom: 1px;
  }

  body.ux-revamp .ops-tab-label {
    font-size: 8.5px;
  }

  body.ux-revamp .map-toolbar {
    left: auto;
    right: 10px;
    bottom: 90px;
  }
}

/* =======================================================
   Operational optimization pass (2026-03-01)
   - KPI action density control by viewport
   - Accessibility mode (html.cr-a11y)
   ======================================================= */
body.ux-revamp .kpi-actions {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(71, 102, 122, 0.55) transparent;
}

body.ux-revamp .kpi-actions::-webkit-scrollbar {
  height: 5px;
}

body.ux-revamp .kpi-actions::-webkit-scrollbar-thumb {
  background: rgba(71, 102, 122, 0.55);
  border-radius: 999px;
}

body.ux-revamp .kpi-action-btn.active,
body.ux-revamp #kpi-btn-accessibility[aria-pressed="true"] {
  border-color: rgba(125, 211, 252, 0.65);
  background: rgba(14, 165, 233, 0.2);
  color: #e0f7ff;
}

@media (max-width: 1500px) {
  body.ux-revamp .kpi-action-low {
    display: none;
  }
}

@media (max-width: 1220px) {
  body.ux-revamp .kpi-action-med {
    display: none;
  }

  body.ux-revamp #kpi-btn-accessibility {
    display: inline-flex;
  }
}

@media (max-width: 920px) {
  body.ux-revamp #kpi-btn-command,
  body.ux-revamp #kpi-btn-report,
  body.ux-revamp #us-trigger-btn,
  body.ux-revamp #kpi-btn-accessibility,
  body.ux-revamp #kpi-btn-redaction {
    display: inline-flex;
  }

  body.ux-revamp .kpi-actions .kpi-action-btn:not(#kpi-btn-command):not(#kpi-btn-report):not(#us-trigger-btn):not(#kpi-btn-accessibility):not(#kpi-btn-redaction) {
    display: none;
  }
}

@media (max-width: 680px) {
  body.ux-revamp .kpi-grid {
    display: none;
  }

  body.ux-revamp .kpi-actions {
    gap: 4px;
  }

  body.ux-revamp .kpi-action-btn {
    min-height: 28px;
    padding: 0 9px;
    font-size: 9px;
  }
}

/* Accessibility mode: larger targets, stronger contrast, calmer scanning */
html.cr-a11y body.ux-revamp {
  letter-spacing: 0.01em;
}

html.cr-a11y body.ux-revamp .kpi-bar {
  border-bottom-color: rgba(125, 211, 252, 0.36);
}

html.cr-a11y body.ux-revamp .kpi-brand-title,
html.cr-a11y body.ux-revamp .cp-title,
html.cr-a11y body.ux-revamp .entity-panel-title {
  color: #d8f4ff;
}

html.cr-a11y body.ux-revamp .kpi-value {
  font-size: 15px;
  color: #d8f4ff;
}

html.cr-a11y body.ux-revamp .kpi-label {
  font-size: 9px;
  color: #8bb6cc;
}

html.cr-a11y body.ux-revamp .kpi-action-btn,
html.cr-a11y body.ux-revamp .btn-primary,
html.cr-a11y body.ux-revamp .btn-secondary,
html.cr-a11y body.ux-revamp .cp-tab,
html.cr-a11y body.ux-revamp .ops-source-tab,
html.cr-a11y body.ux-revamp .map-tb-btn,
html.cr-a11y body.ux-revamp .mobile-panel-toggle,
html.cr-a11y body.ux-revamp .layer-row,
html.cr-a11y body.ux-revamp .panel-disclosure > summary {
  min-height: 38px;
}

html.cr-a11y body.ux-revamp #control-panel input[type="text"],
html.cr-a11y body.ux-revamp #control-panel input[type="date"],
html.cr-a11y body.ux-revamp #control-panel input[type="time"],
html.cr-a11y body.ux-revamp #control-panel select,
html.cr-a11y body.ux-revamp textarea {
  min-height: 36px;
  font-size: 13px;
  color: #ecfbff;
  border-color: rgba(125, 211, 252, 0.44);
  background: rgba(8, 22, 35, 0.82);
}

html.cr-a11y body.ux-revamp .cp-tab {
  font-size: 11.5px;
}

html.cr-a11y body.ux-revamp .ops-tab-label {
  font-size: 10px;
}

html.cr-a11y body.ux-revamp .layer-name {
  font-size: 13px;
  color: #e2f5ff;
}

html.cr-a11y body.ux-revamp .toggle-track {
  width: 40px;
  height: 22px;
}

html.cr-a11y body.ux-revamp .toggle-thumb {
  width: 18px;
  height: 18px;
}

html.cr-a11y body.ux-revamp .layer-row input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

html.cr-a11y body.ux-revamp .leaflet-popup-content-wrapper {
  border-color: rgba(125, 211, 252, 0.3) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(125, 211, 252, 0.14) inset !important;
}

html.cr-a11y body.ux-revamp .leaflet-popup-content {
  font-size: 13px !important;
  line-height: 1.6 !important;
}

html.cr-a11y body.ux-revamp .leaflet-popup-content strong {
  font-size: 14px;
  color: #f0fbff;
}

html.cr-a11y body.ux-revamp button:focus-visible,
html.cr-a11y body.ux-revamp input:focus-visible,
html.cr-a11y body.ux-revamp select:focus-visible,
html.cr-a11y body.ux-revamp summary:focus-visible,
html.cr-a11y body.ux-revamp .cp-menu-item:focus-visible {
  outline: 3px solid rgba(125, 211, 252, 0.98);
  outline-offset: 2px;
}

@media (max-width: 920px) {
  html.cr-a11y body.ux-revamp .kpi-action-btn,
  html.cr-a11y body.ux-revamp .mobile-panel-toggle {
    min-height: 36px;
  }
}

/* =======================================================
   Intel workflow additions (Evidence / Watchlist / Triage)
   ======================================================= */
.evidence-locker-list,
.watchlist-rules-list,
.triage-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}

.evidence-grid,
.watchlist-grid {
  grid-template-columns: 1fr;
}

.watchlist-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #9bb7cb;
}

.watchlist-inline-toggle input[type="checkbox"] {
  accent-color: #38bdf8;
}

.evidence-row,
.watch-rule,
.triage-row {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(8, 16, 28, 0.5);
  padding: 7px 9px;
  margin-bottom: 6px;
}

.evidence-main,
.watch-rule-main,
.triage-main {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.evidence-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 45px;
  min-height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.evidence-kind-file { color: #a5b4fc; border-color: rgba(129, 140, 248, 0.5); }
.evidence-kind-url { color: #22d3ee; border-color: rgba(34, 211, 238, 0.45); }
.evidence-name { color: var(--ui-text); font-size: 11px; font-weight: 650; }
.evidence-time { color: #64748b; font-size: 9px; margin-left: auto; }
.evidence-meta { display: flex; flex-wrap: wrap; gap: 6px; color: #8aa6bb; font-size: 9px; margin-top: 4px; }
.evidence-notes { color: var(--ui-text-muted); font-size: 10px; margin-top: 4px; line-height: 1.35; }
.evidence-actions { margin-top: 6px; display: flex; justify-content: flex-end; }

#evidence-chain-status.is-warning {
  color: #fda4af;
}

.watch-rule.is-disabled {
  opacity: 0.58;
}

.watch-severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 18px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.42);
}

.watch-severity-critical { color: #fecaca; border-color: rgba(239, 68, 68, 0.58); background: rgba(127, 29, 29, 0.3); }
.watch-severity-high { color: #fdba74; border-color: rgba(249, 115, 22, 0.52); background: rgba(124, 45, 18, 0.28); }
.watch-severity-medium { color: #fde68a; border-color: rgba(250, 204, 21, 0.5); background: rgba(113, 63, 18, 0.25); }
.watch-severity-low { color: #86efac; border-color: rgba(34, 197, 94, 0.45); background: rgba(20, 83, 45, 0.26); }

.watch-pattern { color: var(--ui-text); font-size: 11px; font-weight: 650; }
.watch-scope { color: #8aa6bb; font-size: 9px; }
.watch-notes { color: var(--ui-text-muted); font-size: 10px; margin-top: 4px; line-height: 1.35; }
.watch-meta { color: #64748b; font-size: 9px; margin-top: 4px; }
.watch-actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }

.triage-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(6, 12, 20, 0.42);
  flex-wrap: wrap;
}

.triage-toolbar select,
.triage-toolbar input[type="text"] {
  min-height: 30px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.45);
  color: var(--ui-text);
  font-size: 11px;
  font-family: inherit;
  padding: 4px 8px;
}

.triage-toolbar input[type="text"] {
  min-width: 140px;
  flex: 1;
}

.triage-badge {
  min-width: 84px;
  min-height: 20px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.triage-badge-critical { color: #fecaca; background: rgba(127, 29, 29, 0.35); border: 1px solid rgba(239, 68, 68, 0.56); }
.triage-badge-high { color: #fdba74; background: rgba(124, 45, 18, 0.31); border: 1px solid rgba(249, 115, 22, 0.52); }
.triage-badge-medium { color: #fde68a; background: rgba(113, 63, 18, 0.28); border: 1px solid rgba(250, 204, 21, 0.48); }
.triage-badge-low { color: #86efac; background: rgba(20, 83, 45, 0.28); border: 1px solid rgba(34, 197, 94, 0.42); }

.triage-label { color: var(--ui-text); font-size: 11px; font-weight: 700; }
.triage-type { color: #8aa6bb; font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; }
.triage-meta { display: flex; gap: 8px; flex-wrap: wrap; color: #8aa6bb; font-size: 9px; margin-top: 4px; }
.triage-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.triage-watch { color: #94a3b8; font-size: 10px; line-height: 1.3; flex: 1; }
.triage-watch-none { color: #64748b; }

.triage-risk-critical { border-left: 3px solid rgba(239, 68, 68, 0.72); }
.triage-risk-high { border-left: 3px solid rgba(249, 115, 22, 0.68); }
.triage-risk-medium { border-left: 3px solid rgba(250, 204, 21, 0.62); }
.triage-risk-low { border-left: 3px solid rgba(34, 197, 94, 0.58); }

html.cr-redact-partner body.ux-revamp #kpi-btn-redaction,
html.cr-redact-court body.ux-revamp #kpi-btn-redaction {
  border-color: rgba(125, 211, 252, 0.65);
  background: rgba(14, 165, 233, 0.2);
  color: #e0f7ff;
}

html.cr-redact-court body.ux-revamp #kpi-coords {
  filter: blur(2px);
}

@media (max-width: 680px) {
  .triage-toolbar select,
  .triage-toolbar input[type="text"] {
    width: 100%;
  }

  .triage-sub {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COUNTRY PROFILE PANEL (HOI4-inspired)
   ═══════════════════════════════════════════════════════════════════════════ */
.cp-profile-panel {
  position: fixed;
  right: -420px;
  top: 56px;
  width: 400px;
  height: calc(100vh - 56px - 32px);
  background: rgba(15,23,42,0.97);
  border-left: 1px solid rgba(99,102,241,0.18);
  backdrop-filter: blur(14px);
  z-index: 1250;
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  overflow-x: hidden;
  font-family: Bahnschrift, "Lato", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  color: #e2e8f0;
  scrollbar-width: thin;
  scrollbar-color: rgba(99,102,241,0.25) transparent;
}
.cp-profile-panel.open { right: 0; }
.cp-profile-panel::-webkit-scrollbar { width: 5px; }
.cp-profile-panel::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.25); border-radius: 3px; }

.cp-profile-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(30,41,59,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: color 0.2s, border-color 0.2s;
}
.cp-profile-close:hover { color: #f8fafc; border-color: rgba(99,102,241,0.5); }

/* --- Header Banner --- */
.cp-header-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(99,102,241,0.12);
  background: linear-gradient(135deg, rgba(30,41,59,0.9) 0%, rgba(15,23,42,0.95) 100%);
}
.cp-flag-hero {
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.cp-header-text { flex: 1; min-width: 0; }
.cp-country-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}
.cp-official-name {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Government Badge --- */
.cp-gov-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 0.72rem;
  color: #f59e0b;
  background: rgba(245,158,11,0.08);
  border-bottom: 1px solid rgba(99,102,241,0.08);
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* --- Sections --- */
.cp-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.cp-section:last-child { border-bottom: none; }
.cp-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin: 0 0 8px;
  font-weight: 600;
}

/* --- Leader cards with portraits --- */
.cp-leader-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}
.cp-leader-portrait {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(99,102,241,0.4);
  flex-shrink: 0;
  background: rgba(15,23,42,0.6);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.cp-leader-portrait:hover {
  transform: scale(1.08);
  border-color: rgba(99,102,241,0.8);
}
.cp-leader-portrait-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(99,102,241,0.15);
  border: 2px solid rgba(99,102,241,0.3);
  color: #a78bfa;
  font-size: 1.5rem;
  font-weight: 700;
}
.cp-leader-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cp-leader-title {
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cp-leader-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f8fafc;
  line-height: 1.2;
}
.cp-leader-party {
  color: #a78bfa;
  font-size: 0.68rem;
}
.cp-leader-since {
  font-size: 0.62rem;
  color: #475569;
}
/* Portrait lightbox */
.cp-portrait-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  cursor: pointer;
  animation: cpFadeIn 0.15s ease;
}
.cp-portrait-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  border: 2px solid rgba(99,102,241,0.5);
}
@keyframes cpFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Party pie chart --- */
.cp-party-pie {
  display: block;
  margin: 6px auto 10px;
}
.cp-seats-total {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 4px;
}

/* --- Party list --- */
.cp-party-list { display: flex; flex-direction: column; gap: 3px; }
.cp-party-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  padding: 3px 0;
}
.cp-party-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}
.cp-party-name { flex: 1; color: #e2e8f0; font-weight: 600; }
.cp-party-seats { color: #94a3b8; min-width: 30px; text-align: right; }
.cp-party-pct { color: #64748b; min-width: 36px; text-align: right; }
.cp-party-leader { color: #a78bfa; font-size: 0.65rem; min-width: 70px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Key-value rows --- */
.cp-kv {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.72rem;
}
.cp-k { color: #94a3b8; }
.cp-v { color: #f8fafc; font-weight: 600; text-align: right; }

/* --- Freedom Index Bar --- */
.cp-freedom-bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}
.cp-freedom-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.cp-freedom-label {
  font-size: 0.7rem;
  color: #94a3b8;
}

/* --- Alliance chips (clickable) --- */
.cp-alliance-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cp-alliance-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #c4b5fd;
  background: rgba(99,102,241,0.13);
  border: 1px solid rgba(99,102,241,0.2);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.cp-alliance-chip:hover {
  background: rgba(99,102,241,0.25);
  border-color: rgba(99,102,241,0.45);
  color: #e0d5ff;
}
.cp-alliance-chip.cp-alliance-active {
  background: rgba(34,197,94,0.25);
  border-color: rgba(34,197,94,0.6);
  color: #86efac;
  box-shadow: 0 0 8px rgba(34,197,94,0.3);
}

/* --- Terror Threat Badge --- */
.cp-threat-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.cp-threat-desc {
  font-size: 0.7rem;
  color: #cbd5e1;
  margin-bottom: 2px;
}
.cp-threat-source {
  font-size: 0.62rem;
  color: #64748b;
  font-style: italic;
}

/* --- Active Conflicts --- */
.cp-conflict-row {
  padding: 4px 0;
  border-bottom: 1px solid rgba(148,163,184,0.08);
}
.cp-conflict-row:last-child { border-bottom: none; }
.cp-conflict-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ef4444;
}
.cp-conflict-meta {
  display: block;
  font-size: 0.62rem;
  color: #94a3b8;
}

/* --- Sanctioned highlight --- */
.cp-sanctioned {
  color: #ef4444 !important;
  font-weight: 700;
}

/* --- Notes --- */
.cp-notes p {
  font-size: 0.72rem;
  color: #cbd5e1;
  margin: 0;
  line-height: 1.5;
}

/* --- Mobile responsive --- */
@media (max-width: 768px) {
  .cp-profile-panel {
    width: 100vw;
    right: -100vw;
    top: 0;
    height: 100vh;
    border-left: none;
  }
}

/* --- UX Revamp theme overrides --- */
body.ux-revamp .cp-profile-panel {
  border-left-color: rgba(99,102,241,0.25);
  box-shadow: -4px 0 20px rgba(0,0,0,0.25);
}

/* ═══════════════════════════════════════════════════════════════════════
   INTEL PRESETS BAR — one-click scenario activation
   ═══════════════════════════════════════════════════════════════════════ */
.intel-presets {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(99,102,241,0.12);
}
.intel-presets-label {
  font-size: 9px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 2px;
}
.intel-preset-btn {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(99,102,241,0.25);
  background: rgba(15,23,42,0.6);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}
.intel-preset-btn:hover {
  background: rgba(99,102,241,0.15);
  color: #c7d2fe;
  border-color: rgba(99,102,241,0.4);
}
.intel-preset-btn.active {
  background: rgba(99,102,241,0.25);
  color: #e0e7ff;
  border-color: #6366f1;
  box-shadow: 0 0 6px rgba(99,102,241,0.3);
}

.intel-pane-intro {
  margin-bottom: 6px;
}

.intel-pane-copy {
  margin-bottom: 6px;
}

.intel-search-row {
  gap: 6px;
  margin-top: 4px;
}

.intel-count {
  min-height: 16px;
  font-size: 10px;
}

.intel-quick-row,
.intel-workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.intel-mini-btn {
  padding: 3px 8px;
  border-radius: 10px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: rgba(2, 132, 199, 0.12);
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.intel-mini-btn:hover {
  background: rgba(14, 165, 233, 0.22);
  border-color: rgba(56, 189, 248, 0.45);
  color: #cffafe;
}

.intel-mini-btn-ghost {
  border-color: rgba(71, 85, 105, 0.55);
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
}

.intel-workbench-head {
  margin-bottom: 8px;
  padding: 8px 8px 6px;
  border: 1px solid rgba(15, 77, 120, 0.5);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(2, 22, 42, 0.75), rgba(2, 6, 23, 0.6));
}

.intel-workbench-title {
  margin-bottom: 4px;
  font-weight: 700;
  color: #cbd5e1;
}

.intel-workbench-subtitle {
  margin-bottom: 7px;
}

#intel-pane-status {
  min-height: 14px;
  margin-top: 6px;
  font-size: 10px;
}

#intel-source-bar.us-source-bar {
  margin-bottom: 4px !important;
  min-height: 0 !important;
}

#osint-ops-block .intel-section {
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════
   LOCATION PANE — section divider between UK and Global layers
   ═══════════════════════════════════════════════════════════════════════ */
.location-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 0 4px;
}
.location-section-divider::before,
.location-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(99,102,241,0.3), transparent);
}
.location-section-divider span {
  font-size: 9px;
  font-weight: 700;
  color: #6366f1;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════
   RSS INTELLIGENCE FEEDS — catalog browser
   ═══════════════════════════════════════════════════════════════════════ */
.rss-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 0 2px;
}
.rss-cat-header {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  padding: 8px 4px 3px;
  border-bottom: 1px solid rgba(99,102,241,0.1);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.rss-cat-count {
  font-weight: 400;
  color: #64748b;
  font-size: 9px;
}
.rss-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 6px;
  margin: 1px 0;
  border-radius: 4px;
  text-decoration: none;
  color: #cbd5e1;
  font-size: 11px;
  transition: background 0.12s ease;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.rss-feed-item:hover {
  background: rgba(99,102,241,0.1);
  border-left-color: #6366f1;
}
.rss-feed-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rss-feed-badges {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
}
.rss-tier-badge {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: #1e293b;
  color: #64748b;
}
.rss-tier-badge.rss-t1 { background: rgba(34,197,94,0.2); color: #4ade80; }
.rss-tier-badge.rss-t2 { background: rgba(59,130,246,0.2); color: #60a5fa; }
.rss-tier-badge.rss-t3 { background: rgba(148,163,184,0.15); color: #94a3b8; }
.rss-lang-badge {
  font-size: 8px;
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(249,115,22,0.2);
  color: #fb923c;
}
.rss-state-badge {
  font-size: 7px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(239,68,68,0.25);
  color: #f87171;
  letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════════════════════════
   MAP DROP ZONE — drag files onto map for document ingestion
   ═══════════════════════════════════════════════════════════════════════ */
.map-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 9999;
  background: rgba(15,23,42,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  border: 3px dashed rgba(99,102,241,0.5);
  border-radius: 8px;
  margin: 8px;
}
.map-drop-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.map-drop-inner {
  text-align: center;
  color: #c7d2fe;
}
.map-drop-icon {
  font-size: 48px;
  margin-bottom: 8px;
  filter: grayscale(0.5);
}
.map-drop-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.map-drop-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

/* =====================================================
   iOS / MOBILE COMPREHENSIVE FIXES
   Accounts for: Dynamic Island, notch, home indicator,
   touch targets, input zoom, safe areas, panel UX
   ===================================================== */

/* 1 ─ KPI bar: expand into safe area so content clears the notch/Dynamic Island */
.kpi-bar {
  padding-top: env(safe-area-inset-top);
  height: calc(42px + env(safe-area-inset-top));
  box-sizing: content-box;
}

/* 2 ─ Map + entity panel: shift down by the expanded KPI bar height */
#map {
  top: calc(42px + env(safe-area-inset-top)) !important;
  height: calc(100dvh - 42px - env(safe-area-inset-top)) !important;
}
.entity-panel { top: calc(54px + env(safe-area-inset-top)) !important; }
#map.bp-open {
  height: calc(100dvh - 42px - env(safe-area-inset-top) - 320px) !important;
}

/* 3 ─ Control panel: stay below expanded KPI bar */
#control-panel {
  top: calc(54px + env(safe-area-inset-top)) !important;
  max-height: calc(100dvh - 60px - env(safe-area-inset-top)) !important;
}

/* 4 ─ Bottom panel: clear home indicator */
.bottom-panel {
  padding-bottom: env(safe-area-inset-bottom);
}
@media (max-width: 768px) {
  #map.bp-open {
    height: calc(100dvh - 36px - env(safe-area-inset-top) - 240px) !important;
  }
}

/* 5 ─ Mobile panel toggle: fixed so it never scrolls offscreen */
@media (max-width: 920px) {
  .mobile-panel-toggle {
    position: fixed !important;
    bottom: max(12px, env(safe-area-inset-bottom) + 8px) !important;
    right: max(12px, env(safe-area-inset-right) + 8px) !important;
  }

  /* Control panel on mobile: anchor from bottom so thumb can reach it */
  #control-panel {
    top: auto !important;
    bottom: max(62px, env(safe-area-inset-bottom) + 56px) !important;
    left: max(9px, env(safe-area-inset-left)) !important;
    width: calc(100vw - max(18px, env(safe-area-inset-left) + env(safe-area-inset-right) + 18px)) !important;
    max-height: min(72dvh, calc(100dvh - 130px - env(safe-area-inset-top) - env(safe-area-inset-bottom))) !important;
  }

  /* Hidden state: slide DOWN off the bottom edge */
  #control-panel.mobile-hidden {
    transform: translateY(calc(100dvh + 40px)) !important;
  }
}

/* 6 ─ Prevent iOS Safari auto-zoom on input focus (requires ≥ 16px) */
@media (max-width: 920px) {
  #control-panel input[type="text"],
  #control-panel input[type="search"],
  #control-panel input[type="email"],
  #control-panel input[type="number"],
  #control-panel input[type="date"],
  #control-panel input[type="time"],
  #control-panel select,
  #control-panel textarea,
  .leaflet-control input,
  .search-input,
  .intel-q {
    font-size: 16px !important;
  }
}

/* 7 ─ KPI action buttons: hide low-priority ones on small screens */
@media (max-width: 920px) {
  .kpi-action-low  { display: none !important; }
  .kpi-action-med  { display: none !important; }
  .kpi-zoom        { display: none; }
  .kpi-separator:not(:first-of-type) { display: none; }
  .kpi-bar {
    height: calc(36px + env(safe-area-inset-top));
    gap: 4px;
  }
  /* Map: recalc for the shorter 36px mobile KPI bar */
  #map {
    top: calc(36px + env(safe-area-inset-top)) !important;
    height: calc(100dvh - 36px - env(safe-area-inset-top)) !important;
  }
  #control-panel {
    top: calc(48px + env(safe-area-inset-top)) !important;
  }
  .entity-panel { top: calc(48px + env(safe-area-inset-top)) !important; }
}

/* 8 ─ Momentum scrolling on iOS for panel body */
.cp-body,
.entity-panel-body,
.intel-results-inline,
#intel-results,
#ch_results,
#psc_results {
  -webkit-overflow-scrolling: touch;
}

/* 9 ─ Leaflet popup: larger close button + safe popup width on mobile */
@media (max-width: 920px) {
  .leaflet-popup-close-button {
    width: 40px !important;
    height: 40px !important;
    font-size: 22px !important;
    line-height: 40px !important;
    right: 0 !important;
    top: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .leaflet-popup-content-wrapper {
    max-width: min(94vw, 350px) !important;
  }
  .leaflet-popup-content {
    margin: 10px 14px 10px 12px !important;
  }
}

/* 10 ─ Ops-source-tabs: horizontal scroll without wrapping on small screens */
@media (max-width: 680px) {
  .ops-source-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .ops-source-tabs::-webkit-scrollbar { display: none; }
  .ops-source-tab {
    flex: 0 0 auto;
    min-width: 52px;
  }
  .intel-presets {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .intel-presets::-webkit-scrollbar { display: none; }
  .intel-preset-btn {
    flex: 0 0 auto;
  }
}

/* 11 ─ Toast stack: clear home indicator */
@media (max-width: 920px) {
  .toast-stack {
    bottom: max(62px, env(safe-area-inset-bottom) + 58px) !important;
  }
}

/* 12 - Migration intelligence controls: compact + readable on mobile */
#migration-route-stats,
#migration-origin-stats,
#migration-dtm-stats,
#migration-dtm-top {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 680px) {
  #control-panel [data-layer-tools="migration"] .psc-filter-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  #control-panel [data-layer-tools="migration"] .psc-filter-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  #control-panel [data-layer-tools="migration"] #mig-time-play.btn-sm {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 11px;
  }
  #control-panel [data-layer-tools="migration"] #mig-time-label {
    display: block;
    width: 100%;
    margin-top: 2px !important;
    font-size: 11px;
    line-height: 1.3;
  }
  #control-panel [data-layer-tools="migration"] #mig-time-year {
    min-height: 28px;
  }
  #control-panel [data-layer-tools="migration"] .psc-help-text {
    font-size: 11px;
  }
}
