:root {
  /* Backgrounds & UI */
  --bg: #050505;
  --panel: rgba(10, 10, 10, 0.96);
  --line: #2f343d;
  
  /* Typography & Accents */
  --text: #ffffff;
  --muted: #a6adbb;
  --accent: #00ffff;
  --accent-alt: #ff9900;
  
  /* Status & Specific Elements */
  --ok: #00ff88;
  --substation: #ff3333;
  --private-sub: #00ff88;
  --inverter: #ffff00;
  --mv: #6633ff;
  --bess: #ff00aa;
  --array-blue: #0066ff;
  --warn: #ff4444;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", monospace;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* Layout */
.dashboard {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1600px;
  height: 100%;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.panel-left {
  width: 440px;
  padding: 20px 20px 80px 20px;
  flex-shrink: 0;
  overflow-y: auto;
  align-items: stretch;
}

.panel-right {
  flex: 1 1 auto;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 400px;
}

/* Typography */
h2 {
  margin: 0 0 10px 0;
  color: var(--text);
  font-size: 18px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

h3 {
  margin: 15px 0 5px 0;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px dashed #333;
  padding-bottom: 3px;
}

/* Tabs */
.tab-container {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 15px;
}

.tab-btn {
  flex: 1;
  padding: 10px 5px;
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-family: monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: 0.2s;
}

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

.tab-btn.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: bold;
  background: rgba(0, 255, 255, 0.05);
}

.tab-content {
  display: none;
}

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

/* Inputs & Forms */
.input-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.input-group input[type="text"], 
.input-group input[type="number"], 
.input-group select {
  width: 95px;
  background: #111;
  color: var(--accent);
  border: 1px solid #444;
  padding: 5px;
  text-align: right;
  border-radius: 3px;
  font-family: monospace;
  font-size: 11px;
}

.input-group input[type="text"] {
  text-align: left;
}

.input-group select {
  width: auto;
  min-width: 140px;
  text-align: left;
}

.tab-content#central_tab .input-group input[type="number"], 
.tab-content#central_tab .input-group select {
  color: var(--accent-alt);
}

.input-group input:focus, 
.input-group select:focus {
  border-color: var(--text);
  outline: none;
}

/* Hide native number input arrows while preserving numeric typing */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Search Box */
.search-box {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
}

.search-box input {
  flex: 1;
  background: #111;
  color: #fff;
  border: 1px solid #444;
  padding: 8px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}

.search-box button {
  background: #222;
  color: var(--text);
  border: 1px solid #555;
  padding: 8px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-family: monospace;
  font-weight: bold;
}

.search-box button:hover {
  background: #444;
  color: #fff;
}

/* Stats */
.stat-box {
  background: rgba(0, 255, 255, 0.05);
  border: 1px solid var(--accent);
  padding: 12px;
  border-radius: 3px;
  margin-top: 15px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 6px;
  color: var(--muted);
}

.stat-val {
  color: var(--text);
  font-weight: bold;
  text-align: right;
}

.stat-val.cyan {
  color: var(--accent);
  font-size: 13px;
}

.stat-val.orange {
  color: var(--accent-alt);
  font-size: 13px;
}

/* Finance Elements */
.finance-box {
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid var(--ok);
  border-radius: 3px;
  padding: 10px;
  margin-top: 15px;
}

.finance-box summary {
  color: var(--ok);
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.finance-headline {
  border: 1px solid #264d3a;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(0, 255, 136, 0.04);
}

.finance-box input[type="number"] {
  width: 95px;
  background: #111;
  color: var(--ok);
  border: 1px solid #444;
  padding: 5px;
  text-align: right;
  border-radius: 3px;
  font-family: monospace;
  font-size: 11px;
}

.finance-box input[type="checkbox"] {
  accent-color: var(--ok);
  cursor: pointer;
  margin: 0;
}

/* Messages & Notes */
.warning-box {
  color: #ffcc00;
  font-size: 10px;
  margin-top: 8px;
  line-height: 1.4;
}

.ux-note {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}

.benchmark-box {
  background: rgba(17, 17, 17, 0.8);
  border: 1px solid #444;
  border-radius: 3px;
  padding: 10px;
  margin-top: 15px;
}

.disclaimer-box {
  background: rgba(255, 68, 68, 0.05);
  border: 1px solid #ff4444;
  color: #ff9999;
  font-size: 10px;
  padding: 12px;
  border-radius: 3px;
  margin-top: 15px;
  line-height: 1.5;
  text-align: justify;
}

.explainer-box {
  background: rgba(0, 255, 255, 0.04);
  border: 1px solid var(--accent);
  color: var(--muted);
  font-size: 10px;
  padding: 12px 12px 28px 12px;
  border-radius: 3px;
  margin-top: 15px;
  line-height: 1.55;
  text-align: justify;
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}

.explainer-box strong {
  color: var(--text);
}

.explainer-box h3 {
  color: var(--accent);
  margin-top: 0;
}

/* Buttons */
.btn {
  padding: 10px;
  background: #000;
  color: var(--text);
  border: 1px solid #555;
  cursor: pointer;
  font-family: monospace;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 3px;
  margin-top: 10px;
  width: 100%;
  transition: 0.2s;
}

.btn:hover {
  background: #222;
  color: #fff;
}

.btn.draw-btn {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

.btn.draw-btn.central {
  background: var(--accent-alt);
  border-color: var(--accent-alt);
}

.map-toggle-btn {
  background: rgba(5, 5, 5, 0.85);
  color: var(--muted);
  border: 1px solid #444;
  padding: 6px 12px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.map-toggle-btn:hover {
  background: #222;
  border-color: #888;
}

.map-toggle-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 255, 255, 0.05);
}

.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.map-toggle-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.voltage-toggle-row .map-toggle-btn {
  font-size: 10px;
  padding: 5px 8px;
}

.atlas-voltage-btn:not(.active) {
  color: #777;
  border-color: #333;
  opacity: 0.65;
}

.atlas-66kv.active { border-color: #66ff66; color: #66ff66; }
.atlas-132kv.active { border-color: #ffcc00; color: #ffcc00; }
.atlas-275kv.active { border-color: #ff66ff; color: #ff66ff; }
.atlas-400kv.active { border-color: #ff3333; color: #ff3333; }
body.map-expanded { overflow: hidden; padding: 0; }
body.map-expanded .dashboard { max-width: none; width: 100vw; height: 100vh; }
body.map-expanded .panel-left { display: none; }
.panel-right.map-expanded { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 9999; border-radius: 0; border: none; }
.panel-right.map-expanded #map { min-height: 100vh; }
.legend.key-collapsed { display: none; }
@media (max-width: 900px) {
  .map-controls { left: 10px; right: 10px; align-items: flex-end; }
  .map-toggle-row { gap: 6px; }
  .map-toggle-btn { font-size: 10px; padding: 5px 7px; }
}
.map-tool-overlay {
  position: absolute;
  top: 110px;
  right: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  max-width: 520px;
}

.map-tool-overlay.tools-collapsed .map-tool-row-secondary,
.map-tool-overlay.tools-collapsed button:not(#btn_map_tools_toggle) {
  display: none;
}

.map-tool-row-secondary .map-toggle-btn {
  font-size: 10px;
  padding: 5px 7px;
}

@media (max-width: 900px) {
  .map-tool-overlay {
    left: 10px;
    right: 10px;
    top: 118px;
    max-width: none;
  }
}
/* Map Elements */
#map {
  width: 100%;
  height: 100%;
  min-height: 400px;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 24px;
  pointer-events: none;
  z-index: 10;
  text-shadow: 0 0 5px #000;
}

.legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px;
  font-size: 10px;
  z-index: 1;
  border-radius: 4px;
  pointer-events: none;
}

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

.swatch {
  width: 12px;
  height: 12px;
  border: 1px solid #666;
}

/* Maplibre Popups */
.maplibregl-popup-content {
  background: #111;
  color: #fff;
  border: 1px solid #444;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  padding: 12px;
  font-size: 11px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.maplibregl-popup-close-button {
  color: #888;
  padding: 4px;
}

.maplibregl-popup-close-button:hover {
  color: #fff;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  border-bottom: 1px solid #222;
  padding-bottom: 2px;
  gap: 15px;
}

.popup-val {
  font-weight: bold;
  color: var(--accent);
}

/* Status Indicator */
#fetch_status {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  background: rgba(5, 5, 5, 0.9);
  border: 1px solid #555;
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 10px;
  color: var(--muted);
  display: none;
}

#fetch_status.error {
  color: #ff6666;
  border-color: #ff4444;
  display: block;
}

/* Responsive Design */
@media (max-width: 800px) {
  html, body {
    height: auto;
  }
  
  body {
    overflow: auto;
    padding: 10px;
  }
  
  .dashboard {
    flex-direction: column;
    height: auto;
  }
  
  .panel-left {
    width: 100%;
    max-height: none;
    flex-shrink: 0;
    padding-bottom: 80px;
  }
  
  .panel-right {
    height: 60vh;
    flex-shrink: 0;
    min-height: 400px;
  }
}

/* GLOBALGRID2050 A4 PORTRAIT PRINT MODE */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  html,
  body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: block !important;
    background: #ffffff !important;
    color: #111111 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 9.5pt !important;
    line-height: 1.35 !important;
  }

  body::before {
    content: "GlobalGrid2050  |  A4 Portrait Screening Report";
    display: block;
    color: #111111;
    font-weight: bold;
    font-size: 13pt;
    border-bottom: 1px solid #999999;
    padding: 0 0 5mm 0;
    margin: 0 0 6mm 0;
  }

  .dashboard,
  .module-app-shell,
  .module-main,
  .topo-main,
  main {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .panel,
  .panel-left,
  .panel-right,
  .module-panel,
  .topo-panel,
  .module-map-card,
  section,
  header,
  .guidance-box,
  .warning-box,
  .status-box,
  .module-note {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #111111 !important;
    border-color: #cccccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .panel,
  .module-panel,
  .topo-panel,
  .module-map-card,
  .guidance-box,
  .warning-box,
  .status-box,
  .module-note {
    border: 1px solid #cccccc !important;
    border-radius: 0 !important;
    padding: 5mm !important;
    margin: 0 0 6mm 0 !important;
  }

  .panel-right,
  .module-map-card {
    page-break-before: auto;
    break-before: auto;
  }

  #map,
  #module_map,
  canvas,
  svg {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 110mm !important;
    max-height: 170mm !important;
    border: 1px solid #999999 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .maplibregl-canvas,
  .maplibregl-map {
    max-width: 100% !important;
  }

  .map-controls,
  .map-tool-overlay,
  .module-map-toolbar,
  .crosshair,
  #fetch_status,
  .maplibregl-control-container,
  .maplibregl-ctrl,
  .maplibregl-ctrl-group,
  .topo-header-links,
  .button-row,
  .btn,
  button,
  .tab-container,
  .topo-tabs,
  .toolbar,
  .print-btn,
  [id*="btn_"],
  [class*="toggle"] {
    display: none !important;
  }

  .legend {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    background: #ffffff !important;
    color: #111111 !important;
    border: 1px solid #cccccc !important;
    padding: 4mm !important;
    margin: 4mm 0 0 0 !important;
    font-size: 8pt !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  h1,
  h2,
  h3,
  h4 {
    color: #111111 !important;
    border-color: #999999 !important;
    page-break-after: avoid;
    break-after: avoid;
  }

  p,
  label,
  div,
  span,
  small,
  strong,
  li {
    color: #111111 !important;
  }

  input,
  select,
  textarea {
    color: #111111 !important;
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .input-group,
  .module-stat,
  .stat-row,
  .summary-row,
  .function-item,
  .card,
  .topo-mode,
  .tab-content {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .tab-content,
  .topo-mode {
    display: block !important;
  }

  .tab-content:not(.active),
  .topo-mode:not(.active) {
    display: block !important;
  }

  a::after {
    content: "" !important;
  }

  * {
    text-shadow: none !important;
    box-shadow: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* GLOBALGRID2050 PRINT V2 COMPACT REPORT MODE */
@media print {
  @page {
    size: A4 portrait;
    margin: 9mm;
  }

  html,
  body {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: block !important;
    background: #fff !important;
    color: #111 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 8.5pt !important;
    line-height: 1.22 !important;
  }

  body::before {
    content: "GlobalGrid2050 Screening Report";
    display: block !important;
    font-weight: 700 !important;
    font-size: 11pt !important;
    color: #111 !important;
    border-bottom: 1px solid #999 !important;
    padding: 0 0 3mm 0 !important;
    margin: 0 0 4mm 0 !important;
  }

  .dashboard,
  .module-app-shell,
  .module-main,
  .topo-main,
  main {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    gap: 0 !important;
  }

  header,
  .panel,
  .panel-left,
  .panel-right,
  .module-panel,
  .topo-panel,
  .module-map-card,
  .guidance-box,
  .warning-box,
  .status-box,
  .module-note {
    display: block !important;
    position: static !important;
    inset: auto !important;
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #ccc !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 3.5mm !important;
    margin: 0 0 4mm 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .panel-left,
  .module-panel,
  .topo-panel {
    column-count: 2;
    column-gap: 8mm;
    column-rule: 1px solid #ddd;
  }

  .panel-right,
  .panel-right.map-expanded,
  .panel-right.map-fullscreen,
  .module-map-card {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    z-index: auto !important;
    page-break-before: auto !important;
    break-before: auto !important;
    column-count: initial !important;
    column-gap: initial !important;
    column-rule: none !important;
  }

  #map,
  #module_map {
    display: block !important;
    width: 100% !important;
    height: 125mm !important;
    min-height: 125mm !important;
    max-height: 125mm !important;
    border: 1px solid #999 !important;
    margin: 0 0 3mm 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  canvas,
  svg {
    max-width: 100% !important;
    height: auto !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .maplibregl-canvas,
  .maplibregl-map {
    max-width: 100% !important;
  }

  .map-controls,
  .map-tool-overlay,
  .module-map-toolbar,
  .crosshair,
  #fetch_status,
  .maplibregl-control-container,
  .maplibregl-ctrl,
  .maplibregl-ctrl-group,
  .search-box,
  .button-row,
  .btn,
  button,
  .tab-container,
  .topo-tabs,
  .toolbar,
  .print-btn,
  [id*="btn_"],
  [class*="toggle"] {
    display: none !important;
  }

  .legend {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    background: #fff !important;
    color: #111 !important;
    border: 1px solid #ccc !important;
    padding: 2.5mm !important;
    margin: 2mm 0 0 0 !important;
    font-size: 7.5pt !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .legend * {
    color: #111 !important;
  }

  h1 {
    font-size: 14pt !important;
    line-height: 1.15 !important;
    margin: 0 0 3mm 0 !important;
    padding: 0 !important;
  }

  h2 {
    font-size: 10pt !important;
    line-height: 1.15 !important;
    margin: 2.5mm 0 1.5mm 0 !important;
    padding: 0 0 1mm 0 !important;
    border-bottom: 1px solid #999 !important;
    color: #111 !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  h3 {
    font-size: 8.5pt !important;
    line-height: 1.15 !important;
    margin: 2mm 0 1mm 0 !important;
    padding: 0 0 0.75mm 0 !important;
    border-bottom: 1px dotted #bbb !important;
    color: #111 !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  p,
  label,
  div,
  span,
  small,
  strong,
  li {
    color: #111 !important;
  }

  p {
    margin: 0 0 2mm 0 !important;
  }

  .input-group,
  .module-stat,
  .stat-row,
  .summary-row {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 2mm !important;
    align-items: baseline !important;
    margin: 0 0 1mm 0 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  input,
  select,
  textarea {
    color: #111 !important;
    background: #fff !important;
    border: none !important;
    border-bottom: 1px solid #aaa !important;
    padding: 0 !important;
    min-height: 0 !important;
    font-size: 8.5pt !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .tab-content,
  .topo-mode {
    display: none !important;
  }

  .tab-content.active,
  .topo-mode.active,
  .topo-mode[data-mode-panel].active {
    display: block !important;
  }

  details:not([open]) {
    display: none !important;
  }

  .collapsed,
  .hidden,
  [hidden] {
    display: none !important;
  }

  .warning,
  .notice,
  .guidance-box,
  .warning-box,
  .status-box,
  .module-note {
    font-size: 8pt !important;
    line-height: 1.2 !important;
  }

  a::after {
    content: "" !important;
  }

  * {
    text-shadow: none !important;
    box-shadow: none !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* GLOBALGRID2050 PRINT V3 FINANCIALS PATCH */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  body {
    font-size: 8pt !important;
    line-height: 1.16 !important;
  }

  /* Print only the selected topology tab. */
  #string_tab:not(.active),
  #central_tab:not(.active),
  .tab-content:not(.active) {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  #string_tab.active,
  #central_tab.active,
  .tab-content.active {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Financial section should read like a report table, not a screen form. */
  details.finance-box,
  details.finance-box[open],
  .finance-box {
    display: block !important;
    open: true;
    background: #ffffff !important;
    color: #111111 !important;
    border: 1px solid #bbbbbb !important;
    border-radius: 0 !important;
    padding: 2.5mm !important;
    margin: 2mm 0 3mm 0 !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .finance-box summary {
    display: block !important;
    font-weight: 700 !important;
    font-size: 9pt !important;
    color: #111111 !important;
    border-bottom: 1px solid #999999 !important;
    padding: 0 0 1.5mm 0 !important;
    margin: 0 0 2mm 0 !important;
    list-style: none !important;
  }

  .finance-box summary::-webkit-details-marker {
    display: none !important;
  }

  .finance-headline,
  .finance-box .finance-headline {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    column-gap: 6mm !important;
    row-gap: 0.6mm !important;
    background: #ffffff !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 0 2mm 0 !important;
  }

  .finance-box h3 {
    display: block !important;
    clear: both !important;
    font-size: 8.5pt !important;
    color: #111111 !important;
    border-bottom: 1px solid #bbbbbb !important;
    margin: 2mm 0 1mm 0 !important;
    padding: 0 0 0.8mm 0 !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  .finance-box .input-group,
  .finance-box .stat-row,
  details.finance-box .input-group,
  details.finance-box .stat-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 34mm !important;
    gap: 2mm !important;
    align-items: baseline !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0.55mm 0 !important;
    border-bottom: 1px dotted #dddddd !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .finance-box .input-group[style],
  details.finance-box .input-group[style] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 58mm !important;
    margin: 0 !important;
    padding: 0.55mm 0 !important;
  }

  .finance-box label,
  .finance-box .stat-row span:first-child {
    color: #111111 !important;
    font-weight: 400 !important;
    white-space: normal !important;
  }

  .finance-box input,
  .finance-box select,
  .finance-box textarea,
  .finance-box .stat-val,
  .finance-box .cyan,
  .finance-box .orange,
  .finance-box .green,
  .finance-box [class*="cyan"],
  .finance-box [class*="green"],
  .finance-box [class*="orange"] {
    color: #111111 !important;
    background: #ffffff !important;
    border: 0 !important;
    border-bottom: 1px solid #aaaaaa !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-weight: 700 !important;
    text-align: right !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .finance-box select {
    white-space: normal !important;
    text-align: left !important;
    font-weight: 400 !important;
    width: 100% !important;
  }

  .finance-box .warning-box,
  .finance-box [id$="_warnings"] {
    display: block !important;
    color: #111111 !important;
    background: #ffffff !important;
    border: 1px solid #999999 !important;
    padding: 2mm !important;
    margin: 2mm 0 0 0 !important;
    font-size: 7.5pt !important;
    line-height: 1.18 !important;
  }

  .finance-box .warning-box:empty,
  .finance-box [id$="_warnings"]:empty {
    display: none !important;
  }

  /* Prevent repeated zero width oddities and duplicated single values. */
  .finance-box input[type="checkbox"] {
    width: 4mm !important;
    height: 4mm !important;
    border: 1px solid #111111 !important;
  }

  /* Compact normal left report panels after finance expansion. */
  .panel-left {
    padding: 3mm !important;
  }

  .panel-left > h2 {
    font-size: 11pt !important;
    margin-bottom: 3mm !important;
  }

  .stat-box,
  .disclaimer-box,
  .explainer-box {
    padding: 2.5mm !important;
    margin: 0 0 3mm 0 !important;
  }

  .explainer-box p,
  .disclaimer-box,
  .ux-note {
    font-size: 7.6pt !important;
    line-height: 1.18 !important;
  }

  /* Keep the map as a final report figure and not an oversized blank section. */
  .panel-right {
    padding: 3mm !important;
    margin-top: 3mm !important;
  }

  #map {
    height: 115mm !important;
    min-height: 115mm !important;
    max-height: 115mm !important;
  }

  .legend {
    font-size: 7pt !important;
    padding: 2mm !important;
    margin-top: 2mm !important;
  }
}

/* GLOBALGRID2050 GIS SLD PRINT MAP PACK */
@media print {
  .panel-right {
    page-break-before: auto !important;
    break-before: auto !important;
  }

  #map {
    height: 150mm !important;
    min-height: 150mm !important;
    max-height: 150mm !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .print-map-pack {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #111111 !important;
  }

  .print-map-page {
    display: block !important;
    width: 100% !important;
    min-height: 265mm !important;
    page-break-before: always !important;
    break-before: page !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #111111 !important;
  }

  .print-map-page h2 {
    display: block !important;
    font-size: 12pt !important;
    color: #111111 !important;
    margin: 0 0 4mm 0 !important;
    padding: 0 0 2mm 0 !important;
    border-bottom: 1px solid #999999 !important;
  }

  .print-map-page img {
    display: block !important;
    width: 100% !important;
    height: 225mm !important;
    object-fit: contain !important;
    border: 1px solid #999999 !important;
    background: #ffffff !important;
    margin: 0 0 3mm 0 !important;
  }

  .print-map-page p {
    display: block !important;
    color: #111111 !important;
    font-size: 8pt !important;
    line-height: 1.2 !important;
    margin: 0 !important;
  }

  .print-map-page-landscape {
    min-height: 265mm !important;
  }

  .print-map-page-landscape img {
    height: 225mm !important;
  }
}

@media screen {
  .print-map-pack {
    display: none;
  }
}

/* GLOBALGRID2050 SIMPLE SAFE PRINT MAP FIX */
@media print {
  /* The report prints first. The live map prints as one large page figure after report content. */
  .panel-right {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    page-break-before: always !important;
    break-before: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: #ffffff !important;
  }

  .panel-right::before {
    content: "Map Figure: Current GIS SLD View";
    display: block !important;
    font-size: 12pt !important;
    font-weight: 700 !important;
    color: #111111 !important;
    border-bottom: 1px solid #999999 !important;
    padding: 0 0 3mm 0 !important;
    margin: 0 0 4mm 0 !important;
  }

  #map {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: 230mm !important;
    min-height: 230mm !important;
    max-height: 230mm !important;
    overflow: hidden !important;
    border: 1px solid #999999 !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .map-controls,
  .map-tool-overlay,
  .crosshair,
  #fetch_status,
  .maplibregl-control-container,
  .maplibregl-ctrl,
  .maplibregl-ctrl-group,
  .legend {
    display: none !important;
  }

  .print-map-pack,
  .print-map-page,
  .print-map-page-landscape {
    display: none !important;
  }
}

/* GLOBALGRID2050 OPERATING ASSET LAYER BUTTONS */
.asset-toggle-row {
    margin-top: 6px;
}
.asset-layer-btn {
    opacity: 0.5;
}
.asset-layer-btn.active {
    opacity: 1;
}
.asset-solar.active {
    border-color: #00ff88;
    color: #00ff88;
}
.asset-wind-onshore.active {
    border-color: #00ffcc;
    color: #00ffcc;
}
.asset-wind-offshore.active {
    border-color: #0066ff;
    color: #66aaff;
}
.asset-bess.active {
    border-color: #ff69b4;
    color: #ff69b4;
}
@media print {
    .asset-toggle-row {
        display: none !important;
    }
}

/* GLOBALGRID2050 V7 ARRAY VISIBILITY AND MWp SIZING */
.array-size-control input {
    color: var(--accent);
    font-weight: bold;
}
.array-size-note {
    border-left: 2px solid var(--accent);
    padding-left: 8px;
    margin-bottom: 10px;
}
.map-size-row {
    align-items: center;
}
.map-size-input {
    width: 90px;
    min-width: 90px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.82);
    border: 1px solid #2f343d;
    border-radius: 4px;
    color: #00ffff;
    font-family: "Courier New", monospace;
    font-size: 12px;
    font-weight: bold;
}
.map-size-input:focus {
    outline: none;
    border-color: #00ffff;
}
.map-size-status {
    color: #a6adbb;
    font-size: 10px;
    font-weight: bold;
    padding: 8px 4px;
    white-space: nowrap;
}
#btn_array_toggle.active {
    border-color: #00ff88;
    color: #00ff88;
}
#btn_array_toggle:not(.active) {
    opacity: 0.55;
}
@media (max-width: 768px) {
    .map-size-row {
        display: flex;
        flex-wrap: wrap;
    }
    .map-size-input {
        width: 82px;
        min-width: 82px;
    }
    .map-size-status {
        width: 100%;
    }
}
@media print {
    .map-size-row,
    .array-size-note {
        display: none !important;
    }
}

/* GLOBALGRID2050 V7 MOBILE TOOLS ENERGY LAYER CLEARANCE FIX */
@media (max-width: 900px) {
  .map-controls {
    z-index: 30 !important;
  }

  .asset-toggle-row,
  .voltage-toggle-row {
    position: relative !important;
    z-index: 35 !important;
    pointer-events: auto !important;
  }

  .asset-toggle-row .map-toggle-btn,
  .voltage-toggle-row .map-toggle-btn {
    pointer-events: auto !important;
  }

  .map-tool-overlay,
  .map-tool-overlay.tools-collapsed,
  .panel-right.map-expanded .map-tool-overlay,
  .panel-right.map-expanded .map-tool-overlay.tools-collapsed,
  body.map-expanded .map-tool-overlay,
  body.map-expanded .map-tool-overlay.tools-collapsed {
    top: 265px !important;
    left: 10px !important;
    right: 10px !important;
    z-index: 24 !important;
    max-width: none !important;
    align-items: stretch !important;
    pointer-events: none !important;
  }

  .map-tool-overlay .map-toggle-btn,
  .map-tool-overlay input,
  .map-tool-overlay span {
    pointer-events: auto !important;
  }

  .map-tool-overlay > .map-toggle-row {
    justify-content: center !important;
  }

  .map-tool-overlay.tools-collapsed {
    width: auto !important;
  }

  .map-tool-overlay.tools-collapsed #btn_map_tools_toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .map-tool-overlay.tools-collapsed .map-size-row,
  .map-tool-overlay.tools-collapsed .map-tool-row-secondary,
  .map-tool-overlay.tools-collapsed button:not(#btn_map_tools_toggle) {
    display: none !important;
  }
}

@media (max-width: 520px) {
  .map-tool-overlay,
  .map-tool-overlay.tools-collapsed,
  .panel-right.map-expanded .map-tool-overlay,
  .panel-right.map-expanded .map-tool-overlay.tools-collapsed,
  body.map-expanded .map-tool-overlay,
  body.map-expanded .map-tool-overlay.tools-collapsed {
    top: 285px !important;
  }

  .map-tool-overlay > .map-toggle-row:first-child {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
  }
}

/* GLOBALGRID2050 V7 LARGE ASSET MARKERS AND GIS SEARCH */
.gis-map-search {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 45;
    display: flex;
    gap: 6px;
    align-items: flex-start;
    width: min(420px, calc(100% - 20px));
    pointer-events: auto;
}
.gis-search-input {
    flex: 1;
    min-width: 0;
    height: 32px;
    background: rgba(0, 0, 0, 0.88);
    color: #00ffff;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 6px 9px;
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: bold;
}
.gis-search-input:focus {
    outline: none;
    border-color: #00ffff;
}
.gis-search-btn {
    height: 32px;
    padding: 6px 10px;
}
.gis-search-results {
    display: none;
    position: absolute;
    top: 38px;
    left: 0;
    right: 44px;
    background: rgba(5, 5, 5, 0.96);
    border: 1px solid #2f343d;
    border-radius: 4px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 46;
}
.gis-search-result,
.gis-search-result-empty {
    display: block;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #222;
    color: #ffffff;
    font-family: "Courier New", monospace;
    font-size: 10px;
    text-align: left;
    cursor: pointer;
}
.gis-search-result:hover {
    background: rgba(0, 255, 255, 0.08);
}
.gis-search-result strong {
    display: block;
    color: #ffffff;
    margin-bottom: 3px;
}
.gis-search-result span {
    display: block;
    color: #a6adbb;
}
.gis-search-result.asset span {
    color: #00ff88;
}
.gis-search-result.substation span {
    color: #ff9999;
}
.gis-search-result-empty {
    color: #a6adbb;
    cursor: default;
}

@media (max-width: 900px) {
    .gis-map-search {
        top: 54px;
        left: 10px;
        right: 10px;
        width: auto;
    }
    .map-controls {
        padding-top: 0 !important;
    }
}

@media (max-width: 520px) {
    .gis-map-search {
        top: 58px;
        width: auto;
    }
    .gis-search-input {
        height: 34px;
        font-size: 10px;
    }
    .gis-search-btn {
        height: 34px;
    }
}

@media print {
    .gis-map-search {
        display: none !important;
    }
}

/* GLOBALGRID2050 V7 SITE INTELLIGENCE PANEL */
.site-intel-panel {
    position: absolute;
    right: 12px;
    bottom: 16px;
    z-index: 42;
    width: min(380px, calc(100% - 24px));
    max-height: 58%;
    overflow-y: auto;
    background: rgba(5, 5, 5, 0.94);
    border: 1px solid #2f343d;
    border-radius: 8px;
    color: #ffffff;
    font-family: "Courier New", monospace;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.site-intel-panel.collapsed {
    display: none;
}
.site-intel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #2f343d;
    color: #00ffff;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
}
.site-intel-header button {
    background: transparent;
    border: 0;
    color: #a6adbb;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.site-intel-body {
    padding: 10px 12px 12px 12px;
    font-size: 11px;
}
.site-intel-section-title {
    color: #00ff88;
    font-weight: bold;
    text-transform: uppercase;
    margin: 8px 0 6px 0;
}
.site-intel-row {
    display: grid;
    grid-template-columns: 105px 1fr;
    gap: 4px 8px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-intel-row.warn .site-intel-main,
.site-intel-row.warn .site-intel-meta {
    color: #ff9900;
}
.site-intel-label {
    color: #a6adbb;
}
.site-intel-main {
    color: #ffffff;
    font-weight: bold;
    word-break: break-word;
}
.site-intel-meta {
    grid-column: 2;
    color: #00ffff;
}
.site-intel-notes {
    margin: 6px 0 8px 18px;
    padding: 0;
    color: #ffffff;
}
.site-intel-notes li {
    margin-bottom: 5px;
}
.site-intel-disclaimer,
.site-intel-loading,
.site-intel-warning {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #333;
    background: rgba(255,255,255,0.04);
    color: #a6adbb;
    line-height: 1.35;
}
.site-intel-warning {
    color: #ff9900;
    border-color: #ff9900;
}

@media (max-width: 900px) {
    .site-intel-panel {
        left: 10px;
        right: 10px;
        bottom: 14px;
        width: auto;
        max-height: 45%;
    }
    .site-intel-row {
        grid-template-columns: 96px 1fr;
    }
}

@media print {
    .site-intel-panel {
        display: none !important;
    }
}

/* GLOBALGRID2050 V7 ASSET PIPELINE DROPDOWN STATUS FILTER */
.asset-filter-row {
    gap: 6px;
}
.map-asset-select,
.map-asset-status-select,
.asset-range-input {
    height: 32px;
    background: rgba(0, 0, 0, 0.84);
    color: #00ff88;
    border: 1px solid #2f343d;
    border-radius: 4px;
    font-family: "Courier New", monospace;
    font-size: 11px;
    font-weight: bold;
    padding: 6px 8px;
}
.map-asset-select {
    min-width: 150px;
}
.map-asset-status-select {
    min-width: 160px;
    color: #00ffff;
}
.asset-range-input {
    width: 76px;
    text-align: center;
}
.map-asset-select:focus,
.map-asset-status-select:focus,
.asset-range-input:focus {
    outline: none;
    border-color: #00ff88;
}
@media (max-width: 900px) {
    .asset-filter-row {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        position: relative !important;
        z-index: 35 !important;
    }
    .map-asset-select { min-width: 142px; max-width: 170px; }
    .map-asset-status-select { min-width: 150px; max-width: 190px; }
    .asset-range-input { width: 72px; }
}
@media (max-width: 520px) {
    .map-asset-select { width: 150px; min-width: 150px; }
    .map-asset-status-select { width: 160px; min-width: 160px; }
    .asset-range-input { width: 70px; }
}
@media print {
    .asset-filter-row { display: none !important; }
}

