* {
    box-sizing: border-box;
}

:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --border: #e7e7e7;
    --muted: #666;
    --text: #222;
    --brand: #1363df;
    --brand-2: #47b5ff;
    --ok: #1f8b4c;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
    background: var(--bg);
    color: var(--text);
}


/* Nav / Menú */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav .brand {
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: .3px;
}

.nav nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 14px;
    opacity: .9;
}

.nav nav a:hover,
.nav nav a.active {
    opacity: 1;
    text-decoration: underline;
}


.container {
    max-width: 90%;
    margin: 24px auto;
    padding: 0 16px;
}


/* Controles */
input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
}

label {
    display: block;
    font-size: 13px;
    color: #555;
    margin: 6px 0 4px;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

button.secondary,
.btn.secondary {
    background: #fff;
    color: var(--brand);
}

button:disabled {
    opacity: .6;
    cursor: not-allowed;
}


/* Tarjetas y tablas */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .03);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.table thead th {
    background: #fafafa;
    text-align: left;
    font-size: 14px;
    color: #555;
}

.table tr:nth-child(even) td {
    background: #fcfcff;
}

.table tr.seen td {
    background: #ecfff0;
}

.table tr.seen td:first-child::before {
    content: "• ";
    color: var(--ok);
    font-weight: 900;
}

.center {
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--ok);
    color: #fff;
    font-size: 12px;
}

.badge-muted {
    background: #ddd;
    color: #555;
}

.muted {
    color: var(--muted);
}


/* Layouts simples */
.grid {
    display: grid;
    gap: 14px;
}

.grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 800px) {

    .grid.cols-2,
    .grid.cols-3 {
        grid-template-columns: 1fr;
    }
}


/* Formularios */
.form {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Contenedor ancho si querés (ya usás container-s) */
.container-s {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

/* Barra de progreso */
.progress {
    height: 10px;
    background: #eee;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}

.progress>div {
    height: 100%;
    background: var(--brand);
}

/* Mini bar chart CSS */
.bars {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 6px;
    height: 90px;
}

.bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.bar-inner {
    width: 100%;
    max-width: 18px;
    background: linear-gradient(180deg, var(--brand-2), var(--brand));
    border-radius: 6px 6px 0 0;
}

.bar-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* ======== NAV responsive (fix) ======== */

/* Botón hamburguéser: oculto en desktop */
.nav .nav-toggle {
    display: none;
    border: 1px solid rgba(255, 255, 255, .7);
    background: transparent;
    color: #fff;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

/* Desktop: menú horizontal normal */
@media (min-width: 821px) {
    .nav nav {
        display: flex;
        align-items: center;
        gap: 14px;
    }
}

/* Mobile: panel desplegable */
@media (max-width: 820px) {
    .nav {
        z-index: 1000;
    }

    /* que tape el contenido */
    .nav .nav-toggle {
        display: inline-flex;
    }

    /* El panel por defecto: estilo listo para mostrarse */
    .nav nav {
        position: absolute;
        left: 16px;
        right: 16px;
        top: calc(100% + 6px);
        flex-direction: column;
        gap: 6px;
        padding: 10px;
        background: #fff;
        /* panel blanco */
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
    }

    /* ESTADO CERRADO: oculto SIEMPRE salvo que el header tenga .open */
    .nav:not(.open) nav {
        display: none !important;
    }

    /* ESTADO ABIERTO: mostrar como columna */
    .nav.open nav {
        display: flex !important;
    }

    /* Links dentro del panel: texto oscuro y sin subrayado */
    .nav nav a {
        color: var(--text);
        margin-left: 0;
        padding: 10px 12px;
        border-radius: 10px;
        opacity: 1;
        text-decoration: none;
    }

    /* Activo dentro del panel */
    .nav nav a.active {
        background: var(--brand);
        color: #fff;
    }

    .nav nav a:hover {
        background: rgba(0, 0, 0, .04);
    }
}

/* ===== Auth layout (centrado) ===== */
.auth-page {
    /* restar aprox. la altura del header sticky; ajustá si tu header es más alto */
    min-height: calc(100svh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-title {
    margin: 0 0 12px;
    text-align: center;
}

.auth-msg {
    margin-top: 8px;
    text-align: center;
}

button,
.btn {
    background: var(--brand);
    color: #fff;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    display: none;
    z-index: 9999
}

.lightbox.open {
    display: block
}

.lightbox-inner {
    position: absolute;
    inset: 20px;
    overflow: auto
}

.lightbox img {
    display: block;
    max-width: none;
    max-height: none
}

/* 1:1 original */

/* Botón cerrar: forzamos estilos sobre los globales de button/.btn */
.lightbox button.close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 10000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #fff !important;
    /* ← evitar texto blanco sobre blanco */
    color: #111 !important;
    /* ← visible */
    border: 1px solid #ccc !important;
    border-radius: 999px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0;
    /* círculo perfecto */
}

.lightbox button.close:hover {
    filter: brightness(0.95);
}

/* Autocomplete */
.ac-wrap {
    position: relative
}

.ac-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
    z-index: 1000;
    max-height: 240px;
    overflow: auto;
    display: none
}

.ac-item {
    padding: 10px 12px;
    cursor: pointer
}

.ac-item strong {
    font-weight: 700
}

.ac-item em {
    font-style: italic;
    color: #555
}

.ac-item:hover,
.ac-item.active {
    background: #eef5ff
}

.ac-empty {
    padding: 8px 12px;
    color: var(--muted)
}

/* Evitar zoom en iOS al enfocar */
.ac-wrap input {
    font-size: 16px
}