/* ==========================================================================
   GreenSpark SWIS Grid Analytics Platform
   Theme 3: Nordic Wind (Expanded Palette) - Professional Grid Intel
   ========================================================================== */

:root {
  /* Nordic Wind Palette (Ember Grid Intel Specification) */
  --bg-frost: #f4f6f8;            /* Frosty Ice-Blue Background */
  --bg-surface: #ffffff;          /* Pure White Container / Panel Surface */
  --bg-subtle: #f8fafc;           /* Subtle Light Card Fill */
  --bg-hover: #f1f5f9;            /* Subtle Hover Surface */
  --bg-periwinkle: #e0e7ff;       /* Pale Periwinkle Accent Background */

  /* Borders */
  --border-light: #e2e8f0;        /* Light Slate Border */
  --border-medium: #cbd5e1;       /* Input & Button Border */
  --border-dark: #94a3b8;         /* Cool Gray Slate Border */

  /* Typography */
  --text-primary: #0f172a;        /* Deep Slate (Main text, titles, metrics) */
  --text-secondary: #334155;      /* Slate (Body & secondary text) */
  --text-muted: #64748b;          /* Cool Gray (Labels, captions, subheadings) */
  --text-dim: #94a3b8;            /* Dim Cool Gray (Tags & metadata) */

  /* Primary Brand & Accents */
  --accent-blue: #2563eb;         /* Deep Ocean Blue (Primary buttons, active tabs) */
  --accent-wind: #0284c7;         /* Clear Wind Blue */
  --accent-mint: #0d9488;         /* Renewable Mint */
  --accent-aqua: #14bba6;         /* Vibrant Aqua */
  --accent-lime: #84cc16;         /* Lime Green */
  --accent-lavender: #a78bfa;     /* Lavender */

  /* Operational Alert States */
  --status-warning: #f59e0b;      /* Amber Warning */
  --status-critical: #ef4444;     /* Red Critical */
  --status-success: #10b981;      /* Emerald Green */

  /* Typography Stacks */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

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

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

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
header {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, var(--accent-mint), var(--accent-blue));
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.logo-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.logo-title p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.kpi-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 4px 10px;
  min-width: 90px;
}

.kpi-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.kpi-value.alert {
  color: var(--status-critical);
}

.kpi-value.warning {
  color: var(--status-warning);
}

.kpi-value.success {
  color: var(--accent-mint);
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */
.app-container {
  display: flex;
  flex: 1;
  position: relative;
  height: calc(100vh - 60px);
  overflow: hidden;
  background: var(--bg-frost);
}

/* Sidebar */
.sidebar {
  width: 440px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-440px);
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1 0 auto;
  padding: 10px 5px;
  min-width: 62px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: var(--bg-surface);
  box-shadow: inset 0 -2px 0 var(--accent-blue);
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: none;
  background: var(--bg-frost);
}

.tab-content.active {
  display: block;
}

/* Panel Sections */
.panel-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Controls */
.control-group {
  margin-bottom: 12px;
}

.control-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.control-input, .control-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.control-input:focus, .control-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-primary {
  width: 100%;
  padding: 10px;
  background: var(--accent-blue);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-dark);
  color: var(--text-primary);
}

/* Layer Checklist */
.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  transition: background 0.15s, border-color 0.15s;
}

.layer-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.layer-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.layer-label input[type="checkbox"],
.layer-label input[type="radio"] {
  accent-color: var(--accent-blue);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.layer-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Map Container & Visual Flow Elements
   ========================================================================= */
#map {
  flex: 1;
  height: 100%;
  background: var(--bg-frost);
  position: relative;
  z-index: 10;
}

/* Directional Power Flow Animation Keyframes */
@keyframes flowPulseForward {
  from {
    stroke-dashoffset: 48;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes flowPulseReverse {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 48;
  }
}

.flow-base-corridor {
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: stroke !important;
  cursor: pointer;
  transition: opacity 0.2s, stroke-width 0.2s;
}

.flow-base-corridor:hover {
  opacity: 0.65 !important;
}

/* Pulsing dash overlays (pointer-events: none prevents hover flicker) */
.flow-pulse-forward {
  animation: flowPulseForward 1.4s linear infinite;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none !important;
}

.flow-pulse-forward.flow-critical {
  animation: flowPulseForward 0.65s linear infinite;
  filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.8));
  pointer-events: none !important;
}

.flow-pulse-reverse {
  animation: flowPulseReverse 1.4s linear infinite;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none !important;
}

/* Status Filter Pills */
.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.status-pill-btn {
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-pill-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-dark);
}

.status-pill-btn.active {
  background: #eff6ff;
  border-color: var(--accent-blue);
  color: #1d4ed8;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.15);
}

.gen-filter-btn.active {
  background: var(--bg-periwinkle) !important;
  border-color: var(--accent-blue) !important;
  color: var(--accent-blue) !important;
  font-weight: 700 !important;
}

/* ==========================================================================
   Map Floating Overlays: Legends & Control Bars
   ========================================================================== */
.map-floating-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 800;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 330px;
}

.legend-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flow-gradient-bar {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #10b981 0%, #eab308 50%, #f97316 75%, #ef4444 100%);
  margin: 4px 0 3px 0;
}

.flow-gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-badge {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
}

.legend-pulse-indicator {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #10b981, #ef4444);
  position: relative;
  overflow: hidden;
}

/* Bottom Dispatch Control Bar */
.bottom-control-bar {
  position: absolute;
  bottom: 16px;
  left: 460px;
  right: 20px;
  z-index: 800;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-lg);
}

.dispatch-slider-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dispatch-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.dispatch-slider {
  width: 100%;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.time-display {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-blue);
  min-width: 60px;
  text-align: center;
}

/* ==========================================================================
   Floating Feature Details Inspector (Drawer)
   ========================================================================== */
.info-drawer {
  position: absolute;
  bottom: 90px;
  right: 16px;
  width: 380px;
  max-height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px;
  z-index: 850;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: none;
}

.info-drawer.active {
  display: block;
}

.info-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.info-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.info-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.info-close-btn:hover {
  color: var(--text-primary);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.metric-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
}

.metric-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.metric-val {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  margin-top: 2px;
}

/* Co-location Comparison Card */
.colocation-comparison {
  margin-top: 12px;
  padding: 12px;
  background: #f0fdfa;
  border: 1px solid rgba(13, 148, 136, 0.3);
  border-radius: 8px;
}

.comparison-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 4px 0;
  color: var(--text-secondary);
  border-bottom: 1px dashed var(--border-medium);
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-val-benefit {
  color: var(--accent-mint);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ==========================================================================
   Leaflet Custom Styling (Nordic Wind Clean White Popups & Tooltips)
   ========================================================================== */
.leaflet-container {
  background: var(--bg-frost) !important;
}

.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-medium);
  border-radius: 8px !important;
  box-shadow: var(--shadow-xl) !important;
}

.leaflet-popup-tip {
  background: #ffffff !important;
}

.leaflet-popup-content {
  font-size: 12px !important;
  line-height: 1.5 !important;
  margin: 12px 14px !important;
  color: var(--text-primary) !important;
}

.leaflet-tooltip, .custom-tooltip {
  background: #ffffff !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-medium) !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12) !important;
  font-family: var(--font-sans) !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
}

.leaflet-tooltip:before, .custom-tooltip:before {
  border-top-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-frost);
}

::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-dark);
}

/* ==========================================================================
   Live AEMO Market & Grid Intel Component Styles
   ========================================================================== */
.live-status-bar {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border-left: 3px solid var(--accent-mint);
}

.live-pulse-beacon {
  width: 9px;
  height: 9px;
  background-color: var(--accent-mint);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.7);
  animation: liveBeaconPulse 1.8s infinite;
}

@keyframes liveBeaconPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(13, 148, 136, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(13, 148, 136, 0);
  }
}

.badge-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
  font-family: var(--font-mono);
}

.badge-pill-success {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-family: var(--font-mono);
}

.badge-pill-alert {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-family: var(--font-mono);
}

.status-metric-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-metric-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.status-metric-value {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-metric-value.normal {
  color: var(--status-success);
}

.status-metric-value.warning {
  color: var(--status-warning);
}

.status-metric-value.alert {
  color: var(--status-critical);
}

/* Advisories Feed */
.advisories-feed-container {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.advisory-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent-blue);
  border-radius: 6px;
  padding: 9px 11px;
  transition: all 0.2s;
  cursor: pointer;
}

.advisory-card:hover {
  background: #ffffff;
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.advisory-card.security {
  border-left-color: #ef4444;
}

.advisory-card.reserve {
  border-left-color: #f59e0b;
}

.advisory-card.systems {
  border-left-color: #0284c7;
}

.advisory-card.contingency {
  border-left-color: #ec4899;
}

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

.advisory-cat-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.advisory-time {
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.advisory-summary {
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.advisory-actions-box {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.03);
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-secondary);
  border-left: 2px solid var(--border-dark);
}

/* Demand Box Grid */
.demand-metric-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}

.demand-metric-box.highlight {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.03);
}

.demand-metric-box.solar {
  border-color: rgba(234, 179, 8, 0.3);
  background: rgba(234, 179, 8, 0.04);
}

.demand-box-label {
  font-size: 9.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.demand-box-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.demand-box-sub {
  font-size: 9.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Duck Curve Gauge */
.duck-gauge-container {
  margin-top: 8px;
  padding: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.duck-gauge-track {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.duck-gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 25%, #10b981 60%);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.duck-gauge-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 2;
}

/* Fuel Stack Segment Bar */
.fuel-segment-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--border-light);
}

.fuel-segment-bar .segment {
  height: 100%;
  transition: width 0.4s ease;
}

.seg-coal { background: #18181b; }
.seg-gas { background: #ef4444; }
.seg-wind { background: #3b82f6; }
.seg-solar { background: #f97316; }
.seg-rooftop { background: #eab308; }
.seg-battery { background: #10b981; }

.fuel-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fuel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.fuel-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 130px;
}

.fuel-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.fuel-bar-mini {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 10px;
}

.fuel-bar-mini-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.fuel-row-right {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  min-width: 90px;
  text-align: right;
  color: var(--text-primary);
}

/* Price Hero Card */
.price-hero-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.price-hero-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-blue);
  line-height: 1.1;
  margin: 2px 0;
}

.price-hero-value.negative {
  color: #ef4444;
}

.price-hero-sub {
  font-size: 10px;
  color: var(--status-success);
  font-weight: 600;
}

.price-hero-sub.alert {
  color: #ef4444;
}

/* ESS Grid */
.ess-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.ess-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ess-label {
  font-size: 10px;
  color: var(--text-muted);
}

.ess-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Market Preset Buttons */
.market-preset-btn {
  padding: 8px 6px;
  font-size: 11px;
  text-align: left;
  line-height: 1.3;
  cursor: pointer;
}

.market-preset-btn:hover {
  border-color: var(--accent-blue);
  background: #ffffff;
}

/* Network Intel Callout */
.network-intel-callout {
  background: rgba(37, 99, 235, 0.04);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-left: 3px solid var(--accent-blue);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
}

/* Large-Load Pipeline Markers */
.large-load-marker-icon {
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.large-load-marker-icon:hover {
  transform: scale(1.22);
  z-index: 1000 !important;
}

/* Microgrid Candidate Cards & Opportunity Siting Engine */
.microgrid-candidate-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.microgrid-candidate-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.microgrid-candidate-card.border-constrained {
  border-left: 4px solid #ef4444;
}

.microgrid-candidate-card.border-greenfield {
  border-left: 4px solid #10b981;
}

.microgrid-candidate-card.border-regional {
  border-left: 4px solid #f59e0b;
}

.candidate-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.candidate-title-wrap {
  flex: 1;
}

.candidate-rank-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  display: inline-block;
  margin-bottom: 3px;
}

.candidate-score-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.candidate-metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0;
  background: rgba(0, 0, 0, 0.15);
  padding: 6px 8px;
  border-radius: 6px;
}

.candidate-metric-box {
  display: flex;
  flex-direction: column;
}

.candidate-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.candidate-metric-value {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.candidate-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.candidate-btn-view {
  flex: 1;
  padding: 5px 8px;
  font-size: 10.5px;
  border-radius: 5px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.candidate-btn-view:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

.candidate-btn-sim {
  flex: 1;
  padding: 5px 8px;
  font-size: 10.5px;
  border-radius: 5px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.candidate-btn-sim:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: #60a5fa;
}

/* Microgrid Filter Pills */
.candidate-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.candidate-pill-btn {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 10.5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.candidate-pill-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.candidate-pill-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
  font-weight: 600;
}

/* Microgrid Comparison Table */
.microgrid-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin-top: 8px;
}

.microgrid-matrix-table th {
  text-align: left;
  padding: 6px 6px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-light);
}

.microgrid-matrix-table td {
  padding: 6px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.microgrid-matrix-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}



