:root {
  --bg: #0c0f13;
  --panel: #12161c;
  --panel-2: #181d25;
  --panel-3: #1f2630;
  --border: #252d38;
  --text: #e7eaef;
  --muted: #8a94a3;
  --faint: #5d6776;
  --accent: #ff8a3d;
  --accent-soft: rgba(255, 138, 61, 0.14);
  --cool: #7fd3ff;
  --danger: #ff6b5b;
  --radius: 10px;
  --panel-w: 360px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cool); }

button, select, input { font: inherit; color: inherit; }

svg { display: block; }

.muted { color: var(--muted); }

.app {
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  height: 100%;
}

/* ------------------------------------------------------------ panel */

.panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 1000;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  fill: var(--accent);
  flex: none;
  filter: drop-shadow(0 0 10px rgba(255, 138, 61, 0.45));
}

.brand-text { flex: 1; min-width: 0; }

.brand h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  flex: none;
}

.icon-btn:hover { background: var(--panel-3); }

.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.small { width: 26px; height: 26px; }
.icon-btn.small svg { width: 14px; height: 14px; }

.icon-btn.spinning svg { animation: spin 0.9s linear infinite; }

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

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 21px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat:first-child .stat-value { color: var(--accent); }

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.daily {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 58px;
}

.daily:empty { display: none; }

.day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.day-bar {
  width: 100%;
  max-width: 34px;
  background: linear-gradient(to top, #b8431b, var(--accent));
  border-radius: 3px 3px 0 0;
  min-height: 2px;
}

.day-label {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
}

.day-count {
  font-size: 10px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.mobile-only { display: none; }

.notice {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 107, 91, 0.1);
  border: 1px solid rgba(255, 107, 91, 0.3);
  color: #ffb4aa;
  font-size: 12.5px;
}

.group {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.h-note {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--faint);
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  font-size: 10px;
  cursor: help;
}

select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
}

.segmented {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 3px;
}

.segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.segmented button:hover { color: var(--text); }

.segmented button.active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px #33404f;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.chip input { display: none; }

.chip:has(input:checked) {
  border-color: rgba(255, 138, 61, 0.55);
  background: var(--accent-soft);
}

.chip:not(:has(input:checked)) { color: var(--faint); }

.chip-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-wrap: wrap;
}

.toggle input {
  appearance: none;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid #33404f;
  position: relative;
  cursor: pointer;
  flex: none;
  margin: 0;
  transition: background 0.15s;
}

.toggle input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}

.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::after { transform: translateX(14px); background: #fff; }
.toggle input:disabled { opacity: 0.4; cursor: not-allowed; }

.toggle small {
  flex-basis: 100%;
  padding-left: 42px;
  color: var(--faint);
  font-size: 11.5px;
  margin-top: -4px;
}

.toggle small:empty { display: none; }

/* ------------------------------------------------------------ clusters */

.clusters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clusters button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  cursor: pointer;
}

.clusters button:hover {
  background: var(--panel-2);
  border-color: var(--border);
}

.rank {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  display: grid;
  place-items: center;
  flex: none;
}

.c-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.c-name {
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-dir {
  flex: none;
  text-align: right;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.25;
}

.c-dir b {
  display: block;
  color: #ffcf8a;
  font-size: 13px;
  font-weight: 600;
}

.tag {
  font-size: 10.5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  margin-left: 4px;
  color: var(--muted);
  font-weight: 400;
}

/* ------------------------------------------------------------ point forecast */

.point-head { display: flex; flex-direction: column; }
.point-head strong { font-size: 15px; }
.point-head .muted { font-size: 12px; font-variant-numeric: tabular-nums; }

.now-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.now-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.now-card.wide { grid-column: 1 / -1; }
.now-card small { font-size: 11px; font-weight: 400; color: var(--muted); }
.now-card .k { font-size: 11.5px; color: var(--muted); }
.now-card .v { font-size: 17px; font-weight: 620; font-variant-numeric: tabular-nums; }
.now-card .s { font-size: 12px; color: var(--muted); }

.ispu {
  display: inline-block;
  border-radius: 4px;
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.chart-title {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 2px;
  display: flex;
  justify-content: space-between;
}

.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font: 10px var(--font); fill: var(--faint); }
.chart .day-line { stroke: var(--border); }
.chart .cursor { stroke: var(--cool); stroke-width: 1.2; stroke-dasharray: 3 3; }
.chart .threshold { stroke-dasharray: 2 3; stroke-width: 1; }

.point-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.sources {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 11.5px;
  color: var(--faint);
}

.sources a { color: var(--muted); }

/* ------------------------------------------------------------ map */

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

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

.leaflet-container { font: 13px/1.4 var(--font); }

.canvas-layer { pointer-events: none; }

.traj-pane > svg { pointer-events: none; }

.panel-toggle {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 900;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(18, 22, 28, 0.92);
  cursor: pointer;
  place-items: center;
}

.panel-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.loading {
  pointer-events: none;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  background: rgba(18, 22, 28, 0.94);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px 6px 32px;
  font-size: 13px;
  white-space: nowrap;
}

.loading::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* timebar */

.timebar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 690; /* di atas titik api & marker, di bawah popup Leaflet (700) */
  width: min(640px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 8px 10px;
  background: rgba(18, 22, 28, 0.94);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.play { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); border-color: var(--accent); color: #1a0d04; }
.play:hover { background: #ff9d5c; }
.play svg { fill: currentColor; stroke: none; width: 16px; height: 16px; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }

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

.timebar-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

#time-label { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-rel { color: var(--muted); font-size: 12px; white-space: nowrap; }

.link-btn {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--cool);
  cursor: pointer;
  font-size: 12.5px;
  padding: 0;
}

.slider-wrap { position: relative; padding-bottom: 14px; }

input[type="range"] {
  width: 100%;
  margin: 4px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.ticks {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 14px;
  pointer-events: none;
}

.tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
}

.tick.now {
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cool);
}

#clear-custom { align-self: flex-start; margin-left: 0; }

/* legend */

.legend {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 690;
  background: rgba(18, 22, 28, 0.94);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 220px;
}

.legend.under-popup { visibility: hidden; }

.legend-title { color: var(--text); font-weight: 600; font-size: 11.5px; margin-bottom: 3px; }

.legend-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

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

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.ramp {
  height: 8px;
  border-radius: 4px;
  width: 100%;
}

.ramp-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-top: 2px; }

/* popups */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { margin: 12px 14px; min-width: 220px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }

.pop-title { font-weight: 650; font-size: 14px; }
.pop-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }

.pop dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin: 0 0 10px;
  font-size: 12.5px;
}

.pop dt { color: var(--muted); }
.pop dd { margin: 0; font-variant-numeric: tabular-nums; }

.pop-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pop-actions button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 12.5px;
  cursor: pointer;
}

.pop-actions button:hover { background: var(--panel-3); }
.pop-actions button.primary { border-color: rgba(255, 138, 61, 0.6); color: #ffcf8a; }

.leaflet-tooltip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
  font-size: 12px;
}

.leaflet-tooltip-top::before { border-top-color: var(--border); }

.leaflet-control-layers,
.leaflet-bar a {
  background: rgba(18, 22, 28, 0.94);
  color: var(--text);
  border-color: var(--border) !important;
}

.leaflet-bar a:hover { background: var(--panel-3); }
.leaflet-control-layers-toggle { filter: invert(1) brightness(1.4); }
.leaflet-control-layers-expanded { color: var(--text); padding: 8px 10px; }

.leaflet-control-attribution {
  background: rgba(12, 15, 19, 0.75) !important;
  color: var(--faint);
}

.leaflet-control-attribution a { color: var(--muted); }

.leaflet-control-scale-line {
  background: rgba(12, 15, 19, 0.6);
  color: var(--muted);
  border-color: var(--muted);
}

.aqi-badge span {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11.5px;
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* WAQI: bulat agar beda dari badge kota IQAir yang kotak */
.waqi-badge span {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid rgba(12, 15, 19, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.waqi-badge span.stale {
  background: #3a4350;
  color: #aab3bf;
  opacity: 0.8;
}

.waqi-badge sup {
  position: absolute;
  top: -7px;
  right: -8px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 13px;
  text-align: center;
}

.pop-label {
  font-size: 11.5px;
  color: var(--muted);
  margin: 6px 0 4px;
}

.sub-aqis, .fc-days {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
}

.sub-aqi { display: inline-flex; align-items: center; gap: 4px; }

.fc-days { gap: 6px; }

.fc-day {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
}

.fc-day b {
  min-width: 30px;
  padding: 1px 4px;
  border-radius: 4px;
  text-align: center;
  background: #3a4350;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pop-credit {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--faint);
}

.pop-credit a { color: var(--muted); }

.toggle small a { color: var(--cool); }

.point-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--cool);
  background: rgba(127, 211, 255, 0.25);
  box-shadow: 0 0 0 4px rgba(127, 211, 255, 0.18);
}

.traj-arrow {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 0 2px #000);
}

/* ------------------------------------------------------------ mobile */

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }

  .panel {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(92vw, var(--panel-w));
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .app.panel-open .panel { transform: none; }

  .panel-toggle { display: grid; }

  .mobile-only { display: inline-grid; }

  .leaflet-control-scale { display: none; }

  .timebar {
    bottom: 16px;
    padding: 8px 10px 6px 8px;
    gap: 8px;
  }

  .time-rel { display: none; }

  .legend {
    top: 62px;
    max-width: 190px;
    padding: 8px 10px;
  }

  .legend > :not(:first-child) { display: none; }
}

/* ------------------------------------------------------------ pencarian & wilayah cepat */

.search { display: flex; flex-direction: column; gap: 8px; }

.search-box { position: relative; }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  margin-top: -8.5px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 16px; /* ≥ 16px: iOS tidak memperbesar halaman saat fokus */
}

#search-input:focus { outline: 2px solid rgba(255, 138, 61, 0.55); outline-offset: 1px; border-color: transparent; }

.search-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-list li[role="option"] {
  min-height: 48px;
  padding: 7px 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
}

.search-list li[role="option"]:hover,
.search-list li.active { background: var(--panel-3); }

.sug-name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-area .sug-name { color: var(--cool); font-weight: 500; }
.sug-status { padding: 6px 10px; font-size: 12.5px; color: var(--muted); }

.presets { display: flex; flex-wrap: wrap; gap: 6px; }

.preset {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  cursor: pointer;
}

.preset:hover { border-color: rgba(255, 138, 61, 0.55); background: var(--accent-soft); }

/* ------------------------------------------------------------ mode fokus */

body.focusing #regional,
body.focusing #clusters-section { display: none; }

.focus { display: flex; flex-direction: column; gap: 10px; }

.focus-head {
  position: sticky;
  top: -16px; /* sticky diukur dari tepi konten; -16px = menempel di tepi atas panel ber-padding 16px */
  z-index: 5;
  margin: 0 -16px;
  padding: 12px 16px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.focus-title { display: flex; align-items: flex-start; gap: 8px; }
.focus-name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.focus-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}

#focus-name {
  font-size: 18px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#focus-close { width: 44px; height: 44px; }

.focus-sub, .focus-fresh { font-size: 12px; color: var(--muted); }
.focus-fresh:empty { display: none; }

.focus-actions { display: flex; gap: 6px; }

.small-btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 36px;
  font-size: 13px;
  cursor: pointer;
}

.small-btn:hover { background: var(--panel-3); }

.focus-notice {
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12.5px;
}

.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
}

.card-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
}

.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.card-head {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.card-head .ispu { font-size: 13px; padding: 1px 8px; }
.card-text { margin: 0; line-height: 1.5; }
.card-line { font-size: 13px; }
.card-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.card-wait, .card-muted { margin: 0; color: var(--muted); font-size: 12.5px; }
.card-wait::before { content: "… "; }
.card-foot { margin: 2px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.45; }

.card-warn {
  margin: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 107, 91, 0.1);
  border: 1px solid rgba(255, 107, 91, 0.3);
  color: #ffb4aa;
  font-size: 12.5px;
}

.day-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.day-tile {
  --tile: #3a4350;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--tile);
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
}

.day-tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
.dt-label { font-size: 11px; color: var(--muted); }
.dt-cat { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-max { font-size: 10.5px; color: var(--muted); }

.sensor-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }

.sensor-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 8px;
  align-items: center;
}

.sl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-meta { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); }

.zone-table {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 3px 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.zone-table [role="row"] { display: contents; }
.zone-table [role="cell"], .zone-table .zt-h:not(:first-child) { text-align: right; }
.zt-h { font-size: 11px; color: var(--muted); }

.focus-daily { height: 54px; }
.focus-daily .day-bar { position: relative; overflow: hidden; }

.focus-daily .day-bar i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #8a2c10;
}

.focus-daily .day.today .day-bar {
  background: repeating-linear-gradient(135deg, var(--accent) 0 3px, #b8431b 3px 6px);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.tile {
  --fill: #3a4350;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  background: var(--fill);
  color: #1a1206;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0;
  cursor: pointer;
}

.tile.off { background: transparent; border: 1px dashed var(--border); cursor: default; }
.tile.late { opacity: 0.55; }

.tile.hatch {
  background: repeating-linear-gradient(135deg, var(--fill) 0 4px, rgba(0, 0, 0, 0.3) 4px 6px);
}

.tile.sel { outline: 2px solid #fff; outline-offset: 1px; opacity: 1; }
.tile-h { font-size: 10px; font-weight: 700; line-height: 1; }
.tile svg { width: 12px; height: 12px; fill: currentColor; }

.tile[style*="#3a4350"] { color: var(--text); }

.src-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.src-list li { display: flex; flex-direction: column; }
.src-name { font-weight: 550; }
.src-meta { font-size: 12px; color: var(--muted); }

.card .clusters button { align-items: flex-start; }
.reach { font-size: 12px; color: #ffcf8a; }
.tag.local { color: var(--accent); border-color: rgba(255, 138, 61, 0.55); margin-left: 0; }

.card-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 8px 12px;
}

.card-details summary,
details.filters > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 4px 0;
}

.card-details[open] summary { margin-bottom: 8px; }

details.filters { border-top: 1px solid var(--border); padding-top: 8px; }
details.filters > .group:first-of-type { border-top: 0; padding-top: 6px; }
details.filters[open] { display: flex; flex-direction: column; gap: 12px; }

.back-link { align-self: flex-start; margin-left: 0; padding: 6px 0; font-size: 13px; }

.point-head { gap: 2px; }
.point-focus { align-self: flex-start; margin-top: 6px; }

/* peta */

.focus-halo-pane { opacity: 0.13; }
.focus-pin { width: 20px; height: 20px; border-width: 3px; border-color: #fff; background: rgba(255, 255, 255, 0.25); }

.swatch-line { width: 14px; height: 0; border-top: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.swatch-halo { width: 12px; height: 10px; border-radius: 3px; background: rgba(255, 176, 32, 0.35); }

.focus-pill {
  display: none;
  position: absolute;
  top: 12px;
  left: 60px;
  z-index: 900;
  max-width: calc(100% - 60px - 64px);
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 138, 61, 0.6);
  background: rgba(18, 22, 28, 0.94);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.toast {
  position: fixed; /* di atas laci panel ponsel (z 1000) */
  left: 16px;
  right: 16px;
  bottom: 110px;
  margin: 0 auto;
  width: fit-content;
  z-index: 1200;
  max-width: 460px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(18, 22, 28, 0.97);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 13px;
}

@media (max-width: 760px) {
  .focus-pill:not([hidden]) { display: block; }
  body.focusing .legend { top: 62px; }
}

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

@media (max-width: 760px) {
  /* laci panel di atas kontrol zoom/lapisan Leaflet (z 1000) */
  .panel { z-index: 1100; }
  .loading { top: 62px; }
}

/* ------------------------------------------------------------ jendela "Tentang" */

.about {
  width: min(660px, calc(100vw - 24px));
  max-height: min(90vh, 920px);
  padding: 0;
  border: 1px solid rgba(255, 138, 61, 0.35);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.about[open] { display: flex; flex-direction: column; }
.about::backdrop { background: rgba(5, 7, 10, 0.7); backdrop-filter: blur(2px); }

.about-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.about-head .brand-mark { width: 40px; height: 40px; }
.about-title-wrap { flex: 1; min-width: 0; }
.about-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.about-head h2 span { color: var(--accent); }
.about-head p { margin: 2px 0 0; font-size: 12.5px; }
#about-x { width: 40px; height: 40px; }

.about-body {
  overflow-y: auto;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--panel-3) transparent;
}

.about-lead { margin: 0; font-size: 14.5px; line-height: 1.65; color: #cfd5de; }

.about-section { display: flex; flex-direction: column; gap: 8px; }

.about-section h3 {
  margin: 0 0 2px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.about-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.about-card strong { font-size: 14px; font-weight: 600; }
.about-card p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

.about-icon { flex: none; width: 24px; font-size: 19px; line-height: 1.25; text-align: center; }

.about-credit {
  border-color: rgba(255, 138, 61, 0.45);
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.12), var(--panel-2) 60%);
}

.about-credit strong { font-size: 15.5px; }
.about-credit p.about-support { color: #ffcf8a; }

.about-note { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.about-disclaimer {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(127, 211, 255, 0.3);
  border-radius: 10px;
  background: rgba(127, 211, 255, 0.07);
  color: #cfe8f7;
  font-size: 12.5px;
  line-height: 1.55;
}

.about-disclaimer p { margin: 0 0 4px; }
.about-disclaimer ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.about-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}

.about-foot .small-btn { min-width: 100px; min-height: 40px; font-weight: 600; }

.sources { display: flex; flex-direction: column; gap: 5px; }
.sources b { color: var(--muted); font-weight: 600; }
#about-link { align-self: flex-start; margin-left: 0; font-size: 12px; padding: 2px 0; }

@media (max-width: 760px) {
  .about { max-height: 92vh; border-radius: 14px; }
  .about-head { padding: 14px 16px; }
  .about-body { padding: 14px 16px 16px; }
  .about-head h2 { font-size: 18px; }
}
