/* ===================================================
   DANIMEC — Precision & Authority Design System
   Inter font via Google Fonts
   Primary: #0047AB / #00327D
   No-Line philosophy — tonal surfaces only
=================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

:root {
    --primary: #00327D;
    --primary-container: #0047AB;
    --on-primary: #ffffff;
    --on-primary-container: #a5bdff;
    --secondary: #4e5e85;
    --surface: #faf8ff;
    --surface-bright: #faf8ff;
    --surface-container-low: #f3f3fc;
    --surface-container: #ededf6;
    --surface-container-high: #e7e7f0;
    --surface-container-highest: #e2e2eb;
    --on-surface: #191b22;
    --on-surface-variant: #434653;
    --outline: #737784;
    --outline-variant: #c3c6d5;
    --error: #ba1a1a;
    --error-container: #ffdad6;
    --tertiary: #651f00;
    --tertiary-container: #8b2e01;
    --tertiary-fixed: #ffdbcf;
    --font: 'Inter', sans-serif;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 999px;
    --shadow-ambient: 0 4px 16px rgba(25,27,34,0.06);
    --sidebar-w: 240px;
    --gradient-cta: linear-gradient(135deg, #00327D, #0047AB);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--on-surface);
    height: 100%;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ─────────────── LAYOUT ─────────────── */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ─────────────── SIDEBAR ─────────────── */

/* Variable para el ancho colapsado */
:root {
    --sidebar-collapsed-w: 64px;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    background: linear-gradient(180deg, #001f52 0%, #00327D 60%, #0047AB 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    z-index: 100;
    overflow: hidden;
    /* ── Transición suave ── */
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Botón toggle (dentro del sidebar) ── */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.10);
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.80);
    transition: background 0.18s ease, color 0.18s ease, transform 0.22s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.20);
    color: #fff;
}

.sidebar-toggle .material-icons-round {
    font-size: 20px;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Brand header ── */
.sidebar-brand {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    flex-shrink: 0;
}

.brand-logo-area {
    overflow: hidden;
    transition: opacity 0.20s ease, width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.sidebar-brand .brand-name {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 3px;
    text-transform: uppercase;
    line-height: 1;
}

.sidebar-brand .brand-sub {
    font-size: 9px;
    color: var(--on-primary-container);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
    font-weight: 500;
}

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    padding: 8px 8px 4px;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.20s ease, height 0.20s ease, margin 0.20s ease, padding 0.20s ease;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.18s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background: rgba(255,255,255,0.10);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.16);
    color: #fff;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: #fff;
    border-radius: 999px;
}

.nav-item .material-icons-round {
    font-size: 20px;
    opacity: 0.85;
    flex-shrink: 0;
}

/* Texto del nav-item — span implícito (el texto directo del anchor) */
.nav-item span:not(.material-icons-round) {
    transition: opacity 0.18s ease;
    overflow: hidden;
}

/* ── Footer ── */
.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex-shrink: 0;
    min-height: 64px;
}

.sidebar-footer-info {
    flex-grow: 1;
    overflow: hidden;
    transition: opacity 0.20s ease, width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: 0;
}

.sidebar-footer .user-name {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-footer .user-role {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.5px;
}

/* ────────────────────────────────────────────────────────
   ESTADO COLAPSADO — Desktop
   ──────────────────────────────────────────────────────── */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-w);
}

/* Ocultar textos del brand */
.sidebar.collapsed .brand-logo-area {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* Ocultar etiquetas de sección */
.sidebar.collapsed .nav-label {
    opacity: 0;
    height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

/* Centrar íconos del nav y ocultar texto */
.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0;
}

/* En modo colapsado el texto del nav-item es el TextNode directo.
   Lo envolvemos con un span.nav-text desde el HTML. */
.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Ocultar info del footer */
.sidebar.collapsed .sidebar-footer-info {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding: 14px 8px;
}

/* Rotar ícono del toggle */
.sidebar.collapsed .sidebar-toggle .material-icons-round {
    transform: rotate(180deg);
}

/* Tooltip nativo para los nav-items cuando está colapsado */
.sidebar.collapsed .nav-item {
    overflow: visible;
}

/* ────────────────────────────────────────────────────────
   OVERLAY Y BOTÓN FLOTANTE (Móvil)
   ──────────────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* Botón flotante para abrir en móvil */
.sidebar-open-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 98;
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-cta);
    color: #fff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 50, 125, 0.35);
    transition: opacity 0.20s ease, transform 0.20s ease;
}

.sidebar-open-btn.visible {
    display: flex;
}

.sidebar-open-btn:hover {
    opacity: 0.88;
    transform: scale(1.05);
}

.sidebar-open-btn .material-icons-round {
    font-size: 22px;
}

/* ─────────────── MAIN CONTENT ─────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    overflow-y: auto;
    height: 100vh;
    background: var(--surface);
    /* Transición sincronizada con el sidebar */
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Cuando el sidebar está colapsado en desktop */
.sidebar.collapsed ~ .sidebar-open-btn,
.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-w);
}

.page-header {
    padding: 28px 32px 0;
    background: var(--surface);
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--on-surface-variant);
    margin-top: 4px;
}

.page-body {
    padding: 24px 32px 40px;
}

/* ─────────────── KPI CARDS ─────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--surface-container-lowest, #fff);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-ambient);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform 0.18s ease;
}

.kpi-card:hover { transform: translateY(-2px); }

.kpi-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon.blue { background: var(--primary-container); }
.kpi-icon.blue .material-icons-round { color: #fff; }
.kpi-icon.amber { background: #FFF3E0; }
.kpi-icon.amber .material-icons-round { color: #E65100; }
.kpi-icon.green { background: #E8F5E9; }
.kpi-icon.green .material-icons-round { color: #2E7D32; }
.kpi-icon.red { background: var(--error-container); }
.kpi-icon.red .material-icons-round { color: var(--error); }

.kpi-icon .material-icons-round { font-size: 22px; }

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--on-surface);
    line-height: 1;
}

.kpi-label {
    font-size: 12px;
    color: var(--on-surface-variant);
    margin-top: 4px;
    font-weight: 500;
}

/* ─────────────── TABLES ─────────────── */
.data-section {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-ambient);
    overflow: hidden;
    margin-bottom: 24px;
}

.section-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-container-low);
}

.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--on-surface);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-subtitle {
    font-size: 12px;
    color: var(--on-surface-variant);
    margin-top: 2px;
}

.dn-table {
    width: 100%;
    border-collapse: collapse;
}

.dn-table thead tr {
    background: var(--primary-container);
}

.dn-table thead th {
    padding: 12px 16px;
    color: var(--on-primary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: left;
}

.dn-table thead th.right { text-align: right; }

.dn-table tbody tr:nth-child(odd) { background: #fff; }
.dn-table tbody tr:nth-child(even) { background: var(--surface-container-low); }

.dn-table tbody tr {
    transition: background 0.12s ease;
}

.dn-table tbody tr:hover { background: var(--surface-container); }

.dn-table tbody td {
    padding: 12px 16px;
    color: var(--on-surface);
    font-size: 13px;
    vertical-align: middle;
}

.dn-table tbody td.right { text-align: right; }
.dn-table tbody td.muted { color: var(--on-surface-variant); }

/* ─────────────── STATUS CHIPS ─────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.chip-progreso { background: #E3F2FD; color: #1565C0; }
.chip-cotizacion { background: #FFF8E1; color: #E65100; }
.chip-finalizado { background: #E8F5E9; color: #2E7D32; }
.chip-vencido { background: var(--error-container); color: var(--error); }
.chip-alert { background: var(--tertiary-fixed); color: var(--tertiary); }

/* ─────────────── BUTTONS ─────────────── */
.btn-primary-dn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--gradient-cta);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s ease, transform 0.12s ease;
    letter-spacing: 0.2px;
}

.btn-primary-dn:hover { opacity: 0.92; transform: translateY(-1px); color: #fff; }
.btn-primary-dn:active { transform: translateY(0); }

.btn-ghost-dn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: transparent;
    color: var(--primary-container);
    border: 1.5px solid var(--primary-container);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-ghost-dn:hover { background: var(--surface-container); color: var(--primary); }

.btn-icon-dn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--on-surface-variant);
    transition: background 0.12s ease;
    text-decoration: none;
}

.btn-icon-dn:hover { background: var(--surface-container); color: var(--on-surface); }
.btn-icon-dn.danger:hover { background: var(--error-container); color: var(--error); }

/* ─────────────── FORMS ─────────────── */
.form-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-ambient);
    padding: 28px;
    margin-bottom: 20px;
}

.form-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--primary-container);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-container);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid-full {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--on-surface-variant);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-control-dn {
    background: var(--surface-container-low);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 10px 12px;
    font-family: var(--font);
    font-size: 13px;
    color: var(--on-surface);
    outline: none;
    transition: border-color 0.18s ease, background 0.18s ease;
    width: 100%;
}

.form-control-dn:focus {
    border-bottom-color: var(--primary-container);
    background: var(--surface-container);
}

.form-control-dn::placeholder { color: var(--outline); }

select.form-control-dn { cursor: pointer; }
textarea.form-control-dn { resize: vertical; min-height: 80px; }

.field-validation-error {
    font-size: 11px;
    color: var(--error);
    margin-top: 2px;
}

/* ─────────────── DIAGNOSTIC CARD ─────────────── */
.diagnostic-card {
    background: var(--surface-container-high);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow-ambient);
}

.diag-header {
    background: var(--surface-container-highest);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.diag-header .material-icons-round { font-size: 18px; color: var(--primary-container); }
.diag-header-title { font-size: 12px; font-weight: 700; color: var(--on-surface); text-transform: uppercase; letter-spacing: 0.8px; }
.diag-body { padding: 16px 20px; font-size: 13px; color: var(--on-surface-variant); line-height: 1.6; }

/* ─────────────── SEARCH BAR ─────────────── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-container-low);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    border: 1.5px solid transparent;
    transition: border-color 0.18s;
    flex: 1;
    max-width: 340px;
}

.search-bar:focus-within { border-color: rgba(0,71,171,0.3); }

.search-bar input {
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: 13px;
    color: var(--on-surface);
    outline: none;
    flex: 1;
}

.search-bar input::placeholder { color: var(--outline); }
.search-bar .material-icons-round { font-size: 18px; color: var(--outline); }

/* ─────────────── SUMMARY BOX ─────────────── */
.summary-box {
    background: var(--primary-container);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: #fff;
}

.summary-box .s-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.summary-box .s-row:last-child { border-bottom: none; }
.summary-box .s-row.total { font-size: 18px; font-weight: 800; margin-top: 8px; border-top: 2px solid rgba(255,255,255,0.3); border-bottom: none; padding-top: 12px; }
.summary-box .s-label { opacity: 0.82; }
.summary-box .s-value { font-weight: 600; }

/* ─────────────── ALERTS/TOASTS ─────────────── */
.toast-success {
    background: #E8F5E9;
    border-left: 4px solid #2E7D32;
    color: #2E7D32;
    padding: 12px 20px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─────────────── INVENTORY CARDS ─────────────── */
.inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.inv-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-ambient);
    transition: transform 0.15s ease;
}

.inv-card:hover { transform: translateY(-2px); }

.inv-card.alert { border-top: 3px solid var(--error); }

.inv-card-code { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: var(--on-surface-variant); text-transform: uppercase; }
.inv-card-name { font-size: 14px; font-weight: 700; color: var(--on-surface); margin: 6px 0 4px; line-height: 1.3; }
.inv-card-cat { font-size: 11px; color: var(--on-surface-variant); }

.inv-stock {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stock-bar-wrap { flex: 1; height: 6px; background: var(--surface-container); border-radius: 3px; margin: 0 12px; overflow: hidden; }
.stock-bar { height: 100%; border-radius: 3px; background: var(--primary-container); transition: width 0.3s; }
.stock-bar.low { background: var(--error); }
.stock-num { font-size: 12px; font-weight: 700; color: var(--on-surface); white-space: nowrap; }

/* ─────────────── MISC ─────────────── */
.separator { height: 24px; }
.text-muted-dn { color: var(--on-surface-variant); font-size: 12px; }
.fw-semibold { font-weight: 600; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ms-auto { margin-left: auto; }
.text-right { text-align: right; }

/* ─────────────── DETAIL LAYOUT ─────────────── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.detail-sidebar { position: sticky; top: 20px; }

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.info-field .info-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    margin-bottom: 4px;
}

.info-field .info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--on-surface);
}

/* ─────────────── FILTER ROW ─────────────── */
.filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: all 0.12s;
    color: var(--on-surface-variant);
    background: var(--surface-container-low);
}

.filter-chip:hover, .filter-chip.active {
    background: var(--primary-container);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-layout { grid-template-columns: 1fr; }
}

/* ────────────────────────────────────────────────────────
   RESPONSIVO — Tablet y Móvil (≤ 768px)
   ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* El sidebar se convierte en un drawer deslizante */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important; /* siempre ancho completo en móvil */
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }

    /* Cuando está expandido (no colapsado) se desliza hacia dentro */
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    /* El main siempre ocupa todo el ancho en móvil */
    .main-content {
        margin-left: 0 !important;
        padding-top: 0;
    }

    /* Padding superior para que el contenido no quede bajo el botón flotante */
    .page-header {
        padding-top: 64px;
    }

    /* Ocultar textos del nav (mostrarlos, ya que el sidebar es full-width en móvil) */
    .sidebar.collapsed .brand-logo-area { opacity: 1; width: auto; pointer-events: auto; }
    .sidebar.collapsed .nav-label { opacity: 1; height: auto; margin: 8px 0 0; padding: 8px 8px 4px; pointer-events: auto; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 10px 12px; }
    .sidebar.collapsed .nav-text { opacity: 1; width: auto; pointer-events: auto; }
    .sidebar.collapsed .sidebar-footer-info { opacity: 1; width: auto; pointer-events: auto; }
    .sidebar.collapsed .sidebar-footer { justify-content: flex-start; padding: 14px; }
    .sidebar.collapsed .sidebar-toggle .material-icons-round { transform: none; }

    /* KPIs en 1 columna en móvil pequeño */
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .page-body { padding: 16px 16px 32px; }
    .page-header { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
}
