/* ============================================================
   AIR-IOT — Design System v2.0
   Sistema de colores: Paleta oficial SENA
   Tipografía: Work Sans (font-sena) + Calibri/Inter (font-senaBody)
   ============================================================ */
:root {
    /* ── Colores SENA (paleta oficial) ── */
    --sena-primary:        #39A900;   /* Verde SENA principal */
    --sena-primary-dark:   #007832;   /* Verde oscuro */
    --sena-secondary-dark: #00304D;   /* Azul marino corporativo */
    --sena-purple:         #71277A;   /* Púrpura SENA */
    --sena-yellow:         #FDC300;   /* Amarillo SENA */
    --sena-light-blue:     #50E5F9;   /* Azul claro SENA */
    --sena-white:          #FFFFFF;
    --sena-gray:           #F6F6F6;
    --sena-black:          #000000;
    --dark-bg:             #121212;
    --dark-surface:        #1E1E1E;

    /* ── Aliases funcionales (mapean a paleta SENA) ── */
    --bg:           #0d1b2a;          /* Fondo oscuro principal */
    --bg-card:      #112240;          /* Superficies de cards */
    --bg-sidebar:   #081627;          /* Sidebar */
    --bg-input:     #0d1b2a;          /* Inputs */
    --border:       rgba(0, 48, 77, 0.6);  /* Bordes — sena-secondary-dark */
    --text:         #e2e8f0;
    --text-dim:     #94a3b8;
    --text-muted:   #64748b;

    /* ── Verde SENA como color primario del sistema ── */
    --primary:       #39A900;
    --primary-glow:  rgba(57, 169, 0, 0.25);
    --primary-dark:  #007832;
    --green:         #39A900;
    --green-glow:    rgba(57, 169, 0, 0.22);

    /* ── Semánticos estándar (Tailwind-compatible) ── */
    --red:           #ef4444;   /* error / peligro */
    --red-glow:      rgba(239, 68, 68, 0.22);
    --orange:        #f97316;   /* advertencia suave */
    --indigo:        #818cf8;   /* info / programado */
    --yellow:        #FDC300;   /* sena-yellow = advertencia */

    /* ── Escala de texto extendida (estandarizada) ── */
    --text-bright:   #f1f5f9;   /* títulos / valores destacados */
    --text-soft:     #cbd5e1;   /* texto secundario claro */
    --text-subtle:   #475569;   /* texto tenue sobre superficies */

    /* ── Escala semántica extendida (estandarizada) ── */
    --success:       #22c55e;   /* verde éxito (más brillante que primary) */
    --green-light:   #4ade80;   /* verde claro / activo */
    --green-bright:  #44c200;   /* verde brillante (hover de botones) */
    --sena-purple-dark: #5b1c63; /* púrpura oscuro (gradiente mantenimiento) */
    --amber:         #f59e0b;   /* ámbar / advertencia fuerte */
    --red-light:     #f87171;   /* rojo claro */
    --red-dark:      #b91c1c;   /* rojo intenso */
    --blue:          #60a5fa;   /* info azul */
    --blue-strong:   #3b82f6;   /* info azul intenso */
    --purple:        #a855f7;   /* púrpura claro */

    /* ── Tipografía (estandarizada) ── */
    --font-sans: 'Work Sans', 'Inter', system-ui, sans-serif;  /* UI + títulos */
    --font-mono: 'Courier New', monospace;                     /* datos/IDs monoespaciados */

    /* ── Forma y movimiento ── */
    --radius:    16px;
    --radius-sm: 10px;
    --shadow:    0 4px 24px rgba(0, 0, 0, 0.35);
    --tr:        0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Layout ── */
    --sidebar-w: 280px;

    /* ── Señal WiFi ── */
    --sig-excellent: #22c55e;
    --sig-good:      #84cc16;
    --sig-fair:      #FDC300;   /* sena-yellow */
    --sig-poor:      #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* font-senaBody: Calibri con fallback Inter para entorno web */
    font-family: var(--font-sans);
    background: radial-gradient(ellipse at top right, #112240, #081627);
    background-attachment: fixed;
    color: var(--text);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Tipografía SENA: clases de fuente reutilizables ── */
.font-sena     { font-family: var(--font-sans); }
.font-senaBody { font-family: var(--font-sans); }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    /* Sidebar usa sena-secondary-dark como base de fondo */
    background: linear-gradient(180deg, #081627 0%, #041020 100%);
    border-right: 1px solid rgba(0, 48, 77, 0.5);
    display: flex;
    flex-direction: column;
    padding: 32px 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    box-shadow: 10px 0 60px rgba(0, 0, 0, 0.5),
                inset -1px 0 0 rgba(57, 169, 0, 0.08);
    transition: transform var(--tr);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--tr);
}

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

.sidebar-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin-bottom: 40px;
    min-height: 80px;
}

.brand-logo-main {
    width: 100%;
    max-width: 175px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
    transition: var(--tr);
}

.brand-logo-main:hover {
    transform: scale(1.04);
}

/* Logo Tecnoparque SENA — parte inferior del sidebar (centrado) */
.sidebar-tecnoparque {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
}

.tecnoparque-logo {
    height: 40px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
    opacity: 0.9;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
    transition: var(--tr);
}

.tecnoparque-logo:hover {
    opacity: 1;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--tr);
    font-family: inherit;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    transform: translateX(8px);
}

.nav-btn.active {
    /* Acento verde SENA (#39A900) con borde derecho destacado */
    background: linear-gradient(90deg, rgba(57, 169, 0, 0.18), transparent);
    color: var(--sena-primary);
    border-right: 4px solid var(--sena-primary);
    font-family: var(--font-sans);
    font-weight: 700;
}

/* Glassmorphism touch to cards */
.aer-card {
    backdrop-filter: blur(10px);
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.device-info-bar {
    backdrop-filter: blur(8px);
    background: rgba(30, 41, 59, 0.6);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    /* Gradiente verde SENA para el avatar del usuario en sidebar */
    background: linear-gradient(135deg, var(--sena-primary), var(--sena-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: var(--sena-white);
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(57, 169, 0, 0.35);
}

.user-name {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--sena-white);
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== MAIN ===== */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 40px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    width: calc(100vw - var(--sidebar-w));
    min-width: 0;
    transition: margin var(--tr);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    width: 100%;
    max-width: 1200px;
    gap: 16px;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--sena-white);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--tr);
}

.header h1 {
    /* font-sena: Work Sans — color sólido estandarizado */
    font-family: var(--font-sans);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.8px;
    color: var(--text-bright);
}

.subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.clock-badge {
    text-transform: none;
    letter-spacing: normal;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.clock-badge i {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

.clock-badge .tz-label {
    padding-left: 8px;
    margin-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.connection-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 30px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    backdrop-filter: blur(10px);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.connection-badge .broker-icon {
    display: inline-flex;
    align-items: center;
    color: var(--red);
    filter: drop-shadow(0 0 6px var(--red-glow));
    transition: var(--tr);
}

.connection-badge .broker-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.connection-badge.connected .broker-icon {
    color: var(--green);
    filter: drop-shadow(0 0 8px var(--green-glow));
}

/* ===== DEVICE INFO BAR ===== */
.device-info-bar {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding: 0;
    background: linear-gradient(135deg,
            rgba(17, 34, 64, 0.92),
            rgba(8, 22, 39, 0.85));
    /* Acento borde izquierdo con --sena-primary */
    border: 1px solid rgba(57, 169, 0, 0.2);
    border-left: 4px solid var(--sena-primary);
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 0 1px rgba(57, 169, 0, 0.05) inset;
    overflow: hidden;
}

.dinfo {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 150px;
    padding: 20px 22px;
    border-radius: 0;
    transition: var(--tr);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.dinfo:last-child {
    border-right: none;
}

.dinfo:hover {
    background: rgba(255, 255, 255, 0.04);
}

.dinfo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    /* Usa --sena-primary para iconos de info device */
    background: rgba(57, 169, 0, 0.12);
    border: 1px solid rgba(57, 169, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.dinfo-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    margin-bottom: 4px;
}

.dinfo-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* RSSI Signal Badges */
.rssi-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.5px;
}

.rssi-excellent { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: var(--sig-excellent); }
.rssi-good { background: rgba(132, 204, 22, 0.1); border: 1px solid rgba(132, 204, 22, 0.3); color: var(--sig-good); }
.rssi-fair { background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); color: var(--sig-fair); }
.rssi-poor { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--sig-poor); }

/* Horizontal Signal Gauge */
.signal-gauge {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 14px;
    margin-right: 5px;
}

.sig-bar {
    width: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 2px;
    transition: all 0.5s ease;
}

.sig-bar--1 { height: 25%; }
.sig-bar--2 { height: 50%; }
.sig-bar--3 { height: 75%; }
.sig-bar--4 { height: 100%; }

.signal-gauge.level-1 .sig-bar--1 { background: var(--sig-poor); box-shadow: 0 0 8px var(--sig-poor); }
.signal-gauge.level-2 .sig-bar--1, .signal-gauge.level-2 .sig-bar--2 { background: var(--sig-fair); box-shadow: 0 0 8px var(--sig-fair); }
.signal-gauge.level-3 .sig-bar--1, .signal-gauge.level-3 .sig-bar--2, .signal-gauge.level-3 .sig-bar--3 { background: var(--sig-good); box-shadow: 0 0 8px var(--sig-good); }
.signal-gauge.level-4 .sig-bar--1, .signal-gauge.level-4 .sig-bar--2, .signal-gauge.level-4 .sig-bar--3, .signal-gauge.level-4 .sig-bar--4 { background: var(--sig-excellent); box-shadow: 0 0 8px var(--sig-excellent); }

/* ===== TABS ===== */
.tab-content {
    display: none;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn .3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.tab-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: var(--tr);
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-status {
    background: var(--bg-card);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-primary {
    background: linear-gradient(135deg, var(--sena-primary), var(--sena-primary-dark));
    color: var(--sena-white);
    box-shadow: 0 4px 14px rgba(57, 169, 0, 0.28);
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--green-bright), var(--sena-primary));
    box-shadow: 0 6px 20px rgba(57, 169, 0, 0.4);
}

.btn-full {
    width: 100%;
    padding: 13px;
    font-size: 14px;
    margin-top: 8px;
}

.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.quick-actions .btn {
    padding: 12px 28px;
    font-size: 13px;
    letter-spacing: 0.04em;
    border-radius: 12px;
    font-weight: 800;
}

/* btn-both-on: verde SENA #39A900 + #007832 */
.btn-both-on {
    background: linear-gradient(135deg, var(--sena-primary), var(--sena-primary-dark));
    color: var(--sena-white);
    box-shadow: 0 4px 20px rgba(57, 169, 0, 0.35);
    border: none;
    font-family: var(--font-sans);
    letter-spacing: 0.04em;
}

.btn-both-on:hover {
    background: linear-gradient(135deg, var(--green-bright), var(--sena-primary));
    box-shadow: 0 6px 28px rgba(57, 169, 0, 0.55);
    transform: translateY(-2px);
}

/* btn-panic: rojo semántico Tailwind */
.btn-panic {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: var(--sena-white);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35);
    border: none;
    font-family: var(--font-sans);
    letter-spacing: 0.04em;
}

.btn-panic:hover {
    box-shadow: 0 6px 28px rgba(239, 68, 68, 0.55);
    transform: translateY(-2px);
}

/* btn-wifi-reset: usa sena-purple para diferenciación visual */
.btn-wifi-reset {
    background: linear-gradient(135deg, var(--sena-purple), var(--sena-purple-dark));
    color: var(--sena-white);
    box-shadow: 0 4px 18px rgba(113, 39, 122, 0.35);
    border: none;
    font-family: var(--font-sans);
    letter-spacing: 0.04em;
}

.btn-wifi-reset:hover {
    box-shadow: 0 6px 24px rgba(113, 39, 122, 0.5);
    transform: translateY(-2px);
}

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    margin-bottom: 32px;
    width: 100%;
}

.card-placeholder {
    grid-column: 1/-1;
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
}

.aer-card {
    backdrop-filter: blur(16px);
    background: linear-gradient(160deg,
            rgba(30, 41, 59, 0.85),
            rgba(15, 23, 42, 0.75));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px;
    padding: 28px 30px;
    transition: var(--tr);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.aer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
            transparent, rgba(57, 169, 53, 0.4), transparent);
    transition: var(--tr);
    opacity: 0;
}

.aer-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 255, 255, 0.13);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.aer-card:hover::before {
    opacity: 1;
}

.aer-card.active {
    border-color: rgba(57, 169, 0, 0.5);
    box-shadow: 0 0 0 1px rgba(57, 169, 0, 0.22),
        0 8px 32px rgba(57, 169, 0, 0.18);
}

.aer-card.active::before {
    opacity: 1;
    background: linear-gradient(90deg, var(--sena-primary), var(--sena-primary-dark), var(--sena-primary));
}

.aer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.aer-card-title {
    font-size: 17px;
    font-weight: 900;
}

.aer-card-topic {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.mode-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.mode-toggle button {
    flex: 1;
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--tr);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.mode-toggle button.active-mode {
    color: var(--sena-white);
}

.mode-toggle button.manual-active {
    background: var(--orange);
    color: var(--sena-white);
}

.mode-toggle button.prog-active {
    background: var(--indigo);
    color: var(--sena-white);
}

.fan-wrap {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.fan-svg {
    width: 68px;
    height: 68px;
    color: var(--text-muted);
    transition: color .3s;
}

.fan-svg.on {
    color: var(--green);
    filter: drop-shadow(0 0 12px var(--green-glow));
}

.fan-svg.on .fan-blades {
    animation: spin .8s linear infinite;
    transform-origin: 50% 50%;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fan-label {
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.fan-label.on {
    color: var(--green);
}

.fan-label.off {
    color: var(--text-muted);
}

/* SCHEDULE PREVIEW on card */
.card-schedules {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 12px 0 0;
}

.card-schedules-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--indigo);
    font-weight: 800;
    margin-bottom: 6px;
}

.card-sched-item {
    font-size: 11px;
    color: var(--text-dim);
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    justify-content: space-between;
}

.card-sched-item:last-child {
    border: none;
}

.card-sched-name {
    font-weight: 700;
}

.card-sched-time {
    color: var(--primary);
    font-weight: 600;
    font-size: 10px;
}

.no-sched {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.aer-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.btn-power {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--tr);
    font-family: inherit;
}

.btn-power.turn-on {
    background: linear-gradient(135deg, var(--sena-primary), var(--sena-primary-dark));
    color: var(--sena-white);
    box-shadow: 0 4px 18px rgba(57, 169, 53, 0.45);
}

.btn-power.turn-on:hover {
    box-shadow: 0 6px 24px rgba(57, 169, 53, 0.6);
    transform: translateY(-2px);
}

.btn-power.turn-off {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: var(--sena-white);
    box-shadow: 0 4px 18px rgba(239, 68, 68, 0.4);
}

.btn-power.turn-off:hover {
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.55);
    transform: translateY(-2px);
}

.btn-power:disabled {
    opacity: .3;
    cursor: not-allowed;
}

.aer-card-footer {
    text-align: center;
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ===== SECTION TITLE (dashboard labels) ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
    margin-top: 4px;
}

.section-title::before {
    content: '';
    display: block;
    width: 3px;
    height: 16px;
    border-radius: 2px;
    background: var(--primary);
    flex-shrink: 0;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

/* ===== RECENT LOGS WRAPPER ===== */
.logs-table-wrap {
    background: linear-gradient(160deg,
            rgba(30, 41, 59, 0.6),
            rgba(15, 23, 42, 0.5));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 8px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ===== STATISTICS ===== */
.stats-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

canvas {
    width: 100% !important;
    height: 300px !important;
}

/* ===== DISCONNECTION ALERT ===== */
.disconnection-alert {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    color: var(--sena-white);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    margin: 0 10px 24px;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    animation: pulse 2s infinite;
}

.disconnection-alert.show {
    display: flex;
    animation: slideIn 0.4s ease forwards, pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ===== TAB REFINEMENTS ===== */
.tab-content h2 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.tab-desc {
    margin-bottom: 32px;
    color: var(--text-muted);
}

/* History Tab Table */
.history-wrap {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* Settings Form */
.settings-form {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 32px;
    max-width: 600px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row label {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
}

.form-row input {
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--sena-white);
    outline: none;
    transition: var(--tr);
}

.form-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ===== SCHEDULES TAB ===== */
.schedules-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.schedules-header h2 {
    font-family: var(--font-sans);
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.5px;
    color: var(--text-bright);
}

.schedules-header .btn-primary {
    padding: 11px 22px;
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-sans);
    border-radius: 12px;
    /* Gradiente verde SENA para el botón primario de horarios */
    background: linear-gradient(135deg, var(--sena-primary), var(--sena-primary-dark));
    box-shadow: 0 4px 16px rgba(57, 169, 0, 0.32);
    letter-spacing: 0.03em;
}

/* Schedules grid container */
.schedules-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Group per aerator */
.sched-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sched-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg,
            rgba(17, 34, 64, 0.88),
            rgba(8, 22, 39, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.06);
    /* Acento izquierdo con verde SENA */
    border-left: 3px solid var(--sena-primary);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.sched-group-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-bright);
    flex: 1;
    letter-spacing: -0.2px;
}

/* Individual schedule card */
.sched-card {
    background: linear-gradient(160deg,
            rgba(30, 41, 59, 0.80),
            rgba(15, 23, 42, 0.70));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 18px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--tr);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    margin-left: 12px;
}

.sched-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(57, 169, 53, 0.5), transparent);
    opacity: 0;
    transition: var(--tr);
}

.sched-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.3);
}

.sched-card:hover::before {
    opacity: 1;
}

.sched-card.inactive {
    opacity: 0.42;
    filter: grayscale(0.6);
}

/* Card top row — name + time + action badge */
.sched-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sched-card-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-bright);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sched-card-time {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 5px 12px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.sched-arrow {
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
}

.sched-action-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sched-action-badge.action-on {
    background: rgba(57, 169, 53, 0.18);
    color: var(--green-light);
    border: 1px solid rgba(57, 169, 53, 0.3);
}

.sched-action-badge.action-off {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red-light);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Day chips row */
.sched-days-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.day-chip {
    font-size: 10px;
    font-weight: 800;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    text-transform: uppercase;
    border: 1px solid transparent;
    transition: var(--tr);
}

.day-chip.active {
    background: rgba(57, 169, 53, 0.18);
    color: var(--green-light);
    border-color: rgba(57, 169, 53, 0.35);
    box-shadow: 0 0 8px rgba(57, 169, 53, 0.2);
}

/* Card action buttons */
.sched-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-toggle {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--tr);
    font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.btn-toggle:hover {
    background: rgba(57, 169, 53, 0.15);
    border-color: rgba(57, 169, 53, 0.4);
    color: var(--green-light);
}

.btn-toggle.active {
    background: rgba(57, 169, 53, 0.18);
    border-color: rgba(57, 169, 53, 0.4);
    color: var(--green-light);
}

.btn-danger-sm {
    padding: 9px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: var(--red-light);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--tr);
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* ===== ACTIVITY FEED (History) ===== */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid var(--border);
}

.activity-item.on {
    border-left-color: var(--green);
}

.activity-item.off {
    border-left-color: var(--red);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.activity-details {
    flex: 1;
}

.activity-main {
    font-weight: 700;
    font-size: 14px;
    color: var(--sena-white);
}

.activity-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.activity-meta {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== STATS REFINEMENTS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-mini-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-mini-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-mini-value {
    font-size: 24px;
    font-weight: 900;
    color: var(--sena-white);
}

/* Dashboard refinements */
.quick-actions {
    background: rgba(255, 255, 255, 0.02);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 32px;
    border: 1px dashed var(--border);
}

/* ===== SECTION ===== */
.section-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 14px;
    color: var(--text-dim);
}

/* ===== LOGS TABLE ===== */
.logs-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.logs-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 16px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.logs-table td {
    padding: 12px 16px;
    font-size: 12px;
    border-top: 1px solid var(--border);
}

.logs-table tr:hover td {
    background: rgba(255, 255, 255, .02);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.badge.on {
    background: var(--green-glow);
    color: var(--green);
}

.badge.off {
    background: var(--red-glow);
    color: var(--red);
}

.badge.schedule {
    background: rgba(129, 140, 248, .15);
    color: var(--indigo);
}

.badge.manual {
    background: rgba(249, 115, 22, .15);
    color: var(--orange);
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--bg-card);
    border: 1px solid var(--green);
    color: var(--text);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(80px);
    opacity: 0;
    transition: var(--tr);
    box-shadow: var(--shadow);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 460px;
    position: relative;
    animation: slideUp .3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
}

.modal h3 {
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 20px;
}

.modal label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.modal input,
.modal select {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.days-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 14px;
}

.days-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.day-check input {
    display: none;
}

.day-check span {
    display: block;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
}

.day-check input:checked+span {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 240px;
    }
    
    .stats-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-w: 280px; /* Drawer width */
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 2000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
        padding: 24px 16px;
    }
    
    .hamburger {
        display: block;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .device-info-bar {
        flex-direction: column;
        border-left: none;
        border-top: 4px solid var(--primary);
    }
    
    .dinfo {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .modal-card {
        padding: 24px;
        width: 95%;
        border-radius: 20px;
    }
    
    .tab-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-filters {
        width: 100%;
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .stats-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 20px;
    }
    
    .btn {
        width: 100%;
    }
    
    .quick-actions {
        flex-direction: column;
    }
}

/* ===== PREMIUM MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.3s ease;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: scale(0.9);
    transition: var(--tr);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.modal-card h2 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 12px;
}

.modal-body-text {
    font-size: 15px;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 32px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== ADVANCED STATS ===== */
.tab-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 20px;
    flex-wrap: wrap;
}

.stats-filters {
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.stats-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--sena-white);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.stats-main-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

@media (max-width: 900px) {
    .stats-main-grid {
        grid-template-columns: 1fr;
    }
}

.modal-list {
    margin-top: 20px;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-list-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 4px;
}

.modal-list-item:last-child {
    border-bottom: none;
}

.modal-list-item.omitted {
    opacity: 0.5;
    color: var(--text-dim);
}

.modal-list-item small {
    opacity: 0.7;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================================
   NEW COMPONENTS – Advanced Control System
   =================================================== */

/* --- CONFIRM MODAL (Premium) --- */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirm-modal-overlay.active {
    display: flex;
    animation: fadeInModal 0.22s ease;
}

.confirm-modal-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 36px 32px 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
    animation: cmSlideUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

@keyframes cmSlideUp {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(24px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.confirm-modal-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
    line-height: 1;
}

.confirm-modal-icon.icon-green {
    filter: drop-shadow(0 0 12px #22c55e88);
}

.confirm-modal-icon.icon-red {
    filter: drop-shadow(0 0 12px #ef444488);
}

.confirm-modal-icon.icon-yellow {
    filter: drop-shadow(0 0 12px #f59e0b88);
}

.confirm-modal-icon.icon-blue {
    filter: drop-shadow(0 0 12px #3b82f688);
}

#confirmModalTitle {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 10px;
}

.confirm-modal-body {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: left;
}

.confirm-modal-body p {
    margin: 0 0 10px;
    color: var(--text-soft);
}

.confirm-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-bright);
}

.btn-danger {
    background: var(--red);
    color: var(--sena-white);
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--red-dark);
}

/* --- MODAL LIST (aerator breakdown) --- */
.modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.modal-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.88rem;
}

.modal-list-item.dimmed {
    opacity: 0.55;
}

.mli-icon {
    font-size: 1.1rem;
}

.mli-name {
    flex: 1;
    font-weight: 600;
    color: var(--text);
}

.mli-action {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--success);
}

.mli-action.skip-label {
    color: var(--amber);
}

/* --- DISABLED POWER BUTTON --- */
.btn-power:disabled,
.btn-power.btn-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(0.9);
    pointer-events: none;
}

/* --- PROG MODE OVERLAY MESSAGE --- */
.prog-overlay-msg {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    color: var(--amber);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    padding: 8px 12px;
    margin: 4px 0 8px;
}

/* --- CARD STATUS BADGES --- */
.badge-status {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.status-on {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-off {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-subtle);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* --- CARD SCHED ACTION --- */
.card-sched-action {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
}

.action-on {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.action-off {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
}

/* --- SCHEDULE GROUPS (per-aerator sections) --- */
.sched-group {
    margin-bottom: 24px;
}

.sched-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 12px;
}

.sched-group-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}

/* --- SCHEDULE CARD IMPROVEMENTS --- */
.sched-card {
    border-radius: 14px;
}

.sched-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sched-card-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.88rem;
    color: var(--text-dim);
    font-weight: 500;
}

.sched-arrow {
    color: var(--text-subtle);
    font-size: 0.8rem;
}

.sched-action-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.sched-days-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0 4px;
}

.day-chip {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-subtle);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.day-chip.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--blue);
    border-color: rgba(59, 130, 246, 0.35);
}

.sched-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-toggle {
    font-size: 0.8rem;
    padding: 6px 14px;
}

.btn-toggle.active {
    background: rgba(245, 158, 11, 0.15);
    color: var(--amber);
    border-color: rgba(245, 158, 11, 0.3);
}

.btn-danger-sm {
    font-size: 0.8rem;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.empty-state.small {
    font-size: 0.82rem;
    padding: 10px 12px;
}

/* ============================================================
   SETTINGS TAB — PREMIUM REDESIGN
   ============================================================ */

.settings-header {
    margin-bottom: 24px;
}

.settings-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-bright);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

/* Settings Card */
.settings-card {
    background: linear-gradient(165deg,
            rgba(32, 45, 72, 0.7),
            rgba(15, 23, 42, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px 36px;
    backdrop-filter: blur(20px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.settings-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(57, 169, 53, 0.03), transparent 70%);
    pointer-events: none;
    transition: var(--tr);
}

.settings-card:hover {
    border-color: rgba(57, 169, 53, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.settings-card:hover::after {
    background: radial-gradient(circle at center, rgba(57, 169, 53, 0.07), transparent 70%);
}

.settings-card--full {
    grid-column: 1 / -1;
}

/* Card Header (icon + title) */
.settings-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-card-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(135deg,
            rgba(57, 169, 53, 0.25),
            rgba(34, 197, 94, 0.1));
    border: 1px solid rgba(57, 169, 53, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.settings-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 3px;
}

.settings-card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Fila de acción de mantenimiento (info + botón) dentro de settings-card */
.maintenance-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(0, 48, 77, 0.45);
    border-radius: 14px;
    padding: 16px 18px;
}

.maintenance-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.maintenance-info strong {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 700;
}

.maintenance-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.maintenance-action .btn {
    flex-shrink: 0;
}

/* sform: the premium settings form */
.sform {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sform-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.sform-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sform-field--sm {
    max-width: 180px;
}

.sform-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sform-input {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: var(--text-bright);
    padding: 12px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--tr);
    outline: none;
    width: 100%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sform-input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 0 4px rgba(57, 169, 53, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.sform-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.sform-select option {
    background: #1e293b;
    color: var(--text);
}

.sform-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 4px;
}

.sform-btn {
    padding: 10px 28px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    letter-spacing: 0.02em;
}

/* Create panel (inside user mgmt card) */
.sform-create-panel {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.sform-panel-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}

/* Users table override */
.users-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.users-table-wrap .log-table td,
.users-table-wrap .log-table th {
    padding: 12px 18px;
}

.users-table-wrap .log-table tr:last-child td {
    border-bottom: none;
}

.users-table-wrap .log-table tbody tr {
    transition: background 0.15s;
}

.users-table-wrap .log-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}


/* ===== EQUIPMENT CONFIG PANELS ===== */
.equip-panel {
    padding: 20px 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.equip-panel:last-child {
    border-bottom: none;
}

.equip-topic {
    font-size: 10px;
    color: var(--primary);
    font-family: var(--font-mono);
    font-weight: 600;
    margin-left: 6px;
    opacity: 0.8;
}

.equip-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 4px 0 16px;
    padding: 8px 14px;
    background: rgba(57, 169, 53, 0.08);
    border: 1px solid rgba(57, 169, 53, 0.15);
    border-radius: 8px;
    letter-spacing: 0.02em;
}

.equip-hint strong {
    color: var(--primary);
}

/* --- LOG FEED (Dashboard recent activity) --- */
.log-feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
}

.log-feed-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.log-bar {
    width: 3px;
    height: 36px;
    border-radius: 2px;
}

.log-on .log-bar {
    background: var(--success);
}

.log-off .log-bar {
    background: var(--text-subtle);
}

.log-icon {
    font-size: 1.1rem;
}

.log-content {
    flex: 1;
}

.log-name {
    display: block;
    font-weight: 600;
    color: var(--text);
    font-size: 0.88rem;
}

.log-action {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.log-action small {
    margin-left: 6px;
    color: var(--text-subtle);
}

.log-time {
    font-size: 0.75rem;
    color: var(--text-subtle);
    white-space: nowrap;
}

/* --- LOG TABLE (History tab) --- */
.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.log-table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.log-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
}

.row-on td {
    color: var(--text-soft);
}

.row-off td {
    color: var(--text-muted);
}

.log-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.04em;
}

.badge-on {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
}

.badge-off {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-subtle);
}

/* --- STATS CHART CARDS --- */
.stats-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
}

/* Upgrade Chart Cards */
.chart-card {
    background: linear-gradient(165deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 28px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.chart-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 24px;
}

/* --- STATS FILTERS --- */
.tab-header-flex {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.stats-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stats-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text);
    padding: 7px 10px;
    font-size: 0.83rem;
    font-family: inherit;
}

.stats-input:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    border-color: transparent;
}

/* --- STATS GRID & PREMIUM CARDS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(165deg, rgba(30, 41, 59, 1), rgba(15, 23, 42, 1));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all var(--tr);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.03), transparent 70%);
    pointer-events: none;
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-info {
    display: flex;
    flex-direction: column;
}

.stat-card-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.stat-card-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--sena-white);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 4px;
    font-weight: 500;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--tr);
}

.stat-card:hover .stat-card-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Modifiers for Icons/Highlights */
.stat-card--energy .stat-card-icon {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(234, 179, 8, 0.05));
    color: var(--yellow);
}

.stat-card--volume .stat-card-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
    color: var(--blue-strong);
}

.stat-card--uptime .stat-card-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
    color: var(--success);
}

.stat-card--online .stat-card-icon {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(168, 85, 247, 0.05));
    color: var(--purple);
}

.stat-card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-trend {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
}

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

/* Filter Bar Refinement */
.stats-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.stats-main-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--sena-white);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.stats-filters {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

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

.filter-sep {
    color: var(--text-subtle);
    font-size: 0.8rem;
}

.btn-refresh {
    padding: 8px 18px;
    font-size: 0.85rem;
    border-radius: 10px;
}

/* Card Badge Logic (Cleanup) */
.stat-card--energy .stat-card-value {
    color: var(--yellow);
}

.stat-card--volume .stat-card-value {
    color: var(--blue);
}

.stat-card--uptime .stat-card-value {
    color: var(--green-light);
}

.stat-card--online .stat-card-value {
    color: var(--purple);
}

/* --- SCHEDULE MODAL (form) --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

/* --- Auth / Logout sidebar --- */
.logout-btn {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--red);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    line-height: 1;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.4);
    transform: scale(1.08);
}

/* Role badge variants */
.user-role.role-admin {
    color: var(--success) !important;
}

.user-role.role-usuario {
    color: var(--amber) !important;
}


/* --- INSIGHTS REFINED --- */
.insights-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom Scrollbar for Insights */
.insights-container::-webkit-scrollbar {
    width: 6px;
}

.insights-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.insights-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.insights-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.insight-item {
    display: flex;
    gap: 18px;
    padding: 20px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    transition: all var(--tr);
    position: relative;
}

.insight-item:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.insight-icon-container {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.insight-content {
    flex: 1;
}

.insight-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 6px;
}

.insight-desc {
    font-size: 0.88rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1.5;
}

.insight-main-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--sena-white);
    margin: 8px 0;
    letter-spacing: -0.02em;
}

.insight-main-value small {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.insight-sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.insight-sub-item {
    background: rgba(15, 23, 42, 0.3);
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.sub-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sub-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.insight-details-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
    background: rgba(15, 23, 42, 0.2);
    padding: 10px;
    border-radius: 12px;
}

.insight-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.insight-detail-row strong {
    color: var(--text-bright);
}

.insight-footer-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    margin-top: 8px;
}

.insight-status-pill {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--green-light);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.insight-status-pill.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue);
}

.insight-alert-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--yellow);
    line-height: 1.4;
}

.insight-item.success {
    border-left: 4px solid var(--success);
}

.insight-item.warning {
    border-left: 4px solid var(--amber);
}

.insight-item.info {
    border-left: 4px solid var(--blue-strong);
}

.insight-item.success .insight-icon-container {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.insight-item.warning .insight-icon-container {
    background: rgba(245, 158, 11, 0.1);
    color: var(--amber);
}

.insight-item.info .insight-icon-container {
    background: rgba(59, 130, 246, 0.1);
    color: var(--blue-strong);
}

/* ===== USER MANAGEMENT ENHANCEMENTS ===== */
.user-row-inactive {
    opacity: 0.5;
    filter: grayscale(0.8);
    background: rgba(0, 0, 0, 0.15) !important;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    vertical-align: middle;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-subtle);
    transition: .3s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

.btn-action-sm {
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-action-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sena-white);
    transform: translateY(-2px);
}

.btn-action-sm.blue:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue);
    border-color: rgba(59, 130, 246, 0.3);
}

.modal-icon-header {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-status-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-active {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green-light);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-light);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ===== REPORTS MODULE ===== */
.reports-container {
    display: flex;
    gap: 25px;
    height: calc(100vh - 160px);
    margin-top: 20px;
}

.reports-left {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
}

.reports-right {
    flex: 1;
    min-width: 0;
}

.reports-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.reports-header-ui {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.reports-header-ui h3 {
    font-size: 1.25rem;
    font-weight: 800;
}

.reports-header-ui p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.reports-filters {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.reports-selection-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    padding-right: 5px;
}

/* Custom scrollbar for list */
.reports-selection-list::-webkit-scrollbar { width: 5px; }
.reports-selection-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.report-item-card {
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--tr);
}

.report-item-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateX(4px);
}

.report-item-card.selected {
    border-color: var(--primary);
    background: rgba(57, 169, 53, 0.08);
}

.report-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.report-item-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.report-item-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.report-item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

/* Preview Section */
.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.preview-header {
    background: rgba(15, 23, 42, 0.6);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text-dim);
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-body {
    flex: 1;
    background: #0b1120;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-empty {
    text-align: center;
    padding: 40px;
}

.preview-empty p {
    color: var(--text-muted);
    font-weight: 500;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Responsive Reports */
@media (max-width: 1024px) {
    .reports-container {
        flex-direction: column;
        height: auto;
    }
    .reports-left {
        flex: none;
        width: 100%;
    }
    .preview-card {
        height: 600px;
    }
}

.icon-spin {
    animation: spin 1s linear infinite;
}

.row-gap-0 { row-gap: 0 !important; }


/* ============================================================
   SENA DESIGN SYSTEM — Componentes reutilizables v2.0
   Todos los colores usan la paleta oficial SENA.
   Tipografía: Work Sans (font-sena) / Inter (font-senaBody)
   ============================================================ */

/* ── .card — tarjeta base del sistema ── */
.card {
    background: linear-gradient(165deg,
        rgba(17, 34, 64, 0.82),
        rgba(8, 22, 39, 0.78));
    border: 1px solid rgba(0, 48, 77, 0.45);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: transform var(--tr),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(57, 169, 0, 0.25);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 0 0 1px rgba(57, 169, 0, 0.08);
}

/* Variantes de tarjeta */
.card-primary {
    border-left: 4px solid var(--sena-primary);
}

/* ── .view-header — encabezado de sección con ícono ── */
.view-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 48, 77, 0.4);
}

.view-header-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    /* Gradiente verde SENA para ícono de cabecera */
    background: linear-gradient(135deg,
        rgba(57, 169, 0, 0.22),
        rgba(0, 120, 50, 0.12));
    border: 1px solid rgba(57, 169, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

/* ── .badge-status — badges semánticos del sistema ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

/* success → emerald (éxito) */
.badge-status.success {
    background: rgba(34, 197, 94, 0.14);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.30);
}

/* warning → yellow/sena-yellow (advertencia) */
.badge-status.warning {
    background: rgba(253, 195, 0, 0.14);
    color: var(--sena-yellow);
    border: 1px solid rgba(253, 195, 0, 0.30);
}

/* danger → red (peligro/error) */
.badge-status.danger {
    background: rgba(239, 68, 68, 0.13);
    color: var(--red-light);
    border: 1px solid rgba(239, 68, 68, 0.28);
}

/* info → blue (información) */
.badge-status.info {
    background: rgba(80, 229, 249, 0.12);
    color: var(--sena-light-blue);
    border: 1px solid rgba(80, 229, 249, 0.25);
}

/* primary → sena-primary verde (acción principal) */
.badge-status.primary {
    background: rgba(57, 169, 0, 0.14);
    color: var(--sena-primary);
    border: 1px solid rgba(57, 169, 0, 0.30);
}

/* ── Colores de texto semánticos ── */
.text-primary { color: var(--sena-primary) !important; }
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--red-light) !important; }
.text-warning  { color: var(--sena-yellow) !important; }
.text-info     { color: var(--sena-light-blue) !important; }

/* ── .btn-success — éxito/verde emerald ── */
.btn-success {
    background: linear-gradient(135deg, var(--sena-primary), var(--sena-primary-dark));
    color: var(--sena-white);
    border: none;
    font-family: var(--font-sans);
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.30);
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--green-light), var(--success));
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
    transform: translateY(-2px);
}

/* ── .btn-icon — botón de ícono cuadrado ── */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.22s ease;
    font-size: 1rem;
}

.btn-icon:hover {
    background: rgba(57, 169, 0, 0.14);
    border-color: rgba(57, 169, 0, 0.30);
    color: var(--sena-primary);
    transform: translateY(-2px);
}

/* ── .form-group — grupo de campo de formulario ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-family: var(--font-sans);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(13, 27, 42, 0.6);
    border: 1px solid rgba(0, 48, 77, 0.55);
    border-radius: 11px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    padding: 11px 14px;
    outline: none;
    transition: all 0.25s ease;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: rgba(57, 169, 0, 0.55);
    background: rgba(57, 169, 0, 0.05);
    box-shadow: 0 0 0 3px rgba(57, 169, 0, 0.13);
}

/* ── .data-table — tabla de datos del sistema ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

.data-table thead th {
    text-align: left;
    padding: 11px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: rgba(0, 0, 0, 0.18);
    border-bottom: 1px solid rgba(0, 48, 77, 0.4);
}

.data-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    transition: background 0.15s;
}

.data-table tbody tr:hover td {
    background: rgba(57, 169, 0, 0.04);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── .progress-container — barra de progreso del sistema ── */
.progress-container {
    width: 100%;
}

.progress-container .progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.progress-container .progress-bar-wrap {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    overflow: hidden;
}

.progress-container .progress-bar {
    height: 100%;
    border-radius: 20px;
    /* Verde SENA como color de progreso por defecto */
    background: linear-gradient(90deg, var(--sena-primary), var(--sena-primary-dark));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-container .progress-bar::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 30%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25));
    border-radius: 20px;
}

/* Variantes de progreso (colores semánticos) */
.progress-bar.warning {
    background: linear-gradient(90deg, var(--sena-yellow), #c99b00);
}

.progress-bar.danger {
    background: linear-gradient(90deg, #ef4444, #b91c1c);
}

.progress-bar.info {
    background: linear-gradient(90deg, var(--sena-light-blue), #00b4d8);
}

/* ── .objective-row — fila de objetivo/meta ── */
.objective-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    transition: all 0.22s ease;
    margin-bottom: 8px;
}

.objective-row:hover {
    background: rgba(57, 169, 0, 0.04);
    border-color: rgba(57, 169, 0, 0.18);
}

.objective-row .obj-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--sena-primary);
    box-shadow: 0 0 8px rgba(57, 169, 0, 0.5);
}

.objective-row .obj-indicator.warning {
    background: var(--sena-yellow);
    box-shadow: 0 0 8px rgba(253, 195, 0, 0.5);
}

.objective-row .obj-indicator.danger {
    background: var(--red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.objective-row .obj-content {
    flex: 1;
}

.objective-row .obj-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.objective-row .obj-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── .semillero-logo — logo institucional del sistema ── */
.semillero-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(57, 169, 0, 0.06);
    border: 1px solid rgba(57, 169, 0, 0.15);
    border-radius: 12px;
    transition: all 0.22s ease;
}

.semillero-logo:hover {
    background: rgba(57, 169, 0, 0.10);
    border-color: rgba(57, 169, 0, 0.28);
}

.semillero-logo img {
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

/* ── Notificaciones inline ── */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    transition: background 0.2s;
}

.notification-item.unread {
    background: rgba(57, 169, 0, 0.05);
    border-color: rgba(57, 169, 0, 0.16);
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* ── Scrollbar global (webkit) ── */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(57, 169, 0, 0.25);
    border-radius: 10px;
    border: 1px solid rgba(57, 169, 0, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(57, 169, 0, 0.4);
}

/* ── Selección de texto ── */
::selection {
    background: rgba(57, 169, 0, 0.25);
    color: var(--sena-white);
}

/* ── Animación global de entrada para vistas ── */
@keyframes sena-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: sena-fade-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Tooltip base ── */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(8, 22, 39, 0.95);
    border: 1px solid rgba(57, 169, 0, 0.25);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* ── Focus visible accesibilidad ── */
:focus-visible {
    outline: 2px solid var(--sena-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Empty state mejorado ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ── Clases de tiempo de motor en tarjetas de aireador ── */
/* Reemplazan los estilos inline de app.js renderCards() */
.motor-time-off {
    font-size: 0.75rem;
    color: var(--text-muted);   /* #64748b */
    margin: 5px 0;
    font-family: var(--font-sans);
}

.motor-time-on {
    font-size: 0.85rem;
    color: var(--sena-primary); /* #39A900 verde SENA oficial */
    margin: 5px 0;
    font-weight: 700;
    font-family: var(--font-sans);
    text-shadow: 0 0 8px rgba(57, 169, 0, 0.4);
}

/* ============================================================
   MEJORAS DE RESPUESTA MÓVIL (solo estilos, sin cambios de lógica)
   Complementa las media queries existentes; se define al final
   para tener prioridad de cascada donde hace falta.
   ============================================================ */

/* ── Tablets y móviles (≤ 768px) ────────────────────────────── */
@media (max-width: 768px) {
    /* Evita el zoom automático de iOS Safari al enfocar un campo:
       requiere tamaño de fuente ≥ 16px en los controles de formulario. */
    input,
    select,
    textarea,
    .modal input,
    .modal select,
    .stats-input,
    .sform-input,
    .sform-select,
    .form-row input,
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important;
    }

    /* Scroll con inercia en las tablas desplazables (evita cortes bruscos) */
    .logs-table-wrap,
    .users-table-wrap,
    .history-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* El drawer lateral debe poder desplazarse si su contenido no cabe */
    .sidebar {
        overflow-y: auto;
    }

    /* Objetivos táctiles más cómodos (mín. ~44px de alto) */
    .nav-btn {
        min-height: 48px;
    }

    .btn,
    .btn-power,
    .btn-toggle,
    .btn-primary,
    .btn-full {
        min-height: 44px;
    }

    /* Medios que nunca desborden el ancho de la pantalla */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Los badges del header (reloj + MQTT) se ajustan y envuelven */
    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .connection-badge {
        padding: 7px 12px;
    }
}

/* ── Móviles pequeños (≤ 480px) ─────────────────────────────── */
@media (max-width: 480px) {
    .main {
        padding: 20px 12px;
    }

    /* Menos padding en tarjetas para ganar ancho útil */
    .card,
    .stat-card,
    .modal-card {
        padding: 18px;
    }

    /* Acciones de modal apiladas y a todo el ancho (más fáciles de tocar) */
    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn,
    .modal-actions button {
        width: 100%;
    }

    /* Cifras destacadas que no rompan el layout en pantallas angostas */
    .insight-main-value {
        font-size: 1.6rem;
    }

    /* Badge del reloj compacto: la etiqueta de zona pasa a línea inferior */
    .clock-badge .tz-label {
        padding-left: 6px;
        margin-left: 3px;
        font-size: 9px;
    }
}
