/* SIDO V6.4 — Archivo documental privado */

/* =====================================================
   01. Variables de diseño y paleta de colores
   ===================================================== */

:root {
    --blue: #1e3a5f;
    --blue-light: #2d5a87;
    --green: #43a047;
    --green-dark: #2e7d32;
    --green-soft: #e8f5e9;
    --green-border: #c8e6c9;

    /* Degradados decorativos del panel de archivo. */
    --green-panel: linear-gradient(180deg, #e8f5e9 0%, #f0fdf4 100%);
    --green-header: linear-gradient(135deg, #2e7d32 0%, #43a047 100%);
    --text: #1a1a1a;
    --muted: #4a5568;
    --line: #e2e8f0;
    --surface: #f7f8fa;
    --shadow: 0 4px 12px #0000001a;

    /* Duraciones de interacción, editables desde un solo lugar. */
    --motion-fast: 180ms;
    --motion-panel: 220ms;
    --motion-ease: ease-out;
    --gradient: linear-gradient(135deg, var(--blue), var(--blue-light));
}

/* =====================================================
   02. Base, accesibilidad y tipografía
   ===================================================== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    cursor: pointer;
}

button:disabled {
    opacity: 0.45;
    cursor: default;
}

a:focus-visible, button:focus-visible {
    outline: 3px solid #83b8ee;
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.ui-icon {
    width: 1.1em;
    height: 1.1em;
    flex: none;
    vertical-align: middle;
}

.ui-icon+span {
    min-width: 0;
}

/* =====================================================
   03. Encabezado y marca
   ===================================================== */

header, footer, .sido-hero {
    background: var(--gradient);
    color: #fff;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    padding: 0.8rem 2rem;
}

header .inner, footer .inner {
    max-width: 1400px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.brand:hover {
    opacity: 0.88;
}

.brand-logo {
    height: 67.2px;
    width: 92.4px;
    object-fit: contain;
}

.brand-text h1 {
    font-size: 1.75rem;
    letter-spacing: -0.5px;
    margin: 0;
    line-height: 1.1;
}

.brand-text small {
    font-size: 0.875rem;
    color: #ffffffd9;
    display: block;
    margin-top: 2px;
}

.contact-link-top {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    color: #ffffffe6;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s;
}

.contact-link-top:hover {
    background: #ffffff26;
    color: #fff;
}

/* =====================================================
   04. Presentación y aviso de archivo privado
   ===================================================== */

.sido-hero {
    text-align: center;
    padding: 2.5rem 2rem 4rem;
}

.sido-hero h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    margin: 0 0 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.sido-hero p {
    font-size: 1.125rem;
    line-height: 1.6;
    color: #ffffffe6;
    margin: 0;
}

.archive-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    max-width: 760px;
    margin: 1rem auto 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ffffff40;
    border-radius: 8px;
    background: #ffffff12;
    color: #fff;
    font-size: 0.83rem;
    line-height: 1.45;
}

.archive-notice .ui-icon {
    font-size: 1.1rem;
}

/* =====================================================
   05. Distribución de columnas y tarjetas
   ===================================================== */

.layout {
    width: 100%;
    max-width: 1600px;
    margin: -2rem auto 0;
    padding: 0 2rem 2rem;
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    flex: 1;
    position: relative;
    z-index: 1;
}

.card {
    min-width: 0;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sidebar {
    padding: 1rem 1.25rem;
}

.label, dt {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}

.label .ui-icon, dt .ui-icon {
    color: var(--blue);
    font-size: 1rem;
}

.value {
    min-height: 42px;
    display: flex;
    align-items: center;
    border: 2px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 0.625rem 0.875rem;
    font-size: 0.9rem;
    margin: 0 0 0.875rem;
    overflow-wrap: anywhere;
}

.value:last-child {
    margin: 0;
}

/* =====================================================
   06. Pestañas y estados de interacción
   ===================================================== */

.tabs {
    display: flex;
    align-items: stretch;
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    gap: 2px;
}

.tabs button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;

    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 1rem 1.25rem;

    /* Tipografía */
    color: #64748b;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0px;
    line-height: 1.2;

    /* Transiciones */
    transition:
        color var(--motion-fast) ease,
        background-color var(--motion-fast) ease,
        border-color var(--motion-fast) ease,
        transform 120ms ease;
}

.tabs button:hover {
    color: var(--blue);
    background: #e9eff5;
}

.tabs button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: -3px;
}

.tabs button:active {
    transform: scale(0.97);
}

.tabs button[aria-selected="true"] {
    color: var(--blue);
    border-bottom-color: var(--blue);
    background: #eef3f8;
}

.tabs #tab-estado:hover, .tabs #tab-estado[aria-selected="true"] {
    color: var(--green-dark);
    background: var(--green-soft);
    border-bottom-color: var(--green);
}

/* =====================================================
   07. Visor del documento y controles de zoom
   ===================================================== */

.panel {
    min-height: 500px;
}

/* Entrada discreta al mostrar una pestaña: sin cambiar su contenido. */
.panel:not([hidden]) {
    animation: panel-enter var(--motion-panel) var(--motion-ease) both;
}

@keyframes panel-enter {
    from {
        opacity: 0.55;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.actions a, .actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: white;
    border: 1px solid #91afe1;
    border-radius: 6px;
    color: #285eaa;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.55rem 0.75rem;
    transition: background 0.2s, box-shadow 0.2s, transform 0.12s;
}

.actions a:hover, .actions button:hover:not(:disabled) {
    background: #eaf2ff;
    box-shadow: 0 2px 5px #1e3a5f14;
}

.actions a:active, .actions button:active:not(:disabled) {
    transform: scale(0.96);
}

.zoom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.zoom button {
    min-height: 34px;
    min-width: 34px;
}

.canvas {
    height: clamp(420px, 65vh, 850px);
    overflow: auto;
    background: #e7e7e7;
    padding: 1rem;
    text-align: center;
}

.canvas img {
    display: block;
    width: 62%;
    max-width: none;
    height: auto;
    margin: auto;
    box-shadow: 0 2px 9px #0003;
    transition: width var(--motion-fast) var(--motion-ease);
}

/* =====================================================
   08. Estado documental archivado
   ===================================================== */

#estado {
    --archive-ink: #2e7d32;
    --archive-soft: #e8f5e9;
    --archive-secondary: #718096;
    --archive-line: #c8e6c9;

    background: var(--green-panel);
    min-height: 0;
    container-type: inline-size;
}

/* 08.1 — Cabecera: información, no validación. */
.status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    /* Capa oscura para conservar contraste del texto blanco. */
    background: #2e7d32;
    color: #ffffff;
    border-bottom: 1px solid var(--archive-line);
    color: #fff;
}

.status-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
}

.status-title .ui-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.status-sub {
    display: block;
    margin-top: 0.35rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.5;
}

.status time {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* 08.2 — Cuerpo y título del documento. */
.body {
    padding: 1.5rem;
}

.body h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.muted {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 08.3 — Tarjetas: icono a la izquierda, texto alineado. */
.archive-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 0;
}

.record {
    min-width: 0;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--archive-line);
    border-radius: 8px;
    box-shadow: 0 1px 3px #0000000f;
    overflow-wrap: anywhere;
}

.archive-fields .record {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    transition: box-shadow 0.2s ease;
}

.archive-fields .record:hover {
    box-shadow: 0 2px 8px #00000014;
}

.record-icon {
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    color: var(--archive-ink);
}

.record-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    min-width: 0;
}

.archive-fields .label {
    margin: 0;
    color: var(--archive-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.4;
}

.record p {
    margin: 0;
    line-height: 1.5;
}

/* 08.4 — Tipografías específicas: código, estado y nombre. */
.verification-code {
    display: inline-block;
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #e8f5e9;
    color: #2e7d32;
    font-family: "SF Mono", Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.status-value {
    color: var(--archive-ink);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.quoted-state {
    color: var(--archive-secondary);
    font-size: 0.8rem;
}

.signer-name {
    font-size: 0.95rem;
    font-weight: 400;
}

/* 08.5 — Firmas consignadas: sección separada a ancho completo. */
.archive-signature {
    padding: 1.5rem;
    border-top: 1px solid var(--archive-line);
    background: #ffffff80;
}

.archive-signature h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    color: var(--archive-ink);
    font-size: 1rem;
    font-weight: 600;
}

.signature-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.875rem;
    border-left: 3px solid #c7d8e5;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.signature-row:hover {
    border-left-color: #2e7d32;
    box-shadow: 0 2px 8px #0000001a;
}

.signature-icon {
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0.55rem;
    border-radius: 50%;
    color: var(--archive-ink);
    background: var(--archive-soft);
}

.signature-main {
    display: flex;
    flex: 1 1 10rem;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.signer-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

.signature-date {
    color: var(--archive-secondary);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.signature-note {
    color: #536174;
    font-size: 0.9rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
}

/* Etiqueta neutral: no se ha comprobado la firma. */
.archive-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

/* 08.6 — Adaptación al ancho real del panel, no solo de pantalla. */
@container (max-width: 590px) {
    .archive-fields {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =====================================================
   09. Detalle documental
   ===================================================== */

.fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 0;
}

.fields>div {
    border: none;
    padding: 0;
    min-width: 0;
}
.fields dd {
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.fields .detail-code {
    background: #f5f6f8;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
}

.full {
    grid-column: 1/-1;
}

/* =====================================================
   10. Pie de página
   ===================================================== */

/* =====================================================
   10. Pie de página
   ===================================================== */

footer {
    margin-top: auto;
    padding: 1.25rem 2rem;
    background: var(--gradient);
}

footer .inner {
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Alineación general */

.footer-brand,
.footer-contact,
.footer-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Nombre del sistema */

.footer-brand {
    font-size: 0.875rem;
    font-weight: 400;
    color: #ffffff;
    gap: 12px;
}

/* Logotipo inferior */

.footer-logo {
    width: 57px;
    height: 30px;
    object-fit: contain;
    border-radius: 0;
}

/* Información de contacto */

.footer-contact {
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-item {
    color: #ffffff;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
}

.footer-item:hover {
    text-decoration: underline;
}

/* Iconos SVG */

.footer-item svg {
    width: 18px;
    height: 18px;
    stroke: #e9b949;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* Iconos PrimeIcons */

.footer-item .pi {
    color: #e9b949;
    font-size: 1rem;
}

/* 11. Diseño adaptable (responsive) */

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 380px minmax(0, 1fr);
    }

}

@media (max-width: 1000px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        padding: 0 1rem 1.5rem;
        gap: 1rem;
    }

    .document-card {
        grid-row: 1;
    }

    .sidebar {
        grid-row: 2;
    }

    .canvas {
        height: 65vh;
        min-height: 280px;
    }

    .canvas img {
        width: 95%;
    }

    .panel {
        min-height: 0;
    }

    .tabs {
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 0.5rem;
    }

    .tabs button {
        flex: 0 1 auto;
        min-width: 0;
        padding: 0.8rem 0.75rem;
    }

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

    .full {
        grid-column: auto;
    }

    header .inner {
        flex-wrap: wrap;
        gap: 8px 14px;
    }

    .brand-logo {
        width: 62px;
        height: 46px;
    }

    .zoom {
        margin-left: 0;
    }

    .sido-hero {
        padding: 2rem 1rem 3.5rem;
    }

    header, footer {
        padding: 1rem;
    }

    .body,
    .archive-signature {
        padding: 1.15rem;
    }

}

/* 11.2 — Alineación móvil recuperada de V4.7. */
@media (max-width: 760px) {
    header .inner {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 10px;
    }

    header .brand {
        width: 100%;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 0;
    }

    .brand-text {
        text-align: center;
        min-width: 0;
    }

    .brand-text small {
        overflow-wrap: anywhere;
    }

    .contact-link-top {
        align-self: center;
        justify-content: center;
    }

    footer .inner,
    footer .footer-brand,
    footer .footer-contact {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    footer .footer-brand {
        gap: 8px;
    }

    footer .footer-contact {
        width: 100%;
        gap: 12px;
    }

    footer .footer-item {
        justify-content: center;
        max-width: 100%;
        min-width: 0;
    }

    footer .footer-item span {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .actions .zoom {
        flex: 1 1 100%;
        flex-wrap: wrap;
        padding-top: 4px;
    }
}

/* 11.3 — Pantallas compactas. */
@media (max-width: 550px) {
    header .inner {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .brand {
        gap: 0.6rem;
    }

    .brand-logo {
        width: 48px;
        height: 42px;
    }

    .brand-text h1 {
        font-size: 1.5rem;
    }

    .brand-text small {
        font-size: 0.72rem;
    }

    .contact-link-top {
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    .sido-hero p {
        font-size: 0.95rem;
    }

    .archive-notice {
        font-size: 0.75rem;
        text-align: left;
    }

    .tabs button {
        font-size: 0.78rem;
        white-space: normal;
        gap: 0.3rem;
        padding: 0.8rem 0.25rem;
    }

    .tabs button .ui-icon {
        width: 1rem;
        height: 1rem;
    }

    .actions .zoom {
        flex-basis: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

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

    .full {
        grid-column: auto;
    }

    .status {
        padding: 1rem;
    }

    .status time {
        font-size: 0.8rem;
    }

    .signature-main {
        flex-basis: calc(100% - 3.125rem);
    }

    .archive-badge {
        margin-left: 3.125rem;
    }

    .footer-contact, .footer-brand {
        align-items: center;
        flex-wrap: wrap;
    }

    .footer-item {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

}

@media (max-width: 360px) {
    .tabs button {
        padding-inline: 5px;
        font-size: 0.75rem;
    }
}

/* 11.4 — Accesibilidad: respetar la preferencia de movimiento. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }

}

