/* ============================================================
   HDPUV Admin Interface — Estilos globales
   Sistema de unidades: rem (base = html font-size)
   Para escalar toda la interfaz: cambiar solo html { font-size }
   ============================================================ */

/* ── Variables de marca ───────────────────────────────────── */
:root {
    --teal: #29b4c5;
    --teal-dark: #1d8f9e;
    --teal-light: #e6f7f9;
    --gray-dark: #2d2d2d;
    --gray-bg: #f2f4f5;
    --white: #ffffff;
    --border: #dde3e6;
    --text-1: #1e1e1e;
    --text-2: #5a6673;
    --green: #2e8b57;
    --amber: #b06000;
    --red: #a52525;
    --green-bg: #e6f5ee;
    --amber-bg: #fef3e0;
    --red-bg: #fdeaea;
    --gray-row: #f0f3f5;
    --sidebar-w: 192px;
    --header-h: 80px;
    --footer-h: 36px;
}

/* ── Base: cambiar este valor escala TODA la interfaz ─────── */
html {
    font-size: 16.5px; /* 13px × 1.30 = +30% */
}

/* ── Reset base ───────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html,
body {
    height: 100%;
    overflow: hidden;
}
body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--gray-bg);
    color: var(--text-1);
    line-height: 1.5;
    font-size: 1rem;
}
a {
    color: var(--teal-dark);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ── Header — fijo arriba ─────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--white);
    border-bottom: 3px solid var(--teal);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.68rem;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}
.header-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-dark);
}
.header-sub {
    font-size: 0.77rem;
    color: var(--text-2);
    margin-top: 0.14rem;
}
.header-user {
    font-size: 0.77rem;
    color: var(--text-2);
}
.header-role {
    font-size: 0.77rem;
    color: var(--teal-dark);
    font-weight: 600;
    margin-top: 0.14rem;
}

/* ── Footer — fijo abajo ──────────────────────────────────── */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-h);
    background: var(--gray-dark);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.7rem;
    padding: 0 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}
.footer a {
    color: var(--teal);
    text-decoration: none;
}

/* ── Zona de contenido scrolleable ───────────────────────── */
.content-area {
    position: fixed;
    top: var(--header-h);
    bottom: var(--footer-h);
    left: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.content-area.with-sidebar {
    left: var(--sidebar-w);
}
.content-area.login-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8f7f9 0%, #f2f4f5 60%, #e0f0f2 100%);
}

/* ── Login ────────────────────────────────────────────────── */
.login-card {
    background: var(--white);
    border-radius: 0.7rem;
    padding: 2.52rem 2.24rem;
    width: 26.6rem;
    border-top: 4px solid var(--teal);
    box-shadow:
        0 4px 24px rgba(41, 180, 197, 0.12),
        0 1px 4px rgba(0, 0, 0, 0.06);
}
.login-icon {
    text-align: center;
    margin-bottom: 1.26rem;
}
.login-icon svg {
    width: 3.36rem;
    height: 3.36rem;
}
.login-title {
    font-size: 1.19rem;
    font-weight: 700;
    color: var(--gray-dark);
    text-align: center;
    margin-bottom: 0.28rem;
}
.login-sub {
    font-size: 0.77rem;
    color: var(--text-2);
    text-align: center;
    margin-bottom: 1.68rem;
}
.login-error {
    background: var(--red-bg);
    color: #8a1f1f;
    border: 1px solid #f5c0c0;
    border-radius: 0.35rem;
    padding: 0.56rem 0.84rem;
    font-size: 0.84rem;
    margin-bottom: 0.98rem;
}

/* ── Sidebar — fijo izquierda ─────────────────────────────── */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    bottom: var(--footer-h);
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 1.12rem 0 0;
    overflow-y: hidden;
    z-index: 90;
    display: flex;
    flex-direction: column;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

.sidebar-logout {
    border-top: 1px solid var(--border);
    padding: 0.7rem 0.98rem;
    flex-shrink: 0;
}

.sidebar-logout a {
    display: flex;
    align-items: center;
    gap: 0.56rem;
    padding: 0.56rem 0.7rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--red);
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.15s;
}

.sidebar-logout a:hover {
    background: var(--red);
    color: #fff;
}

.sidebar-logout a:hover .logout-icon {
    color: #fff;
}

.sidebar-logout .logout-icon {
    font-size: 15px;
    line-height: 1;
}
.nav-label {
    font-size: 0.665rem;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.063rem;
    padding: 0 0.98rem 0.35rem;
    display: block;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.56rem;
    padding: 0.56rem 0.98rem;
    font-size: 0.84rem;
    color: var(--text-2);
    border-left: 3px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.1s;
}
.nav-item:hover {
    background: var(--teal-light);
    color: var(--teal-dark);
    text-decoration: none;
}
.nav-item.active {
    background: var(--teal-light);
    color: var(--teal-dark);
    border-left-color: var(--teal);
    font-weight: 600;
}
.nav-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}
.nav-item.active .nav-dot {
    background: var(--teal);
}
.nav-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.56rem 0.98rem;
}

/* ── Main — contenido de página ───────────────────────────── */
.main {
    padding: 1.4rem 1.54rem;
}
.breadcrumb {
    font-size: 0.7rem;
    color: var(--text-2);
    margin-bottom: 0.56rem;
}
.breadcrumb span {
    color: var(--teal-dark);
}
.page-title {
    font-size: 1.19rem;
    font-weight: 700;
    color: var(--gray-dark);
    margin-bottom: 0.14rem;
}
.page-sub {
    font-size: 0.77rem;
    color: var(--text-2);
    margin-bottom: 1.26rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: 0.49rem;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.12rem;
}
.card-head {
    padding: 0.77rem 1.12rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 0.91rem;
    font-weight: 700;
    color: var(--gray-dark);
}
.card-meta {
    font-size: 0.7rem;
    color: var(--text-2);
    margin-top: 0.07rem;
}
.card-body {
    padding: 1.26rem 1.12rem;
}

/* ── KPIs ─────────────────────────────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.7rem;
    margin-bottom: 1.26rem;
}
.kpi {
    background: var(--white);
    border-radius: 0.49rem;
    padding: 0.98rem 1.12rem;
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal);
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.kpi.ok {
    border-left-color: var(--green);
}
.kpi.warn {
    border-left-color: var(--amber);
}
.kpi.kpi-alert {
    border-left-color: var(--red);
}
.kpi-val {
    font-size: 1.68rem;
    font-weight: 700;
    color: var(--teal-dark);
    line-height: 1;
}
.kpi.ok .kpi-val {
    color: var(--green);
}
.kpi.warn .kpi-val {
    color: var(--amber);
}
.kpi.kpi-alert .kpi-val {
    color: var(--red);
}
.kpi-lbl {
    font-size: 0.7rem;
    color: var(--text-2);
    margin-top: 0.35rem;
}

/* ── Tablas ───────────────────────────────────────────────── */
.tabla-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}
thead th {
    background: #f7fafb;
    color: var(--text-2);
    font-weight: 700;
    text-align: left;
    padding: 0.56rem 0.98rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.028rem;
    white-space: nowrap;
}
tbody tr {
    border-bottom: 1px solid #f0f3f5;
}
tbody tr:last-child {
    border-bottom: none;
}
tbody tr:hover {
    background: #fafcfc;
}
tbody td {
    padding: 0.56rem 0.98rem;
    vertical-align: middle;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.14rem 0.63rem;
    border-radius: 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
}
.badge-ok {
    background: var(--green-bg);
    color: #1f6b3a;
}
.badge-warn {
    background: var(--amber-bg);
    color: #8f4d00;
}
.badge-alert {
    background: var(--red-bg);
    color: #8a1f1f;
}
.badge-pend {
    background: var(--gray-row);
    color: var(--text-2);
}

/* ── Barras de progreso ───────────────────────────────────── */
.prow {
    display: flex;
    align-items: center;
    gap: 0.49rem;
}
.pbar {
    background: #e0e8ec;
    border-radius: 3px;
    height: 5px;
    width: 5.6rem;
}
.pfill {
    border-radius: 3px;
    height: 5px;
    background: var(--green);
}
.pct {
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 2.1rem;
}

/* ── Botones ──────────────────────────────────────────────── */
.btn-primary {
    background: var(--teal);
    color: var(--white);
    border: none;
    padding: 0.56rem 1.12rem;
    border-radius: 0.35rem;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    display: inline-block;
}
.btn-primary:hover {
    background: var(--teal-dark);
    text-decoration: none;
}
.btn-secondary {
    background: var(--white);
    color: var(--text-2);
    border: 1.5px solid var(--border);
    padding: 0.49rem 0.98rem;
    border-radius: 0.35rem;
    font-size: 0.84rem;
    cursor: pointer;
}
.btn-secondary:hover {
    border-color: var(--teal);
    color: var(--teal-dark);
}
.btn-export {
    background: var(--white);
    color: var(--teal-dark);
    border: 1.5px solid var(--teal);
    padding: 0.49rem 0.91rem;
    border-radius: 0.35rem;
    font-size: 0.77rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-export:hover {
    background: var(--teal-light);
}

/* ── Formularios ──────────────────────────────────────────── */
.field {
    margin-bottom: 0.98rem;
}
.field label {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--gray-dark);
    display: block;
    margin-bottom: 0.28rem;
}
.field input,
.field select {
    width: 100%;
    padding: 0.56rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: 0.35rem;
    font-size: 0.84rem;
    color: var(--text-1);
    background: var(--white);
    font-family: inherit;
    transition: border-color 0.15s;
}
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--teal);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.98rem;
}
.form-row.full {
    grid-template-columns: 1fr;
}
.search-row {
    display: flex;
    gap: 0.56rem;
}
.search-row input {
    flex: 1;
}
.result-box {
    background: var(--teal-light);
    border: 1px solid var(--teal);
    border-radius: 0.35rem;
    padding: 0.7rem 0.84rem;
    margin-top: 0.42rem;
    font-size: 0.77rem;
    color: var(--teal-dark);
}
.result-box strong {
    display: block;
    font-size: 0.84rem;
    color: var(--gray-dark);
    margin-bottom: 0.14rem;
}
.form-divider {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 1.12rem 0;
}
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.049rem;
    margin-bottom: 0.84rem;
}
.btn-row {
    display: flex;
    gap: 0.7rem;
    justify-content: flex-end;
}

/* ── Paginación ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.84rem 0.98rem;
    border-top: 1px solid var(--border);
    font-size: 0.77rem;
    color: var(--text-2);
}
.pagination a {
    padding: 0.28rem 0.63rem;
    border: 1px solid var(--border);
    border-radius: 0.28rem;
    color: var(--text-2);
}
.pagination a:hover {
    border-color: var(--teal);
    color: var(--teal-dark);
    text-decoration: none;
}
.pagination a.active {
    background: var(--teal);
    color: var(--white);
    border-color: var(--teal);
    font-weight: 600;
}

/* ── Modal de errores ─────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.modal-box {
    background: var(--white);
    border-radius: 0.7rem;
    padding: 2.24rem 1.96rem;
    max-width: 29.4rem;
    width: 90%;
    text-align: center;
    border-top: 4px solid var(--teal);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.modal-icono {
    font-size: 2.24rem;
    margin-bottom: 0.84rem;
    color: var(--teal);
}
.modal-titulo {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--gray-dark);
    margin-bottom: 0.7rem;
}
.modal-cuerpo {
    font-size: 0.91rem;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: 1.4rem;
}

/* ── Alertas inline ───────────────────────────────────────── */
.alert {
    padding: 0.7rem 0.98rem;
    border-radius: 0.35rem;
    font-size: 0.84rem;
    margin-bottom: 0.98rem;
}
.alert-ok {
    background: var(--green-bg);
    color: #1f6b3a;
    border: 1px solid #b8dfc9;
}
.alert-warn {
    background: var(--amber-bg);
    color: #8f4d00;
    border: 1px solid #f5d9a8;
}
.alert-error {
    background: var(--red-bg);
    color: #8a1f1f;
    border: 1px solid #f5c0c0;
}

/* ── Chip ─────────────────────────────────────────────────── */
.chip {
    display: inline-block;
    background: var(--teal-light);
    color: var(--teal-dark);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.14rem 0.63rem;
    border-radius: 0.63rem;
    margin-left: 0.42rem;
}

/* ── Filtros ──────────────────────────────────────────────── */
.filter-row {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 0.98rem;
    flex-wrap: wrap;
}
.filter-row select,
.filter-row input {
    padding: 0.49rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: 0.35rem;
    font-size: 0.84rem;
    color: var(--text-1);
    background: var(--white);
    font-family: inherit;
}
.filter-row input {
    flex: 1;
    min-width: 11.2rem;
}
.filter-row select:focus,
.filter-row input:focus {
    outline: none;
    border-color: var(--teal);
}

/* ── Utilidades ───────────────────────────────────────────── */
.text-muted {
    color: var(--text-2);
}
.text-small {
    font-size: 0.7rem;
}
.mt-1 {
    margin-top: 0.56rem;
}
.mt-2 {
    margin-top: 1.12rem;
}
.mb-1 {
    margin-bottom: 0.56rem;
}
.mb-2 {
    margin-bottom: 1.12rem;
}
.ml-auto {
    margin-left: auto;
}
