/* ═══════════════════════════════════════════════════════════════════════
   Keldi-Ketdi — admin panel dizayn qatlami

   Yondashuv: Bootstrap 5.3 TIZIM sifatida qoladi (uni almashtirish butun
   panelni qayta yozish demakdi), ustiga token qatlami qo'yiladi. Bootstrap'ning
   o'z CSS o'zgaruvchilari qayta belgilanadi — shunda har bir komponent
   (tugma, jadval, forma, nishon, toast) markupga tegmasdan yangi ko'rinishga
   o'tadi.

   Rang mantig'i: interfeys xromi NEYTRAL (siyoh + kul), rang faqat MA'NO
   tashiydi — yashil "o'z vaqtida", qizil "kechikdi", sariq "ruxsat/kutilmoqda".
   Shuning uchun asosiy tugmalar ko'k emas, siyoh rangda: aks holda ular
   status ranglari bilan e'tibor uchun raqobatlashardi.

   Zichlik yuqori (jadval-og'ir panel) → kartochka qutilari o'rniga 1px
   chiziqlar, barcha raqamlar tabular monoshirift bilan.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────── tokenlar ─────────────────────────────── */

:root {
  /* Neytral shkala — sovuq emas, iliq kul (slate emas, stone) */
  --ink-950: #17171a;
  --ink-900: #1f1f23;
  --ink-800: #2c2c31;
  --ink-700: #3f3f46;
  --ink-500: #71717a;
  --ink-400: #8e8e97;
  --ink-300: #c9c9cf;
  --ink-200: #e2e2e6;
  --ink-100: #eeeef1;
  --ink-50:  #f7f7f8;

  /* Semantik ranglar — INTERFEYSDA YAGONA rang manbai */
  --ok:      #15803d;
  --ok-bg:   #dcfce7;
  --late:    #b91c1c;
  --late-bg: #fee2e2;
  --warn:    #b45309;
  --warn-bg: #fef3c7;
  --info:    #1d4ed8;
  --info-bg: #dbeafe;

  --surface:      #ffffff;
  --surface-sunk: #f4f4f6;
  --page:         #fbfbfc;
  --line:         #e6e6ea;
  --line-strong:  #d4d4d9;

  --text:      var(--ink-900);
  --text-soft: var(--ink-500);
  --text-faint:var(--ink-400);

  --accent:      var(--ink-900);   /* asosiy amal rangi = siyoh */
  --accent-text: #ffffff;
  --focus:       #2563eb;          /* faqat fokus halqasi uchun */

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 14px;

  /* Soyalar fon rangiga bo'yalgan — sof qora soya yasama ko'rinadi */
  --shadow-sm: 0 1px 2px rgba(23,23,26,.05);
  --shadow:    0 1px 3px rgba(23,23,26,.07), 0 6px 20px -8px rgba(23,23,26,.10);

  --t: 140ms cubic-bezier(.16,1,.3,1);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, monospace;
}

[data-bs-theme="dark"] {
  --surface:      #1a1a1d;
  --surface-sunk: #202024;
  --page:         #131316;
  --line:         #2c2c31;
  --line-strong:  #3a3a41;

  --text:      #ececef;
  --text-soft: #9a9aa3;
  --text-faint:#75757e;

  --accent:      #ececef;
  --accent-text: #17171a;
  --focus:       #60a5fa;

  --ok:      #4ade80;  --ok-bg:   rgba(34,197,94,.16);
  --late:    #f87171;  --late-bg: rgba(239,68,68,.16);
  --warn:    #fbbf24;  --warn-bg: rgba(245,158,11,.16);
  --info:    #7dabff;  --info-bg: rgba(59,130,246,.18);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow:    0 1px 3px rgba(0,0,0,.4), 0 8px 24px -10px rgba(0,0,0,.6);
}

/* Bootstrap'ni tokenlarga ulaymiz — markupga tegmasdan hamma joyga tarqaladi */
:root,
[data-bs-theme="dark"] {
  --bs-body-bg:        var(--page);
  --bs-body-color:     var(--text);
  --bs-emphasis-color: var(--text);
  --bs-secondary-color:var(--text-soft);
  --bs-secondary-bg:   var(--surface-sunk);
  --bs-tertiary-bg:    var(--surface-sunk);
  --bs-border-color:   var(--line);
  --bs-border-radius:     var(--r);
  --bs-border-radius-sm:  var(--r-sm);
  --bs-border-radius-lg:  var(--r-lg);
  --bs-link-color:       var(--text);
  --bs-link-hover-color: var(--text);
  --bs-font-sans-serif: ui-sans-serif, -apple-system, BlinkMacSystemFont,
                        "Segoe UI Variable Text", "Segoe UI", Roboto,
                        "Helvetica Neue", Arial, sans-serif;
  --bs-font-monospace: var(--mono);
}

/* ──────────────────────────────── asos ──────────────────────────────── */

body {
  background: var(--page);
  color: var(--text);
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.006em;
}

/* Zichlik 7: har bir raqam tabular — ustunlar sakramaydi */
.mono, td .mono,
#s-employees, #s-present, #s-late, #s-absent {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
table td, table th { font-variant-numeric: tabular-nums; }

::selection { background: var(--text); color: var(--surface); }

*:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ───────────────────────────── ilova paneli ───────────────────────────── */

.appbar {
  position: sticky; top: 0; z-index: 1030;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  height: 60px;
}
.appbar-inner {
  height: 100%;
  display: flex; align-items: center; gap: 14px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 15px; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none; white-space: nowrap;
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 14px; flex-shrink: 0;
}
.appbar-meta {
  margin-left: auto;
  display: flex; align-items: center; gap: 14px;
  font-size: 12.5px; color: var(--text-soft); white-space: nowrap;
}
.appbar-clock { font-family: var(--mono); font-size: 12px; }
.appbar-user { display: flex; align-items: center; gap: 7px; }
.appbar-user b { color: var(--text); font-weight: 550; }
.role-chip {
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--surface-sunk); color: var(--text-soft);
  border: 1px solid var(--line);
}

.icon-btn {
  width: 32px; height: 32px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-soft);
  display: grid; place-items: center; font-size: 14px;
  cursor: pointer; transition: background var(--t), color var(--t), border-color var(--t);
}
.icon-btn:hover { background: var(--surface-sunk); color: var(--text); border-color: var(--line-strong); }
.icon-btn:active { transform: translateY(1px); }

/* ─────────────────────── metrikalar (kartochkasiz) ─────────────────────── */
/* Zichlik 7 da to'rtta soyali quti ortiqcha shovqin — bitta chiziqli
   panel bir qarashda o'qiladi va sahifa balandligini yemaydi. */

.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden;
}
.metric { padding: 15px 18px; position: relative; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-label {
  font-size: 11.5px; font-weight: 550; color: var(--text-soft);
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
}
.metric-value {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 27px; font-weight: 600; line-height: 1.05; letter-spacing: -0.035em;
}
.metric-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.metric.is-ok    .metric-dot { background: var(--ok); }
.metric.is-warn  .metric-dot { background: var(--warn); }
.metric.is-late  .metric-dot { background: var(--late); }
.metric.is-ok    .metric-value { color: var(--ok); }
.metric.is-warn  .metric-value { color: var(--warn); }
.metric.is-late  .metric-value { color: var(--late); }
.metric.is-total .metric-dot { background: var(--ink-300); }

@media (max-width: 700px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metric-value { font-size: 23px; }
}

/* ────────────────────────────── tab navigatsiya ────────────────────────── */
/* Bir qatorda turadi; tor ekranda gorizontal siljiydi (ikki qatorli nav
   buzilgan dizayn hisoblanadi). */

.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
  margin-bottom: 20px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .nav-link {
  position: relative;
  border: 0; background: none;
  padding: 10px 13px 12px;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  color: var(--text-soft);
  display: flex; align-items: center; gap: 7px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--t), background var(--t);
}
.tabs .nav-link:hover { color: var(--text); background: var(--surface-sunk); }
.tabs .nav-link.active { color: var(--text); font-weight: 600; }
.tabs .nav-link.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--accent); border-radius: 2px 2px 0 0;
}
.tabs .nav-link i { font-size: 14px; opacity: .75; }
.tabs .nav-link.active i { opacity: 1; }

/* Kutilayotgan ish sonini ko'rsatuvchi nishon */
.tab-count {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--late); color: #fff;
}

/* ───────────────────────────── panel (karta) ──────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel + .panel { margin-top: 16px; }
.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel-title {
  font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em;
  margin: 0; display: flex; align-items: center; gap: 8px;
}
.panel-title i { color: var(--text-soft); font-size: 15px; }
.panel-body { padding: 18px; }
.panel-body.is-flush { padding: 0; }

.note {
  font-size: 12.5px; line-height: 1.55; color: var(--text-soft);
  margin: 0;
}
.note code {
  font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-sunk); color: var(--text); border: 1px solid var(--line);
}
.note b, .note strong { color: var(--text); font-weight: 600; }

/* ──────────────────────────────── jadval ──────────────────────────────── */
/* Har qatorga ikki chiziq (ustki + ostki) qo'yish — dangasa yechim.
   Faqat qatorlar ORASIDA bitta chiziq qoldiramiz. */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  margin: 0;
  font-size: 13px;
}
.table > :not(caption) > * > * { padding: 9px 12px; }
.table thead th {
  background: var(--surface-sunk);
  color: var(--text-soft);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  /* Yopishqoq sarlavha ATAYLAB yo'q: jadval `overflow-x: auto` konteyner
     ichida turadi va u yerda `position: sticky` sahifaga emas, o'sha
     konteynerga nisbatan hisoblanadi — natijada birinchi qator sarlavha
     ustiga chiqib qolardi. */
}
.table tbody tr { border-bottom: 1px solid var(--line); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody td { border: 0; vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--surface-sunk); }
.table tbody tr.is-pending { background: var(--warn-bg); }
.table tbody tr.is-pending:hover { background: var(--warn-bg); filter: brightness(.98); }

.table-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Ism va sana o'ralib ketsa qator ikki-uch barobar balandlashadi va
   zich jadvalni ko'zdan kechirish qiyinlashadi. Ular bir qatorda qoladi —
   joy yetmasa jadval gorizontal siljiydi. */
.cell-name { font-weight: 550; white-space: nowrap; }
.cell-sub {
  font-size: 11.5px; color: var(--text-faint); margin-top: 1px;
  white-space: nowrap;
}
.cell-time {
  font-family: var(--mono); font-size: 12.5px; font-weight: 550;
  white-space: nowrap;
}
.cell-muted { color: var(--text-faint); }
.table td.mono, .table td.cell-time { white-space: nowrap; }

/* ──────────────────────────────── nishonlar ───────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; line-height: 1.4;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.pill-ok    { background: var(--ok-bg);   color: var(--ok); }
.pill-late  { background: var(--late-bg); color: var(--late); }
.pill-warn  { background: var(--warn-bg); color: var(--warn); }
.pill-info  { background: var(--info-bg); color: var(--info); }
.pill-mute  { background: var(--surface-sunk); color: var(--text-soft); border: 1px solid var(--line); }
.pill-count { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Hafta kunlari belgisi */
.daymark {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: var(--r-sm);
  font-size: 10.5px; font-weight: 600;
  background: var(--surface-sunk); color: var(--text-faint);
  border: 1px solid var(--line);
}
.daymark.is-on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.daymarks { display: inline-flex; gap: 3px; }

/* Formadagi kun tanlagich — jadvaldagi chiplar bilan BIR XIL vizual til.
   Avval bu yerda oddiy katakchalar edi: bitta tushuncha ikki xil ko'rinishda
   chiqib, interfeys yamoq bo'lib turardi. */
.daypick { display: flex; gap: 4px; flex-wrap: wrap; }
.daypick input { position: absolute; opacity: 0; pointer-events: none; }
.daypick label {
  display: grid; place-items: center;
  min-width: 32px; height: 30px; padding: 0 7px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text-soft);
  font-size: 12px; font-weight: 550; cursor: pointer; user-select: none;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.daypick label:hover { border-color: var(--line-strong); color: var(--text); }
.daypick input:checked + label {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
}
.daypick input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ──────────────────────────────── tugmalar ────────────────────────────── */

.btn {
  --bs-btn-font-size: 13px;
  --bs-btn-font-weight: 550;
  --bs-btn-border-radius: var(--r-sm);
  --bs-btn-padding-y: .38rem;
  --bs-btn-padding-x: .75rem;
  letter-spacing: -0.005em;
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t);
}
.btn:active { transform: translateY(1px); }   /* jismoniy bosish hissi */

.btn-primary {
  --bs-btn-bg: var(--accent);          --bs-btn-border-color: var(--accent);
  --bs-btn-color: var(--accent-text);
  --bs-btn-hover-bg: var(--ink-700);   --bs-btn-hover-border-color: var(--ink-700);
  --bs-btn-hover-color: var(--accent-text);
  --bs-btn-active-bg: var(--ink-800);  --bs-btn-active-border-color: var(--ink-800);
  --bs-btn-active-color: var(--accent-text);
  --bs-btn-disabled-bg: var(--ink-300);--bs-btn-disabled-border-color: var(--ink-300);
}
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-hover-bg: #ffffff;  --bs-btn-hover-border-color: #ffffff;
  --bs-btn-active-bg: #d4d4d9; --bs-btn-active-border-color: #d4d4d9;
}

.btn-outline-secondary {
  --bs-btn-color: var(--text); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--surface-sunk); --bs-btn-hover-color: var(--text);
  --bs-btn-hover-border-color: var(--line-strong);
  --bs-btn-active-bg: var(--surface-sunk); --bs-btn-active-color: var(--text);
  --bs-btn-active-border-color: var(--line-strong);
}
.btn-success {
  --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #166534; --bs-btn-hover-border-color: #166534; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #14532d; --bs-btn-active-border-color: #14532d;
}
.btn-outline-success {
  --bs-btn-color: var(--ok); --bs-btn-border-color: var(--ok);
  --bs-btn-hover-bg: var(--ok); --bs-btn-hover-color: #fff;
}
.btn-outline-danger {
  --bs-btn-color: var(--late); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--late-bg); --bs-btn-hover-color: var(--late);
  --bs-btn-hover-border-color: var(--late);
  --bs-btn-active-bg: var(--late-bg); --bs-btn-active-color: var(--late);
}
.btn-outline-primary {
  --bs-btn-color: var(--text); --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--surface-sunk); --bs-btn-hover-color: var(--text);
  --bs-btn-hover-border-color: var(--line-strong);
}
[data-bs-theme="dark"] .btn-success { --bs-btn-color: #06240f; }

/* Jadval ichidagi ixcham amal tugmalari */
.btn-icon {
  width: 29px; height: 29px; padding: 0;
  display: inline-grid; place-items: center; font-size: 13px;
}
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }

/* ──────────────────────────────── formalar ────────────────────────────── */

.form-label {
  font-size: 11.5px; font-weight: 550; color: var(--text-soft);
  margin-bottom: 5px; letter-spacing: -0.003em;
}
.form-control, .form-select {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  font-size: 13px;
  border-radius: var(--r-sm);
  transition: border-color var(--t), box-shadow var(--t);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .form-select:focus {
  background: var(--surface);
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,.16);
  color: var(--text);
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus { box-shadow: 0 0 0 3px rgba(96,165,250,.22); }
.form-control-sm, .form-select-sm { font-size: 12.5px; padding: .34rem .6rem; }
.form-text { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; margin-top: 5px; }

.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
[data-bs-theme="dark"] .form-check-input:checked { background-color: var(--accent); }
.form-check-label { font-size: 12.5px; }
.form-switch .form-check-input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.16); }

/* Qorong'i rejimda yoqilgan switch foni oqish (accent), Bootstrap'ning
   standart tugmachasi ham oq — natijada tugmacha ko'rinmay qolardi.
   Shu holat uchun tugmachani qoraytiramiz. */
[data-bs-theme="dark"] .form-switch .form-check-input:checked {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2317171a'/%3e%3c/svg%3e");
}

.field { margin-bottom: 13px; }
.field:last-child { margin-bottom: 0; }
.inline-input { max-width: 108px; }
.e-place { min-width: 168px; }
/* Bo'lim nomi kesilib "Mar…", "Sotu…" bo'lib qolmasin */
.e-dept { min-width: 138px; }

/* Filtr paneli — pastki chiziq bilan ajratilgan, quti emas */
.filterbar {
  display: grid; gap: 10px;
  grid-template-columns: repeat(4, minmax(0,1fr)) auto;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.filterbar-actions { display: flex; gap: 6px; }
@media (max-width: 900px) {
  .filterbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .filterbar-actions { grid-column: 1 / -1; }
}

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
}
.toolbar-count {
  margin-left: auto; font-family: var(--mono);
  font-size: 11.5px; color: var(--text-faint);
}

/* ───────────────────────── bo'sh va yuklanish holati ───────────────────── */
/* Bo'sh holat "ma'lumot yo'q" degan kulrang matn emas — nima qilish
   kerakligini aytadi. */

.empty {
  padding: 44px 24px; text-align: center;
}
.empty-icon {
  width: 40px; height: 40px; margin: 0 auto 12px;
  border-radius: var(--r); display: grid; place-items: center;
  background: var(--surface-sunk); color: var(--text-faint); font-size: 18px;
  border: 1px solid var(--line);
}
.empty-title { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.empty-hint { font-size: 12.5px; color: var(--text-soft); max-width: 34ch; margin: 0 auto; line-height: 1.55; }
.empty-hint code {
  font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-sunk); border: 1px solid var(--line); color: var(--text);
}

/* Skelet — yakuniy jadval shaklini takrorlaydi, aylanma spinner emas */
.skeleton-row td { padding: 11px 12px; }
.sk {
  height: 10px; border-radius: 4px; display: block;
  background: linear-gradient(90deg, var(--surface-sunk) 25%, var(--line) 37%, var(--surface-sunk) 63%);
  background-size: 400% 100%;
  animation: sk-shimmer 1.3s ease-in-out infinite;
}
@keyframes sk-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ──────────────────────────── xabar shablonlari ───────────────────────── */

.tpl {
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 10px;
  background: var(--surface);
  transition: border-color var(--t);
}
.tpl:hover { border-color: var(--line-strong); }
.tpl-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.tpl-name { font-size: 13px; font-weight: 600; }
.tpl-key {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  margin-top: 2px; display: block;
}
.tpl textarea {
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  background: var(--surface-sunk);
}
.tpl-vars { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 9px; }
.tpl-var {
  font-family: var(--mono); font-size: 10.5px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-sunk); color: var(--text-soft);
  border: 1px solid var(--line); cursor: pointer;
  transition: background var(--t), color var(--t);
}
.tpl-var:hover { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ──────────────────────────── dialog oynasi ──────────────────────────── */
/* Brauzerning o'z confirm()/alert() oynalari uslublanmaydi va tizim
   ko'rinishida chiqib, dizayndan butunlay ajralib turardi. Native <dialog>
   elementi ishlatiladi: fokus qopqoni, Esc bilan yopilish va ::backdrop
   brauzerdan tekinga keladi. */

.dlg {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dlg::backdrop {
  background: rgba(23,23,26,.5);
  backdrop-filter: blur(2px);
}
[data-bs-theme="dark"] .dlg::backdrop { background: rgba(0,0,0,.62); }

.dlg[open] { animation: dlg-in .18s cubic-bezier(.16,1,.3,1); }
.dlg[open]::backdrop { animation: dlg-fade .18s ease; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes dlg-fade { from { opacity: 0; } }

.dlg-inner { padding: 20px; margin: 0; }
.dlg-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.dlg-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--r-sm); display: grid; place-items: center;
  font-size: 16px; background: var(--surface-sunk); color: var(--text-soft);
  border: 1px solid var(--line);
}
.dlg.is-danger .dlg-icon { background: var(--late-bg); color: var(--late); border-color: transparent; }
.dlg-title { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -0.015em; line-height: 1.35; }
.dlg-body { font-size: 13px; color: var(--text-soft); line-height: 1.6; }
.dlg-body b { color: var(--text); font-weight: 600; }
.dlg-body code {
  font-size: 12px; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-sunk); border: 1px solid var(--line); color: var(--text);
}
.dlg-body p { margin: 0 0 8px; }
.dlg-body p:last-child { margin-bottom: 0; }

.dlg-actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 20px;
}
/* Uch va undan ortiq variant bo'lsa gorizontal qator siqilib ketadi —
   ular ustma-ust, eng xavfsizi tepada turadi. */
.dlg-actions.is-stacked { flex-direction: column-reverse; }
.dlg-actions.is-stacked .btn { width: 100%; }

/* ── forma oynasi ──────────────────────────────────────────────────────
   Ilgari "yangi bo'lim / yangi admin / bayram" formalari sahifada doim
   ochiq turardi: har safar tabga kirganda yarim ekranni bo'sh maydonlar
   egallardi va ro'yxat qolgan 8 ustunga siqilardi. Endi forma o'sha
   ro'yxat ustidagi tugma bilan ochiladigan oyna. Ko'rinish tasdiq
   oynalari bilan bir xil — yangi modal tili emas, o'sha .dlg kengaytmasi.

   Uch qismli tuzilma: sarlavha va amallar joyida qotib turadi, faqat
   o'rtadagi maydonlar bo'limi suriladi — shuning uchun "Saqlash" tugmasi
   uzun formada ham doim ko'rinib turadi. */

.dlg-form { width: min(520px, calc(100vw - 32px)); }

.dlg-form .dlg-inner {
  display: flex;
  flex-direction: column;
  max-height: min(720px, calc(100dvh - 48px));
  padding: 0;
}

.dlg-form .dlg-head {
  margin: 0;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.dlg-form-body { padding: 18px; overflow-y: auto; }

.dlg-form .dlg-actions {
  margin: 0;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-sunk);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* Sarlavhadagi ikona panel sarlavhalari bilan bir xil vaznda */
.dlg-title i { color: var(--text-soft); font-size: 15px; }

.dlg-close {
  margin-left: auto;
  flex-shrink: 0;
  width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  color: var(--text-faint);
  font-size: 12px;
  transition: background var(--t), color var(--t);
}
.dlg-close:hover { background: var(--surface); color: var(--text); border-color: var(--line); }
.dlg-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Nusxa olinadigan maydon (yangi admin paroli) */
.dlg-copy {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-sunk); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 9px 11px; margin-top: 4px;
}
.dlg-copy code {
  flex: 1; font-family: var(--mono); font-size: 13px;
  background: none; border: 0; padding: 0; word-break: break-all;
}

/* ───────────────────────────────── toast ──────────────────────────────── */

.toast {
  background: var(--ink-950); color: #fff;
  border: 0; border-radius: var(--r);
  box-shadow: var(--shadow);
  font-size: 13px;
}
[data-bs-theme="dark"] .toast { background: #ececef; color: var(--ink-950); }
.toast.is-danger { background: var(--late); color: #fff; }
.toast.is-warning { background: var(--warn); color: #fff; }
.toast .btn-close { filter: invert(1) grayscale(1) brightness(2); }
[data-bs-theme="dark"] .toast:not(.is-danger):not(.is-warning) .btn-close { filter: none; }

/* ─────────────────────────────── boshqalar ────────────────────────────── */

.scope-note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 14px; margin-bottom: 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--info);
  border-radius: var(--r);
  background: var(--surface); font-size: 12.5px; color: var(--text-soft);
}
.scope-note i { color: var(--info); font-size: 15px; line-height: 1.3; }
.scope-note b { color: var(--text); }

.divider { height: 1px; background: var(--line); margin: 18px -18px; }

.section-label {
  font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px;
}

.stack-sm > * + * { margin-top: 8px; }

/* Guruh qatoridagi bo'lim katakchalari */
.dept-picker { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.dept-picker .form-check { margin: 0; min-height: auto; }
.dept-picker .form-check-label { font-size: 12px; }

/* Rolga ko'ra yashiriladigan elementlar dastlab ko'rinmaydi —
   super bo'lmagan admin panel yuklanganda ularni bir lahza ko'rmasin */
/* Sinf BODY ga qo'yiladi: JS ishlagunicha super-elementlar yashirin turadi,
   ruxsat tasdiqlangach o'z tabiiy display qiymatiga (flex) qaytadi —
   shuning uchun `display: revert` emas, aynan shu teskari selektor. */
body:not(.is-super) .super-only { display: none !important; }

@media (max-width: 575px) {
  .appbar-user { display: none; }
  .panel-body { padding: 14px; }
  .filterbar, .toolbar { padding: 12px 14px; }
}

/* Harakat kamaytirilgan rejim — 3-darajali animatsiya ham to'liq o'chadi */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .btn:active, .icon-btn:active { transform: none; }
}

/* ───────────────────────── kirish sahifalari ─────────────────────────
   /login va /parol/<token>. Brauzerning Basic auth oynasi o'rniga.
   Chapdagi brend paneli rangi --auth-hero-bg tokenidan (brend CSS uni
   qayta belgilaydi), standartda siyoh. */

:root { --auth-hero-bg: var(--ink-900); --auth-hero-text: #ffffff; --auth-hero-soft: rgba(255,255,255,.66); }

.auth-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-hero {
  background: var(--auth-hero-bg); color: var(--auth-hero-text);
  padding: 56px clamp(32px, 6vw, 88px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  position: relative; overflow: hidden;
}
.auth-hero-mark .brand-logo { height: 104px; width: auto; display: block; }
.auth-hero-mark .brand-mark { width: 64px; height: 64px; border-radius: 16px; font-size: 30px;
                              background: rgba(255,255,255,.12); color: #fff; }
.auth-hero h2 { font-size: clamp(26px, 3vw, 36px); font-weight: 680; letter-spacing: -0.025em;
                line-height: 1.15; margin: 28px 0 12px; color: var(--auth-hero-text); }
.auth-hero p { color: var(--auth-hero-soft); font-size: 15.5px; max-width: 380px; margin: 0; }
.auth-hero-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px;
                  color: var(--auth-hero-soft); font-size: 14px; }
.auth-hero-list i { color: var(--auth-hero-text); margin-right: 10px; }

.auth-main { display: grid; place-items: center; padding: 48px 24px; background: var(--page); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; margin: 0 0 6px; }
.auth-card .lead-sm { color: var(--text-soft); font-size: 14.5px; margin: 0 0 26px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card .form-control { height: 44px; font-size: 15px; }
.auth-card .btn-primary { height: 46px; font-size: 15px; font-weight: 600; }
.auth-pass { position: relative; }
.auth-pass .form-control { padding-right: 46px; }
.auth-eye { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border: 0;
            background: transparent; color: var(--text-faint); border-radius: var(--r-sm);
            display: grid; place-items: center; }
.auth-eye:hover { color: var(--text); background: var(--surface-sunk); }
.auth-msg { font-size: 13.5px; min-height: 20px; margin: 2px 0 12px; color: var(--late); }
.auth-foot { margin-top: 22px; font-size: 13px; color: var(--text-faint); line-height: 1.5; }
.auth-brand-sm { display: none; }

/* Bitta ustunli variant (parol o'rnatish) va telefon */
.auth-single { min-height: 100dvh; display: grid; place-items: center; padding: 40px 16px; background: var(--page); }
.auth-single .auth-card { background: var(--surface); border: 1px solid var(--line);
                          border-radius: var(--r-lg); padding: 28px 26px; box-shadow: var(--shadow); }
.auth-single .auth-brand-sm, .auth-page .auth-brand-sm { align-items: center; gap: 10px; font-weight: 650;
                          font-size: 16px; margin-bottom: 22px; }
.auth-single .auth-brand-sm { display: flex; justify-content: center; }
.auth-brand-sm .brand-logo { height: 34px; width: auto; }

@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-page .auth-brand-sm { display: flex; }
  .auth-main { align-items: start; padding-top: 12vh; }
}
