:root {
    --contenedores-green: #1a8d51;
    --contenedores-ink: #173c25;
    --contenedores-muted: #607361;
}

body.page-certificados-contenedores {
    margin: 0;
    background: linear-gradient(180deg, #eef6ef 0%, #f8fbf8 100%);
    color: #203024;
}

.contenedores-overlay {
    min-height: 100vh;
    padding: 38px 20px 72px;
    background:
        radial-gradient(circle at 90% 0%, rgba(46, 204, 113, 0.13), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 249, 244, 0.96));
}

.contenedores-container {
    width: min(1480px, 100%);
    margin: 0 auto;
}

.contenedores-hero {
    margin-bottom: 26px;
    padding: 36px 40px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(12, 42, 23, 0.92), rgba(21, 112, 61, 0.78)),
        url('/img/fondo1.jpeg') center/cover no-repeat;
    color: #fff;
    box-shadow: 0 22px 48px rgba(35, 50, 39, 0.16);
}

.contenedores-kicker {
    margin: 0 0 10px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.contenedores-hero h1 {
    margin: 0;
    font-size: clamp(32px, 4.5vw, 50px);
    line-height: 1.08;
}

.contenedores-hero p:last-child {
    max-width: 760px;
    margin: 14px 0 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 17px;
    line-height: 1.6;
}

.contenedores-workspace {
    display: grid;
    grid-template-columns: minmax(390px, 0.78fr) minmax(600px, 1.22fr);
    align-items: start;
    gap: 22px;
}

.contenedores-panel {
    min-width: 0;
    scroll-margin-top: 110px;
    padding: 26px;
    border: 1px solid rgba(23, 60, 37, 0.09);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 40px rgba(35, 50, 39, 0.08);
}

.contenedores-form-panel {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.contenedores-heading {
    margin-bottom: 20px;
}

.contenedores-heading h2 {
    margin: 0;
    color: var(--contenedores-ink);
    font-size: 26px;
}

.contenedores-heading p {
    margin: 8px 0 0;
    color: var(--contenedores-muted);
    line-height: 1.55;
}

.contenedores-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.contenedores-number-chip {
    flex: 0 0 auto;
    padding: 9px 13px;
    border-radius: 999px;
    background: #e4f7ea;
    color: #116d3b;
    font-size: 13px;
    font-weight: 800;
}

.contenedores-import-panel {
    margin-bottom: 22px;
}

.contenedores-import-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.contenedores-file-field input {
    padding: 7px;
}

.contenedores-file-field input::file-selector-button {
    min-height: 36px;
    margin-right: 10px;
    padding: 0 13px;
    border: 0;
    border-radius: 9px;
    background: #edf2ee;
    color: var(--contenedores-ink);
    font-weight: 800;
    cursor: pointer;
}

.contenedores-import-results {
    display: grid;
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(23, 60, 37, 0.12);
}

.contenedores-import-results[hidden] {
    display: none;
}

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

.contenedores-import-toolbar,
.contenedores-import-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.contenedores-import-toolbar strong {
    display: block;
    color: var(--contenedores-ink);
}

.contenedores-import-toolbar span {
    display: block;
    margin-top: 3px;
    color: var(--contenedores-muted);
    font-size: 13px;
}

.contenedores-inline-actions {
    display: flex;
    gap: 8px;
}

.contenedores-text-button {
    padding: 7px 10px;
    border: 0;
    border-radius: 9px;
    background: #edf2ee;
    color: var(--contenedores-ink);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.contenedores-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(23, 60, 37, 0.12);
    border-radius: 14px;
}

.contenedores-import-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    background: #fff;
}

.contenedores-import-table th,
.contenedores-import-table td {
    padding: 9px;
    border-bottom: 1px solid rgba(23, 60, 37, 0.09);
    text-align: left;
}

.contenedores-import-table th {
    background: #f3f8f4;
    color: #35503d;
    font-size: 12px;
}

.contenedores-import-table tbody tr:last-child td {
    border-bottom: 0;
}

.contenedores-import-table input[type="text"],
.contenedores-import-table input[type="date"] {
    width: 100%;
    min-width: 115px;
    box-sizing: border-box;
    padding: 8px 9px;
    border: 1px solid rgba(23, 60, 37, 0.16);
    border-radius: 9px;
    font: inherit;
}

.contenedores-import-table input[data-import-prop="contenedor"] {
    min-width: 145px;
    text-transform: uppercase;
}

.contenedores-import-footer p {
    margin: 0;
    color: var(--contenedores-muted);
    font-size: 13px;
}

.contenedores-form {
    display: grid;
    gap: 18px;
}

.contenedores-form fieldset {
    min-width: 0;
    margin: 0;
    padding: 17px;
    border: 1px solid rgba(23, 60, 37, 0.13);
    border-radius: 16px;
    background: #f8fbf8;
}

.contenedores-form legend {
    padding: 0 7px;
    color: var(--contenedores-ink);
    font-size: 14px;
    font-weight: 800;
}

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

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

.contenedores-field-wide {
    grid-column: 1 / -1;
}

.contenedores-field > span {
    color: #35503d;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
}

.contenedores-field input,
.contenedores-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(23, 60, 37, 0.17);
    border-radius: 12px;
    background: #fff;
    color: #1f3024;
    padding: 11px 12px;
    font: inherit;
    line-height: 1.4;
    outline: none;
    resize: vertical;
}

.contenedores-field input {
    min-height: 44px;
}

.contenedores-field input:focus,
.contenedores-field textarea:focus {
    border-color: #2ecc71;
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.14);
}

.contenedores-field input[readonly] {
    background: #edf7f0;
    color: #116d3b;
    font-weight: 900;
    cursor: default;
}

.contenedores-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.contenedores-button {
    min-height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    background: #27c86d;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.contenedores-button:hover {
    transform: translateY(-1px);
    background: #20b961;
    box-shadow: 0 10px 22px rgba(32, 185, 97, 0.2);
}

.contenedores-button.secondary {
    background: #edf2ee;
    color: var(--contenedores-ink);
}

.contenedores-status {
    min-height: 20px;
    margin: 0;
    color: var(--contenedores-muted);
    font-size: 13px;
    font-weight: 700;
}

.contenedores-status.is-error {
    color: #b42318;
}

.contenedores-status.is-success {
    color: #168b49;
}

.contenedores-preview-panel {
    position: sticky;
    top: 18px;
}

.contenedores-preview-frame {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: #dfe5df;
    box-shadow: inset 0 0 0 1px rgba(23, 60, 37, 0.08);
}

.contenedores-preview-scaler {
    position: absolute;
    top: 0;
    left: 0;
    width: 210mm;
    height: 296.5mm;
    transform-origin: top left;
}

.contenedor-certificate {
    box-sizing: border-box;
    display: flex;
    width: 210mm;
    height: 296.5mm;
    flex-direction: column;
    overflow: hidden;
    padding: 5mm 14mm 7mm 12mm;
    background: #fff;
    color: #000;
    font-family: "Times New Roman", Times, serif;
    font-size: 11.2pt;
    line-height: 1.18;
}

.contenedor-certificate-header {
    flex: 0 0 auto;
}

.contenedor-certificate-logo {
    display: block;
    width: 36mm;
    height: 28mm;
    object-fit: contain;
    object-position: left center;
}

.contenedor-legal {
    margin-top: 1mm;
    font-size: 10.6pt;
    font-weight: 700;
    line-height: 1.22;
    text-decoration: underline;
}

.contenedor-legal p {
    margin: 0 0 0.8mm;
}

.contenedor-title {
    margin: 8mm 0 5mm;
    text-align: center;
    font-size: 13.4pt;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: underline;
    white-space: nowrap;
}

.contenedor-body {
    display: grid;
    flex: 1 1 auto;
    align-content: start;
    gap: 3.8mm;
    min-height: 0;
}

.contenedor-row {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.contenedor-row strong {
    font-weight: 700;
}

.contenedor-value {
    text-transform: uppercase;
}

.contenedor-signatures {
    flex: 0 0 auto;
    margin-top: 4mm;
}

.contenedor-signatures-title {
    margin: 0 0 2mm;
    font-weight: 700;
}

.contenedor-signatures-images {
    display: flex;
    align-items: flex-end;
    gap: 3mm;
    height: 37mm;
}

.contenedor-signatures-images img {
    display: block;
    width: auto;
    max-width: 47mm;
    height: 34mm;
    object-fit: contain;
    object-position: left bottom;
}

.contenedores-print-output {
    display: none;
}

.contenedores-queue-panel {
    margin-top: 22px;
}

.contenedores-queue-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.contenedores-queue-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(23, 60, 37, 0.11);
    border-radius: 13px;
    background: #f8fbf8;
    min-width: 0;
}

.contenedores-queue-item > div:first-child {
    min-width: 0;
}

.contenedores-queue-item strong,
.contenedores-queue-item span {
    display: block;
}

.contenedores-queue-item strong {
    color: var(--contenedores-ink);
    font-size: 14px;
}

.contenedores-queue-item span {
    margin-top: 3px;
    overflow: hidden;
    color: var(--contenedores-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contenedores-queue-actions {
    display: flex;
    gap: 6px;
}

.contenedores-queue-actions button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: #e8f1ea;
    color: var(--contenedores-ink);
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
}

.contenedores-empty {
    margin: 0 0 18px;
    padding: 18px;
    border: 1px dashed rgba(23, 60, 37, 0.2);
    border-radius: 13px;
    color: var(--contenedores-muted);
    text-align: center;
}

@media (max-width: 1160px) {
    .contenedores-workspace {
        grid-template-columns: 1fr;
    }

    .contenedores-form-panel {
        max-height: none;
        overflow: visible;
    }

    .contenedores-preview-panel {
        position: static;
    }

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

@media (max-width: 700px) {
    .contenedores-overlay {
        padding: 24px 10px 48px;
    }

    .contenedores-hero,
    .contenedores-panel {
        padding: 22px 18px;
        border-radius: 18px;
    }

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

    .contenedores-heading-row,
    .contenedores-import-toolbar,
    .contenedores-import-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .contenedores-import-form,
    .contenedores-import-common {
        grid-template-columns: 1fr;
    }

    .contenedores-field-wide {
        grid-column: auto;
    }

    .contenedores-actions {
        flex-direction: column-reverse;
    }

    .contenedores-button {
        width: 100%;
    }
}

@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    html,
    body {
        width: 210mm !important;
        min-width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body > *:not(.contenedores-print-output) {
        display: none !important;
    }

    .contenedores-print-output {
        position: static !important;
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .contenedores-print-output .contenedor-certificate {
        display: flex !important;
        width: 210mm !important;
        height: 296.5mm !important;
        margin: 0 !important;
        break-after: page !important;
        break-inside: avoid-page !important;
        page-break-after: always !important;
        page-break-inside: avoid !important;
        box-shadow: none !important;
    }

    .contenedores-print-output .contenedor-certificate:last-child {
        break-after: auto !important;
        page-break-after: auto !important;
    }
}
