/* ==========================================================================
   Elita School ERP — dizayn tizimi
   Ranglar, tipografiya, oraliqlar va komponentlar bir joyda belgilanadi.
   ========================================================================== */


:root {
  /* Asosiy palitra */
  --ink-950: #0b1424;
  --ink-900: #111d33;
  --ink-800: #1a2945;
  --ink-700: #2a3b5c;
  --ink-500: #5b6b88;
  --ink-400: #8391ab;
  --ink-300: #b5c0d3;
  --ink-200: #dbe2ec;
  --ink-100: #edf1f7;
  --ink-50:  #f6f8fb;

  --brand-700: #3730a3;
  --brand-600: #4338ca;
  --brand-500: #5b5bf0;
  --brand-100: #e8e8fe;
  --brand-50:  #f3f3ff;

  --amber-500: #f2a33a;
  --amber-100: #fdf0dc;
  --green-600: #138a5a;
  --green-100: #dcf5ea;
  --red-600:   #d6384b;
  --red-100:   #fde4e7;
  --blue-600:  #2563eb;
  --blue-100:  #e0eaff;

  /* Semantik tokenlar */
  --bg: var(--ink-50);
  --surface: #ffffff;
  --surface-2: var(--ink-100);
  --text: var(--ink-900);
  --text-muted: var(--ink-500);
  --border: var(--ink-200);
  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-soft: var(--brand-50);
  --sidebar-bg: var(--ink-950);
  --sidebar-text: #c6cfe0;
  --sidebar-muted: #6f7f9c;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(91,91,240,.22);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(17,29,51,.06);
  --shadow: 0 1px 2px rgba(17,29,51,.05), 0 6px 16px -6px rgba(17,29,51,.10);
  --shadow-lg: 0 24px 48px -16px rgba(17,29,51,.28);

  --sidebar-w: 268px;
  --topbar-h: 64px;

  --bs-body-font-family: "Manrope Variable", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 67, 56, 202;
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-hover);
  --bs-link-color-rgb: 67, 56, 202;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] {
  --bg: #0a1220;
  --surface: #111b2e;
  --surface-2: #17233a;
  --text: #e6ebf4;
  --text-muted: #8f9cb5;
  --border: #23314b;
  --primary-soft: rgba(91,91,240,.16);
  --sidebar-bg: #070d18;
  --bs-body-color: var(--text);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--border);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
  --bs-emphasis-color: #fff;
  color-scheme: dark;
}

/* --- Asos ------------------------------------------------------------------ */
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--bs-body-font-family); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.text-muted { color: var(--text-muted) !important; }
.tabular { font-variant-numeric: tabular-nums; }
a { text-decoration: none; }
::selection { background: var(--brand-100); }

/* --- Ilova karkasi -------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .22s ease; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 24px 28px 48px; flex: 1; }

/* Sidebar */
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-text); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; z-index: 1040; }
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-500), #8b5cf6); color: #fff; font-weight: 800; font-size: 17px; box-shadow: 0 8px 20px -8px rgba(91,91,240,.8); flex: 0 0 auto; }
.brand-name { font-weight: 800; font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-muted); font-weight: 500; }
.sidebar__branch { margin: 4px 14px 12px; }
.branch-switch { width: 100%; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); color: #fff; border-radius: 10px; padding: 9px 12px; font-size: 13px; text-align: left; }
.branch-switch:hover { background: rgba(255,255,255,.09); }
.branch-switch small { display: block; color: var(--sidebar-muted); font-size: 11px; }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 4px 10px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section { margin-bottom: 2px; }
.nav-link-erp { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--sidebar-text); font-size: 14px; font-weight: 500; width: 100%; background: none; border: 0; text-align: left; transition: background .15s, color .15s; }
.nav-link-erp:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link-erp.is-active { background: var(--sidebar-active); color: #fff; }
.nav-link-erp .bi { font-size: 17px; width: 20px; text-align: center; opacity: .9; }
.nav-link-erp .chev { margin-left: auto; font-size: 12px; transition: transform .2s; opacity: .6; }
.nav-link-erp[aria-expanded="true"] .chev { transform: rotate(90deg); }
.nav-sub { list-style: none; margin: 2px 0 6px; padding: 0 0 0 30px; position: relative; }
.nav-sub::before { content: ""; position: absolute; left: 21px; top: 4px; bottom: 4px; width: 1px; background: rgba(255,255,255,.08); }
.nav-sub a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--sidebar-muted); font-size: 13.5px; font-weight: 500; }
.nav-sub a:hover { color: #fff; background: var(--sidebar-hover); }
.nav-sub a.is-active { color: #fff; background: rgba(255,255,255,.07); }
.sidebar__foot { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.06); font-size: 12px; color: var(--sidebar-muted); display: flex; align-items: center; gap: 8px; }
.nav-sub__title { display: none; }
.sb-collapse { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--sidebar-hover); color: var(--sidebar-text); display: grid; place-items: center; }
.sb-collapse:hover { background: rgba(255,255,255,.12); color: #fff; }
.sb-collapse .bi { transition: transform .2s; }

/* Topbar */
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 28px; position: sticky; top: 0; z-index: 1030; }
.topbar__title { font-size: 17px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--brand-700); background: var(--brand-100); flex: 0 0 auto; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 72px; height: 72px; font-size: 24px; border-radius: 20px; }
.global-search { position: relative; flex: 0 1 380px; }
.global-search input { padding-left: 38px; background: var(--surface-2); border-color: transparent; border-radius: 10px; height: 38px; }
.global-search .bi { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.global-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); font-size: 11px; padding: 1px 6px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; display: none; z-index: 1100; }
.search-results.show { display: block; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.is-focus { background: var(--primary-soft); }
.search-results small { color: var(--text-muted); }

/* --- Sahifa sarlavhasi ------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .lead-text { color: var(--text-muted); margin: 4px 0 0; font-size: 14px; }
.page-head__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.page-head__actions > .form-control, .page-head__actions > .form-select { width: auto; }
.breadcrumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }

/* --- Kartalar ------------------------------------------------------------ */
.card-erp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-erp__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-erp__head h2, .card-erp__head h3 { font-size: 15px; margin: 0; }
.card-erp__body { padding: 20px; }
.card-erp__foot { padding: 12px 20px; border-top: 1px solid var(--border); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; height: 100%; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; color: var(--text); }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.stat__icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: 0 0 auto; }
.stat__label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat__value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat__hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.tone-brand { background: var(--brand-100); color: var(--brand-600); }
.tone-green { background: var(--green-100); color: var(--green-600); }
.tone-red { background: var(--red-100); color: var(--red-600); }
.tone-amber { background: var(--amber-100); color: #b26b08; }
.tone-blue { background: var(--blue-100); color: var(--blue-600); }
.tone-ink { background: var(--ink-100); color: var(--ink-700); }

/* --- Jadval ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table-erp { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table-erp thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table-erp tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-erp tbody tr:last-child td { border-bottom: 0; }
.table-erp tbody tr:hover td { background: var(--primary-soft); }
.table-erp .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-erp tr.is-muted td { opacity: .55; }
.table-erp tfoot td { padding: 12px 16px; font-weight: 700; border-top: 1px solid var(--border); background: var(--surface-2); }
.cell-person { display: flex; align-items: center; gap: 10px; }
.cell-person b { font-weight: 600; color: var(--text); display: block; }
.cell-person small { color: var(--text-muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar .form-control, .toolbar .form-select { height: 38px; font-size: 14px; }
.toolbar .search { position: relative; flex: 1 1 170px; max-width: 320px; }
.toolbar .search .bi { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.toolbar .search input { padding-left: 34px; }
/* Filtrlar bir qatorda: select/sana maydonlari to'liq kenglikka cho'zilmaydi */
.toolbar > .form-select, .toolbar > select, .toolbar > .form-control:not(.search input),
.toolbar > input[type=date], .toolbar > input[type=month], .toolbar > input[type=number] { width: auto; flex: 1 1 140px; min-width: 140px; max-width: 220px; }
.toolbar > .btn { flex: 0 0 auto; }
@media (max-width: 575.98px) {
  .toolbar > .form-select, .toolbar > select, .toolbar > .form-control, .toolbar > input { flex: 1 1 calc(50% - 10px); max-width: none; min-width: 0; }
  .toolbar .search { flex-basis: 100%; max-width: none; }
}

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state .bi { font-size: 40px; color: var(--ink-300); display: block; margin-bottom: 10px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 4px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.pager .pagination { margin: 0; }
.page-link { color: var(--text); border-color: var(--border); }
.active > .page-link { background: var(--primary); border-color: var(--primary); }

/* --- Belgilar ------------------------------------------------------------------ */
.badge-soft { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-soft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-soft--green { background: var(--green-100); color: var(--green-600); }
.badge-soft--red { background: var(--red-100); color: var(--red-600); }
.badge-soft--amber { background: var(--amber-100); color: #a36007; }
.badge-soft--blue { background: var(--blue-100); color: var(--blue-600); }
.badge-soft--brand { background: var(--brand-100); color: var(--brand-600); }
.badge-soft--neutral { background: var(--ink-100); color: var(--ink-700); }

/* --- Tugmalar va forma ---------------------------------------------------------- */
.btn { font-weight: 600; border-radius: 10px; font-size: 14px; padding: 8px 16px; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--primary-hover); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-soft { background: var(--primary-soft); color: var(--primary); border: 1px solid transparent; }
.btn-soft:hover { background: var(--brand-100); color: var(--primary-hover); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { --bs-btn-bg: var(--green-600); --bs-btn-border-color: var(--green-600); }
.btn-danger { --bs-btn-bg: var(--red-600); --bs-btn-border-color: var(--red-600); }
.btn-icon { width: 34px; height: 34px; padding: 0; }

.form-control, .form-select { border-radius: 10px; border-color: var(--border); background-color: var(--surface); color: var(--text); padding: 9px 12px; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(91,91,240,.14); background-color: var(--surface); color: var(--text); }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .req { color: var(--red-600); margin-left: 2px; }
.form-text { color: var(--text-muted); font-size: 12px; }
.invalid-feedback { font-size: 12.5px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-section { padding: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { font-size: 15px; margin-bottom: 4px; }
.form-section > p { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.money-input { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Offcanvas (o'ng panel formalar) ------------------------------------------- */
.offcanvas { background: var(--surface); color: var(--text); border-left: 1px solid var(--border); }
.offcanvas.offcanvas-end { width: min(480px, 100vw); }
.offcanvas-header { border-bottom: 1px solid var(--border); padding: 18px 22px; }
.offcanvas-title { font-weight: 700; font-size: 17px; }
.offcanvas-body { padding: 22px; }
.offcanvas-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* --- Xabarlar (toast) ------------------------------------------------------------ */
.toast-stack { position: fixed; top: 76px; right: 20px; z-index: 1200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast-erp { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .25s ease-out; }
.toast-erp--success { border-left-color: var(--green-600); }
.toast-erp--error { border-left-color: var(--red-600); }
.toast-erp--warning { border-left-color: var(--amber-500); }
.toast-erp button { margin-left: auto; background: none; border: 0; color: var(--text-muted); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* --- Kassa kartalari ------------------------------------------------------------ */
.cashbox-card { position: relative; border-radius: var(--radius-lg); padding: 18px; color: #fff; overflow: hidden; background: radial-gradient(120% 140% at 100% 0%, #2b4a8f 0%, transparent 55%), linear-gradient(160deg, #0f1d33 0%, #16294a 60%, #1d3866 100%); box-shadow: 0 14px 30px -18px rgba(11,20,36,.9); }
.cashbox-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.08); }
.cashbox-card.is-idle { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.cashbox-card.is-idle::after { background: var(--surface-2); }
.cashbox-card__name { font-size: 13px; opacity: .8; font-weight: 600; }
.cashbox-card__total { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 10px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.cashbox-card__methods { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; position: relative; z-index: 1; }
.cashbox-card__methods span { opacity: .78; }
.cashbox-card a { color: inherit; }
.cash-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cash-action { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; color: var(--text); }
.cash-action:hover { border-color: var(--brand-500); color: var(--primary); }
.cash-action .bi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; }

/* --- Kanban ----------------------------------------------------------------------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kanban-col { background: var(--surface-2); border-radius: var(--radius-lg); padding: 12px; min-height: 240px; border-top: 3px solid var(--col-color, var(--ink-400)); }
.kanban-col__head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.kanban-col__head .count { margin-left: auto; background: var(--surface); color: var(--text-muted); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.kanban-col.is-drop { outline: 2px dashed var(--brand-500); outline-offset: -4px; }
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); cursor: grab; display: block; color: var(--text); }
.lead-card:hover { border-color: var(--brand-500); color: var(--text); }
.lead-card.is-dragging { opacity: .5; }
.lead-card__name { font-weight: 700; font-size: 14px; }
.lead-card__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.lead-card__meta .overdue { color: var(--red-600); font-weight: 600; }

/* --- Timeline ----------------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 18px 44px; font-size: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot { position: absolute; left: 4px; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface); border: 2px solid var(--border); color: var(--text-muted); }
.timeline time { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* --- Profil ------------------------------------------------------------------------------ */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h1 { font-size: 22px; margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--text-muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; }
.nav-tabs-erp { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.nav-tabs-erp a { padding: 12px 14px; font-weight: 600; font-size: 14px; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-tabs-erp a:hover { color: var(--text); }
.nav-tabs-erp a.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- Ruxsatlar matritsasi ------------------------------------------------------------------ */
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.perm-group__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); font-weight: 700; }
.perm-group__body { padding: 12px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }

/* --- Login ----------------------------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.auth__art { background: radial-gradient(1200px 600px at -10% -10%, #5b5bf0 0%, transparent 55%), radial-gradient(900px 500px at 110% 110%, #7c3aed 0%, transparent 55%), var(--ink-950); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth__art h2 { color: #fff; font-size: 36px; font-weight: 800; line-height: 1.15; max-width: 460px; }
.auth__art p { color: #c3cbe0; max-width: 440px; font-size: 16px; }
.auth__features { display: grid; gap: 14px; margin-top: 28px; }
.auth__features div { display: flex; gap: 12px; align-items: center; color: #dfe5f3; }
.auth__features .bi { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.auth__form { display: grid; place-items: center; padding: 40px 24px; }
.auth__box { width: 100%; max-width: 380px; }
.auth__box h1 { font-size: 26px; margin-bottom: 6px; }

/* --- Moliya: oyma-oy jadval -------------------------------------------------------------------- */
.cell-paid { background: var(--green-100); color: var(--green-600); font-weight: 600; }
.cell-partial { background: var(--amber-100); color: #a36007; font-weight: 600; }
.cell-unpaid { background: var(--red-100); color: var(--red-600); font-weight: 600; }
.cell-none { color: var(--ink-300); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.chart-box { position: relative; height: 280px; }
.hide-amounts .amount-sensitive { filter: blur(7px); user-select: none; }

/* --- Qo'shimcha komponentlar ---------------------------------------------------------------------- */
.list-plain { list-style: none; margin: 0; padding: 4px 0; }
.list-plain li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 14px; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain li.is-unread { background: var(--primary-soft); }
.kv--compact { grid-template-columns: 1fr auto; }
.kv--compact dd { text-align: right; font-weight: 700; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--green-600); }
.subject-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13.5px; color: var(--text); }
.subject-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--subject, var(--primary)); }
.subject-chip:hover { border-color: var(--subject, var(--primary)); color: var(--text); }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-muted); }
.prio--high { background: var(--amber-100); color: #a35f05; }
.prio--urgent { background: var(--red-100); color: var(--red-600); }
.prio--low { opacity: .75; }
.kanban-col--new { --col-color: var(--ink-500); }
.kanban-col--progress { --col-color: var(--blue-600); }
.kanban-col--review { --col-color: var(--amber-500); }
.kanban-col--done { --col-color: var(--green-600); }
.dot-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red-600); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

/* Segment tanlov (davomat) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg__btn { padding: 5px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-muted); border-right: 1px solid var(--border); user-select: none; }
.seg__btn:last-of-type { border-right: 0; }
.btn-check:checked + .seg__btn--present { background: var(--green-100); color: var(--green-600); }
.btn-check:checked + .seg__btn--late { background: var(--amber-100); color: #a35f05; }
.btn-check:checked + .seg__btn--absent { background: var(--red-100); color: var(--red-600); }
.btn-check:checked + .seg__btn--excused { background: var(--blue-100); color: var(--blue-600); }
.btn-check:focus-visible + .seg__btn { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Dars jadvali */
.timetable td.tt-cell { position: relative; vertical-align: top; min-width: 150px; height: 64px; }
.tt-lesson { display: block; padding: 6px 8px 6px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--subject, var(--primary)); color: var(--text); font-size: 13px; margin-bottom: 4px; line-height: 1.3; }
.tt-lesson small { color: var(--text-muted); font-size: 11.5px; }
a.tt-lesson:hover { background: var(--primary-soft); color: var(--text); }
.tt-add { position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--text-muted); opacity: 0; transition: opacity .15s; }
.tt-cell:hover .tt-add, .tt-add:focus { opacity: 1; background: var(--surface-2); }

/* Jurnal */
.table-erp .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; white-space: nowrap; min-width: 200px; }
.journal th, .journal td { text-align: center; padding: 6px 4px; }
.journal td.sticky-col, .journal th.sticky-col { text-align: left; padding-left: 16px; }
.journal th.is-today { color: var(--primary); }
.j-cell { cursor: pointer; min-width: 38px; height: 40px; position: relative; }
.j-cell:hover, .j-cell:focus { background: var(--primary-soft); outline: none; }
.j-cell.is-future { cursor: default; background: repeating-linear-gradient(45deg, transparent 0 6px, var(--surface-2) 6px 7px); }
.j-input { position: absolute; inset: 3px; width: calc(100% - 6px); text-align: center; border: 2px solid var(--primary); border-radius: 6px; font-weight: 700; background: var(--surface); color: var(--text); }
.j-grade { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 7px; font-weight: 800; font-size: 13px; background: var(--surface-2); color: var(--text); margin: 1px; }
.j-grade--5, .j-grade--10, .j-grade--9 { background: var(--green-100); color: var(--green-600); }
.j-grade--4, .j-grade--8, .j-grade--7 { background: var(--blue-100); color: var(--blue-600); }
.j-grade--3, .j-grade--6 { background: var(--amber-100); color: #a35f05; }
.j-grade--2, .j-grade--1 { background: var(--red-100); color: var(--red-600); }

/* Oyma-oy jadval */
.table-matrix td, .table-matrix th { white-space: nowrap; font-size: 12.5px; }
.table-matrix td small { font-size: 10.5px; opacity: .7; }

/* Chek */
.receipt { max-width: 380px; margin: 0 auto; padding: 24px; font-size: 14px; }
.receipt__no { text-align: center; font-weight: 800; letter-spacing: .08em; border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border); padding: 8px 0; margin-bottom: 12px; }
.receipt__rows { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 12px; }
.receipt__rows dt { font-weight: 500; color: var(--text-muted); }
.receipt__rows dd { margin: 0; text-align: right; font-weight: 600; }
.receipt__total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--border); padding-top: 12px; margin-bottom: 6px; font-size: 16px; }
.receipt__total b { font-size: 22px; }
@media print { .receipt { max-width: 80mm; padding: 0; } body { background: #fff; } }

/* --- Moslashuvchanlik ----------------------------------------------------------------------------- */
.sidebar-backdrop { display: none; }
@media (max-width: 1199.98px) {
  .global-search { flex-basis: 260px; }
}
@media (max-width: 991.98px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s ease; }
  .app.sidebar-open .sidebar { transform: none; }
  .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(8,14,26,.5); z-index: 1035; }
  .topbar { padding: 0 16px; }
  .app-content { padding: 18px 16px 40px; }
  .global-search { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth__art { display: none; }
}
@media (max-width: 575.98px) {
  .stat { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat__value { font-size: 19px; overflow-wrap: anywhere; }
  .stat__icon { width: 34px; height: 34px; font-size: 16px; }
  .topbar__title { font-size: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 10px; }
  .page-head h1 { font-size: 20px; }
  .user-chip .user-chip__name { display: none; }
  .toast-stack { left: 16px; right: 16px; max-width: none; }
}
@media print {
  .sidebar, .topbar, .page-head__actions, .toolbar, .pager, .no-print { display: none !important; }
  .app { display: block; }
  .card-erp { border: 0; box-shadow: none; }
}

/* --- Chat ------------------------------------------------------------------------------------------------ */
/* --- Chat (Telegram uslubida) ------------------------------------------------------------------------ */
:root { --tg-wall-1: #d4dfa8; --tg-wall-2: #8cbf93; --tg-wall-3: #c6d99a; --tg-wall-4: #7fb08a; --tg-pattern-opacity: .11;
  --tg-in: #ffffff; --tg-out: #effdde; --tg-out-meta: #4fae4e; --tg-in-meta: #8e98a4; --tg-text: #0f1419; --tg-accent: #3390ec;
  --tg-day: rgba(52, 88, 52, .42); }
:root[data-theme="dark"] { --tg-wall-1: #0b131c; --tg-wall-2: #0e1621; --tg-wall-3: #0c141d; --tg-wall-4: #111c28; --tg-pattern-opacity: .05;
  --tg-in: #182533; --tg-out: #2b5278; --tg-out-meta: #7ab7f0; --tg-in-meta: #6d7f8f; --tg-text: #f5f5f5; --tg-day: rgba(0, 0, 0, .35); }
.chat { display: grid; grid-template-columns: 360px 1fr; gap: 0; height: calc(100vh - var(--topbar-h) - 56px); min-height: 460px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.chat .card-erp { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border: 0; border-radius: 0; box-shadow: none; }
.chat__list { border-right: 1px solid var(--border) !important; }
.chat__list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.chat__convs { list-style: none; margin: 0; padding: 0 6px 6px; overflow-y: auto; flex: 1 1 auto; }
.chat__convs a { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.chat__convs a:hover { background: var(--surface-2); }
.chat__convs a.is-active { background: var(--tg-accent); color: #fff; }
.chat__convs a.is-active small, .chat__convs a.is-active .text-muted { color: rgba(255, 255, 255, .85) !important; }
.chat__convs a.is-active .count-badge { background: #fff; color: var(--tg-accent); }
.chat__conv-main { flex: 1 1 auto; min-width: 0; }
.chat__conv-main b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat__conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; align-self: stretch; padding-top: 2px; }
.chat .count-badge { background: #c4c9cc; }
.chat__convs a:not(.is-active) .count-badge { background: var(--tg-accent); }
.chat__contacts { border-top: 1px solid var(--border); }
.tg-avatar { --av: #65aadd; width: 48px; height: 48px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; color: #fff;
  font-weight: 600; font-size: 17px; letter-spacing: .02em; background: linear-gradient(180deg, color-mix(in srgb, var(--av) 80%, #fff), var(--av)); }
.chat__thread-head .tg-avatar { width: 40px; height: 40px; font-size: 15px; }
.chat__thread-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 56px; border-bottom: 1px solid var(--border); background: var(--surface); position: relative; z-index: 2; }
.chat__thread-head small { font-size: 13px; }
.chat__wall { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  background: linear-gradient(135deg, var(--tg-wall-1) 0%, var(--tg-wall-2) 35%, var(--tg-wall-3) 65%, var(--tg-wall-4) 100%); }
.chat__wall::before { content: ""; position: absolute; inset: 0; background: url("../img/chat-pattern.05209d2e8f31.svg") 0 0 / 420px repeat; opacity: var(--tg-pattern-opacity); pointer-events: none; }
:root[data-theme="dark"] .chat__wall::before { filter: invert(1); }
.chat__messages { position: relative; flex: 1 1 auto; overflow-y: auto; padding: 12px 8% 12px; display: flex; flex-direction: column; gap: 2px; }
.tg-day { align-self: center; margin: 10px 0 6px; position: sticky; top: 4px; z-index: 1; }
.tg-day span { display: inline-block; padding: 3px 10px; border-radius: 12px; background: var(--tg-day); color: #fff; font-size: 13.5px; font-weight: 500; }
.tg-empty { margin: auto; } .tg-empty span { padding: 6px 14px; border-radius: 14px; background: var(--tg-day); color: #fff; font-size: 14px; }
.msg { max-width: min(78%, 520px); display: flex; align-self: flex-start; margin-left: 8px; }
.msg.is-first { margin-top: 6px; }
.msg--mine { align-self: flex-end; margin-left: 0; margin-right: 8px; }
.msg__bubble { position: relative; background: var(--tg-in); color: var(--tg-text); padding: 6px 9px 6px 11px; border-radius: 12px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .13); white-space: normal; overflow-wrap: anywhere; font-size: 15px; line-height: 1.35; }
.msg--mine .msg__bubble { background: var(--tg-out); }
/* dumcha — guruhning oxirgi xabarida */
.msg.is-last .msg__bubble { border-bottom-left-radius: 4px; }
.msg--mine.is-last .msg__bubble { border-bottom-left-radius: 12px; border-bottom-right-radius: 4px; }
.msg.is-last .msg__bubble::before { content: ""; position: absolute; bottom: 0; left: -8px; width: 9px; height: 16px; background: var(--tg-in);
  clip-path: path("M9 0 V16 H0 C4 15 8 11 9 0 Z"); filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .08)); }
.msg--mine.is-last .msg__bubble::before { left: auto; right: -8px; background: var(--tg-out); clip-path: path("M0 0 V16 H9 C5 15 1 11 0 0 Z"); }
.msg:not(.is-first) .msg__bubble { border-top-left-radius: 6px; }
.msg--mine:not(.is-first) .msg__bubble { border-top-left-radius: 12px; border-top-right-radius: 6px; }
.msg:not(.is-last) .msg__bubble { border-bottom-left-radius: 6px; }
.msg--mine:not(.is-last) .msg__bubble { border-bottom-left-radius: 12px; border-bottom-right-radius: 6px; }
.msg__author { font-size: 14px; font-weight: 600; margin-bottom: 1px; }
.msg__text { white-space: pre-wrap; }
.msg__hidden { color: var(--tg-in-meta); }
/* vaqt — pufakcha ichida, o'ng pastda (Telegram kabi matn oxiriga "suzadi") */
.msg__meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px -2px -4px 10px; font-size: 12px; color: var(--tg-in-meta); white-space: nowrap; line-height: 1; position: relative; top: 2px; }
.msg--mine .msg__meta { color: var(--tg-out-meta); }
.msg__tick { font-size: 16px; line-height: 1; margin-right: -3px; }
.msg__hide { border: 0; background: none; padding: 0 4px 0 0; color: inherit; opacity: 0; font-size: 12px; transition: opacity .15s; }
.msg:hover .msg__hide, .msg__hide:focus-visible { opacity: .7; }
.msg__hide:hover { opacity: 1; color: var(--red-600); }
.chat__composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 8% 14px; position: relative; z-index: 1; background: transparent; border: 0; }
.chat__composer.text-muted { justify-content: center; }
.chat__composer.text-muted::before { content: none; }
.chat__composer.text-muted { color: #fff !important; } .chat__composer.text-muted > * { background: var(--tg-day); padding: 6px 14px; border-radius: 14px; }
.tg-input { flex: 1 1 auto; min-height: 46px; max-height: 160px; resize: none; border: 0; outline: 0; border-radius: 14px; padding: 12px 16px; font-size: 15px;
  background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); line-height: 1.4; }
.tg-send { width: 46px; height: 46px; flex: 0 0 auto; border: 0; border-radius: 50%; display: grid; place-items: center; font-size: 19px;
  background: var(--surface); color: var(--tg-accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); transition: transform .12s, background .15s, color .15s; }
.tg-send:hover { background: var(--tg-accent); color: #fff; }
.tg-send:active { transform: scale(.94); }
.tg-send:disabled { opacity: .6; }
.chat__placeholder { margin: auto; position: relative; } .chat__placeholder span { padding: 6px 14px; border-radius: 14px; background: var(--tg-day); color: #fff; font-size: 14px; }
@media (max-width: 991.98px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - 40px); border-radius: 12px; }
  .chat.has-current .chat__list, .chat:not(.has-current) .chat__thread { display: none; }
  .chat__messages, .chat__composer { padding-left: 6px; padding-right: 6px; }
  .msg { max-width: 86%; }
}
/* --- Ota-ona portali: chat ------------------------------------------------------------------------------- */
.portal .chat { height: calc(100vh - 190px); height: calc(100dvh - 76px - 96px - env(safe-area-inset-bottom)); min-height: 380px;
  border-radius: 22px; overflow: hidden; border: 1px solid var(--border); }
.portal .chat__list { position: relative; background: linear-gradient(135deg, var(--tg-wall-1) 0%, var(--tg-wall-2) 35%, var(--tg-wall-3) 65%, var(--tg-wall-4) 100%); }
.portal .chat__list::before { content: ""; position: absolute; inset: 0; background: url("../img/chat-pattern.05209d2e8f31.svg") 0 0 / 420px repeat;
  opacity: var(--tg-pattern-opacity); pointer-events: none; }
.portal .chat__list > * { position: relative; }
.portal .chat__list-head { padding: 14px 16px 6px; }
.portal .chat__list-head h1 { color: #1f3a1f; font-weight: 800; }
:root[data-theme="dark"] .portal .chat__list-head h1 { color: var(--text); }
.pchat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.pchat-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: rgba(20, 50, 20, .7); margin: 2px 6px -6px; }
:root[data-theme="dark"] .pchat-label { color: var(--text-muted); }
.pchat-card { background: color-mix(in srgb, var(--surface) 94%, transparent); border-radius: 18px; box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .35);
  padding: 6px; margin: 0; flex: 0 0 auto; overflow: visible; }
.portal .chat__convs.pchat-card { padding: 6px; }
.pchat-contacts__head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; margin: 8px 10px 6px; }
.pchat-contacts__head .bi { color: var(--tg-accent); }
.pchat-contact { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 14px; background: transparent;
  color: var(--text); text-align: left; font: inherit; }
button.pchat-contact:hover, button.pchat-contact:focus-visible { background: var(--surface-2); }
.pchat-contact > .bi { color: var(--text-muted); }
.pchat-contact.is-off { opacity: .55; }
.pchat-contact .tg-avatar { width: 46px; height: 46px; font-size: 16px; }
.tg-avatar--admin { --av: #3390ec; font-size: 20px !important; }
.pchat-contact__main { flex: 1; min-width: 0; }
.pchat-contact__main b { display: block; font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchat-contact__main small { display: block; color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchat-tag { display: inline-block; padding: 1px 7px; margin-right: 6px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 700; }
.pchat-empty { margin: 10px 12px; color: var(--text-muted); font-size: 14px; }
@media (max-width: 991.98px) {
  /* ochiq suhbatda pastki menyu yashiriladi — yozish maydoni to'liq ko'rinadi (Telegram'dagidek) */
  body.portal:has(.chat.has-current) { padding-bottom: 0; }
  body.portal:has(.chat.has-current) .portal-tabbar { display: none; }
  body.portal:has(.chat.has-current) .portal-main { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .portal .chat.has-current { height: calc(100vh - 92px); height: calc(100dvh - 76px - 14px - env(safe-area-inset-bottom)); }
}
.portal-tabbar .dot-badge { top: 0; right: 18%; }

/* --- AI tahlil --------------------------------------------------------------------------------------------- */
.risk-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.risk-pill--high { background: var(--red-100); color: var(--red-600); }
.risk-pill--medium { background: var(--amber-100); color: #8a5a10; }
.risk-pill--low { background: var(--green-100); color: var(--green-600); }
.risk-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; min-width: 80px; }
.risk-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-500), var(--red-600)); }
.ai-summary { white-space: pre-wrap; line-height: 1.6; }

/* --- Hujjat varag'i --------------------------------------------------------------------------------------- */
.doc-sheet { background: #fff; color: #111; border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow); padding: 18mm 16mm; min-height: 240mm; font-family: "Liberation Serif", "Times New Roman", Georgia, serif; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.doc-sheet h1, .doc-sheet h2, .doc-sheet h3 { text-align: center; }
.doc-sheet table { width: 100%; border-collapse: collapse; }
@media (max-width: 767.98px) { .doc-sheet { padding: 20px 16px; min-height: 0; } }

/* --- Tasdiqlash bosqichlari ------------------------------------------------------------------------------ */
.wf-steps { list-style: none; margin: 0; padding: 12px 20px 16px; counter-reset: wf; }
.wf-step { position: relative; padding: 0 0 18px 36px; counter-increment: wf; }
.wf-step::before { content: counter(wf); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-muted); }
.wf-step:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--border); }
.wf-step--done::before { content: "✓"; background: var(--green-600); color: #fff; }
.wf-step--rejected::before { content: "✕"; background: var(--red-600); color: #fff; }
.wf-step--current::before { background: var(--amber-500); color: #fff; box-shadow: 0 0 0 4px var(--amber-100); }

/* --- Bosh sahifa vidjetlari --------------------------------------------------------------------------------- */
.dash-editbar { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20; background: var(--surface); border: 1px solid var(--primary); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.dash-item { position: relative; }
.dash-grid.is-editing .dash-item > :not(.dash-tools) { pointer-events: none; outline: 2px dashed var(--brand-100); outline-offset: 2px; border-radius: var(--radius); }
.dash-grid.is-editing .dash-item { cursor: grab; }
.dash-item.is-dragging { opacity: .45; }
.dash-tools { position: absolute; top: 6px; right: 18px; z-index: 5; display: flex; gap: 4px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 2px 4px; box-shadow: var(--shadow-sm); }
.dash-tools .btn { padding: 2px 8px; font-size: 12px; }
.dash-tools .btn.active { background: var(--primary); color: #fff; }
.dash-handle { padding: 0 4px; color: var(--text-muted); cursor: grab; }

/* --- Taqvim --------------------------------------------------------------------------------------------------- */
.cal { overflow: hidden; }
.cal__head, .cal__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__head div { padding: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.cal__day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; }
.cal__week .cal__day:last-child { border-right: 0; }
.cal__day.is-out { background: var(--bg); }
.cal__day.is-out .cal__num { opacity: .45; }
.cal__num { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.cal__num a { color: inherit; }
.cal__day.is-today .cal__num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 13px; background: var(--primary); color: #fff; padding: 0 6px; }
.cal__day.is-today .cal__num a { color: #fff; }
.cal__ev { font-size: 11.5px; line-height: 1.3; padding: 2px 6px; margin-bottom: 3px; border-radius: 6px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__more { font-size: 11px; color: var(--text-muted); padding-left: 4px; }
.cal__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
@media (max-width: 767.98px) { .cal__day { min-height: 64px; padding: 3px; } .cal__ev { font-size: 0; height: 6px; padding: 0; margin-bottom: 2px; } }

/* --- Bosh sahifa (v5) --------------------------------------------------------------------------------- */
.stat--stack { flex-direction: column; gap: 10px; }
.dash-item[data-size="xs"] .stat { flex-direction: column; gap: 10px; padding: 16px; }
.dash-item[data-size="xs"] .stat__value { font-size: 22px; }
.dash-item[data-size="xs"] .stat__label { line-height: 1.25; }
.dash-hero { position: relative; min-height: 168px; border-radius: var(--radius-lg); overflow: hidden; color: #fff; display: flex; align-items: flex-end;
  background: radial-gradient(120% 140% at 100% 0%, #6d5dfc 0%, transparent 55%), linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%); box-shadow: var(--shadow-sm); }
.dash-hero.has-cover { background: linear-gradient(90deg, rgba(15, 18, 45, .88) 0%, rgba(15, 18, 45, .55) 45%, rgba(15, 18, 45, .05) 100%), var(--hero-img) center / cover no-repeat; }
.dash-hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .06); pointer-events: none; }
.dash-hero.has-cover::after { display: none; }
.dash-hero__body { position: relative; z-index: 1; padding: 26px 28px; max-width: 640px; }
.dash-hero__title { font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; color: #fff; }
.dash-hero__tag { margin: 0 0 14px; opacity: .88; font-size: 15px; }
.dash-hero__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-hero__chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .14); backdrop-filter: blur(4px); }
.dash-hero__hint { position: absolute; right: 16px; top: 14px; z-index: 1; font-size: 12px; color: rgba(255, 255, 255, .8); }
.dash-hero__hint:hover { color: #fff; }
.sys-row { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dot--ok { background: var(--green-600); box-shadow: 0 0 0 3px var(--green-100); }
.dot--bad { background: #e29a1b; box-shadow: 0 0 0 3px var(--amber-100); }
.dot--off { background: var(--border); }
.subj { display: flex; align-items: center; gap: 20px; }
.subj__donut { position: relative; width: 168px; height: 168px; flex: 0 0 auto; }
.subj__center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.subj__center b { font-size: 26px; font-weight: 800; line-height: 1; }
.subj__center span { font-size: 12px; color: var(--text-muted); }
.subj__list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; font-size: 14px; }
.subj__list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.subj__list li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.subj__dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
@media (max-width: 420px) { .subj { flex-direction: column; } }
.branch-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; height: 100%; background: var(--surface); }
.branch-card.is-current { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }
.branch-card__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff; background: linear-gradient(135deg, #4338ca, #6d5dfc); flex: 0 0 auto; }
.branch-card__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px dashed var(--border); padding-top: 10px; }
.branch-card__nums b { display: block; font-size: 18px; font-weight: 800; }
.branch-card__nums span { font-size: 12px; color: var(--text-muted); }
.min-w-0 { min-width: 0; }
.table-erp--compact thead th { padding: 9px 12px; }
.table-erp--compact tbody td { padding: 9px 12px; font-size: 13.5px; }
.table-erp--compact td.text-end, .table-erp--compact td:last-child { white-space: nowrap; }
.mod-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 768px) { .mod-row { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .mod-row { grid-template-columns: repeat(6, 1fr); } }
.mod-tile { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; }
.mod-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.mod-tile__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: var(--brand-100); color: var(--brand-600); flex: 0 0 auto; }
.mod-tile b { display: block; font-size: 14px; }
.mod-tile small { color: var(--text-muted); font-size: 12px; }

/* Avtomatik filtr: «Filtrlash / Ko'rsatish» tugmasi kerak emas (JS o'chiq bo'lsa ko'rinadi) */
form.is-autofilter button:not([type=button]):not([name]):not(.dropdown-toggle) { display: none; }

/* --- Yig'ilgan sidebar (faqat kompyuter ekranida) ---------------------------------------------------- */
@media (min-width: 992px) {
  :root.sb-mini { --sidebar-w: 76px; }
  .sb-mini .sidebar { overflow: visible; }
  .sb-mini .sidebar .sb-text, .sb-mini .sidebar .nav-link-erp > span, .sb-mini .sidebar .chev,
  .sb-mini .branch-switch > span, .sb-mini .branch-switch > .bi-chevron-expand { display: none; }
  .sb-mini .sidebar__brand { justify-content: center; padding: 20px 0 16px; }
  .sb-mini .sidebar__branch { margin: 4px 12px 12px; }
  .sb-mini .branch-switch { justify-content: center; padding: 10px 0; }
  .sb-mini .sidebar__branch .dropdown-menu { min-width: 240px; }
  .sb-mini .sidebar__nav { padding: 4px 0 20px; overflow-x: hidden; }
  .sb-mini .nav-link-erp { justify-content: center; padding: 10px 0; width: 52px; margin: 0 auto; }
  .sb-mini .nav-link-erp .bi { font-size: 19px; }
  .sb-mini .sidebar__foot { justify-content: center; padding: 10px 0; }
  .sb-mini .sb-collapse { margin: 0; }
  .sb-mini .sb-collapse .bi { transform: rotate(180deg); }
  /* yon tomonda chiqadigan menyu va nom */
  .sb-mini .nav-section { position: relative; }
  .sb-mini .nav-sub, .sb-mini .nav-sub.collapse:not(.show) { display: none; position: fixed; left: calc(var(--sidebar-w) - 4px); top: var(--fy, 0); min-width: 220px;
    margin: 0; padding: 8px; background: var(--sidebar-bg); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.5); z-index: 1060; height: auto !important; }
  .sb-mini .nav-sub::before { display: none; }
  .sb-mini .nav-section:hover > .nav-sub { display: block; }
  .sb-mini .nav-sub__title { display: block; padding: 6px 12px 8px; color: #fff; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 4px; }
  .sb-mini .nav-section:not(:has(.nav-sub)):hover::after { content: attr(data-label); position: fixed; left: calc(var(--sidebar-w) + 4px); top: calc(var(--fy, 0) + 6px);
    padding: 6px 12px; border-radius: 8px; background: var(--ink-950, #0b1220); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; z-index: 1060; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); pointer-events: none; }
}
@media (max-width: 991.98px) { .sb-collapse { display: none; } }

/* Bosh sahifa sarlavhasi: sana, chorak, tizim holati */
.dash-head { align-items: center; margin-bottom: 16px; }
.dash-head__info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-head__date { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--text); text-transform: capitalize; }
.dash-head__date .bi { color: var(--primary); }
.dash-head__chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.dash-head__sys { cursor: pointer; }
.dash-head__sys.is-warn { color: #a36007; border-color: var(--amber-100); background: var(--amber-100); }

/* Bosh sahifa: joriy filial / barcha filiallar */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.seg__btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.dash-scope-note { margin: -4px 0 14px; padding: 9px 14px; border-radius: 12px; background: var(--brand-100); color: var(--brand-700); font-size: 13.5px; }
.dash-scope-note a { font-weight: 600; margin-left: 6px; }

/* Portal: oflayn / keshdagi ma'lumot belgisi */
.portal-stale { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 1080;
  max-width: calc(100vw - 24px); padding: 8px 14px; border-radius: 999px; background: #1f2937; color: #fff; font-size: 13px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45); display: flex; align-items: center; gap: 8px; }
.portal-stale[hidden] { display: none; }

.branch-mode-note { margin: -6px 0 14px; padding: 8px 14px; border-radius: 12px; background: var(--amber-100); color: #8a5306; font-size: 13px; }
.branch-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; }

/* --- AI savol generatori ------------------------------------------------------------- */
.grade-lock { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-size: 14px; }
.grade-lock .bi { font-size: 18px; }
.steps-list { padding-left: 1.1rem; margin-bottom: 12px; font-size: 14px; }
.steps-list li { margin-bottom: 8px; }
.job-line { display: flex; align-items: center; gap: 10px; width: 100%; color: var(--text); min-width: 0; }
.job-line:hover { color: var(--primary); }
.job-line__dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--ink-300); }
.job-line__dot--done { background: var(--green-600); }
.job-line__dot--failed { background: var(--red-600); }
.job-line__dot--running, .job-line__dot--pending { background: var(--amber-500); animation: gen-pulse 1s infinite alternate; }
@keyframes gen-pulse { to { opacity: .45; } }
.gen-q { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.gen-q.is-flagged { border-color: color-mix(in srgb, var(--red-600) 45%, var(--border)); }
.gen-q.is-approved { border-color: color-mix(in srgb, var(--green-600) 45%, var(--border)); }
.gen-q__head { display: flex; align-items: flex-start; gap: 12px; }
.gen-q__num { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; font-size: 13px; }
.gen-q__text { flex: 1; font-weight: 600; white-space: pre-line; min-width: 0; }
.gen-q__opts { list-style: none; padding: 0; margin: 12px 0 0 42px; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gen-q__opts li { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 9px; background: var(--surface-2); font-size: 14px; }
.gen-q__opts li.is-correct { background: var(--green-100); color: var(--green-600); font-weight: 600; }
.gen-q__opts li b { width: 18px; flex: 0 0 auto; }
.gen-q__expl { margin: 10px 0 0 42px; font-size: 13px; color: var(--text-muted); white-space: pre-line; }
.gen-q__check { margin: 10px 0 0 42px; font-size: 13px; padding: 8px 12px; border-radius: 10px; }
.gen-q__check--ok { background: var(--green-100); color: var(--green-600); }
.gen-q__check--bad { background: var(--red-100); color: var(--red-600); }
.gen-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; margin-top: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
:root[data-theme="dark"] .pchat-tag { background: rgba(129, 140, 248, .2); color: #c7d2fe; }
.ai-free { padding: 10px 0; border-bottom: 1px solid var(--border); }
.ai-free:first-child { padding-top: 0; }
/* Lid voronkasi: bosqichlarni boshqarish */
.kanban-col__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-col__head .dropdown { margin-right: -6px; }
.kanban-col__menu { width: 28px; height: 28px; padding: 0; }
.kanban-grip { cursor: grab; color: var(--text-muted); margin-left: -4px; display: inline-flex; }
.kanban-grip:active { cursor: grabbing; }
.kanban-col.is-moving { opacity: .55; outline: 2px dashed var(--col-color, var(--brand-500)); outline-offset: -4px; }
.kanban-add { min-height: 120px; border: 2px dashed var(--border); border-radius: var(--radius-lg); background: transparent; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; transition: all .15s; }
.kanban-add:hover { border-color: var(--brand-500); color: var(--brand-600); background: var(--primary-soft); }
.kanban-add .bi { font-size: 22px; }
.stage-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stage-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--c); box-shadow: inset 0 0 0 2px var(--surface); }
.stage-swatch.is-on { border-color: var(--c); box-shadow: inset 0 0 0 3px var(--surface); }
.stage-kind { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; }
.stage-kind:has(input:checked) { border-color: var(--brand-500); background: var(--primary-soft); }
.stage-kind input { margin-top: 3px; }
