/* ==========================================
   LogiTrack S.A. - Dashboard & Layout CSS
   Login hero · Sidebar · Main · Stat cards
   ========================================== */

/* ============================================================
   AUTH / LOGIN VIEW
   ============================================================ */
/* ============================================================
   AUTH / LOGIN VIEW (ESTRUCTURA DE ALINEACIÓN BALANCEADA)
   ============================================================ */
#auth-layout {
    min-height: 100vh;
    width: 100%;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    position: relative;
    z-index: 1;
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 42px 42px;
    background-attachment: fixed;
}

@media (max-width: 1100px) {
    #auth-layout {
        grid-template-columns: 1fr 420px;
    }
}

@media (max-width: 900px) {
    #auth-layout {
        grid-template-columns: 1fr;
    }
}

/* Hero section (left panel) */
.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 60px 70px;
    overflow: hidden;
    background: transparent;
    border-right: none;
}

@media (max-width: 900px) {
    .login-hero {
        padding: 40px 30px;
        border-right: none;
        border-bottom: none;
    }
}

/* Animated warehouse map SVG background */
.baymap {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
}
.baymap svg { width: 100%; height: 100%; }
.bay-cell   { fill: rgba(27, 33, 44, 0.2); stroke: var(--border); stroke-width: 1; }
.bay-node   { animation: pulse 3.2s ease-in-out infinite; transform-origin: center; filter: drop-shadow(0 0 6px var(--accent)); }
.bay-node.n2 { animation-delay: 0.6s; }
.bay-node.n3 { animation-delay: 1.2s; }
.bay-node.n4 { animation-delay: 1.8s; }
.bay-node.n5 { animation-delay: 2.4s; }
.bay-link   { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 6 6; animation: dashPulse 16s linear infinite; opacity: 0.6; }

@keyframes dashPulse {
    to {
        stroke-dashoffset: -120;
    }
}

.login-hero-content { position: relative; z-index: 1; max-width: 680px; }

/* Brand lockup */
.brand-lockup {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    background: url('../images/logo-icon.svg') center/contain no-repeat;
    filter: drop-shadow(0 0 10px rgba(255, 106, 43, 0.45));
    display: inline-block;
    flex-shrink: 0;
    transition: transform 0.3s ease, filter 0.3s ease;
}
.brand-mark:hover {
    transform: scale(1.06);
    filter: drop-shadow(0 0 16px rgba(255, 106, 43, 0.7));
}
.brand-mark span { display: none; }

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}
.brand-name b { color: var(--accent); }

/* Headlines */
.hero-headline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(36px, 4vw, 54px);
    line-height: 1.05;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    color: var(--text);
    margin-top: 36px;
}
.hero-headline em { font-style: normal; color: var(--accent); }

.hero-sub {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    max-width: 540px;
    margin-top: 20px;
    line-height: 1.65;
}

/* Telemetry Pills */
.hero-telemetry {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.tele-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.tele-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}
.tele-dot.warning { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.tele-dot.info    { background: var(--info); box-shadow: 0 0 8px var(--info); }

.tele-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    color: var(--text);
    font-weight: 600;
}

/* Hero stats footer */
.hero-footer {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-top: 36px;
}
.hero-stat .num {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.hero-stat .num span { color: var(--accent); }
.hero-stat .label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 4px;
}

/* ===== AUTH / LOGIN VIEW (UNIFICADO CON EL SISTEMA DE PANELES) ===== */
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 40px;
    position: relative;
    z-index: 1;
    background: transparent;
    border-left: none;
    width: 100%;
}

.auth-card {
    width: 100%;
    max-width: 410px;
    background: rgba(27, 33, 44, 0.92);
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 106, 43, 0.25), inset 0 0 15px rgba(255, 106, 43, 0.05);
}

/* Eye Password Toggle & CapsLock Alert */
.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrap .form-input {
    padding-right: 42px;
}

.btn-toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
}

.btn-toggle-password:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
}

.caps-lock-alert {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #eab308;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 4px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s ease-out;
}

.auth-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.auth-card-header {
    padding: 28px 28px 16px;
    border-bottom: 1px solid var(--border);
}

.auth-card-title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text);
    margin-top: 4px;
}

.auth-card-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.auth-card-body {
    padding: 24px 28px 28px;
}

.auth-footer-meta {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
    text-align: center;
}

.sys-status {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--success);
}

.auth-toggle {
    margin-top: 14px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--accent-2);
    font-weight: 600;
    margin-left: 4px;
    text-decoration: none;
}

.auth-toggle a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ============================================================
   DASHBOARD VIEW
   ============================================================ */
/* ============================================================
   DASHBOARD VIEW (Mobile-First Architecture)
   ============================================================ */
#app-layout {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    min-height: 100vh;
}

/* ===== SIDEBAR (Mobile Drawer by Default) ===== */
.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 24px 0 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar .brand-lockup {
    flex-shrink: 0;
    padding: 0 22px;
    margin-bottom: 20px;
}
.sidebar .brand-name { font-size: 16px; }
.sidebar .brand-mark { width: 32px; height: 32px; }

/* Scrollable nav menu body */
.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav-scroll::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Nav groups */
.nav-group-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 0 22px;
    margin: 16px 0 6px;
}

.nav-list { list-style: none; }

.nav-item,
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 22px;
    font-family: var(--font-body);
    font-size: 13.5px;
    color: var(--text-muted);
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: var(--transition);
    text-decoration: none;
}

.nav-item:hover,
.nav-link:hover {
    color: var(--text);
    background: rgba(255,255,255,0.02);
}

.nav-item.active,
.nav-link.active {
    color: var(--text);
    border-left-color: var(--accent);
    background: linear-gradient(90deg, var(--accent-dim), transparent);
}

.nav-code {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    width: 30px;
    flex-shrink: 0;
}
.nav-item.active .nav-code,
.nav-link.active .nav-code {
    color: var(--accent);
}

/* Sidebar footer / user chip (Fijo siempre abajo) */
.sidebar-foot {
    flex-shrink: 0;
    margin-top: auto;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--border);
    background: rgba(18, 22, 29, 0.96);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--panel-3);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-2);
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.user-role { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-logout-topbar {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ef4444;
    transition: all 0.2s ease;
}

.btn-logout-topbar:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* ===== MAIN WRAPPER (Mobile First) ===== */
.main-wrapper {
    flex: 1;
    margin-left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main,
.content-area {
    padding: clamp(14px, 3vw, 28px);
    flex: 1;
}

/* ===== TOPBAR (Mobile First) ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(18, 22, 29, 0.96) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.page-title,
.topbar h1 {
    font-family: var(--font-display);
    font-size: clamp(14px, 2vw, 18px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.topbar-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Hide non-essential desktop topbar tags on Mobile by Default */
.topbar-meta #clock,
.topbar-meta .topbar-date,
.topbar-meta .topbar-date-sep,
.topbar-meta .cmd-text,
.topbar-meta .cmd-kbd {
    display: none;
}

#clock { color: var(--accent-2); }

.content-area {
    padding: 26px 34px 60px;
    flex: 1;
}

/* ===== STAT / METRIC CARDS ===== */
.stat-row,
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    gap: clamp(12px, 2vw, 20px);
    margin-bottom: clamp(20px, 3vw, 32px);
}

.stat-card,
.metric-card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: clamp(16px, 2.2vw, 24px);
    border-radius: var(--radius-md);
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.stat-card:hover,
.metric-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 106, 43, 0.15);
}

.stat-card .eyebrow,
.metric-header {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: clamp(10.5px, 1.2vw, 12px);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
}

/* Override eyebrow::before for metric-header */
.metric-header::before { display: none; }

.stat-value,
.metric-value {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.8vw, 42px);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    letter-spacing: -0.01em;
}

.stat-delta {
    font-family: var(--font-mono);
    font-size: 12px;
    margin-top: 10px;
    font-weight: 600;
}
.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ===== SECTION HEADERS ===== */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.section-title h2,
.section-title h3 {
    font-family: var(--font-display);
    font-size: clamp(17px, 2.4vw, 22px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    margin: 0;
}

.section-title a {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-2);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ===== BODEGAS GRID ===== */
.bodegas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: clamp(10px, 2vw, 16px);
    margin-bottom: 30px;
}

.bodega-card {
    background: var(--panel);
    border: 1px solid var(--border);
    padding: clamp(14px, 2vw, 18px);
    border-radius: var(--radius-md);
    position: relative;
    transition: var(--transition);
}

.bodega-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.bodega-card:hover { border-color: var(--text-dim); }

.bodega-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.bodega-name { font-family: var(--font-display); font-size: clamp(14px, 1.8vw, 17px); text-transform: uppercase; }
.bodega-loc  { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); margin-top: 3px; }
.bodega-id   { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

/* Gauge */
.gauge-label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.gauge {
    height: 6px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    width: 0;
    transition: width 1.1s cubic-bezier(0.4,0,0.2,1);
}

.gauge-fill.warn {
    background: linear-gradient(90deg, var(--danger), var(--accent));
}

.bodega-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
}

/* ===== SPLIT ROW (2-column layout) ===== */
.split-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: clamp(12px, 2vw, 18px);
    align-items: start;
}

/* ===== TABLE WRAP (inline table cards) ===== */
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap thead th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
    white-space: nowrap;
}
.table-wrap tbody td {
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover { background: rgba(255,255,255,0.015); }

/* ===== ALERTS PANEL (stock bajo) ===== */
.alerts-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.alert-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: rgba(255,255,255,0.015); }
.alert-name  { font-size: 13px; color: var(--text); }
.alert-cat   { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.alert-stock { font-family: var(--font-mono); font-size: 13px; color: var(--danger); font-weight: 600; }

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 20px;
}

.chart-card--wide { grid-column: 1 / -1; }

.chart-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.chart-card:hover { border-color: var(--text-dim); }

.chart-card__header {
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border);
}

.chart-card__title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text);
    margin: 0 0 2px;
}

.chart-card__subtitle {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-dim);
}

.chart-card__body {
    padding: 14px;
    position: relative;
    min-height: 220px;
}

/* ===== HAMBURGER BUTTON & SIDEBAR OVERLAY ===== */
.btn-hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    z-index: 101;
}

.btn-hamburger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.btn-hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.btn-hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Sidebar Backdrop Mobile Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ===== SYSTEM-WIDE RESPONSIVE ENHANCEMENTS ===== */

/* 1. Desktop & Laptop Layout Override (>= 901px) */
@media (min-width: 901px) {
    #app-layout {
        display: block;
        width: 100%;
    }

    .main-wrapper {
        margin-left: 245px;
        width: calc(100% - 245px);
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 245px;
        transform: translateX(0) !important;
        box-shadow: none;
        background: rgba(27, 33, 44, 0.95);
        z-index: 100;
    }

    .btn-hamburger {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .topbar {
        padding: 0 40px;
        height: 64px;
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }

    .topbar-meta #clock,
    .topbar-meta .topbar-date,
    .topbar-meta .topbar-date-sep,
    .topbar-meta .cmd-text,
    .topbar-meta .cmd-kbd {
        display: inline-block !important;
    }

    .content-area {
        padding: 30px 42px 60px;
    }

    .stat-row, .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 22px;
    }

    .bodegas-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 22px;
    }

    .split-row {
        gap: 24px;
    }
}

/* 2. Large Monitors (>= 1441px) */
@media (min-width: 1441px) {
    .content-area {
        max-width: 100%;
        padding: 36px 56px 80px;
    }

    .stat-row, .metrics-grid {
        gap: 28px;
    }

    .bodegas-grid {
        gap: 28px;
    }

    .stat-card, .metric-card {
        padding: 24px 30px;
    }

    .bodega-card {
        padding: 24px 28px;
    }
}
}

/* 3. Mid-range Tablets (769px - 1100px) */
@media (min-width: 769px) and (max-width: 1100px) {
    .stat-row, .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .bodegas-grid { grid-template-columns: repeat(2, 1fr); }
    .split-row { grid-template-columns: 1fr; }
}

/* 4. Small Tablets & Mobile Devices (<= 768px) */
@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chart-card--wide { grid-column: 1; }
    
    .table-container, .table-wrap {
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }

    .table th, .table td {
        padding: 9px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    #auth-layout { grid-template-columns: 1fr; }
    .login-hero  { display: none; }
}

/* 5. Mobile Small Devices (<= 480px) */
@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
        height: 56px;
        gap: 8px;
    }

    .page-title {
        font-size: 14px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .btn-cmd-palette {
        margin-right: 0;
        padding: 6px 10px;
    }

    .stat-row, .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card, .metric-card {
        padding: 12px;
    }

    .stat-value, .metric-value {
        font-size: 22px;
    }

    .stat-card .eyebrow, .metric-header {
        font-size: 9px;
        margin-bottom: 4px;
    }

    .bodegas-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .bodega-card {
        padding: 14px;
    }

    .drawer-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0;
    }

    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        padding: 18px 14px !important;
        margin: 10px auto !important;
        border-radius: 12px;
    }

    .cmd-overlay {
        padding-top: 10px;
    }

    .cmd-dialog {
        width: 95%;
        margin: 0 auto;
    }
}

/* ===== SLIDE-OVER DRAWER ===== */

/* Slide-Over Drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000 !important;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    justify-content: flex-end;
}

.drawer-overlay.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 9000 !important;
}

.drawer-content {
    width: 100%;
    max-width: 520px;
    height: 100%;
    background: var(--panel);
    border-left: 1px solid var(--border);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-overlay.active .drawer-content {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.25);
}

.drawer-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.drawer-close:hover {
    color: var(--danger);
    background: rgba(255, 77, 94, 0.1);
}

.drawer-body {
    padding: 24px;
    overflow-y.auto;
    flex: 1;
}

.drawer-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.drawer-field {
    margin-bottom: 12px;
}

.drawer-field:last-child {
    margin-bottom: 0;
}

.drawer-field-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.drawer-field-value {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

/* ===== SPARKLINE MINI-CHARTS & COMMAND PALETTE ===== */

.metric-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.trend-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.trend-up {
    color: var(--success);
    background: var(--success-dim);
}

.trend-down {
    color: var(--danger);
    background: var(--danger-dim);
}

.sparkline-wrap {
    margin-top: 10px;
    height: 28px;
    width: 100%;
    overflow: hidden;
}

.sparkline-svg {
    width: 100%;
    height: 100%;
}

/* Command Palette Trigger Button */
.btn-cmd-palette {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 5px 12px;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 12px;
}

.btn-cmd-palette:hover {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.btn-cmd-palette kbd {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 10px;
    color: var(--text-dim);
}

/* Command Palette Overlay Modal */
.cmd-overlay {
    position: fixed;
    inset: 0;
    z-index: 9800 !important;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.cmd-overlay.active {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 9800 !important;
}

.cmd-dialog {
    width: 100%;
    max-width: 640px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 106, 43, 0.15);
    overflow: hidden;
    transform: translateY(-15px);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cmd-overlay.active .cmd-dialog {
    transform: translateY(0);
}

.cmd-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    gap: 12px;
}

.cmd-search-icon {
    font-size: 18px;
    color: var(--accent);
}

.cmd-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 16px;
    font-family: var(--font-main);
}

.cmd-esc-tag {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    cursor: pointer;
}

.cmd-results {
    max-height: 380px;
    overflow-y: auto;
    padding: 12px 16px;
}

.cmd-empty-hint {
    padding: 24px 16px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

.cmd-group-title {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 10px 4px;
}

.cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
}

.cmd-item:hover {
    background: var(--accent-dim);
    border-left: 3px solid var(--accent);
}

.cmd-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cmd-item-title {
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.cmd-item-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.cmd-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

.cmd-footer kbd {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 4px;
    color: var(--text-muted);
}

/* ==========================================
   Filtros Modernos y Barras de Control WMS
   ========================================== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-bar .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters-bar .filter-group label {
    font-size: 11px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    white-space: nowrap;
    margin: 0;
}

.filters-bar .form-control,
.filters-bar input[type="text"],
.filters-bar select {
    background: #0B111E;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-bright, #F8FAFC);
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-body);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 180px;
}

.filters-bar .form-control:focus,
.filters-bar input[type="text"]:focus,
.filters-bar select:focus {
    outline: none;
    border-color: var(--accent, #FF6A2B);
    box-shadow: 0 0 0 2px rgba(255, 106, 43, 0.2);
}

.filters-bar .btn-outline {
    background: rgba(255, 179, 0, 0.08);
    border: 1px solid rgba(255, 179, 0, 0.35);
    color: #FFB800;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.filters-bar .btn-outline:hover {
    background: rgba(255, 179, 0, 0.18);
    border-color: #FFB800;
    transform: translateY(-1px);
}

/* ==========================================
   Secciones y Tablas de Historial WMS
   ========================================= */
.wms-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 28px 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wms-section-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.wms-section-header .section-badge {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-family: var(--font-mono);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-indicator.active {
    background: #FFA000;
    box-shadow: 0 0 8px rgba(255, 160, 0, 0.6);
}

.status-indicator.completed {
    background: #00E676;
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.6);
}


.table-container {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.order-detail-grid .meta-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.order-detail-grid .meta-item label {
    font-size: 10px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    color: var(--text-muted);
}

.order-detail-grid .meta-item span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
}

