﻿    * {
      box-sizing: border-box;
    }

    html,
    body {
      height: 100%;
      margin: 0;
      font-family: "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
      background-color: #0f172a;
      color: #e2e8f0;
    }

    .app-shell {
      display: flex;
      height: 100%;
    }

    .map-container {
      flex: 1 1 auto;
      position: relative;
      min-width: 0;
    }

    #map {
      position: absolute;
      inset: 0;
      background: #0f172a;
    }

    .control-panel {
      width: 360px;
      max-width: 100%;
      background: rgba(15, 23, 42, 0.92);
      border-left: 1px solid rgba(148, 163, 184, 0.1);
      padding: 20px 24px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .panel-header h1 {
      margin: 0 0 6px;
      font-size: 22px;
      color: #f8fafc;
    }

    .panel-header p {
      margin: 0;
      font-size: 13px;
      color: #94a3b8;
    }

    .button-grid {
      display: grid;
      gap: 10px;
      margin: 20px 0;
    }

    .button-grid.two-column {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 10px 12px;
      border-radius: 8px;
      border: none;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: transform 0.15s ease, box-shadow 0.15s ease;
      color: #0f172a;
      background: #e2e8f0;
    }

    .panel-button.primary {
      background: #38bdf8;
      color: #0c4a6e;
    }

    .panel-button.danger {
      background: #fca5a5;
      color: #7f1d1d;
    }

    .panel-button:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 12px rgba(15, 23, 42, 0.25);
    }

    .panel-section {
      margin-top: 24px;
      padding-top: 12px;
      border-top: 1px solid rgba(148, 163, 184, 0.15);
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
    }

    .panel-section h2 {
      margin: 0 0 12px;
      font-size: 16px;
      color: #f8fafc;
    }

    #storage-status {
      display: grid;
      gap: 8px;
      margin-top: 16px;
    }

    #status-content {
      margin-top: 16px;
      background: rgba(148, 163, 184, 0.08);
      border-radius: 8px;
      padding: 12px;
      color: #cbd5f5;
      font-size: 12px;
      line-height: 1.5;
    }

    #data-list {
      display: grid;
      gap: 12px;
      overflow-y: auto;
      padding-right: 6px;
      flex: 1 1 auto;
      min-height: 0;
    }

    .data-toolbar {
      display: grid;
      gap: 10px;
      margin-bottom: 12px;
      padding: 12px;
      border-radius: 10px;
      background: rgba(148, 163, 184, 0.08);
      border: 1px solid rgba(148, 163, 184, 0.12);
    }

    .data-toolbar__row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .data-toolbar__field {
      display: grid;
      gap: 6px;
    }

    .data-toolbar__label {
      font-size: 12px;
      color: #94a3b8;
      letter-spacing: 0.02em;
    }

    .data-toolbar__control {
      width: 100%;
      padding: 10px 12px;
      border-radius: 8px;
      border: 1px solid rgba(148, 163, 184, 0.18);
      background: rgba(15, 23, 42, 0.72);
      color: #e2e8f0;
      font-size: 13px;
      outline: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .data-toolbar__control:focus {
      border-color: rgba(56, 189, 248, 0.65);
      box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    }

    .data-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: start;
      padding: 12px 14px;
      border-radius: 10px;
      border: 1px solid rgba(148, 163, 184, 0.16);
      background: rgba(30, 41, 59, 0.9);
      color: #e2e8f0;
      cursor: pointer;
      text-align: left;
      transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    }

    .data-row:hover {
      transform: translateY(-1px);
      box-shadow: 0 12px 22px rgba(15, 23, 42, 0.35);
      border-color: rgba(56, 189, 248, 0.4);
    }

    .data-row__name {
      font-weight: 700;
      font-size: 14px;
      color: #f8fafc;
      margin: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .data-row__meta {
      margin-top: 6px;
      font-size: 12px;
      color: #cbd5f5;
      display: grid;
      gap: 4px;
    }

    .data-row__pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
      background: rgba(56, 189, 248, 0.18);
      color: #bae6fd;
      border: 1px solid rgba(56, 189, 248, 0.25);
    }

    .data-row__pill.is-empty {
      background: rgba(148, 163, 184, 0.14);
      color: #94a3b8;
      border-color: rgba(148, 163, 184, 0.22);
    }

    .data-sentinel {
      padding: 10px 14px;
      text-align: center;
      font-size: 12px;
      color: #94a3b8;
    }

    .data-card {
      background: rgba(30, 41, 59, 0.9);
      border-radius: 10px;
      padding: 16px;
      box-shadow: 0 10px 20px rgba(15, 23, 42, 0.35);
    }

    .leaflet-top.leaflet-left .leaflet-control-layers {
      margin-top: 12px;
      margin-left: 12px;
      border-radius: 8px;
      overflow: hidden;
      box-shadow: 0 12px 24px rgba(15, 23, 42, 0.35);
    }

    .leaflet-control-layers-toggle {
      width: auto;
      height: auto;
      padding: 0.45rem 0.85rem;
      font-size: 0.85rem;
      font-weight: 600;
      letter-spacing: 0.02em;
      background: #e2e8f0;
      color: #0f172a;
    }

    .leaflet-control-layers-expanded {
      background: rgba(15, 23, 42, 0.92);
      color: #e2e8f0;
      border: none;
    }

    .leaflet-control-layers-overlays label {
      font-size: 0.85rem;
      padding: 0.25rem 0.5rem;
    }

    .leaflet-tooltip.capital-label {
      background: rgba(15, 23, 42, 0.78);
      border-radius: 999px;
      padding: 4px 12px;
      font-size: 12px;
      font-weight: 600;
      text-align: center;
      pointer-events: none;
      border: 1px solid transparent;
      box-shadow: 0 6px 12px rgba(15, 23, 42, 0.35);
    }

    .leaflet-tooltip.capital-label.capital-label--red {
      color: #fecaca;
      border-color: rgba(248, 113, 113, 0.45);
    }

    .leaflet-tooltip.capital-label.capital-label--green {
      color: #bbf7d0;
      border-color: rgba(74, 222, 128, 0.45);
    }

    .capital-desc {
      margin-bottom: 8px;
      color: #e2e8f0;
      font-size: 13px;
      line-height: 1.45;
    }

    .capital-popup-controls {
      display: flex;
      gap: 8px;
    }

    .capital-color-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 6px 12px;
      border: none;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      color: #0f172a;
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }

    .capital-color-toggle[data-next-mode="green"] {
      background: #4ade80;
      color: #064e3b;
    }

    .capital-color-toggle[data-next-mode="red"] {
      background: #f87171;
      color: #7f1d1d;
    }

    .capital-color-toggle:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 12px rgba(15, 23, 42, 0.25);
    }

    @media (max-width: 1024px) {
      .app-shell {
        flex-direction: column;
      }

      .control-panel {
        width: 100%;
        height: 45vh;
        border-left: none;
        border-top: 1px solid rgba(148, 163, 184, 0.1);
      }

      .map-container {
        height: 55vh;
      }

      #map {
        position: relative;
        height: 100%;
      }
    }
