/* =============================================================
   Library Management System — UI
   ============================================================= */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e6e9f0;
    --border-strong: #d4d9e3;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #8a94a6;

    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-soft: #eef2ff;
    --primary-ring: rgba(79, 70, 229, .18);

    --green: #059669;  --green-soft: #ecfdf5;
    --amber: #d97706;  --amber-soft: #fffbeb;
    --red: #dc2626;    --red-soft: #fef2f2;
    --blue: #2563eb;   --blue-soft: #eff6ff;
    --violet: #7c3aed; --violet-soft: #f5f3ff;
    --teal: #0d9488;   --teal-soft: #f0fdfa;

    --side-bg: #0b1120;
    --side-text: #94a3b8;
    --side-hover: rgba(255, 255, 255, .06);
    --side-active: rgba(99, 102, 241, .18);

    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .16);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

:root[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #121829;
    --surface-2: #0f1524;
    --border: #1f2940;
    --border-strong: #2a3652;
    --text: #e5e9f2;
    --text-2: #a7b1c6;
    --muted: #6d7891;
    --primary: #818cf8;
    --primary-600: #6366f1;
    --primary-soft: rgba(129, 140, 248, .12);
    --primary-ring: rgba(129, 140, 248, .25);
    --green: #34d399;  --green-soft: rgba(52, 211, 153, .12);
    --amber: #fbbf24;  --amber-soft: rgba(251, 191, 36, .12);
    --red: #f87171;    --red-soft: rgba(248, 113, 113, .12);
    --blue: #60a5fa;   --blue-soft: rgba(96, 165, 250, .12);
    --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .12);
    --teal: #2dd4bf;   --teal-soft: rgba(45, 212, 191, .12);
    --side-bg: #070b16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
img { max-width: 100%; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: 260px;
    display: flex; flex-direction: column;
    background: var(--side-bg);
    color: var(--side-text);
    padding: 18px 14px;
    overflow-y: auto;
}
.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 8px 22px;
    color: #fff; text-decoration: none !important;
}
.brand img { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: #fff; }
.brand b { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 11.5px; color: var(--side-text); line-height: 1.3; }

.nav { flex: 1; }
.nav-section {
    font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: #56627a; padding: 16px 12px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin: 2px 0;
    border-radius: 10px;
    color: var(--side-text); font-weight: 500;
    text-decoration: none !important;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--side-hover); color: #e2e8f0; }
.nav-link.active { background: var(--side-active); color: #fff; }
.nav-link.active .ic { color: #a5b4fc; }
.nav-count {
    margin-left: auto; font-style: normal;
    background: #ef4444; color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 1px 8px; border-radius: 999px;
}
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .07); padding-top: 10px; margin-top: 10px; }

.main { flex: 1; min-width: 0; margin-left: 260px; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    height: 68px; padding: 0 28px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.top-search {
    position: relative; flex: 1; max-width: 520px;
    display: flex; align-items: center;
}
.top-search .ic { position: absolute; left: 14px; color: var(--muted); }
.top-search input {
    width: 100%; height: 42px;
    padding: 0 44px 0 42px;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface); color: var(--text);
    font: inherit;
}
.top-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.top-search kbd {
    position: absolute; right: 12px;
    font: 600 11px var(--font); color: var(--muted);
    border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px;
    border: 1px solid var(--border); border-radius: 11px;
    background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { color: var(--primary); border-color: var(--border-strong); }
.show-dark { display: none; }
:root[data-theme="dark"] .show-dark { display: inline; }
:root[data-theme="dark"] .show-light { display: none; }
.icon-btn > span { display: inline-grid; }
.icon-btn > .show-dark { display: none; }
:root[data-theme="dark"] .icon-btn > .show-dark { display: inline-grid; }
:root[data-theme="dark"] .icon-btn > .show-light { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.avatar {
    display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; font-weight: 700;
}
.user-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.user-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }

.content { padding: 28px; max-width: 1400px; width: 100%; }
.foot { margin-top: auto; padding: 18px 28px; color: var(--muted); font-size: 12.5px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.only-mobile { display: none; }
.scrim { display: none; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head .ic { color: var(--muted); }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }

.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
.mt { margin-top: 20px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 6px;
    padding: 18px 20px;
    color: inherit; text-decoration: none !important;
    transition: transform .15s, box-shadow .15s;
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--text-2); font-weight: 500; font-size: 13.5px; }
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.stat-value { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat-note { font-size: 12.5px; color: var(--muted); }
.tone-primary .stat-icon { background: var(--primary-soft); color: var(--primary); }
.tone-green .stat-icon { background: var(--green-soft); color: var(--green); }
.tone-amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.tone-red .stat-icon { background: var(--red-soft); color: var(--red); }
.tone-blue .stat-icon { background: var(--blue-soft); color: var(--blue); }
.tone-violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.tone-red .stat-value { color: var(--red); }

/* ---------- Hero / quick actions ---------- */
.hero {
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    padding: 24px 26px; margin-bottom: 20px;
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(1200px 300px at 100% 0%, rgba(168, 85, 247, .45), transparent 60%),
        linear-gradient(120deg, #4338ca, #4f46e5 45%, #7c3aed);
    box-shadow: 0 18px 40px -18px rgba(79, 70, 229, .7);
}
.hero h2 { font-size: 22px; font-weight: 700; }
.hero p { margin: 4px 0 0; opacity: .85; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; }
.quick a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: 12px;
    background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600;
    border: 1px solid rgba(255, 255, 255, .22);
    text-decoration: none !important; backdrop-filter: blur(4px);
    transition: background .15s;
}
.quick a:hover { background: rgba(255, 255, 255, .26); }
.quick a.solid { background: #fff; color: #4338ca; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px;
    border: 1px solid transparent; border-radius: 11px;
    font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
    text-decoration: none !important;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .6); }
.btn-primary:hover { background: var(--primary-600); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 6px 16px -6px rgba(5, 150, 105, .55); }
.btn-green:hover { filter: brightness(.95); }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-light:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-xs { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-xs .ic, .btn-sm .ic { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.field label .req { color: var(--red); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.input, .select, textarea.input {
    width: 100%; height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border-strong); border-radius: 11px;
    background: var(--surface); color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.input-lg { height: 54px; font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.input-icon { position: relative; }
.input-icon > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 42px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.form-actions .spacer { margin-right: auto; }

/* Filters bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.filters .input-icon { flex: 1; min-width: 220px; }
.filters .input, .filters .select { height: 40px; }
.filters .select { width: auto; min-width: 150px; }
.filters .btn { height: 40px; }

/* Tabs / segmented */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.seg a {
    padding: 7px 14px; border-radius: 9px;
    color: var(--text-2); font-weight: 600; font-size: 13px;
    text-decoration: none !important;
}
.seg a.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.seg a em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
    text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted);
    padding: 12px 16px; background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .right { text-align: right; }
.tbl .nowrap { white-space: nowrap; }
.t-title { font-weight: 600; color: var(--text); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 140px; }
.tbl td .badge { margin-top: 3px; }
.t-sub { font-size: 12.5px; color: var(--muted); }
.t-actions { display: flex; gap: 6px; justify-content: flex-end; }
.acc {
    display: inline-block; min-width: 54px; text-align: center;
    font: 600 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    padding: 3px 8px; border-radius: 7px;
    background: var(--primary-soft); color: var(--primary);
}
.acc.mem { background: var(--teal-soft); color: var(--teal); }
.empty {
    text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty .ic { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 2px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.muted::before { display: none; }

/* ---------- Alerts ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; margin-bottom: 18px;
    border-radius: 12px; border: 1px solid;
    animation: slideIn .25s ease-out;
}
.alert > .ic { margin-top: 2px; }
.alert > div { flex: 1; }
.alert.success { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); color: var(--green); }
.alert.error { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.alert.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, transparent); color: var(--blue); }
.alert.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.alert b { color: inherit; }
.alert div, .alert div a { color: var(--text); }
.alert div b:first-child { color: inherit; }
.alert-x { background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0; }
.alert-x:hover { opacity: 1; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Lookup preview (issue / return) ---------- */
.preview {
    display: flex; align-items: center; gap: 12px;
    min-height: 58px; margin-top: 10px; padding: 10px 14px;
    border: 1px dashed var(--border-strong); border-radius: 12px;
    color: var(--muted); font-size: 13.5px;
    background: var(--surface-2);
}
.preview .pv-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); flex: none; }
.preview.ok { border-style: solid; border-color: color-mix(in srgb, var(--green) 35%, transparent); background: var(--green-soft); color: var(--text); }
.preview.ok .pv-icon { color: var(--green); }
.preview.bad { border-style: solid; border-color: color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-soft); color: var(--text); }
.preview.bad .pv-icon { color: var(--red); }
.preview.warn { border-style: solid; border-color: color-mix(in srgb, var(--amber) 35%, transparent); background: var(--amber-soft); color: var(--text); }
.preview.warn .pv-icon { color: var(--amber); }
.preview b { display: block; color: var(--text); font-size: 14px; }

.scan-tip {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 14px; border-radius: 12px;
    background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 500;
    margin-bottom: 18px;
}

/* Result card after return */
.result {
    display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
    padding: 18px; border-radius: 14px; margin-bottom: 20px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.result .big-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--green-soft); color: var(--green); }
.result .big-ic .ic { width: 26px; height: 26px; }
.result.late .big-ic { background: var(--amber-soft); color: var(--amber); }
.kv { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 6px; color: var(--text-2); font-size: 13px; }
.kv b { color: var(--text); font-weight: 600; }

/* ---------- Detail header ---------- */
.detail { display: flex; gap: 18px; align-items: flex-start; }
.detail-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); flex: none; }
.detail-icon .ic { width: 28px; height: 28px; }
.detail-icon.mem { background: var(--teal-soft); color: var(--teal); }
.detail h2 { font-size: 20px; font-weight: 700; }
.detail .sub { color: var(--text-2); margin-top: 2px; }
.props { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.prop { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.prop span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.prop b { font-weight: 650; }

/* ---------- Chart ---------- */
.card.fill { display: flex; flex-direction: column; }
.card.fill > .card-body { flex: 1; display: flex; flex-direction: column; }
.chart { display: flex; align-items: flex-end; gap: 10px; flex: 1; min-height: 220px; padding: 10px 4px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; min-width: 0; }
.chart .bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.chart .bar { width: 42%; max-width: 18px; border-radius: 5px 5px 2px 2px; min-height: 2px; position: relative; transition: filter .15s; }
.chart .bar.i { background: linear-gradient(180deg, #818cf8, #4f46e5); }
.chart .bar.r { background: linear-gradient(180deg, #6ee7b7, #059669); }
.chart .bar:hover { filter: brightness(1.12); }
.chart .lbl { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .li { background: #4f46e5; }
.legend .lr { background: #059669; }

/* Tooltip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    background: #0f172a; color: #fff; font-size: 11.5px; font-weight: 600;
    padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; pointer-events: none;
}

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.list .dot .ic { width: 16px; height: 16px; }
.list .dot.i { background: var(--primary-soft); color: var(--primary); }
.list .dot.r { background: var(--green-soft); color: var(--green); }
.list .grow { flex: 1; min-width: 0; }
.list .grow .t-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); flex: none; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager-info { color: var(--text-2); font-size: 13px; }
.pager-links { display: flex; gap: 4px; }
.pg {
    display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
    border-radius: 9px; border: 1px solid var(--border);
    color: var(--text-2); font-weight: 600; font-size: 13px; text-decoration: none !important;
}
.pg .ic { width: 16px; height: 16px; }
a.pg:hover { border-color: var(--primary); color: var(--primary); }
.pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg.disabled { opacity: .4; }
.pg.gap { border: 0; }

/* ---------- Login ---------- */
.auth {
    min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr;
    background: var(--surface);
}
.auth-art {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px;
    color: #fff;
    background:
        radial-gradient(800px 400px at 0% 100%, rgba(236, 72, 153, .35), transparent 60%),
        radial-gradient(700px 500px at 100% 0%, rgba(168, 85, 247, .5), transparent 60%),
        linear-gradient(135deg, #312e81, #4338ca 50%, #6d28d9);
}
.auth-art .brand { padding: 0; }
.auth-art .brand img { width: 48px; height: 48px; }
.auth-art .brand small { color: rgba(255, 255, 255, .7); }
.auth-art h2 { font-size: 40px; line-height: 1.12; font-weight: 800; letter-spacing: -.03em; max-width: 480px; }
.auth-art p { opacity: .8; max-width: 440px; font-size: 16px; }
.shelf { display: flex; align-items: flex-end; gap: 8px; height: 150px; margin-top: 30px; }
.shelf span { width: 30px; border-radius: 6px 6px 3px 3px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .25); }
.shelf span:nth-child(3n) { background: rgba(255, 255, 255, .3); }
.shelf span:nth-child(4n) { transform: rotate(-8deg); transform-origin: bottom left; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.auth-box > p { color: var(--text-2); margin: 6px 0 28px; }
.auth-box .field { margin-bottom: 16px; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 46px; }
.pass-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 8px; display: grid; }
.pass-toggle:hover { color: var(--primary); }
.auth-mobile-brand { display: none; }

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .foot, .page-actions, .filters, .pager, .no-print, .alert { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 0; }
    body { background: #fff; }
    .tbl td, .tbl th { padding: 6px 8px; font-size: 12px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 35; }
    .main { margin-left: 0; }
    .only-mobile { display: inline-grid; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px; }
    .foot { padding: 16px; }
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
    .auth-mobile-brand img { width: 44px; height: 44px; border-radius: 12px; }
    .auth-mobile-brand small { display: block; color: var(--muted); font-size: 12px; }
    .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .user-name, .top-search kbd { display: none; }
    .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 24px; }
    .stat-icon { width: 34px; height: 34px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .page-head h1 { font-size: 21px; }
    .hero { padding: 20px; }
    .chart { gap: 4px; }
    .chart .lbl { font-size: 10px; }
    .hide-sm { display: none; }
    .card-head, .filters, .card-body { padding-left: 16px; padding-right: 16px; }
    .tbl th, .tbl td { padding-left: 12px; padding-right: 12px; }
}
