:root {
  /* EMHARE Light Theme - Default */
  --bg-deep: #f4f6f9;
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f0f0f0;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f9f9;
  --border: #e0e0e0;
  
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-muted: #777777;
  
  --accent-blue: #003366; /* EMHARE Navy */
  --accent-green: #22c55e;
  --accent-emerald: #10b981;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;
  --accent-teal: #14b8a6;
  
  --sidebar-w: 240px;
  --header-h: 54px;
  --radius: 4px; /* Squarer look */
  --glow-b: none;
  --glow-g: none;
}

[data-theme="dark"] {
  /* EMHARE Navy Dark Theme - Optional Fallback */
  --bg-deep: #000c1a;
  --bg-primary: #001933;
  --bg-secondary: #002244;
  --bg-tertiary: #003366;
  --bg-card: #002b5e;
  --bg-card-hover: #003d82;
  --border: #004080;
  --text-primary: #f0f4f8;
  --text-secondary: #b3cce6;
  --text-muted: #6699cc;
  --accent-blue: #F59D1F; /* EMHARE Orange */
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg-deep); color: var(--text-primary); height: 100dvh; overflow: hidden; }

/* Google Sign-In Button */
.btn-google {
  width: 100%;
  padding: 10px 15px;
  background: white;
  color: #757575;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  margin-bottom: 15px;
}

.btn-google:hover {
  background: #f5f5f5;
  border-color: #c1c7d0;
  box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.1), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
}

.btn-google:active {
  background: #e8eaed;
}

/* ═══════════ LOGIN ═══════════ */
#loginScreen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 32px 16px;
  background: #f4f6f9; /* Off-white background */
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#loginScreen.out { opacity: 0; pointer-events: none; transform: scale(1.08); }

/* Decorative top bar */
#loginScreen::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 12px;
  background: linear-gradient(90deg, #F59D1F 0%, #F59D1F 75%, #003366 75%, #003366 100%);
  z-index: 1;
}

.login-card-simple {
  position: relative; z-index: 10;
  background: #ffffff;
  width: 100%; max-width: 600px;
  border-radius: 6px;
  border-top: 5px solid #003366; /* Thick blue border on top */
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  padding: 40px 60px;
  margin: auto;
  animation: cardIn 0.8s cubic-bezier(0.19,1,0.22,1);
}
@keyframes cardIn { from { opacity:0; transform: translateY(40px) scale(0.96); } }

.emhare-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #003366;
  margin-bottom: 30px;
  letter-spacing: 0.5px;
}

.fg-simple {
  margin-bottom: 20px;
}
.fg-simple label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  color: #333333;
  margin-bottom: 6px;
}
.fg-simple input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  color: #333333;
  transition: border-color 0.2s;
  outline: none;
}
.fg-simple input:focus {
  border-color: #003366;
}
.fg-simple input::placeholder {
  color: #aaaaaa;
}
.emhare-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  color: #333333;
  outline: none;
  background: #ffffff;
}
.remember-emhare {
  margin-bottom: 20px;
  font-size: 13px;
  color: #333333;
}
.remember-emhare label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.remember-emhare input[type="checkbox"] {
  accent-color: #003366;
  width: 15px;
  height: 15px;
}

.btn-emhare {
  width: 100%;
  padding: 14px;
  background-color: #003366;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  transition: background-color 0.2s;
}
.btn-emhare:hover {
  background-color: #001933;
}

.login-nb {
  margin-top: 25px;
  text-align: center;
  font-size: 12px;
  color: #555555;
}
.login-nb strong {
  font-weight: bold;
  color: #000;
}
.login-nb a {
  color: #003366;
  text-decoration: none;
  font-weight: bold;
}
.login-nb a:hover {
  text-decoration: underline;
}

.login-error {
  display: none; padding: 10px 14px; border-radius: 4px; margin-bottom: 16px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
  color: var(--accent-red); font-size: 13px;
}
.login-error.show { display: block; animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* ═══════════ APP SHELL ═══════════ */
#appShell { display: flex; height: calc(100dvh - 31px); /* Clear the footer line entirely */ opacity: 0; transition: opacity 0.6s ease; pointer-events: none; }
#appShell.on { opacity: 1; pointer-events: auto; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w); background: #ffffff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; z-index: 200;
}
.sidebar::after { display: none; }
.sb-header {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 11px;
  background: var(--accent-blue); /* #003366 */
  color: #fff; border-radius: 4px 4px 0 0;
}
.sb-logo { display: none; }
.sb-title h3 { font-size: 14px; font-weight: bold; letter-spacing: 0.5px; text-transform: uppercase; }
.sb-title span { display: none; }

.sb-nav { flex: 1; overflow-y: auto; padding: 0; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--border); }

.nav-group { margin-bottom: 0; }
.nav-group-label { display: none; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 20px; cursor: pointer;
  font-size: 13px; font-weight: bold; color: var(--accent-blue);
  transition: all 0.1s; margin-bottom: 0;
  border-bottom: 1px solid #f0f0f0; border-radius: 0; background: #fff;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.nav-link:hover { background: #f9f9f9; }
.nav-link.active {
  background: #f4f6f9; color: var(--accent-blue);
}
.nav-link.active::before { display: none; }
.nav-link .ni { display: none; }
.nav-link .badge {
  margin-left: auto; font-size: 10px; padding: 2px 8px;
  border-radius: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
}
.badge.live { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.badge.warn { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.badge.crit { background: rgba(239,68,68,0.12); color: var(--accent-red); }

.sb-user {
  margin: 0 16px 20px 16px; /* Moved slightly above and clear */
  padding: 12px 14px; 
  border-radius: 10px;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 11px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.sb-user-info .uname { font-size: 13px; font-weight: 550; }
.sb-user-info .urole { font-size: 11px; color: var(--text-muted); }

/* ─── MAIN ─── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-primary); }

/* ─── HEADER ─── */
.top-bar {
  min-height: var(--header-h); padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border); background: var(--bg-secondary);
  flex-shrink: 0; transition: min-height 0.3s;
}
.tb-left { display: flex; align-items: center; gap: 14px; }
.tb-left h2 { font-size: 16px; font-weight: 650; }
.tb-left .crumb { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.live-tag {
  display: flex; align-items: center; gap: 7px; padding: 5px 14px;
  border-radius: 20px; background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.18);
  font-size: 11px; color: var(--accent-green); font-weight: 600;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-green); animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.search-box {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px;
  border-radius: 8px; background: var(--bg-tertiary); border: 1px solid var(--border); width: 200px;
}
.search-box input {
  border: none; background: transparent; color: var(--text-primary);
  font-size: 13px; font-family: inherit; outline: none; width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.hdr-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); font-size: 15px; transition: all 0.15s;
  position: relative;
}
.hdr-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.hdr-btn .notif { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-red); }

/* ─── PAGES ─── */
.page { display: none; flex: 1; overflow-y: auto; overflow-x: hidden; }
.page.active { display: flex; flex-direction: column; }
.page::-webkit-scrollbar { width: 5px; }
.page::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.pg-pad { padding: 22px 26px; display: flex; flex-direction: column; gap: 20px; }

/* ─── STAT CARDS ─── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  padding: 20px; border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all 0.25s; cursor: default; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.stat-card:hover { border-color: rgba(59,130,246,0.2); transform: translateY(-2px); box-shadow: var(--glow-b); }
.stat-card:hover::before { opacity: 1; }
.sc-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; margin-bottom: 14px;
}
.sc-icon.b { background: rgba(59,130,246,0.1); }
.sc-icon.g { background: rgba(34,197,94,0.1); }
.sc-icon.a { background: rgba(245,158,11,0.1); }
.sc-icon.c { background: rgba(6,182,212,0.1); }
.sc-icon.r { background: rgba(239,68,68,0.1); }
.sc-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.sc-value { font-size: 28px; font-weight: 800; font-family: 'JetBrains Mono', monospace; letter-spacing: -1px; }
.sc-change {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  margin-top: 8px; padding: 3px 10px; border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
}
.sc-change.up { background: rgba(34,197,94,0.1); color: var(--accent-green); }
.sc-change.dn { background: rgba(239,68,68,0.1); color: var(--accent-red); }
.sc-change.neut { background: rgba(59,130,246,0.1); color: var(--accent-blue); }

/* ─── PANELS ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 .full { grid-column: 1 / -1; }

.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-top: 2px solid var(--accent-blue);
  border-radius: var(--radius); padding: 0; overflow: hidden;
}
.panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: rgba(0, 51, 102, 0.05); border-bottom: 1px solid var(--border);
  margin-bottom: 0px;
}
.panel-hdr h3 { font-size: 14px; font-weight: bold; color: var(--accent-blue); text-transform: uppercase; }
.panel-badge {
  font-size: 10px; padding: 3px 10px; border-radius: 10px; font-weight: 700;
  background: var(--accent-blue); color: #fff;
}

/* ─── SCROLLABLE CONTENT ─── */
.panel-scroll-content {
  max-height: 600px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-blue) rgba(0,0,0,0.03);
}
.panel-scroll-content::-webkit-scrollbar {
  width: 6px;
}
.panel-scroll-content::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.03);
}
.panel-scroll-content::-webkit-scrollbar-thumb {
  background: var(--accent-blue);
  border-radius: 10px;
}
.panel-scroll-content::-webkit-scrollbar-thumb:hover {
  background: #001933;
}

/* ─── NEWS SEARCH ─── */
.news-search-box {
  flex: 1;
  max-width: 350px;
  margin: 0 20px;
  position: relative;
}
.news-search-box input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  border: 1px solid rgba(0,51,102,0.15);
  border-radius: 20px;
  font-size: 12px;
  background: rgba(255,255,255,0.8);
  color: var(--accent-blue);
  outline: none;
  transition: all 0.2s;
}
.news-search-box input:focus {
  background: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0,51,102,0.05);
}
.news-search-box::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.6;
  pointer-events: none;
}

/* ─── TABLES ─── */
.dtable { width: 100%; border-collapse: collapse; }
.dtable th {
  text-align: left; font-size: 11px; font-weight: bold;
  color: #fff; background: var(--accent-blue);
  text-transform: uppercase; padding: 12px; border: 1px solid #fff;
}
.dtable td { padding: 12px; font-size: 13px; color: #333; border: 1px solid var(--border); background: #fff; }
.dtable tbody tr:hover td { background: #f4f6f9; }
.mono { font-family: inherit; font-weight: 500; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 700;
}
.pill.ok { background: rgba(34,197,94,0.1); color: var(--accent-green); }
.pill.warn { background: rgba(245,158,11,0.1); color: var(--accent-amber); }
.pill.crit { background: rgba(239,68,68,0.1); color: var(--accent-red); }
.pill.info { background: rgba(59,130,246,0.1); color: var(--accent-blue); }

/* ─── ALERTS ─── */
.wb-date-input {
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  font-family: 'Segoe UI', sans-serif;
  font-size: 13px;
  outline: none;
}
.wb-apply-btn {
  background: #005c99; color: #fff;
  border: none; padding: 6px 16px; border-radius: 4px;
  font-weight: 600; cursor: pointer; font-family: 'Segoe UI', sans-serif;
  transition: background 0.2s;
}
.wb-apply-btn:hover { background: #004675; }

.alert-card {
  display: flex; gap: 14px; padding: 14px; border-radius: 10px;
  margin-bottom: 8px; border: 1px solid; transition: transform 0.15s;
}
.alert-card:hover { transform: translateX(4px); }
.alert-card.critical { background: rgba(239,68,68,0.04); border-color: rgba(239,68,68,0.12); }
.alert-card.warning { background: rgba(245,158,11,0.04); border-color: rgba(245,158,11,0.12); }
.alert-card.info { background: rgba(59,130,246,0.04); border-color: rgba(59,130,246,0.12); }
.ac-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.alert-card.critical .ac-icon { background: rgba(239,68,68,0.12); }
.alert-card.warning .ac-icon { background: rgba(245,158,11,0.12); }
.alert-card.info .ac-icon { background: rgba(59,130,246,0.12); }
.ac-body .ac-title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.ac-body .ac-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.ac-body .ac-meta { font-size: 10.5px; color: var(--text-muted); margin-top: 5px; font-family: 'JetBrains Mono', monospace; }

/* ─── BAR CHART ─── */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 0 6px; }
.bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; gap: 5px; }
.bar {
  width: 100%; border-radius: 5px 5px 0 0; min-width: 22px;
  transition: height 0.8s cubic-bezier(0.34,1.56,0.64,1); cursor: pointer; position: relative;
}
.bar:hover { filter: brightness(1.25); }
.bar-val { font-size: 10px; color: var(--text-secondary); font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.bar-lbl { font-size: 9.5px; color: var(--text-muted); font-weight: 500; }

.ndvi-gradient { height: 10px; border-radius: 5px; margin-top: 10px; background: linear-gradient(90deg, #d73027, #fc8d59, #fee08b, #d9ef8b, #91cf60, #1a9850); }
.ndvi-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* ─── WATER GAUGES ─── */
.gauge-row { display: flex; flex-direction: column; gap: 16px; }
.gauge-item label { display: flex; justify-content: space-between; margin-bottom: 5px; }
.gauge-item label span:first-child { font-size: 12.5px; color: var(--text-secondary); }
.gauge-item label span:last-child { font-size: 12.5px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.gauge-track { width: 100%; height: 26px; border-radius: 13px; background: var(--bg-tertiary); overflow: hidden; position: relative; }
.gauge-fill { height: 100%; border-radius: 13px; transition: width 1.2s cubic-bezier(0.34,1.56,0.64,1); position: relative; }
.gauge-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), transparent);
  border-radius: 13px;
}
.gauge-fill.water { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); }
.gauge-fill.mixed { background: linear-gradient(90deg, var(--accent-amber), var(--accent-cyan)); }
.gauge-fill.low { background: linear-gradient(90deg, var(--accent-red), var(--accent-amber)); }
.gauge-fill.high { background: linear-gradient(90deg, var(--accent-blue), var(--accent-emerald)); }

/* ─── MAP ─── */
.map-wrap { flex: 1; position: relative; min-height: 500px; background: var(--bg-deep); }
#worldMap { width: 100%; height: 100%; position: absolute; inset: 0; }
.map-ctrls {
  position: absolute; top: 14px; left: 14px; z-index: 10;
  display: flex; flex-direction: column; gap: 6px;
}
.map-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(0,25,51,0.9); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); font-size: 16px;
  backdrop-filter: blur(12px); transition: all 0.15s; font-family: 'JetBrains Mono';
}
.map-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

/* LEAFLET OVERRIDES */
.leaflet-container { background: var(--bg-deep) !important; font-family: 'Outfit', sans-serif !important; }
.leaflet-popup-content-wrapper { background: var(--bg-secondary) !important; color: var(--text-primary) !important; border: 1px solid var(--border); border-radius: 10px; }
.leaflet-popup-tip { background: var(--bg-secondary) !important; border: 1px solid var(--border); }
.leaflet-popup-close-button { color: var(--text-muted) !important; }
.leaflet-control-zoom { border: none !important; box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; }
.leaflet-control-zoom a { background: var(--bg-secondary) !important; color: var(--text-primary) !important; border-bottom: 1px solid var(--border) !important; }
.leaflet-control-zoom a:hover { color: var(--accent-blue) !important; }

.map-chips {
  position: absolute; top: 14px; left: 64px; z-index: 10; display: flex; gap: 6px;
}
.chip {
  padding: 7px 16px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--bg-secondary); border: 1px solid var(--border);
  cursor: pointer; color: var(--text-secondary); transition: all 0.15s;
  backdrop-filter: blur(12px);
}
.chip.on { background: rgba(245,157,31,0.15); border-color: var(--accent-blue); color: var(--accent-blue); }
.chip:hover { border-color: var(--accent-blue); }

.map-legend-box {
  position: absolute; bottom: 14px; left: 14px; z-index: 10;
  background: rgba(7,13,27,0.92); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
}
.map-legend-box h4 { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; font-weight: 700; }
.lg-item { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.lg-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255,255,255,0.1); }

.map-detail {
  position: absolute; top: 14px; right: 14px; z-index: 10; width: 310px;
  background: var(--bg-secondary); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; max-height: calc(100% - 28px); overflow-y: auto;
}
.map-detail h3 { font-size: 15px; font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.md-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.md-row:last-child { border-bottom: none; }
.md-row .md-l { font-size: 12.5px; color: var(--text-secondary); }
.md-row .md-v { font-size: 13px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }

/* ─── FARM CARDS ─── */
.tab-bar { display: flex; gap: 3px; margin-bottom: 18px; }
.tab-btn {
  padding: 8px 18px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-secondary);
  font-size: 12.5px; font-weight: 550; cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.tab-btn.active { background: rgba(59,130,246,0.1); color: var(--accent-blue); }
.tab-btn:hover { background: rgba(255,255,255,0.03); }

.farm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.farm-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; cursor: pointer; transition: all 0.25s;
}
.farm-card:hover { border-color: rgba(34,197,94,0.25); transform: translateY(-3px); box-shadow: var(--glow-g); }
.fc-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.fc-hdr h4 { font-size: 14px; font-weight: 650; }
.fc-status { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; }
.fc-status.healthy { color: var(--accent-green); }
.fc-status.stressed { color: var(--accent-amber); }
.fc-status.critical { color: var(--accent-red); }

.ndvi-bar-wrap { margin-bottom: 14px; }
.ndvi-bar-wrap .ndvi-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.ndvi-prog { display: flex; align-items: center; gap: 10px; }
.ndvi-track { flex: 1; height: 8px; border-radius: 4px; background: var(--bg-tertiary); overflow: hidden; }
.ndvi-fill { height: 100%; border-radius: 4px; transition: width 1s ease-out; }
.ndvi-val { font-size: 14px; font-weight: 800; font-family: 'JetBrains Mono', monospace; min-width: 38px; text-align: right; }

.fm-row { display: flex; gap: 8px; }
.fm-box {
  flex: 1; padding: 10px; border-radius: 8px;
  background: rgba(255,255,255,0.015); border: 1px solid rgba(255,255,255,0.03);
}
.fm-box .fm-l { font-size: 9.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.fm-box .fm-v { font-size: 16px; font-weight: 800; font-family: 'JetBrains Mono', monospace; margin-top: 3px; }

/* ─── MODULE PLACEHOLDER ─── */
.module-hero {
  padding: 60px 24px; text-align: center; color: var(--text-secondary);
}
.module-hero .mh-icon { font-size: 56px; margin-bottom: 16px; display: block; }
.module-hero h3 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.module-hero p { font-size: 14px; max-width: 560px; margin: 0 auto; line-height: 1.7; }

/* ─── TOOLTIP ─── */
.ttp {
  position: fixed; z-index: 99999; padding: 8px 14px; max-width: 220px;
  background: rgba(7,13,27,0.95); border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; color: var(--text-primary);
  pointer-events: none; opacity: 0; transition: opacity 0.12s;
  backdrop-filter: blur(12px); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.ttp.on { opacity: 1; }

/* ─── RESPONSIVE ─── */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } .farm-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .login-card { flex-direction: column; max-width: 480px; }
  .login-hero { padding: 32px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .farm-grid { grid-template-columns: 1fr; }
  .map-detail { width: 240px; }
  .map-chips { flex-wrap: wrap; max-width: calc(100% - 80px); }
}
@media (max-width: 600px) { .stats-grid { grid-template-columns: 1fr; } }

/* ─── WAF.EO LOGO ─── */
.waf-logo-box {
  display: flex; align-items: center; background: #1a1e26;
  border-radius: 6px; border: 1px solid rgba(255,255,255,0.1); overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2); height: 38px;
}
.sidebar .waf-logo-box {
  background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.waf-logo-box span {
  display: inline-flex; align-items: center; justify-content: center;
  height: 100%; padding: 0 12px; font-size: 20px; font-weight: 800;
  border-right: 1px solid rgba(255,255,255,0.06); font-family: 'Outfit', sans-serif;
  color: #fff;
}
.sidebar .waf-logo-box span {
  border-right: 1px solid #e2e8f0;
}
.waf-logo-box span:last-child { border-right: none; }

/* ─── Brand: logo image to the LEFT of the WAFEO pill ─── */
.waf-brand { display: inline-flex; align-items: center; gap: 12px; }
.waf-logo-img {
  height: 46px; width: auto; display: block; object-fit: contain;
  background: #ffffff; border-radius: 8px; padding: 6px 8px;
}
/* Dashboard sidebar (240px) — shrink so the brand fits fully and is not clipped */
.sidebar .sb-header { overflow: visible; padding-left: 14px; padding-right: 10px; }
.sidebar .waf-brand { gap: 8px; transform: translateX(4px); }
.sidebar .waf-logo-img {
  height: 32px; padding: 4px 6px; border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.sidebar .waf-logo-box { transform: none !important; height: 32px; }
.sidebar .waf-logo-box span { padding: 0 7px; font-size: 15px; }

/* ─── NDVI / LSTM forecast panel ─── */
.fc-run-btn {
  background: linear-gradient(135deg, var(--accent-emerald, #10b981), #0b8043);
  color: #fff; border: none; border-radius: 6px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity .2s;
}
.fc-run-btn:hover { opacity: .9; }
.fc-run-btn:disabled { opacity: .55; cursor: progress; }
.fc-card {
  background: var(--bg-deep, #f1f5f9); border-radius: 8px; padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
}
.fc-card .fc-label { font-size: 11px; color: var(--text-muted, #94a3b8); text-transform: uppercase; letter-spacing: .4px; }
.fc-card .fc-value { font-size: 20px; font-weight: 700; margin-top: 4px; }
.fc-up { color: #10b981; } .fc-down { color: #ef4444; } .fc-neutral { color: var(--accent-blue, #003366); }

/* ─── Report: AI narrative + saved records ─── */
.report-narrative { font-size: 13px; line-height: 1.7; color: var(--text-secondary, #475569); white-space: normal; }
.report-narrative h4 { color: var(--accent-blue, #003366); margin: 12px 0 4px; font-size: 14px; }
.saved-report-row {
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:10px 12px; border:1px solid var(--border,#e2e8f0); border-radius:6px; margin-bottom:8px; font-size:12px;
}

/* ─── Terms of Use summary on the login homepage ─── */
.login-terms {
  margin-top: 18px; padding: 14px 16px; border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px; background: #f8fafc; text-align: left;
  font-size: 11.5px; line-height: 1.5; color: #4b5563;
}
.login-terms strong { display: block; margin-bottom: 8px; color: var(--accent-blue, #003366); font-size: 12px; letter-spacing: .3px; }
.login-terms ul { margin: 0; padding-left: 18px; }
.login-terms li { margin-bottom: 6px; }
.login-terms a { color: var(--accent-blue, #003366); font-weight: 700; }

/* ─── Terms of Service modal ─── */
.terms-card { max-width: 640px; width: 92%; max-height: 84vh; display: flex; flex-direction: column; }
.terms-body { overflow-y: auto; padding-right: 6px; text-align: left; }
.terms-body h3 { font-size: 14px; font-weight: 700; color: var(--accent-blue, #003366); margin: 14px 0 4px; }
.terms-body p { font-size: 12.5px; line-height: 1.6; color: #4b5563; margin: 0 0 6px; }
.terms-body .terms-meta { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }

.waf-w { color: #0a6952 !important; }
.waf-a { color: #538116 !important; }
.waf-f { color: #b97416 !important; }
.waf-e { color: #8cb6df !important; }
.waf-o { color: #9bbbd5 !important; }

/* ─── GOOGLE MAPS CONTROLS ─── */
.gmap-ctrls {
  display: flex; font-family: Roboto, Arial, sans-serif;
  box-shadow: rgba(0,0,0,0.3) 0px 1px 4px; border-radius: 2px; background: #fff;
}
.g-btn {
  position: relative; cursor: pointer; color: #565656; font-size: 11px; font-weight: 500;
}
.g-btn-main {
  padding: 9px 13px; transition: background 0.1s; display: flex; align-items: center; justify-content: center;
}
.g-btn:hover .g-btn-main, .g-btn-dropdown label:hover {
  background: #f8f8f8; color: #333;
}
.g-btn.active .g-btn-main {
  color: #000; font-weight: 600;
}
.g-btn-dropdown {
  display: none; position: absolute; top: 100%; left: 0; background: #fff;
  box-shadow: rgba(0,0,0,0.2) 0px 2px 4px; border: 1px solid #e6e6e6; border-top: none;
  min-width: 100%; white-space: nowrap; margin-top: 0px; box-sizing: border-box; padding: 4px 0;
}
.g-btn:hover .g-btn-dropdown {
  display: block;
}
.g-btn-dropdown label {
  display: flex; align-items: center; gap: 8px; padding: 6px 13px; cursor: pointer; color: #333; font-weight: 400; user-select: none;
}
.g-btn-dropdown input {
  margin: 0; cursor: pointer; accent-color: #1a73e8;
}

/* ─── AI ASSISTANT CHAT UI ─── */
.chat-msg {
  display: flex; gap: 12px; max-width: 85%;
}
.chat-msg.bot {
  align-self: flex-start;
}
.chat-msg.user {
  align-self: flex-end; flex-direction: row-reverse;
}
.cm-avatar {
  width: 36px; height: 36px; background: #e3ebf3; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.user .cm-avatar {
  background: var(--accent-blue); color: #fff;
}
.cm-bubble {
  background: #fff; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border); font-size: 14px; line-height: 1.5; color: var(--text-primary); box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.user .cm-bubble {
  background: var(--accent-blue); color: #fff; border-color: var(--accent-blue);
}
.chat-msg.typing .cm-bubble {
  color: #888; font-style: italic;
}

/* ─── FLOATING AI WIDGET ─── */
#aiWidgetContainer {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.ai-fab {
  background: #252625;
  border-radius: 40px;
  border: 1px solid #444;
  display: flex;
  align-items: center;
  padding: 6px 16px 6px 6px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-fab:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}
.fab-icon-box {
  display: flex;
  align-items: center;
  margin-right: 12px;
}
.fab-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}
.fab-ask {
  color: #6aca89;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 3px;
}
.fab-wafeo {
  display: flex;
  align-items: center;
}
.fw-waf {
  color: #6aca89;
  font-size: 18px;
  font-weight: 900;
  margin-right: 3px;
}
.fw-eo {
  color: #72aeff;
  font-size: 18px;
  font-weight: 900;
  margin-right: 6px;
}
.fw-ai {
  background: #323f4b;
  color: #88beff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
}
#aiWidgetPanel {
  width: 380px;
  height: 550px;
  max-height: 80vh;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  transform-origin: bottom right;
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── CONTINENT SELECTOR ─── */
.continent-selector {
  display: none; /* toggled by JS */
  align-items: center;
  gap: 20px;
  padding: 5px 0;
}

.cont-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 0.2s;
  animation: floatBump 4s ease-in-out infinite;
}

/* Add slight delay offsets so they don't bounce identically at the same time */
.cont-box:nth-child(1) { animation-delay: 0.1s; }
.cont-box:nth-child(2) { animation-delay: 0.3s; }
.cont-box:nth-child(3) { animation-delay: 0.5s; }
.cont-box:nth-child(4) { animation-delay: 0.2s; }
.cont-box:nth-child(5) { animation-delay: 0.4s; }

.cont-box:hover {
  transform: scale(1.1) translateY(-2px);
  animation-play-state: paused;
}

@keyframes floatBump {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

.cont-ico {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e3ebf3, #ffffff);
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1), inset 0 2px 4px rgba(255,255,255,0.8);
  margin-bottom: 6px;
  transition: all 0.3s;
  position: relative;
}

/* Metallic styling logic for the icons */
.ico-asia { border-color: #0a6952; box-shadow: 0 4px 10px rgba(10,105,82,0.2); }
.ico-africa { border-color: #b97416; box-shadow: 0 4px 10px rgba(185,116,22,0.2); }
.ico-namerica { border-color: #538116; box-shadow: 0 4px 10px rgba(83,129,22,0.2); }
.ico-samerica { border-color: #2d6a1e; box-shadow: 0 4px 10px rgba(45,106,30,0.2); }
.ico-antarctica { border-color: #64b5f6; box-shadow: 0 4px 10px rgba(100,181,246,0.2); }
.ico-europe { border-color: #8cb6df; box-shadow: 0 4px 10px rgba(140,182,223,0.2); }
.ico-oceania { border-color: #9bbbd5; box-shadow: 0 4px 10px rgba(155,187,213,0.2); }

.cont-box:hover .cont-ico {
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}
.cont-box.active .cont-ico {
  border-width: 3px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

.cont-lbl {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1;
  text-shadow: 0px 1px 2px rgba(0,0,0,0.1);
  white-space: nowrap;
}

.cont-sub {
  font-size: 8px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  margin-top: 2px;
  letter-spacing: 0.3px;
  opacity: 0.8;
}

.continent-selector {
  gap: 14px;
}

/* Notification badge */
#notifBadge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ═══════════════ FIXED FOOTER BAR ═══════════════ */
.platform-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 24px;
  background: #ffffff;
  border-top: 3px solid;
  border-image: linear-gradient(90deg, #e63946, #f4a261, #2a9d8f, #264653) 1;
  font-size: 12px;
  color: #555;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.footer-left, .footer-right { flex: 1 1 0; }
.footer-right { text-align: right; }
.footer-left {
  font-size: 11px;
  color: #888;
  letter-spacing: 0.5px;
}
.footer-left strong {
  color: #333;
  font-weight: 700;
}

.footer-center {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.footer-sep {
  color: #ccc;
  margin: 0 2px;
}

.footer-right {
  font-size: 11px;
  color: #888;
}

[data-theme="dark"] .platform-footer {
  background: #001222;
  border-image: linear-gradient(90deg, #e63946, #f4a261, #2a9d8f, #264653) 1;
}
[data-theme="dark"] .footer-left { color: #6699cc; }
[data-theme="dark"] .footer-left strong { color: #b3cce6; }
[data-theme="dark"] .footer-center { color: #b3cce6; }
[data-theme="dark"] .footer-sep { color: #336699; }
[data-theme="dark"] .footer-right { color: #6699cc; }

/* Adjust login screen to not be hidden behind footer */
#loginScreen { padding-bottom: 32px; }

/* ═══════════════ REGISTRATION MODAL ═══════════════ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show {
  display: flex;
}
.modal-card {
  background: var(--bg-primary, #fff);
  padding: 28px 32px;
  border-radius: 12px;
  width: 420px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease-out;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-card .fg-simple {
  margin-bottom: 12px;
}

.register-error {
  background: #fef2f2;
  color: #dc2626;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  display: none;
  border: 1px solid #fecaca;
}
.register-error.show {
  display: block;
}

.register-success {
  background: #f0fdf4;
  color: #16a34a;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  border: 1px solid #bbf7d0;
}

/* ═══════════════ ADMIN USER PROFILES ═══════════════ */
.user-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.user-profile-card:hover {
  background: var(--bg-card-hover);
}
.user-profile-card:last-child {
  border-bottom: none;
}
.upc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.upc-info {
  flex: 1;
  min-width: 0;
}
.upc-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}
.upc-email {
  font-size: 11px;
  color: var(--text-muted);
}
.upc-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.upc-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.upc-badge.admin { background: #dc2626; }
.upc-badge.farmer { background: #16a34a; }
.upc-badge.policy { background: #7c3aed; }
.upc-badge.researcher { background: #0891b2; }
/* ─── DEDICATED SITE INTELLIGENCE PAGE ─── */
.si-tab-btn { background: none; border: none; padding: 12px 24px; font-weight: 600; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all 0.2s; font-size: 15px; }
.si-tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.si-map-btn { background: none; border: none; padding: 8px 16px; font-weight: 600; cursor: pointer; color: var(--text-muted); }
.si-map-btn.active { background: var(--accent-blue); color: #fff; }
.si-map-panel.mode-3d #siMapWrapper { transform: perspective(1200px) rotateX(60deg) scale(1.4) translateY(-15%); }

.si-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.02); display: flex; flex-direction: column; gap: 8px; }
.si-card-hdr { display: flex; justify-content: space-between; align-items: center; }
.si-card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-dark); font-size: 14px;}
.si-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--text-muted); }
.si-badge { font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.si-badge.concern { background: #fee2e2; color: #b91c1c; }
.si-badge.watch { background: #fef3c7; color: #b45309; }
.si-badge.optimal { background: #d1fae5; color: #047857; }
.si-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.si-compare-item { border-left: 3px solid var(--accent-blue); padding-left: 16px; }
.si-compare-item.negative { border-left-color: var(--accent-red); }
.si-compare-item.positive { border-left-color: var(--accent-green); }
.si-compare-title { font-weight: 600; margin-bottom: 4px; font-size: 14px;}
.si-compare-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.si-reg-item { border: 1px solid var(--border); border-radius: 6px; padding: 12px; }
.si-reg-title { font-weight: 600; display:flex; justify-content:space-between; font-size:14px; margin-bottom: 6px;}
.si-reg-status.compliant { color: var(--accent-green); }
.si-reg-status.warning { color: var(--accent-amber); }

@keyframes scanSweep {
  0% { top: 0; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}


:root.dark-theme {
  --bg-primary: #0f111a;
  --bg-secondary: #1a1d2d;
  --bg-tertiary: #24283b;
  --text-primary: #c0caf5;
  --text-secondary: #a9b1d6;
  --text-muted: #565f89;
  --border: #292e42;
  --bg-light: #16161e;
  --accent-blue: #7aa2f7;
}


/* ─── WAFEO REPORT MODAL & SPLIT SLIDER ─── */
.wafeo-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85); z-index: 9999;
  display: flex; justify-content: center; align-items: center;
  backdrop-filter: blur(8px);
  padding: 20px;
}
.report-content {
  background: var(--bg-surface);
  border-radius: 12px;
  width: 100%; max-width: 900px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.report-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-deep);
}
.rh-logo {
  background: var(--accent-emerald); color: #fff;
  font-weight: 800; font-size: 14px; padding: 4px 10px;
  border-radius: 4px; letter-spacing: 1px;
}
.report-header h2 { margin: 0; font-size: 18px; color: var(--text-primary); flex: 1; }
.close-report { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; transition: color 0.2s; }
.close-report:hover { color: var(--accent-red); }

.report-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
.report-summary h3 { margin: 0 0 8px 0; color: var(--text-primary); font-size: 16px; }
.report-summary p { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

/* Tabs */
.report-tabs { display: flex; gap: 10px; border-bottom: 2px solid var(--border); padding-bottom: 10px; }
.rt-btn {
  background: none; border: none; padding: 8px 16px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-radius: 6px; transition: all 0.2s;
}
.rt-btn:hover { background: var(--bg-deep); color: var(--text-primary); }
.rt-btn.active { background: var(--accent-emerald); color: #fff; }

/* Split Slider */
.split-slider-container {
  position: relative;
  width: 100%;
  height: 400px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
  user-select: none;
}
.ss-img {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; object-fit: cover;
  pointer-events: none;
}
.ss-img-over-wrapper {
  position: absolute; top: 0; left: 0;
  width: 50%; height: 100%;
  overflow: hidden;
  border-right: 3px solid #fff;
  box-shadow: 2px 0 15px rgba(0,0,0,0.5);
  pointer-events: none;
}
.ss-img-over { width: 100vw; max-width: 850px; } /* Must match container width */

.ss-range {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: ew-resize;
  z-index: 10;
}
.ss-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px;
  transform: translateX(-50%);
  pointer-events: none; z-index: 5;
}
.ss-handle-button {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; color: #000;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
  font-size: 12px; font-weight: bold; font-family: monospace;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
.ss-label {
  position: absolute; bottom: 16px;
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 6px 12px; border-radius: 4px; font-size: 12px; font-weight: 600;
  backdrop-filter: blur(4px); pointer-events: none;
}
.ss-label-left { left: 16px; }
.ss-label-right { right: 16px; }

/* Data Grid */
.report-data-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.rd-box { background: var(--bg-deep); padding: 16px; border-radius: 8px; text-align: center; border: 1px solid var(--border); }
.rd-box h4 { margin: 0 0 8px 0; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.rd-val { font-size: 24px; font-weight: 700; }
.rd-val.negative { color: var(--accent-red); }
.rd-val.positive { color: var(--accent-emerald); }
.rd-val.warning { color: var(--accent-orange); }


/* ═══════════════ LIVE SATELLITE SITE ANALYSIS (eo.js) ═══════════════ */
.eo-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-top: 4px; }
.eo-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.eo-seg-btn { background: #fff; border: 0; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-muted); }
.eo-seg-btn + .eo-seg-btn { border-left: 1px solid var(--border); }
.eo-seg-btn.active { background: var(--accent-blue); color: #fff; }
.eo-radius { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.eo-radius select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; }
.eo-draw-actions { display: inline-flex; gap: 6px; }
.eo-btn { background: #3F8F3A; color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.eo-btn:hover { background: #347a30; }
.eo-btn:disabled { opacity: 0.6; cursor: progress; }
.eo-btn-ghost { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 12px; cursor: pointer; color: var(--text-dark); }
.eo-hint { font-size: 12px; color: var(--text-muted); flex: 1 1 260px; }
.eo-hint-error { color: #b91c1c; font-weight: 600; }
.si-badge.neutral { background: #eef1f4; color: #4b5563; }
.eo-overall { border-left: 4px solid #3F8F3A; }
.eo-overall.eo-watch { border-left-color: #E8A33A; }
.eo-overall.eo-concern { border-left-color: #C9463D; }
.eo-headline { font-size: 14px; font-weight: 600; color: var(--text-dark); line-height: 1.5; }
.eo-score { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.eo-score-bar { flex: 1; height: 6px; border-radius: 6px; background: #eef1f4; overflow: hidden; }
.eo-score-bar i { display: block; height: 100%; background: linear-gradient(90deg, #C9463D, #E8A33A 50%, #3F8F3A); }
.eo-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-top: 4px; }
.eo-kv div { display: flex; flex-direction: column; font-size: 11px; color: var(--text-muted); min-width: 0; }
.eo-kv b { font-size: 13px; color: var(--text-dark); overflow-wrap: anywhere; }
.eo-h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-blue); }
.eo-h4:first-child { margin-top: 0; }
.eo-evidence { margin-top: 4px; font-size: 11px; color: var(--text-muted); font-style: italic; }
.eo-details { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.eo-details summary { padding: 8px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.eo-table-wrap { overflow-x: auto; }
.eo-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.eo-table td, .eo-table th { padding: 6px 12px; border-top: 1px solid var(--border); text-align: left; vertical-align: top; }
.eo-table td:last-child { font-weight: 600; color: var(--text-dark); }
.eo-table th { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.eo-guide + .eo-guide { margin-top: 6px; }
.eo-actions { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.eo-action { font-size: 13px; color: var(--text-dark); line-height: 1.5; }
.eo-why { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.eo-note { font-size: 11.5px; color: var(--text-muted); margin-top: 14px; font-style: italic; }
.eo-sources .si-reg-item { margin-bottom: 8px; }
.eo-context { margin-bottom: 16px; padding: 14px 16px; }
.eo-context-hdr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 13px; color: var(--text-dark); margin-bottom: 10px; }
.eo-context-meta { font-size: 12px; color: var(--text-muted); }
.eo-context a { color: var(--accent-blue); font-weight: 600; }
.eo-context-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.eo-context-empty { font-size: 13px; color: var(--text-muted); }
.eo-issue-list { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--text-dark); }
/* Site Intelligence never wider than the screen (the map was cut off on the right). */
#pg-site-intelligence .pg-pad { width: 100%; min-width: 0; box-sizing: border-box; }
#pg-site-intelligence .pg-pad > *, #pg-site-intelligence .si-content-area > * { min-width: 0; }
#pg-site-intelligence .site-intel-header { box-sizing: border-box; max-width: 100%; }
#pg-site-intelligence .site-intel-header > div:first-child { flex-wrap: wrap; gap: 12px; }
#pg-site-intelligence .site-search-wrapper { width: min(260px, 100%) !important; }
#pg-site-intelligence .si-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
#pg-site-intelligence .si-tab-btn { white-space: nowrap; flex: none; }
#pg-site-intelligence .si-content-area { min-height: 500px; }
#pg-site-intelligence .si-map-panel { min-height: 480px; }
@media (max-width: 900px) {
  /* Stacked: map on top, results below, and the page scrolls (the results
     panel used to be squeezed to nothing inside a fixed-height page). */
  #pg-site-intelligence .pg-pad { height: auto !important; }
  #pg-site-intelligence .si-content-area { flex-direction: column; flex: none !important; min-height: 0; }
  #pg-site-intelligence .si-map-panel { flex: none !important; height: 380px; min-height: 380px; }
  #pg-site-intelligence .si-data-panel { width: 100% !important; flex: none; height: auto; overflow: visible !important; }
}

/* ═══════════════ LIVE PAGES (pages.js) ═══════════════ */
.lv-host { display: flex; flex-direction: column; gap: 16px; }
.lv-sitebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.lv-site-now { flex: 1 1 100%; font-size: 13px; color: var(--text-secondary); }
.lv-site-now b { color: var(--text-primary); }
.lv-link { background: none; border: 0; color: var(--accent-blue); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 6px; }
.lv-link:hover { text-decoration: underline; }
.lv-search { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 520px; }
.lv-search input { flex: 1 1 240px; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; background: var(--bg-primary); color: var(--text-primary); }
.lv-search select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; background: var(--bg-primary); color: var(--text-primary); }
.lv-btn { background: #3F8F3A; color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lv-btn:hover { background: #347a30; }
.lv-btn:disabled, .lv-btn-ghost:disabled { opacity: 0.6; cursor: progress; }
.lv-btn-ghost { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-primary); }
.lv-view { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.lv-view button { background: var(--bg-primary); border: 0; padding: 7px 14px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted); }
.lv-view button.on { background: var(--accent-blue); color: #fff; }
.lv-progress { flex: 1 1 100%; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.lv-progress.lv-error { color: #b91c1c; font-weight: 600; }
.lv-spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: #3F8F3A; border-radius: 50%; animation: lvspin 0.8s linear infinite; flex: none; }
@keyframes lvspin { to { transform: rotate(360deg); } }

.lv-plain { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); border-left: 5px solid #9ca3af; background: var(--bg-primary); }
.lv-plain.lv-good { border-left-color: #2f8f46; }
.lv-plain.lv-watch { border-left-color: #e8a33a; }
.lv-plain.lv-bad { border-left-color: #c9463d; }
.lv-plain-icon { font-size: 20px; line-height: 1; }
.lv-plain-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.lv-plain-text { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-top: 2px; }

.lv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.lv-card { background: var(--bg-primary); border: 1px solid var(--border); border-top: 4px solid #9ca3af; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lv-card.lv-good { border-top-color: #2f8f46; }
.lv-card.lv-watch { border-top-color: #e8a33a; }
.lv-card.lv-bad { border-top-color: #c9463d; }
.lv-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lv-card-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.lv-info { background: none; border: 1px solid var(--border); border-radius: 50%; width: 22px; height: 22px; font-size: 12px; line-height: 1; cursor: pointer; color: var(--text-muted); flex: none; }
.lv-info:hover, .lv-info[aria-expanded="true"] { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.lv-card-value { font-size: 24px; font-weight: 700; color: var(--text-primary); overflow-wrap: anywhere; }
.lv-card-value small { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.lv-card-plain { font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); }
.lv-card-tech { font-size: 12px; line-height: 1.5; color: var(--text-secondary); background: var(--bg-deep); border-radius: 6px; padding: 8px; }
body.lv-expert .lv-card-tech { display: block !important; }
.lv-expert-only { display: none; }
body.lv-expert .lv-expert-only { display: block; }
.lv-tech { font-size: 12px; color: var(--text-secondary); background: var(--bg-deep); border-radius: 6px; padding: 8px 10px; margin-top: 10px; font-family: 'JetBrains Mono', ui-monospace, monospace; }

.lv-panel { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; min-width: 0; }
.lv-panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--accent-blue); }
.lv-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.lv-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 8px 0 0; }
.lv-chart { position: relative; height: 280px; }
.lv-chart-sm { height: 220px; }
.lv-map { height: 300px; border-radius: 8px; overflow: hidden; }

.lv-actions .lv-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lv-tabs button { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text-primary); }
.lv-tabs button span { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--border); font-size: 11px; margin-left: 4px; }
.lv-tabs button.on { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.lv-tabs button.on span { background: rgba(255, 255, 255, 0.25); }
.lv-action-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--text-primary); }
.lv-why { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lv-action-list li.lv-sev-critical::marker, .lv-action-list li.lv-sev-high::marker { color: #c9463d; font-weight: 700; }
.lv-action-list li.lv-sev-medium::marker { color: #e8a33a; font-weight: 700; }

.lv-issues { display: flex; flex-direction: column; gap: 8px; }
.lv-issue { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--bg-deep); font-size: 13px; line-height: 1.5; color: var(--text-primary); }
.lv-evidence { font-size: 11.5px; color: var(--text-muted); font-style: italic; margin-top: 2px; }
.lv-chip { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 8px; border-radius: 999px; background: #eef1f4; color: #4b5563; white-space: nowrap; }
.lv-chip.lv-sev-critical { background: #7f1d1d; color: #fff; }
.lv-chip.lv-sev-high { background: #fee2e2; color: #b91c1c; }
.lv-chip.lv-sev-medium { background: #fef3c7; color: #b45309; }
.lv-chip.lv-sev-low { background: #e0f2fe; color: #0369a1; }
.lv-chip.lv-sev-info, .lv-chip.lv-src-live { background: #d1fae5; color: #047857; }
.lv-chip.lv-src-unavailable { background: #fef3c7; color: #b45309; }
.lv-chip.lv-src-failed { background: #fee2e2; color: #b91c1c; }
.lv-ok { font-size: 13px; color: #047857; background: #ecfdf5; border-radius: 8px; padding: 10px 12px; }

.lv-science { border: 1px dashed var(--border); border-radius: 10px; padding: 10px 14px; background: var(--bg-primary); }
.lv-science summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent-blue); }
.lv-table-wrap { overflow-x: auto; margin-top: 10px; }
.lv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lv-table th, .lv-table td { text-align: left; padding: 6px 10px; border-top: 1px solid var(--border); vertical-align: top; color: var(--text-primary); }
.lv-table th { font-size: 11px; text-transform: uppercase; color: var(--text-muted); }
.lv-tech-cell { color: var(--text-muted); font-size: 11.5px; min-width: 220px; }
.lv-sources { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--text-secondary); }

.lv-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--bg-deep); }
.lv-bar i { display: block; height: 100%; font-style: normal; }
.lv-bar-tall { height: 34px; }
.lv-bar-tall i { display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.lv-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--text-secondary); }
.lv-legend i, .lv-map-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lv-ph { position: relative; padding-top: 26px; }
.lv-ph-bar { height: 14px; border-radius: 7px; background: linear-gradient(90deg, #c9463d 0%, #e8a33a 25%, #2f8f46 45%, #2f8f46 70%, #5db8da 100%); }
.lv-ph-mark { position: absolute; top: 0; transform: translateX(-50%); text-align: center; font-size: 13px; }
.lv-ph-mark::after { content: ""; display: block; width: 3px; height: 26px; background: var(--text-primary); margin: 2px auto 0; border-radius: 2px; }
.lv-ph-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.lv-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.lv-meter { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.lv-meter-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.lv-meter-bar { position: relative; height: 12px; border-radius: 6px; margin: 14px 0 6px; background: linear-gradient(90deg, #c9463d, #e8a33a 35%, #2f8f46 60%, #5db8da); }
.lv-meter-bar i { position: absolute; top: -5px; width: 6px; height: 22px; border-radius: 3px; background: var(--text-primary); transform: translateX(-50%); }
.lv-meter-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); }
.lv-meter-value { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-top: 4px; }
.lv-zones { display: flex; flex-direction: column; gap: 8px; }
.lv-zone { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--bg-deep); border-left: 4px solid #9ca3af; font-size: 13px; color: var(--text-primary); }
.lv-zone.lv-good { border-left-color: #2f8f46; }
.lv-zone.lv-watch { border-left-color: #e8a33a; }
.lv-zone.lv-bad { border-left-color: #c9463d; }
.lv-zone-v { font-size: 22px; font-weight: 700; min-width: 56px; text-align: center; }

.lv-first { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.lv-first-item { background: var(--bg-deep); border-radius: 8px; padding: 12px; font-size: 13.5px; line-height: 1.5; color: var(--text-primary); border-left: 4px solid #9ca3af; }
.lv-first-item.lv-sev-critical, .lv-first-item.lv-sev-high { border-left-color: #c9463d; }
.lv-first-item.lv-sev-medium { border-left-color: #e8a33a; }
.lv-first-item.lv-sev-info, .lv-first-item.lv-sev-low { border-left-color: #2f8f46; }
.lv-first-who { font-weight: 700; margin-bottom: 4px; }
.lv-hazards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-primary); }
.lv-hazards a { color: var(--accent-blue); }
.lv-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

.lv-ipc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lv-ipc { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 8px; min-width: 150px; color: #1f2937; }
.lv-ipc b { font-size: 16px; }
.lv-ipc small { font-size: 11px; opacity: 0.85; }
.lv-ipc-1 { background: #cdfacd; }
.lv-ipc-2 { background: #fae61e; }
.lv-ipc-3 { background: #e67800; color: #fff; }
.lv-ipc-4 { background: #c80000; color: #fff; }
.lv-ipc-5 { background: #640000; color: #fff; }
.lv-arrow { font-size: 20px; color: var(--text-muted); }

.lv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.lv-kpi { text-align: left; background: var(--bg-primary); border: 1px solid var(--border); border-top: 4px solid #9ca3af; border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; color: var(--text-primary); transition: transform 0.2s, box-shadow 0.2s; }
.lv-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); }
.lv-kpi span { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); }
.lv-kpi b { font-size: 17px; }
.lv-kpi small { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
.lv-kpi.lv-good { border-top-color: #2f8f46; }
.lv-kpi.lv-watch { border-top-color: #e8a33a; }
.lv-kpi.lv-bad { border-top-color: #c9463d; }

.lv-empty { text-align: center; padding: 34px 20px; background: var(--bg-primary); border: 1px dashed var(--border); border-radius: 12px; color: var(--text-secondary); }
.lv-empty-icon { font-size: 40px; }
.lv-empty h3 { color: var(--text-primary); margin: 10px 0 6px; font-size: 17px; }
.lv-empty p { max-width: 640px; margin: 0 auto; font-size: 13.5px; line-height: 1.6; }

.lv-map-toggle { display: flex; align-items: center; gap: 6px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; font-size: 12px; font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); cursor: pointer; color: var(--text-primary); }
.lv-map-legend { position: absolute; bottom: 20px; left: 20px; z-index: 1000; background: var(--bg-primary); padding: 12px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); border: 1px solid var(--border); font-size: 12px; color: var(--text-primary); display: flex; flex-direction: column; gap: 4px; }
.lv-map-legend h4 { margin: 0 0 4px; font-size: 13px; }
.lv-map-hint { margin-top: 4px; color: var(--text-muted); font-style: italic; }
.lv-popup { font-size: 13px; line-height: 1.5; }
.lv-popup .lv-btn { margin-top: 8px; padding: 6px 10px; font-size: 12px; }
@media (max-width: 700px) {
  .lv-search { flex: 1 1 100%; }
  .lv-chart { height: 230px; }
  .lv-map-legend { display: none; }
}

/* ═══ SVG icons (Lucide) ═══════════════════════════════════════ */
[hidden] { display: none !important; }
svg.lucide { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.15em; }
.nav-link .ni { display: inline-flex; width: 20px; justify-content: center; margin-right: 10px; color: var(--text-muted); }
.nav-link .ni svg.lucide { width: 17px; height: 17px; }
.nav-link.active .ni { color: var(--accent-blue); }
.hdr-btn svg.lucide { width: 16px; height: 16px; }
button.hdr-btn { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; }
.cm-avatar svg.lucide { width: 16px; height: 16px; }
.panel-hdr h3, .si-card-title, .eo-h4, .lv-science summary, .lv-ok, .lv-tabs button, .lv-link, .lv-btn, .lv-btn-ghost, .eo-btn, .eo-seg-btn, .fc-run-btn, .lv-first-who { display: inline-flex; align-items: center; gap: 6px; }
.lv-hazards li svg.lucide { margin: 0 2px; color: var(--text-muted); }
.lv-plain-icon svg.lucide { width: 26px; height: 26px; color: #3F8F3A; }
.lv-empty-icon svg.lucide { width: 44px; height: 44px; color: #3F8F3A; }
.lv-info { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.lv-info svg.lucide { width: 13px; height: 13px; }
.upc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.spin { animation: wafeoSpin 0.9s linear infinite; }
@keyframes wafeoSpin { to { transform: rotate(360deg); } }

/* ═══ Header: demo pill ════════════════════════════════════════ */
.demo-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; background: #FFF4CC; color: #6b4e00; border: 1px solid #F2D27A; border-radius: 999px; padding: 5px 6px 5px 12px; }
.demo-pill[hidden] { display: none; }
.demo-pill button { background: #3F8F3A; color: #fff; border: 0; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-demo { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; margin-bottom: 18px; border-radius: 6px; border: 1px solid #E8C04A; background: #FFF8DD; color: #5a4300; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.btn-demo:hover { background: #FFEFB0; }
@media (max-width: 760px) { .demo-pill { font-size: 0; gap: 0; padding: 4px; } .demo-pill svg { display: none; } .demo-pill button { font-size: 12px; } }

/* ═══ World atlas map (dashboard) ══════════════════════════════ */
.atlas { position: relative; height: clamp(460px, 68vh, 760px); margin-bottom: 24px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border);
  background: radial-gradient(120% 90% at 50% 40%, #f3f8fc 0%, #dce9f3 55%, #c8dae8 100%); box-shadow: 0 10px 30px rgba(16, 42, 67, 0.08); }
:root.dark-theme .atlas { background: radial-gradient(120% 90% at 50% 40%, #1c2433 0%, #121826 60%, #0b0f18 100%); }
.atlas .atlas-map { position: absolute; inset: 0; }   /* two classes: must beat maplibre-gl.css, which loads later */
.atlas.atlas-expanded { position: fixed; inset: 0; z-index: 5000; height: auto; margin: 0; border-radius: 0; border: 0; }
body.atlas-lock { overflow: hidden; }
.atlas-toolbar { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.atlas-seg, .atlas-btn, .atlas-chipbtn { background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(15, 23, 42, 0.1); box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12); color: #1f2937; }
.atlas-seg { display: inline-flex; border-radius: 10px; padding: 3px; gap: 2px; }
.atlas-seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; }
.atlas-seg button.active { background: #1f6b37; color: #fff; }
.atlas-btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 8px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.atlas-btn.active { color: #1f6b37; }
.atlas-btn:hover, .atlas-seg button:not(.active):hover { background: rgba(231, 244, 233, 0.95); }
.atlas-layers { position: absolute; top: 62px; right: 14px; z-index: 3; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
.atlas-chipbtn { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; opacity: 0.75; }
.atlas-chipbtn.active { opacity: 1; color: #1f6b37; font-weight: 600; }
.atlas-chipbtn svg.lucide { width: 13px; height: 13px; }

.atlas-panel { position: absolute; top: 14px; left: 14px; bottom: 14px; width: 300px; z-index: 4; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(15, 23, 42, 0.08); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16); transition: transform 0.35s cubic-bezier(.2,.8,.2,1), opacity 0.35s; }
.atlas-panel.closed { transform: translateX(-110%); opacity: 0; pointer-events: none; }
.atlas-panel-head { padding: 14px 14px 10px; border-bottom: 1px solid rgba(15, 23, 42, 0.08); }
.atlas-panel-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; color: #0f172a; }
.atlas-panel-head p { margin: 2px 0 10px; font-size: 12px; color: #64748b; }
.atlas-search { display: flex; align-items: center; gap: 6px; background: #f1f5f9; border-radius: 9px; padding: 0 10px; color: #64748b; }
.atlas-search input { flex: 1; border: 0; background: transparent; padding: 9px 0; font: inherit; font-size: 13px; outline: none; color: #0f172a; min-width: 0; }
.atlas-regions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.atlas-regions button { border: 1px solid #e2e8f0; background: #fff; border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 11.5px; cursor: pointer; color: #475569; }
.atlas-regions button.active { background: #1f6b37; border-color: #1f6b37; color: #fff; }
.atlas-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.atlas-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.atlas-list li:hover, .atlas-list li:focus-visible { background: #f1f5f9; outline: none; }
.atlas-list li.active { background: #e7f4e9; }
.atlas-list img { width: 28px; height: 20px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12); flex: none; }
.atlas-list b { display: block; font-size: 13px; font-weight: 600; color: #0f172a; }
.atlas-list small { display: block; font-size: 11px; color: #64748b; }
.atlas-none { color: #64748b; font-size: 13px; cursor: default !important; }

.atlas-card { position: absolute; right: 14px; bottom: 14px; width: 340px; max-height: calc(100% - 120px); overflow-y: auto; z-index: 4; border-radius: 14px; padding: 16px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22); color: #0f172a; animation: atlasIn 0.35s cubic-bezier(.2,.8,.2,1); }
.atlas-card[hidden] { display: none; }
@keyframes atlasIn { from { opacity: 0; transform: translateY(12px); } }
.atlas-x { position: absolute; top: 10px; right: 10px; border: 0; background: #f1f5f9; border-radius: 8px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #475569; }
.atlas-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; padding-right: 30px; }
.atlas-card-head img { width: 72px; height: auto; border-radius: 6px; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12); }
.atlas-card-head h3 { margin: 0; font-size: 18px; }
.atlas-card-head p { margin: 1px 0 5px; font-size: 12px; color: #64748b; }
.atlas-chip { display: inline-block; font-size: 11px; background: #e7f4e9; color: #1f6b37; border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.atlas-card h4 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; }
.atlas-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.atlas-facts div { background: #f8fafc; border-radius: 8px; padding: 6px 8px; }
.atlas-facts dt { font-size: 11px; color: #64748b; }
.atlas-facts dd { margin: 1px 0 0; font-size: 13px; font-weight: 600; }
.atlas-facts dd small { font-weight: 400; color: #94a3b8; font-size: 10.5px; }
.atlas-facts .atlas-loading { grid-column: 1 / -1; font-size: 12px; color: #64748b; background: none; }
.atlas-hz { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.atlas-hz li { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.atlas-hz li > i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.atlas-ok { color: #047857; }
.atlas-zoomfarm { margin-top: 14px; width: 100%; justify-content: center; }

.atlas-hint { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 40px);
  background: rgba(15, 23, 42, 0.78); color: #fff; font-size: 12.5px; padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(8px); pointer-events: none; transition: background 0.3s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atlas-hint.flash { background: #1f6b37; }
.atlas-legend { display: none; }
.atlas.atlas-expanded .atlas-legend { display: block; position: absolute; left: 330px; bottom: 60px; z-index: 2; background: rgba(255,255,255,0.9); border-radius: 10px; padding: 6px 10px; font-size: 11.5px; }
.atlas-legend span { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
.atlas-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.15); }
.atlas-legend i.sq { border-radius: 2px; }
.atlas .maplibregl-ctrl-bottom-right { bottom: 40px; }
.atlas .maplibregl-ctrl-scale { background: rgba(255,255,255,0.8); }
.atlas-popup { z-index: 6; }
.atlas-popup .maplibregl-popup-content { border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22); }
.atlas-pop b { display: block; font-size: 13.5px; color: #0f172a; margin-bottom: 4px; padding-right: 14px; }
.atlas-pop p { margin: 0 0 8px; font-size: 12.5px; color: #475569; line-height: 1.45; }
.atlas-pop a { font-size: 12.5px; }
.atlas-pop-btns { display: flex; flex-direction: column; gap: 6px; }
.atlas-pop-btns .lv-btn, .atlas-pop-btns .lv-btn-ghost { justify-content: center; font-size: 12.5px; padding: 7px 10px; }
.atlas-spin { width: 22px; height: 22px; border: 3px solid #e2e8f0; border-top-color: #1f6b37; border-radius: 50%; animation: wafeoSpin 0.8s linear infinite; }
@media (max-width: 760px) {
  .atlas { height: 72vh; border-radius: 12px; }
  .atlas-btn span, .atlas-seg button span { display: none; }
  .atlas-panel { width: auto; right: 14px; top: 64px; bottom: 60px; }
  .atlas-card { left: 10px; right: 10px; width: auto; bottom: 56px; max-height: 62%; }
  .atlas-layers { right: 10px; max-width: calc(100% - 20px); }
  .atlas-hint { font-size: 11.5px; }
}

/* ═══ Reports page and PDF buttons ═════════════════════════════ */
.report-hero { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 22px 24px; }
.report-hero-text { flex: 1 1 340px; }
.report-hero h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 18px; color: var(--accent-blue); }
.report-hero p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); }
.report-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.report-pdf-btn { background: #1f6b37; }
.report-pdf-btn:hover { background: #185a2d; }
#siMetricsGrid > .report-pdf-btn { align-self: flex-start; }
.lv-pdf { padding: 5px 10px; font-size: 12px; margin-left: 4px; }
.eo-seg-btn svg.lucide, .eo-btn svg.lucide { width: 15px; height: 15px; }

/* ═══ Live News panel ═════════════════════════════════════════ */
#newsPanel { overflow: hidden; }
.ln-hdr { flex-wrap: wrap; gap: 10px; }
.ln-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #eef6ef; color: #1f6b37; }
.ln-status.checking { background: #eef3fb; color: #2b6cb0; }
.ln-status.past { background: #f3f0fa; color: #5b3fa0; }
.ln-status.err { background: #fdeeee; color: #a83232; }
.ln-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.ln-status.live .ln-dot { animation: lnPulse 1.6s ease-out infinite; }
.ln-status.checking .ln-dot { animation: lnPulse 0.8s ease-out infinite; }
@keyframes lnPulse { 0% { box-shadow: 0 0 0 0 rgba(31, 107, 55, 0.5); } 100% { box-shadow: 0 0 0 8px rgba(31, 107, 55, 0); } }
.ln-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 6px; align-items: center; }
.ln-search, .ln-date { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--bg-primary); color: var(--text-muted); }
.ln-search { flex: 1 1 260px; }
.ln-search input, .ln-date input { border: 0; background: transparent; padding: 8px 0; font: inherit; font-size: 13px; color: var(--text-primary); outline: none; min-width: 0; width: 100%; }
.ln-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px 4px; align-items: center; }
.ln-chips button { border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-secondary); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.ln-chips button.on { background: #1f6b37; border-color: #1f6b37; color: #fff; }
.ln-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.ln-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); padding: 4px 16px 8px; margin: 0; }
.ln-note svg.lucide { color: #1f6b37; }
.ln-warn { color: #a83232; }
.ln-list { max-height: 640px; overflow-y: auto; border-top: 1px solid var(--border); }
.ln-day { position: sticky; top: 0; z-index: 1; background: var(--bg-deep); padding: 6px 16px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.ln-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; transition: background 0.3s; }
.ln-item:hover { background: var(--bg-card-hover); }
.ln-item.ln-new { background: #f2fbf3; }
.ln-tag { flex: none; margin-top: 2px; color: #fff; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.ln-body { flex: 1; min-width: 0; }
.ln-body a, .ln-body b { display: block; font-weight: 600; font-size: 14px; line-height: 1.4; color: var(--text-primary); text-decoration: none; }
.ln-body a:hover { color: var(--accent-blue); text-decoration: underline; }
.ln-body p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.ln-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 11.5px; color: var(--text-muted); }
.ln-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ln-verified { color: #1f6b37; font-weight: 600; }
.ln-corr { color: #2b6cb0; font-weight: 600; cursor: help; }
.ln-newbadge { background: #1f6b37; color: #fff; font-weight: 700; font-size: 10px; padding: 1px 6px; border-radius: 4px; }
.ln-empty { padding: 28px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
@media (max-width: 640px) { .ln-item { flex-direction: column; gap: 6px; } .ln-sep { display: none; } }

/* ═══ Change over time (then vs now) ══════════════════════════ */
.dash-compare { margin-top: 18px; }
.cv { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.cv-compact { border: 0; padding: 0; background: transparent; }
.cv-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; color: var(--accent-blue); }
.cv-sub { margin: 4px 0 12px; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.cv-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.cv-period { flex: 1 1 280px; min-width: 0; }
.cv-period label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.cv-out { font-weight: 700; color: var(--text-primary); }
.cv-range { width: 100%; accent-color: #1f6b37; cursor: pointer; }
.cv-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; padding: 0 2px; }
.cv-ticks span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.cv-compact .cv-ticks span:nth-child(even) { visibility: hidden; }
.cv-modes { display: inline-flex; background: var(--bg-deep); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 12px; flex-wrap: wrap; }
.cv-modes button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.cv-modes button.on { background: #1f6b37; color: #fff; }
.cv-stage { position: relative; width: 100%; max-height: 560px; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #e8ece8; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); user-select: none; }
.cv-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
.cv-divider { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 0 12px rgba(0,0,0,0.35); pointer-events: none; }
.cv-knob { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; color: #1f6b37; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
.cv-knob svg.lucide { width: 20px; height: 20px; }
.cv-lbl { position: absolute; top: 10px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(15, 23, 42, 0.72); backdrop-filter: blur(6px); pointer-events: none; }
.cv-lbl-l { left: 10px; }
.cv-lbl-r { right: 10px; background: rgba(31, 107, 55, 0.88); }
.cv-swipe { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none; }
.cv-swipe:focus-visible + * { outline: none; }
.cv-stage:focus-within { box-shadow: 0 0 0 3px rgba(31, 107, 55, 0.4); }
.cv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-secondary); margin: 8px 0 0; }
.cv-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cv-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: 14px; align-items: start; }
.cv-compact .cv-grid { grid-template-columns: 1fr; }
.cv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cv-table th, .cv-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: right; }
.cv-table th:first-child, .cv-table td:first-child { text-align: left; }
.cv-table th { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.cv-up { color: #1f7a3a; font-weight: 700; }
.cv-down { color: #c0392b; font-weight: 700; }
.cv-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--bg-deep); }
.cv-bar i { display: block; height: 100%; }
.cv-bar-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.cv-bar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cv-bar-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cv-h4 { display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; font-size: 14px; color: var(--text-primary); }
.cv-findings { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.cv-findings li { margin-bottom: 4px; }
.cv-empty { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 34px 16px; font-size: 13px; color: var(--text-muted); background: var(--bg-deep); border-radius: 12px; }
.cv-err { color: #a83232; }
@media (max-width: 760px) { .cv-grid { grid-template-columns: 1fr; } .cv-ticks span:nth-child(even) { visibility: hidden; } }

/* ═══ Ask AI: floating button and chat panel (bottom right) ═══ */
#aiWidgetContainer { position: fixed; right: 20px; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); z-index: 9990; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; pointer-events: none; }
#aiWidgetContainer > * { pointer-events: auto; }
.ai-float { display: inline-flex; align-items: center; gap: 10px; padding: 5px 18px 5px 5px; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 999px; background: #fff; color: #0b3d91; font: inherit; font-size: 15px; font-weight: 700; letter-spacing: 0.01em; cursor: pointer;
  box-shadow: 0 10px 28px rgba(11, 61, 145, 0.25), 0 2px 6px rgba(0, 0, 0, 0.08); transition: transform 0.2s, box-shadow 0.2s; animation: aiFloat 3.2s ease-in-out infinite; }
.ai-float img { width: 46px; height: 46px; border-radius: 50%; display: block; background: #fff; }
.ai-float:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(11, 61, 145, 0.32), 0 2px 6px rgba(0, 0, 0, 0.1); animation-play-state: paused; }
.ai-float:focus-visible { outline: 3px solid rgba(0, 112, 192, 0.45); outline-offset: 3px; }
.ai-float.active { animation: none; background: #0b3d91; color: #fff; }
.ai-float { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.ai-float img { -webkit-user-drag: none; pointer-events: none; }
.ai-float.dragging { cursor: grabbing; animation: none; transform: scale(1.04); box-shadow: 0 18px 40px rgba(11, 61, 145, 0.35); transition: none; }
@keyframes aiFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .ai-float { animation: none; } }

#aiWidgetPanel { display: none; position: fixed; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 150px)); margin: 0; background: var(--bg-primary, #fff); border-radius: 18px; border: 1px solid var(--border);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28); flex-direction: column; overflow: hidden; transform-origin: bottom right; animation: popIn 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
#aiWidgetPanel.open { display: flex; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: linear-gradient(135deg, #0b3d91, #0070c0); color: #fff; }
.ai-head img { width: 34px; height: 34px; border-radius: 50%; background: #fff; }
.ai-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-head-text b { font-size: 15px; }
.ai-head-text small { font-size: 11.5px; opacity: 0.85; line-height: 1.3; overflow-wrap: anywhere; }
.ai-icon-btn { border: 0; background: rgba(255, 255, 255, 0.16); color: #fff; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ai-icon-btn:hover { background: rgba(255, 255, 255, 0.28); }
#aiChatWindow { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-deep); }
.ai-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.ai-user { justify-content: flex-end; }
.ai-av img { width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); display: block; }
.ai-bubble { max-width: 86%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.ai-assistant .ai-bubble { background: var(--bg-primary, #fff); color: var(--text-primary); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ai-user .ai-bubble { background: #0b3d91; color: #fff; border-bottom-right-radius: 4px; }
.ai-bubble p { margin: 0 0 6px; }
.ai-bubble p:last-child, .ai-bubble ul:last-child, .ai-bubble ol:last-child { margin-bottom: 0; }
.ai-bubble ul, .ai-bubble ol { margin: 2px 0 6px; padding-left: 18px; }
.ai-bubble li { margin: 2px 0; }
.ai-bubble h5 { margin: 6px 0 4px; font-size: 13.5px; }
.ai-bubble code { background: rgba(0, 0, 0, 0.06); padding: 0 4px; border-radius: 4px; font-size: 12.5px; }
.ai-bubble .ai-row { font-size: 12.5px; }
.ai-error .ai-bubble { border-color: #f1c0c0; background: #fff6f6; color: #8a1f1f; }
.ai-retry { margin-left: 6px; border: 0; background: #0b3d91; color: #fff; border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.ai-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ai-dots i { width: 7px; height: 7px; border-radius: 50%; background: #0070c0; animation: aiDot 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: 0.15s; } .ai-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--bg-primary, #fff); border-top: 1px solid var(--border); }
.ai-suggest button { border: 1px solid #c9dcf2; background: #f2f7fd; color: #0b3d91; border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.ai-suggest button:hover { background: #e3eefb; }
.ai-compose { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 6px; background: var(--bg-primary, #fff); }
.ai-suggest[hidden] + .ai-compose { border-top: 1px solid var(--border); }
.ai-compose textarea { flex: 1; resize: none; overflow-y: hidden; border: 1px solid var(--border); border-radius: 14px; padding: 9px 12px; font: inherit; font-size: 13.5px; line-height: 1.4; max-height: 120px; outline: none; background: var(--bg-deep); color: var(--text-primary); }
.ai-compose textarea:focus { border-color: #0070c0; box-shadow: 0 0 0 3px rgba(0, 112, 192, 0.15); }
.ai-compose button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #0070c0; color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.ai-compose button:disabled { opacity: 0.5; cursor: progress; }
.ai-foot { margin: 0; padding: 0 14px 10px; font-size: 10.5px; color: var(--text-muted); background: var(--bg-primary, #fff); }
@media (max-width: 600px) {
  #aiWidgetContainer { right: 12px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .ai-float { font-size: 14px; padding-right: 14px; }
  .ai-float img { width: 40px; height: 40px; }
}

/* Map could not load (offline / blocked CDN) */
.atlas-fail { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-secondary); font-size: 14px; }

/* Phones: the atlas hint wraps instead of being cut off with "…". */
@media (max-width: 760px) {
  .atlas-hint { white-space: normal; text-overflow: clip; text-align: center; justify-content: center; border-radius: 14px; line-height: 1.35; width: max-content; max-width: calc(100% - 24px); padding: 7px 12px; bottom: 10px; }
  .atlas .maplibregl-ctrl-bottom-right { bottom: 60px; }
  .atlas .maplibregl-ctrl-bottom-left { bottom: 88px; }
}

/* Every page ends with room to scroll its last lines clear of the floating Ask AI button. */
.page.active::after { content: ''; display: block; flex: 0 0 72px; }

/* Phones: the footer stays on one line (it is 31 px tall, the space the app leaves for it). */
@media (max-width: 600px) {
  .platform-footer { padding: 6px 10px; gap: 8px; }
  .footer-left { display: none; }
  .footer-center { font-size: 9.5px; letter-spacing: 0.4px; white-space: nowrap; overflow: hidden; text-overflow: clip; flex: 1 1 auto; min-width: 0; }
  .footer-right { flex: 0 0 auto; font-size: 10px; white-space: nowrap; }
}
