/* ===== JNR AGRO Stock Portal — Main Stylesheet ===== */
:root {
    --navy:       #0A1628;
    --navy-mid:   #122040;
    --navy-light: #1A2F5E;
    --blue:       #1E4DB7;
    --blue-light: #2563EB;
    --accent:     #3B82F6;
    --accent-glow:#60A5FA;
    --white:      #FFFFFF;
    --off-white:  #F4F7FC;
    --border:     #DDE3EF;
    --border-dark:#C4CEDF;
    --text-main:  #0F1F3D;
    --text-muted: #5A6B8C;
    --text-light: #8FA0BC;
    --success:    #059669;
    --success-bg: #D1FAE5;
    --danger:     #DC2626;
    --danger-bg:  #FEE2E2;
    --warning:    #D97706;
    --warning-bg: #FEF3C7;
    --info:       #0EA5E9;
    --info-bg:    #E0F2FE;
    --sidebar-w:  260px;
    --header-h:   64px;
    --bnav-h:     64px;
    --radius:     10px;
    --radius-lg:  16px;
    --shadow-sm:  0 1px 3px rgba(10,22,40,.08);
    --shadow:     0 4px 16px rgba(10,22,40,.10);
    --shadow-lg:  0 8px 32px rgba(10,22,40,.16);
    --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--off-white);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

img { max-width: 100%; display: block; }

/* ===== TOP HEADER ===== */
.top-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(10,22,40,.25);
}
.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 16px;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background var(--transition);
}
.sidebar-toggle:hover { background: rgba(255,255,255,.1); }
.sidebar-toggle svg { width: 22px; height: 22px; }
.brand-logo { display: flex; align-items: center; gap: 10px; }
.brand-logo svg { width: 36px; height: 36px; flex-shrink: 0; }
.brand-name {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: .5px;
    line-height: 1.1;
}
.brand-sub {
    display: block;
    font-size: .65rem;
    color: rgba(255,255,255,.55);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
}
.header-actions { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 100px;
    padding: 6px 14px 6px 6px;
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue-light));
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; line-height: 1.1; }
.user-name { font-size: .8rem; font-weight: 600; color: var(--white); }
.user-role {
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 100px;
    margin-top: 2px;
    width: fit-content;
}
.user-role.admin { background: #FFD700; color: #7B4F00; }
.user-role.staff { background: var(--accent); color: var(--white); }
.logout-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: rgba(255,255,255,.7);
    transition: all var(--transition);
}
.logout-btn:hover { background: rgba(220,38,38,.25); color: #FCA5A5; }
.logout-btn svg { width: 18px; height: 18px; }

/* ===== APP LAYOUT ===== */
.app-layout {
    display: flex;
    padding-top: var(--header-h);
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1px solid var(--border);
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 900;
    transition: transform var(--transition);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sidebar-nav { padding: 16px 12px 120px; }
.nav-section { margin-bottom: 8px; }
.nav-label {
    display: block;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-light);
    padding: 12px 12px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
    margin-bottom: 2px;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--off-white); color: var(--blue); }
.nav-item.active {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(30,77,183,.3);
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,.5);
    z-index: 850;
    backdrop-filter: blur(2px);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 28px 28px 100px;
    min-height: calc(100vh - var(--header-h));
    max-width: 100%;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }
.page-subtitle { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(30,77,183,.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(30,77,183,.45); transform: translateY(-1px); }
.btn-success {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(5,150,105,.25);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(5,150,105,.4); transform: translateY(-1px); }
.btn-danger {
    background: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(220,38,38,.25);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(220,38,38,.4); transform: translateY(-1px); }
.btn-outline {
    background: var(--white);
    color: var(--blue);
    border: 1.5px solid var(--blue);
}
.btn-outline:hover { background: var(--blue); color: var(--white); }
.btn-ghost {
    background: var(--off-white);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--border); color: var(--text-main); }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title svg { width: 18px; height: 18px; color: var(--blue); }
.card-body { padding: 24px; }

/* ===== STAT CARDS ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: #EFF6FF; color: var(--blue-light); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.navy { background: #E8EEF8; color: var(--navy-light); }
.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text-main); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: 6px; font-weight: 500; }

/* ===== TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
thead tr {
    background: var(--navy);
    color: var(--white);
}
thead th {
    padding: 12px 16px;
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: nowrap;
    text-align: left;
}
tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
tbody tr:hover { background: var(--off-white); }
tbody td {
    padding: 13px 16px;
    color: var(--text-main);
    vertical-align: middle;
}
.td-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: .82rem;
    font-weight: 600;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .3px;
    white-space: nowrap;
}
.badge svg { width: 10px; height: 10px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-navy    { background: #E8EEF8; color: var(--navy-light); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 7px;
}
.form-label .req { color: var(--danger); margin-left: 3px; }
.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .875rem;
    color: var(--text-main);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
    -webkit-appearance: none;
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--blue-light);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6B8C' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 5px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 5px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ===== SEARCH / FILTER ===== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.search-input-wrap {
    flex: 1;
    position: relative;
    min-width: 200px;
}
.search-input-wrap svg {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-light);
    pointer-events: none;
}
.search-input-wrap input {
    padding-left: 38px;
    width: 100%;
}

/* ===== STOCK LEVEL INDICATOR ===== */
.stock-level {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stock-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    width: 80px;
}
.stock-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}
.stock-fill.ok      { background: var(--success); }
.stock-fill.low     { background: var(--warning); }
.stock-fill.critical{ background: var(--danger); }

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 4px solid;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: #065F46; border-color: var(--success); }
.alert-danger   { background: var(--danger-bg);  color: #991B1B; border-color: var(--danger);  }
.alert-warning  { background: var(--warning-bg); color: #92400E; border-color: var(--warning); }
.alert-info     { background: var(--info-bg);    color: #0C4A6E; border-color: var(--info);    }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 80px; right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}
.toast {
    background: var(--navy);
    color: var(--white);
    padding: 14px 18px;
    border-radius: 10px;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 360px;
    pointer-events: all;
    animation: slideInRight .3s ease;
    border-left: 4px solid var(--accent);
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger);  }
.toast.warning { border-color: var(--warning); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast-close { margin-left: auto; cursor: pointer; opacity: .6; }
.toast-close:hover { opacity: 1; }
@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10,22,40,.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: none;
}
.modal-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1101;
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--navy);
    color: var(--white);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
    background: none; border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,.1); color: var(--white); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bnav-h);
    background: var(--white);
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(10,22,40,.1);
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom);
}
.bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--text-light);
    padding: 8px 4px;
    text-transform: uppercase;
    transition: all var(--transition);
    min-width: 0;
}
.bnav-item svg { width: 22px; height: 22px; }
.bnav-item.active { color: var(--blue-light); }
.bnav-item.active svg { stroke: var(--blue-light); }

/* ===== DASHBOARD GRID ===== */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.dash-grid .card.full { grid-column: 1 / -1; }

/* ===== LOW STOCK ITEMS ===== */
.low-stock-list { display: flex; flex-direction: column; gap: 10px; }
.low-stock-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--off-white);
    border-radius: 8px;
    border-left: 3px solid var(--warning);
}
.low-stock-item.critical { border-color: var(--danger); }
.low-stock-item-info { flex: 1; min-width: 0; }
.low-stock-item-name { font-weight: 600; font-size: .875rem; }
.low-stock-item-detail { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, var(--blue) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -200px; right: -200px;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(59,130,246,.15) 0%, transparent 70%);
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    bottom: -150px; left: -150px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(30,77,183,.2) 0%, transparent 70%);
    border-radius: 50%;
}
.login-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0,0,0,.3);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}
.login-logo-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 30px; height: 30px; }
.login-app-name { font-size: 1.3rem; font-weight: 800; color: var(--text-main); }
.login-app-sub  { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.login-heading  { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.login-subheading { font-size: .875rem; color: var(--text-muted); margin-bottom: 28px; }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 20px;
}
.page-btn {
    min-width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--white);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    padding: 0 12px;
}
.page-btn:hover { border-color: var(--blue); color: var(--blue); }
.page-btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== PERMISSION TOGGLES ===== */
.perm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
}
.perm-item:hover { border-color: var(--blue); }
.perm-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }
.perm-item label { font-size: .82rem; font-weight: 500; cursor: pointer; }

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
    text-align: center;
}
.empty-state svg { width: 56px; height: 56px; margin-bottom: 16px; opacity: .4; }
.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.empty-state-desc  { font-size: .875rem; }

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ===== TRANSACTION TYPE INDICATOR ===== */
.txn-in  { color: var(--success); font-weight: 700; }
.txn-out { color: var(--danger);  font-weight: 700; }
.txn-adj { color: var(--warning); font-weight: 700; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }
    .user-info { display: none; }
    .user-chip { padding: 5px; }
    
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 950;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity var(--transition); }
    .sidebar-overlay.visible { opacity: 1; pointer-events: all; }
    
    .main-content {
        margin-left: 0;
        padding: 20px 16px 100px;
    }
    
    .bottom-nav { display: flex; }
    
    .stat-grid { grid-template-columns: 1fr 1fr; }
    
    .form-row.cols-2,
    .form-row.cols-3 { grid-template-columns: 1fr; }
    
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; justify-content: center; }

    .modal-container { top: auto; bottom: 0; left: 0; right: 0;
        transform: none; width: 100%; max-width: 100%; max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

    .perm-grid { grid-template-columns: 1fr; }
    
    .search-bar { flex-direction: column; }
    
    .toast-container { left: 16px; right: 16px; top: 70px; }
    .toast { min-width: unset; width: 100%; }
}

@media (max-width: 420px) {
    .stat-grid { grid-template-columns: 1fr; }
    .login-box { padding: 28px 20px; }
    .brand-sub { display: none; }
}

/* ===== UTILITIES ===== */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger);  }
.text-warning { color: var(--warning); }
.text-sm      { font-size: .82rem; }
.fw-700       { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mb-16{ margin-bottom: 16px; }
.mb-20{ margin-bottom: 20px; }
.gap-8{ gap: 8px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.d-none { display: none !important; }
