/* IT Asset Management - blue & white enterprise theme */
:root {
    --brand: #1d4ed8;
    --brand-dark: #1e3a8a;
    --brand-soft: #eaf1ff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f4f7fc;
    --sidebar-w: 256px;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-link-color: #1d4ed8;
    --bs-link-hover-color: #1e3a8a;
    --bs-body-font-size: .9rem;
}
body { background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.page-link { color: var(--brand); }
.active > .page-link { background: var(--brand); border-color: var(--brand); }
.form-control:focus, .form-select:focus { border-color: #93b4f5; box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .15); }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, #14306f 0%, #0f2557 100%); color: #dbe6ff; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1040; transition: transform .2s ease; scrollbar-width: thin; scrollbar-color: #2b4a94 transparent; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; transition: margin .2s ease; }
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main { margin-left: 0; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.1rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand:hover { color: #fff; }
.brand-icon { width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--brand); display: grid; place-items: center; font-size: 1.05rem; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text small { color: #9fb6ec; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav { padding: .6rem .6rem 2rem; }
.nav-link-top { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px; color: #cfdcfb; font-weight: 500; margin-top: 2px; }
.nav-link-top > i:first-child { width: 18px; text-align: center; font-size: .9rem; opacity: .9; }
.nav-link-top:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-link-top.active { background: #fff; color: var(--brand-dark); }
.nav-link-top .caret { margin-left: auto; font-size: .65rem; transition: transform .15s; }
.nav-link-top.collapsed .caret { transform: rotate(-90deg); }
.nav-link-sub { display: block; padding: .38rem .75rem .38rem 2.55rem; color: #a9bdec; border-radius: 6px; font-size: .86rem; position: relative; }
.nav-link-sub::before { content: ""; position: absolute; left: 1.45rem; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: #4f6fb8; transform: translateY(-50%); }
.nav-link-sub:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-link-sub.active { color: #fff; background: rgba(255, 255, 255, .14); font-weight: 600; }
.nav-link-sub.active::before { background: #fff; }
.sidebar-backdrop { display: none; }

.topbar { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6rem; padding: 0 1rem; position: sticky; top: 0; z-index: 1020; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); background: #fff; }
.global-search { flex: 1; max-width: 620px; position: relative; }
.global-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.global-search input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 .9rem 0 2.4rem; background: #f8fafc; outline: none; }
.global-search input:focus { border-color: #93b4f5; background: #fff; box-shadow: 0 0 0 .2rem rgba(29, 78, 216, .12); }
.user-btn { display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); background: #fff; padding: .25rem .6rem; margin-left: auto; }
.topbar .dropdown { margin-left: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-weight: 600; font-size: .85rem; }
.content { padding: 1.25rem; flex: 1; }
.footer { padding: .8rem 1.25rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); background: #fff; }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.3rem; font-weight: 650; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .84rem; }

/* Cards */
.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; border-radius: 12px 12px 0 0 !important; padding: .75rem 1rem; }
.stat-card { display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; height: 100%; color: inherit; transition: box-shadow .15s, transform .15s; }
a.stat-card:hover { box-shadow: 0 6px 18px rgba(29, 78, 216, .12); transform: translateY(-1px); color: inherit; }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.stat-icon.green { background: #e7f8ef; color: #15803d; }
.stat-icon.amber { background: #fff4de; color: #b45309; }
.stat-icon.red { background: #fde8e8; color: #b91c1c; }
.stat-icon.slate { background: #eef2f7; color: #475569; }
.stat-icon.violet { background: #efeaff; color: #6d28d9; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .8rem; }
.chart-box { position: relative; height: 280px; }

/* Tables */
.table { --bs-table-hover-bg: #f5f8ff; margin-bottom: 0; }
.table thead th { background: #f1f5fb; color: #334155; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 650; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { vertical-align: middle; }
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-wrap .table-responsive { max-height: none; }
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .75rem; margin-bottom: .9rem; }
.filter-bar .form-control, .filter-bar .form-select { font-size: .85rem; }
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: .85em; }
.nowrap { white-space: nowrap; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .65rem 1.25rem; }
.dl-grid dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.dl-grid dd { margin: 0; font-weight: 500; word-break: break-word; }
.form-label { font-weight: 600; font-size: .82rem; margin-bottom: .25rem; }
.required::after { content: " *"; color: #dc2626; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: .35rem; margin: 1.1rem 0 .8rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem .9rem; }
.timeline li::before { content: ""; position: absolute; left: -1.38rem; top: .25rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand); }

/* Guest (login / install) */
body.guest { min-height: 100vh; background: linear-gradient(135deg, #14306f 0%, #1d4ed8 60%, #3b82f6 100%); display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(2, 12, 40, .35); }
.auth-card.wide { max-width: 860px; }
.auth-logo { width: 54px; height: 54px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 1.5rem; margin-bottom: .9rem; }

/* Mobile */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }
    .content { padding: .9rem; }
    .topbar { padding: 0 .6rem; }
}
@media print {
    .sidebar, .topbar, .footer, .no-print, .toast-container { display: none !important; }
    .main { margin: 0 !important; }
    .content { padding: 0; }
    body { background: #fff; }
    .card, .table-wrap { border: none; box-shadow: none; }
}
