/* ═══════════════════════════════════════════════════
   Андижон вилояти — Саноат зоналар тизими
   style.css — premium dark design
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --bg:      #0d1117;
  --bg2:     #161b22;
  --bg3:     #21262d;
  --bg4:     #2d333b;
  --border:  rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.12);
  --text:    #e6edf3;
  --text2:   #8b949e;
  --text3:   #484f58;
  --blue:    #3b82f6;
  --blue-d:  #1d4ed8;
  --blue-g:  rgba(59,130,246,0.12);
  --amber:   #f59e0b;
  --amber-g: rgba(245,158,11,0.12);
  --green:   #10b981;
  --green-g: rgba(16,185,129,0.12);
  --purple:  #8b5cf6;
  --purple-g:rgba(139,92,246,0.12);
  --red:     #ef4444;
  --sb-width: 390px;
  --radius:  10px;
  --radius-lg: 16px;
  --shadow:  0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.7);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input  { outline: none; border: none; background: none; font-family: inherit; color: inherit; }
svg    { display: block; flex-shrink: 0; }

/* ── Scrollbar ── */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--bg4); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover{ background: var(--text3); }

/* ══════════════════════════════════════════════════
   LOADER
══════════════════════════════════════════════════ */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader-inner {
  text-align: center;
  animation: scaleIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes scaleIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.loader-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; margin-bottom: 32px;
}
.loader-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--blue-d), var(--blue));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 24px rgba(59,130,246,0.4);
}
.loader-icon svg { width: 26px; height: 26px; stroke: #fff; }
.loader-brand {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, var(--blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}
.loader-bar-wrap {
  width: 240px; height: 4px;
  background: var(--bg4); border-radius: 99px;
  overflow: hidden; margin: 0 auto 16px;
}
.loader-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--blue-d), var(--blue), #60a5fa);
  border-radius: 99px;
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(59,130,246,0.6);
}
.loader-msg {
  color: var(--text2); font-size: 13px; letter-spacing: 0.01em;
}

/* ══════════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════════ */
#app {
  display: flex; width: 100%; height: 100vh; overflow: hidden;
}

/* ══════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════ */
#sidebar {
  width: var(--sb-width);
  min-width: var(--sb-width);
  height: 100%;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.32s cubic-bezier(0.4,0,0.2,1),
              opacity 0.32s ease;
  z-index: 10;
}
#sidebar.collapsed { margin-left: calc(-1 * var(--sb-width)); opacity: 0; }

/* ── Sidebar Head ── */
.sb-head {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 16px 0;
  flex-shrink: 0;
}
.sb-head-top {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  margin-bottom: 16px;
}
.sb-brand { display: flex; align-items: center; gap: 10px; }
.sb-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--blue-d), var(--blue));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px rgba(59,130,246,0.35);
  flex-shrink: 0;
}
.sb-brand-icon svg { width: 18px; height: 18px; stroke: #fff; }
.sb-brand-title { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sb-brand-sub   { font-size: 11px; font-weight: 400; color: var(--text2); margin-top: 1px; }

/* ── Language Switcher ── */
.lang-switcher {
  display: flex; gap: 3px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  flex-shrink: 0;
}
.lang-btn {
  padding: 4px 8px;
  font-size: 11px; font-weight: 600;
  border-radius: 6px;
  color: var(--text2);
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}
.lang-btn:hover { color: var(--text); background: var(--bg4); }
.lang-btn.active {
  background: var(--blue); color: #fff;
  box-shadow: 0 0 8px rgba(59,130,246,0.4);
}

/* ── KPI Grid ── */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding-bottom: 16px;
}
.kpi-card {
  border-radius: var(--radius);
  padding: 12px;
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0.06; pointer-events: none;
}
.kpi-blue  { background: var(--blue-g);   border-color: rgba(59,130,246,0.2); }
.kpi-green { background: var(--green-g);  border-color: rgba(16,185,129,0.2); }
.kpi-amber { background: var(--amber-g);  border-color: rgba(245,158,11,0.2); }
.kpi-purple{ background: var(--purple-g); border-color: rgba(139,92,246,0.2); }

.kpi-blue  .kpi-icon { color: var(--blue); }
.kpi-green .kpi-icon { color: var(--green); }
.kpi-amber .kpi-icon { color: var(--amber); }
.kpi-purple .kpi-icon{ color: var(--purple); }

.kpi-icon { margin-bottom: 6px; }
.kpi-icon svg { width: 16px; height: 16px; stroke: currentColor; }

.kpi-val {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.5px; line-height: 1;
  color: var(--text);
  margin-bottom: 3px;
}
.kpi-blue  .kpi-val { color: #60a5fa; }
.kpi-green .kpi-val { color: #34d399; }
.kpi-amber .kpi-val { color: #fcd34d; }
.kpi-purple .kpi-val{ color: #a78bfa; }

.kpi-label { font-size: 10px; color: var(--text2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Tab Bar ── */
.tab-bar {
  display: flex; align-items: center;
  padding: 0 8px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 2px;
}
.tab-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 11px 10px;
  font-size: 12px; font-weight: 600;
  color: var(--text2);
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: color 0.2s;
}
.tab-btn::after {
  content: ''; position: absolute; bottom: -1px;
  left: 0; right: 0; height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.2s;
}
.tab-btn.active { color: var(--text); }
.tab-btn[data-tab="ksz"].active::after    { background: var(--blue); }
.tab-btn[data-tab="yoshlar"].active::after{ background: var(--amber); }
.tab-btn[data-tab="all"].active::after    { background: var(--green); }
.tab-btn:hover { color: var(--text); }

.tab-dot {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
}
.tab-dot-blue  { background: var(--blue); box-shadow: 0 0 4px rgba(59,130,246,0.6); }
.tab-dot-amber { background: var(--amber); box-shadow: 0 0 4px rgba(245,158,11,0.6); }
.tab-dot-green { background: var(--green); box-shadow: 0 0 4px rgba(16,185,129,0.6); }

.tab-count {
  font-size: 10px; font-weight: 700;
  background: var(--bg4);
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 22px; text-align: center;
}

/* ── Search ── */
.sb-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.search-icon { color: var(--text2); flex-shrink: 0; }
.search-icon svg { width: 15px; height: 15px; }

.sb-search input {
  flex: 1;
  font-size: 13px; color: var(--text);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sb-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.sb-search input::placeholder { color: var(--text3); }

.search-clear {
  color: var(--text3); display: none;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.search-clear svg { width: 14px; height: 14px; }
.search-clear:hover { background: var(--bg4); color: var(--text); }
.search-clear.visible { display: flex; }

/* ── Sidebar Content ── */
.sb-content {
  flex: 1; overflow-y: auto;
  padding: 8px;
}

/* District group */
.dist-group { margin-bottom: 4px; border-radius: var(--radius); overflow: hidden; }

.dist-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  user-select: none;
}
.dist-header:hover { background: var(--bg4); border-color: var(--border2); }
.dist-header.open  { border-radius: var(--radius) var(--radius) 0 0; }
.dist-header.selected {
  background: var(--blue-g);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35);
}
.dist-header.selected .dist-name { color: #93c5fd; }

.dist-color-bar { width: 3px; height: 32px; border-radius: 2px; flex-shrink: 0; }
.dist-info { flex: 1; min-width: 0; }
.dist-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-meta { font-size: 10px; color: var(--text2); margin-top: 2px; }

.dist-badge {
  font-size: 10px; font-weight: 700;
  background: var(--bg4);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--text2);
  flex-shrink: 0;
}
.dist-header.selected .dist-badge { background: var(--blue); color: #fff; }
.dist-toggle {
  color: var(--text3);
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  transition: transform 0.25s ease, background 0.18s, color 0.18s;
  flex-shrink: 0;
}
.dist-toggle:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.dist-toggle svg { width: 14px; height: 14px; }
.dist-header.open .dist-toggle { transform: rotate(90deg); }

/* Zone list inside district */
.zone-list {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
}
.zone-list.open { max-height: 600px; }

.zone-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px 9px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-left-color 0.15s;
  border-left: 3px solid transparent;
  animation: fadeSlideIn 0.3s ease both;
}
.zone-item:last-child { border-bottom: none; }
.zone-item:hover { background: var(--bg3); border-left-color: var(--blue); }
.zone-item.yoshlar:hover { border-left-color: var(--amber); }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.zone-item:nth-child(1) { animation-delay: 0.03s; }
.zone-item:nth-child(2) { animation-delay: 0.06s; }
.zone-item:nth-child(3) { animation-delay: 0.09s; }
.zone-item:nth-child(4) { animation-delay: 0.12s; }
.zone-item:nth-child(5) { animation-delay: 0.15s; }

.zone-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.zone-info { flex: 1; min-width: 0; }
.zone-name { font-size: 11.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-sub  { font-size: 10px; color: var(--text2); margin-top: 1px; }
.zone-count{ font-size: 10px; color: var(--text3); font-weight: 600; }

.no-results {
  text-align: center; padding: 40px 20px;
  color: var(--text2);
}
.no-results svg { width: 40px; height: 40px; margin: 0 auto 12px; stroke: var(--text3); opacity: 0.5; }
.no-results p { font-size: 13px; }

/* ══════════════════════════════════════════════════
   MAP WRAP
══════════════════════════════════════════════════ */
#mapwrap { flex: 1; position: relative; overflow: hidden; }
#map { width: 100%; height: 100%; }

/* Dark tile filter */
.leaflet-tile-pane { filter: brightness(0.85) saturate(0.9); }

/* Map control cluster (top-left) */
.map-controls {
  position: absolute; top: 12px; left: 12px; z-index: 500;
  display: flex; align-items: center; gap: 8px;
}
.sb-toggle {
  width: 40px; height: 40px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  color: var(--text2);
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.sb-toggle:hover { background: var(--bg4); color: var(--text); }
.sb-toggle svg { width: 18px; height: 18px; }

.map-ctrl-btn {
  height: 40px;
  padding: 0 14px 0 12px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 7px;
  box-shadow: var(--shadow);
  color: var(--text2);
  font-size: 12px; font-weight: 600;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.map-ctrl-btn:hover { background: var(--bg4); color: var(--text); border-color: var(--blue); }
.map-ctrl-btn svg { width: 16px; height: 16px; }
.map-ctrl-label { white-space: nowrap; }
@media (max-width: 480px) { .map-ctrl-label { display: none; } .map-ctrl-btn { padding: 0 10px; } }

/* Legend */
.map-legend {
  position: absolute; bottom: 24px; right: 12px; z-index: 500;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  min-width: 140px;
}
.legend-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text2); margin-bottom: 8px;
}
.legend-items { display: flex; flex-direction: column; gap: 5px; }
.legend-row {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--text2);
}
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-sep { border-top: 1px solid var(--border); margin: 8px 0; }

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
  background: var(--bg2) !important;
  border: 1px solid var(--border2) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
}
.leaflet-popup-tip { background: var(--bg2) !important; }
.leaflet-popup-content { font-size: 12px !important; color: var(--text) !important; }
.leaflet-container { background: var(--bg) !important; }

/* Map tooltip */
.leaflet-tooltip.dark-tooltip {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 8px 11px;
}
.leaflet-tooltip.dark-tooltip::before { display: none; }
.map-tt { display: flex; flex-direction: column; gap: 2px; font-family: 'Inter', sans-serif; font-size: 12px; line-height: 1.45; }
.map-tt b { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.map-tt .tt-dist { color: var(--text2); font-size: 10.5px; font-weight: 500; margin-bottom: 3px; }
.map-tt .tt-ksz { color: #60a5fa; }
.map-tt .tt-ysh { color: #fcd34d; }
.map-tt .tt-hint { color: var(--text3); font-size: 10.5px; margin-top: 3px; padding-top: 4px; border-top: 1px solid var(--border); }

/* District name labels */
.dist-label-wrap { pointer-events: none; }
.dist-label {
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  background: rgba(13,17,23,0.72);
  border: 1px solid rgba(125,179,255,0.25);
  border-radius: 999px;
  white-space: nowrap;
  backdrop-filter: blur(2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.dist-label .dl-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}
.dist-label .dl-name {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 600; color: #e6edf3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  letter-spacing: 0.01em;
}
.dist-label .dl-count {
  font-size: 10px; font-weight: 700; color: #93c5fd;
  background: rgba(59,130,246,0.22);
  border-radius: 999px; padding: 0 6px; line-height: 16px;
}
.dist-label.selected {
  background: rgba(13,17,23,0.94);
  border-color: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 2px rgba(147,197,253,0.55), 0 2px 10px rgba(0,0,0,0.6);
}
.dist-label.selected .dl-name { color: #fff; }

.legend-note { font-size: 11px; color: var(--text2); line-height: 1.45; }

/* ══════════════════════════════════════════════════
   DISTRICT MODAL (right slide panel)
══════════════════════════════════════════════════ */
#distModal {
  position: fixed; inset: 0; z-index: 3000;
  pointer-events: none;
}
#distModal.open { pointer-events: all; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.35s ease;
  backdrop-filter: blur(2px);
}
.modal-backdrop.open { opacity: 1; }

.modal-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 700px;
  max-width: calc(100vw - 10px);
  background: var(--bg2);
  border-left: 1px solid var(--border2);
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 40px rgba(0,0,0,0.6);
}
.modal-panel.open { transform: translateX(0); }

/* Modal inner scrollable content */
#modalContent {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
}

/* ── Modal Header ── */
.mp-header {
  background: linear-gradient(135deg, #0f1923 0%, #1a2535 50%, #162032 100%);
  border-bottom: 1px solid var(--border2);
  padding: 20px 24px;
  position: relative;
  flex-shrink: 0;
}
.mp-header::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at top left, rgba(59,130,246,0.12), transparent 60%);
  pointer-events: none;
}
.mp-breadcrumb {
  font-size: 11px; color: var(--text2); margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.mp-title {
  font-size: 20px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 8px;
  letter-spacing: -0.3px; line-height: 1.2;
}
.mp-title svg { width: 18px; height: 18px; stroke: var(--blue); flex-shrink: 0; }
.mp-subtitle {
  font-size: 12px; color: var(--text2); margin-top: 6px;
}
.mp-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  transition: background 0.2s, color 0.2s;
}
.mp-close:hover { background: rgba(239,68,68,0.15); color: var(--red); border-color: rgba(239,68,68,0.3); }
.mp-close svg { width: 14px; height: 14px; }

/* ── Modal Stat Grid ── */
.mp-stat-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 10px; padding: 16px 20px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mp-stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px;
  transition: border-color 0.2s;
}
.mp-stat-card:hover { border-color: var(--border2); }
.mp-stat-icon { margin-bottom: 2px; }
.mp-stat-icon svg { width: 15px; height: 15px; }
.mp-stat-val {
  font-size: 18px; font-weight: 800;
  letter-spacing: -0.5px; line-height: 1;
}
.mp-stat-label { font-size: 10px; color: var(--text2); font-weight: 500; }

.mp-stat-card.c-blue  .mp-stat-icon { color: var(--blue); }
.mp-stat-card.c-blue  .mp-stat-val  { color: #60a5fa; }
.mp-stat-card.c-amber .mp-stat-icon { color: var(--amber); }
.mp-stat-card.c-amber .mp-stat-val  { color: #fcd34d; }
.mp-stat-card.c-green .mp-stat-icon { color: var(--green); }
.mp-stat-card.c-green .mp-stat-val  { color: #34d399; }
.mp-stat-card.c-purple .mp-stat-icon{ color: var(--purple); }
.mp-stat-card.c-purple .mp-stat-val { color: #a78bfa; }

/* ── Modal Tabs ── */
.mp-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 0 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mp-tab-btn {
  padding: 11px 14px;
  font-size: 12px; font-weight: 600;
  color: var(--text2);
  position: relative;
  transition: color 0.2s;
  border-radius: 6px 6px 0 0;
}
.mp-tab-btn::after {
  content: ''; position: absolute; bottom: -1px;
  left: 0; right: 0; height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.2s;
}
.mp-tab-btn.active { color: var(--text); }
.mp-tab-btn.t-overview.active::after { background: var(--blue); }
.mp-tab-btn.t-ksz.active::after     { background: var(--blue); }
.mp-tab-btn.t-yoshlar.active::after  { background: var(--amber); }
.mp-tab-btn:hover { color: var(--text); }

.mp-tab-count {
  display: inline-flex;
  font-size: 10px; font-weight: 700;
  background: var(--bg4);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* ── Modal Body ── */
.mp-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
}
.mp-tab-panel { display: none; }
.mp-tab-panel.active { display: block; }

/* ── Overview two-column cards ── */
.mp-overview-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 20px;
}
.mp-ov-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.mp-ov-card-head {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.mp-ov-card-head.c-blue  { background: rgba(59,130,246,0.08); }
.mp-ov-card-head.c-amber { background: rgba(245,158,11,0.08); }
.mp-ov-card-head svg { width: 14px; height: 14px; }
.mp-ov-card-head.c-blue  svg { stroke: var(--blue); }
.mp-ov-card-head.c-amber svg { stroke: var(--amber); }
.mp-ov-title { font-size: 12px; font-weight: 700; }
.mp-ov-badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.mp-ov-badge.c-blue  { background: rgba(59,130,246,0.2); color: #93c5fd; }
.mp-ov-badge.c-amber { background: rgba(245,158,11,0.2); color: #fde68a; }

.mp-ov-rows { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.mp-ov-row  { display: flex; justify-content: space-between; align-items: center; }
.mp-ov-key  { font-size: 11px; color: var(--text2); }
.mp-ov-val  { font-size: 12px; font-weight: 600; color: var(--text); }

/* ── Zone Accordion ── */
.zone-accord {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
  animation: fadeSlideIn 0.3s ease both;
}
.zone-accord-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg3);
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}
.zone-accord-head:hover { background: var(--bg4); }
.zone-accord-head.open  { border-bottom: 1px solid var(--border); }
.za-name { font-size: 13px; font-weight: 700; flex: 1; min-width: 0; }
.za-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  flex-shrink: 0;
}
.za-badge.ksz    { background: rgba(59,130,246,0.2);  color: #93c5fd; }
.za-badge.yoshlar{ background: rgba(245,158,11,0.2); color: #fde68a; }
.za-meta { font-size: 11px; color: var(--text2); white-space: nowrap; flex-shrink: 0; }
.za-chevron { color: var(--text3); transition: transform 0.25s; flex-shrink: 0; }
.za-chevron svg { width: 14px; height: 14px; }
.zone-accord-head.open .za-chevron { transform: rotate(90deg); }

.zone-accord-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
  background: var(--bg);
}
.zone-accord-body.open { max-height: 2000px; }

/* Projects table */
.proj-table-wrap { overflow-x: auto; }
.proj-table {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px;
}
.proj-table th {
  padding: 7px 8px;
  text-align: left;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--text3);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  white-space: normal; line-height: 1.25;
  position: sticky; top: 0; z-index: 1;
}
.proj-table td {
  padding: 7px 8px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.proj-table tr:last-child td { border-bottom: none; }
.proj-table tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.proj-table tr:hover td { background: rgba(255,255,255,0.04); }
.proj-table .td-num   { color: var(--text3); font-weight: 600; width: 26px; }
.proj-table .td-comp  { color: var(--text); font-weight: 500; max-width: 122px; }
.proj-table .td-prod  { max-width: 92px; }
.proj-table .td-trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
.proj-table .td-num-r { text-align: right; white-space: nowrap; }
.proj-table .td-val   { color: #60a5fa; font-weight: 600; white-space: nowrap; }
.proj-table .td-jobs  { color: #34d399; font-weight: 600; }
.proj-table .td-stir  {
  color: var(--text3); font-weight: 500; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-size: 11px; letter-spacing: 0.01em;
}

.status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px 2px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
}
.status-chip svg { width: 11px; height: 11px; }
.status-active   { background: rgba(16,185,129,0.15); color: #34d399; }
.status-progress { background: rgba(245,158,11,0.15); color: #fcd34d; }

/* ── Glossary ── */
.glossary {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.glossary-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: var(--bg3);
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
}
.glossary-head:hover { background: var(--bg4); }
.glossary-head svg { width: 14px; height: 14px; stroke: var(--blue); }
.glossary-title { font-size: 12px; font-weight: 700; flex: 1; }
.glossary-chevron { color: var(--text3); transition: transform 0.25s; }
.glossary-chevron svg { width: 14px; height: 14px; }
.glossary-head.open .glossary-chevron { transform: rotate(90deg); }

.glossary-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
  background: var(--bg);
}
.glossary-body.open { max-height: 600px; }
.glossary-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 7px; }
.glossary-item { display: flex; gap: 10px; align-items: baseline; }
.glossary-abbr { font-size: 11px; font-weight: 700; color: var(--blue); white-space: nowrap; min-width: 72px; }
.glossary-desc { font-size: 11px; color: var(--text2); }

/* ── Empty states ── */
.mp-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text2);
}
.mp-empty svg { width: 40px; height: 40px; margin: 0 auto 12px; stroke: var(--text3); }
.mp-empty p { font-size: 13px; }

/* ══════════════════════════════════════════════════
   COUNTER ANIMATION
══════════════════════════════════════════════════ */
@keyframes countPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.counter-pulse { animation: countPulse 0.3s ease; }

/* ══════════════════════════════════════════════════
   ACCENT MAP BUTTONS
══════════════════════════════════════════════════ */
.map-ctrl-btn.ctrl-accent {
  border-color: rgba(59,130,246,0.4);
  color: #93c5fd;
}
.map-ctrl-btn.ctrl-accent:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
#tourBtn.ctrl-accent { border-color: rgba(245,158,11,0.45); color: #fcd34d; }
#tourBtn.ctrl-accent:hover { background: var(--amber); color: #14181f; border-color: var(--amber); }

/* ══════════════════════════════════════════════════
   MAP METRIC SWITCHER (top-center)
══════════════════════════════════════════════════ */
.map-metric {
  position: absolute; top: 12px; right: 12px;
  z-index: 500;
  display: flex; align-items: center; gap: 9px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 5px 8px 5px 12px;
  box-shadow: var(--shadow);
}
.mm-label { font-size: 11px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.mm-seg { display: flex; gap: 2px; background: var(--bg3); border-radius: 7px; padding: 3px; }
.mm-btn {
  padding: 5px 10px; font-size: 11px; font-weight: 600;
  color: var(--text2); border-radius: 5px; white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}
.mm-btn:hover { color: var(--text); }
.mm-btn.active { background: var(--blue); color: #fff; box-shadow: 0 0 8px rgba(59,130,246,0.4); }

/* Legend gradient (metric mode) */
.lg-gradient { display: flex; height: 10px; border-radius: 4px; overflow: hidden; margin-bottom: 5px; }
.lg-swatch { flex: 1; }
.lg-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--text2); }

/* ══════════════════════════════════════════════════
   STATISTICS DASHBOARD MODAL
══════════════════════════════════════════════════ */
#statsModal { position: fixed; inset: 0; z-index: 3500; pointer-events: none; }
#statsModal.open { pointer-events: all; }
.stats-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.66);
  backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.3s ease;
}
.stats-backdrop.open { opacity: 1; }
.stats-card {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(0.96); opacity: 0;
  width: min(1060px, calc(100vw - 32px));
  max-height: 90vh; overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: transform 0.34s cubic-bezier(0.34,1.4,0.64,1), opacity 0.28s ease;
}
.stats-card.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }

.stats-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 24px 16px;
  background: linear-gradient(135deg, #0f1923 0%, #1a2535 55%, #162032 100%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.stats-eyebrow { font-size: 11px; color: var(--text2); letter-spacing: 0.04em; margin-bottom: 5px; text-transform: uppercase; }
.stats-title { font-size: 21px; font-weight: 800; letter-spacing: -0.4px; display: flex; align-items: center; gap: 9px; }
.stats-title svg { stroke: var(--blue); }
.stats-close {
  width: 34px; height: 34px; background: var(--bg4); border: 1px solid var(--border2);
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  color: var(--text2); transition: background 0.2s, color 0.2s; flex-shrink: 0;
}
.stats-close:hover { background: rgba(239,68,68,0.16); color: var(--red); }

.stats-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 18px 24px;
}
.stat-tile {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; position: relative; overflow: hidden;
}
.stat-tile.c-blue   { background: var(--blue-g);   border-color: rgba(59,130,246,0.2); }
.stat-tile.c-green  { background: var(--green-g);  border-color: rgba(16,185,129,0.2); }
.stat-tile.c-amber  { background: var(--amber-g);  border-color: rgba(245,158,11,0.2); }
.stat-tile.c-purple { background: var(--purple-g); border-color: rgba(139,92,246,0.2); }
.st-icon { margin-bottom: 8px; }
.stat-tile.c-blue .st-icon   { color: var(--blue); }
.stat-tile.c-green .st-icon  { color: var(--green); }
.stat-tile.c-amber .st-icon  { color: var(--amber); }
.stat-tile.c-purple .st-icon { color: var(--purple); }
.st-val { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; line-height: 1; }
.stat-tile.c-blue .st-val   { color: #60a5fa; }
.stat-tile.c-green .st-val  { color: #34d399; }
.stat-tile.c-amber .st-val  { color: #fcd34d; }
.stat-tile.c-purple .st-val { color: #a78bfa; }
.st-label { font-size: 11px; color: var(--text2); margin-top: 6px; font-weight: 500; }

.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  padding: 4px 24px 24px;
}
.stats-cardx {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.stats-cardx.span2 { grid-column: span 2; }
.scx-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.scx-title { font-size: 13px; font-weight: 700; color: var(--text); }
.scx-seg { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 3px; }
.seg-b { padding: 4px 9px; font-size: 10.5px; font-weight: 600; color: var(--text2); border-radius: 5px; transition: background 0.15s, color 0.15s; }
.seg-b:hover { color: var(--text); }
.seg-b.active { background: var(--blue); color: #fff; }

/* Horizontal bar list */
.chart-bars { display: flex; flex-direction: column; gap: 9px; }
.chart-row { display: flex; align-items: center; gap: 10px; animation: fadeSlideIn 0.35s ease both; }
.cr-label { width: 120px; flex-shrink: 0; font-size: 11.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-track { flex: 1; height: 9px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.cr-fill { display: block; height: 100%; border-radius: 99px; transition: width 0.5s cubic-bezier(0.2,0.8,0.2,1); }
.cr-val { width: 64px; flex-shrink: 0; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-svg { width: 128px; height: 128px; flex-shrink: 0; }
.donut-c1 { fill: var(--text); font-size: 22px; font-weight: 800; font-family: 'Inter', sans-serif; }
.donut-c2 { fill: var(--text2); font-size: 10px; font-family: 'Inter', sans-serif; }
.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.dl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); }
.dl-row b { margin-left: auto; color: var(--text); font-size: 14px; }
.dotc { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }

/* KSZ vs YOSHLAR comparison */
.cmp-row { margin-bottom: 13px; }
.cmp-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.cmp-top > span:first-child { font-size: 11.5px; color: var(--text2); }
.cmp-nums { font-size: 11.5px; font-weight: 700; color: var(--text); }
.stack-track { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--bg); }
.stack-seg { height: 100%; transition: width 0.5s cubic-bezier(0.2,0.8,0.2,1); }
.cmp-legend { display: flex; gap: 16px; margin-top: 4px; }
.cmp-legend span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text2); }

/* ══════════════════════════════════════════════════
   PRESENTATION / AUTO-TOUR BAR
══════════════════════════════════════════════════ */
#tourBar {
  position: absolute; bottom: 24px; left: 50%;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  z-index: 1500; transition: transform 0.35s cubic-bezier(0.34,1.3,0.64,1), opacity 0.3s ease;
}
#tourBar.open { transform: translate(-50%, 0); opacity: 1; pointer-events: all; }
.tour-inner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(22,27,34,0.94);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
}
.tour-ctrl {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); background: var(--bg3);
  transition: background 0.18s, color 0.18s; flex-shrink: 0;
}
.tour-ctrl:hover { background: var(--bg4); color: var(--text); }
.tour-ctrl svg { width: 16px; height: 16px; }
.tour-play { width: 40px; height: 40px; background: var(--blue); color: #fff; }
.tour-play:hover { background: #2563eb; color: #fff; }
.tour-play svg { width: 18px; height: 18px; }
.tour-info { display: flex; align-items: center; gap: 9px; padding: 0 8px 0 6px; min-width: 0; }
.ti-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.4); }
.ti-name { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.ti-stats { font-size: 12px; color: var(--text2); white-space: nowrap; }
.ti-stats b { color: var(--text); font-weight: 700; }
.tour-progress { font-size: 11px; font-weight: 700; color: var(--text2); background: var(--bg3); border-radius: 99px; padding: 4px 10px; white-space: nowrap; flex-shrink: 0; }
.tour-exit { background: transparent; }
.tour-exit:hover { background: rgba(239,68,68,0.16); color: var(--red); }
body.tour-mode #sidebar { opacity: 0.35; pointer-events: none; }
body.tour-mode .map-metric { opacity: 0; pointer-events: none; }

/* ══════════════════════════════════════════════════
   RESPONSIVE — mobile
══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sb-width: 100vw; }
  #sidebar { position: absolute; z-index: 400; box-shadow: var(--shadow-lg); }
  .modal-panel { width: 100vw; max-width: 100vw; }
  .mp-stat-grid { grid-template-columns: repeat(2,1fr); }
  .mp-overview-grid { grid-template-columns: 1fr; }
  .mp-stat-val { font-size: 15px; }
  .map-metric { top: auto; bottom: 70px; left: 12px; right: 12px; transform: none; overflow-x: auto; }
  .stats-kpis { grid-template-columns: repeat(2,1fr); }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-cardx.span2 { grid-column: span 1; }
  .tour-info .ti-stats { display: none; }
}

@media (max-width: 480px) {
  .mp-stat-grid { grid-template-columns: repeat(2,1fr); }
  .st-val { font-size: 20px; }
  .cr-label { width: 88px; }
}
