﻿:root {
      --bg: #05070a;
      --panel: #0d1318;
      --panel-strong: #101921;
      --surface: #071016;
      --border: rgba(125,249,255,.18);
      --border-strong: rgba(245,199,107,.4);
      --text: #d9fff8;
      --muted: rgba(217,255,248,.64);
      --cyan: #00ffd5;
      --gold: #f5c76b;
      --danger: #ff6b6b;
      --good: #55d187;
      --warning: #ffd166;
      --input: #04080c;
      --grid-color: rgba(125,249,255,.035);
      --violet: #b388ff;
      --blue: #5cc8ff;
    }

    * { box-sizing: border-box; }

    html,
    body {
      margin: 0;
      min-height: 100%;
      background: var(--bg);
      color: var(--text);
      font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    body {
      min-height: 100vh;
      overflow: hidden;
      background:
        linear-gradient(135deg, rgba(0,255,213,.08), transparent 32%),
        linear-gradient(315deg, rgba(245,199,107,.08), transparent 34%),
        var(--bg);
    }

    body::before {
      content: "";
      position: fixed;
      inset: 0;
      background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
      background-size: 42px 42px;
      pointer-events: none;
      z-index: 1;
    }

    button,
    input,
    select {
      font: inherit;
    }

    .acled-shell {
      position: relative;
      z-index: 2;
      display: grid;
      grid-template-rows: auto 1fr;
      min-height: 100vh;
    }

    .acled-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      min-height: 68px;
      padding: 12px 18px;
      border-bottom: 1px solid var(--border);
      background: rgba(3, 7, 10, .9);
      backdrop-filter: blur(16px);
    }

    .acled-title {
      min-width: 0;
    }

    .acled-kicker {
      color: var(--gold);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .18em;
      text-transform: uppercase;
    }

    h1 {
      margin: 4px 0 0;
      font-size: clamp(22px, 3vw, 34px);
      line-height: 1;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .home-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 38px;
      padding: 0 13px;
      border: 1px solid rgba(0,255,213,.36);
      border-radius: 8px;
      background: rgba(0,255,213,.08);
      color: var(--text);
      text-decoration: none;
      font-size: 11px;
      font-weight: 900;
      letter-spacing: .12em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .home-link:hover {
      border-color: rgba(245,199,107,.65);
      background: rgba(245,199,107,.08);
    }

    .layout {
      display: grid;
      grid-template-columns: 390px minmax(0, 1fr);
      min-height: 0;
    }

    .sidebar {
      min-height: 0;
      max-height: calc(100vh - 68px);
      overflow: auto;
      border-right: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(13,19,24,.96), rgba(6,10,14,.96));
      padding: 12px;
    }

    .map-wrap {
      position: relative;
      min-height: 0;
    }

    #map {
      width: 100%;
      height: calc(100vh - 68px);
      background: #0b0f14;
    }

    .control-group {
      margin-bottom: 10px;
      padding: 12px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.014));
      box-shadow: 0 16px 40px rgba(0,0,0,.18);
    }

    details.control-group {
      padding: 0;
      overflow: hidden;
    }

    details.control-group > summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 46px;
      padding: 0 12px;
      color: var(--gold);
      cursor: pointer;
      font-size: 11px;
      font-weight: 900;
      letter-spacing: .16em;
      list-style: none;
      text-transform: uppercase;
    }

    details.control-group > summary::-webkit-details-marker {
      display: none;
    }

    details.control-group > summary::after {
      content: "+";
      display: grid;
      place-items: center;
      width: 22px;
      height: 22px;
      border: 1px solid rgba(125,249,255,.22);
      border-radius: 50%;
      color: var(--cyan);
      background: rgba(0,255,213,.06);
    }

    details.control-group[open] > summary::after {
      content: "-";
      border-color: rgba(245,199,107,.42);
      color: var(--gold);
      background: rgba(245,199,107,.08);
    }

    .control-inner {
      padding: 0 12px 12px;
    }

    .control-group h2 {
      margin: 0 0 10px;
      color: var(--gold);
      font-size: 11px;
      font-weight: 900;
      letter-spacing: .16em;
      text-transform: uppercase;
    }

    label {
      display: block;
      margin-bottom: 8px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      letter-spacing: .02em;
    }

    input,
    select {
      width: 100%;
      min-height: 38px;
      margin-top: 5px;
      border: 1px solid rgba(125,249,255,.16);
      border-radius: 7px;
      padding: 8px 9px;
      background: var(--input);
      color: var(--text);
      outline: none;
    }

    input:focus,
    select:focus {
      border-color: rgba(0,255,213,.55);
      box-shadow: 0 0 0 2px rgba(0,255,213,.08);
    }

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

    .button-row {
      margin-top: 8px;
    }

    .scope-load {
      width: 100%;
      margin-top: 8px;
    }

    button {
      min-height: 39px;
      border: 1px solid rgba(125,249,255,.22);
      border-radius: 8px;
      padding: 8px 10px;
      background: rgba(125,249,255,.08);
      color: var(--text);
      cursor: pointer;
      font-size: 12px;
      font-weight: 900;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    button:hover {
      border-color: var(--border-strong);
      background: rgba(245,199,107,.08);
    }

    button.primary {
      border-color: rgba(245,199,107,.5);
      background: rgba(245,199,107,.14);
      color: #ffe0a0;
    }

    button.good {
      border-color: rgba(85,209,135,.45);
      background: rgba(85,209,135,.12);
      color: #a8f4c7;
    }

    button.danger {
      border-color: rgba(255,107,107,.4);
      background: rgba(255,107,107,.1);
      color: #ffb0b8;
    }

    button:disabled {
      opacity: .45;
      cursor: not-allowed;
    }

    .status {
      margin-top: 10px;
      min-height: 48px;
      border: 1px solid rgba(125,249,255,.16);
      border-radius: 8px;
      padding: 10px;
      background: rgba(4,8,12,.78);
      color: var(--muted);
      font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
      font-size: 11px;
      line-height: 1.45;
      white-space: pre-wrap;
    }

    .status.good {
      color: var(--good);
      border-color: rgba(85,209,135,.36);
    }

    .status.bad {
      color: var(--danger);
      border-color: rgba(255,107,107,.44);
    }

    .small-note {
      margin: -2px 0 8px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.4;
    }

    .warning-bar {
      display: none;
      position: absolute;
      left: 12px;
      right: 12px;
      top: 68px;
      z-index: 800;
      border: 1px solid rgba(255,209,102,.5);
      border-radius: 8px;
      padding: 10px 12px;
      background: rgba(48,37,9,.94);
      color: var(--warning);
      font-size: 13px;
      box-shadow: 0 12px 30px rgba(0,0,0,.36);
    }

    .map-command {
      position: absolute;
      left: 12px;
      top: 12px;
      right: 12px;
      z-index: 810;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 10px;
      pointer-events: none;
    }

    .query-chips,
    .basemap-dock {
      display: flex;
      align-items: center;
      gap: 7px;
      min-height: 42px;
      border: 1px solid rgba(125,249,255,.18);
      border-radius: 8px;
      padding: 7px;
      background: rgba(4,8,12,.78);
      box-shadow: 0 14px 34px rgba(0,0,0,.34);
      backdrop-filter: blur(12px);
      pointer-events: auto;
    }

    .query-chips {
      flex-wrap: wrap;
    }

    .query-chip {
      display: inline-flex;
      align-items: center;
      min-height: 26px;
      border: 1px solid rgba(125,249,255,.18);
      border-radius: 999px;
      padding: 0 9px;
      color: var(--text);
      background: rgba(0,255,213,.07);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .04em;
      white-space: nowrap;
    }

    .query-chip.hot {
      border-color: rgba(245,199,107,.4);
      background: rgba(245,199,107,.1);
      color: #ffe0a0;
    }

    .basemap-dock button {
      min-height: 28px;
      border-radius: 999px;
      padding: 0 10px;
      font-size: 10px;
      letter-spacing: .08em;
    }

    .basemap-dock button.active {
      border-color: rgba(245,199,107,.64);
      background: rgba(245,199,107,.16);
      color: #ffe0a0;
      box-shadow: 0 0 24px rgba(245,199,107,.12);
    }

    .map-select-label {
      display: grid;
      grid-template-columns: auto minmax(190px, 1fr);
      align-items: center;
      gap: 8px;
      margin: 0;
      color: var(--gold);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .map-select-label select {
      min-height: 30px;
      margin: 0;
      border-radius: 999px;
      padding: 4px 28px 4px 10px;
      font-size: 11px;
      letter-spacing: 0;
      text-transform: none;
    }

    .attrib-box,
    .legend {
      position: absolute;
      z-index: 800;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: rgba(4,8,12,.84);
      box-shadow: 0 12px 30px rgba(0,0,0,.32);
      backdrop-filter: blur(10px);
    }

    .attrib-box {
      right: 12px;
      bottom: 22px;
      max-width: min(440px, calc(100% - 24px));
      padding: 8px 10px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
    }

    .legend {
      left: 12px;
      bottom: 22px;
      padding: 10px;
      color: var(--text);
      font-size: 12px;
      line-height: 1.5;
    }

    .legend-section + .legend-section {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid rgba(125,249,255,.12);
    }

    .legend strong {
      display: block;
      margin-bottom: 4px;
      color: var(--gold);
      font-size: 11px;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .legend-row {
      display: flex;
      align-items: center;
      gap: 7px;
      white-space: nowrap;
    }

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

    .legend-icon {
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      width: 24px;
      height: 24px;
      border: 2px solid rgba(143,161,173,.78);
      border-radius: 50%;
      background:
        radial-gradient(circle at 35% 28%, rgba(255,255,255,.16), transparent 28%),
        rgba(4,8,12,.9);
      color: var(--legend-icon-color);
      box-shadow: 0 0 12px var(--legend-icon-glow);
    }

    .legend-icon svg {
      width: 15px;
      height: 15px;
      stroke: currentColor;
      fill: none;
      stroke-width: 2.4;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .actor-dot {
      display: inline-block;
      width: 11px;
      height: 11px;
      border-radius: 50%;
      border: 1px solid rgba(255,255,255,.5);
    }

    .actor-dot.state { background: #2f9bff; }
    .actor-dot.threat { background: #ff3d4d; }
    .actor-dot.civilian { background: #55d187; }
    .actor-dot.mixed {
      background: linear-gradient(90deg, #2f9bff 0 50%, #ff3d4d 50% 100%);
    }
    .actor-dot.other { background: #8fa1ad; }

    .incident-marker {
      position: relative;
      display: grid;
      place-items: center;
      width: var(--marker-size);
      height: var(--marker-size);
      border-radius: 50%;
      padding: 3px;
      background:
        var(--actor-ring);
      box-shadow:
        0 0 0 1px rgba(0,0,0,.42),
        0 0 18px var(--actor-glow);
      color: var(--incident-color);
    }

    .incident-marker .marker-face {
      position: relative;
      z-index: 1;
      display: grid;
      place-items: center;
      width: 100%;
      height: 100%;
      border-radius: 50%;
      background:
        radial-gradient(circle at 35% 28%, rgba(255,255,255,.2), transparent 26%),
        rgba(4,8,12,.9);
    }

    .incident-marker.high-fatality::before {
      content: "";
      position: absolute;
      inset: -7px;
      border: 1px solid var(--incident-color);
      border-radius: 50%;
      opacity: .45;
    }

    .incident-marker svg {
      width: 60%;
      height: 60%;
      stroke: currentColor;
      fill: none;
      stroke-width: 2.4;
      stroke-linecap: round;
      stroke-linejoin: round;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,.7));
    }

    .incident-marker.cluster {
      cursor: pointer;
    }

    .incident-marker .cluster-count {
      position: absolute;
      top: -8px;
      right: -10px;
      z-index: 2;
      display: grid;
      place-items: center;
      min-width: 20px;
      height: 20px;
      border: 1px solid rgba(245,199,107,.7);
      border-radius: 999px;
      padding: 0 5px;
      background: rgba(4,8,12,.92);
      color: #ffe0a0;
      font-size: 11px;
      font-weight: 950;
      letter-spacing: .02em;
      box-shadow: 0 0 20px rgba(245,199,107,.2);
    }

    .explode-line {
      stroke: rgba(245,199,107,.78);
      stroke-width: 1.5;
      stroke-dasharray: 3 4;
      filter: drop-shadow(0 0 5px rgba(245,199,107,.3));
    }

    .summary {
      display: none;
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 5000;
      display: none;
      background:
        radial-gradient(circle at 16% 12%, rgba(0,255,213,.13), transparent 34%),
        radial-gradient(circle at 84% 18%, rgba(179,136,255,.12), transparent 30%),
        rgba(1, 4, 7, .9);
      backdrop-filter: blur(12px);
    }

    .modal-backdrop.open {
      display: block;
    }

    .summary-modal {
      display: grid;
      grid-template-rows: auto 1fr;
      width: min(1480px, calc(100vw - 28px));
      height: min(900px, calc(100vh - 28px));
      margin: 14px auto;
      border: 1px solid rgba(125,249,255,.24);
      border-radius: 8px;
      background: linear-gradient(145deg, rgba(8,14,19,.98), rgba(3,7,11,.98));
      box-shadow: 0 30px 100px rgba(0,0,0,.56);
      overflow: hidden;
    }

    .summary-modal-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      min-height: 70px;
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      background: rgba(4,8,12,.86);
    }

    .summary-modal-title {
      min-width: 0;
    }

    .summary-modal-title h2 {
      margin: 4px 0 0;
      color: var(--text);
      font-size: clamp(20px, 3vw, 34px);
      line-height: 1;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .summary-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 8px;
    }

    .summary-modal-body {
      overflow: auto;
      padding: 14px;
    }

    .summary-grid {
      display: grid;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      gap: 12px;
    }

    .summary-block {
      border: 1px solid rgba(125,249,255,.16);
      border-radius: 8px;
      padding: 12px;
      background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.012));
      min-width: 0;
    }

    .summary-block.wide {
      grid-column: span 8;
    }

    .summary-block.mid {
      grid-column: span 6;
    }

    .summary-block.side {
      grid-column: span 4;
    }

    .summary-block.full {
      grid-column: 1 / -1;
    }

    .summary-block h3 {
      margin: 0 0 10px;
      color: var(--gold);
      font-size: 11px;
      font-weight: 900;
      letter-spacing: .14em;
      text-transform: uppercase;
    }

    .chart-frame {
      position: relative;
      height: 280px;
    }

    .chart-frame.tall {
      height: 380px;
    }

    .summary-block canvas {
      width: 100% !important;
      height: 100% !important;
    }

    .summary-table-wrap {
      max-height: 340px;
      overflow: auto;
    }

    .tempo-note {
      margin-top: 8px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }

    body.summary-printing > .acled-shell,
    body.summary-printing > .leaflet-container {
      display: none !important;
    }

    @media print {
      body {
        overflow: visible;
        background: #fff;
        color: #111;
      }

      body > .acled-shell {
        display: none !important;
      }

      .modal-backdrop {
        position: static;
        display: block !important;
        background: #fff;
        backdrop-filter: none;
      }

      .summary-modal {
        width: 100%;
        height: auto;
        margin: 0;
        border: 0;
        box-shadow: none;
        background: #fff;
      }

      .summary-modal-head,
      .summary-block {
        color: #111;
        background: #fff;
        border-color: #bbb;
      }

      .summary-actions {
        display: none;
      }

      .summary-modal-body {
        overflow: visible;
      }

      .summary-grid {
        display: block;
      }

      .summary-block {
        break-inside: avoid;
        margin-bottom: 12px;
      }
    }

    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
      margin-bottom: 10px;
    }

    .kpi {
      border: 1px solid rgba(125,249,255,.14);
      border-radius: 8px;
      padding: 10px;
      background: rgba(4,8,12,.72);
    }

    .kpi .label {
      color: var(--muted);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    .kpi .value {
      margin-top: 4px;
      color: var(--text);
      font-size: 22px;
      font-weight: 900;
    }

    table {
      width: 100%;
      margin-top: 8px;
      border-collapse: collapse;
      font-size: 12px;
    }

    th,
    td {
      border-bottom: 1px solid rgba(125,249,255,.13);
      padding: 6px;
      text-align: left;
      vertical-align: top;
    }

    th {
      color: var(--gold);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .section-title {
      margin: 12px 0 4px;
      color: var(--gold);
      font-size: 11px;
      font-weight: 900;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .leaflet-container {
      font: inherit;
      background: #0b0f14;
    }

    .leaflet-control-attribution {
      background: rgba(4,8,12,.72) !important;
      color: rgba(217,255,248,.66) !important;
    }

    .leaflet-control-attribution a {
      color: var(--cyan) !important;
    }

    .leaflet-popup-content-wrapper {
      border: 1px solid rgba(125,249,255,.28);
      border-radius: 8px;
      padding: 0;
      background:
        linear-gradient(145deg, rgba(13,19,24,.98), rgba(4,8,12,.98));
      color: var(--text);
      box-shadow:
        0 24px 70px rgba(0,0,0,.52),
        0 0 32px rgba(0,255,213,.08);
    }

    .leaflet-popup-content-wrapper::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: 8px;
      background:
        linear-gradient(90deg, rgba(0,255,213,.18), transparent 34%, rgba(245,199,107,.12));
      pointer-events: none;
      opacity: .55;
    }

    .leaflet-popup-tip {
      border: 1px solid rgba(125,249,255,.2);
      background: rgba(4,8,12,.98);
      box-shadow: 0 8px 24px rgba(0,0,0,.38);
    }

    .leaflet-container a.leaflet-popup-close-button {
      z-index: 20;
      top: 10px;
      right: 10px;
      display: grid;
      place-items: center;
      width: 30px;
      height: 30px;
      border: 1px solid rgba(125,249,255,.32);
      border-radius: 50%;
      color: rgba(236,255,251,.82);
      background: rgba(3,8,13,.92);
      font-size: 20px;
      font-weight: 800;
      line-height: 1;
      text-align: center;
      text-decoration: none;
      box-shadow: 0 8px 22px rgba(0,0,0,.32);
    }

    .leaflet-container a.leaflet-popup-close-button:hover {
      color: var(--gold);
      border-color: rgba(245,199,107,.45);
      background: rgba(245,199,107,.08);
    }

    .leaflet-popup-content {
      position: relative;
      z-index: 1;
      width: 360px !important;
      margin: 0;
      font-size: 12px;
      line-height: 1.45;
    }

    .tetra-popup {
      overflow: hidden;
      border-radius: 8px;
    }

    .tetra-popup-head {
      border-bottom: 1px solid rgba(125,249,255,.14);
      padding: 13px 42px 11px 14px;
      background:
        linear-gradient(90deg, var(--popup-accent), transparent 4px),
        rgba(255,255,255,.035);
    }

    .tetra-popup-kicker {
      color: var(--gold);
      font-size: 9px;
      font-weight: 950;
      letter-spacing: .18em;
      text-transform: uppercase;
    }

    .tetra-popup-title {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 5px;
      color: var(--text);
      font-size: 15px;
      font-weight: 950;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .tetra-popup-title svg {
      width: 18px;
      height: 18px;
      stroke: var(--popup-accent);
      fill: none;
      stroke-width: 2.3;
      stroke-linecap: round;
      stroke-linejoin: round;
      filter: drop-shadow(0 0 8px var(--popup-glow));
    }

    .tetra-popup-body {
      padding: 12px 14px 14px;
    }

    .popup-chip-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-bottom: 10px;
    }

    .popup-chip {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      border: 1px solid rgba(125,249,255,.18);
      border-radius: 999px;
      padding: 0 8px;
      color: var(--text);
      background: rgba(0,255,213,.06);
      font-size: 10px;
      font-weight: 850;
      letter-spacing: .04em;
    }

    .popup-chip.hot {
      border-color: rgba(245,199,107,.38);
      background: rgba(245,199,107,.09);
      color: #ffe0a0;
    }

    .popup-grid {
      display: grid;
      grid-template-columns: 88px minmax(0, 1fr);
      gap: 5px 9px;
      margin-top: 8px;
    }

    .popup-label {
      color: var(--muted);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .popup-value {
      min-width: 0;
      color: var(--text);
      overflow-wrap: anywhere;
    }

    .popup-notes {
      margin-top: 12px;
      border-top: 1px solid rgba(125,249,255,.13);
      padding-top: 10px;
      color: rgba(217,255,248,.78);
      line-height: 1.55;
    }

    .popup-notes-label {
      margin-bottom: 4px;
      color: var(--gold);
      font-size: 10px;
      font-weight: 950;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .leaflet-tooltip {
      border: 1px solid rgba(125,249,255,.2) !important;
      border-radius: 8px !important;
      background: rgba(4,8,12,.9) !important;
      color: var(--text) !important;
      box-shadow: 0 12px 28px rgba(0,0,0,.36) !important;
      font-size: 11px;
      font-weight: 800;
      letter-spacing: .02em;
    }

    .leaflet-tooltip-top::before {
      border-top-color: rgba(4,8,12,.9) !important;
    }

    /* UI polish layer: map behavior and incident marker logic are intentionally untouched. */
    :root {
      --bg: #03070c;
      --panel: #071018;
      --panel-strong: #0a1620;
      --surface: #07131c;
      --border: rgba(125,249,255,.16);
      --border-strong: rgba(245,199,107,.42);
      --text: #ecfffb;
      --muted: rgba(236,255,251,.62);
      --cyan: #38f8ff;
      --gold: #f5c76b;
      --danger: #ff6b6b;
      --good: #55d187;
      --warning: #ffd166;
      --input: #03080d;
      --grid-color: rgba(125,249,255,.028);
    }

    body {
      background:
        radial-gradient(circle at 10% 0%, rgba(56,248,255,.12), transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(245,199,107,.08), transparent 24%),
        linear-gradient(180deg, #03070c 0%, #050a10 48%, #03070c 100%);
    }

    body::before {
      opacity: .8;
      background-size: 48px 48px;
    }

    body::after {
      content: "";
      position: fixed;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      background: linear-gradient(180deg, transparent 0 92%, rgba(56,248,255,.04) 92% 93%, transparent 93% 100%);
      background-size: 100% 7px;
      opacity: .32;
    }

    .acled-shell {
      grid-template-rows: 72px 1fr;
    }

    .acled-header {
      position: relative;
      display: grid;
      grid-template-columns: minmax(260px, auto) minmax(260px, 1fr) auto;
      min-height: 72px;
      padding: 12px 16px 12px 18px;
      background:
        linear-gradient(90deg, rgba(56,248,255,.08), transparent 34%, rgba(245,199,107,.05)),
        rgba(3, 7, 10, .94);
      box-shadow: 0 18px 44px rgba(0,0,0,.32);
    }

    .acled-header::before {
      content: "";
      position: absolute;
      left: 18px;
      right: 18px;
      bottom: -1px;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(56,248,255,.6), rgba(245,199,107,.45), transparent);
      opacity: .72;
    }

    .acled-title h1,
    h1 {
      margin-top: 5px;
      font-size: clamp(20px, 2vw, 27px);
      letter-spacing: .12em;
    }

    .acled-header-meta {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-width: 0;
      overflow: hidden;
    }

    .acled-header-meta span {
      display: inline-flex;
      align-items: center;
      min-height: 30px;
      border: 1px solid rgba(125,249,255,.16);
      border-radius: 999px;
      padding: 0 11px;
      background: rgba(4,8,12,.56);
      color: rgba(236,255,251,.68);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .1em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .acled-header-meta span:last-child {
      border-color: rgba(85,209,135,.28);
      color: #a8f4c7;
      background: rgba(85,209,135,.08);
    }

    .home-link {
      min-height: 36px;
      border-color: rgba(125,249,255,.24);
      background: rgba(125,249,255,.06);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    }

    .layout {
      grid-template-columns: 344px minmax(0, 1fr);
      background: rgba(2,6,10,.36);
    }

    .sidebar {
      max-height: calc(100vh - 72px);
      padding: 14px;
      background:
        linear-gradient(180deg, rgba(10,22,32,.96), rgba(4,9,14,.97)),
        var(--panel);
      box-shadow: 18px 0 46px rgba(0,0,0,.22);
    }

    .sidebar::-webkit-scrollbar,
    .summary-modal-body::-webkit-scrollbar,
    .summary-table-wrap::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    .sidebar::-webkit-scrollbar-thumb,
    .summary-modal-body::-webkit-scrollbar-thumb,
    .summary-table-wrap::-webkit-scrollbar-thumb {
      border: 2px solid rgba(4,8,12,.95);
      border-radius: 999px;
      background: rgba(125,249,255,.22);
    }

    #map {
      height: calc(100vh - 72px);
    }

    .map-wrap::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 500;
      pointer-events: none;
      border: 1px solid rgba(125,249,255,.08);
      box-shadow: inset 0 0 90px rgba(0,0,0,.28);
    }

    .control-group {
      margin-bottom: 12px;
      border-color: rgba(125,249,255,.15);
      border-radius: 8px;
      background:
        linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.012)),
        rgba(4,8,12,.62);
      box-shadow: 0 18px 44px rgba(0,0,0,.24);
    }

    details.control-group > summary {
      min-height: 44px;
      border-bottom: 1px solid rgba(125,249,255,.08);
      background: linear-gradient(90deg, rgba(125,249,255,.045), transparent);
    }

    details.control-group[open] > summary {
      border-bottom-color: rgba(245,199,107,.14);
    }

    .control-inner {
      padding: 12px;
    }

    label {
      margin-bottom: 10px;
      color: rgba(236,255,251,.68);
      font-size: 11px;
      font-weight: 850;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    input,
    select {
      min-height: 40px;
      margin-top: 6px;
      border-color: rgba(125,249,255,.18);
      background:
        linear-gradient(180deg, rgba(255,255,255,.025), transparent),
        var(--input);
      color: var(--text);
      font-size: 12px;
      letter-spacing: 0;
      text-transform: none;
    }

    select {
      appearance: none;
      background-image:
        linear-gradient(45deg, transparent 50%, rgba(245,199,107,.9) 50%),
        linear-gradient(135deg, rgba(245,199,107,.9) 50%, transparent 50%),
        linear-gradient(180deg, rgba(255,255,255,.025), transparent);
      background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px),
        0 0;
      background-size:
        6px 6px,
        6px 6px,
        100% 100%;
      background-repeat: no-repeat;
      padding-right: 34px;
    }

    select option {
      background: #071018;
      color: var(--text);
    }

    .hidden-control {
      position: absolute !important;
      width: 1px !important;
      height: 1px !important;
      margin: 0 !important;
      border: 0 !important;
      padding: 0 !important;
      overflow: hidden !important;
      clip: rect(0 0 0 0) !important;
      white-space: nowrap !important;
    }

    input::placeholder {
      color: rgba(236,255,251,.34);
    }

    input:hover,
    select:hover {
      border-color: rgba(125,249,255,.3);
    }

    input:focus,
    select:focus {
      border-color: rgba(56,248,255,.68);
      box-shadow: 0 0 0 2px rgba(56,248,255,.11), 0 0 24px rgba(56,248,255,.06);
    }

    .small-note {
      margin: -1px 0 10px;
      border-left: 2px solid rgba(245,199,107,.36);
      padding-left: 8px;
      color: rgba(236,255,251,.5);
      font-size: 11px;
    }

    .date-console {
      position: relative;
      margin: 4px 0 12px;
      border: 1px solid rgba(125,249,255,.18);
      border-radius: 8px;
      padding: 12px;
      background:
        linear-gradient(135deg, rgba(56,248,255,.09), transparent 42%),
        linear-gradient(315deg, rgba(245,199,107,.08), transparent 38%),
        rgba(2,6,10,.78);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,.05),
        0 18px 42px rgba(0,0,0,.24);
      overflow: hidden;
    }

    .date-console::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background:
        linear-gradient(90deg, rgba(56,248,255,.3), transparent 28%, rgba(245,199,107,.18)),
        linear-gradient(180deg, rgba(255,255,255,.04), transparent 45%);
      opacity: .55;
    }

    .date-console > * {
      position: relative;
      z-index: 1;
    }

    .date-console-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
      border-bottom: 1px solid rgba(125,249,255,.12);
      padding-bottom: 9px;
    }

    .date-console-head span,
    .date-console-head strong {
      font-size: 10px;
      font-weight: 950;
      letter-spacing: .14em;
      text-transform: uppercase;
    }

    .date-console-head span {
      color: var(--gold);
    }

    .date-console-head strong {
      color: rgba(236,255,251,.62);
    }

    .date-console label {
      margin-bottom: 10px;
    }

    .date-console select,
    .date-console input[type="date"] {
      min-height: 44px;
      border-color: rgba(56,248,255,.25);
      background-color: rgba(3,8,13,.9);
      color: var(--text);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,.05),
        0 0 24px rgba(56,248,255,.035);
    }

    .date-console input[type="date"]:disabled {
      opacity: .55;
      color: rgba(236,255,251,.48);
      cursor: not-allowed;
    }

    .date-console input[type="date"]::-webkit-calendar-picker-indicator {
      border-radius: 6px;
      padding: 4px;
      background:
        linear-gradient(135deg, rgba(56,248,255,.85), rgba(245,199,107,.85));
      cursor: pointer;
      filter: invert(1) saturate(1.4);
    }

    .date-grid {
      gap: 10px;
    }

    .button-row {
      grid-template-columns: 1fr 1fr 1fr;
    }

    button {
      min-height: 40px;
      border-color: rgba(125,249,255,.22);
      background:
        linear-gradient(180deg, rgba(255,255,255,.04), transparent),
        rgba(125,249,255,.075);
      box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    }

    button:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 24px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.05);
    }

    button:active {
      transform: translateY(0);
    }

    button.primary,
    .scope-load {
      border-color: rgba(245,199,107,.55);
      background:
        linear-gradient(180deg, rgba(245,199,107,.18), rgba(245,199,107,.08)),
        rgba(245,199,107,.08);
    }

    .status {
      min-height: 74px;
      margin-top: 12px;
      border-color: rgba(125,249,255,.14);
      background:
        linear-gradient(180deg, rgba(255,255,255,.025), transparent),
        rgba(2,6,10,.74);
      color: rgba(236,255,251,.58);
    }

    .status.good {
      background: linear-gradient(180deg, rgba(85,209,135,.08), rgba(2,6,10,.78));
    }

    .status.bad {
      background: linear-gradient(180deg, rgba(255,107,107,.08), rgba(2,6,10,.78));
    }

    .map-command {
      left: 14px;
      top: 14px;
      right: 14px;
      grid-template-columns: minmax(0, 1fr) minmax(250px, auto);
    }

    .query-chips,
    .basemap-dock,
    .legend,
    .attrib-box {
      border-color: rgba(125,249,255,.16);
      background:
        linear-gradient(145deg, rgba(255,255,255,.05), rgba(255,255,255,.012)),
        rgba(3,8,13,.8);
      box-shadow: 0 16px 40px rgba(0,0,0,.32);
    }

    .query-chip {
      border-color: rgba(125,249,255,.18);
      background: rgba(56,248,255,.055);
      color: rgba(236,255,251,.82);
    }

    .query-chip.hot {
      border-color: rgba(245,199,107,.38);
      background: rgba(245,199,107,.1);
    }

    .map-select-label {
      display: block;
      margin-bottom: 12px;
      color: rgba(245,199,107,.9);
    }

    .map-select-label select {
      min-height: 40px;
      margin-top: 6px;
      border-radius: 7px;
      padding: 8px 34px 8px 9px;
      font-size: 12px;
    }

    .legend {
      bottom: 24px;
      left: 14px;
      max-width: min(270px, calc(100% - 28px));
      padding: 12px;
    }

    .legend-row {
      min-height: 27px;
      color: rgba(236,255,251,.72);
      font-size: 11px;
      letter-spacing: .02em;
    }

    .attrib-box {
      right: 14px;
      bottom: 24px;
      color: rgba(236,255,251,.5);
    }

    .leaflet-control-zoom {
      border: 1px solid rgba(125,249,255,.18) !important;
      border-radius: 8px !important;
      overflow: hidden;
      box-shadow: 0 14px 34px rgba(0,0,0,.3) !important;
    }

    .leaflet-control-zoom a {
      width: 34px !important;
      height: 34px !important;
      border-color: rgba(125,249,255,.12) !important;
      background: rgba(4,8,12,.86) !important;
      color: rgba(236,255,251,.82) !important;
      line-height: 34px !important;
    }

    .leaflet-control-zoom a:hover {
      color: #ffe0a0 !important;
      background: rgba(245,199,107,.1) !important;
    }

    .summary-modal {
      border-color: rgba(125,249,255,.22);
      background:
        linear-gradient(145deg, rgba(13,24,34,.99), rgba(3,7,11,.99));
    }

    .summary-modal-head {
      background:
        linear-gradient(90deg, rgba(56,248,255,.08), transparent 48%, rgba(245,199,107,.06)),
        rgba(4,8,12,.88);
    }

    .summary-block {
      border-color: rgba(125,249,255,.14);
      background:
        linear-gradient(145deg, rgba(255,255,255,.05), rgba(255,255,255,.012)),
        rgba(4,8,12,.52);
    }

    .kpi {
      background:
        linear-gradient(180deg, rgba(56,248,255,.045), transparent),
        rgba(4,8,12,.72);
    }

    .layout {
      grid-template-columns: 320px minmax(420px, 1fr) 330px;
    }

    .sidebar {
      border-right: 1px solid rgba(125,249,255,.14);
    }

    .intel-rail {
      min-height: 0;
      max-height: calc(100vh - 72px);
      overflow: auto;
      border-left: 1px solid rgba(125,249,255,.14);
      padding: 14px;
      background:
        linear-gradient(180deg, rgba(12,22,32,.96), rgba(5,10,15,.98)),
        var(--panel);
      box-shadow: -18px 0 46px rgba(0,0,0,.24);
    }

    .intel-rail::-webkit-scrollbar {
      width: 10px;
    }

    .intel-rail::-webkit-scrollbar-thumb {
      border: 2px solid rgba(4,8,12,.95);
      border-radius: 999px;
      background: rgba(245,199,107,.22);
    }

    .intel-card {
      position: relative;
      margin-bottom: 12px;
      border: 1px solid rgba(125,249,255,.15);
      border-radius: 8px;
      padding: 13px;
      background:
        linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.012)),
        rgba(4,8,12,.66);
      box-shadow: 0 18px 44px rgba(0,0,0,.24);
    }

    .intel-card::before {
      content: "";
      position: absolute;
      left: 0;
      top: 12px;
      bottom: 12px;
      width: 2px;
      background: linear-gradient(180deg, rgba(56,248,255,.7), rgba(245,199,107,.55));
      opacity: .7;
    }

    .intel-card-title {
      margin-bottom: 12px;
      color: var(--gold);
      font-size: 11px;
      font-weight: 950;
      letter-spacing: .16em;
      text-transform: uppercase;
    }

    .intel-rail .button-row {
      grid-template-columns: 1fr;
    }

    .intel-rail .status {
      margin-top: 12px;
    }

    .intel-rail .summary {
      display: none;
    }

    .intel-rail .summary[style*="block"] {
      display: block !important;
    }

    .incident-filter {
      margin-top: auto;
    }

    .incident-filter .legend-section {
      display: grid;
      gap: 7px;
    }

    .incident-filter .legend-row {
      width: 100%;
      min-height: 38px;
      justify-content: flex-start;
      border-color: rgba(125,249,255,.16);
      border-radius: 8px;
      padding: 6px 8px;
      background: rgba(125,249,255,.045);
      color: rgba(236,255,251,.76);
      text-align: left;
      text-transform: none;
      letter-spacing: .02em;
    }

    .incident-filter .legend-row:hover,
    .incident-filter .legend-row.active {
      border-color: rgba(245,199,107,.42);
      background: rgba(245,199,107,.1);
      color: #ffe0a0;
      transform: none;
    }

    .attrib-box {
      max-width: min(360px, calc(100% - 24px));
    }

    @media (max-width: 1180px) {
      .acled-header {
        grid-template-columns: minmax(220px, 1fr) auto;
      }

      .acled-header-meta {
        display: none;
      }

      .layout {
        grid-template-columns: 300px minmax(0, 1fr);
      }

      .intel-rail {
        position: absolute;
        z-index: 900;
        right: 14px;
        top: 86px;
        width: min(330px, calc(100vw - 28px));
        max-height: calc(100vh - 104px);
        border: 1px solid rgba(125,249,255,.16);
        border-radius: 8px;
      }
    }

    @media (max-width: 980px) {
      body {
        overflow: auto;
      }

      .layout {
        grid-template-columns: 1fr;
      }

      .sidebar {
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
      }

      .intel-rail {
        position: static;
        width: auto;
        max-height: none;
        border-right: none;
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
      }

      #map,
      .map-wrap {
        height: 72vh;
        min-height: 520px;
      }

      .summary-block.wide,
      .summary-block.mid,
      .summary-block.side {
        grid-column: 1 / -1;
      }

      .map-command {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 640px) {
      .acled-header {
        align-items: flex-start;
        flex-direction: column;
      }

      .home-link {
        width: 100%;
      }

      .grid-2,
      .button-row {
        grid-template-columns: 1fr;
      }

      .legend {
        display: none;
      }

      .map-command {
        grid-template-columns: 1fr;
      }

      .basemap-dock {
        overflow: auto;
      }

      .attrib-box {
        left: 12px;
        right: 12px;
      }

      .summary-modal-head {
        align-items: stretch;
        flex-direction: column;
      }

      .summary-actions {
        justify-content: stretch;
      }

      .summary-actions button {
        flex: 1 1 140px;
      }
    }

    /* Floating map console: keep ACLED behavior untouched; only rehomes the controls visually. */
    .acled-shell {
      grid-template-rows: 64px 1fr;
      background: #02060a;
    }

    .acled-header {
      min-height: 64px;
      padding: 10px 16px;
      background:
        linear-gradient(90deg, rgba(2,6,10,.96), rgba(5,13,18,.86) 45%, rgba(2,6,10,.96)),
        rgba(2,6,10,.94);
    }

    .layout {
      position: relative;
      display: block;
      min-height: calc(100vh - 64px);
      background: #03070c;
      overflow: hidden;
    }

    .map-wrap {
      position: absolute;
      inset: 0;
      min-height: 0;
    }

    #map {
      height: calc(100vh - 64px);
      min-height: 0;
    }

    .sidebar,
    .intel-rail {
      position: absolute;
      z-index: 920;
      max-height: calc(100vh - 92px);
      border: 0;
      background: transparent;
      box-shadow: none;
      overflow: auto;
      scrollbar-width: thin;
    }

    .sidebar {
      left: 16px;
      top: 16px;
      width: min(318px, calc(100vw - 32px));
      padding: 0;
    }

    .intel-rail {
      right: 16px;
      top: 16px;
      width: min(318px, calc(100vw - 32px));
      padding: 0;
    }

    .control-group,
    .intel-card {
      border: 1px solid rgba(125,249,255,.22);
      border-radius: 8px;
      background:
        linear-gradient(145deg, rgba(12,23,31,.88), rgba(3,8,13,.74)),
        rgba(3,8,13,.78);
      box-shadow:
        0 18px 55px rgba(0,0,0,.34),
        inset 0 1px 0 rgba(255,255,255,.055);
      backdrop-filter: blur(18px) saturate(1.08);
    }

    .intel-card::before {
      display: none;
    }

    details.control-group > summary,
    .intel-card-title {
      min-height: 40px;
      margin: 0;
      border-bottom: 1px solid rgba(125,249,255,.1);
      background: linear-gradient(90deg, rgba(56,248,255,.07), transparent 68%);
    }

    .intel-card-title {
      display: flex;
      align-items: center;
      padding: 0 12px;
    }

    .control-inner,
    .intel-card {
      padding: 12px;
    }

    .intel-card .intel-card-title {
      margin: -12px -12px 12px;
    }

    .date-console {
      box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
    }

    .status {
      min-height: 64px;
      max-height: 116px;
      overflow: auto;
    }

    .incident-filter .legend-section {
      gap: 8px;
    }

    .incident-filter .legend-row {
      min-height: 36px;
      background: rgba(3,10,14,.58);
    }

    .attrib-box {
      right: 348px;
      bottom: 16px;
      background: rgba(3,8,13,.72);
      backdrop-filter: blur(14px);
    }

    .warning-bar {
      top: 16px;
      left: 350px;
      right: 350px;
      background: rgba(48,37,9,.88);
      backdrop-filter: blur(14px);
    }

    .leaflet-control-zoom {
      margin-left: 348px !important;
      margin-top: 16px !important;
    }

    @media (max-width: 1180px) {
      .layout {
        grid-template-columns: none;
      }

      .intel-rail {
        position: absolute;
        right: 16px;
        top: 16px;
        width: min(300px, calc(100vw - 32px));
        max-height: calc(100vh - 92px);
        border: 0;
        border-radius: 0;
      }

      .sidebar {
        width: min(300px, calc(100vw - 32px));
      }

      .leaflet-control-zoom {
        margin-left: 330px !important;
      }

      .attrib-box {
        right: 330px;
      }
    }

    @media (max-width: 900px) {
      body {
        overflow: auto;
      }

      .layout {
        min-height: auto;
        overflow: visible;
      }

      .map-wrap {
        position: relative;
        height: 72vh;
        min-height: 500px;
      }

      #map {
        height: 72vh;
        min-height: 500px;
      }

      .sidebar,
      .intel-rail {
        position: relative;
        inset: auto;
        width: auto;
        max-height: none;
        margin: 12px;
        overflow: visible;
      }

      .leaflet-control-zoom {
        margin-left: 10px !important;
        margin-top: 10px !important;
      }

      .attrib-box {
        right: 12px;
        bottom: 12px;
      }

      .warning-bar {
        left: 12px;
        right: 12px;
      }
    }

