:root {
    --brand-1: #4f46e5;
    --brand-2: #4338ca;
    --sidebar-bg: #1e2233;
    --sidebar-bg-hover: #2a2f45;
    --content-bg: #f4f6fb;
}

body {
    background: var(--content-bg);
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #222633;
}

/* ---------- Topbar ---------- */
.topbar {
    background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
    height: 60px;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar .navbar-brand {
    color: #fff;
    font-size: 1.15rem;
}

/* ---------- Shell layout ---------- */
.app-shell {
    display: flex;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    padding: 1rem 0.75rem;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-section-label {
    color: #7d84a6;
    text-transform: uppercase;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    margin: 1.1rem .6rem .4rem;
}

.sidebar-section-label:first-child {
    margin-top: .2rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #c7cbe0;
    padding: .55rem .7rem;
    border-radius: .5rem;
    text-decoration: none;
    font-size: .92rem;
    margin-bottom: .15rem;
    transition: background .15s ease, color .15s ease;
}

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

.sidebar-link:hover {
    background: var(--sidebar-bg-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--brand-1);
    color: #fff;
}

.app-content {
    flex: 1;
    padding: 1.5rem 1.75rem 3rem;
    min-width: 0;
}

.page-title {
    font-weight: 600;
    color: #1e2233;
}

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(20,20,50,.06), 0 1px 2px rgba(20,20,50,.08);
}

.stat-card {
    border-radius: .9rem;
    color: #fff;
    padding: 1.25rem 1.4rem;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2.4rem;
    opacity: .35;
}

.stat-card.bg-indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }
.stat-card.bg-teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.stat-card.bg-amber  { background: linear-gradient(135deg, #f59e0b, #b45309); }
.stat-card.bg-rose   { background: linear-gradient(135deg, #fb7185, #be123c); }

.stat-card .stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .85rem; opacity: .9; }

/* ---------- Toolbar above DataTables ---------- */
.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    margin-bottom: .9rem;
    flex-wrap: wrap;
}

table.dataTable {
    width: 100% !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: .4rem;
    border: 1px solid #d7dae6;
    padding: .25rem .5rem;
}

.badge-low-stock { background-color: #fee2e2; color: #b91c1c; }
.badge-ok-stock { background-color: #dcfce7; color: #15803d; }

/* ---------- Mobile sidebar ---------- */
@@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 60px;
        z-index: 1040;
        transition: left .2s ease;
        box-shadow: 4px 0 16px rgba(0,0,0,.25);
    }

    .sidebar.open {
        left: 0;
    }
}

/* ---------- Login page ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-1), #1e2233);
}

.login-card {
    width: 100%;
    max-width: 380px;
    border-radius: 1rem;
    box-shadow: 0 20px 45px rgba(0,0,0,.35);
}
