/* ============================================================
   DUNOSHOP — Sistema de Novedades
   Premium DARK theme inspirado en Maxton: deep navy background,
   vibrant gradient stat cards, compact density, modern SaaS feel.
   ============================================================ */

:root {
    /* Background layers — deep navy con sutil gradiente */
    --bg-page: #0B1220;
    --bg-elevated: #131C2E;
    --bg-elevated-2: #1A2438;
    --bg-subtle: #1E2A42;
    --bg-hover: #243149;

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: #B5BFD0;
    --text-tertiary: #7B879A;
    --text-disabled: #4F5969;

    /* Borders — sutiles sobre dark */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* Accent — Coral DUNOSHOP, ahora con glow eléctrico */
    --accent: #FF7847;
    --accent-hover: #FF8F66;
    --accent-active: #E5663A;
    --accent-soft: rgba(255, 120, 71, 0.12);
    --accent-glow: rgba(255, 120, 71, 0.35);

    /* Vibrant accent palette — para stat cards y badges */
    --grad-purple: linear-gradient(135deg, #7B5DFA 0%, #5839D7 100%);
    --grad-pink: linear-gradient(135deg, #F368A8 0%, #D74390 100%);
    --grad-cyan: linear-gradient(135deg, #3DBCF1 0%, #1E96D0 100%);
    --grad-green: linear-gradient(135deg, #3FE3A0 0%, #1FBE82 100%);
    --grad-orange: linear-gradient(135deg, #FFB05A 0%, #FF7847 100%);
    --grad-rose: linear-gradient(135deg, #FF9DAA 0%, #E5547B 100%);

    --color-purple: #7B5DFA;
    --color-pink: #F368A8;
    --color-cyan: #3DBCF1;
    --color-green: #3FE3A0;
    --color-orange: #FFB05A;

    /* Status — sobre dark */
    --status-ok: #3FE3A0;
    --status-ok-bg: rgba(63, 227, 160, 0.12);
    --status-ok-border: rgba(63, 227, 160, 0.3);
    --status-warning: #FFB05A;
    --status-warning-bg: rgba(255, 176, 90, 0.12);
    --status-warning-border: rgba(255, 176, 90, 0.3);
    --status-danger: #FF6B7A;
    --status-danger-bg: rgba(255, 107, 122, 0.12);
    --status-danger-border: rgba(255, 107, 122, 0.3);
    --status-info: #3DBCF1;
    --status-info-bg: rgba(61, 188, 241, 0.12);
    --status-info-border: rgba(61, 188, 241, 0.3);

    /* Shadows en dark — usan glow en lugar de sombra */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow-orange: 0 0 0 1px var(--accent-glow), 0 8px 24px var(--accent-glow);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === LIGHT THEME === */
.theme-light {
    --bg-page: #FAF8F2;
    --bg-elevated: #FFFFFF;
    --bg-elevated-2: #F2EFE5;
    --bg-subtle: #EBE7DA;
    --bg-hover: #E0DBC9;

    --text-primary: #1F1D17;
    --text-secondary: #5C5750;
    --text-tertiary: #8E8A7E;
    --text-disabled: #BFBAA8;

    --border-subtle: rgba(0, 0, 0, 0.07);
    --border-default: rgba(0, 0, 0, 0.12);
    --border-strong: rgba(0, 0, 0, 0.18);

    /* Sombras más visibles en claro */
    --shadow-xs: 0 1px 2px rgba(31, 29, 23, 0.04);
    --shadow-sm: 0 1px 3px rgba(31, 29, 23, 0.05), 0 1px 2px rgba(31, 29, 23, 0.03);
    --shadow-md: 0 4px 8px -2px rgba(31, 29, 23, 0.06), 0 2px 4px -1px rgba(31, 29, 23, 0.04);
    --shadow-lg: 0 12px 24px -6px rgba(31, 29, 23, 0.08), 0 4px 8px -2px rgba(31, 29, 23, 0.04);
    --shadow-xl: 0 24px 48px -12px rgba(31, 29, 23, 0.12);

    /* Status — TEXTOS más oscuros para contraste sobre fondos light */
    --status-ok: #2A6E48;        /* verde más oscuro (antes #3FE3A0 era para dark) */
    --status-ok-bg: #DCEBDF;
    --status-ok-border: #A7CCAE;
    --status-warning: #92551A;   /* ámbar oscuro (antes #FFB05A) */
    --status-warning-bg: #F5E5C8;
    --status-warning-border: #DDC089;
    --status-danger: #962E2E;    /* rojo oscuro (antes #FF6B7A) */
    --status-danger-bg: #F0D2D2;
    --status-danger-border: #D9A4A4;
    --status-info: #1F4F7A;      /* azul oscuro (antes #3DBCF1) */
    --status-info-bg: #D6E4F0;
    --status-info-border: #A4C0DA;

    /* Acentos vibrantes — versiones más oscuras para legibilidad sobre claro */
    --color-purple: #4E2EC4;
    --color-pink: #B83878;
    --color-cyan: #1E7AA8;
    --color-green: #1F8554;
    --color-orange: #C95226;

    /* Accent (coral) — un poquito más oscuro y soft adaptado */
    --accent: #D45A2D;
    --accent-hover: #BD4F26;
    --accent-active: #A6431F;
    --accent-soft: rgba(212, 90, 45, 0.10);
    --accent-glow: rgba(212, 90, 45, 0.22);
}

/* Badges con borde más grueso en light para que se distingan del fondo blanco */
.theme-light .badge {
    border-width: 1px;
    font-weight: 600;
}

/* Badge purple/pink override para light theme (usa --color-purple/pink ya redefinidos) */
.theme-light .badge-purple {
    background: rgba(78, 46, 196, 0.10);
    color: var(--color-purple);
    border-color: rgba(78, 46, 196, 0.28);
}
.theme-light .badge-pink {
    background: rgba(184, 56, 120, 0.10);
    color: var(--color-pink);
    border-color: rgba(184, 56, 120, 0.28);
}

/* Stat cards — gradientes ya se ven OK en light (texto blanco sobre gradiente vibrante) */
/* Pero los íconos pueden estar más opacos */
.theme-light .stat-card .stat-icon {
    background: rgba(255, 255, 255, 0.28);
}

/* SLA pills con borde más visible */
.theme-light .sla-pill {
    font-weight: 600;
}

/* Sidebar en light: white pero con sombra para diferenciarlo del fondo */
.theme-light .sidebar {
    background: #FFFFFF;
    border-right: 1px solid var(--border-subtle);
    box-shadow: 1px 0 12px rgba(31, 29, 23, 0.04);
}

/* Sidebar link active — fondo más visible en claro */
.theme-light .sidebar-link.active {
    background: rgba(212, 90, 45, 0.08);
    color: var(--accent);
}
.theme-light .sidebar-link.active::before {
    background: var(--accent);
}

/* Hover en filas de tabla en light */
.theme-light .table tr.clickable:hover td {
    background: rgba(212, 90, 45, 0.04);
}

/* Table header en light — fondo cálido, texto bien legible */
.theme-light .table th {
    background: var(--bg-elevated-2);
    color: #6B6358;
}

/* Input/textarea en light */
.theme-light .input,
.theme-light .select,
.theme-light .textarea {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-primary);
}

/* btn-secondary en light: borde y texto definidos */
.theme-light .btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}
.theme-light .btn-secondary:hover:not(:disabled) {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
}

/* Toggle switch en light: track gris claro */
.theme-light .toggle-slider {
    background: #E0DBC9;
    border-color: var(--border-default);
}
.theme-light .toggle-switch input:not(:checked) + .toggle-slider::before {
    background: #FFFFFF;
}

/* Search input en light */
.theme-light .search-input {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

/* Hamburger en light theme (override del anterior con mejor contraste) */
.theme-light .hamburger-btn {
    background: var(--bg-elevated);
    border-color: var(--border-default);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Theme toggle borde más definido en claro */
.theme-light .theme-toggle {
    border-color: var(--border-default);
    color: var(--text-secondary);
}

/* Card-footer en light tiene fondo gris demasiado oscuro — aclararlo */
.theme-light .card-footer {
    background: rgba(0, 0, 0, 0.02);
}

/* Empty state icon en light (era rgba(255 120 71 / 0.12)) — mantener pero con color más oscuro */
.theme-light .empty-state-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Avatar text-secondary cuando no tiene gradiente — asegurar contraste */
.theme-light .avatar {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Background gradient orbs más sutiles en claro */
.theme-light::before {
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(255, 120, 71, 0.06), transparent 60%),
        radial-gradient(ellipse 60% 50% at 85% 90%, rgba(255, 120, 71, 0.04), transparent 55%),
        radial-gradient(ellipse 50% 40% at 75% 20%, rgba(123, 93, 250, 0.03), transparent 50%);
}

/* En light theme el logo NO se invierte (ya es negro sobre claro) */
.theme-light .brand-logo {
    filter: none;
}

/* Hamburger en light theme */
.theme-light .hamburger-btn {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-secondary);
}
.theme-light .hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background con gradient sutil (dark) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 90% 70% at 15% 5%, rgba(123, 93, 250, 0.10), transparent 55%),
        radial-gradient(ellipse 70% 60% at 90% 95%, rgba(255, 120, 71, 0.08), transparent 55%),
        radial-gradient(ellipse 60% 50% at 80% 30%, rgba(61, 188, 241, 0.05), transparent 50%);
    pointer-events: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.015em;
}
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.4; font-weight: 600; }
h4 { font-size: 14px; line-height: 1.4; font-weight: 600; }

p { margin: 0; }
a { color: var(--accent); text-decoration: none; transition: color 160ms var(--ease-smooth); }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent); color: white; }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container { max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 480px; }
.container-md { max-width: 720px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.grow { flex-grow: 1; }
.w-full { width: 100%; }

.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: -0.01em; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.tabular { font-variant-numeric: tabular-nums; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* Card — dark elevated */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 240ms var(--ease-smooth), box-shadow 240ms var(--ease-smooth);
}
.card:hover { border-color: var(--border-default); }
.card-body { padding: 22px 24px; }
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: center; justify-content: space-between;
}
.card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.18);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 180ms var(--ease-smooth);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
    background: var(--grad-orange);
    color: white;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 4px 12px rgba(255, 120, 71, 0.4);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 6px 18px rgba(255, 120, 71, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated-2);
    color: var(--text-primary);
    border-color: var(--border-default);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated-2); color: var(--text-primary); }

.btn-danger { background: linear-gradient(135deg, #FF6B7A, #D74356); color: white; }
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }

.btn-success { background: var(--grad-green); color: white; }
.btn-success:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }

.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; }

/* Input */
.input, .select, .textarea {
    width: 100%;
    padding: 10px 13px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-elevated-2);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all 180ms var(--ease-smooth);
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-disabled); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: -0.005em;
}
.field { margin-bottom: 16px; }

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    font-size: 11.5px;
    font-weight: 500;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1.4;
}
.badge-ok { background: var(--status-ok-bg); color: var(--status-ok); border-color: var(--status-ok-border); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); border-color: var(--status-warning-border); }
.badge-danger { background: var(--status-danger-bg); color: var(--status-danger); border-color: var(--status-danger-border); }
.badge-info { background: var(--status-info-bg); color: var(--status-info); border-color: var(--status-info-border); }
.badge-purple { background: rgba(123, 93, 250, 0.12); color: var(--color-purple); border-color: rgba(123, 93, 250, 0.3); }
.badge-pink { background: rgba(243, 104, 168, 0.12); color: var(--color-pink); border-color: rgba(243, 104, 168, 0.3); }
.badge-neutral { background: var(--bg-elevated-2); color: var(--text-secondary); border-color: var(--border-default); }

/* Badge URGENTE — para "Sin gestión", llama la atención con pulso */
.badge-urgent {
    background: linear-gradient(135deg, #FF6B7A 0%, #FF7847 100%);
    color: white !important;
    border: none !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 3px rgba(255, 107, 122, 0.35);
    animation: badge-urgent-pulse 2.2s ease-in-out infinite;
}
@keyframes badge-urgent-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 122, 0.55), 0 1px 3px rgba(255, 107, 122, 0.35);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(255, 107, 122, 0), 0 1px 3px rgba(255, 107, 122, 0.35);
        transform: scale(1.03);
    }
}
.theme-light .badge-urgent {
    background: linear-gradient(135deg, #E54E5E 0%, #DC5A29 100%);
    box-shadow: 0 1px 3px rgba(220, 90, 41, 0.4);
}

.badge-dot {
    width: 6px; height: 6px;
    border-radius: 999px;
    background: currentColor;
    display: inline-block;
    position: relative;
}
.badge-dot.pulse::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.4;
    animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Stat card — gradient backgrounds */
.stat-card {
    position: relative;
    padding: 20px 22px;
    border-radius: var(--radius-lg);
    color: white;
    overflow: hidden;
    transition: transform 240ms var(--ease-smooth), box-shadow 240ms var(--ease-smooth);
    box-shadow: var(--shadow-md);
    isolation: isolate;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
}
.stat-card.purple::before { background: var(--grad-purple); }
.stat-card.pink::before { background: var(--grad-pink); }
.stat-card.cyan::before { background: var(--grad-cyan); }
.stat-card.green::before { background: var(--grad-green); }
.stat-card.orange::before { background: var(--grad-orange); }

/* Decorative blob in stat card corner */
.stat-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 60%);
    z-index: -1;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    display: grid; place-items: center;
    color: white;
    margin-bottom: 16px;
    backdrop-filter: blur(8px);
}
.stat-card .stat-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.85;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}
.stat-card .stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
}

/* Stat card alternativa — neutral con borde de color */
.stat-card-neutral {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    transition: all 240ms var(--ease-smooth);
    box-shadow: var(--shadow-sm);
}
.stat-card-neutral:hover { border-color: var(--border-default); transform: translateY(-2px); }
.stat-card-neutral .stat-label {
    font-size: 12px; font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.stat-card-neutral .stat-value {
    font-size: 28px; font-weight: 700;
    color: var(--text-primary); line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-card-neutral .stat-meta {
    margin-top: 8px; font-size: 12px; color: var(--text-tertiary);
}

/* Table */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}
.table th, .table td {
    padding: 13px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
}
.table th {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-tertiary);
    background: rgba(0, 0, 0, 0.18);
}
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; transition: background 160ms var(--ease-smooth); }
.table tr.clickable:hover td { background: var(--bg-elevated-2); }

/* App shell + sidebar */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand {
    padding: 4px 12px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar-section { margin-top: 18px; }
.sidebar-section-title {
    padding: 0 12px 6px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}

/* ─── Sección colapsable del sidebar ─── */
aside .sidebar-collapsible {
    display: block;
    margin-top: 14px;
}

aside .sidebar-section-toggle {
    /* Reset agresivo del button */
    all: unset;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    margin: 0 0 4px 0;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 8px;
    transition: background 180ms, color 180ms;
}
aside .sidebar-section-toggle > span {
    flex: 1;
    text-align: left;
}
aside .sidebar-section-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-elevated-2);
}
aside .sidebar-section-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
aside .sidebar-section-toggle .chevron {
    flex: 0 0 auto;
    transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.55;
}
aside .sidebar-section-toggle:hover .chevron { opacity: 1; }

/* Body: por default visible. Cuando .collapsed → escondido. */
aside .sidebar-section-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    max-height: 1200px;
    opacity: 1;
    transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1),
                opacity 200ms ease,
                margin 200ms ease,
                padding 200ms ease;
}

/* Chevron rotado cuando está colapsada */
aside .sidebar-collapsible.collapsed .sidebar-section-toggle .chevron {
    transform: rotate(-90deg);
}
aside .sidebar-collapsible.collapsed .sidebar-section-body {
    max-height: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    font-size: 13.5px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all 160ms var(--ease-smooth);
    font-weight: 500;
    letter-spacing: -0.005em;
}
.sidebar-link:hover { background: var(--bg-elevated-2); color: var(--text-primary); }
.sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    position: relative;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sidebar-link.active svg { opacity: 1; }

.main-content {
    padding: 28px 36px;
    overflow-y: auto;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; line-height: 1.2; }
.page-subtitle { color: var(--text-tertiary); font-size: 13.5px; letter-spacing: -0.005em; }

/* Avatar */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--grad-purple);
    display: grid; place-items: center;
    color: white; font-weight: 600; font-size: 12.5px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}
.avatar.coral { background: var(--grad-orange); }
.avatar.cyan { background: var(--grad-cyan); }
.avatar.pink { background: var(--grad-pink); }
.avatar.green { background: var(--grad-green); }

/* Auth screens */
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}

/* Logo */
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
}
.logo-mark {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--grad-orange);
    display: grid; place-items: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 4px 12px rgba(255, 120, 71, 0.35);
    letter-spacing: 0;
}
.logo-text { font-family: var(--font-sans); letter-spacing: -0.02em; color: var(--text-primary); }

/* Logo imagen (DunoShop) — convierte cualquier imagen a blanco para tema dark */
.brand-logo {
    height: 36px;
    width: auto;
    display: block;
    /* brightness(0) → todo a negro, invert(1) → invierte a blanco */
    filter: brightness(0) invert(1);
}
.brand-logo-icon {
    height: 30px;
    width: auto;
    display: block;
}

/* SLA pill */
.sla-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    font-size: 11px; font-weight: 500;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    border: 1px solid transparent;
}
.sla-fresh { background: var(--status-ok-bg); color: var(--status-ok); border-color: var(--status-ok-border); }
.sla-warning { background: var(--status-warning-bg); color: var(--status-warning); border-color: var(--status-warning-border); }
.sla-critical { background: var(--status-danger-bg); color: var(--status-danger); border-color: var(--status-danger-border); }

/* SLA crítico con pulso de alerta (cuando lleva >24h sin gestión) */
.sla-urgent-pulse {
    background: linear-gradient(135deg, #FF6B7A 0%, #FF7847 100%) !important;
    color: white !important;
    border-color: transparent !important;
    font-weight: 600 !important;
    animation: sla-pulse 1.8s ease-in-out infinite;
}
@keyframes sla-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 122, 0.55); transform: scale(1); }
    50% { box-shadow: 0 0 0 6px rgba(255, 107, 122, 0); transform: scale(1.04); }
}

/* Segundos parpadeando (efecto "reloj corriendo") */
.sla-sec {
    opacity: 0.55;
    animation: sla-sec-blink 1s steps(2, end) infinite;
    font-variant-numeric: tabular-nums;
    margin-left: 2px;
}
@keyframes sla-sec-blink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0.4; }
}
.sla-urgent-pulse .sla-sec { opacity: 0.85; }

/* SLA cerrada (estado informativo, sin tickeo ni alerta) */
.sla-closed {
    background: var(--bg-elevated-2) !important;
    color: var(--text-tertiary) !important;
    border-color: var(--border-default) !important;
    font-weight: 400 !important;
    font-size: 10.5px !important;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-default), transparent);
    margin: 20px 0;
}

/* Search input topbar */
.search-input {
    background: var(--bg-elevated-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px 12px 8px 36px;
    font-size: 13.5px;
    color: var(--text-primary);
    width: 280px;
    transition: all 180ms var(--ease-smooth);
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}
.search-input::placeholder { color: var(--text-disabled); }
.search-wrapper { position: relative; }
.search-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 40px;
}
.empty-state-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: var(--accent-soft);
    display: grid; place-items: center;
    color: var(--accent);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 20px 4px var(--accent-glow); }
}
.fade-in { animation: fadeIn 380ms var(--ease-smooth) both; }
.fade-in-scale { animation: fadeInScale 320ms var(--ease-smooth) both; }
.delay-1 { animation-delay: 60ms; }
.delay-2 { animation-delay: 120ms; }
.delay-3 { animation-delay: 180ms; }
.delay-4 { animation-delay: 240ms; }
.delay-5 { animation-delay: 300ms; }

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated-2) 25%, var(--bg-hover) 50%, var(--bg-elevated-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s linear infinite;
    border-radius: var(--radius-md);
}

/* Toggle switch (estilo iOS) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-elevated-2);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    transition: all 200ms var(--ease-smooth);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 2px; bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 200ms var(--ease-smooth);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: white;
}
.toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }
.toggle-switch:hover input:not(:disabled):checked + .toggle-slider {
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); }

/* === RESPONSIVE — Default: full sidebar layout (desktop & tablets ancho) === */

/* Hamburger button — oculto por default, solo aparece en mobile */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: rgba(19, 28, 46, 0.85);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 9px;
    cursor: pointer;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 180ms var(--ease-smooth);
}
.hamburger-btn:hover {
    color: var(--accent);
    border-color: rgba(255, 120, 71, 0.3);
    background: rgba(19, 28, 46, 0.95);
}
.hamburger-btn:active { transform: scale(0.94); }

/* Theme switcher (sun/moon) — pill transparente con borde */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: 999px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 280ms var(--ease-smooth);
    position: relative;
    overflow: hidden;
}
.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-soft);
    opacity: 0;
    transition: opacity 280ms var(--ease-smooth);
    border-radius: 999px;
}
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.06) rotate(15deg);
}
.theme-toggle:hover::before { opacity: 1; }
.theme-toggle:active { transform: scale(0.95) rotate(15deg); }

.theme-toggle svg {
    position: relative;
    z-index: 1;
    transition: transform 380ms var(--ease-bounce);
}

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
.theme-light .theme-toggle .sun { display: block; }
.theme-light .theme-toggle .moon { display: none; }

/* Botón close dentro del sidebar (solo aparece en mobile cuando sidebar está abierto) */
.sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 7px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 160ms var(--ease-smooth);
}
.sidebar-close:hover { color: var(--accent); border-color: rgba(255, 120, 71, 0.3); }

/* Overlay del drawer */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(11, 18, 32, 0.75);
    backdrop-filter: blur(4px);
    z-index: 95;
}

/* === MOBILE breakpoint = ≤768px (real teléfonos / tablets verticales) === */
@media (max-width: 768px) {
    /* Layout 1 columna */
    .app-shell { grid-template-columns: 1fr; }

    /* Sidebar como drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100vh;
        width: min(280px, 85vw);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 280ms var(--ease-smooth);
        box-shadow: var(--shadow-xl);
        padding: 16px 12px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .hamburger-btn { display: inline-flex; }

    /* Hamburger SIEMPRE visible (cerrado o abierto) — alterna estado al click */
    /* Cuando menú abierto: hamburger queda DENTRO del sidebar (z-index lo coloca encima) */
    body.menu-open .hamburger-btn {
        /* Mantenerlo visible y a la misma posición; queda sobre el sidebar */
        z-index: 200;  /* sigue por encima del sidebar (z-index 100) */
    }
    body.menu-open .sidebar-close { display: inline-flex; }

    /* Padding-top en sidebar para que el botón close no tape el logo */
    .sidebar { padding-top: 60px; }

    /* Espacio para el hamburger */
    .main-content { padding: 56px 16px 24px; }
    .topbar { padding-left: 44px; gap: 10px; flex-wrap: wrap; }
    .search-input, .search-wrapper { width: 100%; min-width: 140px; }
    .search-wrapper { flex-grow: 1; }

    /* Tipografía */
    .page-title { font-size: 22px; }
    .page-subtitle { font-size: 13px; }
    .page-header { flex-wrap: wrap; gap: 12px; }
    h1 { font-size: 22px; }

    /* Cards más compactas */
    .card-body { padding: 18px; }
    .card-header { padding: 14px 18px; }
    .card-footer { padding: 12px 18px; flex-wrap: wrap; }
    .stat-card { padding: 16px 18px; }
    .stat-card .stat-value { font-size: 24px; }

    /* 2 columnas en detail → 1 columna */
    .main-content > div[style*="grid-template-columns: 1.5fr 1fr"],
    .main-content > div[style*="grid-template-columns: 1.7fr 1fr"],
    .main-content > div[style*="grid-template-columns: 1.4fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Stat grid 2 cols */
    .main-content [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* Forms apilados */
    .main-content form > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Tablas con scroll */
    .card > .table,
    .card-body .table {
        display: block; overflow-x: auto; white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .table th, .table td { padding: 10px 12px; font-size: 13px; }

    /* Touch targets */
    .btn-icon { padding: 9px; min-width: 36px; min-height: 36px; }

    /* Auth */
    .auth-card { padding: 28px 22px 24px; max-width: 100%; }
    .auth-screen { padding: 16px; }
}

/* Pantallas muy chicas (≤480px): stat cards en 1 sola columna */
@media (max-width: 480px) {
    .page-title { font-size: 20px; }
    .main-content { padding: 56px 12px 20px; }
    .main-content [style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
    .sidebar { width: 100vw; }
    .btn-sm { padding: 6px 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
