@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   DESIGN TOKENS & CSS VARIABLES
   ========================================================================== */
:root {
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Monaco, Consolas, monospace;

  /* Level Colors */
  --color-prov: #6366f1;
  --color-prov-bg: rgba(99, 102, 241, 0.12);
  --color-prov-border: rgba(99, 102, 241, 0.25);

  --color-reg: #0284c7;
  --color-reg-bg: rgba(2, 132, 199, 0.12);
  --color-reg-border: rgba(2, 132, 199, 0.25);

  --color-dist: #0d9488;
  --color-dist-bg: rgba(13, 148, 136, 0.12);
  --color-dist-border: rgba(13, 148, 136, 0.25);

  --color-vil: #d97706;
  --color-vil-bg: rgba(217, 119, 6, 0.12);
  --color-vil-border: rgba(217, 119, 6, 0.25);

  /* Status Colors */
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning: #f59e0b;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── DARK THEME (Default) ── */
[data-theme="dark"],
:root:not([data-theme="light"]) {
  --bg-app: #090d16;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
                 radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.06) 0px, transparent 50%),
                 radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.4) 0px, transparent 80%);

  --surface-1: #0f172a;
  --surface-2: #1e293b;
  --surface-3: #2d3b55;
  --surface-glass: rgba(15, 23, 42, 0.75);
  --surface-card: rgba(30, 41, 59, 0.6);
  --surface-hover: rgba(255, 255, 255, 0.05);
  --surface-active: rgba(255, 255, 255, 0.08);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-dim: #475569;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(255, 255, 255, 0.2);

  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fbbf24;
  --accent-bg: rgba(245, 158, 11, 0.12);
  --accent-glow: rgba(245, 158, 11, 0.25);
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --brand-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);

  --sidebar-bg: #0b1120;
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.15);

  --code-bg: #060911;
  --code-text: #e2e8f0;
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-gradient: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.06) 0px, transparent 50%),
                 radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.04) 0px, transparent 50%);

  --surface-1: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --surface-glass: rgba(255, 255, 255, 0.85);
  --surface-card: rgba(255, 255, 255, 0.9);
  --surface-hover: rgba(0, 0, 0, 0.03);
  --surface-active: rgba(0, 0, 0, 0.06);

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-medium: rgba(0, 0, 0, 0.12);
  --border-highlight: rgba(0, 0, 0, 0.18);

  --accent: #d97706;
  --accent-dark: #b45309;
  --accent-light: #f59e0b;
  --accent-bg: rgba(217, 119, 6, 0.08);
  --accent-glow: rgba(217, 119, 6, 0.16);
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);

  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(0, 0, 0, 0.06);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.08);

  --code-bg: #0f172a;
  --code-text: #f8fafc;
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg-app);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
  user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

/* Focus styles */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   APP SHELL LAYOUT
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: 100vh;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  transition: grid-template-columns var(--transition-normal);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1100;
  transition: transform var(--transition-normal), width var(--transition-normal);
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}

.sidebar-header {
  padding: 4px 4px 8px;
}

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

.brand-mark-wrap {
  position: relative;
  flex-shrink: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: transform var(--transition-normal);
}

.brand:hover .brand-mark {
  transform: scale(1.05) rotate(-3deg);
}

.brand-glow {
  position: absolute;
  inset: -2px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  filter: blur(8px);
  opacity: 0.4;
  z-index: -1;
  transition: opacity var(--transition-normal);
}

.brand:hover .brand-glow {
  opacity: 0.7;
}

.brand-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Status Card */
.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  position: relative;
  transition: background var(--transition-normal);
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 10px var(--success-glow);
}

.status-dot.fail {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger-glow);
}

.status-pulse-ring {
  position: absolute;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--success);
  opacity: 0.6;
  animation: pulsePing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes pulsePing {
  75%, 100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.status-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.icon-button-subtle {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.icon-button-subtle:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Field Config */
.field-config {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.field-with-action {
  display: flex;
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 6px 4px 10px;
}

.field-with-action input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
}

/* Sidebar Navigation */
.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  padding: 6px 6px 2px;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-fast);
  position: relative;
  text-align: left;
}

.nav-tab:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--accent-bg);
  color: var(--accent-light);
  font-weight: 700;
}

.nav-tab-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-tab.active .nav-tab-icon {
  color: var(--accent);
}

/* Sidebar Links */
.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.doc-icon {
  color: var(--color-prov);
}

.external-arrow {
  margin-left: auto;
  color: var(--text-dim);
  transition: transform var(--transition-fast);
}

.nav-link:hover .external-arrow {
  transform: translate(2px, -2px);
  color: var(--text-muted);
}

.sidebar-spacer {
  flex: 1;
}

/* Sidebar Footer & Theme Toggle */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.theme-toggle-btn,
.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition-fast);
  width: 100%;
}

.theme-toggle-btn[hidden] {
  display: none !important;
}

.theme-toggle-btn:hover,
.sidebar-collapse:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.theme-icon-wrap {
  position: relative;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.sun-icon {
  display: none;
  color: var(--accent);
}

.moon-icon {
  display: block;
  color: var(--color-prov);
}

[data-theme="light"] .sun-icon {
  display: block;
}
[data-theme="light"] .moon-icon {
  display: none;
}

/* Sidebar Collapsed State Adjustments */
.app-shell.sidebar-collapsed .brand-info,
.app-shell.sidebar-collapsed .status-text,
.app-shell.sidebar-collapsed .sidebar-section-label,
.app-shell.sidebar-collapsed .nav-tab span,
.app-shell.sidebar-collapsed .nav-link span,
.app-shell.sidebar-collapsed .external-arrow,
.app-shell.sidebar-collapsed .theme-label,
.app-shell.sidebar-collapsed .sidebar-collapse span {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 20px 10px;
  align-items: center;
}

.app-shell.sidebar-collapsed .nav-tab,
.app-shell.sidebar-collapsed .nav-link,
.app-shell.sidebar-collapsed .theme-toggle-btn,
.app-shell.sidebar-collapsed .sidebar-collapse {
  justify-content: center;
  padding: 12px;
}

.app-shell.sidebar-collapsed .status-card {
  padding: 8px;
  justify-content: center;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ── TOOLBAR ── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.hamburger:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.title-block h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: 1.2;
}

.title-block p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* Search input in toolbar */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 240px;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.quick-search {
  width: 100%;
  height: 38px;
  padding: 0 42px 0 34px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.quick-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
  width: 280px;
}

.shortcut-key {
  position: absolute;
  right: 10px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  pointer-events: none;
}

/* Toggle Pill */
.toggle-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.toggle-pill:hover {
  border-color: var(--border-medium);
}

.toggle-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-pill-track {
  width: 28px;
  height: 16px;
  background: var(--surface-3);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-normal);
}

.toggle-pill-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-radius: var(--radius-full);
  transition: transform var(--transition-normal);
}

.toggle-pill input:checked + .toggle-pill-track {
  background: var(--accent);
}

.toggle-pill input:checked + .toggle-pill-track::after {
  transform: translateX(12px);
}

.toggle-pill-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Action Buttons */
.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: var(--accent-gradient);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: all var(--transition-normal);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
  filter: brightness(1.05);
}

.primary-button:active {
  transform: translateY(0);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.secondary-button:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* ==========================================================================
   VIEWS CONTAINER & BROWSE VIEW
   ========================================================================== */
.view {
  padding: 24px 28px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.view[hidden] {
  display: none !important;
}

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
}

.breadcrumb:empty {
  display: none;
}

.breadcrumb-item button {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.breadcrumb-item button:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

.breadcrumb-item.current button {
  color: var(--accent-light);
  background: var(--accent-bg);
  border-color: var(--accent-border);
  font-weight: 700;
}

.breadcrumb-sep {
  color: var(--text-dim);
  font-size: 12px;
}

/* ==========================================================================
   GLOBAL SUMMARY & METRICS
   ========================================================================== */
.summary-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.summary-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.metric {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 4px 0 0 4px;
}

.metric-province::after { background: var(--color-prov); }
.metric-regency::after  { background: var(--color-reg); }
.metric-district::after { background: var(--color-dist); }
.metric-village::after  { background: var(--color-vil); }

.metric:hover {
  transform: translateY(-2px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.metric-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.metric-province .metric-icon-wrap {
  background: var(--color-prov-bg);
  color: var(--color-prov);
  border: 1px solid var(--color-prov-border);
}

.metric-regency .metric-icon-wrap {
  background: var(--color-reg-bg);
  color: var(--color-reg);
  border: 1px solid var(--color-reg-border);
}

.metric-district .metric-icon-wrap {
  background: var(--color-dist-bg);
  color: var(--color-dist);
  border: 1px solid var(--color-dist-border);
}

.metric-village .metric-icon-wrap {
  background: var(--color-vil-bg);
  color: var(--color-vil);
  border: 1px solid var(--color-vil-border);
}

.metric-body {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 2px 0;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   SELECTION SUMMARY BANNER
   ========================================================================== */
/* ==========================================================================
   SELECTION SUMMARY BANNER (CARD WILAYAH TERPILIH)
   ========================================================================== */
/* ==========================================================================
   COMPACT SELECTION SUMMARY BAR (WILAYAH TERPILIH)
   ========================================================================== */
.selection-summary {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: selectionSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all var(--transition-fast);
}

.selection-summary.is-hidden {
  display: none !important;
}

@keyframes selectionSlideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.selection-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--accent-gradient);
}

.selection-summary[data-level="province"] .selection-accent-bar {
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
}
.selection-summary[data-level="regency"] .selection-accent-bar {
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
}
.selection-summary[data-level="district"] .selection-accent-bar {
  background: linear-gradient(90deg, #0d9488 0%, #2dd4bf 100%);
}
.selection-summary[data-level="village"] .selection-accent-bar {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
}

.selection-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
}

/* Left side main info */
.selection-main-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.selection-level-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}

.selection-summary[data-level="province"] .selection-level-pill {
  background: var(--color-prov-bg);
  color: var(--color-prov);
  border-color: var(--color-prov-border);
}
.selection-summary[data-level="regency"] .selection-level-pill {
  background: var(--color-reg-bg);
  color: var(--color-reg);
  border-color: var(--color-reg-border);
}
.selection-summary[data-level="district"] .selection-level-pill {
  background: var(--color-dist-bg);
  color: var(--color-dist);
  border-color: var(--color-dist-border);
}
.selection-summary[data-level="village"] .selection-level-pill {
  background: var(--color-vil-bg);
  color: var(--color-vil);
  border-color: var(--color-vil-border);
}

.selection-level-icon {
  font-size: 12px;
}

.selection-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
}

.selection-tags-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.selection-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
}

.selection-tag .tag-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.selection-tag code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

.selection-tag-code code {
  color: var(--accent-light);
}

.selection-tag-postal {
  background: var(--color-dist-bg);
  border-color: var(--color-dist-border);
}

.selection-tag-postal code {
  color: var(--color-dist);
}

.selection-meta-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Center metrics inline */
.selection-metrics-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.selection-metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.selection-metric-chip:hover {
  border-color: var(--border-medium);
  background: var(--surface-3);
}

.metric-icon-mini {
  font-size: 12px;
  line-height: 1;
}

.metric-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-number {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
}

.selection-metric-regency .metric-number { color: var(--color-reg); }
.selection-metric-district .metric-number { color: var(--color-dist); }
.selection-metric-village .metric-number { color: var(--color-vil); }

.selection-empty-metrics {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px dashed var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Right Actions */
.selection-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.selection-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.selection-action-btn:hover {
  background: var(--accent-bg);
  color: var(--accent-light);
  border-color: var(--accent-border);
}

.selection-close-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.selection-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.selection-status-msg {
  font-size: 11px;
  color: var(--warning);
  padding: 0 14px 6px;
}

/* ==========================================================================
   CONTENT GRID: TREE VIEW + MAP PANEL
   ========================================================================== */
.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  gap: 20px;
  min-height: 580px;
}

.mobile-content-tabs {
  display: none;
}

.panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface-1);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title-wrap h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.row-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-3);
  color: var(--text-secondary);
}

.filter-input-wrap {
  flex: 1;
  max-width: 180px;
}

.table-filter {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.table-filter:focus {
  border-color: var(--accent);
  background: var(--surface-1);
}

/* ── TREE VIEW ── */
.tree-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  max-height: 600px;
}

.tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tree-node {
  display: flex;
  flex-direction: column;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  font-size: 13px;
}

.tree-row:hover {
  background: var(--surface-hover);
}

.tree-node.expanded > .tree-row {
  background: var(--surface-active);
}

.tree-chevron {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.tree-node.expanded > .tree-row .tree-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

.tree-node.leaf .tree-chevron {
  visibility: hidden;
}

.tree-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: copy;
  flex-shrink: 0;
}

.tree-code:hover {
  background: var(--accent-bg);
  color: var(--accent-light);
  border-color: var(--accent-border);
}

.tree-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.tree-inline-stats {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

.tree-postal-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-dist);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--color-dist-bg);
}

.tree-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.tree-badge-province { background: var(--color-prov-bg); color: var(--color-prov); }
.tree-badge-regency  { background: var(--color-reg-bg);  color: var(--color-reg); }
.tree-badge-district { background: var(--color-dist-bg); color: var(--color-dist); }
.tree-badge-village  { background: var(--color-vil-bg);  color: var(--color-vil); }

.tree-children {
  display: none;
  flex-direction: column;
  padding-left: 20px;
  border-left: 1px dashed var(--border-subtle);
  margin-left: 12px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.tree-node.expanded > .tree-children {
  display: flex;
}

.tree-loading,
.tree-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ==========================================================================
   INTERACTIVE MAP PANEL
   ========================================================================== */
.map-panel {
  display: flex;
  flex-direction: column;
}

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

.map-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.map-badge-live {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  color: var(--accent-light);
  border: 1px solid var(--accent-border);
}

.map-canvas {
  position: relative;
  flex: 1;
  min-height: 480px;
  background: var(--surface-1);
}

.location-map {
  width: 100%;
  height: 100%;
  min-height: 480px;
  z-index: 1;
}

.map-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  max-width: 320px;
  padding: 24px;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.map-empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.map-message strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.map-message p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Custom Leaflet Dark/Light Controls */
.leaflet-container {
  background: var(--surface-1) !important;
  font-family: var(--font-sans) !important;
}

.leaflet-bar {
  border: 1px solid var(--border-medium) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: var(--surface-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-subtle) !important;
  backdrop-filter: blur(8px);
}

.leaflet-bar a:hover {
  background-color: var(--surface-hover) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--surface-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-medium) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  backdrop-filter: blur(16px);
}

.leaflet-popup-tip {
  background: var(--surface-card) !important;
}

/* ==========================================================================
   SEARCH VIEW & DATA TABLE
   ========================================================================== */
.search-bar-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  color: var(--text-muted);
}

.search-input-group input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
}

.search-options {
  display: flex;
  align-items: center;
  gap: 14px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.field-inline input {
  width: 60px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  outline: none;
}

.search-panel {
  min-height: 400px;
}

.table-wrap {
  overflow-x: auto;
  max-height: 600px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead {
  position: sticky;
  top: 0;
  background: var(--surface-1);
  z-index: 10;
}

th {
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

td {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

tr.search-row:hover td {
  background: var(--surface-hover);
  cursor: pointer;
}

.code-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  cursor: copy;
}

.level-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.level-province { background: var(--color-prov-bg); color: var(--color-prov); }
.level-regency  { background: var(--color-reg-bg);  color: var(--color-reg); }
.level-district { background: var(--color-dist-bg); color: var(--color-dist); }
.level-village  { background: var(--color-vil-bg);  color: var(--color-vil); }

.postal-code-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-dist);
}

.action-cell {
  text-align: right;
}

.browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.browse-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Skeleton & Error table states */
.skeleton-cell {
  height: 14px;
  background: var(--surface-3);
  border-radius: var(--radius-xs);
  animation: skeletonPulse 1.5s infinite;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.empty-row td,
.error-row td {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ==========================================================================
   RESPONSE SIDEBAR (DEVELOPER TOOL)
   ========================================================================== */
.response-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(420px, calc(100vw - 280px));
  z-index: 900;
  pointer-events: none;
}

.response-drawer-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 48px;
  min-height: 160px;
  padding: 14px 0;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  border: 1px solid var(--border-medium);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.response-drawer.open .response-drawer-toggle {
  top: 0;
  transform: none;
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 18px;
  flex-direction: row;
  border-right: 1px solid var(--border-medium);
  border-bottom: none;
  border-radius: var(--radius-lg) 0 0 0;
  box-shadow: none;
}

.response-drawer-toggle {
  background: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.response-drawer-toggle svg {
  flex: 0 0 auto;
  transform: rotate(-90deg);
  transition: transform var(--transition-normal);
}

.response-drawer.open .response-drawer-toggle svg {
  transform: rotate(90deg);
}

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

.response-drawer:not(.open) .drawer-label {
  flex-direction: column;
  gap: 8px;
}

.response-drawer:not(.open) .response-drawer-toggle {
  justify-content: center;
}

.response-drawer:not(.open) .drawer-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  letter-spacing: 0.4px;
}

.response-drawer:not(.open) .drawer-status-pill {
  display: none;
}

.drawer-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--success);
}

.response-drawer.has-unread-response .drawer-dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulsePing 1.5s infinite;
}

.drawer-status-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.response-drawer-body {
  position: absolute;
  inset: 44px 0 0;
  background: var(--code-bg);
  border: 1px solid var(--border-medium);
  border-right: none;
  border-top: none;
  border-radius: 0 0 0 var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  visibility: hidden;
  transform: translateX(100%);
  pointer-events: none;
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-smooth), visibility 0s linear 0.35s;
}

.response-drawer.open .response-drawer-body {
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  transition: transform var(--transition-smooth);
}

.response-drawer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
}

.response-endpoint-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.http-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.http-badge.get {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.response-drawer-method {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.response-drawer-method:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

.response-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-text-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}

#responseOutput {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--code-text);
  max-height: none;
}

/* ==========================================================================
   TOAST NOTIFICATION & OVERLAYS
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-full);
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-smooth);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.sidebar-overlay {
  display: none;
}

/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE ADAPTATION
   ========================================================================== */
@media (max-width: 1080px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
  }

  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  .hamburger {
    display: grid;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px;
  }

  .toolbar-title {
    width: 100%;
    align-items: flex-start;
  }

  .title-block {
    min-width: 0;
    flex: 1;
  }

  .title-block h1 {
    font-size: 18px;
  }

  .title-block p {
    max-width: none;
  }

  .toolbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
  }

  .toggle-pill {
    min-width: 0;
    justify-content: center;
    padding-inline: 10px;
  }

  .toggle-pill-label {
    white-space: nowrap;
  }

  .primary-button,
  .secondary-button {
    justify-content: center;
    padding-inline: 12px;
  }

  .search-input-wrapper {
    display: none;
  }

  .view {
    padding: 16px 16px 80px;
  }

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

  .metric {
    gap: 10px;
    padding: 12px;
  }

  .metric-icon-wrap {
    width: 34px;
    height: 34px;
  }

  .metric-value {
    font-size: 20px;
  }

  .metric-sub {
    font-size: 10px;
    line-height: 1.3;
  }

  .mobile-content-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
  }

  .mobile-content-tab {
    min-height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
  }

  .mobile-content-tab.active {
    background: var(--surface-1);
    color: var(--accent-light);
    box-shadow: var(--shadow-sm);
  }

  .content-grid {
    display: block;
    min-height: 0;
  }

  .content-grid .panel {
    display: none;
    height: min(540px, calc(100dvh - 360px));
    min-height: 360px;
  }

  .content-grid:not(.mobile-show-map) .locations-panel,
  .content-grid.mobile-show-map .map-panel {
    display: flex;
  }

  .map-canvas,
  .location-map {
    min-height: 0;
  }

  .search-bar-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-input-group {
    width: 100%;
    min-width: 0;
  }

  .search-input-group input {
    min-width: 0;
    flex: 1;
  }

  .search-options {
    width: 100%;
    justify-content: flex-end;
  }

  .search-options .field-inline {
    margin-right: auto;
  }

  .search-options .primary-button {
    flex: 1;
  }

  .selection-compact-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
  }

  .selection-main-info {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .selection-level-pill {
    padding: 1px 6px;
    font-size: 9px;
    gap: 3px;
  }

  .selection-title {
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
  }

  .selection-tags-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .selection-tag {
    padding: 1px 5px;
    font-size: 10px;
    border-radius: 4px;
  }

  .selection-tag code {
    font-size: 10px;
  }

  .selection-meta-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    margin-left: 0;
    padding-top: 5px;
    border-top: 1px solid var(--border-subtle);
  }

  .selection-metrics-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
  }

  .selection-metrics-inline::-webkit-scrollbar {
    display: none;
  }

  .selection-metric-chip {
    padding: 2px 6px;
    font-size: 9.5px;
    white-space: nowrap;
    flex-shrink: 0;
    gap: 3px;
  }

  .metric-icon-mini {
    font-size: 10px;
  }

  .metric-title {
    font-size: 9px;
  }

  .metric-number {
    font-size: 10px;
  }

  .selection-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  .selection-action-btn {
    height: 22px;
    padding: 0 7px;
    font-size: 9.5px;
    gap: 3px;
  }

  .selection-action-btn svg {
    width: 10px;
    height: 10px;
  }

  .selection-close-btn {
    width: 22px;
    height: 22px;
  }

  .selection-close-btn svg {
    width: 11px;
    height: 11px;
  }

  .response-drawer {
    width: 100vw;
  }

  .response-drawer.open .response-drawer-toggle {
    border-radius: 0;
  }

  .response-drawer-body {
    border-radius: 0;
  }

  .response-drawer-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .response-drawer-actions {
    justify-content: flex-end;
  }
}
