:root {
    --sidebar-width: 260px;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --bg: #f3f5f9;
    --text-muted: #6b7280;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1f2937;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
    color: #fff;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: left .3s ease;
}

.sidebar .brand {
    padding: 1.5rem 1.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar .brand h4 {
    margin: 0;
    font-weight: 800;
    color: #fff;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.sidebar .brand small {
    color: #94a3b8;
    font-size: .75rem;
    letter-spacing: .03em;
}

.sidebar-nav {
    padding: .75rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-heading {
    display: block;
    padding: .9rem 1.35rem .35rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #64748b;
    font-weight: 700;
}

.sidebar-nav .nav-link {
    color: #cbd5e1;
    padding: .65rem 1.35rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-left: 3px solid transparent;
    font-size: .92rem;
    font-weight: 500;
    border-radius: 0;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(37, 99, 235, .18);
    color: #fff;
    border-left-color: var(--brand);
    font-weight: 700;
}

.sidebar-footer {
    padding: 1rem 1.35rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: #64748b;
    font-size: .75rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ---------- Main content ---------- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s ease;
}

.topbar {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    padding: .9rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.btn-icon {
    border: 1px solid #e5e7eb;
    background: #fff;
    width: 38px;
    height: 38px;
    border-radius: .5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content-wrapper {
    padding: 1.75rem;
    flex: 1;
}

.app-footer {
    padding: 1rem 1.75rem;
    color: var(--text-muted);
    font-size: .8rem;
    text-align: center;
}

/* ---------- Cards & tables ---------- */
.card {
    border: none;
    border-radius: .9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef1f5;
    border-radius: .9rem .9rem 0 0 !important;
    font-weight: 700;
    padding: 1rem 1.25rem;
}

.table thead th {
    background: #f8f9fb;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    border-bottom: 2px solid #eef1f5;
    white-space: nowrap;
    vertical-align: middle;
}

.table td {
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

.badge-soft {
    background: #eff6ff;
    color: var(--brand-dark);
    font-weight: 600;
    padding: .4em .7em;
    border-radius: .5rem;
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.btn-soft-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-soft-danger:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-soft-primary {
    background: #eff6ff;
    color: var(--brand-dark);
    border: 1px solid #bfdbfe;
}

.btn-soft-primary:hover {
    background: #dbeafe;
    color: var(--brand-dark);
}

/* ---------- Stat cards (dashboard) ---------- */
.stat-card {
    border-radius: .9rem;
    color: #fff;
    padding: 1.35rem 1.5rem;
    position: relative;
    overflow: hidden;
    min-height: 118px;
}

.stat-card i.bg-icon {
    font-size: 3rem;
    opacity: .28;
    position: absolute;
    right: 1rem;
    top: .9rem;
}

.stat-card .stat-label {
    font-size: .8rem;
    opacity: .9;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    margin-top: .35rem;
}

.bg-grad-blue { background: linear-gradient(135deg,#2563eb,#1d4ed8); }
.bg-grad-green { background: linear-gradient(135deg,#059669,#047857); }
.bg-grad-orange { background: linear-gradient(135deg,#ea580c,#c2410c); }
.bg-grad-purple { background: linear-gradient(135deg,#7c3aed,#6d28d9); }

/* ---------- Forms ---------- */
.form-label {
    font-weight: 600;
    font-size: .85rem;
    color: #374151;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .15);
}

.required-mark {
    color: #dc2626;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .sidebar {
        left: -280px;
    }
    .sidebar.show {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
}
