/* ==========================================================================
   ALEPHGRID PTDF SANDBOX — DARK QUANT THEME
   ========================================================================== */

:root {
  --bg-darkest: #060911;
  --bg-panel: #0b1120;
  --bg-card: #111a2e;
  --bg-card-hover: #16223b;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(6, 182, 212, 0.35);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-orange: #f97316;
  --accent-red: #f43f5e;
  --accent-purple: #8b5cf6;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-darkest);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
.app-header {
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
}

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

.brand-badge {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 5px;
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.4);
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.brand-title .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
}

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

.meta-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.dot.cyan { background: var(--accent-cyan); box-shadow: 0 0 6px var(--accent-cyan); }
.dot.amber { background: var(--accent-amber); box-shadow: 0 0 6px var(--accent-amber); }
.dot.purple { background: var(--accent-purple); box-shadow: 0 0 6px var(--accent-purple); }
.dot.pulse-green {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 1.5s infinite ease-in-out;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1.0; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.live-engine-tag {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: var(--accent-green) !important;
}

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

.cloud-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.cloud-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   PRESET BAR
   -------------------------------------------------------------------------- */
.preset-bar {
  background: #0a0e1a;
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  overflow-x: auto;
}

.preset-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  white-space: nowrap;
}

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

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-preset:hover {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-cyan);
  color: #fff;
}

.btn-preset.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.btn-preset.reset {
  margin-left: 10px;
  color: var(--text-dim);
}

.btn-preset.reset:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* --------------------------------------------------------------------------
   MAIN GRID WORKSPACE
   -------------------------------------------------------------------------- */
.dashboard-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 310px 1fr 370px;
  overflow: hidden;
  background: var(--bg-darkest);
}

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
}

.controls-panel {
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 14px;
  gap: 14px;
}

.map-panel {
  position: relative;
  background: #070a13;
}

.analytics-panel {
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 14px;
  gap: 14px;
}

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

.panel-header h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   CARDS & CONTAINERS
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.card-caption {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: -6px;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   CONTROLS: TRADE BUILDER & SLIDERS
   -------------------------------------------------------------------------- */
.trade-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trade-arrow {
  color: var(--accent-cyan);
  font-size: 14px;
  font-weight: bold;
}

.input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-group label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.select-field {
  background: #0a0f1d;
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  width: 100%;
}

.select-field:focus {
  border-color: var(--accent-cyan);
}

.select-small {
  padding: 5px 8px;
  font-size: 11px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.slider-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

.range-slider {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  opacity: 0.92;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.45);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: #fff;
}

.btn-tiny {
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  cursor: pointer;
}

.btn-tiny:hover {
  color: #fff;
  border-color: var(--text-muted);
}

/* Zone Sliders list */
.sliders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.zone-slider-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.zone-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.zone-name {
  font-weight: 600;
}

.zone-val-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.zone-val-badge.pos { color: var(--accent-green); }
.zone-val-badge.neg { color: var(--accent-red); }
.zone-val-badge.zero { color: var(--text-dim); }

.field-hint {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   MAP PANEL
   -------------------------------------------------------------------------- */
.map-panel .panel-header {
  padding: 10px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 5;
}

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

.caption-tag {
  font-size: 10px;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.map-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-color.green { background: var(--accent-green); }
.legend-color.amber { background: var(--accent-amber); }
.legend-color.orange { background: var(--accent-orange); }
.legend-color.red { background: var(--accent-red); }

.map-viewport-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #0e1526 0%, #060911 100%);
}

.map-container {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.map-container:active {
  cursor: grabbing;
}

/* SVG Line & Node Styles */
.grid-line {
  stroke-linecap: round;
  transition: stroke 0.2s, stroke-width 0.2s;
  cursor: pointer;
}

.grid-line:hover {
  stroke-width: 4.5px !important;
  stroke: #38bdf8 !important;
}

.grid-line.congested {
  animation: pulse-line 1.2s infinite ease-in-out;
}

@keyframes pulse-line {
  0% { opacity: 0.6; stroke-width: 3.5px; }
  50% { opacity: 1.0; stroke-width: 5.5px; }
  100% { opacity: 0.6; stroke-width: 3.5px; }
}

.grid-node-circle {
  transition: transform 0.15s, r 0.15s, fill 0.2s;
  cursor: pointer;
}

/* Flow Direction Arrows */
.flow-arrow-group {
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
}

.flow-arrow-head {
  stroke: #070b14;
  stroke-width: 1.5px;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));
  transition: fill 0.2s, transform 0.2s;
}

.flow-arrow-head:hover {
  transform: scale(1.4);
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.9));
}

.flow-arrow-head.congested {
  animation: pulse-arrow 1.2s infinite ease-in-out;
}

@keyframes pulse-arrow {
  0% { transform: scale(1.0); filter: drop-shadow(0 0 3px var(--accent-red)); }
  50% { transform: scale(1.4); filter: drop-shadow(0 0 8px var(--accent-red)); }
  100% { transform: scale(1.0); filter: drop-shadow(0 0 3px var(--accent-red)); }
}

/* Animated flow dashes on active transmission lines */
.grid-line.flowing-fwd {
  stroke-dasharray: 10, 6;
  animation: flowForward 1.2s linear infinite;
}

.grid-line.flowing-bwd {
  stroke-dasharray: 10, 6;
  animation: flowReverse 1.2s linear infinite;
}

@keyframes flowForward {
  from { stroke-dashoffset: 32; }
  to { stroke-dashoffset: 0; }
}

@keyframes flowReverse {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: 32; }
}

.grid-node-circle:hover {
  r: 9px !important;
  fill: #38bdf8 !important;
}

.grid-node-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  fill: #94a3b8;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.grid-node-label.active {
  fill: #fff;
}

/* Flow particle animation along lines */
.flow-particle {
  fill: #fff;
  opacity: 0.85;
  pointer-events: none;
}

/* Tooltip */
.grid-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 10px rgba(6, 182, 212, 0.25);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  pointer-events: none;
  z-index: 50;
  max-width: 260px;
  transition: opacity 0.1s;
}

.grid-tooltip.hidden {
  opacity: 0;
  pointer-events: none;
}

.tooltip-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-cyan);
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 2px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
  gap: 12px;
}

.tooltip-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   RIGHT SIDEBAR: ANALYTICS
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.kpi-bar {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}

.kpi-bar.red { background: var(--accent-red); box-shadow: 0 0 8px rgba(244, 63, 94, 0.4); }
.kpi-bar.amber { background: var(--accent-amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.4); }
.kpi-bar.cyan { background: var(--accent-cyan); box-shadow: 0 0 8px rgba(6, 182, 212, 0.4); }
.kpi-bar.green { background: var(--accent-green); box-shadow: 0 0 8px rgba(16, 185, 129, 0.4); }

.kpi-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

.kpi-lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 1px;
}

.text-red { color: var(--accent-red); }
.text-amber { color: var(--accent-amber); }
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }

/* Loop flow progress bar */
.loop-bars {
  height: 24px;
  border-radius: 5px;
  display: flex;
  overflow: hidden;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.loop-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  padding: 0 6px;
}

.loop-bar.direct {
  background: linear-gradient(90deg, #0284c7, #06b6d4);
  color: #fff;
}

.loop-bar.loop {
  background: linear-gradient(90deg, #d97706, #f59e0b);
  color: #000;
}

.transit-paths-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.transit-header {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin-bottom: 6px;
}

.transit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.transit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}

.transit-line-id {
  color: var(--text-main);
  font-weight: 600;
}

.transit-mw {
  color: var(--accent-amber);
}

/* Interconnectors Table */
.table-card {
  flex: 1;
  min-height: 200px;
}

.table-subtext {
  font-size: 10px;
  color: var(--text-dim);
}

.table-scroll-container {
  overflow-y: auto;
  max-height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.interconnectors-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: var(--font-mono);
}

.interconnectors-table th {
  background: #090e1a;
  color: var(--text-dim);
  text-align: left;
  padding: 6px 8px;
  font-size: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border-subtle);
}

.interconnectors-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.interconnectors-table tr:hover td {
  background: rgba(6, 182, 212, 0.08);
  cursor: pointer;
}

.interconnectors-table tr.congested-row td {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-red);
}

.loading-bar-mini {
  height: 5px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
}

.loading-bar-fill {
  height: 100%;
  border-radius: 3px;
}

.loading-bar-fill.green { background: var(--accent-green); }
.loading-bar-fill.amber { background: var(--accent-amber); }
.loading-bar-fill.orange { background: var(--accent-orange); }
.loading-bar-fill.red { background: var(--accent-red); }

/* Sensitivity Inspector */
.empty-inspector-state {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  padding: 6px 0;
}

.sensitivity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sens-col-title {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 4px;
}

.sens-col-title.pos { color: var(--accent-green); }
.sens-col-title.neg { color: var(--accent-red); }

.sens-item {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
  margin-bottom: 2px;
}

/* Badges */
.badge {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.badge-quant {
  font-size: 10px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-blue {
  font-size: 10px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.badge-subtle {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.app-footer {
  height: 32px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}

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

.footer-links code {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Highly visible Landing Page link button */
.btn-landing-highlight {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, rgba(0, 212, 200, 0.22), rgba(99, 102, 241, 0.3));
  border: 1px solid #00d4c8;
  color: #ffffff !important;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.3px;
  box-shadow: 0 0 14px rgba(0, 212, 200, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-landing-highlight:hover {
  background: linear-gradient(135deg, rgba(0, 212, 200, 0.38), rgba(99, 102, 241, 0.5));
  border-color: #38bdf8;
  box-shadow: 0 0 22px rgba(0, 212, 200, 0.7);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.btn-landing-highlight .sparkle {
  color: #ffb800;
  font-size: 13px;
}

.footer-landing-link {
  color: #00d4c8;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.footer-landing-link:hover {
  color: #38bdf8;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   MOBILE & TABLET TABS NAVIGATION (< 1024px)
   -------------------------------------------------------------------------- */
.mobile-tabs {
  display: none;
  background: #080d19;
  border-bottom: 1px solid var(--border-subtle);
  height: 46px;
  flex-shrink: 0;
  z-index: 15;
  padding: 0 8px;
}

.mobile-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 0 6px;
  transition: all 0.2s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.mobile-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}

.mobile-tab-btn.active {
  color: #fff;
  border-bottom-color: var(--accent-cyan);
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.04) 0%, rgba(6, 182, 212, 0.12) 100%);
}

.mobile-tab-btn .tab-icon {
  font-size: 14px;
}

.tab-badge {
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.5);
  display: none;
}

.tab-badge.visible {
  display: inline-block;
}

/* --------------------------------------------------------------------------
   ON-MAP FLOATING CONTROLS & STATUS PILL
   -------------------------------------------------------------------------- */
.map-floating-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 25;
}

.floating-btn {
  width: 36px;
  height: 36px;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.floating-btn:hover,
.floating-btn:active {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  transform: scale(1.05);
}

.map-floating-kpi {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  z-index: 25;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.map-floating-kpi:hover,
.map-floating-kpi:active {
  border-color: var(--accent-cyan);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
  transform: translateY(-1px);
}

.dot-kpi {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  flex-shrink: 0;
}

.dot-kpi.congested {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
  animation: pulse-dot 1.2s infinite ease-in-out;
}

.kpi-arrow {
  color: var(--accent-cyan);
  font-size: 12px;
  transition: transform 0.15s;
}

.map-floating-kpi:hover .kpi-arrow {
  transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN: TABLETS & MOBILE DEVICES
   -------------------------------------------------------------------------- */

/* TABLETS AND PHONES (<= 1024px) */
@media (max-width: 1024px) {
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .mobile-tabs {
    display: flex;
  }

  .dashboard-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
  }

  /* Panels: Only active mobile tab panel is displayed */
  .panel {
    display: none;
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
    border: none;
  }

  .panel.active-mobile-tab {
    display: flex;
    flex-direction: column;
  }

  .controls-panel.active-mobile-tab,
  .analytics-panel.active-mobile-tab {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
    gap: 14px;
  }

  .map-panel.active-mobile-tab {
    overflow: hidden;
  }

  .map-viewport-wrapper {
    flex: 1;
    height: 100%;
    min-height: 0;
  }

  /* Preset Bar: horizontal scroll with snap */
  .preset-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding: 6px 12px;
    gap: 8px;
    scrollbar-width: none;
  }

  .preset-bar::-webkit-scrollbar {
    display: none;
  }

  .btn-preset {
    scroll-snap-align: start;
    flex-shrink: 0;
    font-size: 11px;
    padding: 6px 11px;
  }

  /* Touch input hit areas */
  .select-field {
    min-height: 38px;
    font-size: 12px;
  }

  .btn-primary {
    min-height: 40px;
    font-size: 13px;
  }

  .range-slider {
    height: 7px;
    margin: 6px 0;
  }

  .range-slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }

  .sliders-list {
    max-height: 320px;
  }

  .table-scroll-container {
    max-height: 260px;
  }
}

/* SMARTPHONES (<= 768px) */
@media (max-width: 768px) {
  .app-header {
    height: auto;
    min-height: 48px;
    padding: 6px 12px;
  }

  .brand-badge {
    font-size: 10px;
    padding: 3px 6px;
  }

  .brand-title h1 {
    font-size: 14px;
  }

  .brand-title .subtitle {
    display: none;
  }

  .header-center {
    display: none;
  }

  .cloud-badge {
    display: none;
  }

  .btn-landing-highlight {
    padding: 5px 10px;
    font-size: 11px;
    gap: 5px;
  }

  .map-panel .panel-header {
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-title-flex h2 {
    font-size: 12px;
  }

  .caption-tag {
    font-size: 9px;
  }

  .legend-pill {
    font-size: 9px;
    padding: 2px 6px;
    gap: 6px;
  }

  .legend-color {
    width: 6px;
    height: 6px;
  }

  .map-floating-controls {
    top: 10px;
    right: 10px;
  }

  .floating-btn {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .map-floating-kpi {
    bottom: 10px;
    left: 10px;
    font-size: 10px;
    padding: 5px 10px;
  }

  .app-footer {
    height: auto;
    min-height: 28px;
    padding: 6px 10px;
    flex-direction: column;
    gap: 3px;
    text-align: center;
    font-size: 9px;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    font-size: 9px;
    gap: 6px;
  }
}

/* SMALL PHONES (<= 540px) */
@media (max-width: 540px) {
  .trade-inputs {
    flex-direction: column;
    gap: 6px;
  }

  .trade-arrow {
    transform: rotate(90deg);
    text-align: center;
    margin: -3px 0;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .kpi-card {
    padding: 6px 8px;
    gap: 6px;
  }

  .kpi-val {
    font-size: 13px;
  }

  .kpi-lbl {
    font-size: 9px;
  }

  .grid-tooltip {
    max-width: 230px;
    font-size: 10px;
    padding: 6px 8px;
  }
}


