:root {
    --bg-color: #1a1c2c;
    --text-color: #ffffff;
    --header-bg: #1a1c2c;
    --header-border: #a0a0a0;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-hover-bg: rgba(255, 255, 255, 0.06);
    --input-bg: rgba(0, 0, 0, 0.3);
    --input-border: rgba(255, 255, 255, 0.2);
    --modal-bg: rgba(30, 32, 44, 0.95);
    --modal-text-secondary: #a0a0a0;
    --button-secondary-bg: #2a2d3e;
    --button-secondary-text: #ffffff;
    --sidebar-bg: #1a1c2c;
    --controles-vista-button-active: #9cfd33;
    --controles-vista-button: #ffffff;
    --texto-cabecera-h2: #a0a0a0;
    --stats-grafica-text-color: #e2e2e2;
    --text-color-valor-medio: #9cfd33;
    --chart-line: #9cfd33;
    --chart-bg: rgba(156, 253, 51, 0.1);
    /* Logo inversion for dark mode */
    --select-option-bg: #2a2d3e;
    --nav-active-bg: rgba(156, 253, 253, 0.1);
    --naira-logo-filter: brightness(0) invert(1);
    --btn-danger-bg: #ff453a;
    --primary-glow: rgba(156, 253, 51, 0.3);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --primary-color: #9cfd33;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --gradient-primary: linear-gradient(135deg, #9cfd33 0%, #4ade80 100%);
    --border-color: rgba(255, 255, 255, 0.1);
    --nav-border-color: rgba(255, 255, 255, 0.2);
    --btn-bg: #9cfd33;
}

/* ============================
   WATER CHALLENGE LEAGUE MODE
   (Activo solo cuando APP_TITLE=WATER CHALLENGE LEAGUE)
   ============================ */
.wcl-mode {
    --bg-color: #0a1628;
    --header-bg: #0a1628;
    --sidebar-bg: #0c1a30;
    --card-bg: rgba(0, 180, 216, 0.06);
    --card-hover-bg: rgba(0, 180, 216, 0.12);
    --modal-bg: rgba(10, 22, 40, 0.97);
    --button-secondary-bg: #132035;
    --select-option-bg: #132035;
    --primary-color: #00b4d8;
    --primary-glow: rgba(0, 180, 216, 0.35);
    --chart-line: #00b4d8;
    --chart-bg: rgba(0, 180, 216, 0.1);
    --nav-active-bg: rgba(0, 180, 216, 0.12);
    --gradient-primary: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    --btn-bg: #00b4d8;
    --text-color-valor-medio: #00b4d8;
    --controles-vista-button-active: #00b4d8;
}

/* WCL en modo claro: mantener fondo blanco, cambiar sólo acento */
[data-theme="light"].wcl-mode {
    --primary-color: #0077b6;
    --primary-glow: rgba(0, 119, 182, 0.3);
    --chart-line: #0077b6;
    --chart-bg: rgba(0, 119, 182, 0.1);
    --nav-active-bg: rgba(0, 119, 182, 0.15);
    --gradient-primary: linear-gradient(135deg, #0077b6 0%, #00b4d8 100%);
    --btn-bg: #0077b6;
    --text-color-valor-medio: #0077b6;
    --controles-vista-button-active: #0077b6;
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --text-color: #000000;
    --header-bg: #ffffff;
    --header-border: #d1d8e0;
    --card-bg: #f4f7f6;
    --card-hover-bg: #f0f0f0;
    --input-bg: #f4f7f6;
    --input-border: #ced4da;
    --modal-bg: #f4f7f6;
    --modal-text-secondary: #636e72;
    --button-secondary-bg: #dfe6e9;
    --button-secondary-text: #2d3436;
    --sidebar-bg: #f4f7f6;
    --controles-vista-button-active: #2d3436;
    --controles-vista-button: #2d3436;
    --texto-cabecera-h2: #000000;
    --stats-grafica-text-color: #000000;
    --text-color-valor-medio: #16a34a;
    --chart-line: #16a34a;
    --chart-bg: rgba(22, 163, 74, 0.1);
    /* Original logo for light mode */
    --select-option-bg: #f4f7f6;
    --nav-active-bg: rgba(22, 163, 74, 0.15);
    --naira-logo-filter: none;
    --text-primary: #000000;
    --text-secondary: #636e72;
    --border-color: #ced4da;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --nav-border-color: rgba(0, 0, 0, 0.671);
    --primary-color: #16a34a;
    --primary-glow: rgba(22, 163, 74, 0.3);
    --gradient-primary: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
    --btn-bg: #16a34a;
}

/* --- CONFIGURACIÓN GENERAL --- */
* {
    box-sizing: border-box;
    /* Contención universal */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px;
    margin: 0;
    overflow-x: hidden;
    /* Evitar scroll horizontal accidental */
    transition: background-color 0.3s, color 0.3s;
}

select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 1rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 1.2em !important;
    padding-right: 2.8rem !important;
    transition: all 0.3s;
}

[data-theme="light"] select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

select option {
    background-color: var(--select-option-bg);
    color: var(--text-color);
}

header {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    align-items: center;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 2100;
    /* Por encima de todo, incluyendo el grid y badges */
    background-color: var(--header-bg);
    /* Fondo opaco para que no se vea el contenido al scroll */
    padding: 10px 0;
    /* Sombra para dar profundidad */
    transition: background-color 0.3s;
}

header>.row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--header-border);
    flex-wrap: nowrap;
    /* Evitar que se rompa el logo/título */
}

header>.row .sector_izq {
    width: 30%;
    display: flex;
    align-items: center;
    gap: 15px;
}

.desktop-only {
    display: flex !important;
}

.mobile-only {
    display: none !important;
}

/* --- LOGOS Y HEADER --- */
.logo-header {
    height: 70px;
    width: auto;
    object-fit: contain;
    transition: filter 0.3s;
}

.logo-dark {
    display: none !important;
}

[data-theme="dark"] .logo-light {
    display: none !important;
}

[data-theme="dark"] .logo-dark {
    display: block !important;
}

.logo-naira {
    height: 60px;
    width: auto;
    object-fit: contain;
    filter: var(--naira-logo-filter);
}

.brand-unit {
    display: none;
    /* Ya no se usa */
}

.sector_izq {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
}

header>.row .sector_centro {
    width: 40%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

header>.row h2 {
    font-size: 1.7rem;
    color: var(--text-color);
    margin: 0;
}

/* --- MENÚ HAMBURGUESA --- */
#menu-toggle {
    display: none;
}

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    z-index: 2001;
    /* Siempre por encima del overlay */
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    transition: 0.3s;
}

header>.row .sector_der {
    width: 30%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.contenedor-navegacion {
    display: flex;
    width: 100%;
    justify-content: center;
    transition: all 0.3s ease;
}

.contenedor-navegacion .row {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
}

.row .button {
    align-content: center;
    min-width: 200px;
    height: 75px;
    box-sizing: border-box;
}

.row .button button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    width: 100%;
    height: 100%;
    transition: 0.3s;
}

.row .button button h2 {
    font-size: 1.2rem;
    margin: 0;
}

.nav-icon-img {
    height: 1.4rem;
    width: auto;
    transition: transform 0.3s;
}

.button button:hover .nav-icon-img {
    transform: scale(1.1);
}

.row .button a {
    text-decoration: none;
    color: var(--text-color);
    width: 100%;
    height: 100%;
    display: block;
}

/* Estilos de Pestaña Activa (Escritorio) */
.principal-page .nav-principal button,
.meteorologia-page .nav-meteo button,
.riego-page .nav-riego button,
.cultivos-page .nav-cultivos button,
.naira-ia-page .nav-naira button,
.parcel-intelligence-page .nav-parcel button {
    background-color: var(--nav-active-bg);
    border-bottom: 4px solid #9cfd33 !important;
}

/* Bordes divisorios solo en escritorio */
@media (min-width: 769px) {
    .contenedor-navegacion .button button {
        border-right: 1px solid var(--nav-border-color) !important;
    }

    /* Opcional: El último elemento (Parcel Intelligence) no necesita borde derecho */
    .contenedor-navegacion .nav-parcel button {
        border-right: none !important;
    }
}

/* --- SELECTOR DE ZONAS --- */
.header-cultivo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 20px;
    background-color: var(--card-bg);
    border-radius: 15px;
    min-height: 100px;
    /* Altura mínima un poco mayor para dar aire */
    box-sizing: border-box;
}

/* Ajustes para móviles para mantener la altura unificada a 90px */
@media (max-width: 1040px) {
    .header-cultivo {
        padding: 10px 15px;
        min-height: 100px;
        /* Altura mínima móvil */
        margin-bottom: 15px;
    }

    .custom-select {
        font-size: 1.5rem !important;
    }
}

.info-principal {
    display: flex;
    align-items: center;
}

.header-icon {
    font-size: 2.8rem;
    height: 60px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    flex-shrink: 0;
}

.header-icon img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.texto-cabecera {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    /* Evita que el título estire el select innecesariamente */
}

.texto-cabecera h2 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 1.1rem;
    color: var(--texto-cabecera-h2);
    text-transform: uppercase;
    line-height: 1.1;
}

.texto-cabecera p {
    margin: 4px 0 0 0 !important;
    padding: 0 !important;
    line-height: 1.1;
}

.select-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 2px !important;
    line-height: 1;
}

.custom-select {
    background-color: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: bold;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    cursor: pointer;
    outline: none;
    width: 100%;
    position: relative;
    z-index: 2;
    /* Por encima de la flecha */
}

.custom-select option {
    background-color: var(--select-option-bg);
    color: var(--text-color);
}

.flecha-clicable {
    position: absolute;
    right: 5px;
    top: 55%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
    /* Por debajo del select */
}

.cultivos-page .flecha-clicable {
    color: #9cfd33;
}

.riego-page .flecha-clicable {
    color: #00ffff;
}

/* --- GRID Y TARJETAS --- */
.cuerpo {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
    width: 100%;
    overflow-x: hidden;
    min-width: 0;
}

.cuerpo-columna {
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    min-width: 0;
}

#vista-resumen {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
    width: 100%;
}

.contenedor-sensores-y-controles {
    flex: 0 0 calc(66% - 20px);
    /* 66% para los sensores */
    display: flex;
    flex-direction: column;
    min-width: 300px;
    /* Reducido para evitar desbordamiento temprano */
    gap: 0;
    /* Evitar espacios fantasma */
}

.modo-control-active .contenedor-sensores-y-controles {
    flex: 0 0 calc(72% - 10px) !important;
    /* Ancho mayor para los controles pero dejando espacio a la gráfica */
    width: 72% !important;
    max-width: 72% !important;
}

.sensor-grid {
    width: 100%;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-sizing: border-box;
}

.user-list,
.inst-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.card {
    padding: 20px;
    min-height: 115px;
    border-radius: 10px;
    text-align: left;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

.card:hover {
    transform: translateY(-3px);
}

.cultivos-page .card.selected {
    border-color: #9cfd33 !important;
    box-shadow: 0 0 15px rgba(156, 253, 51, 0.4);
}

.riego-page .card.selected,
.principal-page .card.selected,
.meteorologia-page .card.selected {
    border-color: #9cfd33 !important;
    box-shadow: 0 0 15px rgba(156, 253, 51, 0.4);
}

.valor {
    font-size: 1.8rem;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.label {
    font-size: 0.85rem;
    opacity: 0.7;
    text-transform: uppercase;
}

/* Colores de fondo de tarjetas */
.card.blue,
.ia-card.blue,
.card-hum,
.ia-card.card-hum,
.card-ph,
.ia-card.card-ph {
    background-color: rgba(0, 123, 255, 0.15);
    border-left: 5px solid #007bff;
}

.card.orange,
.ia-card.orange,
.card-temp,
.ia-card.card-temp {
    background-color: rgba(216, 140, 0, 0.452);
    border-left: 5px solid #ffa500;
}

.card.green {
    background-color: rgba(40, 167, 69, 0.15);
    border-left: 5px solid #28a745;
}

.card.cyan,
.ia-card.cyan,
.card-viento,
.ia-card.card-viento {
    background-color: rgba(0, 255, 255, 0.1);
    border-left: 5px solid #00ffff;
}

.card.dark-blue,
.ia-card.dark-blue,
.card-caudal,
.ia-card.card-caudal {
    background-color: rgba(63, 81, 181, 0.15);
    border-left: 5px solid #3f51b5;
}

.card-nutri,
.ia-card.card-nutri {
    background-color: rgba(144, 19, 254, 0.15);
    border-left: 5px solid #9013fe;
}

.card-elec,
.ia-card.card-elec {
    background-color: rgba(102, 102, 102, 0.15);
    border-left: 5px solid #666666;
}

.card-valve,
.ia-card.card-valve {
    background-color: rgba(59, 130, 246, 0.15);
    border-left: 5px solid #3b82f6;
}

.card-battery,
.ia-card.card-battery {
    background-color: rgba(234, 179, 8, 0.15);
    border-left: 5px solid #eab308;
}

/* --- CONTENEDOR GRÁFICA Y STATS --- */
.contenedor_grafica {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    position: relative;
    flex: 0 0 calc(34% - 10px);
    /* 34% para reducirla ligeramente */
    min-width: 350px;
    max-width: 100%;
    margin-top: 0;
    min-height: 450px;
    transition: all 1s ease;
    overflow: hidden;
    opacity: 1;
    box-sizing: border-box;
}

/* El nuevo recuadro de Valor Medio */
.stats-grafica {
    position: absolute;
    top: 4px;
    right: 4px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--stats-grafica-text-color);
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-grafica span {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
}

.stats-grafica span#valor-medio {
    color: var(--text-color-valor-medio);
}

.controles-grafica {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    /* Permitir que los botones bajen de línea si no caben */
}

.controles-grafica button {
    background: var(--button-secondary-bg);
    border: 1px solid var(--input-border);
    color: var(--button-secondary-text);
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 20px;
    transition: 0.3s;
}

.cultivos-page .controles-grafica button.active {
    background: #9cfd33;
    color: #000;
    border-color: #9cfd33;
}

.riego-page .controles-grafica button.active,
.principal-page .controles-grafica button.active,
.meteorologia-page .controles-grafica button.active {
    background: #9cfd33;
    color: #000;
    border-color: #9cfd33;
}

.canvas-holder {
    height: 350px;
    width: 100%;
}

/* --- MODO CONTROL --- */
.modo-control-active .contenedor_grafica {
    opacity: 1;
    flex: 0 0 calc(28% - 10px);
    padding: 20px;
    margin: 0;
    width: 28%;
    max-width: 28%;
    min-width: 280px;
    height: auto;
    max-height: none;
    min-height: 400px;
    pointer-events: auto;
    border: none;
    transition: all 0.5s ease;
}

.modo-control-active .canvas-holder {
    height: 280px;
}

.modo-control-active .sensor-grid {
    flex: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.controles-vista {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-bottom: 20px;
    padding-right: 20px;
}

.controles-vista button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--controles-vista-button);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.controles-vista button.active {
    background: rgba(156, 253, 51, 0.2);
    border-color: #9cfd33;
    color: var(--controles-vista-button-active);
}

.sensor-status-badge {
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 2;
}

.sensor-prog-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    background-color: rgba(156, 253, 51, 0.2);
    color: var(--controles-vista-button-active);
    border: 1px solid #9cfd33;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 0 10px rgba(156, 253, 51, 0.2);
}


.status-activo {
    background: rgba(156, 253, 51, 0.2);
    color: var(--controles-vista-button-active);
    border: 1px solid #9cfd33;
}

.status-inactivo {
    background: rgba(255, 69, 58, 0.2);
    color: var(--controles-vista-button);
    border: 1px solid #ff453a;
}

#panel-activacion {
    background-color: var(--card-bg);
    padding: 0;
    /* Sin padding si no se usa */
    border-radius: 12px;
    margin-top: 0;
    /* Sin margen si no se usa */
    display: none;
    border-top: 2px solid rgba(156, 253, 51, 0.3);
    overflow: hidden;
}

.modo-control-active #panel-activacion {
    display: block;
    padding: 20px;
    margin-top: 20px;
}

.panel-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--controles-vista-button);
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: rgba(156, 253, 51, 0.2);
    border-color: #9cfd33;
    color: var(--controles-vista-button-active);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 5px 0 15px 0;
    line-height: 1.4;
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

.input-time {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: inherit;
}

.days-grid {
    display: flex;
    flex-wrap: wrap;
    /* Evitar desbordamiento móvil */
    gap: 5px;
    margin-top: 5px;
    width: 100%;
}

.day-chip {
    flex: 1 1 40px;
    /* Tamaño flexible */
    min-width: 35px;
    font-size: 0.65rem;
    text-align: center;
    padding: 8px 2px;
    border-radius: 4px;
    background: var(--input-bg);
    cursor: pointer;
    border: 1px solid transparent;
}

.day-chip.selected {
    background: rgba(156, 253, 51, 0.2);
    border-color: #9cfd33;
    color: #9cfd33;
}

.btn-guardar-prog {
    background: #9cfd33;
    color: #1a1a1a;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    font-size: 0.8rem;
}

.prog-status {
    font-size: 0.75rem;
    margin-top: 10px;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid #9cfd33;
}

.prog-alert {
    display: block;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 204, 0, 0.1);
    color: #ffcc00;
    border: 1px solid rgba(255, 204, 0, 0.3);
    line-height: 1.4;
    text-align: center;
}

.modo-control-active #panel-activacion {
    display: block;
}

.btn-toggle-sensor {
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    border: none;
    transition: 0.3s;
    margin-top: 10px;
}

.btn-toggle-sensor:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-activar {
    background-color: #9cfd33;
    color: #000;
}

.btn-desactivar {
    background-color: #ff453a;
    color: #fff;
}

/* --- MODAL PERSONALIZADO --- */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

#custom-modal {
    background: var(--modal-bg);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

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

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

.modal-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-color);
}

.modal-text {
    font-size: 0.95rem;
    color: var(--modal-text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
}

.modal-btn-cancel,
.modal-btn-secondary {

    background: var(--button-secondary-bg);
    color: var(--text-color);
}

.modal-btn-cancel:hover,
.modal-btn-secondary:hover {

    background: rgba(255, 255, 255, 0.2);
}

.modal-btn-confirm,
.modal-btn-primary {
    background: var(--primary-color);
    color: #1a1a1a;
}

.modal-btn-confirm:hover,
.modal-btn-primary:hover {
    background: #8ae22a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(156, 253, 51, 0.3);
}

.modal-btn-danger {
    background: #ff453a;
    color: white;
}

.modal-btn-danger:hover {
    background: #ff3b30;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 69, 58, 0.3);
}

/* --- RESPONSIVIDAD (MEDIA QUERIES) --- */

/* Pantallas medianas/grandes (Apilado de gráfica temprano) */
@media (max-width: 1100px) {
    .cuerpo {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .contenedor-sensores-y-controles {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .modo-control-active .contenedor-sensores-y-controles {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
    }

    .sensor-grid {
        display: grid !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
        gap: 20px !important;
    }

    .contenedor_grafica {
        width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
        margin-top: 10px !important;
    }
}

/* Activación de Menú Hamburguesa FUNCIONAL */
@media (max-width: 1040px) {
    .hamburger {
        display: flex;
        transform: scale(1.1);
        z-index: 3000;
    }

    .contenedor-navegacion {
        display: none !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: var(--sidebar-bg);
        z-index: 2500;
        flex-direction: column !important;
        justify-content: flex-start !important;
        padding-top: 15px !important;
        padding-bottom: 40px !important;
        /* Spacing for last items */
        overflow-y: auto !important;
        /* Enable scrolling */
        align-items: center;
        transition: background-color 0.3s;
    }

    #menu-toggle:checked~.contenedor-navegacion {
        display: flex !important;
    }

    .contenedor-navegacion .row {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 15px !important;
        width: 100% !important;
        border: none !important;
        height: auto !important;
    }

    .contenedor-navegacion .button {
        width: 85% !important;
        height: 65px !important;
        margin: 0 auto !important;
    }

    .contenedor-navegacion .button a {
        display: flex !important;
        width: 100%;
        height: 100%;
        text-decoration: none;
    }

    .contenedor-navegacion .button button {
        width: 100% !important;
        height: 100% !important;
        background: var(--card-bg) !important;
        border: 1px solid var(--input-border) !important;
        border-radius: 15px !important;
    }

    .contenedor-navegacion .button button h2 {
        font-size: 1.4rem !important;
        font-weight: 800 !important;
        color: var(--text-color) !important;
    }

    /* --- MOBILE MENU SETTINGS --- */
    .menu-settings-mobile {
        display: flex;
        justify-content: flex-start;
        align-items: flex-start;
        gap: 30px;
        width: 100%;
        padding: 0 0 15px 0;
        border-bottom: 1px solid var(--header-border);
        margin-bottom: 15px;
        padding-left: 20px;
        flex-shrink: 0;
        /* Prevent it from being squashed by buttons */
    }

    .menu-settings-column {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .menu-settings-mobile .theme-toggle {
        margin: 0;
    }

    .menu-settings-column .language-selector-container {
        margin: 0;
    }

    .menu-settings-column .config-toggle {
        margin: 0;
    }
}

/* --- THEME TOGGLE --- */
.theme-toggle {
    background: var(--button-secondary-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    margin-right: 15px;
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
    background-color: var(--card-hover-bg);
}

/* --- LANGUAGE SELECTOR (CUSTOM DROPDOWN) --- */
.language-selector-container {
    padding: 0;
    border: none;
    background: transparent;
    margin-right: 15px;
    position: relative;
    z-index: 2200;
}

.lang-dropdown {
    position: relative;
    width: 150px;
    height: 40px;
    cursor: pointer;
}

.lang-selected {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
    transition: all 0.3s ease;
}

.lang-selected:hover {
    border-color: #9cfd33;
    background: var(--card-hover-bg);
}

.lang-selected img {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

.lang-selected span {
    font-size: 0.9rem;
    font-weight: 600;
}

.lang-selected span:not(.arrow) {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lang-selected .arrow {
    flex: none;
    font-size: 0.7rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
    display: inline-block;
    transform-origin: center;
    width: 14px;
    text-align: center;
}

.lang-dropdown.active .lang-selected .arrow {
    transform: rotate(180deg);
}

.lang-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: var(--modal-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    overflow: hidden;
    display: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.lang-dropdown.active .lang-options {
    display: block;
    animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.lang-option {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--card-hover-bg);
}

.lang-option img {
    width: 20px;
    height: auto;
}

.lang-option span {
    font-size: 0.9rem;
}

@media (max-width: 1040px) {
    .lang-dropdown {
        width: 130px;
    }

    .lang-selected span {
        font-size: 0.8rem;
    }
}

.theme-toggle .icon-light {
    display: none;
}

.theme-toggle .icon-dark {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-light {
    display: block;
}

[data-theme="light"] .theme-toggle .icon-dark {
    display: none;
}

/* Legibilidad Móvil y Cabecera Adaptativa */
@media (max-width: 1040px) {
    body {
        font-size: 1.1rem !important;
        padding: 10px !important;
    }

    header .row h1 {
        font-size: 1.3rem !important;
        margin: 0 !important;
    }

    header .row h2 {
        font-size: 1.1rem !important;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        margin-right: 5px;
    }

    .language-selector-container {
        height: 36px;
        margin-right: 5px;
        padding: 0 4px;
    }

    .language-selector {
        font-size: 1rem;
    }

    .hamburger {
        transform: scale(1.1);
    }

    .sensor-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        /* Gap más estrecho */
        padding: 5px !important;
        /* Padding reducido */
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        /* CRÍTICO para móvil */
    }

    .card {
        min-height: 135px;
    }

    .valor {
        font-size: 1.3rem !important;
        /* Más grande pero no excesivo */
        margin-top: 8px;
    }

    .label {
        font-size: 1rem !important;
    }

    .custom-select {
        font-size: 1rem !important;
        height: 85px;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    header {
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
    }

    header>.row.main-header-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        grid-template-areas: "izq centro burger" !important;
        padding: 10px 15px !important;
        align-items: center !important;
        border-bottom: none !important;
    }

    .sector_izq {
        grid-area: izq !important;
        justify-self: start !important;
        display: flex !important;
        align-items: center !important;
    }

    .mobile-title-row {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        padding: 5px 0 15px 0 !important;
        border-bottom: 2px solid var(--header-border) !important;
    }

    .mobile-title-row h2 {
        font-size: 1.3rem !important;
        margin: 0 !important;
        color: var(--text-color) !important;
    }

    .sector_centro_mobile {
        grid-area: centro !important;
        display: flex !important;
        justify-content: center !important;
    }

    .sector_centro_mobile img {
        height: 48px !important;
    }

    .hamburger {
        position: relative !important;
        right: 0 !important;
        top: 0 !important;
        transform: none !important;
        grid-area: burger !important;
        justify-self: end !important;
        z-index: 4000 !important;
    }

    .logo-header {
        height: 52px !important;
    }

    .stats-grafica {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        margin: 15px auto !important;
        text-align: center !important;
        width: fit-content !important;
        display: block !important;
    }

    .stats-grafica span {
        display: inline-block !important;
        margin: 0 5px !important;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Ajustes específicos para los botones de la gráfica en móvil */
    .controles-grafica {
        gap: 6px !important;
        margin: 10px 0 20px 0 !important;
        justify-content: center !important;
    }

    .controles-grafica button {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }

    /* Estilos móviles para NAIRA IA */
    .ia-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px;
    }

    .ia-timestamp {
        align-self: flex-end;
        text-align: right;
    }

    .ia-grid {
        grid-template-columns: 1fr !important;
    }
}

/* --- NAIRA IA PAGE STYLES --- */
.ia-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
    transition: opacity 0.4s ease-in-out;
}

.ia-grid.traduciendo {
    opacity: 0;
}

.ia-card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    border-left: 5px solid #9cfd33;
    transition: transform 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.ia-card:hover {
    transform: translateY(-3px);
}

.ia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.ia-sensor-id {
    font-weight: bold;
    color: #9cfd33;
    font-size: 1.1rem;
}

[data-theme="light"] .ia-sensor-id {
    color: #16a34a;
}

.ia-timestamp {
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.9;
}

.ia-respuesta {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    white-space: pre-wrap;
}

.ia-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
}

.ia-estado {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: bold;
}

.estado-true {
    background: rgba(156, 253, 51, 0.2);
    color: #9cfd33;
    border: 1px solid #9cfd33;
}

.estado-false {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
    border: 1px solid #ff453a;
}

[data-theme="light"] .ia-estado {
    color: #000000 !important;
}

.no-data {
    text-align: center;
    padding: 50px;
    opacity: 0.5;
    font-style: italic;
}

/* --- NAIRA IA VIEW TOGGLE --- */
.naira-view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.naira-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--controles-vista-button);
    padding: 9px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}

.naira-tab-btn:hover {
    background: rgba(156, 253, 51, 0.08);
    border-color: rgba(156, 253, 51, 0.35);
}

.naira-tab-btn.active {
    background: rgba(156, 253, 51, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 0 12px rgba(156, 253, 51, 0.15);
}

[data-theme="light"] .naira-tab-btn.active {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.12);
    border-color: #16a34a;
    box-shadow: 0 0 12px rgba(22, 163, 74, 0.15);
}

/* --- NAIRA CHAT CONTAINER --- */
.naira-chat-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Chat input panel */
.naira-chat-panel {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 2px 16px var(--shadow-color);
}

.naira-chat-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.naira-chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.naira-chat-textarea {
    width: 100%;
    min-height: 100px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.97rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    line-height: 1.55;
}

.naira-chat-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.naira-chat-textarea::placeholder {
    opacity: 0.45;
    font-style: italic;
}

.naira-chat-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.naira-chat-feedback {
    font-size: 0.9rem;
    font-weight: 500;
    flex: 1;
    min-height: 1.2em;
    transition: all 0.3s ease;
}

.naira-feedback-success {
    color: var(--primary-color);
}

.naira-feedback-error {
    color: #ff453a;
}

.naira-feedback-warning {
    color: #ffa500;
}

.naira-chat-send-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-primary);
    border: none;
    color: #000;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    transition: opacity 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.naira-chat-send-btn:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
}

.naira-chat-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Rules panel */
.naira-rules-panel {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 22px 25px;
    box-shadow: 0 2px 16px var(--shadow-color);
}

.naira-rules-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

.naira-rules-refresh-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 7px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s;
}

.naira-rules-refresh-btn:hover {
    background: rgba(156, 253, 51, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.naira-rules-grid-wrapper {
    margin-top: 20px;
    width: 100%;
}

.naira-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.naira-rule-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.naira-rule-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.naira-rule-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.naira-rule-card-id {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-color);
}

[data-theme="light"] .naira-rule-card-id {
    color: #16a34a;
}

.naira-rule-card-actions {
    display: flex;
    gap: 8px;
}

.naira-rule-card-body {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
}

.naira-rule-card-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.naira-rule-part-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.naira-rule-sensor-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    flex: 1;
    align-items: stretch;
}

.naira-rule-sensor-wrapper .rule-sensor-mini-card {
    width: 100%;
    min-width: 120px;
    max-width: 180px;
    min-height: 70px;
    height: auto;
    box-sizing: border-box;
    justify-content: flex-start;
    padding: 8px 12px;
}

.naira-rule-card-cond {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 70px;
    flex-shrink: 0;
}

.naira-rule-umbral-badge {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

@media (max-width: 576px) {
    .naira-rule-card-body {
        flex-direction: column;
        gap: 12px;
    }

    .naira-rule-card-cond {
        flex-direction: row;
        gap: 10px;
    }
}

.naira-rules-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    opacity: 0.5;
    font-style: italic;
}

/* Spin animation for icons */
@keyframes naira-spin-anim {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.naira-spin {
    display: inline-block;
    animation: naira-spin-anim 0.7s linear infinite;
}

/* Responsive chat */
@media (max-width: 768px) {
    .naira-view-toggle {
        gap: 6px;
    }

    .naira-tab-btn {
        padding: 8px 14px;
        font-size: 0.88rem;
    }

    .naira-chat-panel,
    .naira-rules-panel {
        padding: 16px;
    }

    .naira-rules-table th,
    .naira-rules-table td {
        padding: 8px 10px;
    }

    .naira-chat-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .naira-chat-send-btn {
        justify-content: center;
    }
}


/* =============================================
   NAIRA RULES — INFO BOX
   ============================================= */
.naira-chat-info-box {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(156, 253, 51, 0.05);
    border: 1px solid rgba(156, 253, 51, 0.2);
    border-radius: 12px;
    padding: 16px 20px;
}

[data-theme="light"] .naira-chat-info-box {
    background: rgba(22, 163, 74, 0.05);
    border-color: rgba(22, 163, 74, 0.2);
}

/* =============================================
   NAIRA RULES — COUNT BADGE
   ============================================= */
.naira-rules-count-badge {
    background: rgba(156, 253, 51, 0.12);
    color: var(--primary-color);
    border: 1px solid rgba(156, 253, 51, 0.3);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* =============================================
   NAIRA RULES — MINI SENSOR CARDS (en tabla)
   ============================================= */
.naira-rule-sensor-cell {
    padding: 6px 10px !important;
    vertical-align: middle;
    text-align: center;
}

.rule-sensor-mini-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    min-width: 100px;
    max-width: 200px;
    border-left: 4px solid transparent;
    background: var(--card-bg);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
}

.rule-sensor-mini-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.rule-sensor-mini-card.card-hum {
    background: rgba(0, 123, 255, 0.10);
    border-left-color: #007bff;
}

.rule-sensor-mini-card.card-temp {
    background: rgba(216, 140, 0, 0.15);
    border-left-color: #ffa500;
}

.rule-sensor-mini-card.card-nutri {
    background: rgba(144, 19, 254, 0.10);
    border-left-color: #9013fe;
}

.rule-sensor-mini-card.card-ph {
    background: rgba(0, 123, 255, 0.10);
    border-left-color: #007bff;
}

.rule-sensor-mini-card.card-caudal {
    background: rgba(63, 81, 181, 0.10);
    border-left-color: #3f51b5;
}

.rule-sensor-mini-card.card-viento {
    background: rgba(0, 255, 255, 0.08);
    border-left-color: #00ffff;
}

.rule-sensor-mini-card.card-elec {
    background: rgba(102, 102, 102, 0.10);
    border-left-color: #666;
}

.rule-sensor-mini-card.card-valve {
    background: rgba(59, 130, 246, 0.10);
    border-left-color: #3b82f6;
}

.rule-sensor-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
}

.rule-sensor-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    text-align: center;
}

.rule-sensor-valor {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.rule-sensor-tipo {
    font-size: 0.72rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: normal;
    line-height: 1.2;
}

[data-theme="light"] .rule-sensor-tipo {
    color: #16a34a;
}

.rule-sensor-zona {
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.naira-rule-empty {
    color: var(--text-secondary);
    opacity: 0.5;
}

/* =============================================
   NAIRA RULES — OPERATOR BADGE
   ============================================= */
.naira-rule-op-badge {
    display: inline-block;
    background: rgba(156, 253, 51, 0.1);
    border: 1px solid rgba(156, 253, 51, 0.3);
    color: var(--primary-color);
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
}

[data-theme="light"] .naira-rule-op-badge {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.3);
    color: #16a34a;
}

/* =============================================
   NAIRA RULES — ACTION BUTTONS
   ============================================= */
.naira-rule-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 6px 8px !important;
}

.naira-rule-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.naira-rule-edit-btn:hover {
    background: rgba(156, 253, 51, 0.12);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(156, 253, 51, 0.2);
}

.naira-rule-delete-btn:hover {
    background: rgba(255, 69, 58, 0.12);
    border-color: #ff453a;
    color: #ff453a;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 69, 58, 0.2);
}

/* =============================================
   NAIRA MODALES (Editar / Eliminar)
   ============================================= */
.naira-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: nairaModalFadeIn 0.2s ease;
}

@keyframes nairaModalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.naira-modal-content {
    background: var(--modal-bg);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: nairaModalSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes nairaModalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

.naira-modal-content.naira-modal-danger {
    border-color: rgba(255, 69, 58, 0.3);
}

.naira-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.naira-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    flex: 1;
}

.naira-modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.naira-modal-close-btn:hover {
    background: var(--card-hover-bg);
    color: var(--text-primary);
}

.naira-modal-section {
    margin-bottom: 20px;
}

.naira-modal-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
}

.naira-modal-current-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.naira-modal-data-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.naira-modal-data-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 600;
}

.naira-modal-data-value {
    font-size: 0.88rem;
    font-weight: 600;
    word-break: break-all;
}

.naira-modal-data-value.sensor-tag {
    font-family: 'Courier New', monospace;
    color: var(--primary-color);
    font-size: 0.82rem;
}

[data-theme="light"] .naira-modal-data-value.sensor-tag {
    color: #16a34a;
}

.op-tag {
    display: inline-block;
    background: rgba(156, 253, 51, 0.1);
    border: 1px solid rgba(156, 253, 51, 0.3);
    color: var(--primary-color);
    padding: 1px 7px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 700;
}

[data-theme="light"] .op-tag {
    background: rgba(22, 163, 74, 0.08);
    border-color: rgba(22, 163, 74, 0.3);
    color: #16a34a;
}

.naira-modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.naira-modal-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.naira-modal-form-row label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.naira-modal-select,
.naira-modal-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.naira-modal-select:focus,
.naira-modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.naira-modal-diff {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.naira-modal-diff-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.naira-modal-diff-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 65px;
    font-weight: 600;
}

.naira-modal-diff-value {
    font-size: 0.88rem;
    font-weight: 600;
}

.naira-modal-diff-change {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(156, 253, 51, 0.05);
    border: 1px solid rgba(156, 253, 51, 0.15);
    border-radius: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.naira-modal-diff-before,
.naira-modal-diff-after {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 600;
}

.diff-label-small {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.naira-modal-danger-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(255, 69, 58, 0.08);
    border: 1px solid rgba(255, 69, 58, 0.25);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    color: #ff453a;
    line-height: 1.4;
}

.naira-modal-danger-warning i {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 1px;
}

.naira-modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    margin-top: 6px;
}

.naira-modal-btn-cancel {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 9px 18px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.2s;
}

.naira-modal-btn-cancel:hover {
    background: var(--card-hover-bg);
    color: var(--text-primary);
}

.naira-modal-btn-confirm {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--gradient-primary);
    border: none;
    color: #000;
    padding: 9px 20px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: opacity 0.2s, transform 0.15s;
}

.naira-modal-btn-confirm:hover:not(:disabled) {
    opacity: 0.88;
    transform: translateY(-1px);
}

.naira-modal-btn-confirm:disabled,
.naira-modal-btn-danger:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.naira-modal-btn-danger {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 69, 58, 0.15);
    border: 1px solid #ff453a;
    color: #ff453a;
    padding: 9px 20px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.2s;
}

.naira-modal-btn-danger:hover:not(:disabled) {
    background: #ff453a;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 69, 58, 0.35);
}

/* Responsive modales */
@media (max-width: 540px) {
    .naira-modal-content {
        padding: 20px 16px;
        border-radius: 16px;
    }

    .naira-modal-current-grid {
        grid-template-columns: 1fr;
    }

    .naira-modal-footer {
        flex-direction: column-reverse;
    }

    .naira-modal-btn-cancel,
    .naira-modal-btn-confirm,
    .naira-modal-btn-danger {
        justify-content: center;
        width: 100%;
    }

    .naira-modal-diff-change {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* =============================================
   SIDEBAR BOTTOM SHEET — MÓVIL (≤ 1040px)
   ============================================= */
@media (max-width: 1040px) {

    body.sidebar-present:not(.sidebar-closed),
    body.sidebar-present.sidebar-closed {
        padding-left: 0 !important;
        padding-bottom: 66px !important;
    }

    .sidebar {
        display: flex !important;
        flex-direction: column;
        position: fixed !important;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        height: auto;
        max-height: 70vh;
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-radius: 18px 18px 0 0;
        z-index: 4000;
        transform: translateY(calc(100% - 52px));
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.35);
    }

    .sidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 4px auto 2px auto;
        flex-shrink: 0;
    }

    [data-theme="light"] .sidebar::before {
        background: rgba(0, 0, 0, 0.15);
    }

    .sidebar.sidebar-mobile-open {
        transform: translateY(0);
        overflow-y: auto;
    }

    /* Hamburger button: hidden on mobile — toggle via header tap */
    .sidebar-toggle-btn {
        display: none !important;
    }

    /* Closed state: compact icon strip
       Reorder via flex order: ::before (order 0) → nav (order 1) → header (order 2, hidden) */
    .sidebar:not(.sidebar-mobile-open) .sidebar-header {
        order: 2;
        min-height: 0;
        height: 0;
        padding: 0;
        border-bottom: none;
        overflow: hidden;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-title {
        display: none;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-section-title {
        display: none !important;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-nav {
        order: 1;
        display: flex !important;
        flex-direction: row !important;
        padding: 2px 6px 4px;
        flex: 0 0 auto;
        overflow-x: auto;
        gap: 2px;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-link {
        flex-direction: column;
        padding: 2px 6px;
        gap: 0;
        min-width: 36px;
        justify-content: center;
        align-items: center;
        border-right: none;
        border-radius: 6px;
        margin: 0;
        pointer-events: none;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-text {
        display: none !important;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-icon {
        font-size: 1.05rem;
        margin: 0;
        width: auto;
    }

    /* Full sheet open: normal layout (all order: 0, DOM order: header → nav) */
    .sidebar-header {
        min-height: 38px;
        flex-shrink: 0;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
    }

    .sidebar.sidebar-mobile-open .sidebar-text,
    .sidebar.sidebar-mobile-open .sidebar-section-title {
        display: block !important;
    }

    .sidebar.sidebar-mobile-open .sidebar-title {
        display: block;
    }

    .sidebar.sidebar-mobile-open .sidebar-nav {
        display: flex;
        flex-direction: column;
        padding: 6px 0;
        flex: 1;
    }

    .sidebar.sidebar-mobile-open .sidebar-link {
        flex-direction: row;
        padding: 10px 20px;
        justify-content: flex-start;
        gap: 12px;
        border-right: none;
        border-radius: 0;
        pointer-events: auto;
    }

    .sidebar.sidebar-mobile-open .sidebar-icon {
        font-size: 1.2rem;
        width: 24px;
        margin: 0;
    }

    .sidebar-closed .sidebar {
        width: 100% !important;
    }

    .sidebar-closed .sidebar-text,
    .sidebar-closed .sidebar-section-title,
    .sidebar-closed .sidebar-title {
        display: block !important;
    }

    .sidebar-closed .sidebar-link {
        justify-content: flex-start;
        padding: 12px 20px;
        border-right: none;
    }

    .sidebar-closed .sidebar-icon {
        margin: 0;
        width: 24px;
        font-size: 1.2rem;
    }

    /* Overlay */
    .sidebar-mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 3999;
        backdrop-filter: blur(2px);
    }

    .sidebar-mobile-overlay.active {
        display: block;
    }
}

/* =============================================
   RESPONSIVE — NAIRA IA (móvil)
   ============================================= */
@media (max-width: 768px) {
    .naira-view-toggle {
        gap: 5px;
        flex-wrap: nowrap;
    }

    .naira-tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        flex: 1;
        justify-content: center;
    }

    .naira-rules-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .naira-rules-table {
        min-width: 550px;
    }

    .rule-sensor-mini-card {
        min-width: 100px;
        padding: 6px 8px;
        gap: 6px;
    }

    .rule-sensor-icon {
        font-size: 1.1rem;
    }

    .rule-sensor-valor {
        font-size: 0.85rem;
    }

    .naira-rules-panel,
    .naira-chat-panel {
        padding: 14px;
    }

    .naira-chat-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .naira-chat-send-btn {
        justify-content: center;
    }

    .naira-chat-info-box {
        flex-direction: column;
        gap: 8px;
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .naira-tab-btn span {
        display: none;
    }

    .naira-tab-btn {
        padding: 8px 10px;
        font-size: 1rem;
    }
}

/* =============================================
   RESPONSIVE — ALERTAS (móvil)
   ============================================= */
@media (max-width: 768px) {
    .alertas-container {
        gap: 10px;
    }

    .alerta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .alerta-item .sensor-name {
        min-width: unset;
        font-size: 0.9rem;
    }

    .alerta-item .btn-save-alert {
        margin-left: 0;
        width: 100%;
        padding: 8px;
    }
}

/* =============================================
   RESPONSIVE — DISPOSITIVOS (móvil)
   ============================================= */
@media (max-width: 768px) {
    .dispositivos-grid {
        grid-template-columns: 1fr;
        justify-content: stretch;
        margin-left: 0;
        margin-right: 0;
        gap: 15px;
    }

    .dispositivo-card {
        padding: 15px;
        box-sizing: border-box;
        min-width: 0;
        overflow: hidden;
    }

    .dispositivo-image-placeholder {
        height: 100px;
    }

    .dispositivo-info h3 {
        font-size: 1rem;
        word-break: break-word;
    }
}

/* =============================================
   RESPONSIVE — HEADER / GENERAL (móvil)
   ============================================= */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header-cultivo {
        padding: 10px 5px;
    }

    .texto-cabecera h2 {
        font-size: 1rem;
    }

    .historico-controls {
        gap: 6px;
    }

    .historico-controls button {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .sensor-toggle-list {
        gap: 5px;
    }

    .sensor-toggle-btn {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
}

/* Completely eliminate the white flash and layout shifts */

html,
body,
body.naira-ia-page {
    margin-top: 0 !important;
    padding-top: 0 !important;
    top: 0 !important;
    position: static !important;
}

.goog-te-banner-frame.skiptranslate,
.goog-te-gadget,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-te-menu-value,
.goog-te-menu-frame,
.skiptranslate,
iframe.skiptranslate,
#google_translate_element,
.goog-te-spinner-pos,
.goog-te-spinner,
.goog-te-balloon-text {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    width: 0 !important;
    border: none !important;
    position: absolute !important;
    top: -9999px !important;
}

/* Ensure the translation element is absolutely buried at the bottom */
#google_translate_element {
    position: fixed !important;
    bottom: -1000px !important;
    left: -1000px !important;
    top: auto !important;
}

/* Remove text highlights added by Google */
.goog-text-highlight {
    background: none !important;
    box-shadow: none !important;
}

/* --- LOADER STYLES --- */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loader-wrapper.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    overflow: visible;
}

.loader-header .sector_izq img {
    height: 70px;
    filter: var(--naira-logo-filter);
}

.loader-header .sector_der {
    display: flex;
    align-items: center;
    gap: 15px;
}

.loader-header .language-selector-container {
    position: relative;
    z-index: 10100;
}

.loader-header .lang-dropdown {
    z-index: 10100;
}

.loader-header .lang-options {
    z-index: 10100;
}

.loader-container {
    width: 80%;
    max-width: 400px;
    text-align: center;
}

.loader-logo {
    height: 100px;
    margin-bottom: 30px;
    filter: var(--naira-logo-filter);
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#loader-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

#loader-progress-bar {
    width: 0%;
    height: 100%;
    background: rgb(72, 28, 109);
    border-radius: 10px;
    transition: width 0.1s linear;
}

#loader-status {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 40px;
    min-height: 1.2em;
}

/* Loader Slider and Button Controls */
#loader-slider-container {
    display: none !important;
    position: relative;
    width: 100%;
    max-width: 300px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    margin: 20px auto 0 auto;
    overflow: hidden;
    user-select: none;
}

.loader-btn-desktop {
    display: none !important;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    background: rgb(72, 28, 109);
    color: #ffffff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(72, 28, 109, 0.4);
    margin: 20px auto;
}

.loader-btn-desktop:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(72, 28, 109, 0.6);
    filter: brightness(1.2);
}

@media (min-width: 1025px) {
    #loader-wrapper.loader-ready .loader-btn-desktop-only {
        display: block !important;
    }
}

@media (max-width: 1024px) {
    #loader-wrapper.loader-ready .loader-slider-mobile {
        display: block !important;
    }
}

.slider-text {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0.6;
    padding-left: 50px;
}

#slider-handle {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 50px;
    height: 50px;
    background: rgb(72, 28, 109);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    z-index: 2;
    box-shadow: 0 0 15px rgba(72, 28, 109, 0.4);
    transition: transform 0.1s ease;
}

#slider-handle:active {
    cursor: grabbing;
}

#slider-handle::after {
    content: '➔';
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: bold;
}

.slider-bg-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(72, 28, 109, 0.2);
    width: 0;
    pointer-events: none;
}

/* Dark/Light mode overrides for slider if needed */
[data-theme="light"] #loader-slider-container {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .slider-text {
    color: #000;
}

[data-theme="light"] #slider-handle::after {
    color: #fff;
}

[data-theme="light"] #slider-handle {
    background: rgb(72, 28, 109);
    box-shadow: 0 0 15px rgba(72, 28, 109, 0.4);
}

[data-theme="light"] .slider-bg-progress {
    background: rgba(72, 28, 109, 0.1);
}

/* --- CONFIGURATION BUTTON --- */
.config-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    color: var(--text-color);
}

.config-toggle:hover {
    transform: rotate(45deg);
}

.config-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* --- CONFIGURATION PAGE --- */
.config-container {
    max-width: 1400px;
    width: 96%;
    margin: 40px auto;
    transition: margin 0.3s ease, max-width 0.3s ease;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    color: var(--text-color);
}

.config-container.wide-mode {
    max-width: 98% !important;
    width: 98% !important;
    padding: 20px 30px !important;
}

.config-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
}

.config-section:not(:last-child) {
    border-bottom: 1px solid var(--header-border);
}

.config-section h3 {
    margin-top: 0;
    color: #9cfd33;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recipient-list {
    list-style: none;
    padding: 0;
    padding-inline-start: 0;
    margin: 20px 0;
}

.recipient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--input-bg);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--input-border);
}

.btn-delete-recipient {
    background: none;
    border: none;
    color: #ff453a;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-recipient-group {
    display: flex;
    gap: 10px;
}

.add-recipient-group input {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
}

.btn-add-recipient {
    background: #9cfd33;
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

/* --- PREVENCION TAB --- */
.tab-prevention-content {
    padding: 10px 0;
}

.help-text {
    font-size: 0.85rem;
    color: var(--modal-text-secondary);
    margin-top: 5px;
    display: block;
}

.btn-save-timeout {
    background: #9cfd33;
    color: #000;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}



.config-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 30px;
    border-radius: 18px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.config-section:hover {
    border-color: rgba(156, 253, 51, 0.2);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}

.config-section h3 {
    margin-top: 0;
    color: var(--text-color);
    margin-bottom: 10px;
}

.config-section .help-text {
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 15px;
    font-size: 0.9rem;
    display: block;
}

.config-select {
    width: 100%;
    margin-bottom: 20px;
    background: var(--input-bg);
    color: var(--text-color);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    cursor: pointer;
    font-size: 1rem;
}

[data-theme="light"] .config-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.config-select option {
    background: var(--select-option-bg);
    color: var(--text-color);
}

.recipient-list {
    list-style: none;
    padding: 0;
    padding-inline-start: 0;
    margin: 0 0 20px 0;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--card-bg);
}

.recipient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 15px;
    border-bottom: 1px solid var(--input-border);
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s;
    margin: 0;
}

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

.recipient-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(156, 253, 51, 0.1);
}

.recipient-item span {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 15px;
}

.btn-delete-recipient {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-delete-recipient:hover {
    opacity: 1;
}

.add-recipient-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.add-recipient-group input {
    flex-grow: 1;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 10px;
    border-radius: 8px;
}

.btn-add-recipient {
    background: linear-gradient(135deg, #9cfd33 0%, #7ecb2a 100%);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-save-config {
    background: linear-gradient(135deg, #9cfd33 0%, #7ecb2a 100%);
    color: #000;
    border: none;
    padding: 14px 40px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(156, 253, 51, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-save-config:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px rgba(156, 253, 51, 0.3);
}

.btn-save-config:active {
    transform: scale(0.95);
}

.config-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    gap: 15px;
}

@media (max-width: 600px) {
    .config-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-save-config {
        padding: 12px 20px;
        font-size: 0.95rem;
        width: 100%;
        text-align: center;
    }
}

.config-section label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* Modal configuration overrides */
#modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#custom-modal {
    background: var(--modal-bg);
    padding: 30px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--input-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    color: var(--text-color);
}

.modal-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.modal-text {
    opacity: 0.8;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.modal-btn:active {
    transform: scale(0.95);
}

.modal-btn-primary {
    background: #9cfd33;
    color: #000;
}

.modal-btn-secondary {
    background: var(--button-secondary-bg);
    color: var(--button-secondary-text);
}

.modal-btn-danger {
    background: #ff453a;
    color: #fff;
}

/* --- NEW CONFIGURATION TABS --- */
.config-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.config-tabs .tab-btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 200px;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.config-tabs .tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.config-tabs .tab-btn.active {
    background: rgba(156, 253, 51, 0.1);
    border-color: #9cfd33;
    color: #9cfd33;
    box-shadow: 0 5px 15px rgba(156, 253, 51, 0.2);
}

/* Forzar texto negro en modo claro para los botones de pestañas */
[data-theme="light"] .config-tabs .tab-btn {
    color: #000000 !important;
}

[data-theme="light"] .config-tabs .tab-btn.active {
    background: rgba(156, 253, 51, 0.2);
    border-color: #16a34a;
}

.config-tab-content {
    display: none;
}

.config-tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.registration-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
}

.registration-logs {
    flex: 0.4;
    /* 35% del espacio */
    min-width: 320px;
    padding: 20px !important;
}

.registration-form {
    flex: 1;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.02);
    padding: 20px !important;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 1100px) {
    .registration-layout {
        flex-direction: column;
    }

    .registration-logs,
    .registration-form {
        width: 100%;
        flex: none;
    }
}

.registration-form .form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Forzar 2 columnas en el formulario */
    gap: 15px 25px;
    margin-bottom: 15px;
}

.registration-form .form-group label {
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-weight: 800;
    /* Etiquetas en negrita */
    color: #9cfd33;
}

.registration-form .form-group input,
.registration-form .form-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 12px 18px;
    /* Más padding para que ocupen más */
    font-size: 1rem;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    width: 100%;
    /* Asegurar ancho completo */
    display: block;
}

.registration-form .form-group input:focus,
.registration-form .form-group select:focus {
    border-color: #9cfd33;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(156, 253, 51, 0.1);
}

/* Adaptación para Modo Claro */
[data-theme="light"] .registration-form {
    background: #ffffff;
    border-color: var(--input-border);
}

[data-theme="light"] .registration-form .form-group label {
    color: #16a34a;
    /* Verde más oscuro para lectura en blanco */
}

[data-theme="light"] .registration-form .form-group input,
[data-theme="light"] .registration-form .form-group select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: #000000;
}

[data-theme="light"] .registration-form .form-group input:focus,
[data-theme="light"] .registration-form .form-group select:focus {
    border-color: #16a34a;
    background: #ffffff;
    box-shadow: 0 0 10px rgba(22, 163, 74, 0.1);
}

.registration-form .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .registration-form .form-group input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.btn-small {
    padding: 10px 25px !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
}

/* --- LOGS TABLE --- */
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--input-border);
}

.reg-logs-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
}

.reg-logs-table th,
.reg-logs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--input-border);
}

.reg-logs-table th {
    background: rgba(255, 255, 255, 0.05);
    color: #9cfd33;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.75rem;
}

[data-theme="light"] .reg-logs-table {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .reg-logs-table th {
    background: rgba(0, 0, 0, 0.05);
    color: #16a34a;
}

.status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

[data-theme="light"] .status-badge {
    color: #000000 !important;
}

.status-badge.status-pending {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border: 1px solid #ffa500;
}

.status-badge.status-provisioned {
    background: rgba(156, 253, 51, 0.2);
    color: #9cfd33;
    border: 1px solid #9cfd33;
}

.status-badge.status-error {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
    border: 1px solid #ff453a;
}

/* --- MODAL SUMMARY --- */
.confirm-reg-summary {
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.confirm-reg-summary p {
    margin: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-wrap: wrap;
}

.confirm-reg-summary p:last-child {
    border-bottom: none;
}

.confirm-reg-summary strong {
    color: #9cfd33;
    display: inline-block;
    width: 150px;
    flex-shrink: 0;
}

/* Custom styles for selects to match the theme arrow */
.registration-form select {
    appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px !important;
    padding-right: 35px !important;
}

[data-theme="light"] .registration-form select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
}

.registration-form select option {
    background-color: var(--select-option-bg);
    color: var(--text-color);
}

/* --- MOBILE SPECIFIC FIXES (PHONES) --- */
@media (max-width: 1040px) {

    /* Container constraints to prevent flex items from expanding */
    .registration-layout {
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .registration-logs,
    .registration-form {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 15px !important;
    }

    /* Tab Buttons: Smaller and more compact */
    .config-tabs {
        gap: 10px;
        flex-wrap: wrap;
    }

    .config-tabs .tab-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
        min-width: 140px;
        border-radius: 10px;
        flex: 1 1 auto;
    }

    /* Registration Table: Enforced scrollability */
    .table-responsive {
        margin: 10px 0;
        border-radius: 8px;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        display: block !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
    }

    .reg-logs-table {
        width: 100% !important;
        min-width: 500px !important;
        /* Higher min-width to ensure scrolling is triggered */
        table-layout: auto !important;
    }

    .reg-logs-table th,
    .reg-logs-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Registration Form: One input per row */
    .registration-form .form-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
}

/* --- ANIMACIONES GLOBALES --- */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-spinner {
    margin: 0 auto;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.loader-spinner.blue {
    border-top: 4px solid #3498db;
}

.loader-spinner.orange {
    border-top: 4px solid #f39c12;
}

/* --- ESTILOS DE BOTONES CONTROL REMOTO --- */
.remote-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-top: 30px;
}

.remote-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
    padding: 25px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.remote-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.remote-btn.btn-shutdown {
    border-left: 5px solid #ff453a;
}

.remote-btn.btn-shutdown:hover {
    background-color: rgba(255, 69, 58, 0.15);
    border-color: #ff453a;
}

.remote-btn.btn-reboot {
    border-left: 5px solid #f39c12;
}

.remote-btn.btn-reboot:hover {
    background-color: rgba(243, 156, 18, 0.15);
    border-color: #f39c12;
}

.remote-btn.btn-docker {
    border-left: 5px solid #3498db;
}

.remote-btn.btn-docker:hover {
    background-color: rgba(52, 152, 219, 0.15);
    border-color: #3498db;
}

.remote-btn.btn-backup {
    border-left: 5px solid #28a745;
}

.remote-btn.btn-backup:hover {
    background-color: rgba(40, 167, 69, 0.15);
    border-color: #28a745;
}

.remote-btn span.icon {
    font-size: 2.5rem;
}

@media (max-width: 768px) {
    .remote-grid {
        grid-template-columns: 1fr;
    }
}

/* --- USER MANAGEMENT STYLES --- */
.actions-flex {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-action {
    background: var(--button-secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

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

.btn-action.edit:hover {
    background: rgba(156, 253, 51, 0.2);
    border-color: var(--primary-color);
}

.btn-action.delete:hover {
    background: rgba(255, 69, 58, 0.2);
    border-color: #ff453a;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.status-pending {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa500;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.status-badge.status-provisioned {
    background: rgba(156, 253, 51, 0.2);
    color: #9cfd33;
    border: 1px solid rgba(156, 253, 51, 0.3);
}

.status-badge.status-error {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
    border: 1px solid rgba(255, 69, 58, 0.3);
}

.modal-form .form-group {
    margin-bottom: 20px;
}

.modal-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-form input,
.modal-form select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
}

.btn-small {
    font-size: 0.85rem !important;
}

/* Fix for wide mode in registration */
.config-container.wide-mode {
    max-width: 1400px;
}

@media (max-width: 1024px) {
    .registration-layout {
        flex-direction: column;
    }

    .registration-logs,
    .registration-form {
        width: 100% !important;
    }
}

/* --- MODAL DE CAMBIO DE CONTRASEÑA OBLIGATORIO --- */
#modal-pass-change {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    /* Por encima de todo */
    backdrop-filter: blur(10px);
}

#modal-pass-change.active {
    display: flex;
}

.pass-change-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(156, 253, 51, 0.2);
    text-align: center;
}

.pass-change-content h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.pass-change-content p {
    font-size: 0.9rem;
    margin-bottom: 20px;
    opacity: 0.8;
}

.pass-change-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pass-change-form input {
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.pass-change-form input:focus {
    border-color: var(--primary-color);
}

.btn-confirm-pass {
    background: var(--primary-color);
    color: black;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
}

.btn-confirm-pass:hover {
    transform: translateY(-2px);
    background: #8ae02d;
}

.pass-error-msg {
    color: #ff453a;
    font-size: 0.8rem;
    margin-top: 10px;
    display: none;
}


/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: clamp(220px, 20%, 280px);
    height: 100vh;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    min-height: 60px;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 5px;
    transition: background 0.2s;
}

.sidebar-toggle-btn:hover {
    background: var(--card-hover-bg);
}


.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    background: var(--card-hover-bg);
    color: var(--primary-color);
}

.sidebar-link.active {
    background: var(--nav-active-bg);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.sidebar-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-section-title {
    padding: 8px 20px 4px;
    font-size: 0.65rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
    color: var(--text-color);
    margin-top: 5px;
}

.sidebar-section-title:first-of-type {
    margin-top: 0;
}

/* Sidebar closed: collapse to mini rail (50px) instead of sliding out */
.sidebar-closed .sidebar {
    width: 50px;
    overflow: hidden;
    pointer-events: auto;
}

/* Mini rail: hide labels and section titles, center the toggle button */
.sidebar-closed .sidebar-text,
.sidebar-closed .sidebar-section-title,
.sidebar-closed .sidebar-title {
    display: none;
}

.sidebar-closed .sidebar-header {
    justify-content: center;
    padding: 8px 0;
}

.sidebar-closed .sidebar-link {
    justify-content: center;
    padding: 12px 0;
    border-right: none;
}

.sidebar-closed .sidebar-icon {
    margin: 0;
    font-size: 1.3rem;
}

.sidebar-closed .sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar peek is no longer needed with mini rail */
.sidebar-peek {
    display: none !important;
}

/* ===== SIDEBAR CONTENT PUSHING =====
   Using padding-left on body since sidebar is position:fixed.
   This avoids overflow issues with width:100% children (header, cuerpo, etc.)
   ===================================== */

/* Sidebar open: push body content by full sidebar width */
body.sidebar-present:not(.sidebar-closed) {
    padding-left: calc(clamp(220px, 20%, 280px) + 20px);
    transition: padding-left 0.3s ease;
}

/* Sidebar mini-rail (closed = 50px): push body content by 50px */
body.sidebar-present.sidebar-closed {
    padding-left: 70px;
    transition: padding-left 0.3s ease;
}

/* Config container: center within the padded body area */
body.sidebar-present:not(.sidebar-closed) .config-container,
body.sidebar-present.sidebar-closed .config-container {
    margin-left: auto;
    margin-right: auto;
    width: 96%;
    max-width: 1400px;
    transition: none;
}

/* Config tabs: also centered */
body.sidebar-present:not(.sidebar-closed) .config-tabs,
body.sidebar-present.sidebar-closed .config-tabs {
    margin-left: 0;
    margin-right: 0;
}

/* Mobile: sidebar becomes bottom sheet — handled by @media (max-width: 1040px) block above */
@media (max-width: 1040px) {

    body.sidebar-present:not(.sidebar-closed),
    body.sidebar-present.sidebar-closed {
        padding-left: 0 !important;
    }
}

/* =============================================
   STAT CARDS (Current, Avg, Min, Max)
   ============================================= */
.stats-cards-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 15px 0;
}

.stat-card {
    padding: 15px 12px;
    border-radius: 10px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.stat-current .stat-value {
    color: var(--primary-color);
}

.stat-average .stat-value {
    color: #ffa500;
}

.stat-min .stat-value {
    color: #00bfff;
}

.stat-max .stat-value {
    color: #ff6b6b;
}

@media (max-width: 768px) {
    .stats-cards-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =============================================
   SENSOR TYPE ICONS
   ============================================= */
.sensor-type-icon {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    right: auto !important;
    font-size: 1.1rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
    background: rgba(100, 100, 200, 0.2);
    color: #748ffc;
}

.sensor-type-icon i {
    font-size: 0.95rem;
    line-height: 1;
}

[data-theme="light"] .sensor-type-icon {
    background: rgba(100, 100, 200, 0.15);
    color: #4338ca;
}

/* Push value text below the top-left icon */
.card .valor {
    display: block;
    padding-top: 42px;
    padding-left: 0;
}

.icon-temp {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa94d;
}

.icon-temperature {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa94d;
}

.icon-hum {
    background: rgba(0, 123, 255, 0.2);
    color: #4dabf7;
}

.icon-humidity {
    background: rgba(0, 123, 255, 0.2);
    color: #4dabf7;
}

.icon-nutri {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-nutrient {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-npk {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-nitrogen {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-phosphorus {
    background: rgba(255, 69, 58, 0.2);
    color: #ff6b6b;
    font-weight: bold;
    font-size: 0.8rem;
}

.icon-potassium {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-ph {
    background: rgba(255, 69, 58, 0.2);
    color: #ff6b6b;
    font-weight: bold;
    font-size: 0.8rem;
}

.icon-wind {
    background: rgba(0, 255, 255, 0.15);
    color: #66d9e8;
}

.icon-wind_speed {
    background: rgba(0, 255, 255, 0.15);
    color: #66d9e8;
}

.icon-rain {
    background: rgba(100, 149, 237, 0.2);
    color: #74c0fc;
}

.icon-rainfall {
    background: rgba(100, 149, 237, 0.2);
    color: #74c0fc;
}

.icon-solar {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd43b;
}

.icon-solar_radiation {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd43b;
}

.icon-level {
    background: rgba(0, 200, 150, 0.2);
    color: #38d9a9;
}

.icon-water_level {
    background: rgba(0, 200, 150, 0.2);
    color: #38d9a9;
}

.icon-valve {
    background: rgba(0, 200, 200, 0.2);
    color: #38d9a9;
    font-weight: bold;
    font-size: 0.9rem;
}

.icon-valve_state {
    background: rgba(0, 200, 200, 0.2);
    color: #38d9a9;
    font-weight: bold;
    font-size: 0.9rem;
}

.icon-conductivity {
    background: rgba(100, 100, 200, 0.2);
    color: #748ffc;
}

.icon-ec {
    background: rgba(100, 100, 200, 0.2);
    color: #748ffc;
}

.icon-battery {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd43b;
}

.icon-pulse_counter {
    background: rgba(100, 200, 255, 0.2);
    color: #66d9e8;
}

.icon-pressure {
    background: rgba(0, 150, 255, 0.2);
    color: #4dabf7;
}

.icon-co2 {
    background: rgba(0, 200, 200, 0.2);
    color: #38d9a9;
}

.icon-smoke {
    background: rgba(0, 200, 200, 0.2);
    color: #38d9a9;
}

.icon-default {
    background: rgba(100, 100, 200, 0.2);
    color: #748ffc;
}

/* ---- Spanish / variant type_sensor aliases ---- */
.icon-humedad,
.icon-humedadsuelo,
.icon-humedads {
    background: rgba(0, 123, 255, 0.2);
    color: #4dabf7;
}

.icon-temperatura,
.icon-tempsuelo,
.icon-temps {
    background: rgba(255, 165, 0, 0.2);
    color: #ffa94d;
}

.icon-nitrogeno,
.icon-nitrogenos {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-fosforo,
.icon-fosforos {
    background: rgba(255, 69, 58, 0.2);
    color: #ff6b6b;
    font-weight: bold;
    font-size: 0.8rem;
}

.icon-potasio,
.icon-potasios {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-nutriente,
.icon-nutrientes {
    background: rgba(144, 19, 254, 0.2);
    color: #b197fc;
    font-weight: bold;
    font-size: 0.85rem;
}

.icon-viento,
.icon-velviento,
.icon-dirviento {
    background: rgba(0, 255, 255, 0.15);
    color: #66d9e8;
}

.icon-lluvia {
    background: rgba(100, 149, 237, 0.2);
    color: #74c0fc;
}

.icon-radiacion,
.icon-radiacsolar {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd43b;
}

.icon-nivel,
.icon-nivels {
    background: rgba(0, 200, 150, 0.2);
    color: #38d9a9;
}

.icon-valvula,
.icon-valvulas {
    background: rgba(0, 200, 200, 0.2);
    color: #38d9a9;
}

.icon-conductividad {
    background: rgba(100, 100, 200, 0.2);
    color: #748ffc;
}

.icon-bateria {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd43b;
}

.icon-contador,
.icon-pulsos {
    background: rgba(100, 200, 255, 0.2);
    color: #66d9e8;
}

.icon-presion {
    background: rgba(0, 150, 255, 0.2);
    color: #4dabf7;
}

.icon-caudal,
.icon-caudalactual,
.icon-caudaltotal {
    background: rgba(63, 81, 181, 0.2);
    color: #7986cb;
}

.icon-humo {
    background: rgba(0, 200, 200, 0.2);
    color: #38d9a9;
}

/* ---- Light mode icon colors ---- */
[data-theme="light"] .icon-temp,
[data-theme="light"] .icon-temperature {
    background: rgba(255, 165, 0, 0.18);
    color: #e67e00;
}

[data-theme="light"] .icon-hum,
[data-theme="light"] .icon-humidity {
    background: rgba(0, 123, 255, 0.15);
    color: #0062cc;
}

[data-theme="light"] .icon-nutri,
[data-theme="light"] .icon-nutrient,
[data-theme="light"] .icon-npk,
[data-theme="light"] .icon-nitrogen,
[data-theme="light"] .icon-potassium {
    background: rgba(144, 19, 254, 0.15);
    color: #7013ce;
}

[data-theme="light"] .icon-phosphorus,
[data-theme="light"] .icon-ph {
    background: rgba(255, 69, 58, 0.15);
    color: #c92a2a;
}

[data-theme="light"] .icon-wind,
[data-theme="light"] .icon-wind_speed {
    background: rgba(0, 255, 255, 0.12);
    color: #0891b2;
}

[data-theme="light"] .icon-rain,
[data-theme="light"] .icon-rainfall {
    background: rgba(100, 149, 237, 0.15);
    color: #2563eb;
}

[data-theme="light"] .icon-solar,
[data-theme="light"] .icon-solar_radiation {
    background: rgba(255, 215, 0, 0.15);
    color: #ca8a04;
}

[data-theme="light"] .icon-level,
[data-theme="light"] .icon-water_level {
    background: rgba(0, 200, 150, 0.15);
    color: #059669;
}

[data-theme="light"] .icon-valve,
[data-theme="light"] .icon-valve_state {
    background: rgba(0, 200, 200, 0.18);
    color: #0d9488;
}

[data-theme="light"] .icon-conductivity,
[data-theme="light"] .icon-ec {
    background: rgba(100, 100, 200, 0.15);
    color: #4338ca;
}

[data-theme="light"] .icon-battery {
    background: rgba(255, 215, 0, 0.2);
    color: #a16207;
}

[data-theme="light"] .icon-pulse_counter {
    background: rgba(100, 200, 255, 0.15);
    color: #0284c7;
}

[data-theme="light"] .icon-pressure {
    background: rgba(0, 150, 255, 0.15);
    color: #1d4ed8;
}

[data-theme="light"] .icon-co2,
[data-theme="light"] .icon-smoke {
    background: rgba(0, 200, 200, 0.15);
    color: #0d9488;
}

[data-theme="light"] .icon-default {
    background: rgba(100, 100, 200, 0.15);
    color: #4338ca;
}

/* ---- Light mode: Spanish variant overrides ---- */
[data-theme="light"] .icon-humedad,
[data-theme="light"] .icon-humedadsuelo,
[data-theme="light"] .icon-humedads {
    background: rgba(0, 123, 255, 0.15);
    color: #0062cc;
}

[data-theme="light"] .icon-temperatura,
[data-theme="light"] .icon-tempsuelo,
[data-theme="light"] .icon-temps {
    background: rgba(255, 165, 0, 0.18);
    color: #e67e00;
}

[data-theme="light"] .icon-nitrogeno,
[data-theme="light"] .icon-nitrogenos {
    background: rgba(144, 19, 254, 0.15);
    color: #7013ce;
}

[data-theme="light"] .icon-fosforo,
[data-theme="light"] .icon-fosforos {
    background: rgba(255, 69, 58, 0.15);
    color: #c92a2a;
}

[data-theme="light"] .icon-potasio,
[data-theme="light"] .icon-potasios {
    background: rgba(144, 19, 254, 0.15);
    color: #7013ce;
}

[data-theme="light"] .icon-nutriente,
[data-theme="light"] .icon-nutrientes {
    background: rgba(144, 19, 254, 0.15);
    color: #7013ce;
}

[data-theme="light"] .icon-viento,
[data-theme="light"] .icon-velviento,
[data-theme="light"] .icon-dirviento {
    background: rgba(0, 255, 255, 0.12);
    color: #0891b2;
}

[data-theme="light"] .icon-lluvia {
    background: rgba(100, 149, 237, 0.15);
    color: #2563eb;
}

[data-theme="light"] .icon-radiacion,
[data-theme="light"] .icon-radiacsolar {
    background: rgba(255, 215, 0, 0.15);
    color: #ca8a04;
}

[data-theme="light"] .icon-nivel,
[data-theme="light"] .icon-nivels {
    background: rgba(0, 200, 150, 0.15);
    color: #059669;
}

[data-theme="light"] .icon-valvula,
[data-theme="light"] .icon-valvulas {
    background: rgba(0, 200, 200, 0.15);
    color: #0d9488;
}

[data-theme="light"] .icon-conductividad {
    background: rgba(100, 100, 200, 0.15);
    color: #4338ca;
}

[data-theme="light"] .icon-bateria {
    background: rgba(255, 215, 0, 0.2);
    color: #a16207;
}

[data-theme="light"] .icon-contador,
[data-theme="light"] .icon-pulsos {
    background: rgba(100, 200, 255, 0.15);
    color: #0284c7;
}

[data-theme="light"] .icon-presion {
    background: rgba(0, 150, 255, 0.15);
    color: #1d4ed8;
}

[data-theme="light"] .icon-caudal,
[data-theme="light"] .icon-caudalactual,
[data-theme="light"] .icon-caudaltotal {
    background: rgba(63, 81, 181, 0.15);
    color: #303f9f;
}

[data-theme="light"] .icon-humo {
    background: rgba(0, 200, 200, 0.15);
    color: #0d9488;
}

/* =============================================
   SYSTEM STATUS
   ============================================= */
.system-status-title {
    font-size: 0.85rem;
    font-weight: bold;
    margin-top: 25px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    width: 100%;
}

.system-status-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.system-status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.system-status-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.6;
}

.system-status-value {
    font-size: 1rem;
    font-weight: bold;
}

.status-online {
    color: var(--primary-color);
}

.status-offline {
    color: #ff453a;
}

@media (max-width: 768px) {
    .system-status-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* =============================================
   DISPOSITIVOS PAGE
   ============================================= */
.dispositivos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.dispositivo-card {
    padding: 20px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.dispositivo-card:hover {
    transform: translateY(-3px);
}

.dispositivo-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.dispositivo-detail {
    font-size: 0.85rem;
    margin: 5px 0;
    opacity: 0.85;
}

.dispositivo-detail strong {
    opacity: 1;
}

.dispositivo-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 8px;
}

.disp-status-activo {
    background: rgba(156, 253, 51, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.disp-status-inactivo {
    background: rgba(255, 69, 58, 0.2);
    color: #ff453a;
    border: 1px solid #ff453a;
}

/* =============================================
   HISTORICO PAGE
   ============================================= */
.historico-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.historico-controls button {
    background: var(--button-secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 14px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.historico-controls button.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
}

.historico-controls button:hover:not(.active) {
    border-color: var(--primary-color);
}

.sensor-toggle-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 10px;
}

.sensor-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    opacity: 0.5;
}

.sensor-toggle-btn.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.sensor-toggle-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* =============================================
   ALERTAS PAGE
   ============================================= */
.alertas-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.alerta-item {
    padding: 15px;
    border-radius: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.alerta-item .sensor-name {
    font-weight: bold;
    min-width: 120px;
}

.alerta-item label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-right: 5px;
}

.alerta-item input[type="number"] {
    width: 80px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
}

.alerta-item .btn-save-alert {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    background: var(--primary-color);
    color: #000;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: auto;
}

/* --- ESTILOS PÁGINA DE LOGIN --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, var(--header-bg) 0%, var(--bg-color) 100%) !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Outfit', sans-serif;
}

.top-controls {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
    z-index: 10001;
}

.login-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(156, 253, 51, 0.2);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.login-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.login-logos img {
    height: 50px;
    object-fit: contain;
}

.login-branding h1 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -1px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-branding p {
    font-size: 1rem;
    opacity: 0.7;
    margin-bottom: 35px;
    color: var(--text-color);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group-login {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-login label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-left: 5px;
}

.form-group-login input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 12px 15px;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group-login input:focus {
    border-color: var(--primary-color);
    background: var(--card-hover-bg);
    box-shadow: 0 0 15px rgba(156, 253, 51, 0.1);
}

.btn-login {
    background: var(--primary-color);
    color: black;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(156, 253, 51, 0.3);
    background: #8ae02d;
}

.login-footer {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.login-error {
    background: rgba(255, 69, 58, 0.1);
    color: #ff453a;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: none;
}

/* --- TOGGLE VISIBILIDAD PASSWORD --- */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 45px !important;
    /* Espacio para el icono */
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    padding: 5px;
}

.toggle-password svg {
    display: block;
    pointer-events: none;
}

.toggle-password:hover {
    color: var(--primary-color);
}

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

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

/* --- USER DROPDOWN MENU --- */
.user-menu-container {
    position: relative;
    display: inline-block;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px var(--shadow-color);
    margin-top: 10px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: dropdownFadeIn 0.3s ease;
}

.user-dropdown.active {
    display: flex;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.user-dropdown a,
.user-dropdown button {
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    width: 100%;
    font-family: inherit;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: rgba(156, 253, 51, 0.1);
    color: var(--primary-color);
}

.user-dropdown button {
    border-top: 1px solid var(--border-color);
    color: #ff453a;
}

.user-dropdown button:hover {
    background: rgba(255, 69, 58, 0.1);
    color: #ff453a;
}

[data-theme="light"] .user-dropdown {
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .user-dropdown a,
[data-theme="light"] .user-dropdown button {
    color: #333;
}

[data-theme="light"] .user-dropdown a:hover {
    background: rgba(22, 163, 74, 0.05);
    color: #16a34a;
}

/* --- PARCEL INTELLIGENCE --- */
.parcel-intelligence-page #map {
    height: calc(100vh - 200px);
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    z-index: 1;
    border: 1px solid var(--border-color);
}

.parcel-intelligence-page .cuerpo {
    position: relative;
    width: 100%;
}

.parcel-intelligence-page .panel {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 1000;
    background: var(--modal-bg);
    padding: 20px;
    border-radius: 15px;
    width: 320px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px var(--shadow-color);
    backdrop-filter: blur(10px);
    color: var(--text-color);
}

.parcel-intelligence-page .panel h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.parcel-intelligence-page .panel p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.parcel-intelligence-page .panel button {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s;
}

.parcel-intelligence-page .panel button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(156, 253, 51, 0.3);
}

/* Mobile fix for Parcel Intelligence — legacy rules, superseded by inline styles in parcel_intelligence.html */
@media (max-width: 768px) {
    .parcel-intelligence-page .panel {
        display: none;
        /* old floating panel no longer used */
    }
}

@keyframes slideUpMobile {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* --- DISPOSITIVOS PAGE --- */
.dispositivos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 30px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    overflow-x: hidden;
}

.dispositivo-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.dispositivo-card:hover {
    background: var(--card-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-color);
}

.dispositivo-image-placeholder {
    height: 140px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 8px;
}

.placeholder-icon {
    font-size: 2.5rem;
}

.placeholder-text {
    font-size: 0.8rem;
    opacity: 0.7;
}

.dispositivo-info h3 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1.15rem;
}

.dispositivo-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

[data-theme="light"] .dispositivo-image-placeholder {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}

/* =============================================
   BOOTSTRAP ICONS — NAV BAR & SIDEBAR
   ============================================= */

/* Nav bar Bootstrap icons (top horizontal bar) */
.nav-bi-icon {
    font-size: 1.4rem;
    display: block;
    line-height: 1;
    /* Dark mode default: white */
    color: #ffffff;
    transition: color 0.2s ease;
}

/* Light mode: dark/neutral color */
[data-theme="light"] .nav-bi-icon {
    color: #2d3748;
}

/* Sidebar Bootstrap icons */
.sidebar-icon .bi {
    font-size: 1.2rem;
    line-height: 1;
    /* Dark mode default: white */
    color: #ffffff;
    transition: color 0.2s ease;
}

/* Sidebar light mode */
[data-theme="light"] .sidebar-icon .bi {
    color: #2d3748;
}

/* Active sidebar link — keep accent color */
.sidebar-link.active .sidebar-icon .bi {
    color: var(--primary-color);
}

/* Nav button h2 containing a bi icon — center it like emoji */
.contenedor-navegacion button .nav-bi-icon,
.contenedor-navegacion .row button .nav-bi-icon {
    margin: 0 auto 2px auto;
}

/* =============================================
   MOBILE SIDEBAR OVERRIDE — FINAL (must come after desktop .sidebar)
   Fixes cascade: desktop rules at line 4039+ override mobile at line 2505+
   ============================================= */
@media (max-width: 1040px) {

    /* ---- Base sidebar: force bottom sheet layout ---- */
    .sidebar,
    .sidebar-closed .sidebar {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: 70vh;
        border-right: none !important;
        border-top: 1px solid var(--border-color);
        border-radius: 18px 18px 0 0;
        z-index: 4000;
        transform: translateY(calc(100% - 52px));
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.35);
    }

    /* ---- Drag handle ---- */
    .sidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 6px auto 4px auto;
        flex-shrink: 0;
    }

    [data-theme="light"] .sidebar::before {
        background: rgba(0, 0, 0, 0.15);
    }

    /* ---- Open state ---- */
    .sidebar.sidebar-mobile-open {
        transform: translateY(0);
        overflow-y: auto;
    }

    /* ---- Hide hamburger on mobile ---- */
    .sidebar-toggle-btn {
        display: none !important;
    }

    /* ---- Closed state: icon strip at top ---- */
    .sidebar:not(.sidebar-mobile-open) .sidebar-header {
        order: 2;
        min-height: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        border-bottom: none !important;
        overflow: hidden;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-title {
        display: none !important;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-section-title {
        display: none !important;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-nav {
        order: 1;
        display: flex !important;
        flex-direction: row !important;
        padding: 4px 8px 6px;
        flex: 0 0 auto;
        overflow-x: auto;
        gap: 4px;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-link {
        flex-direction: column;
        padding: 4px 8px;
        gap: 2px;
        min-width: 44px;
        justify-content: center;
        align-items: center;
        border-right: none;
        border-radius: 8px;
        margin: 0;
        pointer-events: none;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-text {
        display: none !important;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-icon {
        font-size: 1.35rem;
        margin: 0;
        width: auto;
    }

    .sidebar:not(.sidebar-mobile-open) .sidebar-icon .bi {
        font-size: 1.35rem;
    }

    /* ---- Open state: restore vertical layout ---- */
    .sidebar.sidebar-mobile-open .sidebar-header {
        order: 0;
        min-height: 38px !important;
        height: auto !important;
        padding: 15px !important;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: space-between;
        align-items: center;
        overflow: visible;
    }

    .sidebar.sidebar-mobile-open .sidebar-title {
        display: block !important;
    }

    .sidebar.sidebar-mobile-open .sidebar-section-title {
        display: block !important;
    }

    .sidebar.sidebar-mobile-open .sidebar-nav {
        order: 0;
        display: flex;
        flex-direction: column;
        padding: 6px 0;
        flex: 1;
    }

    .sidebar.sidebar-mobile-open .sidebar-link {
        flex-direction: row;
        padding: 10px 20px;
        justify-content: flex-start;
        gap: 12px;
        border-right: none;
        border-radius: 0;
        pointer-events: auto;
    }

    .sidebar.sidebar-mobile-open .sidebar-icon {
        font-size: 1.3rem;
        width: 24px;
        margin: 0;
    }

    .sidebar.sidebar-mobile-open .sidebar-icon .bi {
        font-size: 1.3rem;
    }

    /* ---- Body padding ---- */
    body.sidebar-present:not(.sidebar-closed),
    body.sidebar-present.sidebar-closed {
        padding-left: 0 !important;
        padding-bottom: 52px !important;
    }

    /* ---- Overlay ---- */
    .sidebar-mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 3999;
        backdrop-filter: blur(2px);
    }

    .sidebar-mobile-overlay.active {
        display: block;
    }

    /* ---- Desktop sidebar rules that must be neutralized ---- */
    .sidebar-closed .sidebar-text,
    .sidebar-closed .sidebar-section-title,
    .sidebar-closed .sidebar-title {
        display: block !important;
    }

    .sidebar-closed .sidebar-link {
        justify-content: flex-start;
        padding: 12px 20px;
        border-right: none;
    }

    .sidebar-closed .sidebar-icon {
        margin: 0;
        width: 24px;
        font-size: 1.2rem;
    }

    .sidebar-closed .sidebar-toggle-btn {
        display: none !important;
    }

    /* ---- Config pages centering ---- */
    body.sidebar-present:not(.sidebar-closed) .config-container,
    body.sidebar-present.sidebar-closed .config-container {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    body.sidebar-present:not(.sidebar-closed) .config-tabs,
    body.sidebar-present.sidebar-closed .config-tabs {
        margin-left: 0;
        margin-right: 0;
    }
}

/* =============================================
   DEV SENSORS TAB AND MODALS
   ============================================= */
#section-dev-sensores {
    display: none;
}

#section-dev-sensores.active {
    display: block;
}

.dev-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 12, 16, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.dev-modal-content {
    background: var(--card-bg, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    width: 95%;
    max-width: 500px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: var(--text-primary, #fff);
}

.dev-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color, #333);
    padding-bottom: 12px;
}

.dev-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-color, #9cfd33);
}

.dev-modal-body {
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.dev-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color, #333);
    padding-top: 15px;
}

.dev-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    border: none;
}

.dev-modal-btn:hover {
    opacity: 0.9;
}

.dev-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #fff);
}

.dev-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.dev-modal-btn-confirm {
    background: var(--primary-color, #9cfd33);
    color: #000;
}

[data-theme="light"] .dev-modal-btn-confirm {
    background: #16a34a;
    color: #fff;
}

.dev-modal-btn-danger {
    background: #ff453a;
    color: #fff;
}

.dev-modal-form-group {
    margin-bottom: 15px;
}

.dev-modal-form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
}

.dev-modal-input,
.dev-modal-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color, #333);
    color: var(--text-primary, #fff);
    font-size: 0.95rem;
}

[data-theme="light"] .dev-modal-input,
[data-theme="light"] .dev-modal-select {
    background: #fff;
    color: #333;
}

.dev-modal-diff-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border-color, #333);
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

[data-theme="light"] .dev-modal-diff-box {
    background: rgba(0, 0, 0, 0.02);
}

.dev-modal-diff-item {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.dev-modal-diff-item:last-child {
    margin-bottom: 0;
}

/* Adaptación responsive para la tabla DEV de sensores en móvil */
.dev-sensors-desktop-view {
    display: block;
}

.dev-sensors-mobile-view {
    display: none;
}

@media (max-width: 768px) {
    .dev-sensors-desktop-view {
        display: none !important;
    }

    .dev-sensors-mobile-view {
        display: flex !important;
        flex-direction: column;
        gap: 15px;
    }
}

.dev-card-btn {
    flex: 1;
    padding: 10px 0 !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    text-transform: uppercase !important;
    text-align: center !important;
    border: none !important;
    cursor: pointer !important;
    margin: 0 !important;
    float: none !important;
    width: auto !important;
    height: auto !important;
    transition: transform 0.15s, opacity 0.15s;
}

.dev-card-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

/* =======================================================
   LANDING PAGE – WATER CHALLENGE LEAGUE
   Estilos movidos desde index.html
   ======================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.landing-body {
    background: radial-gradient(ellipse at 50% 0%, #0a2a4a 0%, #050d1a 60%);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ─── HEADER ─── */
.landing-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 3rem;
    background: rgba(5, 13, 26, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(0, 180, 216, 0.18);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 0.75rem;
}

.header-logo {
    height: 54px;
    width: auto;
    display: block;
    transition: transform 0.3s ease;
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-logo-text {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 54px;
    font-weight: 800;
    font-size: 0.82rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #00b4d8 0%, #9cfd33 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    box-sizing: border-box;
    padding: 3px 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.landing-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.landing-nav a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.4rem 0;
    letter-spacing: 0.3px;
}

.landing-nav a:hover,
.landing-nav a.active {
    color: #00b4d8;
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.4);
}

.landing-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #00b4d8;
    box-shadow: 0 0 8px #00b4d8;
    transition: width 0.3s ease;
}

.landing-nav a:hover::after,
.landing-nav a.active::after {
    width: 100%;
}

.landing-header a.btn-access {
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: #ffffff !important;
    border: none;
    padding: 0.6rem 1.8rem !important;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-shadow: none !important;
}

.landing-header a.btn-access::after {
    display: none !important;
}

.landing-header a.btn-access:hover {
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5);
    background: linear-gradient(135deg, #00c4e8 0%, #0088c6 100%);
}

/* ─── MAIN WRAPPER ─── */
.landing-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* ─── HERO SECTION ─── */
.hero-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    align-items: center;
    min-height: 340px;
    padding: 1.5rem 3rem 1rem 3rem;
    position: relative;
    overflow: visible;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 100, 160, 0.18) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(0, 60, 120, 0.12) 0%, transparent 60%);
    pointer-events: none;
}

/* --- MAP COLUMN --- */
.hero-map-col {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-container {
    position: relative;
    width: 100%;
    max-width: 440px;
}

.map-canvas-wrapper {
    position: relative;
    width: 100%;
}

#mapCanvas {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 0 16px rgba(0, 210, 240, 0.65)) drop-shadow(0 0 40px rgba(0, 140, 195, 0.35));
}

.map-pins {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.map-pin {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -100%);
    animation: pinFloat 3s ease-in-out infinite;
}

.map-pin:nth-child(2) {
    animation-delay: 0.5s;
}

.map-pin:nth-child(3) {
    animation-delay: 1s;
}

.map-pin:nth-child(4) {
    animation-delay: 1.5s;
}

.map-pin:nth-child(5) {
    animation-delay: 2s;
}

.map-pin:nth-child(6) {
    animation-delay: 0.3s;
}

.map-pin:nth-child(7) {
    animation-delay: 0.8s;
}

.map-pin:nth-child(8) {
    animation-delay: 1.3s;
}

@keyframes pinFloat {

    0%,
    100% {
        transform: translate(-50%, -100%) translateY(0);
    }

    50% {
        transform: translate(-50%, -100%) translateY(-6px);
    }
}

.pin-ripple {
    width: 8px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0, 200, 255, 0.5) 0%, transparent 70%);
    margin-top: -2px;
}

/* --- HERO CENTER COL --- */
.hero-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
    z-index: 1;
}

.hero-title {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 1.5rem 0;
    background: linear-gradient(180deg, #ffffff 0%, #a8d8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-title span {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: none;
    color: rgba(255, 255, 255, 0.6);
    -webkit-text-fill-color: rgba(255, 255, 255, 0.6);
    background: none;
    margin-bottom: 0.2rem;
    letter-spacing: 0;
}

.hero-counter-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 0.4rem;
}

.hero-counter {
    font-size: 4rem;
    font-weight: 900;
    color: #00e5ff;
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.6), 0 0 60px rgba(0, 180, 216, 0.3);
    letter-spacing: 2px;
    line-height: 1;
    margin: 0.2rem 0;
    font-variant-numeric: tabular-nums;
}

.hero-counter-unit {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.3rem;
}

/* --- CUBE COLUMN --- */
.hero-cube-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cube-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Glow ring behind cube */
.cube-glow {
    position: absolute;
    inset: -24px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 160, 210, 0.18) 0%, transparent 68%);
    pointer-events: none;
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.65;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ── HOLOGRAPHIC CUBE ──
   rotateX(-22deg) rotateY(-45deg) gives a perfect isometric view:
   the FRONT face appears on the LEFT, the RIGHT face appears on the RIGHT,
   and the TOP face is visible — matching the reference screenshot.
*/
.holo-cube {
    width: 220px;
    height: 220px;
    position: relative;
    perspective: 600px;
}

.holo-cube-inner {
    width: 155px;
    height: 155px;
    position: absolute;
    top: 32px;
    left: 32px;
    transform-style: preserve-3d;
    /* Isometric: front face (left) + right face (right) + top — no rotation animation */
    transform: rotateX(-22deg) rotateY(-45deg);
}

/* ── CUBE FACES ── */
.holo-face {
    position: absolute;
    width: 155px;
    height: 155px;
    border: 1.8px solid rgba(0, 215, 255, 0.78);
    /* Very transparent glass — lets the water glow shine through */
    background: rgba(0, 20, 50, 0.06);
    overflow: hidden;
    box-shadow:
        inset 0 0 30px rgba(0, 210, 255, 0.10),
        0 0 12px rgba(0, 200, 255, 0.08);
}

/* ── ANIMATED WAVE CANVAS ── */
.face-wave-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    object-fit: fill;
}

.face-wave-top {
    top: 0;
    height: 100%;
}

/* Face transforms */
.holo-face.f-front {
    transform: translateZ(77.5px);
}

.holo-face.f-back {
    transform: rotateY(180deg) translateZ(77.5px);
}

.holo-face.f-right {
    transform: rotateY(90deg) translateZ(77.5px);
}

.holo-face.f-left {
    transform: rotateY(-90deg) translateZ(77.5px);
}

.holo-face.f-top {
    transform: rotateX(90deg) translateZ(77.5px);
    background: rgba(0, 50, 100, 0.10);
}

.holo-face.f-bottom {
    transform: rotateX(-90deg) translateZ(77.5px);
    background: rgba(0, 90, 158, 0.72);
    border-color: rgba(0, 200, 255, 0.55);
}

/* Top face: canvas handles the full caustic shimmer */
.holo-face.f-top .face-wave-canvas {
    height: 100%;
    top: 0;
    bottom: unset;
}

/* Bottom: no water needed */

/* Text centered vertically across the full face */
.face-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 0 10px;
}

/* Front face: 60% */
.face-pct {
    font-size: 2.7rem;
    font-weight: 900;
    line-height: 1;
    color: #00e5ff;
    text-shadow:
        0 0 18px rgba(0, 229, 255, 1),
        0 2px 6px rgba(0, 0, 0, 0.95);
}

.face-sublabel {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(210, 248, 255, 0.95);
    text-align: center;
    line-height: 1.35;
    margin-top: 3px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Right face: 380 */
.face-num {
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    color: #00e5ff;
    text-shadow:
        0 0 14px rgba(0, 229, 255, 1),
        0 2px 6px rgba(0, 0, 0, 0.95);
}

.face-desc {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(210, 248, 255, 0.95);
    text-align: center;
    line-height: 1.5;
    margin-top: 3px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.cube-label-bottom {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.8px;
    color: rgba(0, 200, 255, 0.55);
    white-space: nowrap;
    margin-top: 26px;
    text-align: center;
}

/* ─── BOTTOM SECTION: LÍDERES + CARTAS ─── */
.bottom-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1rem 3rem 2rem 3rem;
}

.section-card {
    background: rgba(5, 20, 45, 0.55);
    border: 1px solid rgba(0, 180, 216, 0.18);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(10px);
}

.section-card-title {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: rgba(180, 220, 255, 0.8);
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.section-card-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: #00b4d8;
    text-align: center;
    margin: 0 0 1.2rem 0;
}

.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 1rem;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.podium-island {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    position: relative;
    margin-bottom: 0.2rem;
}

.podium-item:nth-child(1) {
    order: 2;
}

.podium-item:nth-child(2) {
    order: 1;
}

.podium-item:nth-child(3) {
    order: 3;
}

.podium-item:nth-child(1) .podium-island {
    width: 88px;
    height: 88px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 140, 0, 0.1));
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.25), inset 0 0 15px rgba(255, 215, 0, 0.1);
}

.podium-item:nth-child(2) .podium-island {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.12), rgba(128, 128, 128, 0.08));
    border: 2px solid rgba(192, 192, 192, 0.4);
    box-shadow: 0 0 14px rgba(192, 192, 192, 0.18), inset 0 0 10px rgba(192, 192, 192, 0.08);
}

.podium-item:nth-child(3) .podium-island {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.12), rgba(139, 69, 19, 0.08));
    border: 2px solid rgba(205, 127, 50, 0.4);
    box-shadow: 0 0 12px rgba(205, 127, 50, 0.18), inset 0 0 10px rgba(205, 127, 50, 0.08);
}

.podium-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 900;
}

.podium-item:nth-child(1) .podium-badge {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #0c1a30;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

.podium-item:nth-child(2) .podium-badge {
    background: linear-gradient(135deg, #c0c0c0, #808080);
    color: #0c1a30;
}

.podium-item:nth-child(3) .podium-badge {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: #fff;
}

.podium-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    max-width: 90px;
    line-height: 1.2;
}

.podium-score {
    font-size: 0.68rem;
    color: rgba(0, 180, 216, 0.8);
    font-weight: 500;
}

/* ─── CARTAS COLECTIVAS ─── */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.game-card {
    background: rgba(5, 15, 35, 0.7);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-4px);
}

.game-card.knowledge {
    border: 1.5px solid rgba(255, 180, 0, 0.55);
    box-shadow: 0 0 18px rgba(255, 160, 0, 0.12), inset 0 0 20px rgba(255, 140, 0, 0.05);
}

.game-card.knowledge:hover {
    box-shadow: 0 8px 28px rgba(255, 160, 0, 0.22), inset 0 0 20px rgba(255, 140, 0, 0.08);
}

.game-card.exploration {
    border: 1.5px solid rgba(200, 100, 255, 0.5);
    box-shadow: 0 0 18px rgba(180, 80, 255, 0.1), inset 0 0 20px rgba(160, 60, 255, 0.05);
}

.game-card.exploration:hover {
    box-shadow: 0 8px 28px rgba(180, 80, 255, 0.2), inset 0 0 20px rgba(160, 60, 255, 0.08);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.game-card.knowledge::before {
    background: linear-gradient(90deg, transparent, rgba(255, 180, 0, 0.9), transparent);
}

.game-card.exploration::before {
    background: linear-gradient(90deg, transparent, rgba(200, 100, 255, 0.9), transparent);
}

.game-card-num {
    position: absolute;
    top: 0.6rem;
    left: 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
}

.game-card-type {
    position: absolute;
    top: 0.6rem;
    right: 0.7rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.game-card.knowledge .game-card-type {
    color: rgba(255, 200, 50, 0.8);
}

.game-card.exploration .game-card-type {
    color: rgba(200, 130, 255, 0.8);
}

.game-card-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-top: 0.8rem;
    position: relative;
}

.game-card.knowledge .game-card-icon {
    background: radial-gradient(circle, rgba(255, 160, 0, 0.2), rgba(255, 100, 0, 0.05));
    border: 2px solid rgba(255, 180, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 160, 0, 0.25);
}

.game-card.exploration .game-card-icon {
    background: radial-gradient(circle, rgba(180, 80, 255, 0.2), rgba(100, 0, 200, 0.05));
    border: 2px solid rgba(200, 100, 255, 0.4);
    box-shadow: 0 0 15px rgba(180, 80, 255, 0.25);
}

.game-card-name {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    text-align: center;
    line-height: 1.2;
}

.game-card-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin: 0.1rem 0;
}

.game-card-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-card.knowledge .game-card-progress-bar {
    background: linear-gradient(90deg, #ff8c00, #ffd700);
    box-shadow: 0 0 6px rgba(255, 180, 0, 0.5);
}

.game-card.exploration .game-card-progress-bar {
    background: linear-gradient(90deg, #8b00ff, #da70d6);
    box-shadow: 0 0 6px rgba(200, 100, 255, 0.5);
}

.game-card-progress-text {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.game-card-btn {
    display: inline-block;
    padding: 0.35rem 1.2rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    margin-top: 0.1rem;
}

.game-card.knowledge .game-card-btn {
    background: linear-gradient(135deg, #ff8c00, #ffd700);
    color: #1a0a00;
}

.game-card.knowledge .game-card-btn:hover {
    box-shadow: 0 4px 12px rgba(255, 180, 0, 0.4);
    transform: scale(1.05);
}

.game-card.exploration .game-card-btn {
    background: linear-gradient(135deg, #8b00ff, #da70d6);
    color: #fff;
}

.game-card.exploration .game-card-btn:hover {
    box-shadow: 0 4px 12px rgba(200, 100, 255, 0.4);
    transform: scale(1.05);
}

/* ─── FOOTER ─── */
.landing-footer {
    background: rgba(3, 10, 22, 0.95);
    border-top: 1px solid rgba(0, 180, 216, 0.12);
    padding: 1rem 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-partners {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-partners-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.partner-placeholder {
    height: 28px;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.partner-placeholder:hover {
    opacity: 0.85;
}

.partner-placeholder svg {
    height: 16px;
    width: auto;
    fill: rgba(255, 255, 255, 0.6);
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.social-link:hover {
    background: rgba(0, 180, 216, 0.15);
    border-color: rgba(0, 180, 216, 0.5);
    color: #00b4d8;
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.3);
    transform: translateY(-2px);
}

.social-link svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.footer-copyright {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1100px) {
    .hero-section {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        padding: 1.5rem 2rem 1rem 2rem;
    }

    .hero-cube-col {
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .bottom-section {
        padding: 1rem 2rem 2rem 2rem;
    }
}

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

    .hero-cube-col {
        grid-column: 1;
    }

    .bottom-section {
        grid-template-columns: 1fr;
    }

    .landing-header {
        padding: 0.85rem 1.5rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .header-right {
        flex-direction: column;
        gap: 0.75rem;
    }

    .landing-footer {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
}
/* ══════════════════════════════════════════════════════════════════════
   PÁGINAS DE CONTENIDO DE LA WEB PÚBLICA (Cómo funciona / Mapa / Impacto /
   Participa). Reutilizan el mismo lenguaje visual que el hero de la home
   (landing-header/landing-footer/section-card) — componentes genéricos
   para el contenido de cada pestaña. Diseño provisional.
   ══════════════════════════════════════════════════════════════════════ */
.wcl-page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 3rem 4.5rem;
    width: 100%;
    box-sizing: border-box;
}

.wcl-page-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.wcl-page-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #00b4d8;
    margin-bottom: 0.9rem;
}

.wcl-page-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0 0 1rem;
    line-height: 1.15;
}

.wcl-page-hero h1 span {
    background: linear-gradient(135deg, #00b4d8 0%, #9cfd33 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.wcl-page-hero p {
    font-size: 1.02rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 620px;
    margin: 0 auto;
}

.wcl-section {
    margin-top: 3.2rem;
}

.wcl-section > h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
}

.wcl-section > p.wcl-section-sub {
    color: rgba(255, 255, 255, 0.62);
    margin: 0 0 1.6rem;
    max-width: 620px;
}

.wcl-grid {
    display: grid;
    gap: 1.1rem;
}
.wcl-grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.wcl-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.wcl-grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Tarjeta genérica de contenido (icono + título + texto), sobre section-card */
.wcl-content-card { text-align: left; }
.wcl-content-card .wcl-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: rgba(0, 180, 216, 0.15);
    font-size: 1.25rem;
    margin-bottom: 0.9rem;
}
.wcl-content-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}
.wcl-content-card p {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
    line-height: 1.55;
}

/* Pasos numerados (timeline vertical simple) */
.wcl-steps { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.6rem; }
.wcl-step { display: flex; gap: 1rem; align-items: flex-start; }
.wcl-step-num {
    flex-shrink: 0;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: #fff; font-weight: 800; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.35);
}
.wcl-step-body h4 { margin: 0 0 0.25rem; font-size: 0.95rem; font-weight: 700; }
.wcl-step-body p { margin: 0; font-size: 0.87rem; color: rgba(255, 255, 255, 0.62); }

/* Estadística grande */
.wcl-stat-card { text-align: center; }
.wcl-stat-num { font-size: 2.1rem; font-weight: 800; color: #00b4d8; line-height: 1; }
.wcl-stat-label { margin-top: 0.5rem; font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }

/* Tabla (ranking / listado) */
table.wcl-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
table.wcl-table th, table.wcl-table td {
    text-align: left;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid rgba(0, 180, 216, 0.15);
    font-size: 0.88rem;
}
table.wcl-table th {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
table.wcl-table tr:last-child td { border-bottom: none; }
.wcl-rank-pill {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(0, 180, 216, 0.18); color: #00b4d8;
    font-weight: 800; font-size: 0.72rem;
}

/* Tarjeta de ubicación (mapa en modo lista) */
.wcl-pin-card { display: flex; gap: 0.9rem; align-items: flex-start; text-align: left; }
.wcl-pin-card .wcl-pin-emoji { font-size: 1.3rem; line-height: 1; }
.wcl-pin-card h4 { margin: 0 0 0.2rem; font-size: 0.92rem; font-weight: 700; }
.wcl-pin-card span { font-size: 0.8rem; color: rgba(255, 255, 255, 0.58); }

/* Nota informativa */
.wcl-note {
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.25);
    border-radius: 14px;
    padding: 1rem 1.3rem;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.68);
    margin-top: 2rem;
}

/* Botones (variante ligera de btn-access, para el cuerpo de página) */
.wcl-btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.8rem 1.6rem; border-radius: 30px;
    font-weight: 700; font-size: 0.88rem; text-decoration: none;
    transition: all 0.25s ease; cursor: pointer; border: none;
}
.wcl-btn-primary {
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}
.wcl-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 180, 216, 0.5); }
.wcl-btn-outline {
    background: transparent; color: #fff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.wcl-btn-outline:hover { border-color: #00b4d8; color: #00b4d8 !important; }
.wcl-actions { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; margin-top: 1.6rem; }

/* Formulario simple (Participa) */
form.wcl-form { display: grid; gap: 1rem; max-width: 560px; margin-top: 1.5rem; }
form.wcl-form label {
    display: block; font-size: 0.82rem; font-weight: 700;
    color: rgba(255, 255, 255, 0.7); margin-bottom: 0.4rem;
}
form.wcl-form input, form.wcl-form select, form.wcl-form textarea {
    width: 100%; box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 180, 216, 0.25);
    color: #fff; border-radius: 9px;
    padding: 0.75rem 0.9rem; font-size: 0.9rem; font-family: inherit;
}
form.wcl-form input:focus, form.wcl-form select:focus, form.wcl-form textarea:focus {
    outline: none; border-color: #00b4d8;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

@media (max-width: 720px) {
    .wcl-page-wrap { padding: 2rem 1.25rem 3rem; }
    .wcl-page-hero h1 { font-size: 1.6rem; }
}
