:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --card: #1e293b;
    --primary: #38bdf8;
    --primary-dark: #0284c7;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.25);
    --orange: #f97316;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Header estilo DAT */

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.nav {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    color: var(--text);
    font-weight: 800;
    font-size: 1.4rem;
    text-decoration: none;
}

.brand span {
    color: var(--primary);
}

.brand:hover {
    color: var(--text);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    transition: 0.2s ease;
}

.back-link i {
    color: var(--primary);
}

.back-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
}

/* Hero */

.hero {
    min-height: auto;
    display: flex;
    align-items: center;
    padding-top: 110px;
    padding-bottom: 35px;
}

.badge-custom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    margin-bottom: 24px;
    background: rgba(56, 189, 248, 0.08);
}

.hero h1 {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: 24px;
}

.hero h1 span {
    color: var(--primary);
}

.hero-text {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 650px;
    line-height: 1.7;
}

.update-text {
    margin-top: 22px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.update-text i {
    color: var(--primary);
}

/* Panel principal */

.monitor-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.monitor-panel::before {
    content: "";
    position: absolute;
    top: -70px;
    right: -70px;
    width: 190px;
    height: 190px;
    background: rgba(56, 189, 248, 0.16);
    border-radius: 50%;
    filter: blur(8px);
}

.resource-card,
.details-card {
    position: relative;
    z-index: 1;
}

/* Tarjetas de recursos */

.resource-card {
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.35);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.resource-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid var(--border);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.resource-content {
    display: grid;
    gap: 4px;
}

.resource-content span {
    color: var(--muted);
    font-size: 0.95rem;
}

.resource-content strong {
    color: var(--text);
    font-size: 1.7rem;
    line-height: 1.1;
}

.resource-content strong span {
    color: var(--primary);
    font-size: inherit;
}

/* Detalles sensores */

.details-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.35);
    padding: 22px;
}

.details-card h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.details-card h2 i {
    color: var(--primary);
}

.sensor-list {
    display: grid;
    gap: 12px;
}

.sensor-list div {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.sensor-list span {
    color: var(--muted);
}

.sensor-list strong {
    color: var(--primary);
}

/* Estado API */

.api-status {
    position: relative;
    z-index: 1;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
}

/* Gráficas */

.charts-section {
    padding: 0 0 45px;
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 26px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.chart-card::before {
    content: "";
    position: absolute;
    bottom: -80px;
    right: -80px;
    width: 180px;
    height: 180px;
    background: rgba(56, 189, 248, 0.10);
    border-radius: 50%;
    filter: blur(8px);
}

.chart-card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.chart-card h2 i {
    color: var(--primary);
}

.chart-card p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.chart-container {
    position: relative;
    z-index: 1;
    height: 260px;
    width: 100%;
}

.chart-container canvas {
    width: 100% !important;
    height: 260px !important;
}

/* Footer */

footer {
    border-top: 1px solid var(--border);
    padding: 10px 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

footer p {
    margin: 0;
}

/* Responsive tablet */

@media (max-width: 991px) {
    .hero {
        text-align: center;
        padding-top: 105px;
        padding-bottom: 35px;
    }

    .hero-text {
        margin: 0 auto;
    }

    .badge-custom {
        margin-left: auto;
        margin-right: auto;
    }

    .update-text {
        justify-content: center;
    }

    .monitor-panel {
        margin-top: 10px;
    }
}

/* Responsive móvil */

@media (max-width: 576px) {
    .nav {
        min-height: 66px;
        gap: 12px;
    }

    .brand {
        font-size: 1.2rem;
    }

    .back-link {
        font-size: 0.85rem;
        padding: 8px 10px;
    }

    .hero {
        padding-top: 88px;
        padding-bottom: 28px;
    }

    .hero h1 {
        font-size: 2.35rem;
        margin-bottom: 18px;
    }

    .hero-text {
        font-size: 1rem;
        line-height: 1.55;
    }

    .badge-custom {
        margin-bottom: 18px;
    }

    .monitor-panel {
        padding: 20px;
        border-radius: 20px;
    }

    .resource-card {
        padding: 16px;
        border-radius: 16px;
    }

    .resource-icon {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        font-size: 1.55rem;
    }

    .resource-content strong {
        font-size: 1.45rem;
    }

    .details-card {
        padding: 18px;
        border-radius: 16px;
    }

    .details-card h2 {
        font-size: 1.15rem;
    }

    .sensor-list div {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .charts-section {
        padding: 0 0 32px;
    }

    .chart-card {
        padding: 18px;
        border-radius: 20px;
    }

    .chart-card h2 {
        font-size: 1.15rem;
    }

    .chart-card p {
        font-size: 0.9rem;
        margin-bottom: 14px;
    }

    .chart-container {
        height: 230px;
    }

    .chart-container canvas {
        height: 230px !important;
    }

    footer {
        padding: 8px 0;
        font-size: 0.8rem;
    }
}

/* Móviles muy estrechos */

@media (max-width: 380px) {
    .back-link {
        font-size: 0.8rem;
        padding: 7px 8px;
    }

    .hero h1 {
        font-size: 2.1rem;
    }

    .resource-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-container {
        height: 215px;
    }

    .chart-container canvas {
        height: 215px !important;
    }
}