/* =====================================================================
   UniFi Voucher — admin panel dizayn tizimi
   Monoxrom asos + UniFi ko‘ki (ajratuvchi rang). Light / Dark / Auto.
   Mavzu <html data-bs-theme="light|dark"> orqali (js/app.js boshqaradi).
   ===================================================================== */

/* ---------- 1. Tokenlar ---------- */
:root,
:root[data-bs-theme="light"] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --surface-3: #e8eaed;
  --border: #e3e5e8;
  --border-strong: #cdd1d6;
  --text: #111317;
  --text-2: #464b53;
  --muted: #767c85;
  --accent: #006fff;
  --accent-hover: #005ad1;
  --accent-rgb: 0, 111, 255;
  --accent-soft: rgba(0, 111, 255, 0.09);
  --accent-text: #0058cc;
  --ok: #1a8f4d;
  --ok-soft: rgba(26, 143, 77, 0.10);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.12);
  --bad: #d23a2f;
  --bad-soft: rgba(210, 58, 47, 0.09);
  --shadow: 0 1px 2px rgba(16, 19, 23, 0.04), 0 1px 3px rgba(16, 19, 23, 0.04);
  --shadow-lg: 0 10px 30px rgba(16, 19, 23, 0.10);
  --overlay: rgba(17, 19, 23, 0.36);
  --logo-filter: none;
  color-scheme: light;
}

:root[data-bs-theme="dark"] {
  --bg: #0d0e10;
  --surface: #15171a;
  --surface-2: #1b1d21;
  --surface-3: #23262b;
  --border: #272a30;
  --border-strong: #383c44;
  --text: #eceef1;
  --text-2: #b3b8c0;
  --muted: #858b94;
  --accent: #3d8bff;
  --accent-hover: #63a2ff;
  --accent-rgb: 61, 139, 255;
  --accent-soft: rgba(61, 139, 255, 0.14);
  --accent-text: #79b0ff;
  --ok: #3ec27a;
  --ok-soft: rgba(62, 194, 122, 0.13);
  --warn: #e3ac3c;
  --warn-soft: rgba(227, 172, 60, 0.14);
  --bad: #f2665c;
  --bad-soft: rgba(242, 102, 92, 0.14);
  --shadow: none;
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --overlay: rgba(0, 0, 0, 0.6);
  --logo-filter: invert(1);
  color-scheme: dark;
}

/* Bootstrap o'zgaruvchilarini tokenlarga bog'lash */
:root[data-bs-theme] {
  --bs-body-font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: 0.86rem;
  --bs-body-bg: var(--surface);
  --bs-body-bg-rgb: 255, 255, 255;
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-color: var(--muted);
  --bs-secondary-bg: var(--surface-3);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-primary: var(--accent);
  --bs-primary-rgb: var(--accent-rgb);
  --bs-primary-text-emphasis: var(--accent-text);
  --bs-primary-bg-subtle: var(--accent-soft);
  --bs-primary-border-subtle: rgba(var(--accent-rgb), 0.35);
  --bs-link-color: var(--accent-text);
  --bs-link-color-rgb: var(--accent-rgb);
  --bs-link-hover-color: var(--accent);
  --bs-heading-color: var(--text);
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 12px;
  --bs-focus-ring-color: rgba(var(--accent-rgb), 0.28);
  --bs-success: var(--ok);
  --bs-danger: var(--bad);
  --bs-warning: var(--warn);
}
:root[data-bs-theme="dark"] { --bs-body-bg-rgb: 21, 23, 26; }

/* ---------- 2. Asos ---------- */
html, body { background: var(--bg); }
body {
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
code, kbd, .font-monospace, .mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
code { color: var(--text); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }
.num, .table td, .kpi-value { font-variant-numeric: tabular-nums; }
::selection { background: rgba(var(--accent-rgb), 0.22); }
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.01em; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.text-body-secondary { color: var(--text-2) !important; }
hr { border-color: var(--border); opacity: 1; }

/* Eski sahifalardagi "oq" sinflar qorong'i mavzuda ham to'g'ri ko'rinsin */
.bg-white, .bg-body { background-color: var(--surface) !important; }
.bg-light, .bg-light-subtle, .bg-body-tertiary { background-color: var(--surface-2) !important; }
.text-dark { color: var(--text) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border) !important; }
.shadow-sm { box-shadow: var(--shadow) !important; }
.shadow { box-shadow: var(--shadow-lg) !important; }

/* ---------- 3. Ilova qobig'i: yon menyu + kontent ---------- */
.app { display: flex; min-height: 100vh; }
.app-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040;
  width: 248px; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
}
.app-main { flex: 1; min-width: 0; margin-left: 248px; display: flex; flex-direction: column; }

.sb-brand { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px; border-bottom: 1px solid var(--border); color: var(--text); }
.sb-brand img { height: 19px; width: auto; filter: var(--logo-filter); }
.sb-brand span { font-weight: 650; font-size: 0.95rem; letter-spacing: -0.01em; }
.sb-brand small { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 500; letter-spacing: 0; }

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.sb-group { margin-top: 14px; }
.sb-group:first-child { margin-top: 4px; }
.sb-label { padding: 0 10px 6px; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sb-link {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 10px; margin: 1px 0; border-radius: 7px;
  color: var(--text-2); font-weight: 500;
  transition: background-color .12s, color .12s;
}
.sb-link i { font-size: 1.05rem; width: 18px; text-align: center; color: var(--muted); transition: color .12s; }
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link:hover i { color: var(--text); }
.sb-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sb-link.active i { color: var(--accent); }
.sb-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-link .sb-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 0.7rem; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; }
.sb-link .sb-badge.warn { background: var(--warn); }

.sb-foot { border-top: 1px solid var(--border); padding: 12px; display: grid; gap: 10px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; color: var(--text); width: 100%; border: 0; background: transparent; text-align: left; }
.sb-user:hover { background: var(--surface-2); }
.sb-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: var(--surface); font-weight: 650; font-size: 0.8rem; flex: none; }
.sb-user b { display: block; font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.sb-user small { display: block; font-size: 0.72rem; color: var(--muted); }

/* Mavzu almashtirgich (Light / Auto / Dark) */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.theme-switch button { border: 0; background: transparent; color: var(--muted); height: 28px; border-radius: 6px; font-size: 0.75rem; font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
:root[data-bs-theme="dark"] .theme-switch button[aria-pressed="true"] { background: var(--surface-3); box-shadow: none; }

/* Yuqori satr */
.app-topbar {
  position: sticky; top: 0; z-index: 1020; min-height: 52px;
  display: flex; align-items: center; gap: 12px; padding: 6px 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px); -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-topbar .tb-title { font-size: 0.95rem; font-weight: 600; margin: 0; color: var(--text); }
.app-topbar .tb-crumb { color: var(--muted); font-weight: 500; }
.app-topbar .tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center; }
.tb-btn:hover { color: var(--text); border-color: var(--border-strong); }
.tb-burger { display: none; }

/* Sahifa sarlavhasi yuqori satrda: nom · izoh ......... tugmalar */
.app-topbar .tb-head { flex: 1; min-width: 0; margin: 0; flex-wrap: nowrap; align-items: center; gap: 16px; }
.app-topbar .tb-head > div:first-child { min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.app-topbar .tb-head h1 { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.app-topbar .tb-head p { margin: 0; font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.app-topbar .tb-head p::before { content: ""; display: inline-block; width: 1px; height: 12px; background: var(--border-strong); margin-right: 12px; vertical-align: -1px; }
.app-topbar .tb-head .actions { flex-wrap: nowrap; flex-shrink: 0; gap: 6px; }
.app-topbar .tb-head .actions .btn { padding: 0.3rem 0.75rem; font-size: 0.8125rem; }
.app-topbar .tb-head .actions .seg a, .app-topbar .tb-head .actions .seg button { padding-top: 4px; padding-bottom: 4px; }
.app-topbar .tb-head .actions .chip { padding-top: 3px; padding-bottom: 3px; }
@media (max-width: 1199.98px) { .app-topbar .tb-head p { display: none; } }
@media (max-width: 767.98px) {
  .app-topbar { flex-wrap: wrap; align-items: flex-start; row-gap: 6px; padding-top: 9px; padding-bottom: 9px; }
  .app-topbar .tb-burger { width: 34px; height: 34px; }
  .app-topbar .tb-head { flex-wrap: wrap; row-gap: 8px; min-height: 34px; }
  .app-topbar .tb-head > div:first-child { min-height: 34px; align-items: center; }
  .app-topbar .tb-head .actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .app-topbar .tb-head .actions form { flex-shrink: 0; }
}

.app-content { flex: 1; padding: 24px 28px 48px; }
.app-content > .container, .app-content > .container-fluid, .app-content .container { max-width: 1440px; padding-left: 0; padding-right: 0; margin-left: 0; margin-right: 0; }
.app-content > .container.narrow, .app-content .container.narrow { max-width: 760px; }
.app-foot { padding: 14px 28px; color: var(--muted); font-size: 0.75rem; border-top: 1px solid var(--border); }

.sb-overlay { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.sb-open .app-sidebar { transform: none; }
  .app.sb-open .sb-overlay { display: block; position: fixed; inset: 0; z-index: 1035; background: var(--overlay); }
  .app-main { margin-left: 0; }
  .tb-burger { display: inline-grid; }
  .app-topbar { padding: 0 16px; }
  .app-content { padding: 16px 16px 40px; }
  .app-foot { padding: 14px 16px; }
}

/* ---------- 4. Sahifa sarlavhasi ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.375rem; font-weight: 650; margin: 0; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 28px 0 10px; }
.section-title h2, .section-title h6 { font-size: 0.95rem; font-weight: 650; margin: 0; }
.section-title .hint { color: var(--muted); font-size: 0.8rem; }

/* ---------- 5. Kartalar ---------- */
.card {
  --bs-card-bg: var(--surface);
  --bs-card-border-color: var(--border);
  --bs-card-cap-bg: transparent;
  --bs-card-border-radius: 12px;
  --bs-card-inner-border-radius: 11px;
  box-shadow: var(--shadow);
}
.card-header { border-bottom-color: var(--border); padding: 14px 18px; font-weight: 600; }
.card-header h5, .card-header h6 { margin: 0; font-size: 0.92rem; font-weight: 650; }
.card-body { padding: 18px; }
.card-footer { border-top-color: var(--border); background: transparent; }

/* KPI kartasi */
.kpi { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
a.kpi:hover { border-color: var(--border-strong); }
.kpi-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 550; }
.kpi-label i { font-size: 0.95rem; }
.kpi-value { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-value small { font-size: 0.85rem; font-weight: 550; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-sub { font-size: 0.78rem; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 0.75rem; padding: 1px 6px; border-radius: 99px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--surface-2); }
.kpi.accent { border-color: rgba(var(--accent-rgb), .35); background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface); }

/* Holat nuqtasi va belgilari */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 0.74rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.chip.accent { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }

/* Bootstrap badge'lari monoxrom uslubda */
.badge { font-weight: 600; letter-spacing: 0.01em; border-radius: 6px; }
.badge.bg-success, .badge.text-bg-success { background: var(--ok-soft) !important; color: var(--ok) !important; }
.badge.bg-danger, .badge.text-bg-danger { background: var(--bad-soft) !important; color: var(--bad) !important; }
.badge.bg-warning, .badge.text-bg-warning { background: var(--warn-soft) !important; color: var(--warn) !important; }
.badge.bg-primary, .badge.text-bg-primary { background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.badge.bg-secondary, .badge.text-bg-secondary, .badge.text-bg-light, .badge.bg-light { background: var(--surface-2) !important; color: var(--text-2) !important; }
.badge.text-bg-dark, .badge.bg-dark { background: var(--text) !important; color: var(--surface) !important; }
.badge.bg-info, .badge.text-bg-info { background: var(--surface-2) !important; color: var(--text-2) !important; }

/* Progress (zaxira, muddat) */
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--text); }
.meter.accent > i { background: var(--accent); }
.meter.ok > i { background: var(--ok); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }
.progress { --bs-progress-bg: var(--surface-3); --bs-progress-bar-bg: var(--accent); border-radius: 99px; }

/* ---------- 6. Tugmalar ---------- */
.btn { --bs-btn-font-weight: 550; --bs-btn-font-size: 0.85rem; --bs-btn-border-radius: 8px; --bs-btn-padding-y: 0.42rem; --bs-btn-padding-x: 0.9rem; }
.btn-sm { --bs-btn-font-size: 0.8rem; --bs-btn-padding-y: 0.28rem; --bs-btn-padding-x: 0.65rem; --bs-btn-border-radius: 7px; }
.btn-primary {
  --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent);
  --bs-btn-focus-shadow-rgb: var(--accent-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--accent-text); --bs-btn-border-color: rgba(var(--accent-rgb), .45);
  --bs-btn-hover-bg: var(--accent-soft); --bs-btn-hover-color: var(--accent-text); --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-bg: var(--accent); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--accent);
}
.btn-dark, .btn-secondary {
  --bs-btn-bg: var(--text); --bs-btn-border-color: var(--text); --bs-btn-color: var(--surface);
  --bs-btn-hover-bg: var(--text-2); --bs-btn-hover-border-color: var(--text-2); --bs-btn-hover-color: var(--surface);
  --bs-btn-active-bg: var(--text-2); --bs-btn-active-color: var(--surface);
}
.btn-light, .btn-outline-secondary, .btn-outline-dark, .btn-ghost {
  --bs-btn-bg: var(--surface); --bs-btn-color: var(--text); --bs-btn-border-color: var(--border-strong);
  --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border-strong);
  --bs-btn-active-bg: var(--surface-3); --bs-btn-active-color: var(--text); --bs-btn-active-border-color: var(--border-strong);
  --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-border-color: var(--border);
}
.btn-outline-dark.active, .btn-outline-secondary.active { --bs-btn-active-bg: var(--text); --bs-btn-active-color: var(--surface); --bs-btn-active-border-color: var(--text); }
.btn-danger { --bs-btn-bg: var(--bad); --bs-btn-border-color: var(--bad); --bs-btn-hover-bg: var(--bad); --bs-btn-hover-border-color: var(--bad); --bs-btn-active-bg: var(--bad); }
.btn-outline-danger { --bs-btn-color: var(--bad); --bs-btn-border-color: rgba(210, 58, 47, .4); --bs-btn-hover-bg: var(--bad-soft); --bs-btn-hover-color: var(--bad); --bs-btn-hover-border-color: var(--bad); --bs-btn-active-bg: var(--bad); }
.btn-success { --bs-btn-bg: var(--text); --bs-btn-border-color: var(--text); --bs-btn-color: var(--surface); --bs-btn-hover-bg: var(--text-2); --bs-btn-hover-border-color: var(--text-2); --bs-btn-hover-color: var(--surface); }
.btn-link { --bs-btn-color: var(--accent-text); --bs-btn-hover-color: var(--accent); }
.btn[aria-busy="true"] { cursor: progress; opacity: .85; display: inline-flex; align-items: center; justify-content: center; }
.btn[aria-busy="true"] .spinner-border { --bs-spinner-width: .95rem; --bs-spinner-height: .95rem; --bs-spinner-border-width: .15em; }
.btn:focus-visible, .form-control:focus, .form-select:focus { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .25) !important; border-color: var(--accent) !important; }

/* Segmentli filtr (davr tanlash) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.seg a, .seg button { border: 0; background: transparent; color: var(--text-2); font-size: 0.8rem; font-weight: 550; padding: 4px 11px; border-radius: 6px; white-space: nowrap; }
.seg a:hover, .seg button:hover { color: var(--text); }
.seg .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
:root[data-bs-theme="dark"] .seg .active { background: var(--surface-3); box-shadow: none; }
.seg .count { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ---------- 7. Formalar ---------- */
.form-control, .form-select {
  background-color: var(--surface); border-color: var(--border-strong); color: var(--text);
  border-radius: 8px; font-size: 0.875rem;
}
.form-control::placeholder { color: var(--muted); opacity: .8; }
.form-control:disabled, .form-select:disabled { background-color: var(--surface-2); }
.form-label { font-weight: 550; font-size: 0.82rem; color: var(--text-2); margin-bottom: 6px; }
.form-text { color: var(--muted); }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ---------- 8. Jadvallar ---------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-striped-color: var(--text);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-hover-color: var(--text);
  margin-bottom: 0; font-size: 0.85rem;
}
.table > :not(caption) > * > * { padding: 10px 14px; border-bottom-color: var(--border); }
.table thead th, .table > thead > tr > th {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); background: var(--surface-2) !important; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-light { --bs-table-bg: var(--surface-2); --bs-table-color: var(--muted); --bs-table-border-color: var(--border); }
.table-bordered > :not(caption) > * > * { border-color: var(--border); }
.table-sm > :not(caption) > * > * { padding: 7px 12px; }
.table-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.table-card .table thead th:first-child { border-top-left-radius: 0; }
.table-card .table tbody tr:last-child td { border-bottom: 0; }
.table td.code, .code-cell { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 600; letter-spacing: .02em; }

/* DataTables */
.dataTables_wrapper { font-size: 0.82rem; }
.dataTables_wrapper .row { --bs-gutter-x: 0; margin: 0; align-items: center; }
.dataTables_wrapper > .row:first-child { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.dataTables_wrapper > .row:last-child { padding: 10px 14px; border-top: 1px solid var(--border); }
.dataTables_wrapper > .row > [class*="col-"] { padding: 0; }
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_info { text-align: left !important; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_paginate { text-align: right !important; }
.dataTables_wrapper .dataTables_paginate .pagination { justify-content: flex-end !important; margin: 0; }
.dataTables_wrapper .dataTables_filter label, .dataTables_wrapper .dataTables_length label { margin: 0; color: var(--muted); }
@media (max-width: 575.98px) {
  .dataTables_wrapper > .row > [class*="col-"] { width: 50%; }
  .dataTables_wrapper .dataTables_filter input { width: 100%; margin-left: 0; }
}
.dataTables_wrapper > .row:nth-child(2) > div { padding: 0; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select { border-radius: 7px !important; border-color: var(--border-strong); background-color: var(--surface); color: var(--text); height: 32px; font-size: 0.82rem; }
.dataTables_wrapper .dataTables_filter input { width: 200px; margin-left: 6px; }
.dataTables_wrapper .dataTables_info { color: var(--muted); padding-top: 0 !important; }
.dataTables_wrapper .dataTables_paginate { padding-top: 0 !important; }
.dataTables_wrapper table.dataTable { margin: 0 !important; border-collapse: collapse !important; }
table.dataTable thead > tr > th.sorting::before, table.dataTable thead > tr > th.sorting::after,
table.dataTable thead > tr > th.sorting_asc::before, table.dataTable thead > tr > th.sorting_desc::after { opacity: .25; }
table.dataTable thead > tr > th.sorting_asc::after, table.dataTable thead > tr > th.sorting_desc::before { opacity: .9; color: var(--accent); }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-color: var(--text-2); --bs-pagination-border-color: var(--border); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-hover-color: var(--text); --bs-pagination-hover-border-color: var(--border); --bs-pagination-active-bg: var(--text); --bs-pagination-active-border-color: var(--text); --bs-pagination-active-color: var(--surface); --bs-pagination-disabled-bg: var(--surface); --bs-pagination-disabled-color: var(--muted); --bs-pagination-disabled-border-color: var(--border); --bs-pagination-font-size: .8rem; --bs-pagination-padding-x: .6rem; --bs-pagination-padding-y: .25rem; }

/* ---------- 9. Boshqa Bootstrap komponentlari ---------- */
.alert { border-radius: 10px; font-size: 0.85rem; border-width: 1px; }
.alert-success { --bs-alert-bg: var(--ok-soft); --bs-alert-color: var(--text); --bs-alert-border-color: transparent; }
.alert-danger { --bs-alert-bg: var(--bad-soft); --bs-alert-color: var(--text); --bs-alert-border-color: transparent; }
.alert-warning { --bs-alert-bg: var(--warn-soft); --bs-alert-color: var(--text); --bs-alert-border-color: transparent; }
.alert-info, .alert-primary { --bs-alert-bg: var(--accent-soft); --bs-alert-color: var(--text); --bs-alert-border-color: transparent; }
.alert-light, .alert-secondary { --bs-alert-bg: var(--surface-2); --bs-alert-color: var(--text); --bs-alert-border-color: var(--border); }
.modal { --bs-modal-bg: var(--surface); --bs-modal-border-color: var(--border); --bs-modal-border-radius: 14px; --bs-modal-header-border-color: var(--border); --bs-modal-footer-border-color: var(--border); }
.modal-backdrop { --bs-backdrop-bg: #000; --bs-backdrop-opacity: .45; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-link-active-bg: var(--accent); --bs-dropdown-divider-bg: var(--border); --bs-dropdown-font-size: .85rem; border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; }
.dropdown-item { border-radius: 6px; padding: 7px 10px; display: flex; align-items: center; gap: 8px; }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); --bs-nav-tabs-link-active-bg: var(--surface); --bs-nav-tabs-link-active-color: var(--text); --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--surface); --bs-nav-tabs-link-hover-border-color: transparent; }
.nav-tabs .nav-link { color: var(--muted); font-weight: 550; }
.nav-tabs .nav-link.active { color: var(--text); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--surface); --bs-nav-pills-link-active-color: var(--text); padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.nav-pills .nav-link { color: var(--text-2); font-weight: 550; font-size: .82rem; border-radius: 6px; padding: 5px 12px; }
.nav-pills .nav-link.active { box-shadow: 0 1px 2px rgba(0,0,0,.08); }
:root[data-bs-theme="dark"] .nav-pills { --bs-nav-pills-link-active-bg: var(--surface-3); }
.list-group { --bs-list-group-bg: var(--surface); --bs-list-group-border-color: var(--border); --bs-list-group-color: var(--text); --bs-list-group-action-hover-bg: var(--surface-2); border-radius: 12px; }
.text-primary { color: var(--accent-text) !important; }
.text-success { color: var(--ok) !important; }
.text-danger { color: var(--bad) !important; }
.text-warning { color: var(--warn) !important; }
.text-info { color: var(--text-2) !important; }
.bg-primary { background-color: var(--accent) !important; }
.border-primary { border-color: var(--accent) !important; }
pre { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-size: 0.78rem; }

/* SweetAlert2 */
.swal2-popup { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border); border-radius: 14px !important; font-family: var(--bs-body-font-family); }
.swal2-title { color: var(--text) !important; font-size: 1.15rem !important; font-weight: 650 !important; }
.swal2-html-container { color: var(--text-2) !important; font-size: .9rem !important; }
.swal2-styled.swal2-confirm { background: var(--accent) !important; border-radius: 8px !important; }
.swal2-styled.swal2-cancel { background: var(--surface-3) !important; color: var(--text) !important; border-radius: 8px !important; }
/* Qoraytirilgan fon faqat oynalar uchun; toast (o'ng yuqoridagi xabar) ostida fon bo'lmaydi */
body:not(.swal2-toast-shown) .swal2-container.swal2-backdrop-show { background: var(--overlay) !important; }
body.swal2-toast-shown .swal2-container { background: transparent !important; }
.swal2-popup.swal2-toast { border: 1px solid var(--border); box-shadow: var(--shadow-lg) !important; padding: 10px 14px !important; }
.swal2-popup.swal2-toast .swal2-title { font-size: .88rem !important; font-weight: 600 !important; margin: 0 8px !important; }
.swal2-popup.swal2-toast .swal2-html-container { font-size: .8rem !important; margin: 4px 8px 0 !important; }
.swal2-popup.swal2-toast .swal2-timer-progress-bar { background: var(--accent); }
.swal2-container.swal2-top-end { top: 60px !important; }

/* ---------- 10. Yordamchi bloklar ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty i { font-size: 1.8rem; display: block; margin-bottom: 8px; color: var(--border-strong); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t1 { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .t2 { color: var(--muted); font-size: 0.76rem; }
.rank { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 0.75rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); flex: none; }
.rank.top { background: var(--text); color: var(--surface); }
.icon-chip { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 1rem; flex: none; border: 1px solid var(--border); }
.icon-chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chart-box { position: relative; height: 280px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .78rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stat-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.small-muted { font-size: 0.76rem; color: var(--muted); }

/* Kirish sahifasi */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 72px 16px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card-body { padding: 28px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-brand img { height: 34px; width: auto; filter: var(--logo-filter); }
.auth-title { text-align: center; font-size: 1.15rem; font-weight: 700; margin: 0 0 22px; }
.auth-label { display: block; font-size: 0.75rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.auth-theme { position: fixed; top: 16px; right: 16px; z-index: 10; }
.auth-theme .theme-switch { width: 120px; }

/* Harakat kamaytirilsa */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- 11. Telefon uchun aniqlashtirishlar ---------- */
.kpi-value { white-space: nowrap; }
.table td.code, .code-cell { white-space: nowrap; }
.table-card { overflow-x: auto; }
@media (max-width: 575.98px) {
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.3rem; }
  .kpi-value small { font-size: 0.75rem; }
  .page-head h1 { font-size: 1.2rem; }
  .card-body { padding: 14px; }
  .chart-box { height: 220px; }
}
