/* NUSAPETA — layout inspired by inspirasi-peta-2 (Dispatch HUD) */

:root {
  --text: #1e293b;
  --muted: #64748b;
  --text-muted: rgba(30, 41, 59, 0.58);
  --primary: #004c80;
  --primary-rgb: 0, 76, 128;
  --primary-hover: #003661;
  --cyan: #06b6d4;
  --amber: #f59e0b;
  --orange: #f97316;
  --home: #10b981;
  --sd: #ef4444;
  --smp: #3b82f6;
  --sma: #6b7280;

  /* Orion light / dark glass tokens — opacity −30% agar blur lebih terbaca */
  --bg: #eef2f7;
  --bg-deep: #e8eef6;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-2: rgba(255, 255, 255, 0.56);
  --surface-3: rgba(255, 255, 255, 0.2);
  --surface-dark: rgba(var(--primary-rgb), 0.39);
  --border: rgba(255, 255, 255, 0.5);
  --border-dark: rgba(255, 255, 255, 0.13);
  --border-strong: rgba(30, 41, 59, 0.14);
  --shadow: 0 14px 40px rgba(30, 41, 59, 0.1);
  --shadow-soft: 0 6px 20px rgba(30, 41, 59, 0.1);
  --blur: blur(10px) saturate(100%);
  --tooltip-bg: rgba(var(--primary-rgb), 0.72);
  --tooltip-blur: blur(16px) saturate(150%);

  --radius: 16px;
  --radius-sm: 12px;
  --font-sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --bs-body-font-family: var(--font-sans);
  --bs-font-sans-serif: var(--font-sans);
  --hud-pad: 18px;
  --bottom-h: 340px;
  --hud-card-gap: 12px;
  --hud-dock-peek: 48px;
  --hud-ext-gap: var(--hud-card-gap);
  /* Tinggi extension = HUD bottom (sementara) */
  --hud-ext-h-base: var(--bottom-h);
  --hud-ext-h-scale: 1;
  --hud-ext-ease: cubic-bezier(0.33, 1, 0.68, 1);
  --hud-ext-dur: 0.42s;
  --hud-ext-top-clearance: 70px;
  --hud-ext-top-fade: 56px;
  --hud-ext-top-vignette-h: 64px;
  --hud-ext-backdrop-rgb: 30, 41, 59;
  --hud-ext-backdrop-alpha: 0.7;
  --float-field-width: 240px;
  --region-select-child-width: 180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-deep);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Orion-style light glass surface */
.glass,
.glass-surface {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.mono {
  font-family: var(--font-mono);
}

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

.tiny {
  font-size: 10px;
}

.app-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ===== Full map ===== */
.map-full {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #f2f2f2;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  background: #f2f2f2;
}

/* MapLibre Snazzy light-blue style — optional CSS filter (default none) */
.leaflet-tile-pane,
.leaflet-maplibre-gl {
  filter: brightness(0.98);
}

.leaflet-maplibre-gl {
  z-index: 200 !important;
}

.maplibregl-canvas {
  outline: none;
}

.map-svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.nusapeta-popup .leaflet-popup-content-wrapper {
  background: rgba(var(--primary-rgb), 0.66);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.nusapeta-popup .leaflet-popup-tip {
  background: rgba(var(--primary-rgb), 0.66);
}

.nusapeta-popup .leaflet-popup-content {
  margin: 10px 12px;
  font-size: 12px;
}

.popup-jenjang {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* Radius Ideal hover tooltip + dim — light glass seperti dash-card */
.leaflet-tooltip.nusapeta-radius-tooltip {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: var(--shadow-soft);
  white-space: normal;
  width: min(420px, 82vw);
  max-width: min(420px, 82vw);
}

.leaflet-tooltip-right.nusapeta-radius-tooltip::before {
  border-right-color: rgba(255, 255, 255, 0.85);
}

.leaflet-tooltip-top.nusapeta-school-tooltip::before {
  border-top-color: rgba(255, 255, 255, 0.85);
}

.leaflet-tooltip.nusapeta-radius-tooltip.nusapeta-school-tooltip {
  width: 240px !important;
  max-width: 240px !important;
  min-width: 240px;
}

.radius-tip-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  margin: 0;
  overflow: hidden;
  border-radius: 13px;
}

.radius-tip-table th,
.radius-tip-table td {
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid rgba(30, 41, 59, 0.1);
}

.radius-tip-table thead th,
.radius-tip-table .radius-tip-head {
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.12);
  border-top-left-radius: 13px;
  border-top-right-radius: 13px;
}

.radius-tip-table tbody th {
  width: 38%;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.35);
}

.radius-tip-table tbody td {
  width: 62%;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.radius-tip-table tbody tr:last-child th,
.radius-tip-table tbody tr:last-child td {
  border-bottom: 0;
}

.radius-tip-table tbody tr:last-child th {
  border-bottom-left-radius: 13px;
}

.radius-tip-table tbody tr:last-child td {
  border-bottom-right-radius: 13px;
}

.school-tip-table tbody th {
  width: 32%;
}

.school-tip-table tbody td {
  width: 68%;
  font-size: 11px;
  word-break: break-word;
}

.leaflet-radius-pane.is-dim {
  filter: none;
}

.leaflet-radius-pane.is-dim path.leaflet-interactive {
  transition: fill-opacity 0.15s ease, stroke-width 0.15s ease;
}

/* Hanya lingkaran radius ideal — jangan kena marker user / sekolah */
.leaflet-radius-pane path.leaflet-interactive {
  opacity: 0.7;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.leaflet-radius-pane path.leaflet-interactive:focus,
.leaflet-radius-pane path.leaflet-interactive:focus-visible {
  outline: none;
}

.leaflet-overlay-pane path.leaflet-interactive,
.leaflet-marker-pane path.leaflet-interactive {
  opacity: 1;
}

/* ===== Top HUD ===== */
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: flex-start;
  padding: var(--hud-pad);
  pointer-events: none;
}

.hud-top > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  line-height: 0;
  cursor: pointer;
}

.brand-swap {
  --brand-h: 28px;
  --brand-full-w: calc(var(--brand-h) * 845 / 150);
  --brand-small-w: calc(var(--brand-h) * 145 / 150);
  position: relative;
  height: var(--brand-h);
  width: var(--brand-full-w);
  overflow: hidden;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand.is-compact .brand-swap {
  width: var(--brand-small-w);
}

.brand.is-compact:hover .brand-swap {
  width: var(--brand-full-w);
}

.brand-swap img {
  display: block;
  height: var(--brand-h);
  width: auto;
  max-width: none;
}

.brand-logo-small {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
}

.brand-logo-full {
  position: relative;
  z-index: 1;
  -webkit-mask-image: linear-gradient(to right, #000 42%, transparent 58%);
  mask-image: linear-gradient(to right, #000 42%, transparent 58%);
  -webkit-mask-size: 280% 100%;
  mask-size: 280% 100%;
  -webkit-mask-position: 0% 50%;
  mask-position: 0% 50%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition:
    -webkit-mask-position 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    mask-position 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

.brand.is-compact .brand-logo-full {
  -webkit-mask-position: 100% 50%;
  mask-position: 100% 50%;
  opacity: 0;
}

.brand.is-compact:hover .brand-logo-full {
  -webkit-mask-position: 0% 50%;
  mask-position: 0% 50%;
  opacity: 1;
  transition:
    -webkit-mask-position 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    mask-position 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-swap {
  --brand-h: 28px;
  --brand-full-w: calc(var(--brand-h) * 845 / 150);
  --brand-small-w: calc(var(--brand-h) * 145 / 150);
  position: relative;
  height: var(--brand-h);
  width: var(--brand-full-w);
  overflow: hidden;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand.is-compact .brand-swap {
  width: var(--brand-small-w);
}

.brand-swap img {
  display: block;
  height: var(--brand-h);
  width: auto;
  max-width: none;
}

.brand-logo-small {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
}

.brand-logo-full {
  position: relative;
  z-index: 1;
  -webkit-mask-image: linear-gradient(to right, #000 42%, transparent 58%);
  mask-image: linear-gradient(to right, #000 42%, transparent 58%);
  -webkit-mask-size: 280% 100%;
  mask-size: 280% 100%;
  -webkit-mask-position: 0% 50%;
  mask-position: 0% 50%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  transition:
    -webkit-mask-position 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    mask-position 0.9s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

.brand.is-compact .brand-logo-full {
  -webkit-mask-position: 100% 50%;
  mask-position: 100% 50%;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .brand-swap,
  .brand-logo-full {
    transition: none;
  }
}

.top-pill {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: visible;
}

/*
  Perfect circle controls — shared lock.
  Equal width/height + aspect-ratio 1 + padding 0 + border-radius 50%.
  UA button padding breaks circles; never skip these locks.
*/
.pill-btn,
.icon-round,
.tool-btn,
.avatar {
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  padding: 0;
  margin: 0;
  line-height: 1;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
}

.pill-btn,
.icon-round,
.tool-btn {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.pill-btn i,
.icon-round i,
.tool-btn i,
.avatar i {
  display: block;
  line-height: 1;
  font-size: inherit;
}

.pill-btn {
  position: relative;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  max-width: 42px;
  max-height: 42px;
  border: 0;
  background: transparent;
  color: rgb(0 76 128 / 60%);
  font-size: 1.15rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill-btn:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.39);
}

.pill-btn.active {
  background: var(--primary);
  color: #fff;
}

.nav-ai-lottie {
  display: block;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  pointer-events: none;
}

.nav-ai-lottie svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.pill-btn.active .nav-ai-lottie {
  filter: brightness(0) invert(1);
}

.pill-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 15px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--tooltip-bg);
  backdrop-filter: var(--tooltip-blur);
  -webkit-backdrop-filter: var(--tooltip-blur);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 40;
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.22);
}

.pill-btn[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.top-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.top-right .icon-round,
.top-right .avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  font-size: 1rem;
}

.top-right .icon-round .badge-dot {
  top: 6px;
  right: 7px;
}

.icon-round {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: #334155;
  font-size: 1.1rem;
}

.icon-round.sm {
  flex-basis: 34px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  max-width: 34px;
  max-height: 34px;
  font-size: 1rem;
  box-shadow: none;
  background: transparent;
}

.icon-round .badge-dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
  border: 2px solid #fff;
}

.avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

/* ===== Top-right dropdowns (notif + user) ===== */
.hud-top .top-right {
  position: relative;
  z-index: 2;
}

.hud-top .hud-dd {
  position: relative;
  flex: 0 0 auto;
  z-index: 1;
}

.hud-top .hud-dd > .avatar {
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

.hud-top .hud-dd-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  min-width: 280px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hud-top .hud-dd-panel[hidden] {
  display: none !important;
}

.hud-top .hud-dd-notif {
  min-width: 320px;
  padding: 10px;
}

.hud-top .hud-dd-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 8px 10px;
}

.hud-top .hud-dd-head strong {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.hud-top .hud-dd-head span {
  font-size: 11px;
  color: var(--muted);
}

.hud-top .hud-dd-notif-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(360px, 52vh);
  overflow-x: hidden;
  overflow-y: auto;
}

.hud-top .hud-dd-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(var(--primary-rgb), 0.06);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-sans);
  color: inherit;
  width: 100%;
  transition: background 0.15s ease, color 0.15s ease;
}

.hud-top .hud-dd-notif-item:hover,
.hud-top .hud-dd-notif-item:focus-visible {
  background: var(--primary);
  outline: none;
}

.hud-top .hud-dd-notif-item:hover .hud-dd-notif-ico,
.hud-top .hud-dd-notif-item:focus-visible .hud-dd-notif-ico {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.hud-top .hud-dd-notif-item:hover .hud-dd-notif-body strong,
.hud-top .hud-dd-notif-item:focus-visible .hud-dd-notif-body strong,
.hud-top .hud-dd-notif-item:hover .hud-dd-notif-body p,
.hud-top .hud-dd-notif-item:focus-visible .hud-dd-notif-body p {
  color: #fff;
}

.hud-top .hud-dd-notif-item.is-unread {
  background: rgba(var(--primary-rgb), 0.1);
}

.hud-top .hud-dd-notif-ico {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-size: 16px;
  transition: background 0.15s ease, color 0.15s ease;
}

.hud-top .hud-dd-notif-body {
  flex: 1 1 auto;
  min-width: 0;
}

.hud-top .hud-dd-notif-body strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.35;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.hud-top .hud-dd-notif-body p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  transition: color 0.15s ease;
}

.hud-top .hud-dd-user {
  min-width: 200px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-top .hud-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.hud-top .hud-dd-item i {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-size: 16px;
  transition: background 0.15s ease, color 0.15s ease;
}

.hud-top .hud-dd-item:hover,
.hud-top .hud-dd-item:focus-visible {
  background: var(--primary);
  color: #fff;
  outline: none;
}

.hud-top .hud-dd-item:hover i,
.hud-top .hud-dd-item:focus-visible i {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.hud-top .hud-dd-item.is-danger {
  color: var(--text);
}

.hud-top .hud-dd-item.is-danger i {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.hud-top .hud-dd-item.is-danger:hover,
.hud-top .hud-dd-item.is-danger:focus-visible {
  background: var(--primary);
  color: #fff;
}

.hud-top .hud-dd-item.is-danger:hover i,
.hud-top .hud-dd-item.is-danger:focus-visible i {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ===== Left float controls ===== */
.hud-float-left {
  position: absolute;
  top: 90px;
  left: var(--hud-pad);
  z-index: 550;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  max-width: calc(100vw - 100px);
}

.search-float {
  width: var(--float-field-width);
  max-width: 100%;
}

.search-float,
.region-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  padding: 0 12px;
  height: 44px;
}

.search-float input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  min-width: 0;
}

.region-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 100px);
}

.region-filters-primary {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: var(--float-field-width);
  flex: 0 0 var(--float-field-width);
  max-width: 100%;
  box-sizing: border-box;
}

.region-filters-primary .region-select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.region-select {
  position: relative;
  width: var(--region-select-child-width);
  flex: 0 0 var(--region-select-child-width);
  max-width: 100%;
  z-index: 20;
}

.region-select.is-open {
  z-index: 40;
}

.region-select[hidden] {
  display: none !important;
}

.region-collapse-btn {
  box-sizing: border-box;
  flex: 0 0 35px;
  width: 35px;
  height: 35px;
  min-width: 35px;
  min-height: 35px;
  aspect-ratio: 1 / 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--shadow-soft);
  transition: background 0.15s ease, transform 0.15s ease;
}

.region-collapse-btn:hover {
  background: var(--primary-hover);
}

.region-collapse-btn i {
  display: block;
  line-height: 1;
}

.region-collapse-btn[hidden] {
  display: none !important;
}

.region-select-trigger {
  width: 100%;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.region-select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.region-select-trigger i {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.18s ease;
}

.region-select.is-open .region-select-trigger {
  border-color: rgba(var(--primary-rgb), 0.35);
}

.region-select.is-open .region-select-trigger i {
  transform: rotate(180deg);
  color: var(--primary);
}

.region-select-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  max-height: min(320px, 50vh);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  z-index: 30;
  overflow: hidden;
}

.region-select-menu[hidden] {
  display: none !important;
}

.region-select-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 4px;
  padding: 0 10px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #a5b7d3;
  background: rgba(255, 255, 255, 0.45);
}

.region-select-search i {
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.region-select-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  color: #334155;
}

.region-select-search input::placeholder {
  color: var(--muted);
}

.region-select-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 2px;
  -webkit-overflow-scrolling: touch;
}

.region-select-empty {
  padding: 12px 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.region-select-option {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.region-select-option:hover,
.region-select-option:focus-visible {
  background: rgba(var(--primary-rgb), 0.2);
  color: var(--primary);
  outline: none;
}

.region-select-option.is-active {
  background: var(--primary);
  color: #fff;
}

.layer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  width: var(--float-field-width);
  max-width: 100%;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border);
}

.layer-controls button {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.layer-controls button.active {
  background: var(--primary);
  color: #fff;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  width: fit-content;
  box-shadow: var(--shadow-soft);
}

.live-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--home);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* Map pulse markers (user home + selected school) */
.map-pulse-marker {
  background: transparent !important;
  border: 0 !important;
  overflow: visible !important;
  pointer-events: none !important;
}

.map-pulse-pin {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.map-pulse-dot {
  width: var(--pulse-dot, 14px);
  height: var(--pulse-dot, 14px);
  border-radius: 50%;
  background: var(--pulse-c, var(--home));
  border: 2px solid #fff;
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 5px color-mix(in srgb, var(--pulse-c, var(--home)) 45%, transparent);
}

.map-pulse-halo-only .map-pulse-dot {
  visibility: hidden;
}

.map-pulse-pin::before,
.map-pulse-pin::after {
  content: "";
  position: absolute;
  width: var(--pulse-dot, 14px);
  height: var(--pulse-dot, 14px);
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--pulse-c, var(--home)) 60%, transparent);
  background: transparent;
  pointer-events: none;
  animation: map-pulse-ring 2s ease-out infinite;
}

.map-pulse-pin::after {
  animation-delay: 1s;
}

@keyframes map-pulse-ring {
  0% {
    opacity: 0.85;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(3);
  }
}

.map-school-back-marker.leaflet-marker-icon,
.map-school-back-marker.leaflet-div-icon {
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  overflow: visible !important;
}

.map-school-back {
  position: absolute;
  left: 0;
  bottom: calc(15px + 9px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 32px;
  padding: 0 14px 0 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16);
}

.map-school-back i {
  display: block;
  font-size: 16px;
  line-height: 1;
  color: var(--primary);
}

.map-school-back:hover {
  background: #f8fafc;
}

.map-school-back:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== Bottom dock: HUD BOTTOM (atas) + EXTENSION (bawah) ===== */
.hud-dock {
  position: absolute;
  left: var(--hud-pad);
  right: var(--hud-pad);
  bottom: var(--hud-pad);
  z-index: 700;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  pointer-events: none;
}

body.hud-ext-open.hud-ext-mode-push .hud-dock {
  transform: translateZ(0);
}

.hud-bottom {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(280px, 1.3fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr) minmax(240px, 1.3fr);
  gap: var(--hud-card-gap);
  height: var(--bottom-h);
  flex: 0 0 auto;
  order: 0;
  pointer-events: none;
}

.hud-bottom > * {
  pointer-events: auto;
  min-height: 0;
}

/* Hint scroll — di atas HUD bottom, center */
.hud-scroll-hint {
  display: none;
  position: absolute;
  left: 50%;
  z-index: 710;
  width: 35px;
  height: 35px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 76, 128, 0.28);
  cursor: pointer;
  pointer-events: auto;
  transform: translateX(-50%);
  bottom: calc(var(--hud-dock-visible-h, calc(var(--bottom-h) + var(--hud-card-gap) + var(--hud-dock-peek))) + 15px);
  transition: opacity 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease, bottom 0.22s ease;
}

body.hud-ext-mode-dock-scroll .hud-scroll-hint {
  display: grid;
  place-items: center;
}

body.hud-ext-mode-dock-scroll.hud-ext-revealing .hud-scroll-hint:not(.hud-scroll-hint-nw) {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
}

body.hud-ext-mode-dock-scroll.hud-ext-at-end .hud-scroll-hint:not(.hud-scroll-hint-nw) {
  opacity: 1;
  pointer-events: auto;
  z-index: 720;
  bottom: calc(var(--hud-pad) + 10px);
  transform: translateX(-50%);
}

.hud-scroll-hint:hover,
.hud-scroll-hint:focus-visible {
  box-shadow: 0 8px 22px rgba(0, 76, 128, 0.38);
  outline: none;
}

.hud-scroll-hint-lottie {
  display: block;
  width: 30px;
  height: 30px;
  pointer-events: none;
  filter: brightness(0) invert(1);
  transition: transform 0.22s ease;
}

.hud-scroll-hint-lottie svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.hud-scroll-hint-nw {
  left: var(--hud-pad);
  transform: none;
  margin-bottom: 10px;
}

body.page-sekolah-list .hud-scroll-hint-nw {
  display: none !important;
}

.hud-scroll-hint.is-flipped .hud-scroll-hint-lottie {
  transform: scaleY(-1);
}

body.hud-bottom-collapsed:not(.hud-ext-school) .hud-scroll-hint-nw .hud-scroll-hint-lottie,
.hud-scroll-hint-nw.is-flipped .hud-scroll-hint-lottie {
  transform: scaleY(-1);
}

body.hud-ext-mode-dock-scroll.hud-ext-revealing .hud-scroll-hint-nw {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* Handle bar di extension (bukan tombol peek) */
.hud-ext-peek-bar {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.28);
  order: 2;
}

/* Backdrop di bawah dock, di atas map */
.hud-ext-backdrop {
  position: absolute;
  inset: 0;
  z-index: 690;
  background: rgba(var(--hud-ext-backdrop-rgb), var(--hud-ext-backdrop-alpha));
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--hud-ext-dur) var(--hud-ext-ease);
}

.hud-ext-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

/*
 * Extension — push: grid 0fr→1fr (lebih halus dari animasi height).
 */
.hud-extension {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  order: 1;
  display: grid;
  grid-template-rows: 0fr;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    grid-template-rows var(--hud-ext-dur) var(--hud-ext-ease),
    opacity var(--hud-ext-dur) var(--hud-ext-ease);
  contain: layout style;
  transform: translateZ(0);
}

.hud-ext-body {
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Tinggi tetap hanya saat extension terbuka — jangan reserve ruang saat tertutup */
body.hud-ext-open.hud-ext-mode-push .hud-extension.is-open .hud-ext-body {
  height: var(--hud-ext-h-base);
  max-height: var(--hud-ext-h-base);
}

.hud-dock-scroll {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

/* Mode PUSH: extension tumbuh → dorong HUD bottom */
body.hud-ext-open.hud-ext-mode-push .hud-dock-scroll {
  gap: var(--hud-card-gap);
}

body.hud-ext-open.hud-ext-mode-push .hud-dock {
  gap: 0;
}

body.hud-ext-open.hud-ext-mode-push .hud-extension.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  pointer-events: auto;
}

body.hud-ext-open.hud-ext-mode-push .hud-ext-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Mode SCROLL: bottom tetap, panel overlay + scroll manual */
body.hud-ext-open.hud-ext-mode-scroll .hud-dock {
  gap: 0;
}

body.hud-ext-open.hud-ext-mode-scroll .hud-extension {
  display: block;
  height: 0;
  transform: translateY(8px) translateZ(0);
  transition:
    height var(--hud-ext-dur) var(--hud-ext-ease),
    opacity var(--hud-ext-dur) var(--hud-ext-ease),
    transform var(--hud-ext-dur) var(--hud-ext-ease);
}

body.hud-ext-open.hud-ext-mode-scroll .hud-extension.is-open {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + var(--hud-card-gap));
  z-index: 3;
  height: var(--hud-ext-h-base);
  max-height: var(--hud-ext-h-base);
  transform: translateY(0) translateZ(0);
  opacity: 1;
  pointer-events: auto;
  overflow: hidden;
}

body.hud-ext-open.hud-ext-mode-scroll .hud-ext-body {
  height: 100%;
  max-height: 100%;
}

body.hud-ext-open.hud-ext-mode-scroll .hud-ext-grid {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/*
 * Mode DOCK-SCROLL (analitik): scroll down = buka extension, scroll up = tutup.
 * Satu arah, tanpa scroll internal ganda.
 */
body.hud-ext-mode-dock-scroll .hud-dock {
  gap: 0;
  bottom: 0;
  top: auto;
  height: var(--hud-dock-visible-h, calc(var(--bottom-h) + var(--hud-card-gap) + var(--hud-dock-peek)));
  max-height: calc(100vh - var(--hud-ext-top-clearance));
  overflow: hidden;
  overscroll-behavior: contain;
  pointer-events: auto;
  transition: none;
}

body.hud-ext-school.hud-ext-mode-dock-scroll .hud-dock {
  bottom: var(--hud-pad);
  height: var(--bottom-h);
}

body.hud-ext-school .hud-extension,
body.hud-ext-school #hudScrollHint {
  display: none !important;
}

body.hud-ext-school .hud-ext-backdrop {
  opacity: 0 !important;
  pointer-events: none !important;
}

body.hud-ext-mode-dock-scroll .hud-dock-scroll {
  height: 100%;
  gap: var(--hud-card-gap);
}

body.hud-ext-mode-dock-scroll.hud-ext-reveal-max .hud-dock-scroll {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.hud-ext-mode-dock-scroll .hud-extension {
  padding-bottom: var(--hud-pad);
  box-sizing: border-box;
}

body.hud-ext-mode-dock-scroll.hud-ext-reveal-max .hud-extension {
  padding-bottom: var(--hud-pad);
  box-sizing: border-box;
}

body.hud-ext-mode-dock-scroll .hud-extension {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  display: grid;
  grid-template-rows: 1fr;
  height: auto;
  max-height: none;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  overflow: visible;
  transition: none;
}

body.hud-ext-mode-dock-scroll .hud-extension .hud-ext-body {
  height: var(--hud-ext-h-base);
  max-height: var(--hud-ext-h-base);
}

body.hud-ext-mode-dock-scroll .hud-ext-grid {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

body.hud-ext-mode-dock-scroll .hud-ext-backdrop {
  opacity: var(--hud-ext-backdrop-opacity, 0);
  pointer-events: none;
  transition: none;
}

body.hud-ext-mode-dock-scroll.hud-ext-revealing .hud-ext-backdrop {
  pointer-events: auto;
}

/* Fade lembut di zona clearance atas — hanya saat dock mendekati batas atas */
body.hud-ext-mode-dock-scroll.hud-ext-top-fade::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud-ext-top-vignette-h);
  pointer-events: none;
  z-index: 695;
  background: linear-gradient(
    to bottom,
    rgba(30, 41, 59, 0.14) 0%,
    rgba(30, 41, 59, 0.08) 28%,
    rgba(30, 41, 59, 0.03) 62%,
    transparent 100%
  );
  opacity: var(--hud-ext-top-fade-opacity, 0);
  transition: opacity 0.18s cubic-bezier(0.33, 1, 0.68, 1);
}

/* Brand + top-right + map-tools: fade dari awal scroll (satu variabel) */
body.hud-ext-mode-dock-scroll .hud-top .brand,
body.hud-ext-mode-dock-scroll .hud-top .top-right,
body.hud-ext-mode-dock-scroll .map-tools-right {
  opacity: var(--hud-chrome-opacity, 1);
  transition: opacity 0.2s cubic-bezier(0.33, 1, 0.68, 1);
  will-change: opacity;
}

body.hud-ext-mode-dock-scroll.hud-ext-chrome-faded .hud-top .brand,
body.hud-ext-mode-dock-scroll.hud-ext-chrome-faded .hud-top .top-right,
body.hud-ext-mode-dock-scroll.hud-ext-chrome-faded .map-tools-right {
  pointer-events: none;
}

body.hud-ext-mode-dock-scroll.hud-ext-revealing .hud-dock .dash-card {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(255, 255, 255, 0.9);
}

/*
 * Mask fade di tepi atas dock — soft cut, bukan overlay gelap.
 * Mask di .hud-dock (outer), scroll di .hud-dock-scroll → hindari flicker.
 */
body.hud-ext-mode-dock-scroll.hud-ext-top-fade .hud-dock {
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    rgba(0, 0, 0, 0.04) calc(var(--hud-ext-mask-stop, 56px) * 0.1),
    rgba(0, 0, 0, 0.12) calc(var(--hud-ext-mask-stop, 56px) * 0.22),
    rgba(0, 0, 0, 0.28) calc(var(--hud-ext-mask-stop, 56px) * 0.38),
    rgba(0, 0, 0, 0.5) calc(var(--hud-ext-mask-stop, 56px) * 0.55),
    rgba(0, 0, 0, 0.72) calc(var(--hud-ext-mask-stop, 56px) * 0.7),
    rgba(0, 0, 0, 0.9) calc(var(--hud-ext-mask-stop, 56px) * 0.86),
    #000 var(--hud-ext-mask-stop, 56px),
    #000 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    rgba(0, 0, 0, 0.04) calc(var(--hud-ext-mask-stop, 56px) * 0.1),
    rgba(0, 0, 0, 0.12) calc(var(--hud-ext-mask-stop, 56px) * 0.22),
    rgba(0, 0, 0, 0.28) calc(var(--hud-ext-mask-stop, 56px) * 0.38),
    rgba(0, 0, 0, 0.5) calc(var(--hud-ext-mask-stop, 56px) * 0.55),
    rgba(0, 0, 0, 0.72) calc(var(--hud-ext-mask-stop, 56px) * 0.7),
    rgba(0, 0, 0, 0.9) calc(var(--hud-ext-mask-stop, 56px) * 0.86),
    #000 var(--hud-ext-mask-stop, 56px),
    #000 100%
  );
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* Pengukuran konten (mode detect) */
.hud-extension.is-measuring {
  visibility: hidden !important;
  position: absolute !important;
  left: 0;
  right: 0;
  bottom: 0;
  grid-template-rows: 1fr !important;
  height: auto !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: none !important;
}

.hud-extension.is-measuring .hud-ext-body {
  max-height: none !important;
}

.hud-extension.is-measuring .hud-ext-grid {
  overflow: visible !important;
}

@media (prefers-reduced-motion: reduce) {
  .hud-extension,
  .hud-ext-backdrop,
  body.hud-ext-open.hud-ext-mode-scroll .hud-extension {
    transition-duration: 0.01ms !important;
  }
}

/* Handle di zona gap dock — tidak menambah tinggi */
.hud-ext-handle {
  position: absolute;
  top: calc(-1 * var(--hud-card-gap));
  left: 0;
  right: 0;
  height: var(--hud-card-gap);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  z-index: 2;
}

.hud-ext-handle:active {
  cursor: grabbing;
}

.hud-ext-handle .hud-ext-peek-bar {
  position: static;
  transform: none;
}

/* Daftar sekolah: HUD bottom tampil; extension baru setelah pencarian */
body.page-sekolah[data-hud-ext-mode="dock-scroll"] {
  --hud-ext-h-scale: 1;
  --hud-ext-h-base: var(--bottom-h);
}

body.page-sekolah.hud-ext-mode-dock-scroll .hud-bottom {
  order: 0;
}

body.page-sekolah.hud-ext-mode-dock-scroll .hud-extension {
  order: 1;
  padding-bottom: 0;
  flex: 0 0 var(--bottom-h);
  height: var(--bottom-h);
}

body.page-sekolah.hud-ext-mode-dock-scroll .hud-extension .hud-ext-body {
  height: var(--bottom-h);
  max-height: var(--bottom-h);
}

body.page-sekolah:not(.page-sekolah-results):not(.hud-ext-school) .hud-extension,
body.page-sekolah:not(.page-sekolah-results):not(.hud-ext-school) .hud-ext-backdrop,
body.page-sekolah:not(.hud-ext-school) #hudScrollHint,
body.page-sekolah .hud-ext-handle {
  display: none !important;
}

body.page-sekolah.hud-ext-mode-dock-scroll:not(.hud-ext-school):not(.page-sekolah-results) .hud-dock {
  bottom: var(--hud-pad);
  height: var(--bottom-h);
}

body.page-sekolah.hud-bottom-collapsed:not(.hud-ext-school) .hud-bottom {
  display: none !important;
}

body.page-sekolah.hud-bottom-collapsed.hud-ext-mode-dock-scroll:not(.hud-ext-school):not(.page-sekolah-results) .hud-dock {
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

body.page-sekolah.hud-bottom-collapsed:not(.page-sekolah-results) .school-adv {
  bottom: calc(var(--hud-pad) + 0px);
}

body.page-sekolah.hud-ext-school .hud-bottom {
  order: 0;
  padding-bottom: 0;
}

/* Pencarian lanjutan — tengah peta */
.school-adv {
  display: none;
}

body.page-sekolah .school-adv {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 10px;
  position: absolute;
  left: 0;
  right: 0;
  top: auto;
  bottom: calc(var(--bottom-h) + var(--hud-pad) + 24px);
  margin: 0 auto;
  transform: none;
  z-index: 800;
  width: min(740px, calc(100vw - 88px));
  pointer-events: none;
}

body.page-sekolah.page-sekolah-results .school-adv {
  bottom: calc(var(--hud-dock-visible-h, calc(var(--bottom-h) + var(--hud-card-gap) + var(--hud-dock-peek))) + 16px);
  transform: none;
}

body.page-sekolah.page-sekolah-list .school-adv {
  bottom: calc(var(--hud-pad) + 12px);
  max-height: calc(100vh - 88px);
}

body.page-sekolah.hud-ext-school .school-adv {
  display: none;
}

.school-adv-card {
  pointer-events: auto;
  background: #fff;
  border: 1px solid rgba(30, 41, 59, 0.08);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
  padding: 16px 16px 14px;
  width: 100%;
  flex: 0 0 auto;
}

.school-adv-results {
  display: none;
  pointer-events: auto;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
}

.school-adv-results:not([hidden]) {
  display: flex;
  flex-direction: column;
}

.school-adv-results-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: min(380px, 50vh);
  padding-bottom: 10px;
}

.school-adv-results-card .ext-kab-dir {
  margin-top: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.school-adv-results-card .ext-kab-list {
  min-height: 120px;
}

.school-adv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.school-adv-head .card-kicker,
.school-adv-head .card-kicker-end {
  margin: 0;
}

.school-adv-join {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: #f1f5f9;
}

.school-adv-join button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.school-adv-join button.is-on {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

.school-adv-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
}

.school-adv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 6px 6px 8px;
  border: 1px solid rgba(30, 41, 59, 0.1);
  border-radius: 14px;
  background: #fff;
}

.school-adv-row .school-adv-field-wrap {
  flex: 1 1 0;
}

.school-adv-grip {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: default;
}

.school-adv-field-wrap {
  position: relative;
  flex: 1.4 1 160px;
  min-width: 0;
}

.school-adv-field-wrap .school-adv-dd {
  width: 100%;
}

.school-adv-field-wrap > i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 15px;
  pointer-events: none;
  z-index: 1;
}

.school-adv-dd {
  position: relative;
  min-width: 0;
}

.school-adv-dd.is-open {
  z-index: 50;
  pointer-events: auto;
}

.school-adv-dd-field {
  width: 100%;
}

.school-adv-dd-op,
.school-adv-dd-val {
  flex: 0.9 1 120px;
}

.school-adv-dd-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  height: 36px;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 0 10px 0 12px;
  cursor: pointer;
  text-align: left;
}

.school-adv-field-wrap .school-adv-dd-trigger,
.school-adv-field-wrap .school-adv-val {
  padding-left: 32px;
}

.school-adv-dd-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.school-adv-dd-trigger > i {
  flex: 0 0 auto;
  font-size: 16px;
  color: #64748b;
  transition: transform 0.15s ease, color 0.12s ease;
}

.school-adv-dd-trigger:hover,
.school-adv-dd.is-open .school-adv-dd-trigger {
  background: rgba(var(--primary-rgb), 0.2);
  color: var(--primary);
}

.school-adv-dd-trigger:hover > i,
.school-adv-dd.is-open .school-adv-dd-trigger > i {
  color: var(--primary);
}

.school-adv-dd.is-open .school-adv-dd-trigger > i {
  transform: rotate(180deg);
}

.school-adv-dd-panel.region-select-menu {
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
  right: auto;
  width: max(100%, 240px);
  min-width: 200px;
  max-width: min(360px, calc(100vw - 24px));
  max-height: 400px;
  z-index: 5;
  pointer-events: auto;
}

.school-adv-val {
  flex: 0.9 1 120px;
  min-width: 0;
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 0 12px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.school-adv-del {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(30, 41, 59, 0.08);
  border-radius: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.school-adv-del:hover {
  color: #b45309;
}

.school-adv-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 10px 12px;
  border: 1px dashed rgba(var(--primary-rgb), 0.22);
  border-radius: 14px;
  background: rgba(var(--primary-rgb), 0.03);
}

.school-adv-group-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.school-adv-group .school-adv-del {
  border-left: 0;
}

.school-adv-dd-kab .school-adv-dd-trigger {
  color: var(--primary);
}

.school-adv-row .school-adv-field-wrap:has(.school-adv-dd-sekolah) {
  flex: 1.6 1 0;
}

.school-adv-dd-sekolah .school-adv-dd-panel.region-select-menu {
  min-width: 260px;
  max-width: min(420px, calc(100vw - 24px));
}

.school-adv-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.school-adv-hint {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

.school-adv-hint i {
  flex: 0 0 auto;
  font-size: 14px;
  color: var(--primary);
  line-height: 1;
  transform: translateY(-4px);
}

.school-adv-add {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.school-adv-add button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.school-adv-add button i {
  font-size: 16px;
}

.school-adv-add button:hover {
  background: rgba(var(--primary-rgb), 0.06);
}

.school-adv-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.school-adv-reset {
  appearance: none;
  border: 0;
  background: #e2e8f0;
  color: #475569;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.school-adv-reset:hover {
  background: #cbd5e1;
}

.school-adv-reset i {
  font-size: 15px;
}

.school-adv-run {
  appearance: none;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.school-adv-run:hover {
  background: #0369a1;
}

.school-adv-run i {
  font-size: 15px;
}

@media (max-width: 720px) {
  body.page-sekolah .school-adv {
    width: calc(100vw - 24px);
    top: auto;
    bottom: calc(var(--hud-dock-visible-h, calc(var(--bottom-h) + var(--hud-pad))) + 16px);
    transform: none;
  }

  .school-adv-row {
    flex-wrap: wrap;
  }

  .school-adv-row .school-adv-field-wrap {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
  }

  .school-adv-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .school-adv-actions {
    width: 100%;
  }

  .school-adv-reset,
  .school-adv-run {
    flex: 1 1 0;
    justify-content: center;
  }
}

body.page-sekolah .hud-ext-grid {
  grid-template-columns: minmax(210px, 0.9fr) minmax(260px, 1.4fr);
}

.hud-ext-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(210px, 0.9fr) minmax(260px, 1.2fr) minmax(240px, 1.3fr);
  gap: var(--hud-card-gap);
  pointer-events: none;
  overflow: hidden;
}

.hud-ext-grid > * {
  pointer-events: auto;
  min-height: 0;
}

.hud-ext-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hud-ext-placeholder {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px dashed rgba(30, 41, 59, 0.14);
  background: rgba(255, 255, 255, 0.28);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
}

/* AI Insight list — Extensi F (kabupaten) */
#extCardF .card-kicker-row {
  flex-shrink: 0;
}

#extCardF .hud-ai-list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  isolation: isolate;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.hud-ai-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 2px 2px 0;
}

.hud-ai-item {
  display: flex;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 10px 10px 9px;
  border-radius: 12px;
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  /* Layer sendiri: parent .dash-card punya backdrop-filter + bg 0.75,
     sehingga putih opaque anak ikut ter-composite jadi abu. */
  background-color: #fff;
  background-image: none;
  isolation: isolate;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hud-ai-item:hover,
.hud-ai-item:focus-visible {
  background: rgba(var(--primary-rgb), 0.06);
  border-color: rgba(var(--primary-rgb), 0.22);
  outline: none;
}

.hud-ai-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.hud-ai-icon i {
  font-size: 15px;
  line-height: 1;
}

.hud-ai-icon.risk {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.hud-ai-icon.warn {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.hud-ai-icon.info {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.hud-ai-icon.ok {
  background: rgba(3, 105, 161, 0.12);
  color: #0369a1;
}

.hud-ai-body {
  flex: 1 1 auto;
  min-width: 0;
}

.hud-ai-body strong {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.35;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-ai-body p {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.hud-ai-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hud-ai-foot time {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hud-ai-tag {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.hud-ai-tag.risk {
  color: #ef4444;
}

.hud-ai-tag.warn {
  color: #d97706;
}

.hud-ai-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed rgba(30, 41, 59, 0.14);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: center;
}

/* Profil kabupaten + direktori sekolah — Ekstensi A */
#extCardHero .card-kicker-row,
#extCardSchools .card-kicker-row {
  flex-shrink: 0;
}

#extCardSchools .ext-kab-more {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  transition: color 0.15s ease;
}

#extCardSchools .ext-kab-more i {
  display: block;
  font-size: 12px;
  line-height: 1;
}

#extCardSchools .ext-kab-more:hover,
#extCardSchools .ext-kab-more:focus-visible {
  color: #1d7eb5;
  text-decoration: none;
}

#extCardSchools .ext-kab-more:focus-visible {
  outline: none;
}

.ext-kab-profile,
.ext-kab-dir {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  margin-top: 8px;
}

.ext-kab-profile {
  overflow: auto;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.ext-kab-id {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ext-kab-mark {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
  transform: translateZ(0);
}

.ext-kab-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  padding: 5px;
}

.ext-kab-id strong {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.25;
}

.ext-kab-id span {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.ext-kab-codes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ext-kab-codes em {
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  border-radius: 999px;
  padding: 5px 15px;
}

.ext-kab-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  align-content: stretch;
}

.ext-kab-kpis .hud-benefit-metric {
  background-color: #fff;
  isolation: isolate;
  transform: translateZ(0);
  padding: 7px 10px;
}

.ext-kab-kpis .hud-benefit-metric strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

/* Analitik peek: report kabupaten di kartu hero */
body.page-analitik #telemetryCard .analitik-hero-body {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

body.page-analitik #telemetryCard .analitik-hero-id {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.page-analitik #telemetryCard .ext-kab-id {
  margin-bottom: 8px;
}

body.page-analitik #telemetryCard .analitik-kpi-score {
  grid-template-columns: 1fr 1fr;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 4px;
}

body.page-analitik #telemetryCard .analitik-hero-radar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

body.page-analitik #telemetryCard .analitik-hero-radar .hud-chart-box {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  aspect-ratio: auto;
  max-height: none;
}

.analitik-radar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  flex: 0 0 auto;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.analitik-radar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

body.page-analitik #statsCard .hud-benefit-metrics-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ext-kec-rank {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  overflow: auto;
  overscroll-behavior: contain;
}

.ext-kec-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  background-color: #fff;
  isolation: isolate;
}

.ext-kec-n {
  flex: 0 0 22px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.ext-kec-body {
  flex: 1 1 auto;
  min-width: 0;
}

.ext-kec-body strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.ext-kec-row em {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  max-width: 38%;
}

.ext-kab-dir-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.ext-kab-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--primary-rgb), 0.14);
  background-color: #fff;
  isolation: isolate;
  transform: translateZ(0);
}

.ext-kab-search i {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1;
}

.ext-kab-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  appearance: none;
}

.ext-kab-search input::placeholder {
  color: var(--muted);
}

.ext-kab-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.ext-kab-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.ext-kab-filters button {
  margin: 0;
  border: 0;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--muted);
  cursor: pointer;
  appearance: none;
}

.ext-kab-filters button.active {
  background: var(--primary);
  color: #fff;
}

.ext-kab-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.ext-kab-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 7px 8px 7px 7px;
  border-radius: 12px;
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  background-color: #fff;
  background-image: none;
  isolation: isolate;
  transform: translateZ(0);
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ext-kab-row:hover,
.ext-kab-row:focus-visible {
  background: rgba(var(--primary-rgb), 0.05);
  border-color: rgba(var(--primary-rgb), 0.22);
  outline: none;
}

.ext-kab-row.is-active {
  border-color: rgba(var(--primary-rgb), 0.4);
  background: rgba(var(--primary-rgb), 0.07);
  animation: extKabLastPulse 1.1s ease;
}

@keyframes extKabLastPulse {
  0% {
    background: rgba(var(--primary-rgb), 0.16);
  }
  100% {
    background: rgba(var(--primary-rgb), 0.07);
  }
}

.ext-kab-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}

.ext-kab-row-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ext-kab-row-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.ext-kab-row-body strong {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ext-kab-row .badge-tone {
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 9px;
}

.ext-kab-row-meta {
  display: block;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.3;
  margin: 1px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ext-kab-util {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.ext-kab-util-track {
  flex: 1 1 auto;
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  overflow: hidden;
  min-width: 0;
}

.ext-kab-util-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.ext-kab-util-track i.warn {
  background: #f59e0b;
}

.ext-kab-util-track i.risk {
  background: #ef4444;
}

.ext-kab-util em {
  flex: 0 0 auto;
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ext-kab-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  text-align: center;
  padding: 16px;
}

@media (max-width: 720px) {
  .hud-ext-grid {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(0, 1fr);
    overflow: auto;
  }
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  padding: 16px 18px;
  overflow: hidden;
}

.nusapeta-chart-tooltip {
  position: fixed;
  z-index: 4000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  min-width: 140px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #004c80;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.35;
}

.nusapeta-chart-tooltip.is-show {
  opacity: 1;
  transform: translateY(0);
}

.nusapeta-chart-tooltip .tt-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.nusapeta-chart-tooltip .tt-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.nusapeta-chart-tooltip .tt-row i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
  border: 1px solid #fff;
}

.dash-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  min-height: 0;
}

.card-compact {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.card-stats {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* Utilisasi: chart ~95% tinggi card · metrik 1 baris bawah */
#statsCard .hud-util-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  gap: 6px;
}

#statsCard .hud-util-stack > .hud-chart-box,
#statsCard .hud-util-stack > .hud-chart-box-hbar,
#statsCard .hud-util-stack > .hud-chart-box-fill {
  flex: 95 1 0 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  padding: 10px 0;
}

#statsCard .hud-util-stack > .hud-benefit-metrics-row {
  flex: 5 0 auto;
  min-height: 0;
}

.hud-benefit-metrics.hud-benefit-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.hud-benefit-metrics-row .hud-benefit-metric {
  min-width: 0;
  padding: 3px 10px;
}

.hud-benefit-metrics-row .hud-benefit-metric span {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-benefit-metrics-row .hud-benefit-metric strong {
  font-size: 13px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin: 0;
}

.card-kicker {
  font-family: var(--font-sans);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

.card-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.card-kicker-row .card-kicker {
  margin: 0;
  min-width: 0;
}

.card-kicker-end {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  text-align: right;
  line-height: 1.2;
}

/* Hero card */
.card-hero {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.card-hero,
.card-hero .card-kicker,
.card-hero .hero-id,
.card-hero .badge-tone,
.card-hero .hero-meta,
.card-hero .hero-meta .k,
.card-hero .hero-meta .v,
.card-hero .hero-visual,
.card-hero .school-name,
.card-hero .tiny,
.card-hero .btn-mini,
.card-hero .jenjang-tag {
  font-family: var(--font-sans);
}

.hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex: 0 0 auto;
}

.hero-head .card-kicker-row {
  flex: 1 1 auto;
  width: 100%;
  margin-bottom: 0;
}

.hero-back {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  margin: 0 0 0 -6px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--primary);
  min-height: 22px;
  border-radius: 6px;
}

.hero-back i {
  font-size: 18px;
  line-height: 1;
  color: var(--primary);
}

.hero-back .card-kicker {
  margin: 0;
}

.hero-back:hover .card-kicker,
.hero-back:focus-visible .card-kicker {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-back:focus-visible {
  outline: none;
}

.hero-id {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
}

.badge-tone {
  border-radius: 999px;
  padding: 3px 15px;
  font-size: 10px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid transparent;
}

.badge-tone.ok {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.14);
}

.badge-tone.warn {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.15);
}

.badge-tone.risk {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.14);
}

.badge-tone.transit {
  background: rgba(249, 115, 22, 0.1);
  color: #c2410c;
  border-color: rgba(249, 115, 22, 0.15);
}

.hero-body {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.hero-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  align-self: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.hero-meta li {
  display: grid;
  grid-template-columns: 100px 100px;
  gap: 6px;
  line-height: 18px;
  font-size: 12px;
  font-family: var(--font-sans);
}

.hero-meta .k {
  color: var(--muted);
  white-space: nowrap;
}

.hero-meta .v {
  font-weight: 600;
  color: var(--primary);
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

.hero-meta-sep {
  display: block;
  height: 0;
  margin: 4px 0;
  padding: 0;
  border: 0;
  border-top: 1px solid rgb(176 176 176 / 30%);
  grid-template-columns: none;
}

.hero-visual {
  border-radius: 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

.hero-visual-table {
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.hero-school-head {
  flex: 0 0 auto;
  background: #e2e8f0;
  border-radius: 13px 13px 0 0;
  overflow: hidden;
}

.hero-school-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
}

.hero-school-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.35;
}

.hero-school-table th:nth-child(1),
.hero-school-table td:nth-child(1) {
  width: 72%;
}

.hero-school-table th:nth-child(2),
.hero-school-table td:nth-child(2) {
  width: 28%;
}

.hero-school-head .hero-school-table thead th,
.hero-school-table thead th {
  position: static;
  background: #e2e8f0;
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 10px 8px;
  border-bottom: 0;
  white-space: nowrap;
}

.hero-school-head .hero-school-table thead th:first-child {
  border-radius: 13px 0 0 0;
}

.hero-school-head .hero-school-table thead th:last-child {
  border-radius: 0 13px 0 0;
  text-align: right;
}

.hero-school-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--text);
  vertical-align: top;
}

.hero-school-table tbody tr:last-child td {
  border-bottom: 0;
}

.hero-school-table tbody tr:nth-child(even) td {
  background: rgb(140 198 255 / 5%);
}

.hero-school-name {
  font-weight: 600;
  color: var(--primary) !important;
}

.hero-school-dist {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: right;
}

.hero-school-table th:last-child {
  text-align: right;
}

.hero-school-row {
  cursor: pointer;
  transition: background 0.12s ease;
}

.hero-school-row:hover td {
  background: rgba(var(--primary-rgb), 0.06);
}

.hero-school-empty {
  padding: 10px 6px;
}

.hero-visual .school-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.hero-school-thumb {
  align-self: stretch;
  width: 100%;
  height: 90px;
  margin-bottom: 10px;
  object-fit: cover;
  object-position: center;
  border-radius: 10px;
  display: block;
  background: #e2e8f0;
  flex: 0 0 auto;
}

.hero-visual .jenjang-tag {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 8px;
  color: #fff;
}

.hero-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.hero-kelas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.45);
}

.hero-kelas-head {
  flex: 0 0 auto;
  background: #e2e8f0;
  border-radius: 9px 9px 0 0;
  overflow: hidden;
}

.hero-kelas-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.hero-kelas-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.35;
}

.hero-kelas-head .hero-kelas-table thead th,
.hero-kelas-table thead th {
  position: static;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 0;
}

.hero-kelas-table thead th:last-child,
.hero-kelas-table td.hero-kelas-n {
  text-align: right;
}

.hero-kelas-table th:nth-child(1),
.hero-kelas-table td:nth-child(1) {
  width: 60%;
}

.hero-kelas-table th:nth-child(2),
.hero-kelas-table td:nth-child(2) {
  width: 40%;
}

.hero-kelas-table tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text);
  font-weight: 600;
}

.hero-kelas-table tbody tr:last-child td {
  border-bottom: 0;
}

.hero-kelas-table tbody tr.is-even td {
  background: #f1f5f9;
}

.hero-kelas-n {
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.hero-kelas-empty {
  margin-top: 8px;
  padding: 8px 4px;
}

.btn-mini {
  border: 0;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-mini.dark {
  background: var(--primary);
  color: #fff;
}

.btn-mini.ghost {
  background: var(--surface-2);
  color: #334155;
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Gauge cards */
.gauge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(100% - 18px);
}

.gauge-svg {
  width: 84px;
  height: 56px;
  flex-shrink: 0;
}

.gauge-val {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
}

.gauge-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Orion Revenue–style HUD charts (Chart.js) */
.hud-benefit-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  margin: 2px 0 4px;
  font-family: var(--font-mono);
}

.hud-benefit-value small {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
  font-family: var(--font-sans);
  text-transform: lowercase;
}

.hud-chart-box {
  height: 58px;
  margin-bottom: 6px;
  position: relative;
  flex: 1 1 auto;
  min-height: 48px;
}

.hud-benefit-body {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 2px;
}

/* Chart : metrics = 1.75 : 1 */
.hud-benefit-body > .hud-chart-box-side,
.hud-benefit-body > .hud-chart-box-pie,
.hud-benefit-body > .hud-chart-box-radar {
  flex: 1.3 1 0;
  width: auto;
  min-width: 0;
  max-width: none;
  height: auto;
  min-height: 0;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  align-self: center;
}

.hud-benefit-body > .hud-chart-box-side.hud-chart-box-hbar {
  aspect-ratio: 5 / 6;
  min-width: 150px;
  min-height: 128px;
  max-height: 160px;
}

.hud-benefit-body > .hud-benefit-side {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  align-items: flex-end;
}

.hud-chart-box-side {
  flex: 0 0 96px;
  width: 96px;
  height: auto;
  min-height: 96px;
  max-height: 118px;
  margin-bottom: 0;
  align-self: center;
}

.hud-chart-box-pie {
  flex: 0 0 112px;
  width: 112px;
  min-height: 112px;
  max-height: 128px;
}

.hud-chart-box-hbar {
  flex: 0 0 132px;
  width: 132px;
  min-width: 120px;
  min-height: 112px;
  max-height: 132px;
  aspect-ratio: auto;
}

.hud-chart-box-radar {
  flex: 0 0 128px;
  width: 128px;
  min-height: 118px;
  max-height: 132px;
}

.hud-chart-box-radar-fill {
  flex: 1 1 auto;
  width: 100%;
  min-height: 110px;
  max-height: none;
  margin-top: 4px;
}

.hud-chart-box-fill {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 108px;
  margin-bottom: 0;
}

.hud-benefit-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  align-self: center;
  gap: 6px;
}

.hud-benefit-side .hud-benefit-value {
  margin: 0;
  font-size: 16px;
}

.hud-benefit-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: auto;
  flex-shrink: 0;
}

.hud-benefit-side .hud-benefit-metrics {
  margin-top: 0;
}

.hud-benefit-metrics-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hud-benefit-metrics.hud-benefit-metrics-col {
  grid-template-columns: 1fr;
  gap: 6px;
}

.hud-benefit-metrics-bare {
  gap: 2px;
  width: 100%;
  justify-items: end;
}

.hud-benefit-metrics-bare .hud-benefit-metric {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: right;
  width: 100%;
}

.hud-benefit-metrics-bare .hud-benefit-metric > span {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  line-height: 0;
}

.hud-benefit-metric .luas-metric-line {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  line-height: 14px;
  white-space: nowrap;
  font-weight: 600;
}

.hud-benefit-metric .luas-metric-line b {
  font-family: "Poppins", var(--font-sans) !important;
  font-style: normal;
  font-weight: 700;
  color: #1e293b;
}

.hud-benefit-metric .luas-metric-line em {
  font-family: "Poppins", var(--font-sans) !important;
  font-style: normal;
  font-weight: 600;
  color: #1e293b;
}

.hud-benefit-metric .luas-metric-line .luas-sep {
  font-family: "Poppins", var(--font-sans) !important;
  font-size: inherit;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  width: auto;
  display: inline;
  flex: 0 0 auto;
}

.hud-benefit-side .split-foot {
  margin-top: 2px;
  max-width: 100%;
}

.card-stats .hud-benefit-value {
  font-size: 22px;
  margin: 4px 0 6px;
}

.hud-chart-box-lg {
  height: 120px;
  flex: 1 1 auto;
  min-height: 90px;
}

.hud-chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.hud-benefit-metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(30, 41, 59, 0.06);
  text-align: left;
  font-family: "Poppins", var(--font-sans) !important;
}

.hud-benefit-metric,
.hud-benefit-metric *,
.hud-benefit-metric span,
.hud-benefit-metric strong,
.hud-benefit-metric b,
.hud-benefit-metric em {
  font-family: "Poppins", var(--font-sans) !important;
}

.hud-benefit-metric.is-btn {
  appearance: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hud-benefit-metric.is-btn:hover,
.hud-benefit-metric.is-btn.active {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: rgba(var(--primary-rgb), 0.22);
}

.hud-benefit-metric span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hud-benefit-metric strong {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  font-family: "Poppins", var(--font-sans) !important;
}

.hud-swatch {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.split-foot {
  margin-top: 4px;
  font-size: 9px;
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

/* Pipeline compact (legacy) */
.pipeline-mini {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  margin-top: 8px;
  height: calc(100% - 28px);
}

.pipeline-mini .stage {
  flex: 1;
  text-align: center;
}

.pipeline-mini .bar {
  width: 100%;
  max-width: 36px;
  margin: 0 auto;
  border-radius: 999px;
  opacity: 0.9;
}

.pipeline-mini .lbl {
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
}

.pipeline-mini .arrow {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 18px;
}

/* Jenjang icons */
.jenjang-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.jenjang-tile {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: 0.15s ease;
}

.jenjang-tile:hover,
.jenjang-tile.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

.jenjang-tile i {
  font-size: 1.1rem;
}

.jenjang-tile span {
  font-size: 10px;
  font-weight: 700;
}

/* Stats card */
.stats-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.stat-block .num {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  margin-top: 4px;
}

.stat-block .spark {
  margin-top: 8px;
  height: 28px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.stat-block .spark i {
  flex: 1;
  border-radius: 999px;
  background: rgba(var(--primary-rgb), 0.45);
  display: block;
  min-width: 4px;
}

.stat-block .spark.spark-caps i {
  border-radius: 999px;
}

.stat-block .spark.line {
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.12), transparent);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.stat-block .spark.line::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  top: 35%;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  opacity: 0.55;
}

.perf-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #334155;
}

.perf-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(30, 41, 59, 0.08);
}

.perf-bar-soft {
  height: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.perf-bar span {
  display: block;
  height: 100%;
}

.perf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
}

.perf-legend em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

.perf-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* ===== Right map tools (Arafura-inspired) ===== */
.map-tools-right {
  position: absolute;
  right: var(--hud-pad);
  top: 90px;
  bottom: auto;
  z-index: 620;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.map-tools-right .tool-btn {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  font-size: 1.05rem;
}

.tool-btn {
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  max-width: 44px;
  max-height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: #004c80;
  font-size: 1.2rem;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.tool-btn:hover {
  border-color: rgba(6, 182, 212, 0.55);
  color: var(--primary);
}

.tool-btn.active {
  border-color: var(--primary);
  color: var(--primary);
}

.tool-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--tooltip-bg);
  backdrop-filter: var(--tooltip-blur);
  -webkit-backdrop-filter: var(--tooltip-blur);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.22);
}

.tool-btn[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.tool-btn.is-locating {
  border-color: #06b6d4;
  color: #0891b2;
  animation: locate-pulse 1s ease-in-out infinite;
}

.tool-btn.is-locate-ok {
  border-color: #10b981;
  color: #059669;
}

.tool-btn.is-locate-err {
  border-color: #ef4444;
  color: #dc2626;
}

@keyframes locate-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(6, 182, 212, 0);
  }
}

.basemap-switcher {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: relative;
}

.basemap-options {
  position: absolute;
  right: 46px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.basemap-options.is-open {
  pointer-events: auto;
}

.basemap-trigger {
  padding: 0 !important;
  display: grid !important;
  place-items: center;
  overflow: visible;
  z-index: 6;
}

.basemap-switcher.expanded .basemap-trigger[data-tooltip]:hover::after,
.basemap-switcher.expanded .basemap-trigger[data-tooltip]::after {
  opacity: 0;
  visibility: hidden;
}

.basemap-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0;
  border: 0;
  flex-shrink: 0;
}

.map-tools-right .basemap-thumb {
  width: 30px;
  height: 30px;
}

.basemap-options[hidden] {
  display: none !important;
}

.basemap-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 118px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  cursor: pointer;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  transform: translateX(12px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
  will-change: opacity, transform;
}

.basemap-pill.visible {
  opacity: 1;
  transform: translateX(0);
}

.basemap-pill:hover {
  border-color: rgba(6, 182, 212, 0.45);
}

.basemap-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.basemap-pill .basemap-thumb {
  width: 30px;
  height: 30px;
}

.basemap-switcher.expanded .basemap-trigger {
  border-color: var(--primary);
}

.layer-switchers {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.layer-switcher {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  width: fit-content;
  z-index: 25;
}

.layer-options {
  position: absolute;
  left: 52px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
}

.layer-options.is-open {
  pointer-events: auto;
}

.layer-options[hidden] {
  display: none !important;
}

.layer-pill {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  min-height: 44px;
  min-width: fit-content;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  cursor: pointer;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  opacity: 0;
  transform: translateX(-12px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
  will-change: opacity, transform;
}

.layer-pill i {
  font-size: 1rem;
  line-height: 1;
}

.layer-pill.visible {
  opacity: 1;
  transform: translateX(0);
}

.layer-pill:hover {
  border-color: rgba(var(--primary-rgb), 0.45);
  color: var(--primary);
}

.layer-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.layer-switcher.expanded .layer-trigger {
  border-color: var(--primary);
  color: var(--primary);
}

/* Pill like other hud-float-left fields */
.tool-btn.layer-trigger {
  aspect-ratio: auto;
  border-radius: 999px;
}

/* Tooltip for left-side layer button: show to the right */
.layer-trigger[data-tooltip]::after {
  right: auto;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(-4px);
}

.layer-trigger[data-tooltip]:hover::after {
  transform: translateY(-50%) translateX(0);
}

.map-tone-switcher {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: relative;
  z-index: 8;
}

.map-tone-panel {
  position: fixed;
  right: calc(var(--hud-pad) + 46px);
  top: 90px;
  bottom: auto;
  transform: none;
  width: min(280px, calc(100vw - 90px));
  max-height: calc(100dvh - 90px - var(--hud-pad) - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  z-index: 640;
  color: var(--text);
}

.map-tone-panel[hidden] {
  display: none !important;
}

.map-tone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.map-tone-head strong {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.map-tone-reset {
  border: 0;
  background: rgba(var(--primary-rgb), 0.08);
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

.map-tone-reset:hover {
  background: rgba(var(--primary-rgb), 0.14);
}

.map-tone-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tone-row {
  display: grid;
  grid-template-columns: 72px 1fr 42px;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: default;
}

.map-tone-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.map-tone-val {
  font-size: 11px;
  text-align: right;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.map-tone-row input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  height: 4px;
  cursor: pointer;
}

.map-tone-color-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(30, 41, 59, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tone-color-row input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  padding: 3px;
  border: 1px solid rgba(30, 41, 59, 0.14);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
}

.map-tone-color-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
}

.map-tone-color-row input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}

.map-tone-color-row input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 5px;
}

.map-tone-css {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.08);
}

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

.map-tone-css-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.map-tone-css-label .muted {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  opacity: 0.85;
}

.map-tone-css-value {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(var(--primary-rgb), 0.06);
  border: 1px solid rgba(var(--primary-rgb), 0.08);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.45;
  color: var(--primary);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 72px;
  overflow: auto;
}

.map-tone-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.map-tone-copy:hover {
  background: rgba(var(--primary-rgb), 0.16);
}

.map-tone-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.map-tone-save:hover {
  background: var(--primary-hover);
}

.map-tone-save:disabled {
  opacity: 0.55;
  cursor: wait;
}

.map-tone-save.is-ok {
  background: #059669;
}

.map-tone-save.is-err {
  background: #dc2626;
}

.map-tone-switcher.expanded .tool-btn {
  border-color: var(--primary);
}

@media (max-width: 1100px) {
  .map-tools-right {
    top: 90px;
  }

  .map-tone-panel {
    top: 90px;
    max-height: calc(100dvh - 90px - var(--hud-pad) - 24px);
  }
}
.nearby-sheet {
  position: absolute;
  top: 88px;
  right: var(--hud-pad);
  z-index: 650;
  width: min(360px, calc(100vw - 40px));
}

.nearby-sheet-inner {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  padding: 14px;
  max-height: calc(100vh - var(--bottom-h) - 120px);
  overflow: auto;
}

.nearby-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.nearby-filters button {
  border: 0;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 10px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--muted);
  cursor: pointer;
}

.nearby-filters button.active {
  background: var(--primary);
  color: #fff;
}

.nearby-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin-top: 8px;
}

.nearby-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding-bottom: 6px;
}

.nearby-table td {
  padding: 8px 0;
  border-top: 1px solid rgba(var(--primary-rgb), 0.06);
  vertical-align: middle;
}

.nearby-table tr.active {
  background: rgba(6, 182, 212, 0.08);
}

.jenjang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* AI Drawer */
.ai-backdrop {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(var(--primary-rgb), 0.14);
  backdrop-filter: blur(2px);
}

.ai-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 810;
  width: min(100%, 420px);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(30, 41, 59, 0.12);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.ai-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.08);
}

.ai-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  display: grid;
  place-items: center;
}

.ai-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-msg {
  max-width: 90%;
  border-radius: 16px;
  padding: 0.55rem 0.75rem;
  font-size: 12px;
  line-height: 1.45;
}

.ai-msg.user {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
}

.ai-msg.bot {
  background: #fff;
  border: 1px solid rgba(30, 41, 59, 0.1);
  color: #334155;
}

.ai-foot {
  border-top: 1px solid rgba(30, 41, 59, 0.08);
  padding: 0.75rem;
}

.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.ai-chips button {
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.ai-input-row {
  display: flex;
  gap: 0.5rem;
}

.ai-input-row input {
  flex: 1;
  border: 1px solid rgba(30, 41, 59, 0.12);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}

.btn-send {
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  width: 42px;
  cursor: pointer;
}

/* Dock-scroll: extension 150% bottom + clearance atas 70px */
body[data-hud-ext-mode="dock-scroll"] {
  --hud-ext-top-clearance: 70px;
  --hud-ext-h-scale: 1.5;
  --hud-ext-h-base: calc(var(--bottom-h) * var(--hud-ext-h-scale));
}

@media (max-width: 1100px) {
  :root {
    --bottom-h: min(340px, 46vh);
    --hud-ext-h-base: min(340px, 46vh);
  }

  body[data-hud-ext-mode="dock-scroll"] {
    --hud-ext-h-base: calc(var(--bottom-h) * var(--hud-ext-h-scale));
  }

  .hud-bottom {
    grid-template-columns: 1fr 1fr;
  }

  .card-hero .hero-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hud-top {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .top-pill {
    grid-column: 1 / -1;
    justify-self: center;
    order: 3;
  }

  .hud-bottom {
    grid-template-columns: 1fr;
  }

  .hud-float-left {
    max-width: calc(100vw - 40px);
  }

  .region-filters {
    flex-wrap: wrap;
    width: 100%;
    max-width: calc(100vw - 40px);
  }

  .region-select {
    width: var(--region-select-child-width);
    flex: 0 0 var(--region-select-child-width);
    max-width: calc(50% - 4px);
  }
}
