/* ===== O'quv Markaz LMS — zamonaviy UI ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e6eaf2;
  --primary: #3b5bfd;
  --primary-2: #2563eb;
  --primary-dark: #1e40af;
  --primary-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --red: #dc2626;
  --red-soft: #fdecec;
  --orange: #ea580c;
  --orange-soft: #fff1e6;
  --violet: #7c3aed;
  --sidebar-bg: #0b1220;
  --sidebar-text: #94a3b8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 6px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, .07), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, .16);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Tungi rejim tokenlari */
body.dark {
  --bg: #0b1220;
  --card: #131c30;
  --text: #e8ecf5;
  --text-2: #c4ccdb;
  --muted: #8b96ab;
  --border: #202c46;
  --primary-soft: #1c2647;
  --green-soft: rgba(34, 197, 94, .16);
  --red-soft: rgba(239, 68, 68, .16);
  --orange-soft: rgba(249, 115, 22, .17);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 6px rgba(0, 0, 0, .25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .4), 0 2px 4px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .55);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 400px at 85% -100px, rgba(59, 91, 253, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.45;
  transition: background .3s, color .3s;
}
body.dark {
  background:
    radial-gradient(900px 420px at 85% -100px, rgba(59, 91, 253, .12), transparent 60%),
    radial-gradient(700px 380px at -100px 100%, rgba(124, 58, 237, .08), transparent 60%),
    var(--bg);
}
.hidden { display: none !important; }

/* Yuklanish chizig'i */
#loadbar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 300;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 0 3px 3px 0; opacity: 0;
  transition: width .35s ease, opacity .3s;
  box-shadow: 0 0 10px rgba(59, 91, 253, .6);
}

::selection { background: rgba(59, 91, 253, .18); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== Ikonkalar ===== */
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-icon svg { width: 15px; height: 15px; }

/* ===== Login ===== */
.login-screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #0b1220;
  overflow: hidden;
}
.login-screen::before, .login-screen::after {
  content: ''; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  filter: blur(80px); opacity: .55; pointer-events: none;
  animation: blob 11s ease-in-out infinite alternate;
}
.login-screen::before { background: var(--primary); top: -140px; left: -100px; }
.login-screen::after { background: var(--violet); bottom: -160px; right: -120px; animation-delay: -5s; }
@keyframes blob {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.18); }
}
.login-box {
  background: rgba(255, 255, 255, .97);
  padding: 44px 40px 36px;
  border-radius: 22px;
  width: 360px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, .08);
  animation: rise .45s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 76px; height: 76px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  border-radius: 22px; color: #fff;
  box-shadow: 0 10px 26px rgba(59, 91, 253, .38);
}
.login-logo svg, .login-logo img { width: 52px; height: 52px; }
.login-box h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-box p { color: var(--muted); font-size: 13.5px; margin: 4px 0 22px; }
.login-box input {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 15px; margin-bottom: 12px; font-family: inherit; background: #f8fafc;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.login-box input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(59, 91, 253, .12); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; font-weight: 500; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 40;
  background: linear-gradient(180deg, #0d1526 0%, var(--sidebar-bg) 100%);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 11px; padding: 22px 20px;
  font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: #fff;
}
.sidebar-logo svg, .sidebar-logo img {
  width: 36px; height: 36px; padding: 5px; border-radius: 11px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  box-shadow: 0 6px 16px rgba(59, 91, 253, .35);
}
.sidebar nav { flex: 1; padding: 10px 12px; overflow-y: auto; }
.sidebar nav::-webkit-scrollbar-thumb { border-color: var(--sidebar-bg); background: #1e293b; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10.5px 13px; margin: 3px 0;
  border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--sidebar-text); text-decoration: none; border: none; background: none;
  width: 100%; text-align: left; font-family: inherit;
  transition: background .15s, color .15s, transform .1s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }
.nav-item:active { transform: scale(.98); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 600;
  box-shadow: 0 6px 16px rgba(59, 91, 253, .35);
}
.sidebar-user { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user-name { font-size: 13.5px; font-weight: 700; color: #e2e8f0; }
.sidebar-user-role { font-size: 12px; color: #64748b; margin-top: 1px; }
.logout { margin: 6px 12px 14px; width: calc(100% - 24px); color: #f87171; }
.logout:hover { background: rgba(248, 113, 113, .12); color: #fca5a5; }
.main { flex: 1; margin-left: 250px; padding: 26px 32px 40px; min-width: 0; }

/* ===== Topbar (yopishqoq shisha) ===== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  margin: -26px -32px 22px; padding: 16px 32px;
  background: rgba(244, 246, 251, .78);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(15, 23, 42, .06);
}
body.dark .topbar { background: rgba(11, 18, 32, .72); border-bottom-color: rgba(255, 255, 255, .06); }
.topbar h2 {
  font-size: 24px; font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--text) 60%, var(--primary) 140%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  width: 40px; height: 38px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: all .2s;
}
.theme-btn svg { width: 17px; height: 17px; transition: transform .4s; }
.theme-btn:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.theme-btn:hover svg { transform: rotate(25deg); }
.month-input {
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--card); font-family: inherit; color: var(--text-2);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.month-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59, 91, 253, .1); }

/* ===== Stat kartalar ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 13px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
  animation: fadeUp .4s both;
}
.stat-card:nth-child(2) { animation-delay: .04s; }
.stat-card:nth-child(3) { animation-delay: .08s; }
.stat-card:nth-child(4) { animation-delay: .12s; }
.stat-card:nth-child(5) { animation-delay: .16s; }
.stat-card:nth-child(6) { animation-delay: .2s; }
.stat-card:nth-child(7) { animation-delay: .24s; }
.stat-card:nth-child(8) { animation-delay: .28s; }
.stat-card:nth-child(9) { animation-delay: .32s; }
.stat-card:nth-child(10) { animation-delay: .36s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: 0 6px 14px rgba(100, 116, 139, .3);
}
.stat-icon svg { width: 21px; height: 21px; }
.accent-blue .stat-icon { background: linear-gradient(135deg, var(--primary), var(--violet)); box-shadow: 0 6px 14px rgba(59, 91, 253, .35); }
.accent-green .stat-icon { background: linear-gradient(135deg, #22c55e, #15803d); box-shadow: 0 6px 14px rgba(22, 163, 74, .32); }
.accent-red .stat-icon { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 6px 14px rgba(220, 38, 38, .32); }
.accent-orange .stat-icon { background: linear-gradient(135deg, #f97316, #c2410c); box-shadow: 0 6px 14px rgba(234, 88, 12, .32); }
.stat-body { min-width: 0; }
.stat-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page { animation: fadeUp .3s both; }

/* ===== Kartalar va chartlar ===== */
.card {
  background: var(--card); border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 18px;
}
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 15px; letter-spacing: -.01em; }
.chart-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.chart-grid .card { margin-bottom: 18px; }
.chart-grid canvas { max-height: 250px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

/* ===== Jadvallar ===== */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.table tbody tr { transition: background .12s; animation: rowIn .3s both; }
.table tbody tr:nth-child(1) { animation-delay: .02s; }
.table tbody tr:nth-child(2) { animation-delay: .05s; }
.table tbody tr:nth-child(3) { animation-delay: .08s; }
.table tbody tr:nth-child(4) { animation-delay: .11s; }
.table tbody tr:nth-child(5) { animation-delay: .14s; }
.table tbody tr:nth-child(6) { animation-delay: .17s; }
.table tbody tr:nth-child(7) { animation-delay: .2s; }
.table tbody tr:nth-child(8) { animation-delay: .23s; }
.table tbody tr:nth-child(n+9) { animation-delay: .26s; }
@keyframes rowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.table tbody tr:hover { background: #f7f9fd; }
body.dark .table tbody tr:hover { background: #182340; }
.table tbody tr:last-child td { border-bottom: none; }
body.dark .table td { border-bottom-color: #1a2440; }
.pos { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.neg { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Avatar (ism bosh harflari) */
.cell-name { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 3px 8px rgba(15, 23, 42, .18);
}

/* Bo'sh holat */
.empty-row td {
  text-align: center; padding: 34px 12px !important; color: var(--muted); font-size: 14px;
}

.badge {
  display: inline-block; padding: 3.5px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap;
}
.badge-green { background: var(--green-soft); color: #15803d; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-red { background: var(--red-soft); color: #b91c1c; }
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge-orange { background: var(--orange-soft); color: #c2410c; }

/* ===== Tugmalar ===== */
.btn {
  padding: 10px 18px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); cursor: pointer; font-size: 14px; font-weight: 600;
  font-family: inherit; color: var(--text-2);
  transition: all .15s; box-shadow: var(--shadow-sm);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: #f8fafc; border-color: #d7dce7; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(59, 91, 253, .3);
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ''; position: absolute; top: 0; left: -70%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-20deg); transition: left .5s ease;
}
.btn-primary:hover::after { left: 130%; }
.btn-primary:hover { background: linear-gradient(135deg, #3050f0, #1d4ed8); filter: brightness(1.03); }
.btn.loading { pointer-events: none; opacity: .85; }
.btn.loading::before {
  content: ''; width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-block { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.btn-icon {
  padding: 7px; font-size: 13px; border: none; background: none; cursor: pointer;
  border-radius: 8px; color: var(--muted); transition: background .12s, color .12s;
  display: inline-flex; align-items: center;
}
.btn-icon:hover { background: var(--primary-soft); color: var(--primary); }
.page-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.search-input {
  padding: 10px 15px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; width: 290px; max-width: 100%; font-family: inherit; background: var(--card);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(59, 91, 253, .1); }
.kassa-balance { font-size: 16px; font-weight: 500; }
.kassa-balance b { font-variant-numeric: tabular-nums; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(11, 18, 32, .55);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
  background: #fff; border-radius: 18px; width: 480px; max-width: 100%;
  max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: rise .3s cubic-bezier(.2, .9, .3, 1.15);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px 0; }
.modal-header h3 { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.modal-close {
  border: none; background: #f1f5f9; width: 30px; height: 30px; border-radius: 9px;
  font-size: 14px; cursor: pointer; color: var(--muted); transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--red-soft); color: var(--red); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10.5px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: #f8fafc; color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(59, 91, 253, .1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 26px; right: 26px; z-index: 200;
  background: rgba(13, 21, 38, .96); color: #fff; padding: 14px 20px;
  border-radius: 13px; font-size: 14px; font-weight: 500; max-width: 380px;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255, 255, 255, .08);
  animation: toast-in .3s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.toast.error { background: linear-gradient(135deg, #b91c1c, #dc2626); border-color: rgba(255, 255, 255, .15); }

/* ===== Dars jadvali ===== */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 18px; }
.day-col {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); padding: 12px; min-height: 130px;
}
.day-col h4 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700;
  color: var(--muted); text-align: center; margin-bottom: 11px; padding-bottom: 9px;
  border-bottom: 2px solid var(--border);
}
.day-col.today { border-color: rgba(59, 91, 253, .35); box-shadow: 0 0 0 3px rgba(59, 91, 253, .08), var(--shadow-sm); }
.day-col.today h4 { color: var(--primary); border-bottom-color: var(--primary); }
.lesson-card {
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid rgba(59, 91, 253, .15);
  border-radius: 11px; padding: 9px 11px; margin-bottom: 9px; font-size: 13px; position: relative;
  transition: transform .15s, box-shadow .15s;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lesson-time { font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.lesson-group { font-weight: 600; margin: 3px 0 1px; }
.lesson-teacher { color: var(--muted); font-size: 12px; }
.lesson-del {
  position: absolute; top: 7px; right: 7px; border: none; background: none;
  cursor: pointer; color: #b6bfd0; padding: 3px; border-radius: 6px;
  transition: color .12s, background .12s;
}
.lesson-del:hover { color: var(--red); background: var(--red-soft); }
.lesson-del svg { width: 13px; height: 13px; }
@media (max-width: 1100px) { .week-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== Ruxsat matritsasi ===== */
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 4px; }
.perm-matrix th, .perm-matrix td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.perm-matrix tr:last-child td { border-bottom: none; }
.perm-matrix select {
  padding: 6px 9px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #f8fafc;
}
.perm-tag {
  display: inline-block; padding: 2.5px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; margin: 1.5px;
}
.perm-tag.view { background: var(--primary-soft); color: var(--primary-dark); }
.perm-tag.full { background: var(--green-soft); color: #15803d; }

/* ===== Command palette (Ctrl+K) ===== */
.cmdk-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); cursor: pointer; color: var(--muted);
  font-family: inherit; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-sm); transition: all .2s;
}
.cmdk-btn svg { width: 15px; height: 15px; }
.cmdk-btn:hover { border-color: var(--primary); color: var(--text-2); transform: translateY(-1px); }
kbd {
  font-family: inherit; font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 7px;
}
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(11, 18, 32, .5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px;
}
.cmdk {
  width: 560px; max-width: 100%; background: var(--card); border-radius: 18px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden;
  animation: rise .25s cubic-bezier(.2, .9, .3, 1.15);
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.cmdk-input-wrap svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.cmdk-input-wrap input { flex: 1; border: none; outline: none; background: none; font-family: inherit; font-size: 15.5px; color: var(--text); }
.cmdk-list { max-height: 380px; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 11px; cursor: pointer; transition: background .1s;
}
.cmdk-item svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.cmdk-item.active { background: var(--primary-soft); }
.cmdk-item.active svg { color: var(--primary); }
.cmdk-item-main { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; }
.cmdk-sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.cmdk-type { font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 99px; padding: 3px 9px; font-weight: 600; }
.cmdk-empty { text-align: center; color: var(--muted); padding: 26px; font-size: 14px; }

/* ===== Tasdiqlash dialogi ===== */
.confirm-box {
  background: var(--card); border-radius: 18px; width: 380px; max-width: 94vw;
  padding: 28px 26px 22px; text-align: center; box-shadow: var(--shadow-lg);
  animation: rise .25s cubic-bezier(.2, .9, .3, 1.2);
}
.confirm-icon {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
  background: var(--red-soft); color: var(--red);
}
.confirm-icon svg { width: 26px; height: 26px; }
.confirm-box h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.confirm-box p { color: var(--muted); font-size: 14px; line-height: 1.55; margin-bottom: 20px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-actions .btn { min-width: 120px; justify-content: center; }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(220, 38, 38, .3);
}
.btn-danger:hover { filter: brightness(1.06); background: linear-gradient(135deg, #ef4444, #b91c1c); }

/* Fokus halqalari (klaviatura) */
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* Toast ikonkali */
.toast { display: flex; align-items: center; gap: 10px; }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; color: #4ade80; }
.toast.error svg { color: #fff; }

/* ===== O'quvchi profili ===== */
.modal-wide { width: 660px; }
.detail-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.detail-head .avatar { width: 46px; height: 46px; font-size: 16px; border-radius: 14px; }
.detail-name { font-size: 17px; font-weight: 800; }
.detail-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.dstat { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.dstat-l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 4px; }
.dstat-v { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.detail-h { font-size: 13.5px; font-weight: 700; margin: 14px 0 8px; }
.detail-scroll { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }
.detail-scroll .table th { position: sticky; top: 0; background: var(--card); z-index: 2; }
.detail-scroll .table td, .detail-scroll .table th { padding: 8px 11px; font-size: 13px; }
@media (max-width: 600px) { .detail-stats { grid-template-columns: repeat(2, 1fr); } }

/* ===== Kutubxona ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 17px; border: 1.5px solid var(--border); border-radius: 99px;
  background: var(--card); cursor: pointer; font-family: inherit; font-size: 14px;
  font-weight: 600; color: var(--muted); transition: all .18s; box-shadow: var(--shadow-sm);
}
.tab:hover { color: var(--text-2); transform: translateY(-1px); }
.tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(59, 91, 253, .3);
}
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.book-card {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s; animation: fadeUp .35s both;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.book-cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); }
.book-cover.placeholder { display: flex; align-items: center; justify-content: center; font-size: 44px; color: var(--muted); }
body.dark .book-cover { background: linear-gradient(135deg, #1e2a45, #16203a); }
.book-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.book-title { font-weight: 700; font-size: 14px; line-height: 1.3; }
.book-author { color: var(--muted); font-size: 12.5px; }
.book-price { font-weight: 800; color: var(--primary); font-size: 15px; margin-top: auto; padding-top: 6px; }
.book-actions { display: flex; gap: 6px; margin-top: 9px; }
.book-actions .btn { padding: 6px 10px; font-size: 12.5px; flex: 1; justify-content: center; box-shadow: none; }

/* ===== Tungi rejim qo'shimchalari ===== */
body.dark .modal { background: var(--card); }
body.dark .modal-close { background: #1e2a45; color: var(--muted); }
body.dark .form-group input, body.dark .form-group select, body.dark .form-group textarea,
body.dark .perm-matrix select { background: #0e1628; color: var(--text); border-color: var(--border); }
body.dark .form-group input:focus, body.dark .form-group select:focus, body.dark .form-group textarea:focus { background: #101a30; }
body.dark .btn { background: var(--card); color: var(--text-2); border-color: var(--border); }
body.dark .btn:hover { background: #182238; border-color: #2b3a5e; }
body.dark .btn-primary { color: #fff; }
body.dark .search-input, body.dark .month-input { background: var(--card); color: var(--text); border-color: var(--border); }
body.dark .badge-gray { background: #1e2a45; color: #94a3b8; }
body.dark .lesson-card { background: linear-gradient(135deg, #1b2547, #241d45); border-color: rgba(99, 102, 241, .28); }
body.dark .lesson-del { color: #4c5a7a; }
body.dark .btn-icon:hover { background: var(--primary-soft); }
body.dark ::-webkit-scrollbar-thumb { background: #2b3a5e; border-color: var(--bg); }
body.dark ::-webkit-scrollbar-thumb:hover { background: #3b4d78; }
body.dark .toast { background: rgba(24, 34, 58, .97); }
body.dark .doughnut-border { color: #131c30; }

/* ===== Mobil ===== */
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar-logo span, .nav-item span, .sidebar-user { display: none; }
  .sidebar-logo { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .main { margin-left: 64px; padding: 16px 14px 30px; }
  .topbar { margin: -16px -14px 16px; padding: 12px 14px; }
  .topbar h2 { font-size: 20px; }
  .table { font-size: 12.5px; }
  .table td, .table th { padding: 8px; }
  .card { overflow-x: auto; padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 18px; }
}
