/* ===== Dunyo banklari — dashboard uslublari ===== */

:root {
  --bg: #eef2f7;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #dbe7fb 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 10%, #e2f0fb 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f6f9fd;
  --border: #dbe3ee;
  --border-soft: #e8eef6;
  --text: #0f1c33;
  --text-dim: #5b6b85;
  --text-faint: #8a99b0;
  --accent: #2563eb;
  --accent-2: #0ea5e9;
  --accent-soft: #e8f0fe;
  --shadow: 0 1px 2px rgba(15,28,51,.05), 0 8px 24px rgba(15,28,51,.06);
  --shadow-lg: 0 2px 6px rgba(15,28,51,.07), 0 20px 48px rgba(15,28,51,.12);
  --radius: 16px;
  --radius-sm: 10px;
  --map-ocean: #dfe9f5;
  --map-land: #b9cbe4;
  --map-stroke: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #070d1a;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #10203c 0%, transparent 60%),
             radial-gradient(900px 500px at 110% 10%, #0c2436 0%, transparent 55%);
  --surface: #101a2e;
  --surface-2: #16223a;
  --border: #25334f;
  --border-soft: #1d2a44;
  --text: #e6edf9;
  --text-dim: #9db0cd;
  --text-faint: #6d80a0;
  --accent: #60a5fa;
  --accent-2: #38bdf8;
  --accent-soft: #17263f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.5);
  --map-ocean: #0e1a2e;
  --map-land: #24354f;
  --map-stroke: #0a1220;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

html[dir="rtl"] body {
  font-family: "Vazirmatn", "Segoe UI", Tahoma, "Iranian Sans", "Noto Naskh Arabic", Arial, sans-serif;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; box-shadow: var(--shadow);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--text-dim); margin: 1px 0 0; }

.header-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.lang-switch button {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] {
  background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(37,99,235,.35);
}

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 10px; cursor: pointer; color: var(--text-dim);
  transition: color .18s, border-color .18s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 22px; }
.hero h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--text-dim); font-size: clamp(14px, 2.2vw, 17px); max-width: 60ch; }
.hero .updated {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  font-size: 12.5px; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex: 0 0 7px; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid; gap: 12px; margin-bottom: 26px;
  grid-template-columns: repeat(4, 1fr);
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; inset-inline-end: -24px; top: -24px;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--accent-soft); opacity: .7;
}
.kpi-label { font-size: 12.5px; color: var(--text-dim); margin: 0 0 6px; position: relative; }
.kpi-value {
  font-size: clamp(22px, 4vw, 30px); font-weight: 700; letter-spacing: -.02em;
  line-height: 1.1; position: relative; font-variant-numeric: tabular-nums;
}
.kpi-extra { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; position: relative; }

/* ---------- Card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden;
}
.card-head {
  padding: 16px 18px 0; display: flex; align-items: flex-start;
  gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.card-sub { font-size: 12.5px; color: var(--text-dim); margin: 3px 0 0; }
.card-body { padding: 16px 18px 18px; }

/* ---------- Map ---------- */
.map-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 13px;
  border-radius: 999px; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.map-holder { position: relative; margin-top: 6px; }
.map-svg {
  display: block; width: 100%; height: auto;
  background: var(--map-ocean); border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  touch-action: manipulation;
}
.map-svg .cont {
  fill: var(--map-land); stroke: var(--map-stroke); stroke-width: 1.1;
  stroke-linejoin: round; cursor: pointer;
  transition: fill .22s ease, opacity .22s ease, transform .22s ease;
  transform-origin: center; transform-box: fill-box;
}
.map-svg .cont:hover { filter: brightness(1.12); }
.map-svg .cont:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.map-svg .cont.dim { opacity: .32; }
.map-svg .cont.active { filter: brightness(1.06) saturate(1.15); }

.map-label { pointer-events: none; font-weight: 700; font-size: 13px; }
.map-label .n { fill: #ffffff; paint-order: stroke; stroke: rgba(6,17,35,.62); stroke-width: 3.4px; stroke-linejoin: round; }
.map-label .v { fill: #ffffff; paint-order: stroke; stroke: rgba(6,17,35,.62); stroke-width: 3.4px; font-size: 11.5px; }

.map-legend {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  font-size: 12px; color: var(--text-dim); flex-wrap: wrap;
}
.legend-bar {
  height: 8px; width: 160px; border-radius: 999px; flex: 0 1 160px;
  background: linear-gradient(to right, #cfe0f6, #2563eb);
}
html[dir="rtl"] .legend-bar { background: linear-gradient(to left, #cfe0f6, #2563eb); }

.map-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 11px; box-shadow: var(--shadow-lg);
  font-size: 12.5px; opacity: 0; transform: translate(-50%, -120%);
  transition: opacity .15s; white-space: nowrap;
}
.map-tip.on { opacity: 1; }
.map-tip b { display: block; font-size: 13px; }
.map-tip span { color: var(--text-dim); }

/* ---------- Charts ---------- */
.split { display: grid; gap: 18px; grid-template-columns: 260px 1fr; align-items: center; }
.donut-holder { display: grid; place-items: center; }
.donut { width: 100%; max-width: 220px; height: auto; }
.donut-center { text-anchor: middle; }
.donut-center .big { font-size: 26px; font-weight: 700; fill: var(--text); }
.donut-center .small { font-size: 10px; fill: var(--text-dim); }
.donut circle { transition: stroke-dasharray .6s cubic-bezier(.4,0,.2,1); }

.legend-list { display: grid; gap: 9px; }
.legend-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 4px; }
.legend-name { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-val { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 13px; }
.legend-val b { color: var(--text); }
.legend-track { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: -4px; }
.legend-fill { height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: start; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); font-weight: 700; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--accent); }
thead th .arrow { opacity: .35; font-size: 10px; margin-inline-start: 3px; }
thead th[aria-sort] .arrow { opacity: 1; color: var(--accent); }
tbody td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
tbody tr.is-active { background: var(--accent-soft); }
.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank { color: var(--text-faint); font-variant-numeric: tabular-nums; width: 34px; }
.name-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.name-cell .swatch { width: 9px; height: 22px; border-radius: 3px; flex: 0 0 9px; }
.name-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-cell { min-width: 110px; }
.bar-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
html[dir="rtl"] .bar-fill { background: linear-gradient(-90deg, var(--accent-2), var(--accent)); }
.pct { font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Search ---------- */
.search-box { position: relative; margin-inline-start: auto; }
.search-box input {
  font: inherit; font-size: 13.5px; padding: 8px 12px 8px 34px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; width: 230px; max-width: 100%; outline: none;
  transition: border-color .18s, box-shadow .18s;
}
html[dir="rtl"] .search-box input { padding: 8px 34px 8px 12px; }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box svg {
  position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-faint); pointer-events: none;
}

.empty { padding: 26px 10px; text-align: center; color: var(--text-faint); font-size: 14px; }
.result-count { font-size: 12.5px; color: var(--text-faint); margin-top: 10px; }

/* ---------- Detail stats ---------- */
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.mini {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.mini .l { font-size: 12px; color: var(--text-dim); }
.mini .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 30px; padding: 22px 0 0;
  color: var(--text-faint); font-size: 12.5px;
}
.site-footer p { margin: 0 0 6px; max-width: 78ch; }

/* ---------- Animatsiya ---------- */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .55s cubic-bezier(.22,.9,.28,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .donut { max-width: 190px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 12px 48px; }
  .header-inner { padding: 10px 12px; gap: 10px; }
  .brand-sub { display: none; }
  .header-tools { width: 100%; margin-inline-start: 0; }
  .lang-switch { width: 100%; justify-content: space-between; }
  .lang-switch button { flex: 1; padding: 7px 3px; text-align: center; font-size: 12px; }
  .hero { padding: 22px 0 16px; }
  .kpi { padding: 13px 14px; }
  .card-head, .card-body { padding-inline: 14px; }
  .table-scroll { margin: 0 -14px; padding: 0 14px; }
  .mini-stats { grid-template-columns: 1fr; }
  .search-box { width: 100%; margin-inline-start: 0; }
  .search-box input { width: 100%; }
  .map-label .n { font-size: 15px; }
  .map-label .v { font-size: 13px; }
  .hide-sm { display: none; }
}
@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
