    /* ── Design tokens ─────────────────────────────────────────── */
    :root {
      --kgs-blue:        #005DAB;
      --kgs-blue-dark:   #004080;
      --kgs-blue-light:  #e8f1fb;
      --kgs-accent:      #F5A800;
      --bar-active:      #005DAB;
      --bar-muted:       #99bedd;
      --bar-hover:       #003d73;
      --text-primary:    #1a1a2e;
      --text-secondary:  #4a5568;
      --surface:         #ffffff;
      --surface-alt:     #f7f9fc;
      --border:          #d0dae8;
      --focus-ring:      #F5A800;
      --sidebar-width:   280px;
      --header-height:   72px;
      --bottom-height:   220px;
      --font-ui:         'Segoe UI', system-ui, sans-serif;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    body {
      font-family: var(--font-ui);
      color: var(--text-primary);
      background: var(--surface-alt);
      height: 100dvh;
      display: grid;
      grid-template-rows: var(--header-height) 1fr var(--bottom-height);
      grid-template-columns: var(--sidebar-width) 1fr 300px;
      grid-template-areas:
        "header  header  header"
        "sidebar map     panel"
        "bottom  bottom  bottom";
      overflow: hidden;
    }

    /* ── Skip nav ──────────────────────────────────────────────── */
    .skip-link {
      position: absolute;
      top: -100px; left: 8px;
      z-index: 9999;
      background: var(--kgs-blue); color: #fff;
      padding: 8px 16px;
      border-radius: 0 0 6px 6px;
      font-weight: 600; text-decoration: none;
      transition: top 0.15s;
    }
    .skip-link:focus { top: 0; }
    :focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

    /* ── Header ────────────────────────────────────────────────── */
    #header {
      grid-area: header;
      background: var(--surface);
      border-bottom: 3px solid var(--kgs-blue);
      display: flex; align-items: center; gap: 16px;
      padding: 0 20px; z-index: 10;
    }
    #header img { height: 52px; width: auto; flex-shrink: 0; }
    .header-text { flex: 1; min-width: 0; }
    .header-text h1 {
      font-size: clamp(14px, 2vw, 20px); font-weight: 700;
      color: var(--kgs-blue); line-height: 1.2;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .breadcrumbs { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
    .breadcrumbs a { color: var(--kgs-blue); text-decoration: underline; }
    .breadcrumbs a:hover { color: var(--kgs-blue-dark); }
    .header-feedback {
      display: flex; align-items: center; gap: 6px;
      font-size: 13px; color: var(--kgs-blue); text-decoration: underline; flex-shrink: 0;
    }
    .header-feedback:hover { color: var(--kgs-blue-dark); }

    /* ── Sidebar ────────────────────────────────────────────────── */
    #sidebar {
      grid-area: sidebar;
      background: var(--surface);
      border-right: 2px solid var(--border);
      display: flex; flex-direction: column; overflow: hidden;
    }
    .sidebar-header {
      padding: 10px 14px 8px;
      font-size: 11px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.06em;
      color: var(--text-secondary);
      border-bottom: 1px solid var(--border);
      background: var(--surface-alt);
    }
    .sidebar-body { flex: 1; overflow-y: auto; padding: 12px; }
    #legendDiv { font-size: 13px; }

    /* ── Map ────────────────────────────────────────────────────── */
    #mapDiv { grid-area: map; position: relative; }

    #loading {
      position: absolute; inset: 0;
      background: rgba(255,255,255,0.88);
      display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 14px; z-index: 50;
      font-size: 15px; font-weight: 600; color: var(--kgs-blue);
    }
    .spinner {
      width: 44px; height: 44px;
      border: 4px solid var(--border); border-top-color: var(--kgs-blue);
      border-radius: 50%; animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    #map-status { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

    /* ── Right panel ────────────────────────────────────────────── */
    #panel {
      grid-area: panel;
      background: var(--surface);
      border-left: 2px solid var(--border);
      display: flex; flex-direction: column; overflow: hidden;
    }
    .panel-tab-list {
      display: flex; border-bottom: 2px solid var(--border);
      background: var(--surface-alt);
    }
    .panel-tab-btn {
      flex: 1; padding: 10px 6px;
      background: none; border: none; border-bottom: 3px solid transparent;
      font-family: var(--font-ui); font-size: 12px; font-weight: 600;
      color: var(--text-secondary); cursor: pointer;
      transition: color 0.15s, border-color 0.15s;
    }
    .panel-tab-btn:hover { color: var(--kgs-blue); }
    .panel-tab-btn[aria-selected="true"] {
      color: var(--kgs-blue); border-bottom-color: var(--kgs-blue);
      background: var(--surface);
    }
    .panel-tab-panel { flex: 1; overflow-y: auto; padding: 16px; display: none; }
    .panel-tab-panel[aria-hidden="false"] { display: block; }

    .intro-text { font-size: 13px; line-height: 1.65; color: var(--text-secondary); }
    .intro-text p + p { margin-top: 10px; }
    .intro-text a { color: var(--kgs-blue); text-decoration: underline; }
    .intro-text strong { color: var(--text-primary); }

    .query-form { display: flex; flex-direction: column; gap: 16px; }
    .field-group { display: flex; flex-direction: column; gap: 5px; }
    .field-group label {
      font-size: 12px; font-weight: 600;
      color: var(--text-secondary);
      text-transform: uppercase; letter-spacing: 0.04em;
    }
    .field-group select,
    .field-group input[type="text"] {
      width: 100%; padding: 8px 10px;
      border: 1.5px solid var(--border); border-radius: 6px;
      font-family: var(--font-ui); font-size: 13px;
      color: var(--text-primary); background: var(--surface);
      transition: border-color 0.15s; appearance: auto;
    }
    .field-group select:focus,
    .field-group input[type="text"]:focus {
      border-color: var(--kgs-blue); outline: none;
      box-shadow: 0 0 0 3px rgba(0,93,171,0.18);
    }
    .submit-btn {
      padding: 10px 16px; background: var(--kgs-blue); color: #fff;
      border: none; border-radius: 6px;
      font-family: var(--font-ui); font-size: 14px; font-weight: 600;
      cursor: pointer; transition: background 0.15s;
      align-self: flex-start; min-width: 110px;
    }
    .submit-btn:hover { background: var(--kgs-blue-dark); }
    .submit-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
    #query-status { font-size: 12px; color: var(--kgs-blue); font-weight: 600; min-height: 18px; }

    /* ── Bottom panel ────────────────────────────────────────────── */
    #bottom {
      grid-area: bottom;
      background: var(--surface);
      border-top: 2px solid var(--border);
      display: flex; flex-direction: column;
      padding: 6px 20px 2px;
      overflow: hidden;
    }

    #bottom-toprow {
      display: flex; align-items: center; justify-content: space-between;
      flex-shrink: 0; margin-bottom: 2px;
    }
    #bottom-label {
      font-size: 12px; font-weight: 600; color: var(--text-secondary);
    }

    /* Toggle group */
    .toggle-group {
      display: flex;
      border: 1.5px solid var(--border);
      border-radius: 20px; overflow: hidden;
    }
    .toggle-btn {
      padding: 3px 13px;
      font-family: var(--font-ui); font-size: 11px; font-weight: 600;
      border: none; background: transparent;
      color: var(--text-secondary); cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }
    .toggle-btn[aria-pressed="true"] { background: var(--kgs-blue); color: #fff; }
    .toggle-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -2px; }

    /* Histogram */
    #histogramDiv {
      flex: 1; min-height: 0; overflow: hidden; position: relative;
    }
    #histogramDiv svg { display: block; width: 100%; height: 100%; }

    /* Highlighted bars (within TimeSlider range) */
    .hist-bar { transition: fill 0.12s; cursor: default; }
    .hist-bar.in-range  { fill: var(--bar-active); }
    .hist-bar.out-range { fill: var(--bar-muted); }
    .hist-bar:hover     { fill: var(--bar-hover) !important; }

    /* Tooltip */
    #hist-tooltip {
      position: fixed;
      background: rgba(15,30,60,0.92); color: #fff;
      font-family: var(--font-ui); font-size: 12px;
      padding: 5px 10px; border-radius: 5px;
      pointer-events: none; white-space: nowrap;
      display: none; z-index: 200;
    }

    /* TimeSlider row */
    #timeSliderRow {
      flex-shrink: 0; height: 56px;
      display: flex; flex-direction: column; justify-content: center;
    }
    .esri-time-slider__thumb {
      background-color: var(--kgs-blue) !important;
      border-color: var(--kgs-blue-dark) !important;
    }
    .esri-time-slider__track--buffered { background-color: var(--kgs-blue) !important; }

    /* ── Responsive ──────────────────────────────────────────────── */
    @media (max-width: 900px) {
      body {
        grid-template-columns: var(--sidebar-width) 1fr;
        grid-template-rows: var(--header-height) 1fr 220px var(--bottom-height);
        grid-template-areas: "header header" "sidebar map" "panel panel" "bottom bottom";
      }
    }
    @media (max-width: 600px) {
      body {
        grid-template-columns: 1fr;
        grid-template-rows: var(--header-height) 1fr 220px var(--bottom-height);
        grid-template-areas: "header" "map" "panel" "bottom";
      }
      #sidebar { display: none; }
      #header img { display: none; }
    }