/* ============================================
   SISTEMA DE EXTENSIONES — ESTILOS GLOBALES
   Estética: cian/violeta sobre azul noche
   Inspirado en dashboard tech moderno
   ============================================ */

/* --- 1. Variables de diseño --- */
/* TEMA OSCURO (por defecto) */
:root,
[data-theme="dark"] {
    color-scheme: dark;   /* controles nativos (select, scrollbar, options) en tema oscuro */

    --bg:          #0c1324;
    --bg-solid:    #0c1324;
    --bg-glass:    rgba(12, 19, 36, 0.95);
    --sidebar:     #0c1324;
    --card:        rgba(255, 255, 255, 0.03);
    --card-solid:  #131c34;
    --card2:       rgba(255, 255, 255, 0.05);
    --border:      rgba(255, 255, 255, 0.07);
    --border-2:    rgba(255, 255, 255, 0.12);
    --fg:          #dce1fb;
    --fg-strong:   #ffffff;
    --muted:       #7a85a8;
    --surface-hover: rgba(255, 255, 255, 0.05);
    --input-bg:    rgba(255, 255, 255, 0.04);
    --grid-line:   rgba(31, 41, 55, 0.35);
    --halo-cian:   rgba(0, 242, 254, 0.06);
    --halo-violeta:rgba(139, 92, 246, 0.06);
    --placeholder: #56607a;

    --accent:      #00f2fe;   /* cian eléctrico */
    --accent2:     #8b5cf6;   /* violeta */
    --accent3:     #ec4899;   /* rosa (gradiente animado) */
    --accent-text: #0a0f1a;   /* texto sobre acentos */
    --ext-num:     #00f2fe;

    --success:     #10b981;
    --danger:      #ff4d6a;
    --warning:     #ffb020;
    --info:        #38bdf8;

    --sidebar-w:   260px;
    --radius:      14px;
    --shadow:      0 10px 30px rgba(0, 0, 0, 0.45);
}

/* TEMA CLARO */
[data-theme="light"] {
    color-scheme: light;

    --bg:          #eef1f8;
    --bg-solid:    #ffffff;
    --bg-glass:    rgba(255, 255, 255, 0.85);
    --sidebar:     #ffffff;
    --card:        #ffffff;
    --card-solid:  #ffffff;
    --card2:       #f1f4f9;
    --border:      rgba(15, 23, 42, 0.08);
    --border-2:    rgba(15, 23, 42, 0.16);
    --fg:          #1e293b;
    --fg-strong:   #0a0f1a;
    --muted:       #64748b;
    --surface-hover: rgba(15, 23, 42, 0.04);
    --input-bg:    #ffffff;
    --grid-line:   rgba(15, 23, 42, 0.06);
    --halo-cian:   rgba(0, 180, 220, 0.10);
    --halo-violeta:rgba(139, 92, 246, 0.08);
    --placeholder: #94a3b8;

    --accent:      #0891b2;   /* cian más oscuro para contraste sobre blanco */
    --accent2:     #7c3aed;   /* violeta más oscuro */
    --accent3:     #db2777;
    --accent-text: #ffffff;
    --ext-num:     #0891b2;

    --success:     #059669;
    --danger:      #dc2626;
    --warning:     #d97706;
    --info:        #0284c7;

    --shadow:      0 10px 30px rgba(15, 23, 42, 0.12);
}

/* --- 2. Reset y base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

/* --- 3. Fondo: grid con máscara radial --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
    background-size: 4rem 4rem;
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 0%, #000 60%, transparent 100%);
    mask-image: radial-gradient(ellipse 60% 50% at 50% 0%, #000 60%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 15% 20%, var(--halo-cian) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 85% 80%, var(--halo-violeta) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

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

/* --- 4. Texto con gradiente --- */
.gradient-text {
    background: linear-gradient(135deg, #00f2fe 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.gradient-text-animated {
    background: linear-gradient(135deg, #00f2fe 0%, #8b5cf6 35%, #ec4899 65%, #00f2fe 100%);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: text-gradient-shift 6s ease infinite;
}
@keyframes text-gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- 5. Sidebar --- */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 900;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo .s-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 11px;
    padding: 2px;
    box-shadow: 0 0 18px rgba(0, 242, 254, 0.25);
    flex-shrink: 0;
}
.sidebar-logo .s-icon i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--bg);
    border-radius: 9px;
    color: var(--accent);
    font-size: 15px;
}

.sidebar-logo .s-text { min-width: 0; }
.sidebar-logo .s-text h2 {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-logo .s-text p {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Botón colapsar (desktop) */
.sidebar-collapse-btn {
    display: none;
    position: absolute;
    top: 26px;
    right: 14px;
    width: 24px; height: 24px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 10;
}
.sidebar-collapse-btn:hover {
    color: var(--fg-strong);
    border-color: rgba(0, 242, 254, 0.4);
}
.sidebar-collapse-btn i { transition: transform 0.3s; }
body.sidebar-collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }

.sidebar-nav {
    flex: 1;
    padding: 18px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-nav .nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--muted);
    padding: 6px 14px 8px;
    font-weight: 700;
    opacity: 0.7;
    white-space: nowrap;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 11px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid transparent;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.sidebar-nav a i {
    width: 18px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.sidebar-nav a:hover i { transform: scale(1.08); }

.sidebar-nav a:hover {
    background: var(--surface-hover);
    color: var(--fg-strong);
}

.sidebar-nav a.active {
    background: linear-gradient(to right, rgba(0, 242, 254, 0.12), rgba(139, 92, 246, 0.06));
    color: var(--fg-strong);
    border-color: var(--border-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}
.sidebar-nav a.active i { color: var(--accent); }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-footer .sf-total {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
    font-weight: 700;
    color: var(--fg-strong);
    line-height: 1;
}
.sidebar-footer .sf-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* --- Sidebar colapsada (desktop) --- */
body.sidebar-collapsed { --sidebar-w: 80px; }
body.sidebar-collapsed .sidebar-logo { padding: 22px 0; justify-content: center; }
body.sidebar-collapsed .sidebar-logo .s-text,
body.sidebar-collapsed .sidebar-nav .nav-label,
body.sidebar-collapsed .sidebar-nav a span,
body.sidebar-collapsed .sidebar-footer .sf-text { display: none; }
body.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 12px 0; }
body.sidebar-collapsed .sidebar-footer { text-align: center; }
body.sidebar-collapsed .sidebar-footer .sf-label { display: none; }
body.sidebar-collapsed .sidebar-footer .logout-link span { display: none; }

/* Overlay para sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 899;
}
body.sidebar-open .sidebar { transform: translateX(0); }
body.sidebar-open .sidebar-overlay { display: block; }

/* Hamburger */
.hamburger {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 950;
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-2);
    color: var(--fg-strong);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.hamburger:hover { background: var(--surface-hover); }

/* --- 6. Dock móvil inferior --- */
.mobile-dock {
    display: none;
    position: fixed;
    bottom: 14px;
    left: 14px;
    right: 14px;
    height: 60px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-2);
    border-radius: 18px;
    box-shadow: var(--shadow);
    z-index: 940;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
}
.mobile-dock a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 52px; height: 48px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    transition: all 0.15s;
}
.mobile-dock a i { font-size: 17px; }
.mobile-dock a:hover,
.mobile-dock a.active { color: var(--accent); transform: scale(1.06); }
.mobile-dock a.active i { filter: drop-shadow(0 0 8px var(--accent)); }

/* --- 7. Contenido principal --- */
.main-content {
    margin-left: var(--sidebar-w);
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 0 0 60px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 8. Topbar (header fijo) --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 34px;
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.topbar-title {
    min-width: 0;
}
.topbar-title h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--fg-strong);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-title p {
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- 8b. Stats grid inside topbar --- */
.topbar .stats-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    flex: 1;
    justify-content: center;
}
.topbar .stat-card {
    padding: 6px 12px;
    min-width: 110px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.topbar .stat-card .stat-label {
    font-size: 8px;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.topbar .stat-card .stat-value {
    font-size: 18px;
    font-weight: 700;
}
.topbar .stat-card .stat-icon {
    font-size: 11px;
    top: 6px;
    right: 8px;
    opacity: 0.2;
}

@media (max-width: 1200px) {
    .topbar .stats-grid {
        width: 100%;
        order: 3;
        margin-top: 10px;
        justify-content: space-around;
    }
}
@media (max-width: 768px) {
    .topbar .stat-card {
        min-width: 80px;
        padding: 4px 8px;
    }
    .topbar .stat-card .stat-value {
        font-size: 14px;
    }
    .topbar .stat-card .stat-label {
        font-size: 7px;
    }
    .topbar .stat-card .stat-icon {
        display: none;
    }
}

/* Botones cuadrados de icono (tema + logout) */
.icon-btn {
    width: 40px; height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-size: 15px;
}
.icon-btn:hover {
    color: var(--fg-strong);
    border-color: var(--border-2);
    background: rgba(255, 255, 255, 0.08);
}
.icon-btn.logout:hover {
    color: var(--danger);
    border-color: rgba(255, 77, 106, 0.35);
    background: rgba(255, 77, 106, 0.1);
}
/* En tema claro el hover blanco no aplica */
[data-theme="light"] .icon-btn:hover { background: rgba(15, 23, 42, 0.06); }

/* Theme toggle dentro del topbar (mismo tamaño que icon-btn) */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--muted);
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s;
}
.theme-toggle:hover {
    color: var(--fg-strong);
    border-color: var(--accent);
    background: rgba(0, 242, 254, 0.06);
}
.topbar .theme-toggle {
    margin-top: 0;
    padding: 0;
    width: 40px;
    height: 40px;
}

/* El theme-toggle muestra sol/luna según tema (definido más abajo también) */
.theme-toggle .fa-sun { display: none; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }
[data-theme="light"] .theme-toggle .fa-sun  { display: inline-block; color: var(--warning); }

/* Contenedor del contenido principal debajo del topbar */
.main-inner {
    padding: 28px 34px 0;
}

/* --- 9. Stat cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: default;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, var(--surface-hover));
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--border-2);
}
.stat-card .stat-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 6px;
}
.stat-card .stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}
.stat-card .stat-icon {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 20px;
    opacity: 0.25;
}

.sc-total .stat-value       { color: var(--fg-strong); }
.sc-activas .stat-value     { color: var(--success); }
.sc-inactivas .stat-value   { color: var(--danger); }
.sc-reparacion .stat-value  { color: var(--warning); }
.sc-sin-asignar .stat-value { color: var(--muted); }

/* --- 10. Barra de herramientas --- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}
.search-box i {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
}
.search-box input {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 12px 14px 12px 42px;
    color: var(--fg-strong);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15);
}
.filter-select {
    background-color: var(--card-solid);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 12px 38px 12px 14px;
    color: var(--fg-strong);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237a85a8' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6 6.5-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--accent); }

/* --- Options de los <select>: forzar fondo oscuro + texto claro (evita el fondo blanco nativo) --- */
select,
option {
    background-color: var(--card-solid);
    color: var(--fg-strong);
}
/* Resaltado de la opción bajo el cursor */
option:checked,
option:hover {
    background-color: rgba(0, 242, 254, 0.18);
    color: #ffffff;
}

/* --- 11. Botones --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 11px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s, border-color 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--accent-text);
    box-shadow: 0 4px 18px rgba(0, 242, 254, 0.28);
}
.btn-primary:hover {
    box-shadow: 0 6px 26px rgba(0, 242, 254, 0.4);
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border-2);
}
.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--fg-strong);
    border-color: var(--muted);
}
.btn-sm { padding: 8px 14px; font-size: 12px; border-radius: 9px; }
.btn-edit {
    background: rgba(56, 189, 248, 0.1);
    color: var(--info);
    border: 1px solid rgba(56, 189, 248, 0.22);
}
.btn-edit:hover { background: rgba(56, 189, 248, 0.2); }
.btn-delete {
    background: rgba(255, 77, 106, 0.1);
    color: var(--danger);
    border: 1px solid rgba(255, 77, 106, 0.22);
}
.btn-delete:hover { background: rgba(255, 77, 106, 0.2); }

/* --- 12. Tabla --- */
.table-container {
    background: var(--card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    background: var(--surface-hover);
    padding: 14px 18px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
thead th.sortable {
    padding: 0;
}
thead th.sortable a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: inherit;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}
thead th.sortable a:hover {
    color: var(--accent);
    background-color: rgba(0, 242, 254, 0.05);
}
thead th.sortable .sort-active {
    color: var(--accent);
}
thead th.sortable .sort-muted {
    opacity: 0.35;
    transition: opacity 0.15s;
}
thead th.sortable a:hover .sort-muted {
    opacity: 0.8;
}
tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(0, 242, 254, 0.04); }
tbody td { padding: 14px 18px; vertical-align: middle; }

.ext-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    color: var(--ext-num);
}
.ext-num.clickable {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 4px;
    transition: color 0.15s, text-shadow 0.15s;
}
.ext-num.clickable:hover {
    color: var(--accent2);
    text-shadow: 0 0 8px rgba(124, 58, 237, 0.2);
}
.ext-ubicacion { color: var(--fg); max-width: 220px; }
.ext-asignado { color: var(--fg); font-weight: 500; max-width: 200px; }
.ext-asignado.empty { color: var(--muted); font-style: italic; font-weight: 400; }
.ext-notas {
    color: var(--muted);
    font-size: 13px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ext-fecha {
    color: var(--muted);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}
.acciones { display: flex; gap: 6px; }

/* Estatus badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
}
.badge-activo       { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.28); }
.badge-inactivo     { background: rgba(255, 77, 106, 0.12); color: #fda4af; border-color: rgba(255, 77, 106, 0.28); }
.badge-reparacion   { background: rgba(255, 176, 32, 0.12); color: #fcd34d; border-color: rgba(255, 176, 32, 0.28); }
.badge-sin-asignar  { background: rgba(122, 133, 168, 0.12); color: #94a3b8; border-color: rgba(122, 133, 168, 0.28); }

/* --- 13. Paginación --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pg-btn {
    padding: 8px 14px;
    border-radius: 9px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
}
.pg-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--fg-strong);
    border-color: var(--muted);
}
.pg-btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #0a0f1a;
    border-color: transparent;
    font-weight: 700;
}
.pg-btn.disabled { opacity: 0.3; pointer-events: none; }
.pg-info { color: var(--muted); font-size: 13px; margin: 0 8px; }

/* --- 14. Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s;
}
.modal-overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.modal-box {
    background: var(--card-solid);
    border: 1px solid var(--border-2);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease-out;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 0;
}
.modal-header h2 { font-size: 20px; font-weight: 800; color: var(--fg-strong); }
.modal-close {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.modal-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.modal-body { padding: 24px 28px 28px; }

/* --- 14b. Detalles de Extensión en el Modal --- */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}
.details-item {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s;
}
.details-item:hover {
    border-color: var(--border-2);
    background: var(--card2);
}
.details-item.full-width {
    grid-column: span 2;
}
.details-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.details-label i {
    color: var(--accent);
    font-size: 12px;
}
.details-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg-strong);
    word-break: break-word;
}

/* --- 15. Formulario --- */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin-bottom: 7px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--fg-strong);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15);
}

/* El select del modal también usa fondo sólido para que las options se vean bien */
.form-group select {
    background-color: var(--card-solid);
    cursor: pointer;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--placeholder); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* --- 16. Toast --- */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 10px;
    backdrop-filter: blur(10px);
}
.toast.exito {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #a7f3d0;
}
.toast.error {
    background: rgba(255, 77, 106, 0.15);
    border: 1px solid rgba(255, 77, 106, 0.35);
    color: #fda4af;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- 17. Estado vacío --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--fg-strong); opacity: 0.7; }
.empty-state p { font-size: 14px; }

/* --- 18. Confirmación de eliminación --- */
.confirm-body { text-align: center; padding: 20px 0; }
.confirm-body .warn-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255, 77, 106, 0.1);
    border: 2px solid rgba(255, 77, 106, 0.3);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px;
    color: var(--danger);
    margin-bottom: 16px;
}
.confirm-body p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.confirm-body .ext-name {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 22px;
    color: var(--fg-strong);
}
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }

/* --- 19. Páginas internas (csv) --- */
.csv-card { background: var(--card); backdrop-filter: blur(10px); }

/* --- 19b. Overrides del TEMA CLARO --- */
/* Colores claros (ej. #6ee7b7) no son legibles sobre blanco; aquí los oscurecemos */
[data-theme="light"] .badge-activo      { background: rgba(16, 185, 129, 0.14);  color: #047857; border-color: rgba(16, 185, 129, 0.32); }
[data-theme="light"] .badge-inactivo    { background: rgba(220, 38, 38, 0.10);   color: #b91c1c; border-color: rgba(220, 38, 38, 0.28); }
[data-theme="light"] .badge-reparacion  { background: rgba(217, 119, 6, 0.12);   color: #92400e; border-color: rgba(217, 119, 6, 0.30); }
[data-theme="light"] .badge-sin-asignar { background: rgba(100, 116, 139, 0.12); color: #475569; border-color: rgba(100, 116, 139, 0.28); }

[data-theme="light"] .sc-total .stat-value       { color: var(--fg-strong); }
[data-theme="light"] .sc-activas .stat-value     { color: #059669; }
[data-theme="light"] .sc-inactivas .stat-value   { color: #dc2626; }
[data-theme="light"] .sc-reparacion .stat-value  { color: #d97706; }
[data-theme="light"] .sc-sin-asignar .stat-value { color: #64748b; }

[data-theme="light"] .btn-edit   { background: rgba(2, 132, 199, 0.10);  color: #0284c7; border-color: rgba(2, 132, 199, 0.26); }
[data-theme="light"] .btn-edit:hover { background: rgba(2, 132, 199, 0.18); }
[data-theme="light"] .btn-delete { background: rgba(220, 38, 38, 0.10);   color: #dc2626; border-color: rgba(220, 38, 38, 0.26); }
[data-theme="light"] .btn-delete:hover { background: rgba(220, 38, 38, 0.18); }

[data-theme="light"] .toast.exito { background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.35); color: #047857; }
[data-theme="light"] .toast.error { background: rgba(220, 38, 38, 0.14);  border-color: rgba(220, 38, 38, 0.35); color: #b91c1c; }

/* Sombra del glow cian demasiado fuerte en claro: atenuar */
[data-theme="light"] .sidebar-nav a.active::before { box-shadow: 0 0 6px rgba(8, 145, 178, 0.5); }
[data-theme="light"] .btn-primary { box-shadow: 0 4px 14px rgba(8, 145, 178, 0.25); }
[data-theme="light"] .btn-primary:hover { box-shadow: 0 6px 22px rgba(8, 145, 178, 0.35); }

/* --- 20. Responsive --- */
@media (max-width: 1024px) {
    body { --sidebar-w: 80px; }
    body.sidebar-open { --sidebar-w: 260px !important; }
    body:not(.sidebar-open) .sidebar-logo .s-text,
    body:not(.sidebar-open) .sidebar-nav .nav-label,
    body:not(.sidebar-open) .sidebar-nav a span,
    body:not(.sidebar-open) .sidebar-footer .sf-text,
    body:not(.sidebar-open) .sidebar-footer .sf-label { display: none; }
    body:not(.sidebar-open) .sidebar-logo { justify-content: center; padding: 22px 0; }
    body:not(.sidebar-open) .sidebar-nav a { justify-content: center; padding: 12px 0; }
    body:not(.sidebar-open) .sidebar-footer { text-align: center; }
    body:not(.sidebar-open) .sidebar-footer .logout-link span { display: none; }
    .sidebar-collapse-btn { display: none !important; }
}

@media (min-width: 1025px) {
    .sidebar-collapse-btn { display: flex; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-collapsed { --sidebar-w: 0; }
    .main-content { margin-left: 0; }
    .hamburger { display: flex; }
    .mobile-dock { display: flex; }
    .topbar { padding: 14px 18px; padding-top: 64px; }
    .topbar-title h1 { font-size: 18px; }
    .topbar-title p { font-size: 11px; }
    .main-inner { padding: 20px 18px 0; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: unset; }
    .form-row { grid-template-columns: 1fr; }
    .modal-box { border-radius: 16px; }
    .modal-header, .modal-body { padding-left: 20px; padding-right: 20px; }

    /* --- Conversión de Tabla a Tarjetas en Móviles --- */
    .table-container {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
    }
    .table-scroll {
        overflow: visible !important;
    }
    table {
        display: block !important;
        width: 100% !important;
    }
    table thead {
        display: none !important;
    }
    table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
        width: 100% !important;
    }
    table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        background: var(--card) !important;
        border: 1px solid var(--border-2) !important;
        border-radius: 16px !important;
        padding: 16px !important;
        box-shadow: var(--shadow) !important;
        gap: 12px !important;
        position: relative !important;
        transition: transform 0.2s, box-shadow 0.2s !important;
    }
    table tbody tr:hover {
        background: var(--card) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15) !important;
    }
    table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        width: 100% !important;
        white-space: normal !important;
    }
    table tbody td::before {
        content: attr(data-label) !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: var(--muted) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        text-align: left !important;
    }
    
    /* Soporte para estados vacíos de la tabla */
    table tbody td[colspan] {
        display: block !important;
        text-align: center !important;
        padding: 40px 20px !important;
        background: var(--card) !important;
        border: 1px solid var(--border-2) !important;
        border-radius: 16px !important;
    }
    table tbody td[colspan]::before {
        display: none !important;
    }

    /* Diseño especial para la columna de Extensión (Cabecera de la tarjeta) */
    table tbody td[data-label="Extensión"] {
        justify-content: space-between !important;
        border-bottom: 1px solid var(--border) !important;
        padding-bottom: 10px !important;
        margin-bottom: 6px !important;
    }
    table tbody td[data-label="Extensión"]::before {
        content: "Extensión" !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: var(--muted) !important;
    }
    table tbody td[data-label="Extensión"] .ext-num {
        font-size: 18px !important;
    }

    /* Ocultar el label para la columna de Acciones en móviles */
    table tbody td[data-label="Acciones"] {
        border-top: 1px solid var(--border) !important;
        padding-top: 10px !important;
        margin-top: 6px !important;
        justify-content: flex-end !important;
    }
    table tbody td[data-label="Acciones"]::before {
        display: none !important;
    }
    table tbody td[data-label="Acciones"] .acciones {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        width: auto !important;
        justify-content: flex-end !important;
    }
    table tbody td[data-label="Acciones"] .btn-sm {
        width: auto !important;
        justify-content: center !important;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px 16px; }
    .stat-card .stat-value { font-size: 24px; }
    .main-inner { padding: 16px 12px 0; }
    .topbar-title p { display: none; }
    .topbar { padding: 12px 14px; padding-top: 60px; }
    .acciones { flex-direction: column; }
    .btn-sm { width: 100%; justify-content: center; }
    .mobile-dock { left: 10px; right: 10px; height: 56px; }
    .mobile-dock a { width: 46px; }
}

/* ============================================
   21. ESTILOS DE IMPRESIÓN
   ============================================ */
@media print {
    .sidebar, .sidebar-overlay, .hamburger, .toolbar, .pagination,
    .modal-overlay, .toast, .acciones, .btn, .topbar .btn,
    .mobile-dock { display: none !important; }

    body { background: #fff !important; color: #1a1a2e !important; }
    body::before, body::after { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }

    .topbar { border-bottom: 2px solid #1a1a2e !important; padding: 12px 0 !important; margin-bottom: 16px !important; background: none !important; backdrop-filter: none !important; }
    .topbar-title h1 { font-size: 18px !important; color: #1a1a2e !important; }
    .topbar-title p { color: #666 !important; font-size: 11px !important; }

    .stats-grid {
        display: flex !important;
        gap: 24px !important;
        margin-bottom: 16px !important;
        padding-bottom: 12px !important;
        border-bottom: 1px solid #ddd !important;
    }
    .stat-card { background: none !important; border: none !important; padding: 0 !important; box-shadow: none !important; transform: none !important; backdrop-filter: none !important; }
    .stat-card::before { display: none !important; }
    .stat-card .stat-icon { display: none !important; }
    .stat-card .stat-label { font-size: 8px !important; color: #888 !important; }
    .stat-card .stat-value { font-size: 16px !important; }
    .sc-total .stat-value { color: #1a1a2e !important; }
    .sc-activas .stat-value { color: #065f46 !important; }
    .sc-inactivas .stat-value { color: #991b1b !important; }
    .sc-reparacion .stat-value { color: #92400e !important; }
    .sc-sin-asignar .stat-value { color: #475569 !important; }

    .table-container { border: 1px solid #ccc !important; border-radius: 0 !important; box-shadow: none !important; backdrop-filter: none !important; background: #fff !important; }
    table { font-size: 10px !important; }
    thead th {
        background: #1a1a2e !important; color: #fff !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
        padding: 8px 10px !important; font-size: 8px !important;
    }
    tbody tr { border-bottom: 1px solid #e5e5e5 !important; }
    tbody tr:nth-child(even) { background: #f8f9fb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    tbody td { padding: 7px 10px !important; }
    .ext-num { color: #047857 !important; font-size: 12px !important; }
    .badge { border: none !important; padding: 2px 8px !important; font-size: 9px !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .badge-activo       { background: #d1fae5 !important; color: #065f46 !important; }
    .badge-inactivo     { background: #fee2e2 !important; color: #991b1b !important; }
    .badge-reparacion   { background: #fef3c7 !important; color: #92400e !important; }
    .badge-sin-asignar  { background: #f1f5f9 !important; color: #475569 !important; }
    .ext-fecha { font-size: 9px !important; color: #999 !important; }
    .ext-notas { color: #666 !important; font-size: 10px !important; }
    tr { page-break-inside: avoid; }
    thead { display: table-header-group; }
    .topbar { page-break-after: avoid; }
    .stats-grid { page-break-after: avoid; }
}
