:root {
    --bg: #020617;
    --bg-elevated: #0b1120;
    --bg-elevated-soft: #020617;
    --border: rgba(148, 163, 184, 0.25);
    --accent: #3ecf8e;
    --accent-soft: rgba(62, 207, 142, 0.16);
    --accent-strong: #22c55e;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --danger: #f97373;
    --card-radius: 16px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.85);
    --shadow-subtle: 0 10px 25px rgba(15, 23, 42, 0.7);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(circle at 0% 0%, #1e293b 0, transparent 45%),
        radial-gradient(circle at 90% 10%, #0f766e 0, transparent 40%),
        radial-gradient(circle at 10% 100%, #1d4ed8 0, transparent 40%),
        #020617;
    color: var(--text);
}

/* CONTENEDOR PRINCIPAL (se define normalmente en header.php como <main>) */

main {
    max-width: 1340px;
    margin: 0 auto;
    padding: 1.5rem 1.75rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 1600px) {
    main {
        max-width: 1480px;
        padding-inline: 2.25rem;
    }
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* TITULOS */

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 1.75rem;
    margin: 0 0 0.75rem;
}

h2 {
    font-size: 1.25rem;
    margin: 0 0 0.75rem;
}

h3 {
    font-size: 1.05rem;
    margin: 1rem 0 0.5rem;
}

/* GRID RESPONSIVE PARA TARJETAS */

.grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* TARJETAS */

.card {
    background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.05), transparent 50%),
                radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.9), #020617);
    border-radius: var(--card-radius);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-soft);
    padding: 1.25rem 1.3rem;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at -10% -10%, rgba(56, 189, 248, 0.18), transparent 45%);
    opacity: 0.6;
    mix-blend-mode: screen;
    pointer-events: none;
}

.card h2 {
    position: relative;
    z-index: 1;
}

.card > * {
    position: relative;
    z-index: 1;
}

/* MÉTRICAS */

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.9rem 1.1rem;
    margin-top: 0.5rem;
}

.metric {
    padding: 0.6rem 0.75rem;
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: var(--shadow-subtle);
}

.metric .label {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.metric .value {
    font-size: 1rem;
    font-weight: 600;
}

/* TABLAS */

.table-wrapper {
    width: 100%;
    margin-top: 0.75rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    overflow: auto;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: var(--shadow-subtle);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.table thead {
    background: rgba(15, 23, 42, 0.95);
    position: sticky;
    top: 0;
    z-index: 2;
}

.table th,
.table td {
    padding: 0.55rem 0.75rem;
    text-align: left;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.85);
    white-space: nowrap;
}

.table th {
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
}

.table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.5);
}

.table tbody tr:hover {
    background: rgba(15, 23, 42, 0.95);
}

/* FORMULARIOS */

.form-grid {
    display: grid;
    gap: 0.9rem 1.1rem;
    margin-top: 0.5rem;
}

@media (min-width: 780px) {
    .form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

label {
    font-size: 0.78rem;
    color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    border-radius: 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text);
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder,
textarea::placeholder {
    color: rgba(148, 163, 184, 0.7);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(62, 207, 142, 0.5);
    background: rgba(15, 23, 42, 0.98);
}

textarea {
    resize: vertical;
}

/* BOTONES */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.7);
}

.btn.primary {
    border-color: rgba(62, 207, 142, 0.9);
    background: radial-gradient(circle at 0% 0%, rgba(74, 222, 128, 0.35), transparent 45%),
                linear-gradient(135deg, #16a34a, #22c55e);
    color: #f9fafb;
    font-weight: 600;
}

.btn.primary:hover {
    background: linear-gradient(135deg, #15803d, #22c55e);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ALERTAS */

.alert {
    border-radius: 0.75rem;
    padding: 0.6rem 0.8rem;
    font-size: 0.82rem;
    margin-bottom: 0.7rem;
    border: 1px solid;
}

.alert-error {
    background: rgba(127, 29, 29, 0.7);
    border-color: rgba(248, 113, 113, 0.9);
    color: #fecaca;
}

.alert-success {
    background: rgba(5, 46, 22, 0.8);
    border-color: rgba(34, 197, 94, 0.85);
    color: #bbf7d0;
}

/* LISTAS / TEXTOS AUXILIARES */

.instructions {
    margin: 0.4rem 0 0.8rem;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.instructions li {
    margin-bottom: 0.15rem;
}

.hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.45rem;
}

/* LISTA DE ARCHIVOS SUBIDOS */

.file-list {
    list-style: none;
    padding-left: 0;
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.file-list li {
    padding: 0.15rem 0;
}

/* BADGES ZONAS FC */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(15,23,42,0.85);
    white-space: nowrap;
}

.badge-z1 {
    color: #9ad0ff;
    border-color: rgba(154,208,255,0.4);
    background: rgba(15, 23, 42, 0.85);
}
.badge-z2 {
    color: #8ff7c6;
    border-color: rgba(143,247,198,0.4);
    background: rgba(5, 46, 22, 0.9);
}
.badge-z3 {
    color: #ffe28f;
    border-color: rgba(255,226,143,0.4);
    background: rgba(68,54,14,0.9);
}
.badge-z4 {
    color: #ffb3b3;
    border-color: rgba(255,179,179,0.5);
    background: rgba(90,24,24,0.9);
}
.badge-z5 {
    color: #ffd1ff;
    border-color: rgba(255,209,255,0.5);
    background: rgba(83,16,72,0.9);
}

/* RESUMEN INTENSIDADES */

.intensity-list {
    list-style: none;
    padding-left: 0;
    margin: 0.6rem 0 0.4rem;
}
.intensity-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0;
}
.intensity-list .label {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ESTADO PLAN VS REALIDAD */

.badge-status-low {
    color: #fecaca;
    border-color: rgba(248,113,113,0.7);
    background: rgba(127,29,29,0.9);
}
.badge-status-ok {
    color: #bbf7d0;
    border-color: rgba(34,197,94,0.7);
    background: rgba(5,46,22,0.9);
}
.badge-status-high {
    color: #fef3c7;
    border-color: rgba(234,179,8,0.8);
    background: rgba(113,63,18,0.9);
}
.badge-status-neutral {
    color: var(--muted);
    border-color: rgba(148,163,184,0.6);
    background: rgba(15,23,42,0.9);
}

/* RESPONSIVE */

@media (max-width: 720px) {
    main {
        padding-inline: 1rem;
    }

    .card {
        padding: 1rem 0.9rem;
    }

    .table {
        min-width: 640px;
    }
}
/* Separación un poco mayor para el bloque ancho del plan */
.card + .card {
    margin-top: 0.75rem;
}

/* NAV BAR SUPERIOR */

.top-nav {
    max-width: 1340px;
    margin: 1rem auto 0.5rem;
    padding: 0.7rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border-radius: 999px;
    background: radial-gradient(circle at 0% 0%, rgba(148,163,184,0.12), transparent 55%),
                radial-gradient(circle at 100% 0%, rgba(45,212,191,0.16), transparent 55%),
                rgba(15,23,42,0.92);
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 18px 45px rgba(15,23,42,0.85);
}

@media (min-width: 900px) {
    .top-nav {
        flex-direction: row;
        justify-content: space-between;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 0%, #22c55e, #14532d);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #f9fafb;
    box-shadow: 0 10px 22px rgba(22,163,74,0.9);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--muted);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid rgba(148,163,184,0.55);
    background: linear-gradient(135deg, rgba(15,23,42,0.96), rgba(15,23,42,0.9));
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
    border-color: rgba(148,163,184,0.95);
    box-shadow: 0 10px 25px rgba(15,23,42,0.8);
}

.nav-link.active {
    border-color: rgba(62,207,142,0.95);
    background: radial-gradient(circle at 0% 0%, rgba(74,222,128,0.3), transparent 45%),
                linear-gradient(135deg, #16a34a, #22c55e);
    color: #f9fafb;
    font-weight: 600;
}

