:root {
  color-scheme: dark;
  --bg: #05060a;
  --panel: rgba(10, 14, 26, 0.86);
  --panel-border: rgba(122, 148, 255, 0.12);
  --primary: #7df9ff;
  --accent: #ff7a59;
  --muted: #9aa7c7;
  --glow: rgba(125, 249, 255, 0.35);
  --danger: #ff4d5e;
  --success: #58ffa1;
  --warning: #ffc857;
  --shadow: 0 25px 60px rgba(3, 8, 24, 0.65);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #eff5ff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(52, 95, 182, 0.2);
  --primary: #0f7ea5;
  --accent: #cc5d35;
  --muted: #5c6888;
  --glow: rgba(15, 126, 165, 0.25);
  --danger: #d64252;
  --success: #1ca06f;
  --warning: #c58b19;
  --shadow: 0 14px 36px rgba(26, 50, 90, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", sans-serif;
}

body {
  background: radial-gradient(circle at 20% 20%, #111e38, #05060a 50%, #010103);
  color: #f3f6ff;
  min-height: 100vh;
}

body[data-theme="light"] {
  background: radial-gradient(circle at 20% 20%, #d8e9ff, #eef5ff 50%, #f8fbff);
  color: #152344;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 24px;
  padding: 24px 32px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #7df9ff, #5b5ce8 65%, #1b1045 100%);
  box-shadow: 0 0 25px rgba(125, 249, 255, 0.6);
  position: relative;
  overflow: hidden;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(125, 249, 255, 0.25);
  border-radius: 999px;
  background: rgba(10, 15, 28, 0.65);
  font-size: 13px;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  border: 1px solid rgba(125, 249, 255, 0.25);
  border-radius: 999px;
  background: rgba(10, 15, 28, 0.65);
  color: #dce7ff;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.lang-toggle {
  border: 1px solid rgba(125, 249, 255, 0.25);
  border-radius: 999px;
  background: rgba(10, 15, 28, 0.65);
  color: #dce7ff;
  padding: 8px 10px;
  font-size: 12px;
  min-width: 48px;
  cursor: pointer;
}

body[data-theme="light"] .theme-toggle,
body[data-theme="light"] .status,
body[data-theme="light"] .lang-toggle {
  border-color: rgba(33, 93, 169, 0.28);
  background: rgba(255, 255, 255, 0.85);
  color: #20365f;
}

.reference-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.reference-link {
  color: #dce7ff;
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.4px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(125, 249, 255, 0.18);
  background: linear-gradient(125deg, rgba(125, 249, 255, 0.08), rgba(91, 92, 232, 0.14));
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

body[data-theme="light"] .reference-link {
  color: #1f3766;
  border-color: rgba(33, 93, 169, 0.26);
  background: linear-gradient(125deg, rgba(44, 163, 211, 0.12), rgba(44, 88, 211, 0.1));
}

body[data-theme="light"] .brand-subtitle,
body[data-theme="light"] .metric-label,
body[data-theme="light"] .ops-label,
body[data-theme="light"] .ops-alerts li,
body[data-theme="light"] .ops-briefing li,
body[data-theme="light"] .list-note,
body[data-theme="light"] .trend-message,
body[data-theme="light"] .trend-stat-label {
  color: #5a6787;
}

body[data-theme="light"] .list,
body[data-theme="light"] .metric-value,
body[data-theme="light"] .panel-header h2,
body[data-theme="light"] .brand-title,
body[data-theme="light"] .globe-header h1 {
  color: #1a2e57;
}

body[data-theme="light"] select {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(33, 93, 169, 0.3);
  color: #1f3766;
}

body[data-theme="light"] .globe-stage {
  background: radial-gradient(circle at 50% 30%, rgba(49, 157, 203, 0.18), rgba(239, 245, 255, 0.6) 65%);
}

body[data-theme="light"] .globe-hud {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(33, 93, 169, 0.25);
  color: #33486f;
}

body[data-theme="light"] .leaderboard {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(33, 93, 169, 0.24);
}

body[data-theme="light"] .leaderboard-table th,
body[data-theme="light"] .leaderboard-table td {
  border-bottom-color: rgba(33, 93, 169, 0.18);
}

body[data-theme="light"] .leaderboard-table td,
body[data-theme="light"] .ops-card strong {
  color: #20365f;
}

body[data-theme="light"] .leaderboard-row:hover {
  background: rgba(49, 157, 203, 0.12);
}

body[data-theme="light"] .leaderboard-row.is-selected {
  background: rgba(49, 157, 203, 0.18);
}

body[data-theme="light"] .ops-card,
body[data-theme="light"] .ops-alerts,
body[data-theme="light"] .ops-briefing,
body[data-theme="light"] .ops-briefing-2 {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(33, 93, 169, 0.22);
}

body[data-theme="light"] .risk-chip.high {
  color: #b81e34;
  border-color: rgba(184, 30, 52, 0.55);
}

body[data-theme="light"] .risk-chip.medium {
  color: #9a6500;
  border-color: rgba(154, 101, 0, 0.45);
}

body[data-theme="light"] .risk-chip.low {
  color: #11724d;
  border-color: rgba(17, 114, 77, 0.45);
}

.reference-link:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 249, 255, 0.4);
  box-shadow: 0 8px 18px rgba(18, 28, 58, 0.45);
}

.reference-link:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(125, 249, 255, 0.35);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(88, 255, 161, 0.7);
  animation: pulse 1.6s infinite;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  flex: 1;
}

.globe-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.globe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.globe-header h1 {
  font-size: 26px;
  margin: 6px 0 8px;
}

.globe-header p {
  font-size: 14px;
  color: var(--muted);
  max-width: 420px;
  line-height: 1.5;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 220px;
}

.select label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(10, 12, 28, 0.9);
  border: 1px solid rgba(125, 249, 255, 0.15);
  color: #f2f5ff;
}

.toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

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

.globe-stage {
  position: relative;
  background: radial-gradient(circle at 50% 30%, rgba(125, 249, 255, 0.1), transparent 65%);
  border-radius: 20px;
  min-height: 520px;
  overflow: hidden;
}

#globeCanvas {
  width: 100%;
  height: 520px;
  display: block;
}

.globe-hud {
  position: absolute;
  inset: 18px 18px auto auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(5, 8, 20, 0.7);
  border: 1px solid rgba(125, 249, 255, 0.2);
  font-size: 12px;
  color: var(--muted);
  max-width: 260px;
  min-width: 160px;
  pointer-events: none;
  line-height: 1.35;
}

.hud-legend {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(173, 196, 255, 0.8);
}

.leaderboard {
  border: 1px solid rgba(125, 249, 255, 0.15);
  border-radius: 16px;
  background: rgba(6, 12, 26, 0.72);
  padding: 14px;
}

.leaderboard-header h3 {
  margin-top: 4px;
  font-size: 18px;
}

.leaderboard-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(125, 249, 255, 0.12);
  white-space: nowrap;
}

.leaderboard-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

.leaderboard-row {
  cursor: pointer;
}

.leaderboard-row:hover {
  background: rgba(125, 249, 255, 0.08);
}

.leaderboard-row.is-selected {
  background: rgba(125, 249, 255, 0.14);
}

.leaderboard-row.flash {
  animation: leaderboardFlash 1.1s ease;
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
}

.risk-chip.high {
  border-color: rgba(255, 77, 94, 0.7);
  color: #ff9da8;
}

.risk-chip.medium {
  border-color: rgba(255, 200, 87, 0.7);
  color: #ffd98c;
}

.risk-chip.low {
  border-color: rgba(88, 255, 161, 0.7);
  color: #a8ffcf;
}

.ops-summary {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.ops-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ops-card {
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 10px;
  background: rgba(125, 249, 255, 0.06);
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}

.ops-label {
  font-size: 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.ops-card strong {
  font-size: 13px;
}

.ops-alerts {
  border: 1px solid rgba(125, 249, 255, 0.16);
  border-radius: 10px;
  background: rgba(125, 249, 255, 0.04);
  padding: 10px;
}

.ops-alerts-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}

.ops-alerts ul {
  list-style: none;
  display: grid;
  gap: 6px;
}

.ops-alerts li {
  font-size: 12px;
  color: var(--muted);
}

.ops-briefing {
  border: 1px solid rgba(125, 249, 255, 0.16);
  border-radius: 10px;
  background: rgba(125, 249, 255, 0.035);
  padding: 10px;
  min-height: 120px;
}

.ops-briefing-2 {
  border: 1px solid rgba(125, 249, 255, 0.16);
  border-radius: 10px;
  background: rgba(125, 249, 255, 0.035);
  padding: 10px;
  min-height: 160px;
  display: grid;
  gap: 8px;
}

.ops-briefing-2 ol {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.ops-briefing ul {
  list-style: none;
  display: grid;
  gap: 6px;
}

.ops-briefing li {
  font-size: 12px;
  color: var(--muted);
}

.ops-alert-item.is-clickable {
  cursor: pointer;
  color: #d9f6ff;
}

.ops-alert-item.is-clickable:hover {
  text-decoration: underline;
}

@keyframes leaderboardFlash {
  0% {
    background: rgba(125, 249, 255, 0.28);
  }
  100% {
    background: transparent;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 18px 18px 20px;
  box-shadow: var(--shadow);
}

.sidebar .panel:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sidebar .panel:last-child .panel-body {
  flex: 1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin-top: 6px;
  font-size: 20px;
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 600;
}

.tag {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--primary);
  border: 1px solid rgba(125, 249, 255, 0.2);
  padding: 4px 8px;
  border-radius: 8px;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14px;
}

.model-picker {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.model-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.forecast-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metrics-divider {
  border: 0;
  border-top: 1px solid rgba(125, 249, 255, 0.2);
  margin: 2px 0;
}

.metric-pill {
  border: 1px solid rgba(125, 249, 255, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(125, 249, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-pill span {
  font-size: 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.metric-pill strong {
  font-size: 13px;
}

.metrics-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.4px;
}

.metric {
  display: grid;
  gap: 6px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  font-size: 16px;
  font-weight: 600;
}

.actions {
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.actions li {
  padding-left: 12px;
  position: relative;
}

.actions li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.slider-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
}

input[type="range"] {
  width: 100%;
  grid-column: 1 / -1;
  accent-color: var(--primary);
}

.impact-result {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(125, 249, 255, 0.08);
  border: 1px solid rgba(125, 249, 255, 0.2);
  font-weight: 600;
}

.solution-insights {
  display: grid;
  gap: 10px;
  flex: 1;
  align-content: space-between;
}

.solution-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.solution-kpi {
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 10px;
  background: rgba(125, 249, 255, 0.05);
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.solution-kpi-label {
  font-size: 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.solution-kpi strong {
  font-size: 13px;
}

.solution-list {
  list-style: none;
  display: grid;
  gap: 6px;
}

.solution-list li {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid rgba(125, 249, 255, 0.14);
  background: rgba(125, 249, 255, 0.03);
  border-radius: 8px;
  padding: 7px 9px;
}

.trend-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.trend-stat {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(125, 249, 255, 0.2);
  background: rgba(125, 249, 255, 0.06);
}

.trend-stat-label {
  font-size: 11px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.trend-stat-value {
  font-size: 14px;
  font-weight: 600;
}

.trend-message {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(125, 249, 255, 0.05);
}

.footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.liquid-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.liquid-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.liquid-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(125, 249, 255, 0.08), rgba(1, 3, 10, 0.8) 55%);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
}

.liquid-modal-panel {
  position: relative;
  width: min(760px, calc(100vw - 28px));
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(125, 249, 255, 0.26);
  background:
    linear-gradient(120deg, rgba(125, 249, 255, 0.16), rgba(125, 249, 255, 0.04) 32%, rgba(91, 92, 232, 0.16)),
    rgba(6, 10, 24, 0.56);
  box-shadow: 0 26px 62px rgba(2, 8, 26, 0.75);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.liquid-modal-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 35%);
}

.liquid-modal-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(125, 249, 255, 0.14);
}

.liquid-modal-header h2 {
  font-size: 20px;
}

.liquid-modal-close {
  border: 1px solid rgba(125, 249, 255, 0.3);
  background: rgba(7, 14, 32, 0.45);
  color: #ecf3ff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.liquid-modal-close:hover {
  border-color: rgba(125, 249, 255, 0.55);
}

.liquid-modal-content {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 22px;
  font-size: 14px;
  line-height: 1.55;
  color: #dce7ff;
}

.liquid-modal-frame {
  display: block;
  width: 100%;
  height: 220px;
  max-height: 72vh;
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 14px;
  background: rgba(8, 14, 30, 0.45);
}

body[data-theme="light"] .liquid-modal-backdrop {
  background: radial-gradient(circle at 20% 20%, rgba(15, 126, 165, 0.12), rgba(224, 234, 249, 0.78) 55%);
}

body[data-theme="light"] .liquid-modal-panel {
  border-color: rgba(33, 93, 169, 0.28);
  background:
    linear-gradient(120deg, rgba(15, 126, 165, 0.14), rgba(15, 126, 165, 0.04) 32%, rgba(90, 120, 210, 0.12)),
    rgba(255, 255, 255, 0.74);
  box-shadow: 0 22px 46px rgba(28, 50, 88, 0.28);
}

body[data-theme="light"] .liquid-modal-header {
  border-bottom-color: rgba(33, 93, 169, 0.2);
}

body[data-theme="light"] .liquid-modal-header h2 {
  color: #1a2e57;
}

body[data-theme="light"] .liquid-modal-close {
  border-color: rgba(33, 93, 169, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: #1f3766;
}

body[data-theme="light"] .liquid-modal-frame {
  border-color: rgba(33, 93, 169, 0.24);
  background: rgba(255, 255, 255, 0.9);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(88, 255, 161, 0.6);
  }
  50% {
    transform: scale(1.4);
    box-shadow: 0 0 18px rgba(88, 255, 161, 0.9);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(88, 255, 161, 0.6);
  }
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .globe-header {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
  }

  .reference-links {
    justify-content: flex-start;
  }

  .globe-stage {
    min-height: 400px;
  }

  #globeCanvas {
    height: 400px;
  }

  .footer {
    flex-direction: column;
    gap: 8px;
  }

  .liquid-modal-header {
    padding: 14px 16px;
  }

  .liquid-modal-content {
    padding: 14px 16px 18px;
  }
}

.list {
  font-size: 12px;
  margin-left: 0;
  margin-top: 0;
  color: #ecf3ff;
}

.list-note {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
