/* =====================================================================
   ERP Lubricantes Chavarria - Hoja de estilos
   Identidad GABANTO (unificada wolf / ascreativo / mticontrol / ferreteriacompany)
   ===================================================================== */
:root {
    /* --- Paleta corporativa Gabanto (todos los ERP) --- */
    /* Naranja marca:  #f15a22  |  Oscuro: #d84d16  |  Claro: #ff7a45 */
    /* Sidebar:       #14151a  |  Sidebar 2: #1d1f27 */
    /* Login fondo:   #2b2e33  |  Texto sidebar: #aab0bd */
    --primary: #f15a22;
    --primary-dark: #d84d16;
    --primary-soft: rgba(241, 90, 34, .12);

    /* Tema claro (contenido) */
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #eef1f6;
    --text: #1f2430;
    --text-soft: #7b8494;
    --border: #e4e8ef;

    /* Sidebar (SIEMPRE oscuro en todos los temas) */
    --side-bg: #14151a;
    --side-bg-2: #1d1f27;
    --side-text: #aab0bd;
    --side-title: #5f6675;
    --side-active: var(--primary);

    /* Login (siempre oscuro) */
    --login-bg: #2b2e33;

    /* Estados */
    --success: #1faa59;
    --warning: #f5a524;
    --danger: #e5484d;
    --info: #3b82f6;

    --shadow: 0 4px 18px rgba(20, 21, 26, .06);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .28);
    --radius: 14px;
    --sidebar-w: 252px;
}
[data-theme="dark"] {
    --bg: #0f1116;
    --surface: #171a21;
    --surface-2: #1f232c;
    --text: #e7eaf0;
    --text-soft: #8b93a3;
    --border: #262b35;
    --shadow: 0 4px 18px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.layout-full .main { margin-left: 0; width: 100%; }
.has-sidebar .main { margin-left: var(--sidebar-w); }
.main {
    flex: 1; display: flex; flex-direction: column; min-width: 0;
    transition: margin-left .25s ease;
}
.main.main-home {
    min-height: 100vh; max-height: 100vh; overflow: hidden;
}

/* ---------- Sidebar (oscuro) ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--side-bg);
    position: fixed; top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 40; overflow-y: auto;
    transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #2c2f3a; border-radius: 8px; }
.brand {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 22px 18px 18px; border-bottom: 1px solid rgba(255,255,255,.06);
    text-align: center;
}
.brand-mark {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 20px;
    box-shadow: 0 0 0 4px rgba(241,90,34,.18);
}
.brand-logo { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px rgba(241,90,34,.18); }
.brand-name { font-weight: 700; font-size: 15px; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--side-title); letter-spacing: .04em; }

.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; min-height: 0; }
.nav-group { border-radius: 10px; }
.nav-group-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; padding: 10px 12px; border: none; background: transparent;
    color: var(--side-title); font-size: 11px; text-transform: uppercase;
    letter-spacing: .08em; font-weight: 700; cursor: pointer; border-radius: 8px;
    transition: all .15s; text-align: left;
}
.nav-group-toggle:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-group-label { flex: 1; }
.nav-chevron {
    font-size: 10px; color: var(--side-text); transition: transform .2s ease;
    display: inline-block;
}
.nav-group.open .nav-chevron { transform: rotate(0deg); }
.nav-group:not(.open) .nav-chevron { transform: rotate(-90deg); }
.nav-group-items {
    display: flex; flex-direction: column; gap: 2px;
    padding: 2px 0 6px 4px;
    overflow: hidden; max-height: 480px;
    transition: max-height .28s ease, opacity .2s ease, padding .2s ease;
}
.nav-group:not(.open) .nav-group-items {
    max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0;
    pointer-events: none;
}
.nav-group-title {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--side-title); padding: 16px 12px 6px; font-weight: 700;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 13px; border-radius: 10px; color: var(--side-text);
    font-weight: 500; transition: all .15s; font-size: 13.5px;
}
.nav-link:hover { background: var(--side-bg-2); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(241,90,34,.35); }
.nav-icon { width: 22px; text-align: center; font-size: 16px; }
.sidebar-footer {
    margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08);
    background: var(--side-bg); position: sticky; bottom: 0;
}
.nav-logout {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 12px 13px; border-radius: 10px; color: #ff8a7a;
    font-weight: 600; font-size: 13.5px; transition: all .15s;
}
.nav-logout:hover { background: rgba(229,72,77,.15); color: #ff6b6b; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }

/* ---------- Botones flotantes subir / bajar ---------- */
.scroll-fab {
    position: fixed; right: 20px; bottom: 78px; z-index: 50;
    display: flex; flex-direction: column; gap: 8px;
}
.scroll-fab-btn {
    width: 38px; height: 38px; border: none; border-radius: 10px;
    background: var(--primary); color: #fff; font-size: 15px; font-weight: 700;
    cursor: pointer; box-shadow: 0 4px 14px rgba(241,90,34,.35);
    display: grid; place-items: center; transition: all .15s;
}
.scroll-fab-btn:hover { background: var(--primary-dark); transform: translateY(-2px); }
.scroll-fab-btn:active { transform: translateY(0); }

/* ---------- Topbar ---------- */
.topbar {
    height: 68px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 24px;
    position: sticky; top: 0; z-index: 30;
}
.topbar-brand {
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.topbar-brand-mark {
    width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.topbar-brand-logo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-brand-text strong { font-size: 14px; font-weight: 700; }
.topbar-brand-text small { font-size: 10px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em; }
.btn-back-home {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text-soft);
    font-weight: 600; font-size: 13px; white-space: nowrap; transition: all .15s;
}
.btn-back-home:hover { background: var(--primary-soft); color: var(--primary); border-color: rgba(241,90,34,.35); }
.btn-back-home-icon { font-size: 16px; line-height: 1; }
.topbar-title { font-weight: 700; font-size: 16px; white-space: nowrap; }
.topbar-clock {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    background: var(--side-bg); color: #fff; font-weight: 700; font-size: 15px;
    padding: 7px 16px; border-radius: 10px; letter-spacing: .5px;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { color: var(--text-soft); font-size: 13px; margin-right: 4px; }
.btn-logout {
    background: transparent; border-color: var(--danger); color: var(--danger);
    padding: 7px 14px; font-size: 13px;
}
.btn-logout:hover { background: rgba(229,72,77,.1); }
.btn-icon {
    width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer; font-size: 16px;
    display: grid; place-items: center; transition: all .15s;
}
.btn-icon:hover { background: var(--surface-2); }
#sidebarToggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff;
    display: grid; place-items: center; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta small { color: var(--text-soft); font-size: 11px; }

/* ---------- Content ---------- */
.content { padding: 24px; flex: 1; max-width: 1280px; width: 100%; margin: 0 auto; min-height: 0; }
.content-home {
    max-width: none; width: 100%; margin: 0;
    padding: 6px 14px 8px;
    display: flex; flex-direction: column;
    flex: 1; min-height: 0; overflow: hidden;
}
.appfooter {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
    padding: 10px 20px; color: var(--text-soft); font-size: 12px; border-top: 1px solid var(--border);
    background: var(--surface); flex-shrink: 0;
}
.appfooter-left, .appfooter-center, .appfooter-right { display: flex; align-items: center; gap: 10px; }
.appfooter-center a { color: var(--text-soft); font-weight: 600; padding: 4px 10px; border-radius: 6px; transition: all .15s; }
.appfooter-center a:hover { color: var(--primary); background: var(--primary-soft); }
.appfooter-sep { opacity: .4; }
.brandlink { color: var(--primary); }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head .spacer { flex: 1; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px; }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 700; display:flex; align-items:center; gap:10px; }

/* ---------- Stat cards (estilo Gabanto) ---------- */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 6px; min-height: 104px;
}
.stat .stat-label { color: var(--text-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding-right: 52px; }
.stat .stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat .stat-icon {
    position: absolute; right: 16px; top: 16px; font-size: 20px;
    width: 42px; height: 42px; border-radius: 12px;
    background: var(--primary-soft); color: var(--primary);
    display: grid; place-items: center; opacity: 1;
}
.stat.danger .stat-value { color: var(--danger); }
.stat.success .stat-value { color: var(--success); }
.stat.warning .stat-value { color: var(--warning); }
.stat.info .stat-value { color: var(--info); }

/* ---------- Home / Launcher ancho completo, modulos cuadrados ---------- */
.home-quickstats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    width: 100%; margin: 0 0 14px;
}
.home-quickstats-full { max-width: none; }

/* Dashboard: tarjetas cuadradas (1:1) y todo visible en primera vista */
.content-home {
    --dash-tile: min(
        calc((100vw - var(--sidebar-w) - 48px) / 6 - 7px),
        calc((100vh - 240px) / 3 - 6px)
    );
}
.content-home .home-quickstats {
    gap: 8px; margin-bottom: 8px; flex-shrink: 0;
}
.content-home .mod-box { min-height: 50px; }
.content-home .mod-box-icon { width: 54px; min-width: 54px; font-size: 22px; }
.content-home .mod-box-content { padding: 8px 10px; }
.content-home .mod-box-title { font-size: 14px; margin-top: 2px; }
.content-home .mod-box-label { font-size: 10px; }

.content-home .modules-grid-6x3 {
    flex: 1; min-height: 0; align-content: center;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(3, var(--dash-tile));
    gap: 8px; width: 100%;
    justify-items: center;
}
.content-home .module-tile {
    aspect-ratio: 1 / 1;
    width: var(--dash-tile);
    height: var(--dash-tile);
    padding: 8px 6px; gap: 4px; border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
}
.content-home .module-tile:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.content-home .module-tile-icon { font-size: clamp(22px, calc(var(--dash-tile) * 0.3), 34px); }
.content-home .module-tile-name {
    font-size: clamp(10px, calc(var(--dash-tile) * 0.11), 12px);
    font-weight: 700;
}

.modules-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 14px;
    width: 100%;
}
.modules-grid-6x3 {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 12px;
    width: 100%;
}
.module-tile {
    aspect-ratio: 1;
    border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 14px 10px; color: #fff; text-align: center;
    text-decoration: none;
    box-shadow: 0 3px 14px rgba(0,0,0,.12);
    transition: transform .15s ease, box-shadow .15s ease;
    min-height: 0;
}
.module-tile:hover {
    color: #fff; transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.module-tile-icon { font-size: 40px; line-height: 1; }
.module-tile-name {
    font-size: 13px; font-weight: 800; line-height: 1.2;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.module-tile-group {
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .05em; opacity: .88; margin-top: auto;
}

/* Caja horizontal (resumen arriba) */
.mod-box {
    display: flex; align-items: stretch; color: #fff; text-decoration: none;
    border-radius: 6px; overflow: hidden; min-height: 68px;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    transition: transform .15s ease, box-shadow .15s ease;
}
.mod-box:hover {
    color: #fff; transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.2);
}
.mod-box-icon {
    width: 76px; min-width: 76px;
    display: grid; place-items: center;
    font-size: 30px; background: rgba(0,0,0,.18);
}
.mod-box-content {
    flex: 1; padding: 12px 14px;
    display: flex; flex-direction: column; justify-content: center; align-items: flex-end;
    text-align: right; min-width: 0;
}
.mod-box-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; opacity: .9; line-height: 1.2;
}
.mod-box-title {
    font-size: 17px; font-weight: 800; line-height: 1.2; margin-top: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* Paleta de colores (como referencia inventario) */
.mod-box-c0  { background: #00c0ef; }
.mod-box-c1  { background: #f39c12; }
.mod-box-c2  { background: #605ca8; }
.mod-box-c3  { background: #6c757d; }
.mod-box-c4  { background: #0073b7; }
.mod-box-c5  { background: #e83e8c; }
.mod-box-c6  { background: #3c8dbc; }
.mod-box-c7  { background: #dd4b39; }
.mod-box-c8  { background: #00a65a; }
.mod-box-c9  { background: #d81b60; }
.mod-box-c10 { background: #795548; }
.mod-box-c11 { background: #17a2b8; }
.mod-box-alert { animation: pulse-alert 2s infinite; }
@keyframes pulse-alert {
    0%, 100% { box-shadow: 0 2px 10px rgba(221,75,57,.3); }
    50% { box-shadow: 0 4px 20px rgba(221,75,57,.55); }
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); font-weight: 700; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 10px 18px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
    transition: all .15s;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 600; font-size: 13px; }
input, select, textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 80px; }
.help { color: var(--text-soft); font-size: 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-success { background: rgba(31,170,89,.15); color: var(--success); }
.badge-danger { background: rgba(229,72,77,.15); color: var(--danger); }
.badge-warning { background: rgba(245,165,36,.18); color: #b9791a; }
.badge-info { background: rgba(59,130,246,.15); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--text-soft); }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.alert-success { background: rgba(31,170,89,.12); color: var(--success); }
.alert-danger { background: rgba(229,72,77,.12); color: var(--danger); }
.alert-warning { background: rgba(245,165,36,.14); color: #b9791a; }
.alert-info { background: rgba(59,130,246,.12); color: var(--info); }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1; min-width: 220px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-soft); }
.empty-state h1 { font-size: 56px; color: var(--primary); }

/* ---------- Login (estilo Gabanto) ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--login-bg); position: relative; }
.login-card { background: #fff; color: #1f2430; border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 410px; padding: 38px 34px; }
.login-card .brand-mark { width: 64px; height: 64px; font-size: 22px; margin: 0 auto 16px; box-shadow: none; }
.login-card .brand-logo { margin: 0 auto 16px; display: block; }
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; color: var(--primary); text-transform: uppercase; letter-spacing: .02em; }
.login-card p.sub { text-align: center; color: #9aa1ad; margin-bottom: 24px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.login-card label { color: #4b5160; }
.login-card input { background: #f3f4fa; border-color: #e6e8f0; }
.login-input-row { display: flex; gap: 8px; }
.login-input-row .btn { background: #f3f4fa; border-color: #e6e8f0; color: #4b5160; }
.login-foot { text-align: center; color: #cfd3da; font-size: 11.5px; margin-top: 26px; line-height: 1.7; }
.login-foot a, .login-foot .brandlink { color: var(--primary); font-weight: 700; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; place-items: center; z-index: 60; padding: 20px; }
.modal-overlay.open { display: grid; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Utilities ---------- */
.flex { display: flex; } .gap { gap: 10px; } .items-center { align-items: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.text-soft { color: var(--text-soft); } .text-right { text-align: right; }
.w-full { width: 100%; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .modules-grid-6x3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 992px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .has-sidebar .main { margin-left: 0; }
    .has-sidebar .main.main-home { max-height: none; overflow: visible; }
    #sidebarToggle { display: grid; }
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.35); }
    .sidebar-overlay.open { display: block; }
    .modules-grid-6x3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .modules-grid-full { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
    .modules-grid-6x3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .content-home { overflow: visible; --dash-tile: min(calc((100vw - 32px) / 3 - 8px), 120px); }
    .content-home .modules-grid-6x3 {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(6, var(--dash-tile));
    }
    .content-home .module-tile {
        width: var(--dash-tile);
        height: var(--dash-tile);
    }
    .module-tile-icon { font-size: 32px; }
    .module-tile-name { font-size: 11.5px; }
    .home-quickstats { grid-template-columns: 1fr; }
    .content-home { padding: 8px 12px 14px; }
}
@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .user-meta { display: none; }
    .topbar-date { display: none; }
    .topbar-brand-text { display: none; }
    .topbar-clock { font-size: 13px; padding: 6px 12px; }
    .appfooter { flex-direction: column; text-align: center; }
    .appfooter-left, .appfooter-center, .appfooter-right { justify-content: center; }
    .btn-back-home-text { display: none; }
    .btn-back-home { padding: 8px 11px; }
}
