    :root {
      --bg: #0a0c10;
      --bg2: #0f1218;
      --bg3: #161b24;
      --border: rgba(255,255,255,0.08);
      --text: #e2e8f0;
      --text2: #94a3b8;
      --red: #ef4444;
      --orange: #f97316;
      --yellow: #eab308;
      --blue: #3b82f6;
      --accent: #ef4444;
    }

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

    body {
      font-family: 'Inter', sans-serif;
      background: var(--bg);
      color: var(--text);
      height: 100vh;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    /* ── HEADER ─────────────────────────────────── */
    header {
      position: relative;
      z-index: 1000;
      background: var(--bg2);
      border-bottom: 1px solid var(--border);
      padding: 0 20px;
      height: 56px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
    }

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

    .logo {
      width: 32px;
      height: 32px;
      background: var(--red);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
    }

    h1 {
      font-family: 'Space Grotesk', sans-serif;
      font-size: 17px;
      font-weight: 600;
      letter-spacing: -0.3px;
    }

    h1 span {
      color: var(--red);
    }

    .live-badge {
      display: flex;
      align-items: center;
      gap: 5px;
      background: rgba(239,68,68,0.12);
      border: 1px solid rgba(239,68,68,0.3);
      border-radius: 20px;
      padding: 3px 10px;
      font-size: 11px;
      font-weight: 500;
      color: var(--red);
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }

    .live-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--red);
      animation: blink 1.4s ease infinite;
    }

    @keyframes blink {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.2; }
    }

    .stats-bar {
      display: flex;
      gap: 24px;
    }

    .stat {
      text-align: right;
    }

    .stat-value {
      font-family: 'Space Grotesk', sans-serif;
      font-size: 16px;
      font-weight: 700;
    }

    .stat-label {
      font-size: 10px;
      color: var(--text2);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-top: 1px;
    }

    .stat-value.red { color: var(--red); }
    .stat-value.orange { color: var(--orange); }
    .stat-value.yellow { color: var(--yellow); }

    /* ── LAYOUT ─────────────────────────────────── */
    .layout {
      display: flex;
      flex: 1;
      overflow: hidden;
    }

    /* ── SIDEBAR ────────────────────────────────── */
    .sidebar {
      width: 320px;
      flex-shrink: 0;
      background: var(--bg2);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .sidebar-header {
      padding: 16px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }

    .search-box {
      position: relative;
    }

    .search-box input {
      width: 100%;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 8px 12px 8px 36px;
      color: var(--text);
      font-size: 13px;
      outline: none;
      transition: border-color 0.2s;
    }

    .search-box input:focus {
      border-color: rgba(239,68,68,0.4);
    }

    .search-box input::placeholder {
      color: var(--text2);
    }

    .search-icon {
      position: absolute;
      left: 11px;
      top: 50%;
      transform: translateY(-50%);
      color: var(--text2);
      font-size: 14px;
    }

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

    .filter-btn {
      flex: 1;
      padding: 5px 8px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text2);
      font-size: 11px;
      cursor: pointer;
      transition: all 0.15s;
      font-family: 'Inter', sans-serif;
      font-weight: 500;
    }

    .filter-btn:hover { border-color: rgba(255,255,255,0.2); color: var(--text); }

    .filter-btn.active-all { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: var(--red); }
    .filter-btn.active-war { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: var(--red); }
    .filter-btn.active-conflict { background: rgba(249,115,22,0.15); border-color: rgba(249,115,22,0.4); color: var(--orange); }
    .filter-btn.active-tension { background: rgba(234,179,8,0.15); border-color: rgba(234,179,8,0.4); color: var(--yellow); }

    .conflict-list {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
    }

    .conflict-list::-webkit-scrollbar { width: 4px; }
    .conflict-list::-webkit-scrollbar-track { background: transparent; }
    .conflict-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

    .conflict-item {
      padding: 12px;
      border-radius: 10px;
      border: 1px solid var(--border);
      margin-bottom: 6px;
      cursor: pointer;
      transition: all 0.15s;
      background: var(--bg3);
    }

    .conflict-item:hover {
      border-color: rgba(255,255,255,0.18);
      background: rgba(255,255,255,0.04);
    }

    .conflict-item.active {
      border-color: rgba(239,68,68,0.5);
      background: rgba(239,68,68,0.06);
    }

    .conflict-item-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 8px;
    }

    .conflict-name {
      font-size: 13px;
      font-weight: 600;
      line-height: 1.3;
    }

    .intensity-badge {
      flex-shrink: 0;
      font-size: 10px;
      font-weight: 600;
      padding: 2px 7px;
      border-radius: 4px;
      letter-spacing: 0.3px;
    }

    .intensity-war { background: rgba(239,68,68,0.2); color: var(--red); }
    .intensity-conflict { background: rgba(249,115,22,0.2); color: var(--orange); }
    .intensity-tension { background: rgba(234,179,8,0.2); color: var(--yellow); }

    .conflict-meta {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 5px;
    }

    .conflict-region {
      font-size: 11px;
      color: var(--text2);
    }

    .conflict-since {
      font-size: 11px;
      color: var(--text2);
      margin-left: auto;
    }

    .conflict-parties {
      font-size: 11px;
      color: var(--text2);
      margin-top: 4px;
      line-height: 1.4;
    }

    /* ── DETAIL PANEL ───────────────────────────── */
    .detail-panel {
      position: absolute;
      bottom: 16px;
      right: 16px;
      width: 360px;
      background: rgba(15, 18, 24, 0.95);
      backdrop-filter: blur(12px);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 20px;
      z-index: 1000;
      transform: translateY(20px);
      opacity: 0;
      transition: all 0.25s ease;
      pointer-events: none;
      max-height: calc(100vh - 100px);
      overflow-y: auto;
    }

    .detail-panel.visible {
      transform: translateY(0);
      opacity: 1;
      pointer-events: all;
    }

    .detail-panel::-webkit-scrollbar { width: 4px; }
    .detail-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

    .detail-close {
      position: absolute;
      top: 16px;
      right: 16px;
      width: 28px;
      height: 28px;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text2);
      font-size: 14px;
      transition: all 0.15s;
    }
    .detail-close:hover { color: var(--text); background: rgba(255,255,255,0.08); }

    .detail-type {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      font-weight: 600;
      margin-bottom: 6px;
    }

    .detail-title {
      font-family: 'Space Grotesk', sans-serif;
      font-size: 18px;
      font-weight: 700;
      line-height: 1.2;
      margin-bottom: 4px;
    }

    .detail-region {
      font-size: 13px;
      color: var(--text2);
      margin-bottom: 16px;
    }

    .detail-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-bottom: 16px;
    }

    .detail-stat {
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 12px;
    }

    .detail-stat-label {
      font-size: 10px;
      color: var(--text2);
      text-transform: uppercase;
      letter-spacing: 0.4px;
      margin-bottom: 3px;
    }

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

    .detail-desc {
      font-size: 13px;
      color: var(--text2);
      line-height: 1.6;
      margin-bottom: 14px;
    }

    .detail-parties {
      margin-bottom: 14px;
    }

    .detail-parties-title {
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text2);
      margin-bottom: 8px;
    }

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

    .party {
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 6px 10px;
      font-size: 12px;
    }

    .party-role {
      font-size: 10px;
      color: var(--text2);
      margin-bottom: 2px;
    }

    .source-link {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      font-size: 11px;
      color: var(--blue);
      text-decoration: none;
      opacity: 0.8;
      transition: opacity 0.15s;
    }
    .source-link:hover { opacity: 1; }

    /* ── MAP ────────────────────────────────────── */
    #map {
      flex: 1;
    }

    /* Leaflet overrides */
    .leaflet-container {
      background: #080a0f;
    }

    .leaflet-popup-content-wrapper {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.6);
      color: var(--text);
    }

    .leaflet-popup-tip {
      background: var(--bg2);
    }

    .leaflet-popup-content {
      margin: 12px 16px;
    }

    .popup-title {
      font-family: 'Space Grotesk', sans-serif;
      font-weight: 600;
      font-size: 14px;
      margin-bottom: 4px;
    }

    .popup-meta {
      font-size: 12px;
      color: var(--text2);
      margin-bottom: 6px;
    }

    .popup-btn {
      display: inline-block;
      margin-top: 6px;
      padding: 4px 10px;
      background: rgba(239,68,68,0.15);
      border: 1px solid rgba(239,68,68,0.3);
      border-radius: 5px;
      font-size: 11px;
      color: var(--red);
      cursor: pointer;
      transition: background 0.15s;
    }

    .popup-btn:hover { background: rgba(239,68,68,0.25); }

    /* Pulse marker */
    .pulse-marker {
      position: relative;
    }

    .pulse-ring {
      position: absolute;
      border-radius: 50%;
      animation: pulse-anim 2s ease-out infinite;
    }

    @keyframes pulse-anim {
      0% { transform: scale(0.5); opacity: 0.8; }
      100% { transform: scale(3); opacity: 0; }
    }

    /* Legend */
    .map-legend {
      position: absolute;
      bottom: 28px;
      left: 340px;
      z-index: 900;
      background: rgba(15,18,24,0.9);
      backdrop-filter: blur(8px);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
    }

    .legend-title {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text2);
      margin-bottom: 8px;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 5px;
      font-size: 12px;
    }

    .legend-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    /* Loading */
    #loading {
      position: fixed;
      inset: 0;
      background: var(--bg);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      transition: opacity 0.4s ease;
    }

    .loading-card {
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 32px 36px;
      width: 420px;
      max-width: calc(100vw - 32px);
    }

    .loading-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 28px;
    }

    .loading-logo {
      width: 36px;
      height: 36px;
      background: var(--red);
      border-radius: 9px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    .loading-title {
      font-family: 'Space Grotesk', sans-serif;
      font-size: 16px;
      font-weight: 700;
    }

    .loading-subtitle {
      font-size: 12px;
      color: var(--text2);
      margin-top: 2px;
    }

    .loading-steps {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-bottom: 24px;
    }

    .loading-step {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 8px;
      transition: background 0.2s;
    }

    .loading-step.active {
      background: rgba(255,255,255,0.04);
    }

    .step-icon {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      flex-shrink: 0;
      transition: all 0.3s;
    }

    .step-icon.waiting {
      background: var(--bg3);
      border: 1px solid var(--border);
      color: var(--text2);
    }

    .step-icon.running {
      background: rgba(59,130,246,0.15);
      border: 1px solid rgba(59,130,246,0.3);
      color: var(--blue);
    }

    .step-icon.running::after {
      content: '';
      display: block;
      width: 14px;
      height: 14px;
      border: 2px solid rgba(59,130,246,0.3);
      border-top-color: var(--blue);
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
    }

    .step-icon.done {
      background: rgba(34,197,94,0.15);
      border: 1px solid rgba(34,197,94,0.3);
      color: #22c55e;
    }

    .step-icon.error {
      background: rgba(239,68,68,0.15);
      border: 1px solid rgba(239,68,68,0.3);
      color: var(--red);
    }

    .step-icon.warn {
      background: rgba(234,179,8,0.15);
      border: 1px solid rgba(234,179,8,0.3);
      color: var(--yellow);
    }

    @keyframes spin { to { transform: rotate(360deg); } }

    .step-body {
      flex: 1;
      min-width: 0;
    }

    .step-name {
      font-size: 13px;
      font-weight: 500;
    }

    .step-detail {
      font-size: 11px;
      color: var(--text2);
      margin-top: 1px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .step-time {
      font-size: 11px;
      color: var(--text2);
      flex-shrink: 0;
      font-variant-numeric: tabular-nums;
    }

    .loading-progress {
      height: 3px;
      background: var(--bg3);
      border-radius: 2px;
      overflow: hidden;
      margin-bottom: 16px;
    }

    .loading-progress-bar {
      height: 100%;
      background: linear-gradient(90deg, var(--red), #f97316);
      border-radius: 2px;
      transition: width 0.4s ease;
      width: 0%;
    }

    .loading-footer {
      font-size: 11px;
      color: var(--text2);
      text-align: center;
    }

    /* Toast */
    .toast {
      position: fixed;
      top: 70px;
      right: 16px;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 10px 16px;
      font-size: 12px;
      color: var(--text2);
      z-index: 2000;
      transform: translateX(120%);
      transition: transform 0.3s ease;
    }
    .toast.show { transform: translateX(0); }

    @media (max-width: 768px) {
      .sidebar { width: 100%; position: absolute; bottom: 0; left: 0; right: 0; height: 40%; z-index: 800; border-right: none; border-top: 1px solid var(--border); }
      .stats-bar { display: none; }
      .detail-panel { right: 8px; bottom: 44%; width: calc(100vw - 16px); }
      .map-legend { left: 8px; bottom: 42%; }
    }

    /* ── MODE SWITCH ─────────────────────────────────── */
    .mode-switch {
      display: flex;
      background: var(--bg3);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 3px;
      gap: 2px;
    }

    .mode-btn {
      padding: 5px 14px;
      border-radius: 6px;
      border: none;
      background: transparent;
      color: var(--text2);
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      font-family: 'Inter', sans-serif;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      gap: 5px;
      white-space: nowrap;
    }

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

    .mode-btn.active {
      background: var(--bg2);
      color: var(--red);
      border: 1px solid rgba(239,68,68,0.3);
      box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    }

    .peace-mode .mode-btn.active {
      color: #22c55e;
      border-color: rgba(34,197,94,0.3);
    }

    .mode-icon {
      font-size: 13px;
    }

    /* ── PEACE MODE THEME ────────────────────────────── */
    .peace-mode header {
      border-bottom-color: rgba(34,197,94,0.2);
    }

    .peace-mode .conflict-item.active {
      border-color: rgba(34,197,94,0.5);
      background: rgba(34,197,94,0.06);
    }

    .peace-mode .conflict-item:hover {
      border-color: rgba(34,197,94,0.2);
    }

    .peace-mode .search-box input:focus {
      border-color: rgba(34,197,94,0.4);
    }

    .peace-mode .filter-btn.active-all,
    .peace-mode .filter-btn.active-accord {
      background: rgba(34,197,94,0.15);
      border-color: rgba(34,197,94,0.4);
      color: #22c55e;
    }

    .peace-mode .filter-btn.active-ceasefire {
      background: rgba(20,184,166,0.15);
      border-color: rgba(20,184,166,0.4);
      color: #14b8a6;
    }

    .peace-mode .filter-btn.active-normalized {
      background: rgba(59,130,246,0.15);
      border-color: rgba(59,130,246,0.4);
      color: #3b82f6;
    }

    .peace-mode .filter-btn.active-postwar {
      background: rgba(148,163,184,0.15);
      border-color: rgba(148,163,184,0.4);
      color: #94a3b8;
    }

    .peace-mode .filters .filter-btn {
      font-size: 10px;
      padding: 5px 6px;
    }

    .peace-mode .loading-progress-bar {
      background: linear-gradient(90deg, #22c55e, #14b8a6);
    }

    .peace-mode .popup-btn {
      background: rgba(34,197,94,0.15);
      border-color: rgba(34,197,94,0.3);
      color: #22c55e;
    }

    .peace-mode .popup-btn:hover {
      background: rgba(34,197,94,0.25);
    }

    /* Peace type intensity badges */
    .intensity-accord     { background: rgba(34,197,94,0.2);  color: #22c55e; }
    .intensity-ceasefire  { background: rgba(20,184,166,0.2); color: #14b8a6; }
    .intensity-normalized { background: rgba(59,130,246,0.2); color: #3b82f6; }
    .intensity-postwar    { background: rgba(148,163,184,0.2); color: #94a3b8; }

    /* Peace mode map legend */
    .peace-mode .map-legend {
      border-color: rgba(34,197,94,0.2);
    }

    /* Peace mode stat values */
    .peace-mode .stat-value.red    { color: #22c55e; }
    .peace-mode .stat-value.orange { color: #14b8a6; }
    .peace-mode .stat-value.yellow { color: #3b82f6; }

    /* ── FOOTER ─────────────────────────────────── */
    .site-footer {
      position: relative;
      z-index: 1000;
      background: var(--bg2);
      border-top: 1px solid var(--border);
      padding: 0 20px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
      font-size: 11px;
      color: var(--text2);
    }

    .footer-link {
      color: var(--text2);
      text-decoration: none;
      font-weight: 500;
      transition: color 0.15s;
    }

    .footer-link:hover {
      color: var(--text);
    }

    .peace-mode .footer-link:hover {
      color: #22c55e;
    }

    /* ── EMPTY STATE ─────────────────────────────── */
    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 40px 20px;
      color: var(--text2);
      text-align: center;
      gap: 8px;
    }

    .empty-state-icon {
      font-size: 28px;
      opacity: 0.4;
    }

    .empty-state-text {
      font-size: 13px;
    }

    /* ── ACLED BADGE ─────────────────────────────── */
    .acled-badge {
      margin-top: 12px;
      padding: 10px 12px;
      background: rgba(59,130,246,0.08);
      border: 1px solid rgba(59,130,246,0.2);
      border-radius: 8px;
    }

    .acled-badge-header {
      font-size: 11px;
      font-weight: 600;
      color: #3b82f6;
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .acled-badge-icon {
      font-size: 8px;
      animation: pulse-blue 2s ease-in-out infinite;
    }

    @keyframes pulse-blue {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.4; }
    }

    .acled-badge-stats {
      display: flex;
      gap: 12px;
      font-size: 12px;
      color: var(--text);
      font-variant-numeric: tabular-nums;
    }

    .acled-badge-range {
      font-size: 10px;
      color: var(--text2);
      margin-top: 2px;
    }
