/* ============================================================
   Ko'rinish: kun (yumshoq kulrang) va tun (to'q yashil) rejimlari.
   <html> ga server --brand (markaz rangi) va --user-accent (shaxsiy rang) beradi,
   data-bs-theme esa "light" yoki "dark" bo'ladi.
   ============================================================ */
:root {
  --brand: #1E3A5F;
  --brand-rgb: 30, 58, 95;
  --brand-light: #2E75B6;
}

/* --- Kun rejimi: sof oq o'rniga ko'zni charchatmaydigan kulrang tuslar --- */
:root, [data-bs-theme="light"] {
  --accent: var(--user-accent, var(--brand));
  --accent-rgb: var(--user-accent-rgb, var(--brand-rgb));
  --accent-text: var(--accent);
  --app-bg: #e4e7eb;
  --surface: #f3f4f6;
  --surface-2: #e9ecef;
  --input-bg: #f9fafb;
  --line: #d3d8de;
  --sidebar-bg: var(--accent);
  --sidebar-muted: rgba(255, 255, 255, .55);
  --bs-body-bg: var(--app-bg);
  --bs-body-color: #1f2933;
  --bs-emphasis-color: #111827;
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: #eceef1;
  --bs-border-color: var(--line);
  --bs-secondary-color: rgba(31, 41, 51, .7);
}

/* --- Tun rejimi: to'q yashil tuslar --- */
[data-bs-theme="dark"] {
  --accent: var(--user-accent, #2f9e6b);
  --accent-rgb: var(--user-accent-rgb, 47, 158, 107);
  /* Matn va havolalar uchun rangning ochroq varianti, aks holda qorong'ida ko'rinmaydi */
  --accent-text: color-mix(in srgb, var(--accent) 55%, #e8f5ee);
  --app-bg: #0c1611;
  --surface: #13221a;
  --surface-2: #1a2e23;
  --input-bg: #0f1c15;
  --line: #264434;
  --sidebar-bg: #08110c;
  --sidebar-muted: rgba(200, 230, 212, .5);
  --bs-body-bg: var(--app-bg);
  --bs-body-color: #d3e2d9;
  --bs-emphasis-color: #eef7f1;
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: #16271e;
  --bs-border-color: var(--line);
  --bs-secondary-color: rgba(211, 226, 217, .65);
  --bs-heading-color: #eef7f1;
  color-scheme: dark;
}

/* --- Bootstrap asosiy rangini tanlangan rangga bog'laymiz --- */
:root, [data-bs-theme] {
  --bs-primary: var(--accent);
  --bs-primary-rgb: var(--accent-rgb);
  --bs-link-color: var(--accent-text);
  --bs-link-color-rgb: var(--accent-rgb);
  --bs-link-hover-color: var(--accent-text);
  --bs-primary-bg-subtle: rgba(var(--accent-rgb), .14);
  --bs-primary-border-subtle: rgba(var(--accent-rgb), .35);
  --bs-primary-text-emphasis: var(--accent-text);
  --bs-focus-ring-color: rgba(var(--accent-rgb), .3);
}

body { background: var(--app-bg); color: var(--bs-body-color); font-family: 'Segoe UI', system-ui, sans-serif;
  transition: background-color .2s, color .2s; }
a { color: var(--accent-text); }

/* Yuzalar: kartalar, yuqori panel, jadval, menyular */
.card, .dropdown-menu, .modal-content, .list-group, .offcanvas, .toast, .popover {
  --bs-card-bg: var(--surface); --bs-card-cap-bg: var(--surface);
  --bs-card-border-color: var(--line);
  --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--line);
  --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-color: var(--bs-body-color);
  --bs-dropdown-link-active-bg: var(--accent);
  --bs-modal-bg: var(--surface);
  --bs-list-group-bg: var(--surface); --bs-list-group-border-color: var(--line);
}
.bg-white { background-color: var(--surface) !important; }
.bg-light { background-color: var(--surface-2) !important; }
.bg-body  { background-color: var(--app-bg) !important; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--line); --bs-table-hover-bg: rgba(var(--accent-rgb), .06); }
.table-light { --bs-table-bg: var(--surface-2); --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--line); }
.form-control, .form-select, .input-group-text { background-color: var(--input-bg); border-color: var(--line); color: var(--bs-body-color); }
.input-group-text { background-color: var(--surface-2); }
.form-control:focus, .form-select:focus { background-color: var(--input-bg); color: var(--bs-body-color);
  border-color: rgba(var(--accent-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .2); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: rgba(var(--accent-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .2); }
.progress { --bs-progress-bar-bg: var(--accent); --bs-progress-bg: var(--surface-2); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--accent); }
.nav-tabs { --bs-nav-tabs-link-active-bg: var(--surface); --bs-nav-tabs-border-color: var(--line);
  --bs-nav-tabs-link-active-border-color: var(--line) var(--line) var(--surface); }
.nav-link { color: var(--accent-text); }
.page-link { --bs-pagination-color: var(--accent-text); --bs-pagination-active-bg: var(--accent);
  --bs-pagination-active-border-color: var(--accent); }
.text-primary { color: var(--accent-text) !important; }
.border-primary { border-color: var(--accent) !important; }

/* Tun rejimida "text-dark" yozuvlari (kartalardagi havolalar) ochroq bo'ladi, sariq nishonlar esa o'zgarmaydi */
[data-bs-theme="dark"] .text-dark:not(.badge) { color: var(--bs-emphasis-color) !important; }
[data-bs-theme="dark"] .badge.bg-light.text-dark { color: var(--bs-body-color) !important; }
[data-bs-theme="dark"] .shadow-sm { box-shadow: 0 .125rem .35rem rgba(0, 0, 0, .35) !important; }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color: #a9c2b3; --bs-btn-border-color: #3a5a48;
  --bs-btn-hover-bg: #2a4636; --bs-btn-hover-border-color: #3a5a48; --bs-btn-hover-color: #eef7f1; }
[data-bs-theme="dark"] .error-highlight,
[data-bs-theme="dark"] .tok.err { background: rgba(220, 53, 69, .3); }
[data-bs-theme="dark"] .tok.sel { background: rgba(240, 192, 0, .3); }
[data-bs-theme="dark"] .tok:hover { background: rgba(var(--accent-rgb), .25); }

/* Yon menyu */
/* Yon menyu ekran balandligida qotib turadi: logo tepada, profil va "Chiqish" pastda doim ko'rinadi,
   faqat o'rtadagi bo'limlar ro'yxati sig'masa o'zi aylantiriladi */
.app-sidebar { width: 250px; height: 100vh; height: 100dvh; position: sticky; top: 0; overflow: hidden;
  background: var(--sidebar-bg); transition: background-color .2s; }
.app-sidebar .sidebar-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; margin-right: -.5rem; padding-right: .5rem; }
.app-sidebar .sidebar-nav::-webkit-scrollbar { width: 6px; }
.app-sidebar .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 3px; }
.app-sidebar .nav-link { color: #fff; border-radius: 8px; }
.app-sidebar .nav-link:hover { background: rgba(255, 255, 255, .12); }
.app-sidebar .nav-link.active { background: rgba(255, 255, 255, .18); }
[data-bs-theme="dark"] .app-sidebar { border-right: 1px solid var(--line); }
[data-bs-theme="dark"] .app-sidebar .nav-link.active { background: rgba(var(--accent-rgb), .3);
  box-shadow: inset 3px 0 0 var(--accent); }
.app-sidebar .section-label { color: var(--sidebar-muted); font-size: .7rem; }
.app-sidebar hr { border-color: rgba(255, 255, 255, .2); }
/* Yuqori panel sahifa aylantirilganda ham tepada qoladi */
.app-topbar { background: var(--surface); border-bottom: 1px solid var(--line); min-height: 52px;
  position: sticky; top: 0; z-index: 1020; }
.icon-btn { background: transparent; border: 0; padding: .25rem .4rem; line-height: 1; color: var(--bs-secondary-color);
  border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); color: var(--bs-emphasis-color); }

/* Profil */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; background: var(--accent); flex-shrink: 0; letter-spacing: .02em; }
.avatar-lg { width: 84px; height: 84px; font-size: 1.9rem; }
.app-sidebar .avatar { width: 34px; height: 34px; font-size: .85rem; background: rgba(255, 255, 255, .2); }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; transition: transform .1s; }
.swatch:hover { transform: scale(1.08); }
.btn-check:checked + .swatch { border-color: var(--bs-emphasis-color); }
.btn-check:focus-visible + .swatch { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-check:checked + .swatch .bi { display: inline !important; }
.theme-card { border: 2px solid var(--line); border-radius: 12px; cursor: pointer; overflow: hidden; display: block;
  background: var(--surface); }
.btn-check:checked + .theme-card { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .2); }
.theme-preview { height: 70px; display: flex; }
.theme-preview .side { width: 26%; }
.theme-preview .body { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.theme-preview .bar { height: 8px; border-radius: 4px; }

/* ============================================================ */
.card { border-radius: 12px; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); }
.badge { font-weight: 500; }
/* Ro'yxat raqami: CSS hisoblagich, shuning uchun qidiruvda yashirilgan qatorlar ham to'g'ri qayta raqamlanadi */
.table tbody { counter-reset: row-num; }
.table .row-num { width: 1%; white-space: nowrap; padding-left: 1rem; color: var(--bs-secondary-color);
  font-variant-numeric: tabular-nums; font-size: .85rem; }
.table td.row-num::before { counter-increment: row-num; content: counter(row-num); }
.answer-text { font-size: 1rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.error-highlight { background: #ffd0d0; border-radius: 3px; padding: 0 2px; text-decoration: underline wavy red; }

/* Tekshirish oynasi: javobdagi so'zlar bosiladigan bo'laklar */
.tok { cursor: pointer; border-radius: 3px; padding: 0 1px; transition: background .1s; }
.tok:hover { background: #e7f0fb; }
.tok.err { background: #ffd0d0; text-decoration: underline wavy #dc3545; text-underline-offset: 3px; }
.tok.sel { background: #fff3a8; outline: 2px solid #f0c000; }
.error-highlight { cursor: help; text-underline-offset: 3px; }
.err-cat { font-size: .7rem; }

/* Tanlangan rang tugmalar va havolalarda ham ishlatiladi */
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent);
  --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); filter: saturate(1.05); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-outline-primary { --bs-btn-color: var(--accent-text); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); }

/* ============================================================
   Xabar kartalari: toast (burchakdagi xabar), tasdiqlash oynasi va sahifadagi ogohlantirishlar.
   Har bir tur o'z rangiga ega (--tone), fon esa joriy mavzudan olinadi.
   ============================================================ */
.tone-success { --tone: #16a34a; --tone-rgb: 22, 163, 74; }
.tone-error, .tone-danger { --tone: #dc2626; --tone-rgb: 220, 38, 38; }
.tone-warning { --tone: #d97706; --tone-rgb: 217, 119, 6; }
.tone-info    { --tone: var(--accent); --tone-rgb: var(--accent-rgb); }
.tone-secondary { --tone: #6b7280; --tone-rgb: 107, 114, 128; }
.tone-blue   { --tone: #2563eb; --tone-rgb: 37, 99, 235; }
.tone-violet { --tone: #7c3aed; --tone-rgb: 124, 58, 237; }
[data-bs-theme="dark"] .tone-success { --tone: #34d399; --tone-rgb: 52, 211, 153; }
[data-bs-theme="dark"] .tone-error, [data-bs-theme="dark"] .tone-danger { --tone: #f87171; --tone-rgb: 248, 113, 113; }
[data-bs-theme="dark"] .tone-warning { --tone: #fbbf24; --tone-rgb: 251, 191, 36; }
[data-bs-theme="dark"] .tone-info { --tone: var(--accent-text); }
[data-bs-theme="dark"] .tone-blue { --tone: #60a5fa; --tone-rgb: 96, 165, 250; }
[data-bs-theme="dark"] .tone-violet { --tone: #a78bfa; --tone-rgb: 167, 139, 250; }

.toast-stack { position: fixed; top: 64px; right: 16px; z-index: 2200; display: flex; flex-direction: column;
  gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast-card { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 14px 16px; border-radius: 14px; pointer-events: auto;
  background: color-mix(in srgb, var(--surface) 94%, rgb(var(--tone-rgb)));
  border: 1px solid rgba(var(--tone-rgb), .35); box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  animation: toast-in .28s cubic-bezier(.2, .9, .3, 1.2); }
[data-bs-theme="dark"] .toast-card { box-shadow: 0 12px 32px rgba(0, 0, 0, .55); }
.toast-card.leaving { animation: toast-out .25s ease forwards; }
.toast-icon { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.15rem; color: var(--tone); background: rgba(var(--tone-rgb), .14); }
.toast-body-text { flex: 1; min-width: 0; padding-top: 1px; }
.toast-title { font-weight: 600; font-size: .9rem; color: var(--bs-emphasis-color); }
.toast-msg { font-size: .85rem; color: var(--bs-secondary-color); word-break: break-word; }
.toast-msg:empty { display: none; }
.toast-close { border: 0; background: transparent; color: var(--bs-secondary-color); padding: 2px 4px;
  border-radius: 6px; line-height: 1; font-size: .8rem; }
.toast-close:hover { background: var(--surface-2); color: var(--bs-emphasis-color); }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone);
  transform-origin: left; animation: toast-timer linear forwards; opacity: .7; }
.toast-card.paused .toast-timer { animation-play-state: paused; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast-card, .toast-card.leaving { animation: none; } }

.ui-dialog .modal-content { border-radius: 18px; }
.ui-dialog .modal-dialog { max-width: 420px; }
.modal-backdrop { --bs-backdrop-bg: #0f172a; --bs-backdrop-opacity: .55; }
.dialog-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.7rem; color: var(--tone); background: rgba(var(--tone-rgb), .14);
  box-shadow: 0 0 0 8px rgba(var(--tone-rgb), .06); }
.ui-dialog .dialog-msg { white-space: pre-line; }

/* Sahifa ichidagi ogohlantirishlar ham karta ko'rinishida: chapda rangli chiziq */
.alert { --tone: var(--accent); --tone-rgb: var(--accent-rgb);
  --bs-alert-color: var(--bs-body-color); --bs-alert-link-color: var(--accent-text);
  background: color-mix(in srgb, var(--surface) 90%, rgb(var(--tone-rgb)));
  border: 1px solid rgba(var(--tone-rgb), .25); border-left: 4px solid var(--tone); border-radius: 12px; }
.alert-success { --tone: #16a34a; --tone-rgb: 22, 163, 74; }
.alert-danger  { --tone: #dc2626; --tone-rgb: 220, 38, 38; }
.alert-warning { --tone: #d97706; --tone-rgb: 217, 119, 6; }
.alert-secondary { --tone: #6b7280; --tone-rgb: 107, 114, 128; }
[data-bs-theme="dark"] .alert-success { --tone: #34d399; --tone-rgb: 52, 211, 153; }
[data-bs-theme="dark"] .alert-danger  { --tone: #f87171; --tone-rgb: 248, 113, 113; }
[data-bs-theme="dark"] .alert-warning { --tone: #fbbf24; --tone-rgb: 251, 191, 36; }
.alert > .bi:first-child { color: var(--tone); }

/* Markaz logotipi */
.brand-logo { height: 34px; width: 34px; border-radius: 9px; object-fit: contain; background: #fff; padding: 2px; flex-shrink: 0; }
.logo-drop { border: 2px dashed var(--line); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer;
  background: var(--input-bg); transition: border-color .15s, background-color .15s; }
.logo-drop:hover, .logo-drop.over { border-color: var(--accent); background: rgba(var(--accent-rgb), .06); }
.logo-preview { width: 96px; height: 96px; border-radius: 18px; object-fit: contain; background: #fff;
  border: 1px solid var(--line); padding: 6px; }

/* O'quvchi bosh sahifasi: biriktirilgan imtihonlar */
.exam-tile { border-left: 4px solid var(--tone, var(--line)) !important; transition: transform .12s, box-shadow .12s; }
.exam-tile:hover { transform: translateY(-2px); }
.exam-tile .tile-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.3rem; color: var(--tone); background: rgba(var(--tone-rgb), .14); flex-shrink: 0; }
.deadline-chip { font-size: .75rem; border-radius: 999px; padding: 2px 10px; background: var(--surface-2);
  color: var(--bs-secondary-color); white-space: nowrap; }
.deadline-chip.soon { background: rgba(217, 119, 6, .15); color: #b45309; }
[data-bs-theme="dark"] .deadline-chip.soon { color: #fbbf24; }

/* Jonli nazorat: onlayn nuqta va xavfli qator */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.live-dot.on { background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: live-pulse 2s infinite; }
.live-dot.off { background: #9ca3af; }
.live-dot.err { background: #dc2626; }
@keyframes live-pulse { 70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot.on { animation: none; } }
.table tr.row-danger > td { background: rgba(220, 38, 38, .07); }
.live-card { border-left: 4px solid var(--tone) !important; }

/* ============================================================
   Bosh sahifa: salomlashish, raqamli kartalar, grafik va tezkor havolalar.
   Kartalar ham --tone rangidan foydalanadi (tone-success, tone-info, ...).
   ============================================================ */
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px; border-radius: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, .18), transparent 55%),
              linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #0b1220));
  box-shadow: 0 10px 30px rgba(var(--accent-rgb), .25); }
[data-bs-theme="dark"] .dash-hero { box-shadow: 0 10px 30px rgba(0, 0, 0, .45); border: 1px solid var(--line); }
.dash-hero h4 { color: #fff; }
.dash-date { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.dash-sub { font-size: .9rem; opacity: .85; }
.live-pill { display: inline-flex; align-items: center; gap: 2px; padding: 5px 12px; border-radius: 999px;
  font-size: .8rem; background: rgba(255, 255, 255, .16); backdrop-filter: blur(6px); white-space: nowrap; }
.live-pill[data-state="err"] { background: rgba(220, 38, 38, .35); }

.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi-grid > a { display: block; }
.kpi-grid > a.active > .kpi-card { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone) inset; }
@media (min-width: 768px) { .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .kpi-grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1500px) { .kpi-grid-6 { grid-template-columns: repeat(6, 1fr); } }
.kpi-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; height: 100%;
  padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: transform .15s, box-shadow .15s, border-color .15s; }
.kpi-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--tone-rgb), .16), transparent 70%); pointer-events: none; }
.kpi-card:hover, a:hover > .kpi-card { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, .1);
  border-color: rgba(var(--tone-rgb), .45); }
[data-bs-theme="dark"] .kpi-card:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.kpi-icon { flex-shrink: 0; width: 46px; height: 46px; border-radius: 13px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 1.3rem; color: var(--tone); background: rgba(var(--tone-rgb), .14); }
.kpi-body { min-width: 0; }
.kpi-label { font-size: .78rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.15; color: var(--bs-emphasis-color);
  font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .78rem; color: var(--bs-secondary-color); }
.kpi-bump { animation: kpi-bump 1.2s ease; }
.kpi-bump .kpi-value { animation: kpi-value 1.2s ease; }
@keyframes kpi-bump { 0% { box-shadow: 0 0 0 0 rgba(var(--tone-rgb), .5); border-color: var(--tone); }
  100% { box-shadow: 0 0 0 14px rgba(var(--tone-rgb), 0); } }
@keyframes kpi-value { 0% { color: var(--tone); transform: scale(1.08); } 100% { transform: none; } }

/* Ustunli grafik */
.bar-chart { display: flex; align-items: stretch; justify-content: center; gap: 6px; height: 170px; }
.chart-body { display: flex; flex-direction: column; }
.chart-body .bar-chart { flex: 1; min-height: 170px; height: auto; }
.bar-col { flex: 1; min-width: 0; max-width: 72px; display: flex; flex-direction: column; gap: 6px; cursor: default; }
.bar-track { flex: 1; display: flex; align-items: flex-end; border-radius: 8px;
  background: repeating-linear-gradient(to top, transparent 0 33%, var(--line) 33% calc(33% + 1px)); }
.bar-fill { position: relative; width: 100%; min-height: 3px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(to top, rgba(var(--accent-rgb), .55), var(--accent)); transition: height .5s cubic-bezier(.2, .9, .3, 1); }
.bar-fill.zero { background: var(--surface-2); }
.bar-col:hover .bar-fill:not(.zero) { filter: brightness(1.12); }
.bar-col.today .bar-fill:not(.zero) { background: linear-gradient(to top, #f59e0b, #fbbf24); }
.bar-value { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 600; white-space: nowrap;
  color: var(--bs-secondary-color); }
.bar-label { text-align: center; font-size: .7rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; }
.bar-col.today .bar-label { color: var(--bs-emphasis-color); font-weight: 600; }
.bar-empty { margin: auto; color: var(--bs-secondary-color); font-size: .85rem; }

/* So'nggi natijalar: foiz halqasi */
.score-ring { --p: 0; flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-size: .7rem; font-weight: 700; color: var(--tone);
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 78% 100%),
              conic-gradient(var(--tone) calc(var(--p) * 1%), rgba(var(--tone-rgb), .15) 0); }

.status-chip { display: inline-block; font-size: .75rem; padding: 2px 10px; border-radius: 999px;
  color: var(--tone); background: rgba(var(--tone-rgb), .14); }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }

/* Tezkor harakatlar */
.quick-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.quick-grid.quick-col { grid-template-columns: 1fr; align-content: stretch; }
.quick-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; font-weight: 600;
  color: var(--bs-emphasis-color); text-decoration: none; background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s, border-color .15s, background-color .15s; }
.quick-card:hover { transform: translateY(-2px); border-color: rgba(var(--tone-rgb), .5); color: var(--bs-emphasis-color);
  background: color-mix(in srgb, var(--surface) 92%, rgb(var(--tone-rgb))); }
.quick-card small { font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  .kpi-bump, .kpi-bump .kpi-value { animation: none; }
  .bar-fill, .kpi-card, .quick-card { transition: none; }
}

/* Telefon: yon menyu chapdan chiqadigan panel bo'ladi, sahifa to'liq kenglikni oladi */
.sidebar-shade { display: none; }
@media (max-width: 767.98px) {
  .app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1050; transform: translateX(-100%);
    transition: transform .2s ease; height: auto; }
  .app-sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .sidebar-shade.show { display: block; position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 42, .45); }
  .dash-hero { padding: 18px; border-radius: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .kpi-value { font-size: 1.45rem; }
  .bar-chart { gap: 3px; }
  .bar-value { font-size: .6rem; }
}

/* Kurs kartasi */
.course-card { display: flex; flex-direction: column; padding: 18px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); transition: transform .15s, border-color .15s; }
.course-card:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .45); }
.course-card.archived { opacity: .65; }
.course-price { margin: 12px 0; font-size: 1.6rem; font-weight: 700; color: var(--bs-emphasis-color); font-variant-numeric: tabular-nums; }
.course-price small { font-size: .8rem; font-weight: 500; color: var(--bs-secondary-color); }

/* Guruh sahifasi */
.group-head { padding: 18px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.lesson-row { display: flex; align-items: center; gap: 12px; }
.lesson-row.cancelled .fw-semibold > span:first-child { text-decoration: line-through; color: var(--bs-secondary-color); }
.date-badge { flex-shrink: 0; width: 44px; height: 46px; border-radius: 11px; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.05; background: var(--surface-2); color: var(--bs-emphasis-color); }
.date-badge.today { background: var(--accent); color: #fff; }
.date-badge-day { font-weight: 700; font-size: 1.05rem; }
.date-badge-wd { font-size: .65rem; text-transform: uppercase; opacity: .75; }

/* Guruh formasi: haftalik jadval */
.schedule-grid { display: grid; gap: 8px; }
.schedule-row { display: grid; grid-template-columns: 170px 120px auto 120px; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--input-bg); transition: border-color .15s, background-color .15s; }
.schedule-row.on { border-color: rgba(var(--accent-rgb), .5); background: rgba(var(--accent-rgb), .07); }
.schedule-row:not(.on) input[type=time] { opacity: .45; }
.schedule-day { display: flex; align-items: center; font-weight: 600; cursor: pointer; margin: 0; }
@media (max-width: 575.98px) {
  .schedule-row { grid-template-columns: 1fr 1fr auto 1fr; }
  .schedule-day { grid-column: 1 / -1; }
}

/* Haftalik jadval */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.week-day { display: flex; flex-direction: column; min-height: 220px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); overflow: hidden; }
.week-day.today { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .2); }
.week-day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px;
  border-bottom: 1px solid var(--line); font-size: .85rem; }
.week-day.today .week-day-head { background: var(--accent); color: #fff; }
.week-day-date { font-size: .75rem; opacity: .7; }
.week-day-body { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.week-empty { color: var(--bs-secondary-color); font-size: .8rem; text-align: center; padding: 16px 0; }
.lesson-card { padding: 9px 10px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--accent); font-size: .82rem; }
.lesson-card.phase-done { opacity: .6; }
.lesson-card.phase-now { border-left-color: #16a34a; background: rgba(22, 163, 74, .1); }
.lesson-card.cancelled { border-left-color: #dc2626; opacity: .7; }
.lesson-card.cancelled .lesson-time, .lesson-card.cancelled .lesson-group { text-decoration: line-through; }
.lesson-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.lesson-group { margin: 2px 0; line-height: 1.25; }
.lesson-meta { color: var(--bs-secondary-color); font-size: .75rem; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.lesson-actions { margin-top: 4px; display: flex; flex-wrap: wrap; gap: .1rem .75rem; }
.lesson-actions .btn-link { font-size: .75rem; text-decoration: none; }
@media (max-width: 1199.98px) { .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 767.98px) {
  .week-grid { grid-template-columns: 1fr; }
  .week-day { min-height: 0; }
}
.today-lessons { display: grid; gap: 10px; padding: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

/* Davomat */
.lesson-att { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px;
  padding-top: 6px; border-top: 1px dashed var(--bs-border-color); }
.att-counters { display: flex; flex-wrap: wrap; gap: 6px; }
.att-count { font-size: .8rem; padding: 3px 10px; border-radius: 999px; color: var(--tone); background: rgba(var(--tone-rgb), .1); }
.att-count b { font-variant-numeric: tabular-nums; }
.att-count.zero { opacity: .45; }
.att-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(140px, 220px); align-items: center; gap: 10px 16px; }
.att-row.frozen { opacity: .55; }
.att-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-num { width: 26px; flex-shrink: 0; text-align: center; color: var(--bs-secondary-color); font-size: .8rem; font-variant-numeric: tabular-nums; }
.att-choices { display: flex; gap: 4px; flex-wrap: wrap; }
.att-btn { border: 1px solid rgba(var(--tone-rgb), .4); color: var(--tone); background: transparent; min-width: 84px; font-weight: 500; }
.att-btn:hover { background: rgba(var(--tone-rgb), .1); color: var(--tone); border-color: rgba(var(--tone-rgb), .6); }
.btn-check:checked + .att-btn { background: var(--tone); border-color: var(--tone); color: #fff; }
[data-bs-theme="dark"] .btn-check:checked + .att-btn { color: #0b1220; }
.btn-check:disabled + .att-btn { opacity: .55; }
.btn-check:checked:disabled + .att-btn { opacity: .9; }
.att-footer { position: sticky; bottom: 0; z-index: 2; box-shadow: 0 -6px 16px rgba(15, 23, 42, .06); }
@media (max-width: 991.98px) {
  .att-row { grid-template-columns: 1fr; }
  .att-choices { display: grid; grid-template-columns: repeat(4, 1fr); }
  .att-btn { min-width: 0; padding-left: 4px; padding-right: 4px; }
}
.att-rate { font-weight: 700; color: var(--tone); font-variant-numeric: tabular-nums; }
.journal { font-size: .85rem; }
.journal th, .journal td { white-space: nowrap; }
.journal-name { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 170px; }
.journal thead th { background: var(--surface-2); font-weight: 600; }
.journal thead .journal-name { background: var(--surface-2); }
.journal-day { text-align: center; padding: 6px 4px !important; min-width: 38px; }
.journal-day a { color: inherit; text-decoration: none; line-height: 1.1; display: block; }
.journal-day small { font-size: .65rem; text-transform: uppercase; color: var(--bs-secondary-color); }
.journal-day.today { box-shadow: inset 0 -3px 0 var(--accent); }
.journal-cell { text-align: center; padding: 6px 4px !important; }
.att-dot { display: inline-flex; width: 24px; height: 24px; border-radius: 7px; align-items: center; justify-content: center;
  font-size: .8rem; color: var(--tone); background: rgba(var(--tone-rgb), .14); vertical-align: middle; }
.att-dot.empty { background: transparent; color: var(--bs-secondary-color); }

/* Moliya */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fin-label { font-size: .75rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .04em; }
.fin-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) { .fin-stats { grid-template-columns: repeat(2, 1fr); } }
.fin-balance { text-align: right; padding: 10px 16px; border-radius: 14px; background: var(--surface-2); min-width: 220px; }
.fin-balance .fin-big { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fin-balance.debt { background: rgba(220, 38, 38, .08); }
.fin-balance.debt .fin-big { color: #dc2626; }
.fin-balance.credit { background: rgba(22, 163, 74, .08); }
.fin-balance.credit .fin-big { color: #16a34a; }
[data-bs-theme="dark"] .fin-balance.debt .fin-big { color: #f87171; }
[data-bs-theme="dark"] .fin-balance.credit .fin-big { color: #34d399; }
@media (max-width: 575.98px) { .fin-balance { text-align: left; width: 100%; } }
.debt-chip { font-size: .7rem; }

/* Yangi o'quvchini guruhga yozish bloki (foydalanuvchi formasi) */
.enroll-box { background: var(--surface); border: 1px dashed var(--line); border-radius: .75rem; padding: .9rem 1rem; }

/* Moliyaviy hisobot: 12 oylik ikki qatorli grafik */
.duo-chart { display: flex; align-items: stretch; gap: 8px; height: 190px; }
.duo-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; border-radius: 8px; }
.duo-track { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 0 2px; border-radius: 8px;
  background: repeating-linear-gradient(to top, transparent 0 33%, var(--line) 33% calc(33% + 1px)); }
.duo-bar { flex: 1; max-width: 18px; border-radius: 6px 6px 3px 3px; transition: height .5s cubic-bezier(.2, .9, .3, 1); }
.duo-bar.charged, .duo-dot.charged { background: rgba(var(--accent-rgb), .28); }
.duo-bar.collected, .duo-dot.collected { background: var(--accent); }
.duo-col:hover .duo-track { background-color: var(--surface-2); }
.duo-col.selected .duo-track { background-color: rgba(var(--accent-rgb), .08); }
.duo-col.selected .bar-label { color: var(--bs-emphasis-color); font-weight: 600; }
.duo-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.share-row + .share-row { margin-top: 14px; }
@media (max-width: 576px) { .duo-chart { gap: 3px; } .duo-track { gap: 1px; } }

/* Chop etish (kassa hisoboti): menyu va tugmalar chiqmaydi */
.print-only { display: none; }
@media print {
  .app-sidebar, .app-topbar, .no-print, .toast-container { display: none !important; }
  .print-only { display: block; }
  body, main { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  a { color: inherit !important; text-decoration: none !important; }
}

/* Boshqa guruhga o'tkazish oynasi */
.transfer-members { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.transfer-member { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; margin: 0; }
.transfer-member:hover { background: var(--surface-2); }
.transfer-member small { margin-left: auto; }
.transfer-note { padding: 10px 12px; border-radius: 12px; background: rgba(var(--accent-rgb), .08); color: var(--bs-body-color); }

/* Kurslar sahifasi: kursdagi guruhlar */
.course-groups { margin: 0 -6px 12px; }
.course-group { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; color: inherit; text-decoration: none; }
.course-group:hover { background: var(--surface-2); color: inherit; }
.course-group + .course-group { border-top: 1px solid var(--line); }
.course-group-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb), .12); color: var(--accent); }
.course-group-count { flex-shrink: 0; font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--bs-secondary-color); }
.min-w-0 { min-width: 0; }

/* Parol ko'zchasi (static/js/app.js) */
.pw-toggle { cursor: pointer; color: var(--bs-secondary-color); }
.pw-toggle:hover { color: var(--bs-body-color); }
input::-ms-reveal, input::-ms-clear { display: none; } /* Edge'ning o'z ko'zchasi ikkilanmasin */
