:root {
    --tinta: #18212f;
    --texto: #263241;
    --muted: #667085;
    --linea: #d9e0e8;
    --fondo: #f5f7fa;
    --superficie: #ffffff;
    --marca: #17457a;
    --marca-oscura: #12345c;
    --teal: #0f766e;
    --coral: #c2410c;
    --ok-fondo: #e8f7ef;
    --ok-texto: #166534;
    --pendiente-fondo: #fff4df;
    --pendiente-texto: #92400e;
    --sombra: 0 18px 48px rgba(24, 33, 47, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--texto);
    background: var(--fondo);
    line-height: 1.55;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

.app-shell {
    max-width: 1180px;
    margin: 0 auto;
}

.encabezado.app-shell {
    max-width: none;
    margin: 0;
}

.encabezado {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--linea);
    backdrop-filter: blur(14px);
}

.marca {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    min-width: 0;
}

.marca img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.marca span {
    display: grid;
    min-width: 0;
}

.marca strong {
    color: var(--tinta);
    font-size: 1rem;
    line-height: 1.15;
}

.marca small {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acciones-header,
.form-actions,
.section-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.acciones-header {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.contenedor {
    width: min(100%, 1040px);
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.contenedor--estrecho {
    width: min(100%, 520px);
}

.contenedor--login {
    width: min(100%, 620px);
}

.contenedor--admin {
    width: min(100%, 1180px);
}

.flujo {
    display: grid;
    gap: 1.25rem;
}

.hero-panel,
.panel-inicial,
.seccion-actual,
.historial,
.panel-tabla {
    background: var(--superficie);
    border: 1px solid var(--linea);
    border-radius: 8px;
    box-shadow: var(--sombra);
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    align-items: center;
    gap: 2rem;
    padding: 1.4rem;
}

.hero-panel h1,
.panel-inicial h1 {
    margin: 0;
    color: var(--tinta);
    font-size: clamp(1.7rem, 3vw, 2.55rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.hero-panel p,
.panel-inicial p {
    max-width: 66ch;
    margin: 0.7rem 0 0;
    color: var(--muted);
}

.hero-panel--success {
    grid-template-columns: minmax(0, 1fr) auto;
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.progreso {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.progreso__texto {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.progreso__texto strong {
    color: var(--tinta);
}

.progreso__barra {
    height: 12px;
    overflow: hidden;
    background: #e8edf3;
    border-radius: 999px;
}

.progreso__barra span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--marca));
    border-radius: inherit;
}

.progreso--compacto {
    width: min(100%, 320px);
}

.historial {
    padding: 1.15rem;
}

.historial h2,
.panel-tabla h2,
.seccion-actual h2 {
    margin: 0;
    color: var(--tinta);
    font-size: 1.25rem;
    line-height: 1.25;
}

.lista-respuestas {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.9rem;
}

.seccion-completada {
    border: 1px solid var(--linea);
    border-radius: 8px;
    background: #fbfcfe;
}

.seccion-completada summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    color: var(--tinta);
    font-weight: 700;
}

.seccion-completada summary strong {
    flex: 0 0 auto;
    color: var(--ok-texto);
    background: var(--ok-fondo);
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.76rem;
}

.respuesta-acciones {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.45rem;
}

.link-editar {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 0.6rem;
    color: var(--marca-oscura);
    background: #eef6ff;
    border: 1px solid #c7d9ec;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    text-decoration: none;
}

.link-editar:hover {
    color: #fff;
    background: var(--marca);
    border-color: var(--marca);
}

.seccion-completada p {
    margin: 0;
    padding: 0 1rem 1rem;
    color: var(--texto);
}

.seccion-actual {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 1.25rem;
    align-items: start;
    padding: 1.25rem;
}

.seccion-actual__contenido {
    min-width: 0;
}

.contenido-marco {
    margin-top: 1rem;
    color: #334155;
    min-width: 0;
    overflow-x: auto;
}

.contenido-marco h4 {
    margin: 1.35rem 0 0.45rem;
    color: var(--marca-oscura);
    font-size: 1rem;
}

.contenido-marco p,
.contenido-marco ul,
.contenido-marco ol {
    margin-top: 0.7rem;
    margin-bottom: 0;
}

.contenido-marco li + li {
    margin-top: 0.35rem;
}

.contenido-marco table {
    margin-top: 1rem;
    min-width: 640px;
}

.panel-comentario {
    position: sticky;
    top: 86px;
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    background: #fbfcfe;
    border: 1px solid var(--linea);
    border-radius: 8px;
}

.campo-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

label {
    color: var(--tinta);
    font-weight: 700;
}

textarea,
select {
    width: 100%;
    color: var(--tinta);
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
}

textarea {
    min-height: 190px;
    resize: vertical;
    padding: 0.9rem;
}

select {
    min-height: 46px;
    padding: 0 0.85rem;
}

textarea:focus,
select:focus {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    border-color: var(--teal);
}

.form-actions {
    justify-content: space-between;
    align-items: center;
}

.form-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

button,
.boton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 1rem;
    color: #fff;
    background: var(--marca);
    border: 1px solid var(--marca);
    border-radius: 8px;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

button:hover,
.boton:hover {
    background: var(--marca-oscura);
    border-color: var(--marca-oscura);
}

button[disabled] {
    color: #eef2f6;
    background: #98a2b3;
    border-color: #98a2b3;
    cursor: not-allowed;
}

.boton--secundario {
    color: var(--marca-oscura);
    background: #eaf2fb;
    border-color: #c7d9ec;
}

.boton--secundario:hover {
    color: #fff;
    background: var(--marca);
    border-color: var(--marca);
}

.boton--fantasma {
    color: var(--texto);
    background: #fff;
    border-color: var(--linea);
}

.boton--fantasma:hover {
    color: var(--tinta);
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.pantalla-centrada {
    min-height: 100vh;
    display: grid;
    align-items: center;
}

.panel-inicial {
    padding: 1.5rem;
}

.panel-inicial img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.panel-inicial--centrado {
    display: grid;
    justify-items: center;
    text-align: center;
    padding: 2rem 1.5rem;
}

.panel-inicial--centrado img {
    width: 84px;
    height: 84px;
    margin-bottom: 1.4rem;
}

.panel-inicial--centrado p {
    margin-left: auto;
    margin-right: auto;
}

.panel-inicial--centrado .boton {
    margin-top: 0.35rem;
}

.login-card {
    padding: 2rem;
    background: var(--superficie);
    border: 1px solid var(--linea);
    border-radius: 10px;
    box-shadow: var(--sombra);
}

.login-card__brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.login-card__brand img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.login-card h1 {
    margin: 0;
    color: var(--tinta);
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1;
}

.login-card__intro {
    margin: 1.2rem 0 0;
    color: #4b5f7a;
    font-size: 1.08rem;
}

.login-card__details {
    display: grid;
    gap: 0.55rem;
    margin: 1.3rem 0;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--linea);
    border-radius: 8px;
}

.login-card__details span {
    color: var(--texto);
}

.login-card__details span::before {
    content: "";
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.55rem;
    background: var(--teal);
    border-radius: 999px;
    vertical-align: 0.08rem;
}

.boton--login {
    width: 100%;
    min-height: 52px;
    gap: 0.65rem;
    font-size: 1rem;
}

.boton--login svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.formulario-vertical {
    display: grid;
    gap: 0.8rem;
    margin-top: 1.25rem;
}

.confirmacion {
    margin-top: 1.1rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--linea);
    border-radius: 8px;
}

.confirmacion strong {
    display: block;
    color: var(--tinta);
    font-size: 1.35rem;
    line-height: 1.15;
}

.confirmacion p {
    margin: 0.45rem 0 0;
}

.error {
    color: #9f1239;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    font-weight: 700;
}

.metricas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.metrica {
    padding: 1rem;
    background: var(--superficie);
    border: 1px solid var(--linea);
    border-radius: 8px;
}

.metrica span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.metrica strong {
    display: block;
    margin-top: 0.35rem;
    color: var(--tinta);
    font-size: 2rem;
    line-height: 1;
}

.panel-tabla {
    margin-top: 1rem;
    padding: 1rem;
    box-shadow: none;
}

.section-heading {
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.section-heading .eyebrow {
    margin-bottom: 0.2rem;
}

.tabla-wrap {
    overflow-x: auto;
    border: 1px solid var(--linea);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.tabla-wrap table {
    min-width: 940px;
}

th,
td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--linea);
    text-align: left;
    vertical-align: top;
}

th {
    color: #475467;
    background: #f8fafc;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #fbfcfe;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.estado {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 0.65rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.estado--ok {
    color: var(--ok-texto);
    background: var(--ok-fondo);
}

.estado--pendiente {
    color: var(--pendiente-texto);
    background: var(--pendiente-fondo);
}

.acciones-tabla {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 132px;
}

.acciones-tabla form {
    display: inline-flex;
    margin: 0;
}

.icon-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    color: var(--marca-oscura);
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.icon-button:hover {
    color: #fff;
    background: var(--marca);
    border-color: var(--marca);
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-button--danger {
    color: #b42318;
    background: #fff7f7;
    border-color: #fecaca;
}

.icon-button--danger:hover {
    color: #fff;
    background: #b42318;
    border-color: #b42318;
}

.modal {
    width: min(92vw, 440px);
    padding: 0;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.modal::backdrop {
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(3px);
}

.modal__panel {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
}

.modal__header,
.modal__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modal__header h3 {
    margin: 0;
    color: var(--tinta);
    font-size: 1.1rem;
}

.modal__header .eyebrow {
    margin-bottom: 0.2rem;
}

.modal__actions {
    justify-content: flex-end;
}

@media (max-width: 980px) {
    .encabezado {
        align-items: flex-start;
        flex-direction: column;
    }

    .acciones-header {
        width: 100%;
        justify-content: flex-start;
    }

    .hero-panel,
    .hero-panel--success,
    .seccion-actual {
        grid-template-columns: 1fr;
    }

    .panel-comentario {
        position: static;
    }

    .metricas {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .contenedor {
        padding-inline: 0.75rem;
    }

    .hero-panel,
    .panel-inicial,
    .seccion-actual,
    .historial,
    .panel-tabla {
        padding: 1rem;
    }

    .marca small {
        white-space: normal;
    }

    .acciones-header .boton,
    .form-actions button,
    .hero-panel--success .boton {
        width: 100%;
    }

    .form-actions,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .seccion-completada summary {
        align-items: flex-start;
        flex-direction: column;
    }
}
