﻿/* ============================================================================
   KULFI · Cliente Misterioso
   Hoja de estilos principal
   ========================================================================== */

:root {
    --bg: #f6f4ee;
    --surface: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --verde: #14532d;
    --verde-2: #166534;
    --menta: #ecfdf5;
    --azafran: #eab308;
    --rojo: #b91c1c;
    --ambar: #b45309;
    --azul: #0e7490;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px rgba(16, 24, 40, .06);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--verde-2);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.2;
    color: #111827;
}

p {
    margin: 0;
}

.wrap {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 22px;
}

/* ---------------------------------------------------------------------------
   Barra superior
   ------------------------------------------------------------------------ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--verde), var(--azul));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -.02em;
    box-shadow: 0 4px 10px rgba(20, 83, 45, .25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text strong {
    font-size: 16px;
    letter-spacing: .08em;
    color: var(--verde);
}

.brand-text small {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .02em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: #4b5563;
}

.nav-link:hover {
    background: #f3f4f6;
    color: var(--verde);
    text-decoration: none;
}

.nav-link.active {
    background: var(--menta);
    color: var(--verde);
}

.userbox {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fef3c7;
    color: #92400e;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    max-width: 180px;
}

.user-meta strong {
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta small {
    font-size: 11px;
    color: var(--muted);
}

.main {
    padding: 30px 0 56px;
    min-height: calc(100vh - 150px);
}

.footer {
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 16px 0;
    color: var(--muted);
    font-size: 12px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   Encabezado de página
   ------------------------------------------------------------------------ */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--verde-2);
    margin-bottom: 5px;
}

.page-head h1 {
    font-size: 27px;
    letter-spacing: -.02em;
}

.subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   Tarjetas, grillas y campos
   ------------------------------------------------------------------------ */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}

.card + .card {
    margin-top: 16px;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f0f1f3;
}

.card-head h2 {
    font-size: 17px;
    letter-spacing: -.01em;
}

.card-head .hint {
    font-size: 12.5px;
    color: var(--muted);
}

.card-flat {
    box-shadow: none;
}

.grid {
    display: grid;
    gap: 16px;
}

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

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

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field label {
    font-size: 12.5px;
    font-weight: 700;
    color: #374151;
}

.field .req {
    color: var(--rojo);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.35;
    transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--verde-2);
    box-shadow: 0 0 0 3px rgba(22, 101, 52, .14);
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.field-hint {
    font-size: 11.5px;
    color: var(--muted);
}

.field-error {
    font-size: 12px;
    color: var(--rojo);
}

/* ---------------------------------------------------------------------------
   Botones
   ------------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--verde-2);
    border-color: var(--verde-2);
    color: #fff;
}

.btn-primary:hover {
    background: var(--verde);
    border-color: var(--verde);
}

.btn-outline {
    background: #fff;
    border-color: #cbd5e1;
    color: var(--verde);
}

.btn-outline:hover {
    border-color: var(--verde-2);
    background: var(--menta);
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: #4b5563;
}

.btn-ghost:hover {
    background: #f3f4f6;
}

.btn-danger {
    background: var(--rojo);
    border-color: var(--rojo);
    color: #fff;
}

.btn-danger:hover {
    background: #991b1b;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

/* ---------------------------------------------------------------------------
   Mensajes y etiquetas
   ------------------------------------------------------------------------ */

.alert {
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 13.5px;
}

.alert ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.alert li {
    margin: 2px 0;
}

.alert-error {
    background: #fef2f2;
    border-color: #fca5a5;
    border-left-color: var(--rojo);
    color: #7f1d1d;
}

.alert-ok {
    background: #ecfdf5;
    border-color: #a7f3d0;
    border-left-color: var(--verde-2);
    color: var(--verde);
}

.alert-warn {
    background: #fffbeb;
    border-color: #fde68a;
    border-left-color: var(--ambar);
    color: #78350f;
}

.alert-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: #1d4ed8;
    color: #1e3a8a;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .01em;
    white-space: nowrap;
}

.b-ok {
    background: #dcfce7;
    color: #14532d;
}

.b-warn {
    background: #fef3c7;
    color: #92400e;
}

.b-danger {
    background: #fee2e2;
    color: #991b1b;
}

.b-muted {
    background: #f3f4f6;
    color: #4b5563;
}

.b-info {
    background: #dbeafe;
    color: #1e40af;
}

.nivel-excelente {
    background: #dcfce7;
    color: #14532d;
}

.nivel-muy-bueno {
    background: #cffafe;
    color: #155e75;
}

.nivel-aceptable {
    background: #fef3c7;
    color: #92400e;
}

.nivel-critico {
    background: #fee2e2;
    color: #991b1b;
}

/* ---------------------------------------------------------------------------
   Indicadores y gráficos CSS
   ------------------------------------------------------------------------ */

.kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-label {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.kpi-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    color: #111827;
    overflow-wrap: anywhere;
}

.kpi-foot {
    font-size: 12px;
    color: var(--muted);
}

.barra {
    height: 10px;
    background: #eef0f3;
    border-radius: 999px;
    overflow: hidden;
}

.barra-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}

.barra-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--muted);
}

.barra-meta strong {
    color: #374151;
}

.gauge-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.gauge-box {
    width: 126px;
    flex: 0 0 126px;
}

.gauge-box svg {
    display: block;
    width: 100%;
    height: auto;
}

.gauge-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gauge-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ---------------------------------------------------------------------------
   Gráficos del tablero
   ------------------------------------------------------------------------ */

.chart-wrap {
    margin-top: 4px;
}

.chart-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-svg text {
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--muted);
}

.chart-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

.chart-note {
    margin-top: 8px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--muted);
}

.pc-head,
.pc-row {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) 230px 64px;
    gap: 10px;
    align-items: center;
}

.pc-head {
    padding-bottom: 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--line);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.pc-head .pc-head-criterio {
    grid-column: 1 / 3;
}

.pc-head .pc-head-cumplimiento {
    grid-column: 3 / 5;
    text-align: right;
}

.pc-row {
    padding: 8px 0;
    border-bottom: 1px solid #f1f2f4;
}

.pc-row:last-of-type {
    border-bottom: none;
}

.pc-code {
    display: inline-block;
    justify-self: start;
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f3f4f6;
    font-family: Consolas, "Courier New", monospace;
    font-size: 10.5px;
    font-weight: 700;
    color: #374151;
}

.pc-text {
    font-size: 12.5px;
    line-height: 1.4;
    color: #374151;
}

.pc-cat {
    display: block;
    margin-top: 2px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}

.pc-bar {
    display: block;
    height: 10px;
    border-radius: 999px;
    background: #eef0f3;
    overflow: hidden;
}

.pc-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
}

.pc-pct {
    text-align: right;
    font-size: 12.5px;
    font-weight: 800;
    color: #374151;
    font-variant-numeric: tabular-nums;
}

table.heatmap td {
    text-align: center;
    font-weight: 800;
    font-size: 12px;
    white-space: nowrap;
}

table.heatmap td:first-child {
    text-align: left;
    font-weight: 600;
    font-size: 12.5px;
}

table.heatmap thead th {
    text-align: center;
}

table.heatmap thead th:first-child {
    text-align: left;
}

.heat-ok {
    background: #dcfce7;
    color: #14532d;
}

.heat-good {
    background: #ccfbf1;
    color: #115e59;
}

.heat-warn {
    background: #fef3c7;
    color: #92400e;
}

.heat-bad {
    background: #fee2e2;
    color: #991b1b;
}

.heat-empty {
    background: #f9fafb;
    color: #9ca3af;
}

@media (max-width: 720px) {
    .pc-head {
        display: none;
    }

    .pc-row {
        grid-template-columns: 54px minmax(0, 1fr) 58px;
        gap: 8px;
    }

    .pc-bar {
        grid-column: 1 / -1;
    }
}

/* ---------------------------------------------------------------------------
   Tablas
   ------------------------------------------------------------------------ */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table.tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.tabla th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.tabla td {
    padding: 11px 12px;
    border-bottom: 1px solid #f1f2f4;
    vertical-align: middle;
}

table.tabla tbody tr:hover {
    background: #fafaf9;
}

table.tabla tbody tr:last-child td {
    border-bottom: none;
}

table.tabla .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table.tabla .nowrap {
    white-space: nowrap;
}

.tabla-preguntas td {
    vertical-align: top;
    line-height: 1.45;
}

.codigo-chip {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    background: #f3f4f6;
    border: 1px solid var(--line);
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
}

.grupo-cat td {
    background: #f9fafb;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #374151;
    border-top: 1px solid var(--line);
}

.comentario {
    display: block;
    margin-top: 5px;
    padding: 7px 10px;
    background: #fffbeb;
    border-left: 3px solid var(--azafran);
    border-radius: 0 6px 6px 0;
    color: #4b5563;
    font-size: 12.5px;
}

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

.small {
    font-size: 12px;
}

.right {
    text-align: right;
}

.empty {
    text-align: center;
    padding: 44px 18px;
    color: var(--muted);
}

.empty h3 {
    font-size: 17px;
    color: var(--ink);
    margin-bottom: 6px;
}

/* ---------------------------------------------------------------------------
   Encuesta
   ------------------------------------------------------------------------ */

.cat-card {
    border-left: 5px solid var(--verde-2);
}

.cat-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.cat-head h2 {
    font-size: 18px;
    letter-spacing: -.01em;
}

.cat-head .cat-desc {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 4px;
    max-width: 720px;
}

.cat-peso {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--menta);
    color: var(--verde);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.pregunta {
    padding: 15px 0;
    border-top: 1px solid #f0f1f3;
}

.cat-card .pregunta:first-of-type {
    border-top: none;
}

.pregunta-texto {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 14.5px;
    line-height: 1.45;
    margin-bottom: 10px;
}

.pregunta-texto .codigo-chip {
    margin-top: 1px;
}

.opciones {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.op {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 700;
    color: #4b5563;
    cursor: pointer;
    user-select: none;
}

.op:hover {
    border-color: #9ca3af;
}

.op input {
    margin: 0;
    accent-color: var(--verde-2);
}

.op.si.sel {
    border-color: var(--verde-2);
    background: var(--menta);
    color: var(--verde);
}

.op.no.sel {
    border-color: var(--rojo);
    background: #fef2f2;
    color: #991b1b;
}

.comentario-wrap {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fffbeb;
    border: 1px dashed #f59e0b;
    border-radius: 8px;
}

.comentario-wrap label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 5px;
}

.comentario-wrap textarea {
    min-height: 58px;
    background: #fff;
}

.actions-sticky {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 13px 0;
    background: rgba(246, 244, 238, .95);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(6px);
}

/* ---------------------------------------------------------------------------
   Reporte detallado
   ------------------------------------------------------------------------ */

.report-top {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
}

.score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-right: 1px solid var(--line);
}

.score-block .gauge-wrap {
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.score-block .gauge-box {
    width: 142px;
    flex-basis: 142px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 18px;
}

.meta-item {
    min-width: 0;
}

.meta-item .meta-label {
    display: block;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 3px;
}

.meta-item .meta-value {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #1f2937;
    overflow-wrap: anywhere;
}

.cat-resumen {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.cat-linea .cat-linea-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.cat-linea .cat-linea-head span:first-child {
    font-weight: 700;
    font-size: 13.5px;
}

.cat-linea .cat-linea-head span:last-child {
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

.listas-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.lista {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 13.5px;
}

.lista li {
    position: relative;
    padding-left: 24px;
    color: #374151;
}

.lista li::before {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 800;
}

.lista-fuerte li::before {
    content: "✓";
    color: var(--verde-2);
}

.lista-mejora li::before {
    content: "!";
    color: var(--ambar);
}

.lista-vacia li {
    padding-left: 0;
    color: var(--muted);
    font-style: italic;
}

.lista-vacia li::before {
    content: "";
}

.info-line {
    display: flex;
    gap: 10px;
    font-size: 13.5px;
    padding: 4px 0;
}

.info-line .k {
    color: var(--muted);
    min-width: 150px;
}

.info-line .v {
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Guía de servicio
   ------------------------------------------------------------------------ */

.guia {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
}

.guia summary {
    cursor: pointer;
    padding: 15px 18px;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    list-style: none;
}

.guia summary::-webkit-details-marker {
    display: none;
}

.guia summary:hover {
    background: #fafaf9;
}

.guia[open] summary {
    border-bottom: 1px solid var(--line);
}

.guia .guia-body {
    padding: 16px 18px 18px;
}

.guia .guia-body p {
    color: #374151;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: pre-line;
}

.guia .criterios {
    margin: 14px 0 0;
    padding-left: 20px;
    color: #4b5563;
    font-size: 13px;
}

.guia .criterios li {
    margin: 5px 0;
}

/* ---------------------------------------------------------------------------
   Login
   ------------------------------------------------------------------------ */

.login-body {
    min-height: 100vh;
    margin: 0;
    padding: 26px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(234, 179, 8, .22), transparent 38%),
        radial-gradient(circle at 85% 85%, rgba(14, 116, 144, .3), transparent 42%),
        linear-gradient(135deg, #0b2e1c 0%, #14532d 48%, #1f6b45 100%);
    color: var(--ink);
}

.login-shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1.02fr .98fr;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 32px 70px rgba(0, 0, 0, .38);
}

.login-hero {
    position: relative;
    overflow: hidden;
    padding: 44px 42px;
    color: #fff;
    background: linear-gradient(160deg, #14532d 0%, #166534 58%, #0e7490 130%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 30px;
}

.login-hero::after {
    content: "";
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    right: -110px;
    bottom: -120px;
}

.login-hero .brand-mark {
    background: rgba(255, 255, 255, .16);
    box-shadow: none;
}

.login-hero .brand-text strong,
.login-hero .brand-text small {
    color: #fff;
}

.login-hero .brand-text small {
    opacity: .75;
}

.login-hero h1 {
    color: #fff;
    font-size: 32px;
    letter-spacing: -.025em;
    margin: 26px 0 10px;
}

.login-hero p {
    color: rgba(255, 255, 255, .84);
    font-size: 14px;
    line-height: 1.6;
    max-width: 360px;
}

.login-hero ul {
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
    font-size: 13.5px;
    color: rgba(255, 255, 255, .9);
}

.login-hero ul li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.login-hero ul li::before {
    content: "✓";
    color: var(--azafran);
    font-weight: 800;
}

.login-hero .hero-foot {
    font-size: 11.5px;
    color: rgba(255, 255, 255, .62);
    position: relative;
    z-index: 1;
}

.login-form {
    padding: 46px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form h2 {
    font-size: 24px;
    letter-spacing: -.02em;
}

.login-form .login-sub {
    color: var(--muted);
    font-size: 13.5px;
    margin: 5px 0 22px;
}

.login-form .field {
    margin-bottom: 14px;
}

.login-form input {
    padding: 12px 13px;
    font-size: 14.5px;
}

.login-pie {
    margin-top: 20px;
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
    line-height: 1.6;
}

/* ---------------------------------------------------------------------------
   Utilidades
   ------------------------------------------------------------------------ */

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-100 { width: 100%; }

/* ---------------------------------------------------------------------------
   Adaptación a pantallas
   ------------------------------------------------------------------------ */

@media (max-width: 980px) {
    .topbar-inner {
        gap: 12px;
    }

    .userbox {
        margin-left: 0;
    }

    .user-meta {
        display: none;
    }

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

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

    .report-top {
        grid-template-columns: 1fr;
    }

    .score-block {
        flex-direction: row;
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-bottom: 16px;
    }

    .score-block .gauge-wrap {
        flex-direction: row;
    }

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

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        padding: 30px 34px;
    }

    .login-hero h1 {
        font-size: 26px;
        margin-top: 16px;
    }

    .login-hero ul {
        display: none;
    }
}

@media (max-width: 640px) {
    .wrap {
        padding: 0 15px;
    }

    .topbar-inner {
        padding: 9px 15px;
    }

    .brand-text small {
        display: none;
    }

    .nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 3px;
        flex-wrap: nowrap;
    }

    .nav-link {
        white-space: nowrap;
    }

    .main {
        padding-top: 20px;
    }

    .page-head h1 {
        font-size: 23px;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .kpis,
    .listas-2,
    .meta-grid {
        grid-template-columns: 1fr;
    }

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

    .card {
        padding: 16px;
    }

    .login-body {
        padding: 12px;
    }

    .login-form {
        padding: 30px 24px;
    }

    .login-hero {
        padding: 26px 24px;
    }

    .login-hero p {
        display: none;
    }

    .login-hero h1 {
        margin: 10px 0 0;
        font-size: 22px;
    }

    .actions-sticky {
        justify-content: stretch;
    }

    .actions-sticky .btn {
        flex: 1;
    }
}

/* ---------------------------------------------------------------------------
   Impresión: reportes listos para PDF
   ------------------------------------------------------------------------ */

@media print {
    @page {
        margin: 12mm;
    }

    body {
        background: #fff !important;
        font-size: 11.5px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .topbar,
    .footer,
    .page-actions,
    .actions-sticky,
    .no-print {
        display: none !important;
    }

    .main {
        padding: 0;
        min-height: 0;
    }

    .wrap {
        max-width: none;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #d1d5db;
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 9px;
        padding: 13px 15px;
    }

    .card-head {
        padding-bottom: 7px;
        margin-bottom: 10px;
    }

    .page-head {
        margin-bottom: 12px;
    }

    .page-head h1 {
        font-size: 20px;
    }

    .cat-card {
        break-inside: auto;
        page-break-inside: auto;
    }

    .pregunta {
        padding: 8px 0;
    }

    .gauge-box {
        width: 104px;
        flex-basis: 104px;
    }

    .badge {
        border: 1px solid #d1d5db;
    }

    .barra-fill {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    a {
        color: inherit;
        text-decoration: none;
    }
}
