/* ============================================================================
   IMKON EDU — boshqaruv paneli dizayn tizimi
   ============================================================================

   Bu fayl ikki qismdan iborat:

     1. TOKENLAR  — rang, o'lcham, radius, soya, harakat. Hamma narsa shu
                    yerdan oziqlanadi; sahifalarda «qo'lda» rang yozilmaydi.
     2. KOMPONENTLAR — qobiq, kartochka, tugma, jadval, forma, belgi...

   Nima uchun Tailwind emas: panel Django shablonlarida yozilgan va loyihada
   Node yo'q. Tailwind'ni CDN dan olish admin panel uchun tashqi bog'liqlik
   bo'lardi — u yiqilsa panel butunlay uslubsiz qolardi. Qo'lda yozilgan
   tizim esa bitta fayl, keshlanadi va hech qayerga qaramaydi.

   QORONG'I REJIM teskari rang emas: uning o'z qatlamlari bor (fon → yuza →
   ko'tarilgan yuza), chegaralari boshqacha va matn kontrasti alohida
   sozlangan. `[data-theme]` atributi bilan boshqariladi, tanlov esa
   `localStorage` da saqlanadi.
   ========================================================================= */


/* ============================ 1. TOKENLAR ============================ */

:root {
  color-scheme: light;

  /* --- Sirtlar: pastdan yuqoriga qatlamlar --- */
  --bg:            #f6f8fc;   /* sahifa foni */
  --surface:       #ffffff;   /* kartochka */
  --surface-2:     #f9fafc;   /* kartochka ichidagi bo'lim */
  --surface-3:     #eef1f7;   /* jadval sarlavhasi, kirish maydoni foni */
  --overlay:       rgba(14, 18, 32, .45);

  /* --- Yon menyu: sahifadan alohida, doim to'q --- */
  --nav-bg:        #0e1424;
  --nav-bg-2:      #161e33;
  --nav-text:      #aab4c8;
  --nav-text-hi:   #ffffff;
  --nav-muted:     #64708a;
  --nav-line:      rgba(255, 255, 255, .07);

  /* --- Matn --- */
  --text:          #101828;
  --text-2:        #475467;
  --text-3:        #8b95a8;
  --on-primary:    #ffffff;

  /* --- Chegaralar --- */
  --line:          #e5e9f0;
  --line-2:        #d7dde8;

  /* --- Brend --- */
  --primary:       #4f46e5;
  --primary-hi:    #4338ca;
  --primary-lo:    #eef0ff;
  --primary-ring:  rgba(79, 70, 229, .16);
  --accent:        #0ea5a5;

  /* --- Holat ranglari --- */
  --good:          #059669;
  --good-bg:       #e7f7f0;
  --good-line:     #a7e3ca;

  --warn:          #b45309;
  --warn-bg:       #fdf3e4;
  --warn-line:     #f0d5a6;

  --bad:           #be123c;
  --bad-bg:        #fdeaee;
  --bad-line:      #f4c2ce;

  --info:          #0369a1;
  --info-bg:       #e6f3fb;
  --info-line:     #b3ddf2;

  /* --- Shakl --- */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;

  /* --- Soya: yengil va qatlamli, «quti ostidagi dog'» emas --- */
  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 1px 3px rgba(16, 24, 40, .07), 0 6px 16px -6px rgba(16, 24, 40, .10);
  --sh-3: 0 12px 32px -8px rgba(16, 24, 40, .18);

  /* --- Harakat --- */
  --ease:      cubic-bezier(.22, 1, .36, 1);
  --ease-out:  cubic-bezier(.16, 1, .3, 1);
  --t-fast:    140ms;
  --t-base:    220ms;

  /* --- O'lchov --- */
  --nav-w:     264px;
  --head-h:    62px;
  --page-max:  1560px;
}

/* Qorong'i rejim: aniq tanlov, yoki tizim sozlamasi (`data-theme` yo'q). */
:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  --dark-ready: 1;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #080c17;
  --surface:       #0f1524;
  --surface-2:     #141b2d;
  --surface-3:     #1a2236;
  --overlay:       rgba(3, 6, 14, .66);

  --nav-bg:        #0b1020;
  --nav-bg-2:      #18203a;
  --nav-text:      #97a3ba;
  --nav-text-hi:   #ffffff;
  --nav-muted:     #5b6884;
  --nav-line:      rgba(255, 255, 255, .06);

  --text:          #e8ecf4;
  --text-2:        #9aa6bd;
  --text-3:        #6b7793;

  --line:          #1e263a;
  --line-2:        #2a3450;

  --primary:       #7c74ff;
  --primary-hi:    #918bff;
  --primary-lo:    #1b1f3d;
  --primary-ring:  rgba(124, 116, 255, .22);
  --accent:        #22c4c4;

  --good:          #34d399;
  --good-bg:       #0d2b22;
  --good-line:     #1d5843;

  --warn:          #fbbf24;
  --warn-bg:       #2e2310;
  --warn-line:     #5c471b;

  --bad:           #fb7185;
  --bad-bg:        #2e1119;
  --bad-line:      #5e2333;

  --info:          #38bdf8;
  --info-bg:       #0c2434;
  --info-line:     #1c4a63;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 1px 3px rgba(0, 0, 0, .45), 0 8px 20px -8px rgba(0, 0, 0, .6);
  --sh-3: 0 16px 40px -10px rgba(0, 0, 0, .7);
}


/* ============================ 2. ASOS ============================ */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hi); }

h1, h2, h3, h4 { margin: 0; font-weight: 640; letter-spacing: -.014em; }

code, .mono, .tabular {
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}
.tabular, .num { font-variant-numeric: tabular-nums; }

::selection { background: var(--primary-ring); }

/* Fokus halqasi hamma joyda bir xil va DOIM ko'rinadi — klaviatura bilan
   ishlaydigan odam qayerdaligini yo'qotmasligi kerak. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ============================ 3. QOBIQ ============================ */

.shell { margin-left: var(--nav-w); min-height: 100vh; display: flex; flex-direction: column; }

.content {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  padding: 24px 28px 72px;
}

/* --- Yon menyu --- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav-w);
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  z-index: 60;
  border-right: 1px solid var(--nav-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: var(--head-h);
  flex: 0 0 var(--head-h);
  color: var(--nav-text-hi);
  border-bottom: 1px solid var(--nav-line);
}
.brand:hover { color: var(--nav-text-hi); }

.brand-mark {
  position: relative;
  width: 36px; height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 130%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 13px;
  letter-spacing: .02em;
  box-shadow: 0 4px 12px -3px rgba(79, 70, 229, .55);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 15px; font-weight: 660; letter-spacing: -.015em; }
.brand-text i {
  font-style: normal;
  font-size: 11px;
  color: var(--nav-muted);
  letter-spacing: .01em;
}

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 22px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: var(--nav-bg-2); border-radius: 3px; }

.nav-section + .nav-section { margin-top: 20px; }

.nav-title {
  padding: 0 10px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--nav-muted);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: var(--nav-text);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
}
.nav-item:hover { background: var(--nav-bg-2); color: var(--nav-text-hi); }
.nav-item i { width: 18px; text-align: center; font-size: 15px; color: var(--nav-muted);
              transition: color var(--t-fast) var(--ease); }
.nav-item:hover i { color: var(--nav-text-hi); }
.nav-item span {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Faol bo'lim ikki belgi bilan ko'rsatiladi: fon va chapdagi chiziq.
   Faqat fon bilan cheklansak, kontrast past ekranlarda u yo'qolib ketardi. */
.nav-item.is-active {
  background: linear-gradient(90deg, var(--nav-bg-2), transparent 140%);
  color: var(--nav-text-hi);
  font-weight: 600;
}
.nav-item.is-active i { color: var(--primary-hi); }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  width: 3px; height: 20px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--primary-hi);
  box-shadow: 0 0 12px var(--primary-hi);
}

.nav-tag {
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--nav-muted);
  border: 1px solid var(--nav-line);
  border-radius: 5px;
  padding: 2px 5px;
}

.nav-count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--warn);
  color: #1a1204;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--nav-line);
}
.sidebar-foot a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 11px;
  border-radius: var(--r-md);
  color: var(--nav-muted);
  font-size: 13px;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sidebar-foot a:hover { background: var(--nav-bg-2); color: var(--nav-text-hi); }


/* --- Yuqori panel --- */

.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.head-text { min-width: 0; flex: 0 1 auto; }
.head-text h1 {
  font-size: 16.5px;
  font-weight: 640;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.head-text p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.burger { display: none; }


/* --- Foydalanuvchi menyusi --- */

.umenu { position: relative; }

.umenu-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.umenu-btn:hover { background: var(--surface); border-color: var(--line); }

.avatar {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent) 140%);
  color: #fff;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  text-transform: uppercase;
}

.umenu-name { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.umenu-name b { font-size: 13px; font-weight: 600; }
.umenu-name span { font-size: 11px; color: var(--text-3); }
.umenu-btn .fa-chevron-down { font-size: 10px; color: var(--text-3); }

.dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  min-width: 210px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  z-index: 50;
  transform-origin: top right;
  animation: pop-in var(--t-fast) var(--ease-out);
}
.dropdown[hidden] { display: none; }

.dropdown-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-head b { display: block; font-size: 13.5px; }
.dropdown-head span { font-size: 12px; color: var(--text-3); }

.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0; border-radius: var(--r-sm);
  background: none;
  color: var(--text-2);
  font: inherit; font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); color: var(--text); }
.dropdown i { width: 15px; text-align: center; font-size: 13px; color: var(--text-3); }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to   { opacity: 1; transform: none; }
}


/* ============================ 4. KOMPONENTLAR ============================ */

/* --- Sahifa sarlavhasi --- */

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 24px; font-weight: 680; letter-spacing: -.025em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; max-width: 62ch; }
.page-head .right { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }


/* --- Kartochka --- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card + .card, .card + .grid, .grid + .card { margin-top: 18px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15px; font-weight: 630; }
.card-head .sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.card-body { padding: 20px; }

/* Jadval bevosita kartochka ichida tursa chegaralari ikkilanmasin */
.card > .table:last-child tr:last-child td { border-bottom: 0; }


/* --- Statistika kartochkalari --- */

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat {
  position: relative;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }

.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.stat-ico {
  width: 32px; height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 14px;
  background: var(--primary-lo);
  color: var(--primary);
}
.stat-ico.is-good { background: var(--good-bg); color: var(--good); }
.stat-ico.is-warn { background: var(--warn-bg); color: var(--warn); }
.stat-ico.is-bad  { background: var(--bad-bg);  color: var(--bad); }
.stat-ico.is-info { background: var(--info-bg); color: var(--info); }
.stat-ico.is-gold { background: #fdf3d8; color: #a67c00; }

.stat-label { font-size: 12.5px; font-weight: 550; color: var(--text-3); }
.stat b {
  display: block;
  font-size: 27px; font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat .hint { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }


/* --- Tugmalar --- */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-line: var(--line-2);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--btn-line);
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: 13.5px;
  font-weight: 570;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-3); color: var(--btn-fg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; transform: none;
}
.btn i { font-size: 13px; }

.btn-primary {
  --btn-bg: var(--primary);
  --btn-fg: var(--on-primary);
  --btn-line: var(--primary);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 4px 12px -4px var(--primary-ring);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hi); border-color: var(--primary-hi); color: var(--on-primary);
}

.btn-ghost { --btn-bg: transparent; --btn-line: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-danger { --btn-fg: var(--bad); --btn-line: var(--bad-line); }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }

.btn-good { --btn-fg: var(--good); --btn-line: var(--good-line); }
.btn-good:hover:not(:disabled) { background: var(--good-bg); }

.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }

/* Yuklanish holati: matn joyida qoladi, oldiga aylanma qo'shiladi —
   tugmaning kengligi sakramasin. */
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn.is-busy::before {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* --- Belgilar (badge) --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge i { font-size: 10px; }

.badge-good { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.badge-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge-bad  { background: var(--bad-bg);  border-color: var(--bad-line);  color: var(--bad); }
.badge-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }
.badge-mute { background: var(--surface-3); border-color: var(--line); color: var(--text-3); }
.badge-primary { background: var(--primary-lo); border-color: var(--primary-ring); color: var(--primary); }

/* Nuqtasiz ko'rinish — toifa harfi kabi qisqa yorliqlar uchun */
.badge-plain::before { display: none; }
.badge-plain { padding: 3px 10px; }


/* --- Jadval --- */

.table-wrap { width: 100%; overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table thead th {
  padding: 11px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: left;
  white-space: nowrap;
}

/* Ustun ko'p bo'lgan jadval uchun tor yonlar. To'qqizta ustunda oddiy
   kenglik faqat bo'shliqqa 180px yeb, oxirgi ustundagi tugmani ekrandan
   chiqarib yuborardi. */
.table-compact thead th, .table-compact td { padding-left: 11px; padding-right: 11px; }

/* Sana o'rtasidan bo'linmasin - «02.09.2026» va «10:06» bitta qiymat. */
.table .nowrap { white-space: nowrap; }

.table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

/* Vertikal chiziqlar YO'Q — ajratish uchun bo'shliq va yengil gorizontal
   chiziq yetadi, panjara esa ma'lumotni og'irlashtiradi. */
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

.table .num { text-align: right; white-space: nowrap; }
.table .sub { font-size: 12px; color: var(--text-3); }
.table b { font-weight: 600; }

.cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.cell-ico {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary-lo);
  color: var(--primary);
  font-size: 14px;
}
.cell-text { min-width: 0; }
.cell-text b { display: block; font-size: 13.5px; }


/* --- Bo'sh holat --- */

.empty {
  padding: 56px 24px;
  text-align: center;
}
.empty-ico {
  width: 60px; height: 60px;
  margin: 0 auto 16px;
  border-radius: var(--r-lg);
  display: grid; place-items: center;
  font-size: 24px;
  background: var(--surface-3);
  color: var(--text-3);
}
.empty h3 { font-size: 16px; font-weight: 620; }
.empty p { margin: 6px auto 0; max-width: 42ch; color: var(--text-3); font-size: 13.5px; }
.empty .btn { margin-top: 18px; }


/* --- Xabarlar --- */

.messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }

.msg {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 13.5px;
  animation: slide-in var(--t-base) var(--ease-out);
}
.msg i { font-size: 15px; margin-top: 1px; }
.msg-success { background: var(--good-bg); border-color: var(--good-line); color: var(--good); }
.msg-error   { background: var(--bad-bg);  border-color: var(--bad-line);  color: var(--bad); }
.msg-warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.msg-info    { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}


/* --- Formalar --- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12px; color: var(--bad); font-weight: 550; }

/* Ro'yxat TUR bo'yicha yozilgan (`input` deb qo'yib bo'lmaydi: u
   katakcha va radio tugmani ham bosib ketardi). Ya'ni yangi tur
   qo'shilganda uni SHU YERGA qo'shish kerak - aks holda maydon
   brauzerning o'z ko'rinishida qolib, formadan ajralib turadi. Aynan
   shu `datetime-local` bilan bo'lgan. */
input[type=text], input[type=number], input[type=search],
input[type=password], input[type=date], input[type=time],
input[type=datetime-local], select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-ring);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-3); color: var(--text-3); cursor: not-allowed;
}

textarea { resize: vertical; min-height: 74px; line-height: 1.55; }

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%238b95a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.row { display: flex; flex-wrap: wrap; gap: 14px; }
.row > .field { flex: 1 1 200px; }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.check input {
  width: 17px; height: 17px;
  min-height: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.check.is-locked { opacity: .55; cursor: not-allowed; }


/* --- Skelet yuklanish --- */

.skel {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg,
    var(--surface-3) 25%,
    color-mix(in srgb, var(--surface-3) 55%, var(--surface)) 37%,
    var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }


/* --- Modal --- */

.modal-back {
  position: fixed; inset: 0;
  z-index: 90;
  display: grid; place-items: center;
  padding: 20px;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  animation: fade-in var(--t-fast) var(--ease);
}
.modal-back[hidden] { display: none; }

.modal {
  width: min(100%, 980px);
  max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  overflow: hidden;
  animation: modal-in var(--t-base) var(--ease-out);
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15px; flex: 1; min-width: 0; }
.modal-body { padding: 0; overflow: auto; background: var(--surface-2); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}


/* --- Sahifa kirish animatsiyasi --- */

.content > * { animation: rise var(--t-base) var(--ease-out) backwards; }
.content > *:nth-child(2) { animation-delay: 40ms; }
.content > *:nth-child(3) { animation-delay: 80ms; }
.content > *:nth-child(4) { animation-delay: 120ms; }
.content > *:nth-child(n+5) { animation-delay: 150ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}


/* --- Pastki qatlam (saqlash paneli) --- */

.dock {
  position: sticky;
  bottom: 0;
  z-index: 30;
  margin: 22px -28px -72px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.dock-state { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.dock .btn { margin-left: auto; }


/* ============================ 5. MOSLASHUVCHANLIK ============================ */

@media (max-width: 1100px) {
  .content { padding: 20px 20px 72px; }
  .header { padding: 0 20px; }
  .dock { margin: 22px -20px -72px; padding: 14px 20px; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
    box-shadow: var(--sh-3);
  }
  .shell { margin-left: 0; }

  .burger { display: inline-flex; }

  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }

  .nav-backdrop {
    position: fixed; inset: 0;
    z-index: 55;
    background: var(--overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base) var(--ease);
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  .head-text p { display: none; }
  .umenu-name { display: none; }
  .umenu-btn .fa-chevron-down { display: none; }
}

@media (max-width: 640px) {
  .content { padding: 16px 14px 76px; }
  .header { padding: 0 14px; gap: 10px; }
  .dock { margin: 18px -14px -76px; padding: 12px 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head .right { width: 100%; }
  .page-head .right .btn { flex: 1; }
  .card-head, .card-body { padding: 14px; }
  .table thead th, .table td { padding: 11px 14px; }
}


/* --- Chaqiruv chizig'i (callout) --- */
/* Sahifaning boshida turadigan, bosiladigan xabar. Kartochkadan farqi:
   u ma'lumot ko'rsatmaydi, KEYINGI QADAMni taklif qiladi. */

.callout {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.callout:hover { border-color: var(--primary); box-shadow: var(--sh-2); }

.callout-ico {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 15px;
}
.callout-warn .callout-ico { background: var(--warn-bg); color: var(--warn); }

.callout-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.callout-text b { font-size: 14px; font-weight: 620; }
.callout-text span { font-size: 12.5px; color: var(--text-3); }

.callout-go {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .callout { flex-wrap: wrap; }
  .callout-go { margin-left: 52px; }
}


/* --- Asboblar qatori: filtr yorliqlari + qidiruv --- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

/* Yorliqlar HAVOLA, tugma emas: har biri o'z manziliga ega bo'lishi
   kerak - admin havolani saqlab qo'ya oladi va «orqaga» ishlaydi. */
.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
}
.seg-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg-item:hover { color: var(--text); }
.seg-item em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-3);
}
.seg-item.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-1);
}
.seg-item.is-on em { background: var(--primary-lo); color: var(--primary); }

.searchbox {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 280px;
  max-width: 460px;
}
.searchbox > i {
  position: absolute;
  left: 12px;
  font-size: 12px;
  color: var(--text-3);
  pointer-events: none;
}
.searchbox input[type=search] {
  flex: 1;
  min-width: 0;
  padding-left: 32px;
}
/* Brauzerning o'z «tozalash» xochi olib tashlanadi: bizda alohida tugma
   bor va ikkitasi yonma-yon turgani chalkashtirardi. */
.searchbox input[type=search]::-webkit-search-cancel-button { display: none; }

@media (max-width: 720px) {
  .toolbar { gap: 10px; }
  .searchbox { margin-left: 0; max-width: none; }
  .seg { width: 100%; overflow-x: auto; }
}


/* --- Sahifalash --- */

.pager {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
}
.pager-info { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pager-btns { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pager-now {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 62px;
  text-align: center;
}
/* Chetki sahifada tugma HAVOLA EMAS, oddiy `span`: bosilmaydigan havola
   sichqonchani ham, klaviaturani ham aldab qo'yardi. */
.btn.is-off { opacity: .4; cursor: default; pointer-events: none; }


/* --- Navbatni boshlash --- */

.queue-start {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.queue-start .hint { flex: 1 1 260px; margin: 0; }
.queue-start .btn { margin-left: auto; }
@media (max-width: 640px) {
  .queue-start .btn { margin-left: 0; width: 100%; }
}

/* Jadvaldagi «e'tibor kerak» soni. */
.is-warn-text { color: var(--warn); }


/* --- Reyting: yuqori o'rinlar --- */
/* Uchta ustunli «podium» EMAS, ro'yxat: teng ball teng o'rin oladi, ya'ni
   birinchi o'rinda uch kishi bo'lishi mumkin va qat'iy uch ustunli
   tuzilma buni ko'rsata olmasdi. */

.podium { display: flex; flex-direction: column; gap: 9px; }

.podium-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
/* Faqat birinchi o'rin ajratiladi. Ikkinchi va uchinchini ham bo'yash
   ro'yxatni chipor qilib, birinchining ma'nosini yo'qotardi. */
.podium-item.is-p1 {
  border-color: #e8d08a;
  background: linear-gradient(90deg, #fdf6e3 0%, var(--surface-2) 60%);
}
:root[data-theme="dark"] .podium-item.is-p1 {
  border-color: #5c471b;
  background: linear-gradient(90deg, #2a2210 0%, var(--surface-2) 60%);
}

.podium-place {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.podium-item.is-p1 .podium-place { background: #f0d68a; color: #6b4e00; }
:root[data-theme="dark"] .podium-item.is-p1 .podium-place {
  background: #5c471b; color: #f0d68a;
}

.podium-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.podium-text b { font-size: 14px; font-weight: 620; }

.podium-score {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-variant-numeric: tabular-nums;
}
.podium-score b { font-size: 17px; font-weight: 680; }


/* --- Reyting: toifalar taqsimoti --- */

.grade-rows { display: flex; flex-direction: column; gap: 8px; }

.grade-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.grade-name { flex: 0 0 92px; font-weight: 620; }
.grade-limit { flex: 0 0 78px; font-size: 12px; color: var(--text-3); }

.grade-bar {
  flex: 1;
  min-width: 60px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.grade-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}
/* Sertifikatsizlar boshqa rangda: ular «yomon natija» emas, lekin
   toifalar bilan bitta rangda turgani ularni toifa deb ko'rsatardi. */
.grade-fill.is-none { background: var(--text-3); }

.grade-count { flex: 0 0 40px; text-align: right; font-weight: 620; }
.grade-percent { flex: 0 0 44px; text-align: right; }

@media (max-width: 640px) {
  .grade-limit { display: none; }
  .grade-name { flex: 0 0 78px; }
}


/* --- Reyting: jadvaldagi o'rin --- */

.place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.place.is-top { background: var(--primary-lo); color: var(--primary); }


/* --- Rollar sahifasi --- */

.role-card .card-body { padding-top: 4px; }

.role-note {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}

.perm-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.perm-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
}
.perm-list i {
  margin-top: 3px;
  font-size: 10px;
  color: var(--good);
}

/* Tanlagich va tugma bitta qatorda - jadval katakchasi tor. */
.role-form { display: flex; gap: 7px; align-items: center; justify-content: flex-end; }
.role-form select { min-width: 150px; }

/* Sahifa oxiridagi tushuntirish. */
.page-note {
  margin: 18px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}
.page-note i { margin-top: 3px; }
.page-note b { color: var(--text-2); }


/* --- Jadval ichidagi kirish maydoni --- */
/* Narxlar va bonus qoidalari bitta formada tahrirlanadi: har bir qator
   uchun alohida sahifa ochish ularni taqqoslashni imkonsiz qilardi. */

.cell-input {
  width: 84px;
  min-height: 30px;
  padding: 4px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* --- Paket narxining jonli ko'rinishi --- */

.price-preview {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.price-preview > div {
  flex: 1 1 150px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.price-preview .k {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 3px;
}
.price-preview b { font-size: 17px; font-weight: 650; }
.price-preview .is-final {
  border-color: var(--primary-ring);
  background: var(--primary-lo);
}
.price-preview .is-final b { color: var(--primary); }
/* Qo'lda rejimda hisoblangan narx qo'llanmaydi - buni so'niq
   ko'rinish bilan aytamiz. */
.price-preview.is-muted { opacity: .45; }


/* --- Nom-qiymat ro'yxati --- */

.kv { display: flex; flex-direction: column; gap: 9px; }
.kv > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13.5px;
}
.kv .k { flex: 0 0 168px; color: var(--text-3); font-size: 12.5px; }
.kv b { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .kv > div { flex-direction: column; gap: 2px; }
  .kv .k { flex: none; }
}


/* --- Chek surati --- */

.receipt-link { display: block; }
.receipt-image {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
}


/* --- Tasdiqlash / rad etish --- */

.decision { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.decision-reject { display: flex; gap: 8px; flex: 1 1 340px; }
.decision-reject input { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .decision > form { width: 100%; }
  .decision-reject { flex-wrap: wrap; }
}


/* --- Jadvaldagi ishorali sonlar --- */

.is-good-text { color: var(--good); font-weight: 620; }
.is-bad-text { color: var(--bad); font-weight: 620; }


/* --- Narx tavsiyasi: xulosa bloki --- */
/* Sahifaning javobi. Ilgari u butun kenglikni egallagan katta rangli
   plita edi va yonidagi taqqoslash ogohlantirish MATNI ichida qolib
   ketgandi. Endi raqam va taqqoslash yonma-yon turadi. */

.verdict { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.verdict-main { flex: 1 1 320px; min-width: 0; }

.verdict-label {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 2px;
}
.verdict-price {
  display: block;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--primary);
}
.verdict-price.is-empty { color: var(--text-3); }

.verdict-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 56ch;
}
.verdict-note i { margin-right: 5px; }

.verdict-compare {
  flex: 0 1 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compare-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 13px;
}
.compare-row .k { flex: 0 0 92px; color: var(--text-3); font-size: 12px; }
.compare-row b { flex: 1; font-variant-numeric: tabular-nums; }


/* --- Yig'ma ogohlantirishlar --- */
/* Ilgari har bir ogohlantirish alohida sariq quti edi va to'rttasi
   ustma-ust turgani sahifani «hammasi buzuq» qilib ko'rsatardi. */

.notes {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.notes summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.notes summary::-webkit-details-marker { display: none; }
.notes summary > i { color: var(--warn); }
.notes summary em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
}
/* Ochiq/yopiq holatini ko'rsatadigan burchak. */
.notes summary::after {
  content: "";
  margin-left: auto;
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--text-3);
  border-bottom: 1.6px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform var(--t-fast) var(--ease);
}
.notes[open] summary::after { transform: rotate(-135deg); }

.notes ul {
  margin: 0;
  padding: 0 18px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.notes li { font-size: 12.5px; line-height: 1.6; color: var(--text-2); }


/* --- Bosqich raqami --- */
/* Ikki bosqichli sahifada (qidiruv -> forma) tartibni ko'rsatadi. */

.step-no {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-lo);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}


/* --- Sovg'a: kimga yuborilmoqda --- */
/* Forma to'ldirilayotganda jadval yuqorida qolib ketadi va «kimga
   edi?» degan savol tug'ilardi. */

.gift-target {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border: 1px solid var(--primary-ring);
  border-radius: var(--r-md);
  background: var(--primary-lo);
}
.gift-target .cell-text { flex: 1; min-width: 0; }
.gift-target .cell-text b { font-size: 14.5px; }

.gift-balance { text-align: right; white-space: nowrap; }
.gift-balance .k { display: block; font-size: 11.5px; color: var(--text-3); }
.gift-balance b { font-size: 15px; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .gift-target { flex-wrap: wrap; }
  .gift-balance { text-align: left; margin-left: 47px; }
}

/* Tanlangan qator jadvalda ajralib tursin. */
.table tr.is-picked > td { background: var(--primary-lo); }


/* --- Hammaga sovg'a: jarayon --- */
/* Admin «qotib qoldimi?» deb o'ylamasin: holat nuqtasi, jonli jumla,
   ikki bosqich chizig'i va jurnal. */

.bulk-now { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.bulk-now h2 { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.bulk-activity { font-weight: 550; color: var(--text-2); font-size: 14px; }

.bulk-dot {
  flex: 0 0 auto;
  width: 10px; height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--text-3);
}
.bulk-dot.is-good { background: var(--good); }
.bulk-dot.is-warn { background: var(--warn); }
.bulk-dot.is-bad  { background: var(--bad); }
/* Tirik jarayon «nafas oladi» — sahifa muzlab qolmaganini bildiradi. */
.bulk-dot.is-live { background: var(--info); animation: bulk-pulse 1.4s ease-in-out infinite; }
@keyframes bulk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--info-line); }
  50%      { box-shadow: 0 0 0 6px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .bulk-dot.is-live { animation: none; }
}

.bulk-progress { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.bulk-step { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.bulk-step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bulk-step-head > span { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.bulk-step .hint { font-size: 12px; color: var(--text-3); }
.bulk-step .good { color: var(--good); }
.bulk-step .bad  { color: var(--bad); }

.bulk-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bulk-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--good);
  transition: width .4s ease;
}
.bulk-bar.is-info > span { background: var(--info); }

.bulk-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 460px;
  overflow-y: auto;
  font-size: 13px;
}
.bulk-log li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 20px;
  border-top: 1px solid var(--line);
}
.bulk-log time { flex: 0 0 auto; font-size: 12px; color: var(--text-3); }
.bulk-log i { flex: 0 0 auto; font-size: 12px; color: var(--info); }
.bulk-log span { min-width: 0; overflow-wrap: anywhere; }
.bulk-log li.is-warn  { background: var(--warn-bg); }
.bulk-log li.is-warn i { color: var(--warn); }
.bulk-log li.is-error { background: var(--bad-bg); }
.bulk-log li.is-error i { color: var(--bad); }

@media (max-width: 640px) {
  .bulk-log li { flex-wrap: wrap; padding: 8px 16px; }
}

/* Xabar ko'rinishi — Telegramdagiga yaqin. */
.bulk-preview {
  max-width: 440px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.55;
}
.bulk-preview p { margin: 8px 0; }
.bulk-preview blockquote {
  margin: 0;
  padding: 4px 10px;
  border-left: 3px solid var(--primary);
  color: var(--text-2);
  overflow-wrap: anywhere;
}


/* ============================ SAHIFAGA XOS ============================ */

/* --- Imtihon kartochkasi (natijalar sahifasi) --- */

.exam-body { display: flex; flex-direction: column; gap: 16px; }

.exam-send {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.exam-send-note {
  flex: 1 1 300px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-2);
}
.exam-send-note i { color: var(--text-3); }
.exam-send form { margin-left: auto; }

/* --- Yaratish formasi --- */

.create-form { align-items: flex-start; }
.create-submit { flex: 0 0 auto; justify-content: flex-end; }
/* Tugma yorliqsiz maydonda, ya'ni yonidagilar bilan bir chiziqda
   turishi uchun yorliq balandligicha pastga suriladi. */
.create-submit .btn { margin-top: 22px; }

@media (max-width: 640px) {
  .create-submit { width: 100%; }
  .create-submit .btn { margin-top: 0; width: 100%; }
  .exam-send form { margin-left: 0; width: 100%; }
  .exam-send form .btn { width: 100%; }
}

/* ============================================================================
   BAHOLASH VA RASM KO'RGICHI
   ============================================================================
   Bu bo'lim ATAYLAB umumiy uslub faylida: rasm ko'rgichini `panel.js`
   quradi va u har qanday sahifada ishlaydi. Uslublari bo'lim faylida
   qolganda ko'rgich uslubsiz ochilardi — aynan shu bo'lgan edi: baholash
   sahifasi `national.css` ni umuman yuklamasdi va rasmlar tabiiy
   o'lchamida chiqib, kartochkani yorib o'tardi.
   ========================================================================= */

/* ============================ BAHOLASH ============================ */
/* Adminning ishi — rasmdagi yechimni o'qib ball qo'yish. Shuning uchun
 * rasm eng ko'p joyni oladi, qolgan hamma narsa unga xizmat qiladi. */

.grade-card { scroll-margin-top: calc(var(--head-h) + 16px); }

.q-badge {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--primary-lo);
  color: var(--primary);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Ball maydoni: yorliq, kirish va maksimal ball bitta blokda —
 * «17.5 / 30» ko'rinishi ball qanchadan qo'yilayotganini eslatib turadi. */
.score-input { display: flex; align-items: center; gap: 9px; }
.score-input label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.score-input input {
  width: 92px;
  min-height: 40px;
  text-align: center;
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.score-max {
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}


/* --- Yechim rasmlari --- */
/* `grid` + `minmax(min(210px, 100%), 1fr)` + `object-fit` uchligi rasmni
 * HAR DOIM kartochka ichida ushlab turadi: telefon suratining nisbati
 * qanday bo'lishidan qat'i nazar katakcha o'z o'lchamini saqlaydi.
 *
 * Ilgari to'r `minmax(150px, 1fr)` edi — `min()` bo'lmagani uchun tor
 * ekranda katakcha 150px dan kichrayolmay, kartochkadan chiqib ketardi. */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
  gap: 12px;
  width: 100%;
}

.shot {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-3);
  cursor: zoom-in;
  transition: border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.shot:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--sh-2);
}

.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shot-no {
  position: absolute;
  top: 8px; left: 8px;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(8, 12, 23, .74);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}

.shot-zoom {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 23, .42);
  color: #fff;
  font-size: 19px;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.shot:hover .shot-zoom { opacity: 1; }

.shots-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

/* Jadval ichidagi ixcham qator */
.shot-row { display: flex; gap: 7px; flex-wrap: wrap; }
.shot-row a { display: block; line-height: 0; }
.shot-row img {
  width: 52px; height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: zoom-in;
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.shot-row img:hover { border-color: var(--primary); transform: scale(1.06); }


/* --- Matnli yechim (eski yozuvlar) --- */

.solution {
  margin: 0;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: ui-monospace, "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
  /* Satrlar va bo'shliqlar yechimda ma'noli — saqlanadi, lekin uzun
   * satr ekranga sig'sin. */
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow: auto;
}


/* --- Ogohlantirish bloki --- */

/* BO'SHLIQ BLOKNING O'ZIDA.
 *
 * `.content` va `.card-body` - oddiy oqim: ular bolalari orasiga hech
 * qanday oraliq qo'ymaydi. Kartochkalar bir-biridan alohida qoida bilan
 * ajraladi (`.card + .card`), ogohlantirish esa o'sha ro'yxatda yo'q edi
 * va natijada tepasidagi to'rga ham, pastidagi kartochkaga ham TEGIB
 * turardi.
 *
 * Qoida blokning o'ziga yozildi, qo'shnilariga emas: ogohlantirish
 * shartli chiqadi (`{% if gaps %}`), ya'ni uning qo'shnisi har safar
 * boshqa element bo'ladi va ularning hammasini sanab chiqib bo'lmasdi.
 *
 * Qo'shni marginlar oddiy oqimda BIRLASHADI, shuning uchun 18px yonma-yon
 * turgan kartochkaning 18px i bilan qo'shilib 36px bo'lib ketmaydi. */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 18px 0;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 13.5px;
}

/* Chetdagi bola bo'lsa bo'shliq TUSHIRILADI: idishning o'z ichki
   to'ldirishi allaqachon bor va ikkalasi qo'shilib ketardi. */
.notice:first-child { margin-top: 0; }
.notice:last-child { margin-bottom: 0; }

/* `gap` li idishlarda oraliqni IDISHNING O'ZI beradi (modal formasi -
   16px, to'r - 14px). Bu yerda margin ular bilan QO'SHILADI - birlashish
   faqat oddiy oqimda bo'ladi - va oraliq ikki barobar ko'rinardi. */
.modal-form > .notice,
.grid > .notice { margin: 0; }

.notice i { margin-top: 2px; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.notice-info { background: var(--info-bg); border-color: var(--info-line); color: var(--info); }


/* --- Kichik javoblar (avtomatik yozma) --- */

.sub-answers { display: flex; flex-direction: column; gap: 6px; }
.sub-answer { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.sub-answer .sub-label {
  width: 22px; height: 22px;
  flex: 0 0 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: var(--primary-lo);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}
.sub-answer .sub-text { font-size: 13.5px; }


/* ============================ RASM KO'RGICHI ============================ */
/* Yangi oynada ochish o'rniga shu yerda kattalashtiriladi: admin ball
 * qo'yayotgan sahifadan chiqib ketmasligi kerak. */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 64px;
  background: rgba(4, 7, 15, .88);
  backdrop-filter: blur(6px);
  animation: fade-in var(--t-fast) var(--ease);
}
.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--r-md);
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, .8);
  animation: zoom-in var(--t-base) var(--ease-out);
}

@keyframes zoom-in {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: none; }
}

.lightbox-x,
.lightbox-nav {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.lightbox-x:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, .22); }
.lightbox-nav:active { transform: scale(.94); }

.lightbox-x { top: 18px; right: 18px; width: 42px; height: 42px; font-size: 17px; }
.lightbox-nav { top: 50%; margin-top: -24px; width: 48px; height: 48px; font-size: 16px; }
.lightbox-nav.is-prev { left: 14px; }
.lightbox-nav.is-next { right: 14px; }
.lightbox-nav[hidden] { display: none; }

.lightbox-count {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .lightbox { padding: 56px 12px; }
  .lightbox-nav { width: 40px; height: 40px; margin-top: -20px; }
  .lightbox-nav.is-prev { left: 6px; }
  .lightbox-nav.is-next { right: 6px; }

  .card-head { flex-wrap: wrap; }
  .card-head .right { width: 100%; }
  .score-input { width: 100%; }
  .score-input input { flex: 1; width: auto; }

  .shots { grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); }
}

.grade-note { margin-top: 16px; }
.grade-note .hint-inline { font-weight: 400; color: var(--text-3); }


/* --- Qator amallari --- */
/* Ikonkali tugmalar guruhi. Matnsiz, chunki ustun tor va uchta amal
 * jadval kengligini ikki barobar oshirib yuborardi. Har birida `title`
 * va `aria-label` bor. */

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.row-actions form { display: contents; }

.cell-ico.is-bad { background: var(--bad-bg); color: var(--bad); }


/* --- Modal ichi --- */

.modal-sm { width: min(100%, 520px); }

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  overflow: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.modal-head .btn { margin-left: auto; }

.delete-name {
  margin: 0;
  font-size: 16px;
  font-weight: 620;
  word-break: break-word;
}

@media (max-width: 640px) {
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .row-actions { gap: 4px; }
}

.cell-ico.is-gold { background: #fdf4e0; color: #b08421; }
:root[data-theme="dark"] .cell-ico.is-gold { background: #2e2510; color: #e0bb5c; }
:root[data-theme="dark"] .stat-ico.is-gold { background: #2e2510; color: #e0bb5c; }


/* ============================ KIRISH SAHIFASI ============================

   Panel qobig'idan (yon menyu + sarlavha) TASHQARIDA turadigan yagona
   ekran. Shuning uchun uslublari ham alohida: `.shell` va `.sidebar`
   bu yerda umuman yo'q.

   Ikki ustun: chapda brend, o'ngda forma. 900px dan tor ekranda chap
   ustun butunlay tushib qoladi - telefonda u formani pastga surib
   yuborardi va odam kirish uchun aylantirishga majbur bo'lardi.
   ====================================================================== */

.auth-body { background: var(--bg); }

.auth {
  min-height: 100vh;
  min-height: 100dvh;   /* telefon brauzerining paneli hisobga olinsin */
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* --- Chap ustun: brend --- */

.auth-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 44px 46px;
  background: linear-gradient(160deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  color: var(--nav-text);
  position: relative;
  overflow: hidden;
}

/* Yumshoq yorug'lik dog'i - tekis to'q maydon «o'chib qolgan ekran»
   taassurotini berardi. */
.auth-side::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -170px;
  top: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-ring) 0%, transparent 70%);
  pointer-events: none;
}

.auth-side > * { position: relative; z-index: 1; }

.auth-side-top { display: flex; align-items: center; gap: 12px; }
.auth-side-name { font-weight: 650; font-size: 15px; color: var(--nav-text-hi); }

.auth-side-mid h2 {
  font-size: 30px;
  line-height: 1.2;
  font-weight: 680;
  color: var(--nav-text-hi);
  letter-spacing: -.4px;
}
.auth-side-mid p {
  margin: 14px 0 0;
  max-width: 34ch;
  font-size: 14.5px;
  line-height: 1.65;
}

.auth-points { list-style: none; display: grid; gap: 12px; }
.auth-points li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13.5px;
}
.auth-points i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 13px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .07);
  color: var(--nav-text-hi);
}

/* --- O'ng ustun: forma --- */

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 40px 24px 22px;
}

.auth-box { width: 100%; max-width: 372px; margin: auto 0; }

/* Brend belgisi FAQAT chap ustun yashiringanda kerak - keng ekranda u
   yonma-yon ikki marta takrorlanardi. */
.auth-mark { display: none; align-items: center; gap: 11px; margin-bottom: 26px; }
.auth-mark b { font-size: 15px; font-weight: 650; }

.auth-box h1 { font-size: 25px; font-weight: 680; letter-spacing: -.3px; }
.auth-lead { margin: 7px 0 24px; color: var(--text-3); font-size: 13.5px; }

.auth-box .msg { margin-bottom: 18px; }

.auth-form { display: grid; gap: 16px; }
.auth-form .btn { margin-top: 4px; }

/* Ko'z tugmasi maydonning ICHIDA turadi: yonida turgan tugma maydonni
   qisqartirib, uzun parol ko'rinmay qolardi. */
.auth-pass { position: relative; }
.auth-pass input { padding-right: 42px; }

.auth-eye {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.auth-eye:hover { background: var(--surface-3); color: var(--text-2); }

/* `[hidden]` NI QAYTA TIKLASH. Brauzerning o'z qoidasi
   (`[hidden] { display: none }`) sinf selektoridan kuchsizroq, ya'ni
   quyidagi `display: flex` uni bosib ketardi va ogohlantirish sahifa
   ochilishidayoq turardi. */
.field-caps[hidden] { display: none; }

.field-caps {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--warn);
}

.auth-note {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.auth-foot {
  width: 100%;
  max-width: 372px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-3);
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mark { display: flex; }
}

@media (max-width: 420px) {
  .auth-main { padding: 28px 18px 18px; }
  .auth-box h1 { font-size: 22px; }
}


/* ===================== TO'LOV STATISTIKASI =====================

   Pul soni oddiy `stat b` dan kichikroq: `30 609 900` uch xonali
   sondan ancha uzun va katta o'lchamda kartochkadan chiqib ketardi. */

/* Selektor ATAYLAB `.stat b` dan kuchliroq: yuqoridagi `.stat b`
   qoidasi (sinf + element) yolg'iz sinfdan ustun turadi va `display`
   ni bosib, `gap` ni ishlamas qilib qo'yardi - «2 320so'm» bo'lib
   yopishib chiqardi. */
.stat b.stat-money {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -.4px;
  /* Raqamlar bir xil kenglikda - ustma-ust turgan kartochkalarda
     sonlar bir chiziqda ko'rinadi. */
  font-variant-numeric: tabular-nums;
}

.stat-unit { font-size: 12px; font-weight: 550; color: var(--text-3); }

.provider-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.provider {
  flex: 1 1 190px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.provider-name {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-3);
  margin-bottom: 5px;
}

.provider b {
  font-size: 17px;
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
}

.provider .hint { margin: 2px 0 0; font-size: 12px; color: var(--text-3); }

@media (max-width: 560px) {
  .stat b.stat-money { font-size: 18px; }
}
