/* =====================================================================
   Kutubxona — Admin panel uslublari (Bootstrap 5.3 ustiga)
   Premium dizayn: mobil ilova bilan bir xil brend gradienti, yumaloq tekis
   kartochkalar, telefon uchun pastki navigatsiya va kartochkali ro‘yxatlar.
   ===================================================================== */
:root {
    --kl-sidebar-w: 272px;
    --kl-topbar-h: 68px;
    --kl-bottom-h: 68px;
    --kl-radius: 20px;
    --kl-radius-sm: 12px;
    --kl-grad-start: #1d4ed8;
    --kl-grad-end: #7c3aed;
    --kl-gradient: linear-gradient(135deg, var(--kl-grad-start), var(--kl-grad-end));
    --kl-surface: #ffffff;
    --kl-surface-2: #f4f6fb;
    --kl-border: #e4e8f0;
    --kl-muted: #667085;
    --kl-chart-bar: #2563eb;
    --kl-chart-grid: #e7e9ee;
    --kl-safe-bottom: env(safe-area-inset-bottom, 0px);
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-link-color: #2563eb;
    --bs-link-color-rgb: 37, 99, 235;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-border-radius: 12px;
}
[data-bs-theme="dark"] {
    --kl-grad-start: #1e3a8a;
    --kl-grad-end: #4c1d95;
    --kl-surface: #161a21;
    --kl-surface-2: #0f1216;
    --kl-border: #262c36;
    --kl-muted: #98a2b3;
    --kl-chart-bar: #3b82f6;
    --kl-chart-grid: #2c313a;
    --bs-body-bg: #0f1216;
    --bs-tertiary-bg: #161a21;
    --bs-link-color: #6ea8fe;
    --bs-link-color-rgb: 110, 168, 254;
}

/* ---------- Asosiy ---------- */
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.min-w-0 { min-width: 0; }
.admin-body { background: var(--kl-surface-2); min-height: 100vh; }

.btn-primary {
    --bs-btn-bg: #2563eb; --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #1d4ed8; --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1e40af; --bs-btn-active-border-color: #1e40af;
    --bs-btn-disabled-bg: #2563eb; --bs-btn-disabled-border-color: #2563eb;
}
.btn-outline-primary {
    --bs-btn-color: #2563eb; --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #2563eb; --bs-btn-hover-border-color: #2563eb;
    --bs-btn-active-bg: #2563eb; --bs-btn-active-border-color: #2563eb;
}
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #6ea8fe; --bs-btn-border-color: #3b82f6; }
.btn { border-radius: 12px; font-weight: 500; }
.btn-lg { border-radius: 14px; }
.btn-gradient { background: var(--kl-gradient); color: #fff; border: 0; padding: .65rem 1rem; }
.btn-gradient:hover, .btn-gradient:focus-visible { color: #fff; filter: brightness(1.08); text-decoration: none; }
.btn-light { background: var(--kl-surface-2); border-color: var(--kl-border); }
.btn-icon { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 12px; color: var(--kl-muted); border: 0; background: transparent; }
.btn-icon:hover { background: var(--kl-surface-2); color: var(--bs-body-color); }
.btn-icon.btn-sm { width: 36px; height: 36px; }

.input-group > .form-control, .input-group > .btn, .input-group > .input-group-text { border-radius: 12px; }
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.form-label { font-weight: 500; }

/* Kartochkalar: tekis, ingichka chegara, katta radius */
.card { background: var(--kl-surface); border: 1px solid var(--kl-border); border-radius: var(--kl-radius); box-shadow: none; }
.card-header:first-child { border-radius: var(--kl-radius) var(--kl-radius) 0 0; }
.card-footer:last-child { border-radius: 0 0 var(--kl-radius) var(--kl-radius); }
.card-header, .card-footer { border-color: var(--kl-border); padding: .9rem 1.15rem; }
.card-header h2 { font-weight: 600; }
.list-group-item { background: transparent; border-color: var(--kl-border); }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { border-color: var(--kl-border); }
.table-light { --bs-table-bg: var(--kl-surface-2); --bs-table-color: var(--kl-muted); }
.table thead th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge { border-radius: 8px; font-weight: 600; }
.nav-pills .nav-link { border-radius: 12px; color: var(--kl-muted); white-space: nowrap; }
.nav-pills .nav-link.active { background: var(--kl-gradient); color: #fff; }
.pagination { --bs-pagination-border-radius: 10px; }
.page-link { border-color: var(--kl-border); }

/* ---------- Sidebar ---------- */
.admin-sidebar { background: var(--kl-surface); border-right: 1px solid var(--kl-border); }
@media (min-width: 992px) {
    .admin-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--kl-sidebar-w); z-index: 1030; }
    .admin-main { margin-left: var(--kl-sidebar-w); }
}
@media (max-width: 991.98px) { .admin-sidebar { --bs-offcanvas-width: min(300px, 86vw); } }
.sidebar-hero { position: relative; display: flex; align-items: center; gap: .5rem; padding: 1.1rem 1rem; padding-top: calc(1.1rem + env(safe-area-inset-top, 0px)); background: var(--kl-gradient); color: #fff; overflow: hidden; }
.sidebar-hero::before, .sidebar-hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); pointer-events: none; }
.sidebar-hero::before { width: 150px; height: 150px; right: -50px; top: -70px; }
.sidebar-hero::after { width: 80px; height: 80px; right: 60px; bottom: -50px; }
.sidebar-brand { position: relative; display: flex; align-items: center; gap: .75rem; color: #fff; min-width: 0; }
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.brand-ring { width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .2); border: 2px solid rgba(255, 255, 255, .35); }
.brand-ring img { border-radius: 8px; }
.brand-name { display: block; font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.brand-sub { display: block; font-size: .78rem; opacity: .85; }
.sidebar-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--kl-muted); padding: 0 .5rem .5rem; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .75rem; color: var(--bs-body-color); border-radius: 14px; padding: .5rem .6rem; margin-bottom: 4px; min-height: 48px; font-weight: 500; }
.sidebar-nav .nav-link:hover { background: var(--kl-surface-2); text-decoration: none; }
.sidebar-nav .nav-icon { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-surface-2); color: #2563eb; font-size: 1.05rem; flex-shrink: 0; }
[data-bs-theme="dark"] .sidebar-nav .nav-icon { color: #6ea8fe; }
.sidebar-nav .nav-link.active { background: rgba(37, 99, 235, .1); color: #1d4ed8; font-weight: 600; }
.sidebar-nav .nav-link.active .nav-icon { background: var(--kl-gradient); color: #fff; }
[data-bs-theme="dark"] .sidebar-nav .nav-link.active { color: #93c5fd; background: rgba(59, 130, 246, .14); }
.admin-card { display: flex; align-items: center; gap: .75rem; padding: .75rem; border: 1px solid var(--kl-border); border-radius: 16px; background: var(--kl-surface-2); }
.avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-gradient); color: #fff; font-weight: 700; }
.avatar-sm { width: 30px; height: 30px; font-size: .85rem; }

/* ---------- Topbar ---------- */
.admin-topbar { position: sticky; top: 0; z-index: 1020; min-height: var(--kl-topbar-h); display: flex; align-items: center; gap: .75rem; padding: env(safe-area-inset-top, 0px) 1.5rem 0; background: color-mix(in srgb, var(--kl-surface) 88%, transparent); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--kl-border); }
.topbar-title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.topbar-search { position: relative; align-items: center; margin-left: 1rem; flex: 0 1 380px; }
.topbar-search .bi { position: absolute; left: .9rem; color: var(--kl-muted); }
.topbar-search .form-control { padding-left: 2.4rem; border-radius: 999px; background: var(--kl-surface-2); height: 42px; }
.topbar-user { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--kl-border); border-radius: 999px; padding: .2rem .8rem .2rem .2rem; background: var(--kl-surface); }
.dropdown-menu { border-radius: 14px; border-color: var(--kl-border); padding: .4rem; box-shadow: 0 12px 32px rgba(16, 24, 40, .12); }
.dropdown-item { border-radius: 10px; padding: .55rem .75rem; }

.admin-content { padding: 1.5rem; max-width: 1600px; }
.sticky-offset { top: calc(var(--kl-topbar-h) + 1rem); }

/* ---------- Telefon: pastki navigatsiya ---------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; display: flex; align-items: center; justify-content: space-around; height: calc(var(--kl-bottom-h) + var(--kl-safe-bottom)); padding-bottom: var(--kl-safe-bottom); background: color-mix(in srgb, var(--kl-surface) 94%, transparent); backdrop-filter: saturate(160%) blur(12px); border-top: 1px solid var(--kl-border); }
.bottom-link { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .35rem 0; color: var(--kl-muted); font-size: .72rem; font-weight: 600; min-height: 52px; justify-content: center; }
.bottom-link .bi { font-size: 1.25rem; width: 56px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; transition: background-color .2s; }
.bottom-link:hover { text-decoration: none; color: var(--bs-body-color); }
.bottom-link.active { color: #1d4ed8; }
.bottom-link.active .bi { background: rgba(37, 99, 235, .14); }
[data-bs-theme="dark"] .bottom-link.active { color: #93c5fd; }
.bottom-fab { width: 54px; height: 54px; margin-top: -26px; flex-shrink: 0; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-gradient); color: #fff; font-size: 1.5rem; border: 4px solid var(--kl-surface-2); }
.bottom-fab:hover { color: #fff; text-decoration: none; filter: brightness(1.08); }
@media (max-width: 991.98px) {
    .admin-content { padding-bottom: calc(var(--kl-bottom-h) + var(--kl-safe-bottom) + 1.25rem); }
    .admin-toasts { bottom: calc(var(--kl-bottom-h) + var(--kl-safe-bottom)); }
}
@media (min-width: 992px) { .admin-toasts { bottom: 0; } }
@media (max-width: 575.98px) {
    .admin-content { padding-left: 1rem; padding-right: 1rem; padding-top: 1rem; }
    .admin-topbar { padding-left: .75rem; padding-right: .75rem; }
    .topbar-title { font-size: 1.05rem; }
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
}

/* ---------- Boshqaruv paneli ---------- */
.page-hero { position: relative; overflow: hidden; border-radius: 24px; padding: 1.5rem; margin-bottom: 1.25rem; background: var(--kl-gradient); color: #fff; }
.page-hero::before, .page-hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); pointer-events: none; }
.page-hero::before { width: 260px; height: 260px; right: -80px; top: -120px; }
.page-hero::after { width: 140px; height: 140px; right: 180px; bottom: -90px; }
.page-hero > * { position: relative; }
.page-hero h2 { font-weight: 800; font-size: 1.5rem; margin: 0; }
.page-hero p { opacity: .88; margin: .25rem 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.hero-action { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .95rem; border-radius: 999px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); color: #fff; font-weight: 600; font-size: .9rem; }
.hero-action:hover { background: rgba(255, 255, 255, .28); color: #fff; text-decoration: none; }
.hero-action.primary { background: #fff; color: #1d4ed8; border-color: #fff; }
.hero-action.primary:hover { color: #1e40af; background: #f1f5ff; }

.stat-card .card-body { padding: 1rem 1.1rem; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) {
    .stat-card .card-body { flex-direction: column; gap: .6rem !important; }
    .stat-card .stat-value { font-size: 1.35rem; }
    .stat-card .card-body > .min-w-0 { width: 100%; }
}
.stat-link { color: inherit; display: block; height: 100%; }
.stat-link:hover { text-decoration: none; }
.stat-link:hover .card { border-color: rgba(37, 99, 235, .45); }

/* Ko‘rishlar diagrammasi (bitta seriya, ustunli) */
.views-chart { position: relative; height: 240px; padding: 18px 0 26px 36px; }
.chart-grid { position: absolute; inset: 18px 0 26px 36px; }
.chart-gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--kl-chart-grid); }
.chart-gridline[data-pos="1"] { top: 0; }
.chart-gridline[data-pos="0.5"] { top: 50%; }
.chart-gridline[data-pos="0"] { bottom: 0; border-top-color: var(--kl-border); }
.chart-gridline span { position: absolute; left: -36px; top: -.6em; width: 30px; text-align: right; font-size: .75rem; color: var(--kl-muted); font-variant-numeric: tabular-nums; }
.chart-bars { position: relative; height: 100%; display: flex; align-items: flex-end; gap: 2px; }
.chart-col { position: relative; flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline: none; cursor: default; border-radius: 6px; }
.chart-col:hover, .chart-col:focus-visible { background: rgba(127, 127, 127, .07); }
.chart-col:focus-visible { box-shadow: 0 0 0 2px var(--kl-chart-bar); }
.chart-bar { width: min(24px, 70%); min-height: 0; background: var(--kl-chart-bar); border-radius: 4px 4px 0 0; transition: height .4s ease; height: 0; }
.chart-x { position: absolute; bottom: -22px; font-size: .7rem; color: var(--kl-muted); white-space: nowrap; }
.chart-peak { font-size: .75rem; font-weight: 600; color: var(--bs-body-color); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.chart-tooltip { position: fixed; z-index: 2000; pointer-events: none; background: var(--kl-surface); color: var(--bs-body-color); border: 1px solid var(--kl-border); border-radius: 10px; padding: .4rem .65rem; font-size: .8rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); white-space: nowrap; }
.chart-tooltip .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--kl-chart-bar); margin-right: 6px; }

/* ---------- Jadval elementlari ---------- */
.cover-cell { width: 64px; }
.cover-thumb { width: 44px; height: 62px; object-fit: cover; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-surface-2); border: 1px solid var(--kl-border); }
.cover-empty { color: var(--kl-muted); }
.books-table td { vertical-align: middle; }
.books-table .title-cell { max-width: 320px; }
.row-muted td { opacity: .6; }
.cat-thumb { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-surface-2); color: var(--kl-muted); flex-shrink: 0; }
.cat-thumb-lg { width: 56px; height: 56px; }
.cat-thumb-icon { background: var(--kl-gradient); color: #fff; }
.cat-thumb-icon svg { width: 20px; height: 20px; }
.tree-indent[data-depth="1"] { padding-left: 1.25rem; }
.tree-indent[data-depth="2"] { padding-left: 2.5rem; }
.tree-indent[data-depth="3"] { padding-left: 3.75rem; }
.tree-indent[data-depth="4"] { padding-left: 5rem; }
.tree-indent[data-depth="5"] { padding-left: 6.25rem; }
.tree-indent[data-depth="6"], .tree-indent[data-depth="7"], .tree-indent[data-depth="8"] { padding-left: 7.5rem; }
.tree-filter { max-width: 220px; }
.log-details { max-width: 340px; }

/* Telefon: jadval qatorlari kartochkaga aylanadi */
@media (max-width: 767.98px) {
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--kl-border); }
    .table-cards tbody tr:last-child { border-bottom: 0; }
    .table-cards tbody td { display: block; border: 0; padding: 0; }
    .table-cards tbody td.text-end { text-align: left !important; }
    .table-cards tbody td[colspan] { width: 100%; text-align: center !important; }
    /* Kitoblar: muqova | nom+muallif; pastda holat va amallar */
    .books-table tbody td.cover-cell { width: auto; }
    .books-table tbody td.title-cell { flex: 1 1 0; min-width: 0; max-width: none; }
    .books-table tbody td.status-cell { order: 3; }
    .books-table tbody td.actions-cell { order: 4; width: 100%; display: flex; gap: .25rem; justify-content: flex-end; border-top: 1px dashed var(--kl-border); padding-top: .5rem; }
    .books-table tbody td.actions-cell .btn-icon { width: 42px; height: 42px; background: var(--kl-surface-2); }
    /* Bo‘limlar daraxti */
    .cat-table tbody td:first-child { flex: 1 1 100%; }
    .cat-table tbody td.cat-actions { flex: 1 1 auto; text-align: right !important; }
    .cat-table tbody td.cat-actions .btn-icon { background: var(--kl-surface-2); }
    .tree-indent[data-depth] { padding-left: 0; }
    .tree-filter { max-width: none; flex: 1 1 100%; }
    /* Jurnal */
    .log-table tbody td { font-size: .85rem; }
    .log-table tbody td.log-time { width: 100%; color: var(--kl-muted); }
}

/* Bo‘lim ikonkasi tanlagichi */
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: .45rem; }
.icon-option { position: relative; cursor: pointer; margin: 0; }
.icon-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.icon-tile { display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 12px; border: 1px solid var(--kl-border); color: var(--kl-muted); background: var(--kl-surface); transition: background-color .15s, border-color .15s, color .15s; }
.icon-tile svg { width: 22px; height: 22px; }
.icon-option:hover .icon-tile { border-color: var(--bs-primary); color: var(--bs-primary); }
.icon-option input:checked + .icon-tile { background: var(--kl-gradient); border-color: transparent; color: #fff; }
.icon-option input:focus-visible + .icon-tile { outline: 2px solid var(--bs-primary); outline-offset: 2px; }

/* ---------- Formalar ---------- */
.cover-preview { aspect-ratio: 2 / 3; max-width: 220px; margin: 0 auto; border: 2px dashed var(--kl-border); border-radius: 16px; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; background: var(--kl-surface-2); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-preview-sm { aspect-ratio: 1; max-width: 120px; }
/* Telefon: "Saqlash" tugmalari ekran pastida doim ko‘rinadi */
@media (max-width: 991.98px) {
    .form-actions-sticky { position: sticky; bottom: calc(var(--kl-bottom-h) + var(--kl-safe-bottom) + .5rem); z-index: 5; padding: .6rem; border-radius: 18px; background: color-mix(in srgb, var(--kl-surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--kl-border); }
}

/* ---------- Sozlamalar tablari (ikonkali, premium) ---------- */
.settings-tabs { flex-wrap: nowrap; overflow-x: auto; gap: .35rem; padding: .4rem; background: var(--kl-surface); border: 1px solid var(--kl-border); border-radius: 18px; scrollbar-width: none; }
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs .nav-link { display: inline-flex; align-items: center; gap: .55rem; padding: .45rem .9rem .45rem .45rem; border-radius: 14px; color: var(--bs-body-color); font-weight: 600; white-space: nowrap; min-height: 46px; }
.settings-tabs .nav-link:hover { background: var(--kl-surface-2); }
.settings-tabs .tab-icon { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-surface-2); color: #2563eb; font-size: 1rem; flex-shrink: 0; transition: background-color .15s, color .15s; }
[data-bs-theme="dark"] .settings-tabs .tab-icon { color: #6ea8fe; }
.settings-tabs .nav-link.active { background: var(--kl-gradient); color: #fff; }
.settings-tabs .nav-link.active .tab-icon { background: rgba(255, 255, 255, .22); color: #fff; }
.settings-tabs .nav-link.tab-danger { color: #be123c; }
.settings-tabs .nav-link.tab-danger .tab-icon { color: #e11d48; background: rgba(225, 29, 72, .1); }
.settings-tabs .nav-link.tab-danger.active { background: linear-gradient(135deg, #e11d48, #f97316); color: #fff; }
.settings-tabs .nav-link.tab-danger.active .tab-icon { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------- Sozlamalar tablari ----------
   "Umumiy", "API", "Matnlar" panellari bitta forma ichida (bitta "Saqlash"): Bootstrap faqat
   .tab-content'ning bevosita bolalarini yashiradi — forma ichidagi faol bo‘lmagan panellar ham yashirilsin,
   aks holda ular shaffof bo‘lib joy egallaydi (tab almashganda kontent pastga tushib ketadi). */
.contents-form > .tab-pane { display: none; }
.contents-form > .tab-pane.active { display: block; }

/* ---------- Boshqaruv paneli: eng ko‘p o‘qilganlar ---------- */
.top-books { list-style: none; margin: 0; padding: .35rem .5rem .6rem; }
.top-book { display: flex; align-items: center; gap: .75rem; padding: .6rem .6rem; border-radius: 14px; }
.top-book:hover { background: var(--kl-surface-2); }
.top-rank { width: 30px; height: 30px; flex-shrink: 0; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .85rem; background: var(--kl-surface-2); color: var(--kl-muted); }
.top-rank.rank-1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.top-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #cbd5e1); color: #fff; }
.top-rank.rank-3 { background: linear-gradient(135deg, #c2410c, #fb923c); color: #fff; }
.top-cover { width: 38px; height: 54px; flex-shrink: 0; border-radius: 8px; object-fit: cover; border: 1px solid var(--kl-border); background: var(--kl-surface-2); }
.top-cover-empty { display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--kl-gradient); border: 0; }
.top-title { display: block; font-weight: 600; color: var(--bs-body-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.top-title:hover { color: #2563eb; text-decoration: none; }
.top-meta { font-size: .75rem; color: var(--kl-muted); display: flex; align-items: center; gap: .3rem; margin-top: 1px; }
.top-bar { height: 5px; border-radius: 99px; background: var(--kl-surface-2); margin-top: .4rem; overflow: hidden; }
.top-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--kl-gradient); }
.top-views { flex-shrink: 0; display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; border-radius: 9px; font-size: .8rem; font-weight: 700; color: #1d4ed8; background: rgba(37, 99, 235, .1); font-variant-numeric: tabular-nums; }
[data-bs-theme="dark"] .top-views { color: #93c5fd; }
.top-empty { display: flex; align-items: center; gap: .5rem; padding: 1.5rem .6rem; color: var(--kl-muted); }

/* ---------- Reklama bannerlari ---------- */
.interval-form { display: flex; align-items: center; gap: .45rem; padding: .45rem .55rem .45rem .85rem; border-radius: 14px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); font-weight: 600; font-size: .9rem; }
.interval-form label { margin: 0; white-space: nowrap; }
.interval-form .form-control { width: 70px; min-height: 36px; text-align: center; font-weight: 700; }
.hero-stats.hero-stats-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 767.98px) { .hero-stats.hero-stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.banner-item { overflow: hidden; }
.banner-item.is-editing { border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.banner-item.is-off .banner-thumb img { filter: grayscale(.6); opacity: .75; }
.banner-thumb { position: relative; aspect-ratio: 2 / 1; background: var(--kl-surface-2); }
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-status { position: absolute; top: .75rem; left: .75rem; display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 700; backdrop-filter: blur(6px); background-color: rgba(255, 255, 255, .88); }
.banner-status[class*="tone-"] { background-color: rgba(255, 255, 255, .94); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.banner-order { position: absolute; top: .75rem; right: .75rem; padding: .2rem .55rem; border-radius: 9px; font-size: .75rem; font-weight: 800; color: #fff; background: rgba(15, 23, 42, .55); }
.banner-overlay { position: absolute; inset: auto 0 0 0; padding: 1.5rem 1rem .8rem; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }
.banner-meta, .banner-stats { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .85rem; color: var(--kl-muted); }
.banner-meta .bi, .banner-stats .bi { margin-right: .3rem; color: #2563eb; }
.banner-stats { margin-top: .5rem; font-weight: 600; color: var(--bs-body-color); }
.banner-preview { aspect-ratio: 2 / 1; border: 2px dashed var(--kl-border); border-radius: 16px; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; background: var(--kl-surface-2); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Adminlar va ruxsatlar ---------- */
.avatar-lg { width: 52px; height: 52px; font-size: 1.25rem; }
.avatar-xl { width: 64px; height: 64px; font-size: 1.6rem; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .4); }
.avatar-assistant { background: linear-gradient(135deg, #0ea5e9, #10b981); }
.admin-item { transition: border-color .15s; }
.admin-item.is-editing { border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.admin-item.is-blocked { opacity: .7; }
.role-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.role-super { background: var(--kl-gradient); color: #fff; }
.role-assistant { background: rgba(14, 165, 233, .14); color: #0369a1; }
.role-me { background: var(--kl-surface-2); color: var(--kl-muted); border: 1px solid var(--kl-border); }
.role-blocked { background: rgba(225, 29, 72, .12); color: #be123c; }
[data-bs-theme="dark"] .role-assistant { color: #7dd3fc; }
[data-bs-theme="dark"] .role-blocked { color: #fb7185; }
.perm-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.perm-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 10px; font-size: .8rem; font-weight: 600; background: rgba(37, 99, 235, .08); color: #1d4ed8; border: 1px solid rgba(37, 99, 235, .18); }
[data-bs-theme="dark"] .perm-chip { color: #93c5fd; }
.perm-chip.perm-all { background: var(--kl-gradient); color: #fff; border-color: transparent; }
.perm-chip.perm-none { background: var(--kl-surface-2); color: var(--kl-muted); border-color: var(--kl-border); }
.admin-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px dashed var(--kl-border); }
.perm-grid { display: grid; gap: .5rem; }
.perm-card { display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem; border-radius: 14px; border: 1.5px solid var(--kl-input-border); background: var(--kl-input-bg); cursor: pointer; margin: 0; transition: border-color .15s, background-color .15s; }
.perm-card:hover { border-color: var(--kl-input-border-hover); }
.perm-card:has(.form-check-input:checked) { border-color: rgba(37, 99, 235, .55); background: rgba(37, 99, 235, .05); }
.perm-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-surface-2); color: #2563eb; font-size: 1.05rem; }
.perm-card:has(.form-check-input:checked) .perm-icon { background: var(--kl-gradient); color: #fff; }
.tab-icon { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-surface-2); color: #2563eb; flex-shrink: 0; }
.admin-card-link { color: inherit; }
.admin-card-link:hover { text-decoration: none; color: #2563eb; }

/* ---------- Zavod holatiga qaytarish ---------- */
.reset-card { overflow: hidden; border-color: rgba(225, 29, 72, .35); }
.reset-hero { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.25rem; color: #fff; background: linear-gradient(135deg, #e11d48, #f97316); }
.reset-ring { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .4); font-size: 1.5rem; }
.reset-box { height: 100%; border-radius: 16px; padding: 1rem; border: 1px solid var(--kl-border); }
.reset-box-danger { background: rgba(225, 29, 72, .06); border-color: rgba(225, 29, 72, .25); }
.reset-box-safe { background: rgba(16, 185, 129, .07); border-color: rgba(16, 185, 129, .3); }

/* ---------- Tasdiqlash oynasi ---------- */
.modal-content { border-radius: 24px; border: 0; overflow: hidden; }
.confirm-hero { height: 110px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #e11d48, #f97316); }
.confirm-ring { width: 68px; height: 68px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .4); color: #fff; font-size: 1.8rem; }

/* ---------- Login va mehmon sahifalar ---------- */
.guest-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--kl-gradient); position: relative; overflow-x: hidden; }
.guest-body::before, .guest-body::after { content: ""; position: fixed; border-radius: 50%; background: rgba(255, 255, 255, .1); pointer-events: none; }
.guest-body::before { width: 520px; height: 520px; right: -180px; top: -200px; }
.guest-body::after { width: 320px; height: 320px; left: -120px; bottom: -140px; }
.guest-wrap { position: relative; z-index: 1; width: 100%; max-width: 440px; padding: 1.5rem 1rem; }
.guest-wrap > .text-secondary { color: rgba(255, 255, 255, .85) !important; }
.login-card { border-radius: 28px; border: 0; }
.login-logo { width: 76px; height: 76px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--kl-gradient); margin-bottom: 1rem; }
.error-card { max-width: 560px; overflow: hidden; margin-top: 1rem; }
.error-hero { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 2rem 1rem; background: var(--kl-gradient); color: #fff; }
.error-hero-danger { background: linear-gradient(135deg, #e11d48, #f97316); }
.error-code { font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.legal-page { max-width: 820px; }
.legal-text { line-height: 1.7; }

/* =====================================================================
   Formalar (professional): aniq chegara, 46px balandlik, hover/focus halqasi,
   ikonka bilan input-group, katta kalitlar, gradientli fayl tanlash tugmasi
   ===================================================================== */
:root {
    --kl-input-bg: #ffffff;
    --kl-input-border: #cfd6e4;
    --kl-input-border-hover: #94a3b8;
    --kl-input-focus: #2563eb;
    --kl-input-ring: rgba(37, 99, 235, .16);
    --kl-input-disabled: #f1f4f9;
}
[data-bs-theme="dark"] {
    --kl-input-bg: #11151b;
    --kl-input-border: #313a48;
    --kl-input-border-hover: #4b5668;
    --kl-input-focus: #60a5fa;
    --kl-input-ring: rgba(96, 165, 250, .22);
    --kl-input-disabled: #181d24;
}
.form-label { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; color: var(--bs-body-color); }
.form-text { color: var(--kl-muted); font-size: .8rem; margin-top: .35rem; }
.form-control, .form-select {
    min-height: 46px; padding: .6rem .95rem; font-size: .95rem;
    background-color: var(--kl-input-bg); border: 1.5px solid var(--kl-input-border); border-radius: 12px;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.form-control::placeholder { color: #98a2b3; opacity: 1; }
.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: var(--kl-input-border-hover); }
.form-control:focus, .form-select:focus { background-color: var(--kl-input-bg); border-color: var(--kl-input-focus); box-shadow: 0 0 0 4px var(--kl-input-ring); }
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--kl-input-disabled); color: var(--kl-muted); }
.form-control-sm, .form-select-sm { min-height: 40px; padding: .4rem .8rem; font-size: .875rem; border-radius: 10px; }
textarea.form-control { min-height: 110px; line-height: 1.55; resize: vertical; }
.form-select { padding-right: 2.5rem; background-position: right .9rem center; }
.input-group > .form-control, .input-group > .form-select { border-radius: 12px; }
.input-group-text { min-height: 46px; background: var(--kl-surface-2); border: 1.5px solid var(--kl-input-border); color: #2563eb; padding: 0 .9rem; border-radius: 12px; }
[data-bs-theme="dark"] .input-group-text { color: #6ea8fe; }
.input-group-sm > .input-group-text { min-height: 40px; }
.input-group:focus-within > .input-group-text { border-color: var(--kl-input-focus); }
.input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1.5px; }
.input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* Fayl tanlash */
.form-control[type="file"] { padding: .35rem; line-height: 2.1; }
.form-control[type="file"]::file-selector-button {
    margin: 0 .85rem 0 0; padding: .45rem 1rem; border: 0; border-radius: 9px;
    background: var(--kl-gradient); color: #fff; font-weight: 600; cursor: pointer;
}
.form-control[type="file"]:hover:not(:disabled)::file-selector-button { filter: brightness(1.08); background: var(--kl-gradient); }
/* Checkbox / radio / kalit */
.form-check { min-height: 1.75rem; }
.form-check-input { width: 1.2em; height: 1.2em; border: 1.5px solid var(--kl-input-border); background-color: var(--kl-input-bg); cursor: pointer; }
.form-check-input[type="checkbox"] { border-radius: 6px; }
.form-check-input:focus { border-color: var(--kl-input-focus); box-shadow: 0 0 0 4px var(--kl-input-ring); }
.form-check-input:checked { background-color: #2563eb; border-color: #2563eb; }
.form-switch .form-check-input { width: 2.6em; height: 1.45em; margin-top: .05em; border-radius: 2em; }
.form-switch { padding-left: 3.2em; }
.form-switch .form-check-input { margin-left: -3.2em; }
.form-check-label { cursor: pointer; padding-left: .15rem; }
/* Radio guruh tugmalari (Nashr / Qoralama, Lokal / Tashqi) */
.btn-check + .btn { border-width: 1.5px; min-height: 44px; }
/* Telefon: iOS Safari kattalashtirmasligi uchun maydonlar 16px (bu qoida yuqoridagilardan keyin turishi shart) */
@media (max-width: 575.98px) {
    .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
    .form-control-sm, .form-select-sm { min-height: 44px; }
}
.was-validated .form-control:invalid, .form-control.is-invalid { border-color: #e11d48; }
.was-validated .form-control:invalid:focus, .form-control.is-invalid:focus { box-shadow: 0 0 0 4px rgba(225, 29, 72, .16); }

/* =====================================================================
   Faoliyat jurnali: statistika, filtr chiplari, kunlar bo‘yicha vaqt chizig‘i
   ===================================================================== */
.hero-ring { width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .2); border: 2px solid rgba(255, 255, 255, .35); color: #fff; font-size: 1.45rem; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-top: 1.1rem; }
@media (max-width: 575.98px) { .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hero-stat { display: flex; align-items: center; gap: .65rem; padding: .7rem .85rem; border-radius: 16px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .25); }
.hero-stat > .bi { font-size: 1.25rem; opacity: .9; }
.hero-stat-value { font-size: 1.35rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-stat-label { font-size: .78rem; opacity: .85; }
.log-filters { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; margin-bottom: 1rem; padding-bottom: 2px; }
.log-filters::-webkit-scrollbar { display: none; }
.log-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .55rem .5rem .85rem; border-radius: 999px; white-space: nowrap; font-weight: 600; font-size: .9rem; color: var(--bs-body-color); background: var(--kl-surface); border: 1px solid var(--kl-border); }
.log-chip:hover { text-decoration: none; border-color: rgba(37, 99, 235, .45); color: var(--bs-body-color); }
.log-chip .bi { color: #2563eb; }
.log-chip-count { min-width: 26px; padding: .05rem .45rem; border-radius: 999px; background: var(--kl-surface-2); font-size: .75rem; text-align: center; color: var(--kl-muted); }
.log-chip.active { background: var(--kl-gradient); color: #fff; border-color: transparent; }
.log-chip.active .bi { color: #fff; }
.log-chip.active .log-chip-count { background: rgba(255, 255, 255, .22); color: #fff; }
.log-card { overflow: hidden; }
.log-day { display: flex; align-items: center; justify-content: space-between; padding: .7rem 1.15rem; background: var(--kl-surface-2); border-bottom: 1px solid var(--kl-border); font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.log-day-count { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--kl-muted); font-size: .8rem; }
.log-list { list-style: none; margin: 0; padding: .35rem 0; position: relative; }
.log-item { position: relative; display: flex; align-items: flex-start; gap: .9rem; padding: .8rem 1.15rem; }
.log-item + .log-item::before { content: ""; position: absolute; left: calc(1.15rem + 20px); top: -.8rem; height: 1.6rem; border-left: 2px dashed var(--kl-border); }
.log-item:hover { background: rgba(37, 99, 235, .035); }
.log-icon { width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; position: relative; z-index: 1; }
.tone-success { background: rgba(16, 185, 129, .14); color: #059669; }
.tone-primary { background: rgba(37, 99, 235, .13); color: #1d4ed8; }
.tone-danger { background: rgba(225, 29, 72, .13); color: #e11d48; }
.tone-warning { background: rgba(245, 158, 11, .16); color: #b45309; }
.tone-info { background: rgba(8, 145, 178, .14); color: #0e7490; }
.tone-secondary { background: rgba(100, 116, 139, .14); color: #475569; }
[data-bs-theme="dark"] .tone-success { color: #34d399; }
[data-bs-theme="dark"] .tone-primary { color: #93c5fd; }
[data-bs-theme="dark"] .tone-danger { color: #fb7185; }
[data-bs-theme="dark"] .tone-warning { color: #fbbf24; }
[data-bs-theme="dark"] .tone-info { color: #67e8f9; }
[data-bs-theme="dark"] .tone-secondary { color: #cbd5e1; }
.log-main { flex: 1 1 auto; }
.log-icon-sm { width: 32px; height: 32px; border-radius: 10px; font-size: .9rem; }
.log-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; line-height: 1.35; }
.log-entity { color: var(--bs-body-color); opacity: .85; word-break: break-word; }
.log-keys { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.log-key { font-size: .75rem; padding: .15rem .55rem; border-radius: 8px; background: var(--kl-surface-2); border: 1px solid var(--kl-border); color: var(--kl-muted); }
.log-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; margin-top: .35rem; font-size: .8rem; color: var(--kl-muted); }
.avatar-xs { width: 20px; height: 20px; font-size: .65rem; }
.log-time { flex-shrink: 0; font-size: .85rem; font-weight: 700; color: var(--kl-muted); font-variant-numeric: tabular-nums; padding-top: .55rem; }
@media (max-width: 575.98px) { .log-time { display: none; } }
.log-empty { text-align: center; padding: 3rem 1rem; }
.log-empty .hero-ring { background: var(--kl-gradient); border: 0; }

.placeholder.cover-thumb { display: inline-block; }
.toast { border-radius: 14px; }
@media (prefers-reduced-motion: reduce) { .chart-bar, .bottom-link .bi { transition: none; } }
