/* Astra Earth — antarmuka viewer */

:root {
  color-scheme: dark;

  /* Lapisan tumpuk: pada tema gelap ini putih transparan, pada tema terang
     dibalik jadi tinta transparan. Satu variabel ini yang membuat seluruh
     antarmuka bisa berganti tema tanpa aturan ganda di mana-mana. */
  --lift: 255, 255, 255;

  --ink: #05070d;
  --panel: rgba(12, 16, 26, 0.82);
  --panel-solid: #0c101a;
  --edge: rgba(var(--lift), 0.09);
  --edge-bright: rgba(var(--lift), 0.18);
  --text: #e8ecf4;
  --muted: #7d879b;
  --accent: #5b7cfa;
  --accent-rgb: 91, 124, 250;
  --accent-dim: rgba(var(--accent-rgb), 0.16);
  --hot: #e2603f;

  /* Warna data. Di tema terang dituakan supaya tetap terbaca di atas putih. */
  --blue: #4a9eff;
  --blue-rgb: 74, 158, 255;
  --amber: #e8b866;
  --amber-rgb: 232, 184, 102;
  --green: #4fd88f;
  --green-rgb: 79, 216, 143;
  --ok: #7fe0a8;
  --ok-rgb: 127, 224, 168;
  --tip-bg: rgba(8, 11, 18, 0.94);
  --radius: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Roboto Mono", ui-monospace, monospace;
}

/* ---- Tema terang ---- */
[data-theme="light"] {
  color-scheme: light;
  --lift: 12, 22, 42;

  --ink: #e9edf3;
  --panel: rgba(252, 253, 255, 0.9);
  --panel-solid: #ffffff;
  --edge: rgba(var(--lift), 0.14);
  --edge-bright: rgba(var(--lift), 0.28);
  --text: #10151f;
  --muted: #5c6478;
  --accent: #2f52d8;
  --accent-rgb: 47, 82, 216;
  --hot: #c2401f;

  --blue: #1668cc;
  --blue-rgb: 22, 104, 204;
  --amber: #9a6512;
  --amber-rgb: 154, 101, 18;
  --green: #0f7a48;
  --green-rgb: 15, 122, 72;
  --ok: #0c6b3f;
  --ok-rgb: 12, 107, 63;
  --tip-bg: rgba(255, 255, 255, 0.96);

  --shadow: 0 20px 48px rgba(16, 24, 48, 0.22);
}

/* Peta tetap gelap-terang apa adanya; yang dibalik hanya panelnya.
   Beberapa hal memang harus tetap putih karena menumpang di atas citra. */
[data-theme="light"] .rail,
[data-theme="light"] .panel,
[data-theme="light"] .timeline,
[data-theme="light"] .search input,
[data-theme="light"] .search__results {
  border-color: rgba(var(--lift), 0.16);
}
[data-theme="light"] .attribution {
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#globe {
  position: fixed;
  inset: 0;
}

/* Cesium bawaan yang tidak dipakai */
.cesium-viewer-bottom,
.cesium-widget-credits { display: none !important; }
.cesium-widget canvas { outline: none; }

/* Pesan setup */
.setup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 12px 20px;
  background: var(--hot);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}
.setup code {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.24);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ---- Rail kiri ---- */
.rail {
  position: fixed;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 6px;
  width: 76px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--edge);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.rail__brand {
  display: grid;
  place-items: center;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--edge);
}
.rail__mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #9fb4ff, var(--accent) 55%, #1b2a6b);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.5);
}

.rail__btn {
  display: grid;
  /* Kolomnya DIKUNCI ke lebar tombol. Tanpa minmax(0,1fr), label yang lebih
     lebar daripada tombol melarkan kolomnya, dan `justify-items: center`
     lalu menengahkan ikon terhadap kolom yang melar itu — bukan terhadap
     rail. Itu yang membuat ikon Hydrology meleset 6,5px ke kanan sementara
     Rainfall dan Layers (labelnya pendek) terlihat lurus. */
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  justify-items: center;
  padding: 9px 2px;
  border-radius: 11px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.rail__btn:hover { background: rgba(var(--lift), 0.05); color: var(--text); }
.rail__btn.is-active { background: var(--accent-dim); color: #fff; }
.rail__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 15px;
  line-height: 1;
}
.rail__label {
  max-width: 100%;
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  /* Jaring pengaman: label sepanjang apa pun tidak boleh lagi menggeser ikon. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Pencarian ---- */
.search {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(440px, calc(100vw - 180px));
}

.search input {
  width: 100%;
  padding: 11px 16px;
  font-size: 13px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--edge);
  border-radius: 11px;
  box-shadow: var(--shadow);
}
.search input::placeholder { color: var(--muted); }

.search__results {
  margin-top: 6px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--edge);
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.search__item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--edge);
}
.search__item:last-child { border-bottom: none; }
.search__item:hover, .search__item:focus-visible { background: rgba(var(--lift), 0.05); }
.search__item strong { display: block; font-size: 13px; font-weight: 500; }
.search__item span { font-size: 11px; color: var(--muted); }
.search__kind {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 999px;
  vertical-align: 1px;
}
.search__empty { padding: 14px; font-size: 12px; color: var(--muted); }

/* ---- Panel ---- */
.panel {
  /* Posisi & ukuran diatur JS (bisa digeser dan diubah ukurannya).
     Nilai di sini hanya cadangan sebelum JS jalan. */
  position: fixed;
  top: 74px;
  left: 88px;
  width: calc(100vw - 104px);
  height: calc(100vh - 264px);
  z-index: 25;
  min-width: 300px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel[hidden] { display: none !important; }
.panel.is-drag, .panel.is-resize { user-select: none; }
.panel.is-drag .panel__body, .panel.is-resize .panel__body { pointer-events: none; }

/* Pegangan ubah ukuran di tepi jendela */
.panel__grip { position: absolute; z-index: 4; touch-action: none; }
.panel__grip[data-dir="n"]  { top: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.panel__grip[data-dir="s"]  { bottom: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.panel__grip[data-dir="w"]  { left: 0; top: 12px; bottom: 12px; width: 6px; cursor: ew-resize; }
.panel__grip[data-dir="e"]  { right: 0; top: 12px; bottom: 12px; width: 6px; cursor: ew-resize; }
.panel__grip[data-dir="nw"] { top: 0; left: 0; width: 14px; height: 14px; cursor: nwse-resize; }
.panel__grip[data-dir="ne"] { top: 0; right: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.panel__grip[data-dir="sw"] { bottom: 0; left: 0; width: 14px; height: 14px; cursor: nesw-resize; }
.panel__grip[data-dir="se"] { bottom: 0; right: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.panel__grip[data-dir="se"]::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--edge-bright);
  border-bottom: 2px solid var(--edge-bright);
  border-radius: 0 0 3px 0;
}

.panel__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px 11px 16px;
  border-bottom: 1px solid var(--edge);
  background: rgba(var(--lift), 0.03);
  cursor: move;
  user-select: none;
  touch-action: none;
}
.panel__head::before {
  content: "";
  flex: none;
  width: 9px;
  height: 13px;
  opacity: 0.45;
  background-image: radial-gradient(currentColor 1px, transparent 1.2px);
  background-size: 4px 4px;
  color: var(--muted);
}
.panel__tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: default;
}
.panel__reset {
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  padding: 3px 6px;
  border-radius: 6px;
}
.panel__reset:hover { color: var(--text); background: rgba(var(--lift), 0.07); }
.panel__head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.panel__close {
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  padding: 1px 6px 3px;
  border-radius: 6px;
}
.panel__close:hover { color: var(--text); background: rgba(226, 96, 63, 0.28); }

.panel__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
}
.panel__note {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

/* Item landmark */
.lm {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 5px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 9px;
  transition: background 0.15s, border-color 0.15s;
}
.lm:hover { background: rgba(var(--lift), 0.05); border-color: var(--edge); }
.lm.is-on { background: var(--accent-dim); border-color: rgba(var(--accent-rgb), 0.4); }
.lm__pin { font-size: 13px; color: var(--muted); }
.lm.is-on .lm__pin { color: var(--accent); }
.lm__text { min-width: 0; }
.lm__kind {
  display: block;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.lm__name {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toggle lapisan */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--edge);
}
.toggle:last-of-type { border-bottom: none; }
.toggle__text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 400;
}
.toggle__text span {
  font-size: 10px;
  color: var(--muted);
}
.toggle__sw {
  flex: none;
  width: 34px;
  height: 19px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(var(--lift), 0.13);
  transition: background 0.18s;
}
.toggle__sw::after {
  content: "";
  display: block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}
.toggle__sw[aria-pressed="true"] { background: var(--accent); }
.toggle__sw[aria-pressed="true"]::after { transform: translateX(15px); }

/* Field umum */
.field { margin-bottom: 18px; }
.field label,
.field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__hint {
  margin: 7px 0 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
}
.field select {
  width: 100%;
  padding: 9px 10px;
  font-size: 12.5px;
  background: rgba(var(--lift), 0.05);
  border: 1px solid var(--edge);
  border-radius: 8px;
}
.field select option { background: var(--panel-solid); }

.seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(var(--lift), 0.05);
  border-radius: 9px;
}
.seg--stack { flex-direction: column; }
.seg button {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.seg--stack button { text-align: left; }
.seg button em {
  display: block;
  margin-top: 2px;
  font-size: 9.5px;
  font-style: normal;
  opacity: 0.65;
}
.seg button.is-on {
  background: var(--accent-dim);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.4);
}

/* Tur */
.tour {
  padding: 12px;
  margin-bottom: 9px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: rgba(var(--lift), 0.02);
}
.tour__no {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
}
.tour__name {
  margin: 3px 0 4px;
  font-size: 13.5px;
}
.tour__desc {
  margin: 0 0 9px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted);
}
.tour__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.tour__chip {
  padding: 2px 7px;
  font-size: 9px;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 999px;
}
.tour__go {
  width: 100%;
  padding: 8px;
  font-size: 11.5px;
  background: rgba(var(--lift), 0.06);
  border: 1px solid var(--edge);
  border-radius: 8px;
  transition: background 0.15s;
}
.tour__go:hover { background: var(--accent-dim); }

/* ---- Kartu landmark (sekarang ikut jendela .panel) ---- */
/* Isi kartu dibagi dua kolom: info di kiri, hidrologi melebar di kanan. */
#card .panel__body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
}
.card__info {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 380px;
}
#card #hyd-panel {
  flex: 4 1 440px;
  min-width: 0;
  margin-top: 0;
}

.card__sky {
  position: relative;
  height: 86px;
  background: radial-gradient(ellipse at 62% 78%, #3a2a1e, #0a0c14 68%);
  border-bottom: 1px solid var(--edge);
  overflow: hidden;
}
.card__sun {
  position: absolute;
  top: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff5e0;
  box-shadow: 0 0 26px 9px rgba(255, 214, 150, 0.5);
}


.card__eyebrow {
  margin: 0 0 3px;
  font-size: 9.5px;
  color: var(--muted);
}
.card__title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card__coords {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--accent);
}
.card__blurb {
  margin: 0 0 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text);
}

.card__fly {
  width: 100%;
  padding: 9px;
  margin-bottom: 12px;
  font-size: 12px;
  background: rgba(var(--lift), 0.07);
  border: 1px solid var(--edge-bright);
  border-radius: 8px;
  transition: background 0.15s;
}
.card__fly:hover { background: var(--accent-dim); }

.card__facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 10px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 9px;
  overflow: hidden;
}
.card__fact {
  padding: 8px 7px;
  background: var(--panel-solid);
}
.card__fact dt {
  margin: 0 0 3px;
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.card__fact dd {
  margin: 0;
  font-size: 11.5px;
}

.card__weather {
  padding: 10px 11px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(var(--lift), 0.02);
}
.card__wtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card__wcond {
  font-size: 11.5px;
}
.card__wcond em {
  display: block;
  font-size: 7.5px;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.card__wtemp {
  font-size: 21px;
  font-weight: 300;
}
.card__wrow {
  display: flex;
  gap: 11px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--edge);
  font-size: 9.5px;
  color: var(--muted);
}

.card__nav {
  padding: 11px 14px;
  border-top: 1px solid var(--edge);
}
.card__navlabel {
  display: block;
  margin-bottom: 7px;
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.card__navrow { display: flex; gap: 6px; }
.card__navbtn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 5px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  transition: background 0.15s;
}
.card__navbtn:hover { background: rgba(var(--lift), 0.05); }
.card__navbtn span { color: var(--muted); }
.card__navbtn em {
  font-size: 9.5px;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Panel Hydrology dari rail */
.steps {
  margin: 0;
  padding-left: 18px;
  font-size: 10.5px;
  line-height: 1.9;
  color: var(--muted);
}
.steps li.is-now {
  color: var(--text);
  font-weight: 500;
}

.hydro__go {
  width: 100%;
  padding: 9px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text);
  background: rgba(var(--blue-rgb), 0.12);
  border: 1px solid rgba(var(--blue-rgb), 0.34);
  border-radius: 8px;
  transition: background 0.15s;
}
.hydro__go:hover:not(:disabled) { background: rgba(var(--blue-rgb), 0.22); }
.hydro__go:disabled { opacity: 0.5; cursor: wait; }

/* ---- Analisis hidrologi ---- */
.ws__hyd {
  width: 100%;
  padding: 7px;
  margin-bottom: 6px;
  font-size: 10.5px;
  color: var(--text);
  background: rgba(var(--blue-rgb), 0.1);
  border: 1px solid rgba(var(--blue-rgb), 0.3);
  border-radius: 6px;
  transition: background 0.15s;
}
.ws__hyd:hover { background: rgba(var(--blue-rgb), 0.2); }

.hyd, #hydro-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 12px;
  margin-top: 9px;
}
#hydro-body { margin-top: 0; }
.hyd[hidden] { display: none !important; }

.hyd > *, #hydro-body > * { min-width: 0; margin-bottom: 0; }
.hyd > .hyd__sec,      #hydro-body > .hyd__sec { flex: 1 1 330px; }
.hyd > .clim__stats,   #hydro-body > .clim__stats { flex: 1 1 250px; }

/* Bagian yang harus melintang penuh, bukan ikut kolom */
.hyd > .clim__place,   #hydro-body > .clim__place,
.hyd > .hyd__warn,     #hydro-body > .hyd__warn,
.hyd > .ws__attr,      #hydro-body > .ws__attr,
.hyd > .ws__load,      #hydro-body > .ws__load,
.hyd > .ws__err,       #hydro-body > .ws__err,
.hyd > .panel__note,   #hydro-body > .panel__note,
.hyd > .steps,         #hydro-body > .steps,
.hyd > .hydro__go,     #hydro-body > .hydro__go { flex: 1 1 100%; }

.hyd__sec {
  padding: 12px;
  margin-bottom: 0;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(var(--lift), 0.02);
}

.hyd__head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.hyd__note {
  margin: 7px 0 0;
  font-size: 9px;
  line-height: 1.55;
  color: var(--muted);
}

/* Neraca air */
.hyd__row {
  display: grid;
  grid-template-columns: 48px 1fr 40px;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.hyd__lbl {
  font-size: 9px;
  color: var(--muted);
}
.hyd__bar {
  display: block;
  height: 9px;
  border-radius: 3px;
  background: rgba(var(--lift), 0.05);
  overflow: hidden;
}
.hyd__bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
}
.hyd__bar i.is-rain { background: linear-gradient(90deg, #2b5bb8, #6ba8ff); }
.hyd__bar i.is-et   { background: linear-gradient(90deg, #b8862b, var(--amber)); }
.hyd__bar i.is-run  { background: linear-gradient(90deg, #1f7a4d, var(--green)); }

.hyd__val {
  font-family: var(--mono);
  font-size: 9px;
  text-align: right;
}
.hyd__unit {
  margin: 4px 0 0;
  font-size: 8px;
  text-align: right;
  color: var(--muted);
}

.hyd__legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 0;
  font-size: 8.5px;
  color: var(--muted);
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  border-radius: 2px;
}
.dot--rain { background: var(--blue); }
.dot--et   { background: var(--amber); }

.hyd__etline {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

/* FDC */
.hyd__fdc {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.hyd__grid {
  stroke: rgba(var(--lift), 0.07);
  stroke-width: 0.5;
}

.hyd__q {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 8px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 7px;
  overflow: hidden;
}
.hyd__q div {
  padding: 7px 5px;
  text-align: center;
  background: var(--panel-solid);
}
.hyd__q em {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  color: var(--muted);
}
.hyd__q b {
  display: block;
  margin: 2px 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--green);
}
.hyd__q span {
  font-size: 7.5px;
  color: var(--muted);
}

.hyd__warn {
  padding: 9px 10px;
  margin-bottom: 8px;
  font-size: 9px;
  line-height: 1.6;
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.09);
  border: 1px solid rgba(var(--amber-rgb), 0.3);
  border-radius: 8px;
}
.hyd__warn strong { display: block; margin-bottom: 3px; }
.hyd__warn b { color: var(--text); }
.hyd__warn em { font-style: italic; }

/* ---- Daerah Aliran Sungai ---- */
.card__ws {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px;
  margin-top: 10px;
  font-size: 11.5px;
  background: rgba(226, 96, 63, 0.1);
  border: 1px solid rgba(226, 96, 63, 0.32);
  border-radius: 8px;
  transition: background 0.15s;
}
.card__ws:hover:not(:disabled) { background: rgba(226, 96, 63, 0.2); }
.card__ws:disabled { opacity: 0.5; cursor: wait; }
.card__wsicon { color: var(--hot); }

.ws {
  margin-top: 9px;
  padding: 10px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(var(--lift), 0.02);
}
.ws[hidden] { display: none; }

.ws__load,
.ws__err {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
}
.ws__load em {
  font-size: 9px;
  font-style: normal;
  opacity: 0.7;
}
.ws__err { color: var(--amber); }

.ws__stat {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--edge);
}
.ws__stat em {
  display: block;
  margin-bottom: 3px;
  font-size: 7.5px;
  font-style: normal;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.ws__area {
  display: block;
  font-size: 20px;
  font-weight: 300;
  color: var(--hot);
}
.ws__sqmi {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

.ws__meta {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
}

.ws__dllabel {
  display: block;
  margin-bottom: 5px;
  font-size: 7.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.ws__btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 9px;
}
.ws__btn {
  padding: 7px 4px;
  font-size: 10px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--edge-bright);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.ws__btn:hover { background: var(--accent-dim); }

.ws__clear {
  width: 100%;
  padding: 6px;
  margin-bottom: 8px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.ws__clear:hover { color: var(--text); background: rgba(var(--lift), 0.05); }

.ws__attr {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.55;
  color: rgba(var(--lift), 0.55);
}

/* ---- Panel iklim ---- */
/* Jendela sekarang selebar layar, jadi bagian-bagiannya disusun
   berdampingan alih-alih menumpuk jadi satu kolom panjang. */
#climate-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 12px;
}
#climate-body > * { min-width: 0; margin-bottom: 0; }
#climate-body > .clim { flex: 1 1 340px; }
/* Judul, peringatan, dan atribusi selalu satu baris sendiri */
#climate-body > .clim__place,
#climate-body > .clim__warn,
#climate-body > .clim__attr,
#climate-body > .panel__note { flex: 1 1 100%; }

.clim__place {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
}

.clim {
  padding: 11px;
  margin-bottom: 10px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: rgba(var(--lift), 0.02);
}

.clim__head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.clim__badge {
  padding: 2px 6px;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
}
.clim__badge--ok {
  color: var(--ok);
  background: rgba(var(--ok-rgb), 0.13);
  border: 1px solid rgba(var(--ok-rgb), 0.3);
}
.clim__badge--warn {
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.13);
  border: 1px solid rgba(var(--amber-rgb), 0.32);
}

.clim__range {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.clim__note {
  margin: 0 0 9px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}

.clim__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-bottom: 9px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 7px;
  overflow: hidden;
}
.clim__stats div {
  padding: 7px 8px;
  background: var(--panel-solid);
}
.clim__stats em {
  display: block;
  margin-bottom: 2px;
  font-size: 7.5px;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.clim__stats b {
  font-size: 12px;
  font-weight: 400;
}
.clim__trend span { color: var(--muted); margin-right: 2px; }

.clim__chartwrap { margin-bottom: 7px; }

.clim__chart {
  display: block;
  width: 100%;
  height: auto;
  /* Hanya untuk grafik ber-viewBox tetap (panel iklim): tanpa batas ini,
     di kolom lebar tingginya jadi berlebihan. */
  max-height: 190px;
}
/* Grafik responsif menggambar viewBox 1:1 dengan piksel wadahnya. Kalau
   max-height ikut menjepit, SVG-nya diskalakan turun dan gambarnya muncul
   kecil di tengah dengan ruang kosong kiri-kanan — persis letterbox yang
   mau dihilangkan. Tingginya sudah diatur heightFn di JS. */
.chart > .clim__chart { max-height: none; }
.clim__bar { fill: var(--blue); }
.clim__bar--proj { fill: var(--amber); }
.clim__band { fill: rgba(var(--amber-rgb), 0.22); }
.clim__tick {
  fill: var(--muted);
  font-size: 7px;
  font-family: var(--mono);
}

.clim__extra {
  margin: 0;
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
}

.clim__warn {
  margin: 0 0 8px;
  padding: 8px 9px;
  font-size: 9.5px;
  line-height: 1.55;
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.08);
  border: 1px solid rgba(var(--amber-rgb), 0.24);
  border-radius: 7px;
}

.clim__attr {
  margin: 0;
  font-size: 8.5px;
  line-height: 1.5;
  color: rgba(var(--lift), 0.55);
}

/* Tabel tahunan */
.tbl {
  margin: 9px 0 7px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  overflow: hidden;
}

.tbl__head,
.tbl__row {
  display: grid;
  grid-template-columns: 44px 1fr 66px 12px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  text-align: left;
}

.tbl__head {
  background: rgba(var(--lift), 0.03);
  border-bottom: 1px solid var(--edge);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.tbl__head span:nth-child(2),
.tbl__head span:nth-child(3) { text-align: right; }

.tbl__row {
  width: 100%;
  border-bottom: 1px solid rgba(var(--lift), 0.04);
  transition: background 0.12s;
}
.tbl__row:last-child { border-bottom: none; }
.tbl__row:hover { background: rgba(var(--lift), 0.05); }
.tbl__row.is-open { background: var(--accent-dim); }

.tbl__y {
  font-family: var(--mono);
  font-size: 10.5px;
}
.tbl__v {
  font-size: 11.5px;
  text-align: right;
}
.tbl__d {
  font-family: var(--mono);
  font-size: 9.5px;
  text-align: right;
  color: var(--muted);
}
.tbl__d.is-up { color: var(--blue); }
.tbl__d.is-down { color: var(--amber); }
.tbl__c {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.15s;
}
.tbl__row.is-open .tbl__c { transform: rotate(90deg); }

.clim__r2 {
  margin-left: 5px;
  font-family: var(--mono);
  font-size: 8px;
  font-style: normal;
  color: var(--muted);
}

/* Rincian tahun */
.drill {
  padding: 9px 8px;
  background: rgba(0, 0, 0, 0.28);
  border-bottom: 1px solid var(--edge);
}
.drill__load {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
}
.drill__sum {
  margin: 0 0 7px;
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--text);
}
.drill__warn {
  margin: 0 0 7px;
  padding: 6px 7px;
  font-size: 8.5px;
  line-height: 1.5;
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.08);
  border-radius: 5px;
}

/* Tabel bulanan */
.mtbl__row {
  display: grid;
  grid-template-columns: 26px 1fr 52px 22px;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 3px 4px;
  text-align: left;
  border-radius: 4px;
  transition: background 0.12s;
}
.mtbl__row:hover { background: rgba(var(--lift), 0.05); }
.mtbl__row.is-open { background: rgba(var(--blue-rgb), 0.14); }
.mtbl__row.is-flat { cursor: default; }
.mtbl__row.is-flat:hover { background: none; }

.mtbl__n {
  font-size: 9px;
  color: var(--muted);
}
.mtbl__bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: rgba(var(--lift), 0.05);
  overflow: hidden;
}
.mtbl__bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #2b5bb8, #6ba8ff);
}
.mtbl__v {
  font-family: var(--mono);
  font-size: 9px;
  text-align: right;
}
.mtbl__w {
  font-size: 8px;
  text-align: right;
  color: var(--muted);
}

/* Kalender harian */
.cal {
  padding: 7px 4px 4px;
}
.cal__head {
  margin: 0 0 6px;
  font-size: 8.5px;
  color: var(--muted);
}
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal__dow {
  display: grid;
  place-items: center;
  padding-bottom: 2px;
  font-size: 7px;
  color: var(--muted);
  cursor: default;
}

.cal__day,
.cal__pad {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 7.5px;
  border-radius: 3px;
}
.cal__day {
  background: rgba(var(--lift), 0.04);
  color: var(--muted);
  cursor: default;
}
.cal__day.is-wet { color: #fff; }
.cal__pad { background: none; }

.cal__legend {
  margin: 6px 0 0;
  font-size: 8px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Panel hujan ---- */
.rain__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--edge);
}
.rain__count {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text);
}
.rain__refresh {
  flex: none;
  padding: 4px 8px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.rain__refresh:hover { color: var(--text); background: rgba(var(--lift), 0.05); }

.rain__label {
  margin: 12px 0 5px;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.rain__label:first-child { margin-top: 0; }

.rain__row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  margin-bottom: 3px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background 0.15s;
}
.rain__row:hover { background: rgba(var(--lift), 0.05); border-color: var(--edge); }
.rain__row.is-wet {
  background: rgba(var(--blue-rgb), 0.09);
  border-color: rgba(var(--blue-rgb), 0.28);
}
.rain__row.is-wet:hover { background: rgba(var(--blue-rgb), 0.16); }

.rain__glyph { flex: none; font-size: 13px; }
.rain__text { flex: 1; min-width: 0; }
.rain__text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 400;
}
.rain__text span {
  display: block;
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rain__temp {
  flex: none;
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
}
.rain__row.is-wet .rain__temp { color: var(--blue); }

/* Mode Hari / Minggu */
.seg--mode {
  flex: none;
  padding: 2px;
}
.seg--mode button {
  padding: 5px 9px;
  font-size: 10.5px;
}

/* Strip 7 hari */
.week[hidden] { display: none; }

.week__row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.week__cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 2px 5px;
  border: 1px solid var(--edge);
  border-radius: 7px;
  background: rgba(var(--lift), 0.02);
  transition: background 0.12s, border-color 0.12s;
}
.week__cell:hover { background: rgba(var(--lift), 0.06); }
.week__cell.is-now {
  background: var(--accent-dim);
  border-color: rgba(var(--accent-rgb), 0.5);
}

.week__day {
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.week__cell.is-now .week__day { color: #fff; }

.week__date {
  font-size: 11px;
  line-height: 1;
}

.week__glyph {
  font-size: 13px;
  line-height: 1.2;
}

.week__mm {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--muted);
}
.week__mm.is-wet { color: #6ba8ff; }

/* Batang mm/hari */
.week__gauge {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 14px;
}
.week__gauge i {
  display: block;
  width: 60%;
  border-radius: 1px 1px 0 0;
  background: linear-gradient(180deg, #6ba8ff, #2b5bb8);
}

.week__temp {
  font-size: 9px;
  color: var(--text);
}
.week__temp em {
  font-style: normal;
  color: var(--muted);
}

/* ---- Timeline ---- */
.timeline {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 14px 10px;
  width: min(620px, calc(100vw - 130px));
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--edge);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.timeline__top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.timeline__play {
  flex: none;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  font-size: 10px;
  border: 1px solid var(--edge-bright);
  border-radius: 50%;
}
.timeline__play:hover { background: rgba(var(--lift), 0.07); }

.timeline__meta {
  flex: 1;
  min-width: 0;
}
.timeline__meta span {
  display: block;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline__meta em {
  font-size: 8.5px;
  font-style: normal;
  color: var(--muted);
}

.timeline__date {
  flex: none;
  padding: 5px 8px;
  font-size: 11px;
  background: rgba(var(--lift), 0.05);
  border: 1px solid var(--edge);
  border-radius: 7px;
  color-scheme: inherit;
}

.timeline__today {
  flex: none;
  padding: 5px 9px;
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 7px;
}
.timeline__today:hover { color: var(--text); background: rgba(var(--lift), 0.05); }

/* Strip cuaca 24 jam */
.strip[hidden] { display: none; }

.strip__row {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 1px;
}
.strip__cell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 5px 0 4px;
  font-size: 11px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.strip__cell:hover { background: rgba(var(--lift), 0.08); }
.strip__cell.is-now {
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.55);
}
.strip__cell em {
  margin-top: 3px;
  font-size: 7px;
  font-style: normal;
  color: var(--muted);
}
.strip__cell.is-now em { color: #fff; }

/* Batang curah hujan di bawah strip */
.strip__rain {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 1px;
  height: 16px;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid var(--edge);
  align-items: end;
}
.strip__bar {
  border-radius: 1px 1px 0 0;
  background: linear-gradient(180deg, #6ba8ff, #2b5bb8);
  min-height: 1px;
  transition: height 0.2s;
}
.strip__bar.is-dry { background: rgba(var(--lift), 0.06); }

.timeline__bar { position: relative; }

.timeline__slider {
  display: block;
  width: 100%;
  height: 3px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, #131a2e, #d8b478 50%, #131a2e);
}
.timeline__slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: grab;
  box-shadow: 0 0 8px rgba(var(--lift), 0.55);
}
.timeline__slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #fff;
  cursor: grab;
}

.timeline__ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--muted);
}

.timeline__hint {
  margin: 0;
  font-size: 9.5px;
  line-height: 1.4;
  color: var(--muted);
}
.timeline__hint[hidden] { display: none; }

.attribution {
  position: fixed;
  right: 12px;
  bottom: 6px;
  z-index: 20;
  font-size: 8.5px;
  color: rgba(var(--lift), 0.32);
}

/* ---- Responsif ---- */
@media (max-width: 900px) {
  .rail {
    top: auto;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    width: auto;
    max-width: calc(100vw - 16px);
    padding: 7px 5px;
    border-radius: 14px;
  }
  .rail__brand { display: none; }
  /* Lima tombol harus muat di layar sempit — rapatkan, jangan sampai
     "Hydrology" memaksa rail melebihi lebar layar. */
  .rail__btn {
    padding: 7px 3px;
    min-width: 0;
  }
  .rail__label {
    font-size: 7.5px;
    letter-spacing: 0.02em;
  }
  .rail__icon { font-size: 14px; }
  .search { width: calc(100vw - 24px); }
  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 152px;
    width: auto;
    max-height: 46vh;
  }
  .card {
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 42vh;
  }
  .timeline {
    width: calc(100vw - 24px);
    bottom: 12px;
    gap: 7px;
    padding: 9px 10px 8px;
  }
  .timeline__top { gap: 7px; }
  .timeline__meta span { font-size: 10.5px; }
  .strip__cell { font-size: 9px; }
  .strip__cell em { display: none; }
  .strip__rain { height: 12px; }
  .seg--mode button { padding: 5px 7px; font-size: 9.5px; }
  .week__temp { font-size: 8px; }
  .panel { bottom: 210px; }
  .rail { bottom: 146px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Penyesuaian untuk jendela lebar ---- */
.hyd > .clim__stats, #hydro-body > .clim__stats { margin-bottom: 0; }
.hyd .hyd__warn, #hydro-body .hyd__warn { margin-bottom: 0; }

/* Layar sempit: jendela tetap muat dan tidak menutupi timeline */
@media (max-width: 760px) {
  .panel {
    left: 8px;
    width: calc(100vw - 16px);
  }
  .card__info { max-width: none; }
}

/* ---- Grafik dengan pembacaan kursor ---- */
.chart {
  position: relative;
  margin-bottom: 7px;
  touch-action: pan-y;
}
.chart .clim__chart { cursor: crosshair; }

.chart__hair {
  stroke: var(--muted);
  stroke-width: 0.6;
  stroke-dasharray: 2 2;
  pointer-events: none;
}
.chart__dot {
  fill: var(--text);
  stroke: var(--green);
  stroke-width: 1.4;
  pointer-events: none;
}
.chart__hit { fill: transparent; }

.chart__tip {
  position: absolute;
  z-index: 3;
  transform: translate(9px, -50%);
  padding: 5px 8px;
  white-space: nowrap;
  pointer-events: none;
  background: var(--tip-bg);
  border: 1px solid var(--edge-bright);
  border-radius: 7px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.chart__tip[hidden] { display: none; }
/* Dekat tepi kanan, tooltip pindah ke kiri kursor supaya tidak terpotong. */
.chart__tip.is-left { transform: translate(calc(-100% - 9px), -50%); }

.chart__tipy {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.chart__tipx {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  color: var(--muted);
}

/* ---- Tabel FDC Q5..Q100 ---- */
.hyd__full { flex: 1 1 100% !important; }

.qtab {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 1px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
.qtab__c {
  padding: 6px 4px;
  text-align: center;
  background: var(--panel-solid);
}
.qtab__c.is-key { background: rgba(var(--green-rgb), 0.1); }
.qtab__c em {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  font-style: normal;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.qtab__c b {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
}

/* ---- Tabel tahunan ---- */
.yr__chartwrap { margin-bottom: 8px; }
.yr__runbar { fill: var(--green); }
.dot--run { background: var(--green); }

.yr {
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
.yr__r {
  display: grid;
  grid-template-columns: 1fr repeat(5, minmax(0, 1.1fr));
  gap: 6px;
  padding: 5px 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  border-top: 1px solid var(--edge);
}
.yr__r:first-child { border-top: none; }
.yr__r > span {
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yr__r > span:first-child { text-align: left; }

.yr__r--h {
  font-family: var(--sans);
  font-size: 8.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(var(--lift), 0.04);
}
.yr__r:not(.yr__r--h):hover { background: rgba(var(--lift), 0.05); }
.yr__y { color: var(--muted); }
.yr__rain { color: var(--blue); }
.yr__q { color: var(--green); }

/* Tema terang: peringatan hidrologi butuh badan teks bertinta penuh —
   amber di atas amber pucat terbaca hanya kalau layarnya bagus. */
[data-theme="light"] .hyd__warn,
[data-theme="light"] .clim__warn { color: #6b4708; }
[data-theme="light"] .clim__badge--warn { color: #7a5008; }

/* Atribusi 8,5px: tinta transparan pada latar terang meredup lebih cepat
   daripada putih transparan pada latar gelap, jadi dinaikkan sedikit. */
[data-theme="light"] .ws__attr,
[data-theme="light"] .clim__attr { color: rgba(var(--lift), 0.72); }

/* ---- Lokasi tersimpan ---- */
.card__save {
  display: block;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 8px;
  font-size: 11px;
  text-align: center;
  color: var(--muted);
  background: rgba(var(--lift), 0.04);
  border: 1px solid var(--edge);
  border-radius: 9px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.card__save:hover { color: var(--text); border-color: var(--edge-bright); }
.card__save.is-on {
  color: var(--amber);
  background: rgba(var(--amber-rgb), 0.1);
  border-color: rgba(var(--amber-rgb), 0.35);
}
.card__save[hidden] { display: none; }

.place {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
}
.place:hover { background: rgba(var(--lift), 0.05); border-color: var(--edge); }
.place.is-wet .place__glyph { color: var(--blue); }

.place__go {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 8px 4px 8px 9px;
  text-align: left;
}
.place__glyph { font-size: 13px; text-align: center; color: var(--muted); }
.place__text { min-width: 0; }
.place__text strong {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place__text span {
  display: block;
  margin-top: 1px;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place__temp {
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
}
.place.is-wet .place__temp { color: var(--blue); }

/* Tombol aksi baru muncul saat barisnya disentuh — daftar 50 titik tidak
   perlu 100 tombol yang berteriak sekaligus. */
.place__edit, .place__del {
  padding: 6px 7px;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  border-radius: 7px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.place:hover .place__edit,
.place:hover .place__del,
.place__edit:focus-visible,
.place__del:focus-visible { opacity: 1; }
.place__edit:hover { color: var(--text); background: rgba(var(--lift), 0.08); }
.place__del { font-size: 15px; }
.place__del:hover { color: #fff; background: rgba(226, 96, 63, 0.55); }

.place__input {
  width: 100%;
  padding: 8px 9px;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--text);
  background: var(--panel-solid);
  border: 1px solid var(--accent);
  border-radius: 8px;
  outline: none;
}

/* ---- Hidrologi: tata letak seksi ---- */
.hyd__sec > .hyd__body { margin-top: 9px; }
.hyd__body > * + * { margin-top: 9px; }

/* Pemilih model */
.mdl {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.mdl__b {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 10px;
  text-align: left;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(var(--lift), 0.03);
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  opacity: 0.5;
}
.mdl__b:hover { border-color: var(--edge-bright); }
.mdl__b.is-on {
  opacity: 1;
  border-color: var(--mdl-color);
  background: rgba(var(--lift), 0.06);
}
.mdl__dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--mdl-color);
  background: transparent;
}
.mdl__b.is-on .mdl__dot { background: var(--mdl-color); }
.mdl__txt b {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
}
.mdl__txt em {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-style: normal;
  color: var(--muted);
}

.mdl__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 9px;
  align-items: start;
}
.mdl__card {
  padding: 10px;
  border: 1px solid var(--edge);
  border-left: 2px solid var(--mdl-color);
  border-radius: 8px;
  background: rgba(var(--lift), 0.02);
}
.mdl__card h4 {
  margin: 0 0 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text);
}
.mdl__params {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-top: 7px;
}
.mdl__p {
  display: flex;
  gap: 5px;
  align-items: baseline;
  padding: 3px 6px;
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.mdl__p em {
  font-size: 8px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.mdl__p b {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text);
}

/* Tabel umum */
.tbl__wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--edge);
  border-radius: 8px;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 10.5px;
}
.tbl th, .tbl td {
  padding: 5px 9px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--edge);
}
.tbl th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-family: var(--sans);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-solid);
}
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: rgba(var(--lift), 0.05); }
.tbl__key { color: var(--muted); }
.tbl--dense th, .tbl--dense td { padding: 4px 7px; font-size: 9.5px; }

.dtl__count {
  margin: 0;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--muted);
}

/* Tab tabel perhitungan */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(var(--lift), 0.03);
}
.tabs__b {
  padding: 6px 12px;
  font-size: 10.5px;
  color: var(--muted);
  border-radius: 7px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
}
.tabs__b:hover { color: var(--text); }
.tabs__b.is-on {
  color: var(--text);
  background: rgba(var(--lift), 0.07);
  border-bottom-color: var(--mdl-color);
}

/* Tooltip banyak baris */
.chart__tiprow {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text);
}
.chart__tiprow i {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* ---- Penanda lokasi aktif ---- */
.beacon {
  position: fixed;
  top: 16px;
  left: 14px;
  /* Di atas rail (30), di bawah kotak pencarian (40) — kalau keduanya sempat
     bersentuhan, yang boleh menang adalah pencarian. */
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  /* Berhenti sebelum kotak pencarian yang di tengah: pencarian selebar
     min(440px, 100vw-180px), jadi tepi kirinya ada di 50vw-220. */
  max-width: min(340px, calc(50vw - 248px));
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--edge);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.beacon[hidden] { display: none; }

.beacon__go {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 5px 4px 5px 8px;
  text-align: left;
  border-radius: 10px;
}
.beacon__go:hover { background: rgba(var(--lift), 0.06); }

.beacon__dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 0 3px rgba(226, 96, 63, 0.22);
}

.beacon__text { min-width: 0; }
.beacon__text strong {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.beacon__text span {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.beacon__save {
  flex: none;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1;
  color: var(--muted);
  border-radius: 9px;
}
.beacon__save:hover { color: var(--text); background: rgba(var(--lift), 0.08); }
.beacon__save.is-on { color: var(--amber); }

/* Layar sempit: kotak pencarian memakan bagian tengah, jadi penanda turun ke
   bawahnya alih-alih diadu berebut ruang. */
@media (max-width: 900px) {
  .beacon {
    top: 64px;
    max-width: calc(100vw - 28px);
  }
}

/* ---- Bilah ekspor tabel ---- */
.tbl__box { display: block; }
.xbar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}
.xbar__t {
  flex: 1;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--muted);
}
.xbar__b {
  padding: 4px 9px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.xbar__b:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--edge-bright);
  background: rgba(var(--lift), 0.06);
}
.xbar__b:disabled { opacity: 0.55; }
.xbar__b.is-csv:hover:not(:disabled)  { color: var(--green); border-color: rgba(var(--green-rgb), 0.5); }
.xbar__b.is-xls:hover:not(:disabled)  { color: var(--green); border-color: rgba(var(--green-rgb), 0.5); }
.xbar__b.is-pdf:hover:not(:disabled)  { color: var(--hot); border-color: rgba(226, 96, 63, 0.5); }

/* ---- PLTA ---- */
.plta__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: rgba(var(--lift), 0.03);
}
.fld { display: block; min-width: 0; }
.fld__l {
  display: block;
  margin-bottom: 4px;
  font-size: 8.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.fld__in {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 0;
  background: var(--panel-solid);
  border: 1px solid var(--edge);
  border-radius: 7px;
}
.fld__in:focus-within { border-color: var(--accent); }
.fld__in input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 7px 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
}
.fld__in em {
  flex: none;
  font-size: 8.5px;
  font-style: normal;
  color: var(--muted);
}

.plta__tools {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plta__btn {
  padding: 7px 11px;
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--edge);
  border-radius: 7px;
  transition: color 0.15s, border-color 0.15s;
}
.plta__btn:hover { color: var(--text); border-color: var(--edge-bright); }

.plta__out > * + * { margin-top: 9px; }

/* ---- Bulanan: hitungan vs aktual ---------------------------------------
   Seksi perbandingan produksi bulanan. Memakai token yang sama dengan
   panel lain supaya ikut berganti tema tanpa aturan ganda. */
.act__ctrl { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.act__chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.act__lab {
  font-family: var(--sans); font-size: 8.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin-right: 2px; min-width: 42px;
}
.act__chip {
  font-family: var(--mono); font-size: 11px;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--edge); background: transparent; color: var(--muted);
  transition: color 0.14s, background 0.14s, border-color 0.14s;
  --c: var(--accent);
}
.act__chip:hover { color: var(--text); border-color: var(--edge-bright); }
.act__chip[aria-pressed="true"] {
  color: #fff; border-color: transparent;
  background: var(--c);
}
.act__chip--year[aria-pressed="true"],
.act__chip--avg[aria-pressed="true"] { background: var(--accent); }
.act__chip--all { border-style: dashed; }

/* Basis rerata: chip outline pakai warna model saat aktif */
.act__chip--basis { font-size: 10px; padding: 4px 9px; }
.act__chip--basis[aria-pressed="true"] {
  color: var(--c); border-color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
/* Kalibrasi toggle */
.act__chip--cal[aria-pressed="true"] {
  color: var(--amber); border-color: var(--amber);
  background: rgba(var(--amber-rgb), 0.16);
}
/* Kolom yang ikut dirata-ratakan diberi latar tipis */
.act__inbasis { background: rgba(var(--lift), 0.05); }
/* Kolom terkalibrasi */
.act__cal { color: var(--amber, #d99a2b); font-weight: 600; }

/* Penanda bulan penuh kapasitas (energi dipatok di plafon) */
.act__capped { color: var(--muted); }
.act__capmark {
  color: var(--amber); font-size: 8px; margin-left: 2px; vertical-align: 3px;
}
.act__caplegend {
  margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted);
  padding-left: 10px; border-left: 2px solid var(--amber);
}
.act__caplegend b { color: var(--text); }
.act__caplegend .act__capmark { vertical-align: baseline; margin: 0 2px 0 0; }

/* Grafik komparasi hitungan vs aktual */
.act__chartbox { margin-top: 12px; }
.act__charttitle {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  color: var(--muted); margin-bottom: 4px;
}
.act__cmpbar { fill: rgba(var(--lift), 0.24); }
.act__cmpline { fill: none; stroke-width: 1.6px; stroke-linejoin: round; stroke-linecap: round; }
.act__cmpdot { stroke: none; }
.act__cmpleg {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px;
  font-size: 11px; color: var(--muted);
}
.act__cmplegit { display: inline-flex; align-items: center; gap: 5px; }
.act__cmpleg-bar {
  width: 11px; height: 11px; border-radius: 2px;
  background: rgba(var(--lift), 0.30); display: inline-block;
}
.act__cmpleg-line {
  width: 14px; height: 3px; border-radius: 2px; display: inline-block;
}
.act__cmpleg-line.is-dash { height: 0; border-top: 2px dashed currentColor; background: none !important; }

/* Banner hasil kalibrasi */
.act__cal-banner {
  margin: 4px 0 12px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--edge); border-left: 3px solid var(--amber, #d99a2b);
  background: rgba(var(--lift), 0.04);
}
.act__cal-head {
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--text);
  margin-bottom: 7px;
}
.act__cal-head code {
  font-family: var(--mono); font-size: 11px; color: var(--amber, #d99a2b);
  background: rgba(var(--lift), 0.06); padding: 1px 5px; border-radius: 4px;
}
.act__cal-row {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.act__cal-row b { color: var(--text); font-weight: 700; }
.act__cal-note { font-size: 11px; line-height: 1.5; color: var(--muted); }
.act__cal-note b { color: var(--text); }

.act__year { margin-top: 14px; }
.act__yearhead {
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  color: var(--text); margin-bottom: 7px;
}
.act__inp input {
  width: 74px; text-align: right; font-family: var(--mono); font-size: 10px;
  padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--edge); background: rgba(var(--lift), 0.05);
  color: var(--text);
}
.act__inp input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.act__pos { color: var(--green); }
.act__neg { color: var(--hot); }
.act__mute { color: var(--muted); }
.act__total td {
  font-weight: 700; background: rgba(var(--lift), 0.05);
  border-top: 1px solid var(--edge-bright);
}
.act__total td:first-child { color: var(--text); }

.act__summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.act__stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 12px; border: 1px solid var(--edge); border-radius: 8px;
  background: rgba(var(--lift), 0.04); flex: 1; min-width: 96px;
}
.act__stat-k {
  font-family: var(--sans); font-size: 8.5px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.act__stat-v {
  font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--text);
}
.act__stat-v small { font-size: 10px; color: var(--muted); font-weight: 400; }

.act__guide {
  margin: 10px 0 0; padding-left: 10px; font-size: 11.5px; line-height: 1.45;
  color: var(--muted); border-left: 2px solid var(--accent);
}
.act__guide--ok  { border-left-color: var(--green); }
.act__guide--bad { border-left-color: var(--hot); }
