:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --blue: #3b82f6;
  --navy: #0b192c;
  --sidebar-bg: linear-gradient(185deg, #0d1f38, #050e1b);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --header-bg: rgba(255, 255, 255, 0.85);
}

html[data-spectra-theme="dark"] {
  color-scheme: dark;
  --bg: #070e17;
  --surface: #0b1522;
  --surface-2: #0f1e31;
  --surface-3: #162a43;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: #1e2f47;
  --primary: #22d3ee;
  --primary-hover: #06b6d4;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --purple: #a78bfa;
  --blue: #60a5fa;
  --sidebar-bg: linear-gradient(185deg, #040910, #010408);
  --shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 25px 45px -15px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(11, 21, 34, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  overflow-x: hidden;
}

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

/* App Core Layout */
.spectra-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Sidebar Navy Premium */
.spectra-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  border-radius: 10px;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.brand-mark span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px #fff;
}

.brand-mark i {
  position: absolute;
  width: 22px;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  transform: rotate(-45deg);
}

.sidebar-brand strong {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand span {
  display: block;
  font-size: 10px;
  color: var(--primary);
  font-weight: 650;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
  transition: all 0.2s ease;
}

.side-nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}

.side-nav-link.is-active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.15), rgba(6, 182, 212, 0.02));
  box-shadow: inset 4px 0 var(--primary);
}

.side-icon {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  color: var(--primary);
}

.sidebar-bottom {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.freshness-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 10px;
  font-size: 10px;
  color: #64748b;
  margin-bottom: 12px;
}

.freshness-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-weight: 700;
  margin-bottom: 6px;
}

.live-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.freshness-card div {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.freshness-card b {
  color: #94a3b8;
}

.theme-toggle {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.theme-toggle-track {
  width: 32px;
  height: 16px;
  background: #334155;
  border-radius: 99px;
  position: relative;
}

.theme-toggle-track::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #f59e0b;
  border-radius: 50%;
  transition: all 0.2s;
}

html[data-spectra-theme="dark"] .theme-toggle-track {
  background: var(--primary);
}

html[data-spectra-theme="dark"] .theme-toggle-track::before {
  transform: translateX(16px);
  background: #fff;
}

.sidebar-footer {
  text-align: center;
  font-size: 9px;
  color: #475569;
  margin-top: 10px;
}

/* Main Canvas */
.spectra-main {
  min-width: 0;
  padding: 24px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Topbar Putih Bersih */
.command-bar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  min-height: 64px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-button {
  display: none;
}

.command-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0 14px;
  height: 40px;
  border-radius: 10px;
}

.command-search svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2.2;
}

.command-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--text);
}

.command-button {
  height: 40px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.command-button:hover {
  border-color: var(--primary);
}

.period-card {
  padding-left: 16px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.period-card span {
  font-size: 8px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

.period-card strong {
  font-size: 11px;
  color: var(--text);
  font-weight: 700;
}

.notification-button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
}

.notification-button span {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 6px;
  height: 6px;
  background: var(--danger);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--danger);
}

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

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.user-profile div:last-child {
  display: flex;
  flex-direction: column;
}

.user-profile strong {
  font-size: 12px;
  color: var(--text);
  font-weight: 700;
}

.user-profile span {
  font-size: 9px;
  color: var(--muted);
}

/* Protected Banner */
.protected-banner {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid var(--danger);
  border-radius: 10px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

/* KPI Horizontal Grid */
.kpi-section {
  width: 100%;
}

.kpi-container-inner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--muted);
}

.kpi-card.tone-green { border-left-color: var(--success); }
.kpi-card.tone-orange { border-left-color: var(--warning); }
.kpi-card.tone-blue { border-left-color: var(--blue); }
.kpi-card.tone-purple { border-left-color: var(--purple); }
.kpi-card.tone-red { border-left-color: var(--danger); }
.kpi-card.tone-navy { border-left-color: var(--primary); }

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.section-kicker {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.kpi-icon {
  font-size: 10px;
  font-weight: 850;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.kpi-percent {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.sparkline {
  display: none;
}

.kpi-card p {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

/* Map Workspace Section */
.map-workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-heading h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

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

.map-live {
  font-size: 10px;
  font-weight: 750;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-live i {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

.map-state-indicator {
  font-size: 10px;
  background: var(--surface-3);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
}

.map-shell {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#spectraMap {
  height: 560px;
  width: 100%;
  z-index: 1;
}

.map-legend-panel, .layer-panel {
  position: absolute;
  z-index: 10;
  background: rgba(var(--surface-rgb, 255, 255, 255), 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  border-radius: 10px;
  color: var(--text);
  font-size: 11px;
}

html[data-spectra-theme="dark"] .map-legend-panel,
html[data-spectra-theme="dark"] .layer-panel {
  background: rgba(11, 21, 34, 0.75);
}

.map-legend-panel {
  top: 16px;
  left: 16px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-legend-panel h3, .layer-panel h3 {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

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

.tone-green-bg { background-color: var(--success); }
.tone-orange-bg { background-color: var(--warning); }
.tone-blue-bg { background-color: var(--blue); }
.tone-red-bg { background-color: var(--danger); }
.tone-purple-bg { background-color: var(--purple); }

.legend-shapes-info {
  font-size: 8px;
  color: var(--muted);
  margin-top: 4px;
  border-top: 1px dashed var(--border);
  padding-top: 4px;
}

.layer-panel {
  bottom: 16px;
  left: 16px;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-panel label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 2px 0;
}

.layer-panel input {
  margin-right: 8px;
}

.layer-panel span {
  flex: 1;
}

.shape-circle, .shape-diamond {
  width: 10px;
  height: 10px;
  display: inline-block;
}

.shape-circle {
  border-radius: 50%;
  background: var(--primary);
}

.shape-diamond {
  transform: rotate(45deg);
  background: var(--purple);
}

.is-muted {
  opacity: 0.5;
  cursor: not-allowed;
}

.is-muted small {
  font-size: 8px;
  background: var(--surface-3);
  padding: 1px 3px;
  border-radius: 3px;
}

.map-feedback {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 10px;
  color: var(--muted);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

/* Matching Control Card */
.matching-control {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 24px;
}

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

.radius-badge {
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.radius-track {
  margin: 6px 0;
  display: flex;
  align-items: center;
}

.radius-track input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
}

#radiusHelper {
  font-size: 11px;
  color: var(--muted);
}

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

.preset-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.preset-group button {
  padding: 6px 4px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  font-size: 10px;
  transition: all 0.2s;
}

.preset-group button strong {
  display: block;
}

.preset-group button small {
  display: block;
  color: var(--muted);
  font-size: 8px;
}

.preset-group button.is-active {
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--primary);
}

.parameter-row {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.parameter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.parameter-chips span {
  font-size: 9px;
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
  font-weight: 600;
}

.auto-update {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.auto-update span small {
  display: block;
  font-size: 8px;
  color: var(--muted);
}

.auto-update span strong {
  display: block;
  font-size: 10px;
}

/* Switch styling */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch i {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .4s;
  border-radius: 34px;
}

.switch i::before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.switch input:checked + i {
  background-color: var(--primary);
}

.switch input:checked + i::before {
  transform: translateX(16px);
}

/* Analytics & Bottom Cards */
.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 16px;
}

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.insight-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.insight-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.insight-card h3 {
  font-size: 13px;
  font-weight: 800;
}

.premium-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Regional insight bars */
.region-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.region-bars > div {
  display: grid;
  grid-template-columns: 80px 1fr 30px;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}

.region-bars span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.region-bars i {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  display: block;
  overflow: hidden;
}

.region-bars b {
  height: 100%;
  background: var(--primary);
  display: block;
  border-radius: 4px;
}

.region-bars strong {
  text-align: right;
}

/* Trend ratio progress */
.insight-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.insight-metric strong {
  font-size: 28px;
  color: var(--primary);
  font-weight: 800;
}

.insight-metric span {
  font-size: 10px;
  color: var(--muted);
}

.mini-progress {
  height: 8px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.mini-progress i {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--success));
  display: block;
  border-radius: 99px;
}

/* Verification list queue */
.priority-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.priority-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.priority-item:hover {
  background: var(--surface-3);
}

.priority-item span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.priority-item strong {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.priority-item small {
  font-size: 8px;
  color: var(--muted);
}

/* Results Table Card */
.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.match-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
}

.match-table th {
  background: var(--surface-2);
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.match-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.match-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.match-table tbody tr:hover {
  background: var(--surface-2);
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-badge.status-sinkron_match { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-badge.status-koordinat_bergeser { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-badge.status-hanya_pmt_fo { background: rgba(59, 130, 246, 0.1); color: var(--blue); }
.status-badge.status-hanya_pmt_non_mw { background: rgba(59, 130, 246, 0.1); color: var(--blue); }
.status-badge.status-hanya_pmt_mw_potensi_tidak_berizin { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.status-badge.status-hanya_pmt_unknown { background: rgba(100, 116, 139, 0.1); color: var(--muted); }
.status-badge.status-hanya_isr { background: rgba(139, 92, 246, 0.1); color: var(--purple); }
.status-badge.status-perlu_verifikasi { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.explanation-cell {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

.ghost-action {
  background: transparent;
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.ghost-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.primary-action {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.primary-action:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pagination-bar span {
  font-size: 11px;
  color: var(--muted);
}

.pagination-bar div {
  display: flex;
  gap: 8px;
}

/* Inspection Right Drawer Panel */
.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  height: 100vh;
  z-index: 2000;
  pointer-events: none;
  visibility: hidden;
  display: flex;
  justify-content: flex-end;
}

.detail-drawer.is-open {
  pointer-events: auto;
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.3s;
}

.detail-drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-panel {
  position: relative;
  z-index: 10;
  width: 340px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.detail-drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.detail-panel-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-panel-header h2 {
  font-size: 15px;
  font-weight: 800;
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  cursor: pointer;
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 4px;
}

.detail-tabs button {
  background: transparent;
  border: 0;
  font-size: 9px;
  font-weight: 700;
  padding: 8px 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
}

.detail-tabs button.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Detail panel content styling */
.detail-empty-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 12px;
  color: var(--muted);
}

.target-rings {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px dashed var(--border);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  position: relative;
}

.target-rings span {
  font-size: 20px;
  font-weight: 300;
}

.detail-empty-visual h3 {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

.detail-empty-visual p {
  font-size: 10px;
}

/* Priority Queue Section */
.priority-preview {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.priority-heading {
  margin-bottom: 12px;
}

.priority-heading h3 {
  font-size: 12px;
  font-weight: 800;
}

/* Admin / Upload Card Panel */
.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.state-pill {
  font-size: 9px;
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  color: var(--muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upload-card {
  border: 1px dashed var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-card:hover {
  border-color: var(--primary);
  background: var(--surface-3);
}

.upload-label {
  font-size: 8px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.upload-card strong {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
}

.upload-help {
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 10px;
}

.upload-card input[type="file"] {
  display: none;
}

.file-name {
  font-size: 10px;
  color: var(--primary);
  font-weight: 700;
  word-break: break-all;
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-message {
  font-size: 11px;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}

.admin-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.table-title h3 {
  font-size: 12px;
  font-weight: 800;
}

.table-title p {
  font-size: 9px;
  color: var(--muted);
}

.import-summary-grid, .reconcile-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.empty-summary {
  grid-column: 1 / -1;
  font-size: 10px;
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

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

.dataset-table-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--surface-2);
}

.dataset-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.dataset-table th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.dataset-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.mini-badge {
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary);
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 6px;
}

/* Rule Insight Card */
.rule-insight {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.rule-insight h2 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

#insightText {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

/* Floating AI Assistant Widget (Kanan Bawah) */
.ai-assistant-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 3px solid var(--primary);
}

.ai-header {
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
}

.ai-header h4 {
  font-size: 11px;
  font-weight: 700;
}

.ai-header small {
  font-size: 8px;
  color: var(--success);
}

.ai-body {
  padding: 12px;
  font-size: 10px;
  color: var(--text);
  line-height: 1.5;
  background: var(--surface);
}

.ai-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--surface-2);
}

.ai-footer input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 9px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
}

.ai-footer button {
  background: var(--primary);
  color: #fff;
  border: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 9px;
}

.toast-region {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 11px;
  font-weight: 600;
  animation: slideUp 0.3s;
}

.toast.is-error {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.05);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Detail panel inner data display */
.map-popup {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--text);
}

.map-popup strong {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

.map-popup dl {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-popup dl div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 2px;
}

.map-popup dt {
  font-weight: bold;
  color: var(--muted);
  margin-right: 12px;
}

.map-popup dd {
  font-weight: bold;
}

.map-popup button {
  margin-top: 8px;
  width: 100%;
  padding: 4px;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

/* Tab contents and detail lists */
.detail-grid {
  display: grid;
  gap: 8px;
  font-size: 11px;
}

.detail-grid-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

.detail-grid-row label {
  color: var(--muted);
}

.detail-grid-row span {
  font-weight: 700;
}

.comparison-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

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

.comparison-card h4 {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

.detail-actions-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.detail-actions-btn-group button, .detail-actions-btn-group a {
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
}

.detail-actions-btn-group button:hover, .detail-actions-btn-group a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 1440px) {
  .spectra-app {
    grid-template-columns: 200px 1fr;
  }
  .spectra-sidebar {
    width: 200px;
  }
  .kpi-container-inner {
    grid-template-columns: repeat(3, 1fr);
  }
  .matching-control {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .insight-grid {
    grid-template-columns: 1fr;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .spectra-app {
    grid-template-columns: 1fr;
  }
  .spectra-sidebar {
    display: none;
  }
  .mobile-menu-button {
    display: block;
  }
}


/* === SPECTRA MAP RESILIENCE FIX - 2026-07-12 === */
.map-shell {
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 45%, #ccfbf1 100%) !important;
}

#spectraMap {
  position: relative !important;
  min-height: 560px !important;
  height: 560px !important;
  width: 100% !important;
  z-index: 1 !important;
  background:
    radial-gradient(circle at 38% 42%, rgba(16,185,129,.25), transparent 13%),
    radial-gradient(circle at 64% 36%, rgba(59,130,246,.25), transparent 18%),
    linear-gradient(135deg, #bfe7ff 0%, #e0f2fe 46%, #a7f3d0 100%) !important;
}

#spectraMap.map-fallback-active::after {
  content: "Basemap belum berhasil dimuat. Cek koneksi CDN/tile, namun area peta sudah siap.";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 900;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 48px));
  padding: 16px 18px;
  border-radius: 18px;
  color: #0f172a;
  text-align: center;
  font-weight: 800;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(148,163,184,.45);
  box-shadow: 0 20px 45px rgba(15,23,42,.18);
  backdrop-filter: blur(14px);
}

.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  min-height: 560px !important;
  background: #dbeafe !important;
  font-family: inherit !important;
  outline: none !important;
}

.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-marker-pane,
.leaflet-shadow-pane {
  pointer-events: auto;
}

.leaflet-tile-pane {
  opacity: 1 !important;
  visibility: visible !important;
}

.leaflet-tile {
  opacity: 1 !important;
  visibility: visible !important;
  filter: saturate(1.06) contrast(1.02);
}

.leaflet-control-container {
  position: relative;
  z-index: 12;
}

.leaflet-control-zoom,
.leaflet-control-scale {
  border: 0 !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 14px 30px rgba(15,23,42,.18) !important;
}

.leaflet-control-zoom a {
  border: 0 !important;
  color: #0f172a !important;
  background: rgba(255,255,255,.92) !important;
}

.map-legend-panel,
.layer-panel,
.map-feedback {
  z-index: 650 !important;
}

html[data-spectra-theme="dark"] #spectraMap {
  background: #07111f !important;
}

html[data-spectra-theme="dark"] .leaflet-container {
  background: #07111f !important;
}

.spectra-map,
.leaflet-container {
  background: #dbeafe !important;
}

.leaflet-tile {
  filter: none !important;
  opacity: 1 !important;
  mix-blend-mode: normal !important;
}

/* ── Dataset Empty Notice ─────────────────────────────────── */
.dataset-empty-notice {
  margin: 0 0 16px;
  animation: fadeInUp 0.35s ease both;
}

.dataset-empty-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel-bg, rgba(255,255,255,0.06));
  border: 1px solid rgba(99, 179, 237, 0.2);
  border-left: 3px solid #60a5fa;
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--muted, #64748b);
  font-size: 13px;
}

html[data-spectra-theme="light"] .dataset-empty-inner {
  background: #f0f7ff;
  border-color: rgba(59,130,246,0.25);
  border-left-color: #3b82f6;
  color: #475569;
}

.dataset-empty-inner svg {
  flex-shrink: 0;
  color: #60a5fa;
}

.dataset-empty-inner div {
  flex: 1;
  min-width: 0;
}

.dataset-empty-inner strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 2px;
}

html[data-spectra-theme="light"] .dataset-empty-inner strong {
  color: #1e293b;
}

.dataset-empty-inner span {
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

.notice-action-btn {
  flex-shrink: 0;
  background: #60a5fa;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s;
}
.notice-action-btn:hover { background: #3b82f6; }

/* ── Sidebar Freshness fix: prevent text overflow/stacking ── */
.freshness-card div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-top: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.freshness-card span {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.freshness-card b {
  font-size: 10px;
  color: #94a3b8;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

/* ── Protected banner: ensure hidden by default ──────────── */
.protected-banner { display: none !important; }

/* ── KPI zero-state sublabel ─────────────────────────────── */
.kpi-card p.kpi-no-data {
  font-size: 10px;
  color: var(--muted, #64748b);
  margin-top: 4px;
}
