@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Exo+2:wght@300;400;500&display=swap');

:root {
    --deep: #020c14;
    --navy: #040f1a;
    --blue1: #0055cc;
    --blue2: #00cfff;
    --cyan: #00e5ff;
    --danger: #ff3b3b;
    --success: #00e57a;
    --text: #c8e8f8;
    --muted: #3a6a8a;
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #0b1220;
    color: #fff;
    min-height: 100vh;
}

/* ══════════════════════════════
   CHART HEADER
══════════════════════════════ */
.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 360px;
    padding: 0 2px;
    margin-bottom: -4px;
}

.chart-range-label {
    font-family: 'Orbitron', monospace;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: var(--cyan);
    text-transform: uppercase;
}

.chart-count {
    font-size: 0.62rem;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
}


/* ══════════════════════════════
   NAVBAR
══════════════════════════════ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: 56px;
    background: rgba(4, 12, 22, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

/* Línea animada inferior navbar */
.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    background-size: 200% 100%;
    animation: navFlow 4s linear infinite;
}

@keyframes navFlow {
    from {
        background-position: -200% 0;
    }

    to {
        background-position: 200% 0;
    }
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-tank-icon {
    width: 28px;
    height: 38px;
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.5));
    animation: navTankPulse 3s ease-in-out infinite;
}

@keyframes navTankPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.9));
    }
}

.nav-title {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--cyan), #fff, var(--blue2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Indicador live */
.nav-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Orbitron', monospace;
    font-size: 0.58rem;
    letter-spacing: 1px;
    color: var(--muted);
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    transition: background 0.4s, box-shadow 0.4s;
}

.live-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: livePulse 1.5s ease-in-out infinite;
}

.live-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ══════════════════════════════
   AVATAR / MENÚ USUARIO
══════════════════════════════ */
.user-menu-wrap {
    position: relative;
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50px;
    transition: background 0.2s;
}

.user-avatar-btn:hover {
    background: rgba(0, 229, 255, 0.08);
}

.avatar-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(0, 229, 255, 0.5);
    background: linear-gradient(135deg, #0d2a44, #0055cc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
    transition: box-shadow 0.3s;
}

.user-avatar-btn:hover .avatar-ring {
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.5);
    border-color: var(--cyan);
}

/* Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 230px;
    background: rgba(4, 14, 24, 0.97);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 14px;
    backdrop-filter: blur(20px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 229, 255, 0.05);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 200;
}

.user-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(0, 229, 255, 0.04);
}

.dh-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d2a44, #0055cc);
    border: 2px solid rgba(0, 229, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--cyan);
    flex-shrink: 0;
}

.dh-email {
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}

.dh-role {
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 229, 255, 0.08);
    margin: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: none;
    border: none;
    color: var(--text);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.88rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.dropdown-item:hover {
    background: rgba(0, 229, 255, 0.07);
    color: var(--cyan);
}

.dropdown-item.danger {
    color: #ff6b6b;
}

.dropdown-item.danger:hover {
    background: rgba(255, 59, 59, 0.1);
    color: var(--danger);
}

/* ══════════════════════════════
   APP CONTAINER
══════════════════════════════ */

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem 2rem;
    gap: 1rem;
}

h1 {
    font-size: 20px;
    font-weight: 500;
    color: #00e5ff;
    letter-spacing: 1px;
    margin-top: .5rem;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    max-width: 360px;
}

.card {
    background: #162033;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.card label {
    font-size: 11px;
    color: #aaa;
    display: block;
    margin-bottom: 4px;
}

.card .val {
    font-size: 20px;
    font-weight: 500;
    color: #00e5ff;
}

.status {
    font-size: 12px;
    color: #aaa;
}

canvas {
    max-width: 95%;
    width: 360px;
}

/* ── Selector de rango ── */
.range-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 10px 0 4px;
}

.range-btn {
    background: #0d1e2e;
    color: #4a7a9a;
    border: 1px solid #1e4060;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.range-btn:hover {
    background: #1a3a55;
    color: #00e5ff;
    border-color: #00e5ff;
}

.range-btn.active {
    background: #00e5ff;
    color: #020f1a;
    border-color: #00e5ff;
    font-weight: bold;
}


.alarm-ring {
    animation: ring 1s infinite;
}

@keyframes ring {

    0%,
    100% {
        filter: drop-shadow(0 0 0px red);
    }

    50% {
        filter: drop-shadow(0 0 14px red);
    }
}

/* ══════════════════════════════
   MODALES
══════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: rgba(4, 14, 24, 0.98);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 229, 255, 0.05);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.2) transparent;
}

.modal-overlay.open .modal-box {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
    position: sticky;
    top: 0;
    background: rgba(4, 14, 24, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--cyan);
    text-transform: uppercase;
}

.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--muted);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: rgba(255, 59, 59, 0.15);
    color: var(--danger);
}

.modal-section {
    padding: 18px 22px;
}

.modal-section-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-divider {
    height: 1px;
    background: rgba(0, 229, 255, 0.08);
}

/* Formulario modal */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mfield {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mfield label {
    font-size: 0.63rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
}

.mfield input {
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text);
    font-family: 'Exo 2', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.mfield input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.mfield input::placeholder {
    color: var(--muted);
}

/* Botones modal */
.mbtn {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    cursor: pointer;
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.mbtn:hover {
    transform: translateY(-1px);
}

.mbtn:active {
    transform: translateY(0);
}

.mbtn-primary {
    background: linear-gradient(135deg, var(--blue1), #007acc);
    color: #fff;
    border: 1px solid rgba(0, 229, 255, 0.3);
    width: 100%;
}

.mbtn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 100, 200, 0.4), 0 0 20px rgba(0, 229, 255, 0.1);
}

.mbtn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mbtn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.mbtn-danger {
    background: rgba(255, 59, 59, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 59, 59, 0.3);
}

.mbtn-danger:hover {
    background: rgba(255, 59, 59, 0.25);
    box-shadow: 0 4px 16px rgba(255, 59, 59, 0.3);
}

.modal-msg {
    font-size: 0.78rem;
    min-height: 18px;
    margin-top: 8px;
    text-align: center;
    letter-spacing: 0.3px;
}

.modal-msg.success {
    color: var(--success);
}

.modal-msg.error {
    color: var(--danger);
}

/* ══════════════════════════════
   LISTA DE USUARIOS
══════════════════════════════ */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.users-loading {
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    padding: 20px 0;
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
    animation: loadingPulse 1.4s ease-in-out infinite;
}

@keyframes loadingPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0, 229, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 10px;
    transition: background 0.2s, border-color 0.2s;
    animation: rowIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-row:hover {
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.15);
}

.user-row-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d2a44, #0055cc);
    border: 1px solid rgba(0, 229, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--cyan);
    flex-shrink: 0;
}

.user-row-info {
    flex: 1;
    min-width: 0;
}

.user-row-email {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row-date {
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 2px;
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
}

.user-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.user-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.user-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.user-action-btn.del:hover {
    background: rgba(255, 59, 59, 0.15);
    color: var(--danger);
    border-color: rgba(255, 59, 59, 0.3);
}

.user-self-badge {
    font-size: 0.55rem;
    letter-spacing: 1px;
    font-family: 'Orbitron', monospace;
    color: var(--cyan);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
}

/* ══════════════════════════════
   PERFIL
══════════════════════════════ */
.profile-avatar-big {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d2a44, #0055cc);
    border: 2px solid rgba(0, 229, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1.8rem;
    color: var(--cyan);
    margin: 0 auto 10px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
}

.profile-email-big {
    font-size: 0.9rem;
    color: var(--text);
    text-align: center;
    margin-bottom: 4px;
    word-break: break-all;
}

/* ══════════════════════════════
   CONFIRM MODAL
══════════════════════════════ */
.confirm-box {
    max-width: 320px;
    text-align: center;
    padding: 32px 28px;
}

.confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.confirm-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text);
    margin-bottom: 8px;
}

.confirm-sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ══════════════════════════════
   BADGE TIPO DE TANQUE
══════════════════════════════ */
.tank-type-badge {
    font-family: 'Orbitron', monospace;
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.12);
    border-radius: 20px;
    padding: 3px 12px;
    margin-top: -6px;
    transition: all 0.3s;
}

/* ══════════════════════════════
   MODAL TIPO DE TANQUE
══════════════════════════════ */
.tank-type-options {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 4px 0 8px;
}

.tank-type-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(0, 229, 255, 0.03);
    border: 1px solid rgba(0, 229, 255, 0.12);
    border-radius: 16px;
    padding: 20px 18px 16px;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, transform 0.2s, box-shadow 0.25s;
    min-width: 130px;
}

.tank-type-card:hover {
    background: rgba(0, 229, 255, 0.07);
    border-color: rgba(0, 229, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 229, 255, 0.08);
}

.tank-type-card.selected {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--cyan);
    box-shadow: 0 0 0 1px var(--cyan), 0 8px 24px rgba(0, 229, 255, 0.15);
}

.tank-type-label {
    font-family: 'Orbitron', monospace;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text);
    text-transform: uppercase;
}

.tank-type-desc {
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.5px;
    font-family: 'Exo 2', sans-serif;
}

.tank-type-check {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cyan);
    color: #020c14;
    font-size: 11px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    animation: checkPop 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes checkPop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ══════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════ */
#toast-container {
    position: fixed;
    top: 66px;
    right: 12px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
    pointer-events: none;
}

.toast {
    background: rgba(4, 14, 24, 0.97);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: 'Exo 2', sans-serif;
    font-size: 0.82rem;
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: all;
    line-height: 1.4;
}

.toast.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-color: rgba(0, 229, 122, 0.4);
}

.toast-error {
    border-color: rgba(255, 59, 59, 0.4);
}

.toast-warning {
    border-color: rgba(255, 140, 0, 0.4);
}

.toast-info {
    border-color: rgba(0, 229, 255, 0.2);
}

.toast-success::before {
    content: "✅ ";
}

.toast-error::before {
    content: "❌ ";
}

.toast-warning::before {
    content: "⚠️ ";
}

/* ══════════════════════════════
   PANEL DE DISPOSITIVOS
══════════════════════════════ */
.devices-panel {
    width: 100%;
    max-width: 360px;
    background: rgba(22, 32, 51, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
}

.devices-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.08);
}

.devices-panel-title {
    font-family: 'Orbitron', monospace;
    font-size: 0.62rem;
    letter-spacing: 2px;
    color: var(--muted);
    text-transform: uppercase;
}

.devices-add-btn {
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 8px;
    color: var(--cyan);
    width: 26px;
    height: 26px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.devices-add-btn:hover {
    background: rgba(0, 229, 255, 0.16);
}

.device-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.15) transparent;
}

/* ── Tarjeta de dispositivo ── */
.device-card {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 229, 255, 0.05);
    transition: background 0.2s;
    position: relative;
}

.device-card:last-child {
    border-bottom: none;
}

.device-card:hover {
    background: rgba(0, 229, 255, 0.04);
}

.device-card.active {
    background: rgba(0, 229, 255, 0.08);
    border-left: 2px solid var(--cyan);
}

.device-card.offline {
    opacity: 0.7;
}

.device-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.device-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.device-info {
    flex: 1;
    min-width: 0;
}

.device-alias {
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-id-small {
    font-size: 0.62rem;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
    margin-top: 1px;
}

.device-offline-badge {
    font-size: 0.6rem;
    color: #ff8c00;
    background: rgba(255, 140, 0, 0.1);
    border: 1px solid rgba(255, 140, 0, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.device-menu-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.device-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.device-card-body {
    padding-left: 0;
}

.device-level-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.device-level-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue1), var(--cyan));
    border-radius: 2px;
    transition: width 0.8s ease;
}

.device-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
    letter-spacing: 0.5px;
}

/* Sin dispositivos */
.no-devices {
    text-align: center;
    padding: 20px 16px;
}

.no-devices-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.4;
}

.no-devices-txt {
    font-size: 0.78rem;
    color: var(--muted);
    font-family: 'Orbitron', monospace;
    letter-spacing: 1px;
}

/* ══════════════════════════════
   CHART TOGGLE BUTTON
══════════════════════════════ */
.chart-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    padding: 10px 20px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 12px;
    color: var(--cyan);
    font-family: 'Orbitron', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.chart-toggle-btn:hover {
    background: rgba(0, 229, 255, 0.12);
    border-color: var(--cyan);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15);
}

#chart-panel {
    width: 100%;
    max-width: 380px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════
   BOTÓN TEMA (navbar)
══════════════════════════════ */
.theme-toggle-btn-nav {
    background: rgba(0,229,255,0.06);
    border: 1px solid rgba(0,229,255,0.2);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.theme-toggle-btn-nav:hover {
    background: rgba(0,229,255,0.14);
    border-color: var(--cyan);
    transform: rotate(20deg);
}

/* ══════════════════════════════
   TEMA CLARO — variables
══════════════════════════════ */
html[data-theme="light"] {
    --deep:    #e8f2fb;
    --navy:    #f0f7fd;
    --cyan:    #0077aa;
    --blue2:   #0099cc;
    --danger:  #cc2200;
    --success: #007a44;
    --text:    #1a2a3a;
    --muted:   #4a7090;
}

/* ── Body ── */
html[data-theme="light"] body {
    background: linear-gradient(160deg, #dceefb 0%, #eaf5fc 50%, #f0f8ff 100%);
    color: #1a2a3a;
}

/* ── Navbar ── */
html[data-theme="light"] .navbar {
    background: rgba(255,255,255,0.94);
    border-bottom-color: rgba(0,120,200,0.15);
    box-shadow: 0 2px 20px rgba(0,80,160,0.1);
}
html[data-theme="light"] .navbar::after {
    background: linear-gradient(90deg,transparent,#0077aa,transparent);
}
html[data-theme="light"] .nav-live { color: #4a7090; }
html[data-theme="light"] .theme-toggle-btn-nav {
    background: rgba(0,100,180,0.06);
    border-color: rgba(0,100,180,0.2);
}
html[data-theme="light"] .theme-toggle-btn-nav:hover {
    background: rgba(0,100,180,0.14);
    border-color: #0077aa;
}

/* ── Avatar / menú ── */
html[data-theme="light"] .avatar-ring {
    background: linear-gradient(135deg,#cde8f8,#a0d0f0);
    border-color: rgba(0,120,200,0.4);
    color: #0077aa;
}
html[data-theme="light"] .user-dropdown {
    background: rgba(245,252,255,0.98);
    border-color: rgba(0,100,200,0.15);
    box-shadow: 0 16px 40px rgba(0,80,160,0.15);
}
html[data-theme="light"] .dh-avatar {
    background: linear-gradient(135deg,#cde8f8,#a0d0f0);
    border-color: rgba(0,100,200,0.3);
    color: #0077aa;
}
html[data-theme="light"] .dh-email { color: #1a2a3a; }
html[data-theme="light"] .dh-role  { color: #4a7090; }
html[data-theme="light"] .dropdown-divider { background: rgba(0,100,200,0.1); }
html[data-theme="light"] .dropdown-item { color: #1a2a3a; }
html[data-theme="light"] .dropdown-item:hover { background: rgba(0,100,200,0.07); color: #0077aa; }
html[data-theme="light"] .dropdown-item.danger { color: #cc2200; }
html[data-theme="light"] .dropdown-item.danger:hover { background: rgba(200,0,0,0.07); }

/* ── Cards de datos ── */
html[data-theme="light"] .card {
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0,80,160,0.08);
    border: 1px solid rgba(0,120,200,0.1);
}
html[data-theme="light"] .card label { color: #4a7090; }
html[data-theme="light"] .card .val  { color: #0077aa; }

/* ── Panel dispositivos ── */
html[data-theme="light"] .devices-panel {
    background: rgba(255,255,255,0.9);
    border-color: rgba(0,120,200,0.15);
    box-shadow: 0 4px 20px rgba(0,80,160,0.08);
}
html[data-theme="light"] .devices-panel-title { color: #1a2a3a; }
html[data-theme="light"] .devices-add-btn {
    background: rgba(0,100,180,0.08);
    border-color: rgba(0,100,180,0.2);
    color: #0077aa;
}
html[data-theme="light"] .device-card {
    background: rgba(0,100,180,0.04);
    border-color: rgba(0,120,200,0.12);
}
html[data-theme="light"] .device-card:hover,
html[data-theme="light"] .device-card.active {
    background: rgba(0,100,180,0.09);
    border-color: #0077aa;
}
html[data-theme="light"] .device-alias { color: #1a2a3a; }
html[data-theme="light"] .device-id-small { color: #4a7090; }
html[data-theme="light"] .device-level-bar { background: rgba(0,100,180,0.12); }
html[data-theme="light"] .device-stats span { color: #1a2a3a; }
html[data-theme="light"] .device-menu-btn { color: #4a7090; }
html[data-theme="light"] .device-menu-btn:hover { background: rgba(0,100,180,0.1); color: #0077aa; }

/* ── Badge tipo tanque ── */
html[data-theme="light"] .tank-type-badge {
    background: rgba(0,100,180,0.08);
    border-color: rgba(0,120,200,0.2);
    color: #0077aa;
}

/* ── Rango gráfica ── */
html[data-theme="light"] .range-btn {
    background: rgba(0,100,180,0.06);
    color: #4a7090;
    border-color: rgba(0,120,200,0.2);
}
html[data-theme="light"] .range-btn:hover {
    background: rgba(0,100,180,0.14);
    color: #0077aa;
    border-color: #0077aa;
}
html[data-theme="light"] .range-btn.active {
    background: #0077aa;
    color: #fff;
    border-color: #0077aa;
}
html[data-theme="light"] .chart-range-label { color: #0077aa; }
html[data-theme="light"] .chart-count { color: #4a7090; }
html[data-theme="light"] .chart-toggle-btn {
    background: rgba(0,100,180,0.06);
    border-color: rgba(0,120,200,0.2);
    color: #0077aa;
}
html[data-theme="light"] .chart-toggle-btn:hover {
    background: rgba(0,100,180,0.14);
    border-color: #0077aa;
    box-shadow: 0 0 14px rgba(0,100,200,0.15);
}
html[data-theme="light"] #chart-panel { background: transparent; }
html[data-theme="light"] canvas { filter: none; }

/* ── Status ── */
html[data-theme="light"] .status { color: #4a7090; }

/* ── Modales ── */
html[data-theme="light"] .modal-overlay { background: rgba(0,40,80,0.35); }
html[data-theme="light"] .modal-box {
    background: rgba(245,252,255,0.99);
    border-color: rgba(0,100,200,0.15);
    box-shadow: 0 32px 80px rgba(0,60,140,0.2);
}
html[data-theme="light"] .modal-header {
    background: rgba(245,252,255,0.99);
    border-bottom-color: rgba(0,100,200,0.1);
}
html[data-theme="light"] .modal-title { color: #0077aa; }
html[data-theme="light"] .modal-close { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: #4a7090; }
html[data-theme="light"] .modal-close:hover { background: rgba(200,0,0,0.1); color: #cc2200; }
html[data-theme="light"] .modal-section-title { color: #4a7090; }
html[data-theme="light"] .modal-divider { background: rgba(0,100,200,0.1); }
html[data-theme="light"] .mfield label { color: #4a7090; }
html[data-theme="light"] .mfield input {
    background: rgba(0,100,180,0.04);
    border-color: rgba(0,120,200,0.2);
    color: #1a2a3a;
}
html[data-theme="light"] .mfield input:focus {
    border-color: #0077aa;
    box-shadow: 0 0 0 3px rgba(0,100,180,0.12);
}
html[data-theme="light"] .mfield input::placeholder { color: #7aaabb; }
html[data-theme="light"] .mbtn-primary { background: linear-gradient(135deg,#0066bb,#0088cc); }
html[data-theme="light"] .mbtn-ghost {
    background: rgba(0,0,0,0.04);
    color: #4a7090;
    border-color: rgba(0,0,0,0.12);
}
html[data-theme="light"] .mbtn-ghost:hover { background: rgba(0,0,0,0.08); color: #1a2a3a; }

/* ── Lista usuarios ── */
html[data-theme="light"] .users-loading { color: #4a7090; }
html[data-theme="light"] .user-row {
    background: rgba(0,100,180,0.04);
    border-color: rgba(0,120,200,0.12);
}
html[data-theme="light"] .user-row:hover {
    background: rgba(0,100,180,0.09);
    border-color: rgba(0,120,200,0.2);
}
html[data-theme="light"] .user-row-avatar {
    background: linear-gradient(135deg,#cde8f8,#a0d0f0);
    border-color: rgba(0,100,180,0.3);
    color: #0077aa;
}
html[data-theme="light"] .user-row-email { color: #1a2a3a; }
html[data-theme="light"] .user-row-date  { color: #4a7090; }
html[data-theme="light"] .user-self-badge {
    color: #0077aa;
    background: rgba(0,100,180,0.1);
    border-color: rgba(0,120,200,0.25);
}

/* ── Perfil ── */
html[data-theme="light"] .profile-avatar-big {
    background: linear-gradient(135deg,#cde8f8,#a0d0f0);
    border-color: rgba(0,100,180,0.3);
    color: #0077aa;
}
html[data-theme="light"] .profile-email-big { color: #1a2a3a; }

/* ── Confirm box ── */
html[data-theme="light"] .confirm-title { color: #1a2a3a; }
html[data-theme="light"] .confirm-sub   { color: #4a7090; }

/* ── Toast ── */
html[data-theme="light"] .toast {
    background: rgba(245,252,255,0.97);
    border-color: rgba(0,100,200,0.2);
    color: #1a2a3a;
    box-shadow: 0 8px 24px rgba(0,60,140,0.15);
}

/* ── No devices ── */
html[data-theme="light"] .no-devices-txt { color: #4a7090; }