:root {
    --bg-top: #f4efe4;
    --bg-bottom: #e9ecef;
    --panel: #ffffff;
    --panel-soft: #f7f9fb;
    --line: #d7dee7;
    --line-strong: #b9c5d3;
    --text: #122235;
    --muted: #5e6f84;
    --brand: #0a4f8f;
    --brand-soft: #dbeeff;
    --ok: #1e8e5a;
    --ok-soft: #dbf7e9;
    --ko: #c63c2c;
    --ko-soft: #ffe5e0;
    --raw: #7c4d00;
    --raw-soft: #ffe8c6;
    --focus: #f39c12;
    --radius: 14px;
    --shadow: 0 12px 26px rgba(15, 38, 63, 0.11);
    --a2-right-width: 420px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(155deg, var(--bg-top), var(--bg-bottom));
}

body.a2-hermanos-busy,
body.a2-hermanos-busy * {
    cursor: progress !important;
}

.a2-topbar {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) auto minmax(220px, 1fr);
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(10, 79, 143, 0.16);
    background: linear-gradient(90deg, #ffffff, #f2f8ff 56%, #edf4fc);
}

.a2-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.a2-brand-text {
    min-width: 0;
}

.a2-chip {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 170px;
    height: 58px;
    border-radius: 16px 0 16px 16px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.24);
    flex: 0 0 auto;
}

.a2-chip svg {
    display: block;
    width: 100%;
    height: 100%;
}

.a2-title {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
}

.a2-sub {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.a2-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    justify-self: center;
}

.a2-nav a,
.a2-nav span {
    text-decoration: none;
    border: 1px solid rgba(10, 79, 143, 0.14);
    background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
    color: var(--text);
    border-radius: 999px;
    padding: 11px 18px;
    min-height: 44px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.03em;
    box-shadow: 0 8px 18px rgba(10, 79, 143, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.a2-nav a:hover,
.a2-nav span:hover {
    transform: translateY(-1px);
    border-color: rgba(10, 79, 143, 0.3);
    box-shadow: 0 12px 22px rgba(10, 79, 143, 0.14);
}

.a2-nav .active {
    border-color: #0a4f8f;
    background: linear-gradient(135deg, #0a4f8f 0%, #1c78c8 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(10, 79, 143, 0.22);
}

.backend-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    justify-self: end;
}

.backend-status-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-self: end;
    margin-left: auto;
    gap: 5px;
}

.a2-version {
    font-size: 11px;
    font-family: ui-monospace, monospace;
    font-weight: 600;
    color: #0a4f8f;
    background: rgba(10, 79, 143, 0.08);
    border: 1px solid rgba(10, 79, 143, 0.2);
    border-radius: 6px;
    padding: 2px 7px;
    align-self: center;
    white-space: nowrap;
}

.a2-version--backend {
    align-self: flex-end;
    margin-right: 0;
}

.backend-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--muted);
}

.backend-status.checking {
    background: #fff6e7;
    border-color: #f6d79a;
    color: #946200;
}

.backend-status.checking .backend-status-dot {
    background: #d97706;
}

.backend-status.online {
    background: var(--ok-soft);
    border-color: #bee8d3;
    color: var(--ok);
}

.backend-status.online .backend-status-dot {
    background: var(--ok);
}

.backend-status.offline {
    background: var(--ko-soft);
    border-color: #ffd0cb;
    color: var(--ko);
}

.backend-status.offline .backend-status-dot {
    background: var(--ko);
}

#backendStatusRetryBtn {
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

#backendStatusRetryBtn:hover {
    text-decoration: underline;
}

.a2-layout {
    min-height: calc(100vh - 78px);
    display: grid;
    grid-template-columns: minmax(580px, 1fr) 12px minmax(320px, var(--a2-right-width));
    gap: 8px;
    padding: 12px;
}

.a2-splitter {
    align-self: stretch;
    width: 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, #dbe7f3, #c8d7e8);
    border: 1px solid #b6c8dc;
    cursor: col-resize;
    position: relative;
}

.a2-splitter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 56px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background: rgba(17, 63, 110, 0.28);
}

.a2-splitter:focus-visible {
    outline: 2px solid #2680d8;
    outline-offset: 1px;
}

body.a2-resizing,
body.a2-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.a2-main,
.a2-right {
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
}

.a2-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    padding: 12px;
}

.a2-toolbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border: 1px solid #d9e1ea;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.a2-toolbar-top {
    display: grid;
    grid-template-columns: minmax(110px, 140px) minmax(130px, 190px) 22px minmax(280px, 1fr) auto;
    gap: 12px;
    align-items: center;
    justify-content: start;
    padding-bottom: 0;
    border-bottom: none;
}

.a2-toolbar-top>#openRecordEditorBtn {
    justify-self: end;
    margin-left: 0;
}

#engineFilterSelect {
    width: 100%;
    max-width: 140px;
}

#recordIdInput {
    width: 100%;
    max-width: 190px;
}

.a2-toolbar-top>.a2-meta {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
    min-width: 0;
}

.a2-toolbar-primary-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    min-width: 0;
}

.a2-toolbar-bottom {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
}

.a2-toolbar input,
.a2-toolbar select,
.a2-toolbar button,
.a2-edit-grid input,
.a2-edit-grid select,
.a2-process-actions button,
.a2-outcome-row button {
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    height: 30px;
    font-family: inherit;
    font-size: 12px;
}

.a2-toolbar input,
.a2-toolbar select,
.a2-edit-grid input,
.a2-edit-grid select {
    padding: 0 10px;
    background: #ffffff;
    color: var(--text);
}

#recordIdInput {
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.a2-toolbar button,
.a2-process-actions button,
.a2-outcome-row button {
    cursor: pointer;
    background: #edf4fb;
    color: #0e4f8d;
    font-weight: 700;
}

.a2-toolbar #loadRecordBtn,
.a2-toolbar #recalculateRecordBtn,
.a2-toolbar #recomputeAllBtn {
    font-size: 12px;
    letter-spacing: 0.01em;
}

.a2-search-submit {
    background: linear-gradient(135deg, #1f6fe3, #195ec5) !important;
    color: #ffffff !important;
    border-color: #1b63cf !important;
    font-weight: 800;
}

.a2-search-submit:hover {
    filter: brightness(1.05);
}

.a2-toolbar-top>#loadRecordBtn.a2-top-search-btn {
    width: 22px;
    height: 22px;
    min-height: 22px;
    padding: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #888888;
    border-color: #cccccc;
    flex-shrink: 0;
}

.a2-toolbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 14px;
    border: 1px solid rgba(10, 79, 143, 0.18);
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #eef5fd 100%);
    color: #0a4f8f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.a2-toolbar-primary-actions .a2-toolbar-link:last-child {
    flex: 0;
}

.a2-toolbar-link:hover {
    transform: translateY(-1px);
    border-color: rgba(10, 79, 143, 0.32);
    box-shadow: 0 8px 18px rgba(10, 79, 143, 0.12);
}

.a2-toolbar-link:focus-visible {
    outline: 2px solid #2680d8;
    outline-offset: 1px;
}




.a2-search-nav {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    width: 100%;
    min-height: 40px;
    padding: 4px 5px;
    border-radius: 9px;
}

.a2-search-nav.is-record {
    border: 1px solid #bfd3f6;
    background: #edf4ff;
}

.a2-search-nav.is-error {
    border: 1px solid #f1c2bc;
    background: #fff2f1;
}

.a2-search-nav.is-review {
    border: 1px solid #d9c7f4;
    background: #f5efff;
}

.a2-search-nav.is-copy {
    border: 1px solid #f1c849;
    background: linear-gradient(180deg, #fff8de, #ffeaa3);
}

.a2-search-nav.is-pending {
    border: 1px solid #f0b4ad;
    background: linear-gradient(180deg, #fff3f1, #ffe1dd);
}

.a2-recompute-top-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-items: center;
    min-height: 40px;
    padding: 4px 5px;
    border: 1px solid #b7e0c8;
    border-radius: 9px;
    background: linear-gradient(180deg, #f6fffa, #e8f8ef);
}

.a2-toolbar #recalculateRecordBtn {
    height: 28px;
    border-radius: 8px;
    border-color: #be3b3b;
    background: #df4a4a;
    color: #ffffff;
    font-size: 10px;
}

.a2-toolbar #recalculateRecordBtn:hover {
    background: #cd3d3d;
    border-color: #a63434;
}

.a2-toolbar #recomputeAllBtn {
    height: 28px;
    border-radius: 8px;
    background: #e1f5e9;
    color: #134c2e;
    border-color: #83c29d;
    font-size: 10px;
}

.a2-toolbar #recomputeAllBtn:hover {
    background: #d9f0df;
    color: #18532e;
    border-color: #7fbe95;
}

.a2-search-nav-center {
    flex: 1;
    min-width: 0;
    height: 20px;
    border: 1px solid transparent;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.a2-search-nav.is-record .a2-search-nav-center {
    color: #1f4f82;
}

.a2-search-nav.is-error .a2-search-nav-center {
    color: #9f2f23;
}

.a2-search-nav.is-review .a2-search-nav-center {
    color: #6a38b3;
}

.a2-search-nav.is-copy .a2-search-nav-center {
    color: #8a5a05;
}

.a2-search-nav.is-pending .a2-search-nav-center {
    color: #b42318;
}

.a2-btn-nav {
    width: 22px;
    min-width: 22px;
    height: 20px;
    padding: 0;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    border-radius: 7px;
}

.a2-btn-nav-record {
    color: #1f4f82;
    background: #e5eff9;
    border-color: #a8c2de;
}

.a2-btn-nav-record:hover {
    color: #1a436d;
    background: #d8e7f6;
    border-color: #8eaecd;
}

.a2-btn-nav-record:focus-visible {
    outline: 2px solid #3b78b8;
    outline-offset: 1px;
}

.a2-btn-nav-err {
    font-size: 12px;
    color: #9f2f23;
    background: #ffe9e6;
    border-color: #efb2ab;
}

.a2-btn-nav-err:hover {
    background: #ffd8d3;
    border-color: #e89187;
    color: #8f2318;
}

.a2-btn-nav-err:focus-visible {
    outline: 2px solid #d6453a;
    outline-offset: 1px;
}

#prevPendingBtn,
#nextPendingBtn {
    color: #a33125;
    background: #ffecea;
    border-color: #efbbb3;
}

#prevReviewBtn,
#nextReviewBtn {
    color: #6a38b3;
    background: #efe4ff;
    border-color: #cbb0ee;
}

#prevPendingBtn:hover,
#nextPendingBtn:hover {
    color: #872317;
    background: #ffdcd8;
    border-color: #e69e95;
}

#prevReviewBtn:hover,
#nextReviewBtn:hover {
    color: #562896;
    background: #e5d5ff;
    border-color: #b792e5;
}

#prevPendingBtn:focus-visible,
#nextPendingBtn:focus-visible {
    outline: 2px solid #d6453a;
    outline-offset: 1px;
}

#prevReviewBtn:focus-visible,
#nextReviewBtn:focus-visible {
    outline: 2px solid #7b45c9;
    outline-offset: 1px;
}

.a2-toolbar button:hover,
.a2-process-actions button:hover,
.a2-outcome-row button:hover {
    filter: brightness(0.96);
}

.a2-stats-row {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
}

.a2-stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #d7dee7;
    background: linear-gradient(180deg, #ffffff, #f5f8fb);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.a2-stat-head-row {
    display: flex;
    align-items: center;
    min-height: 18px;
    padding-right: 44px;
}

.a2-stat-mini-nav {
    position: absolute;
    top: 7px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.a2-stat-mini-btn {
    width: 17px;
    min-width: 17px;
    height: 17px;
    padding: 0;
    border: 1px solid #9cb4cd;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #e9f1fa 100%);
    color: #2e516f;
    font-size: 9px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(30, 60, 90, 0.14);
    transition: background 0.14s ease, border-color 0.14s ease, transform 0.12s ease, box-shadow 0.14s ease;
}

.a2-stat-mini-btn:hover {
    background: linear-gradient(180deg, #f8fcff 0%, #dce9f7 100%);
    border-color: #83a2c1;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95), 0 2px 4px rgba(28, 64, 101, 0.18);
}

.a2-stat-mini-btn:active {
    transform: translateY(1px);
}

.a2-stat-mini-btn:focus-visible {
    outline: 2px solid #6695c6;
    outline-offset: 1px;
}

.a2-stat-main,
.a2-stat-inline-total,
.a2-stat-total-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    line-height: 1;
    color: var(--text);
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.a2-stat-main {
    min-height: 22px;
}

.a2-stat-current,
.a2-stat-inline-number {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.75;
    line-height: 1;
    color: var(--text);
}

.a2-stat-of,
.a2-stat-inline-separator {
    font-size: 11px;
    opacity: 0.5;
    font-weight: 500;
    line-height: 1;
    color: var(--muted);
}

.a2-stat-total,
.a2-stat-card strong {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1;
    color: var(--text);
}

.a2-stat-unique,
.a2-stat-inline-unique {
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.7;
    line-height: 1.1;
    font-weight: 500;
    color: #6c7e92;
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.a2-stat-card.is-ok {
    border-color: #b7e0c8;
    background: linear-gradient(180deg, #f6fffa, #e8f8ef);
}

.a2-stat-card.is-copy {
    border-color: #f1c849;
    background: linear-gradient(180deg, #fff8de, #ffeaa3);
}

.a2-stat-card.is-review {
    border-color: #d9c7f4;
    background: linear-gradient(180deg, #f7f2ff, #ece1ff);
}

.a2-stat-card.is-ko {
    border-color: #f0beb7;
    background: linear-gradient(180deg, #fff7f5, #ffe9e6);
}

.a2-stat-card.is-pending {
    border-color: #f0b4ad;
    background: linear-gradient(180deg, #fff3f1, #ffe1dd);
}

.a2-stat-card.is-error {
    border-color: #f3ca74;
    background: linear-gradient(180deg, #fff8e8, #ffefc8);
}

.a2-stat-card.is-state-ok {
    border-color: #94d3ae;
    background: linear-gradient(180deg, #f3fff8, #ddf5e8);
}

.a2-stat-card.is-import-sep {
    margin-left: 8px;
}

.a2-stat-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}

.a2-auto-recompute-controls {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr) auto auto;
    grid-template-areas:
        "engine id dry update"
        "force force run pdf";
    gap: 10px 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid #d5e4f2;
    border-radius: 14px;
    background: linear-gradient(145deg, #f8fbff, #edf4fb);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.a2-auto-recompute-controls select,
.a2-auto-recompute-controls input,
.a2-auto-recompute-controls button {
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    height: 36px;
    font-family: inherit;
    font-size: 12px;
}

#recomputeEngineSelect {
    grid-area: engine;
}

#recomputeIdInput {
    grid-area: id;
}

.a2-auto-recompute-check[for="recomputeDryRunInput"] {
    grid-area: dry;
}

.a2-auto-recompute-check[for="recomputeUpdateRevisionInput"] {
    grid-area: update;
}

.a2-recompute-force-label {
    grid-area: force;
}

#recomputeRunBtn {
    grid-area: run;
}

#recomputePdfRunBtn {
    grid-area: pdf;
}

.a2-auto-recompute-controls select,
.a2-auto-recompute-controls input {
    padding: 0 12px;
    background: #ffffff;
    color: var(--text);
}

.a2-auto-recompute-controls button {
    cursor: pointer;
    background: linear-gradient(135deg, #0f5a98, #1c7bd0);
    border-color: #115f9f;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.a2-auto-recompute-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(15, 90, 152, 0.24);
    filter: saturate(1.06);
}

#recomputePdfRunBtn {
    background: linear-gradient(135deg, #1b4a85, #155a99);
    border-color: #1a4f88;
}

.a2-auto-recompute-controls button[disabled] {
    opacity: 0.7;
    cursor: progress;
    transform: none;
    box-shadow: none;
}

.a2-auto-recompute-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #34536f;
    font-weight: 700;
    white-space: normal;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid #cfdeec;
    background: #f7fbff;
}

.a2-auto-recompute-check input {
    width: 14px;
    height: 14px;
    margin: 0;
}

.a2-recompute-force-label {
    color: #b45309;
    opacity: 0.5;
    transition: opacity 0.2s, border-color 0.2s, background-color 0.2s;
}

.a2-recompute-force-label:has(input:checked) {
    opacity: 1;
    color: #b91c1c;
    border-color: #f1b7b0;
    background: #fff4f3;
}

.a2-auto-recompute-status {
    margin: 2px 0 0;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid #d5e3f0;
    background: #f8fbff;
    font-size: 11px;
    color: #36536d;
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.a2-auto-recompute-status.is-ok {
    color: #16613f;
    border-color: #b9dfc9;
    background: #eefaf2;
}

.a2-auto-recompute-status.is-error {
    color: #9f2f23;
    border-color: #efc2bc;
    background: #fff3f1;
}

.a2-recompute-section {
    margin-bottom: 10px;
}

.a2-recompute-section h3 {
    margin: 0 0 4px;
    font-size: 12px;
    color: #163552;
}

.a2-recompute-help {
    margin: 0 0 8px;
    color: #55728c;
    font-size: 11px;
}

.a2-recompute-compact {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    grid-auto-flow: dense;
    grid-template-areas:
        "step1 step2 step3 step4 step5";
    gap: 10px;
}

.a2-recompute-book-picker {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #eef5fd;
    border: 1px solid #c9dcec;
    border-radius: 10px;
    padding: 5px 12px 5px 10px;
    font-size: 11px;
    color: #284762;
    font-weight: 700;
    white-space: nowrap;
}

.a2-recompute-card[aria-label="Copiar datos leídos del PDF"] {
    grid-area: step1;
}

.a2-recompute-card[aria-label="Actualizar campos SUST desde EXCEL_SUSTITUCION"] {
    grid-area: step2;
}

.a2-recompute-card[aria-label="Calcular campos FINAL desde GESA"] {
    grid-area: step3;
}

.a2-recompute-card[aria-label="Recalcular errores"] {
    grid-area: step4;
}

.a2-recompute-card[aria-label="Recalcular estado y acción de revisión"] {
    grid-area: step5;
}

@media (max-width: 1200px) {
    .a2-recompute-compact {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "step1 step2 step3"
            "step4 step5 step5";
    }
}

@media (max-width: 960px) {
    .a2-recompute-compact {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "step1 step2"
            "step3 step4"
            "step5 step5";
    }
}

@media (max-width: 600px) {
    .a2-recompute-compact {
        grid-template-columns: 1fr;
        grid-template-areas:
            "step1"
            "step2"
            "step3"
            "step4"
            "step5";
    }
}

.a2-recompute-compact .a2-recompute-card {
    width: 100%;
}

.a2-recompute-book-picker select {
    border: none;
    background: transparent;
    color: #17344f;
    font-size: 12px;
    font-weight: 700;
    padding: 0 2px;
    height: auto;
    cursor: default;
    outline: none;
    pointer-events: none;
    appearance: none;
    -webkit-appearance: none;
}

.a2-recompute-card {
    display: flex;
    flex-direction: column;
    min-height: 360px;
    border: 1px solid #d5e4f2;
    border-radius: 12px;
    padding: 11px;
    background: linear-gradient(180deg, #fafdff, #f1f7fd);
}

.a2-recompute-card h3 {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 12px;
    color: #163552;
}

.a2-recompute-card h3>div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.a2-step-index {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    background: #eaf3fc;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.a2-step-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #163552;
}

.a2-step-desc {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #5a7a8f;
    margin: 0;
}

.a2-recompute-card[aria-label="Copiar datos leídos del PDF"] .a2-step-index {
    background: linear-gradient(135deg, #1f6fe3, #195ec5);
}

.a2-recompute-card[aria-label="Actualizar campos SUST desde EXCEL_SUSTITUCION"] .a2-step-index {
    background: linear-gradient(135deg, #1f8fdb, #0f6fb2);
}

.a2-recompute-card[aria-label="Calcular campos FINAL desde GESA"] .a2-step-index {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.a2-recompute-card[aria-label="Recalcular errores"] .a2-step-index {
    background: linear-gradient(135deg, #e63946, #c41e3a);
}

.a2-recompute-card[aria-label="Recalcular estado y acción de revisión"] .a2-step-index {
    background: linear-gradient(135deg, #f0ad4e, #ec971f);
}

.a2-recompute-card .a2-recompute-help:last-of-type {
    margin-bottom: 9px;
}

.a2-recompute-color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 9px;
}

.a2-color-tag {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.a2-color-tag.is-pos {
    background: #eef6ff;
    border-color: #bfd7f7;
    color: #1a4f88;
}

.a2-color-tag.is-pn {
    background: #eafdf4;
    border-color: #b4efd1;
    color: #0f6a44;
}

.a2-color-tag.is-designation {
    background: #fff9ea;
    border-color: #f3dfb1;
    color: #8a6110;
}

.a2-color-tag.is-model {
    background: #f3f1ff;
    border-color: #d4cdf8;
    color: #4f3b9a;
}

.a2-color-tag.is-qty {
    background: #f0fbff;
    border-color: #bfebf6;
    color: #17677d;
}

.a2-color-tag.is-units {
    background: #fff3f8;
    border-color: #f1c7d9;
    color: #8f2e57;
}

.a2-color-tag.is-weight {
    background: #fff2f0;
    border-color: #efc4bd;
    color: #9a2f24;
}

.a2-recompute-card button {
    margin-top: auto;
    width: 100%;
    border: 1px solid #1b63cf;
    border-radius: 10px;
    height: 34px;
    padding: 0 10px;
    cursor: pointer;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, #1f6fe3, #195ec5);
}

.a2-recompute-card #recomputeRunBtn {
    border-color: #ad231a;
    background: linear-gradient(135deg, #d6362a, #b32117);
}

.a2-recompute-card #recomputeCalculateFinalBtn {
    border-color: #1a6e28;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.a2-recompute-card #recomputeRevisionStatusBtn {
    border-color: #b8860b;
    background: linear-gradient(135deg, #f0ad4e, #ec971f);
}

.a2-recompute-card button:hover {
    filter: brightness(1.05);
}

.a2-recompute-card button[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

.a2-recompute-current {
    padding: 12px;
    border: 1px solid #d5e4f2;
    border-radius: 12px;
    background: linear-gradient(180deg, #f9fcff, #f0f6fd);
}

.a2-recompute-current-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.a2-recompute-current-actions button {
    border: 1px solid #1b63cf;
    border-radius: 10px;
    height: 34px;
    padding: 0 10px;
    cursor: pointer;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, #1f6fe3, #195ec5);
}

.a2-recompute-current-actions #recomputeErrorsCurrentBtn {
    border-color: #ad231a;
    background: linear-gradient(135deg, #d6362a, #b32117);
}

.a2-recompute-current-actions button:hover {
    filter: brightness(1.05);
}

.a2-recompute-current-actions button[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
    box-shadow: none;
}

.a2-local-recalc-box {
    margin-top: 10px;
    padding: 12px;
    border: 1px solid #d5e4f2;
    border-radius: 12px;
    background: linear-gradient(180deg, #f7fbff, #eff5fc);
}

.a2-local-recalc-box h3 {
    margin: 0;
    font-size: 12px;
    color: #193a58;
    letter-spacing: 0.01em;
}

.a2-local-recalc-help {
    margin: 5px 0 10px;
    color: #486680;
    font-size: 11px;
}

.a2-local-recalc-modes {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.a2-local-recalc-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #2f536f;
    border: 1px solid #cfe0ef;
    border-radius: 999px;
    background: #ffffff;
    padding: 7px 10px;
}

.a2-local-recalc-actions {
    margin-top: 10px;
}

#localRecalcBtn {
    border: 1px solid #1b6a3f;
    border-radius: 10px;
    height: 34px;
    padding: 0 12px;
    cursor: pointer;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #218652, #1c7346);
}

#localRecalcBtn:hover {
    filter: saturate(1.06);
    box-shadow: 0 8px 14px rgba(20, 98, 56, 0.22);
}

#localRecalcBtn[disabled] {
    opacity: 0.7;
    cursor: progress;
    box-shadow: none;
}

.a2-local-recalc-summary {
    margin-top: 10px;
    border: 1px solid #d4e3f0;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px;
    font-size: 11px;
}

.lrs-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.lrs-title {
    color: #14324f;
}

.lrs-ts {
    color: #62809a;
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.lrs-stats {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
}

.lrs-stat-label {
    color: #4f6a82;
}

.lrs-stat-val {
    color: #17334f;
    font-weight: 700;
}

.lrs-stat-errors {
    color: #a73124;
}

.lrs-error-list {
    margin: 8px 0 0;
    padding-left: 18px;
    max-height: 160px;
    overflow: auto;
}

.lrs-item {
    margin: 3px 0;
}

.lrs-item-label {
    display: inline-block;
    min-width: 120px;
    margin-right: 8px;
    color: #1f3f5f;
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.lrs-err-code {
    display: inline-block;
    margin: 1px 4px 1px 0;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    border: 1px solid transparent;
}

.lrs-sev-error {
    background: #fff2f0;
    border-color: #efc4bd;
    color: #9a2f24;
}

.lrs-sev-warning {
    background: #fff9ec;
    border-color: #efd8a1;
    color: #8a6110;
}

.lrs-more,
.lrs-ok {
    margin: 8px 0 0;
    color: #547088;
}

.recompute-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recompute-modal[hidden] {
    display: none;
}

.recompute-modal-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 22% 8%, rgba(39, 95, 148, 0.22), rgba(7, 17, 29, 0.6));
    backdrop-filter: blur(2px);
}

.recompute-modal-panel {
    position: relative;
    background: linear-gradient(180deg, #fbfdff, #f4f8fd);
    border: 1px solid #d3e2f1;
    border-radius: 16px;
    box-shadow: 0 22px 44px rgba(8, 31, 56, 0.28);
    width: min(960px, 96vw);
    max-height: min(78vh, 760px);
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.recompute-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px 12px;
    border-bottom: 1px solid #d7e4f2;
    background: linear-gradient(180deg, #ffffff, #f1f6fc);
}

.recompute-modal-header>div {
    flex: 1;
}

.recompute-modal-header h2 {
    margin: 0;
    font-size: 17px;
    color: #14324e;
    letter-spacing: 0.01em;
}

.recompute-modal-subtitle {
    margin: 4px 0 0;
    font-size: 11px;
    color: #4f6780;
}

.recompute-modal-close {
    background: #ffffff;
    border: 1px solid #d2e1ee;
    font-size: 22px;
    cursor: pointer;
    color: #4f677e;
    line-height: 1;
    padding: 2px 10px;
    border-radius: 10px;
}

.recompute-modal-close:hover {
    background: #edf5fd;
    color: #1a2d42;
}

.recompute-modal-body {
    padding: 12px 14px 14px;
    display: grid;
    gap: 8px;
}

.recompute-result-panel {
    margin-top: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #fbfdff, #f4f8fc);
    overflow: hidden;
}

.recompute-result-head {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
}

.recompute-result-head h3 {
    margin: 0;
    font-size: 14px;
    color: #18324a;
}

.recompute-result-meta {
    margin: 0;
    font-size: 11px;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    color: #52708c;
}

.recompute-result-body {
    padding: 14px 16px 16px;
    display: grid;
    gap: 12px;
}

.recompute-result-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.recompute-result-kpi {
    border: 1px solid #d7e2ee;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px 12px;
    display: grid;
    gap: 4px;
}

.recompute-result-kpi-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6a8096;
}

.recompute-result-kpi-value {
    font-size: 13px;
    font-weight: 700;
    color: #17324a;
}

.recompute-result-table-wrap {
    overflow: auto;
    border: 1px solid #d7e2ee;
    border-radius: 12px;
    background: #ffffff;
}

.recompute-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.hermanos-progress-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hermanos-progress-modal[hidden] {
    display: none;
}

.hermanos-progress-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 26% 12%, rgba(44, 119, 70, 0.26), rgba(9, 19, 31, 0.62));
    backdrop-filter: blur(2px);
}

.hermanos-progress-panel {
    position: relative;
    width: min(760px, 94vw);
    max-height: min(80vh, 820px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #c8ddd0;
    background: linear-gradient(180deg, #fcfffd, #f2fbf5);
    box-shadow: 0 22px 46px rgba(10, 37, 25, 0.3);
}

.hermanos-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #d7e9dc;
    background: linear-gradient(180deg, #ffffff, #eef9f1);
}

.hermanos-progress-header h2 {
    margin: 0;
    font-size: 17px;
    color: #153726;
    letter-spacing: 0.01em;
}

.hermanos-progress-subtitle {
    margin: 4px 0 0;
    font-size: 11px;
    color: #466858;
}

.hermanos-progress-close {
    background: #ffffff;
    border: 1px solid #cde2d4;
    font-size: 22px;
    cursor: pointer;
    color: #496a58;
    line-height: 1;
    padding: 2px 10px;
    border-radius: 10px;
}

.hermanos-progress-close:hover {
    background: #eaf7ef;
    color: #1f3e2f;
}

.hermanos-progress-close:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hermanos-progress-body {
    padding: 14px 20px 20px;
    display: grid;
    gap: 10px;
}

.hermanos-progress-track {
    width: 100%;
    height: 14px;
    border-radius: 999px;
    border: 1px solid #bcd8c6;
    background: #eaf5ee;
    overflow: hidden;
}

.hermanos-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #1f8b58, #46b57a);
    transition: width 0.2s ease;
}

.hermanos-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: #244936;
    font-weight: 700;
}

.hermanos-progress-stats {
    border: 1px solid #d2e5d9;
    border-radius: 10px;
    background: #f8fcf9;
    color: #315645;
    font-size: 11px;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    padding: 8px 10px;
}

.hermanos-progress-log {
    border: 1px solid #d2e5d9;
    border-radius: 12px;
    background: #ffffff;
    min-height: 180px;
    max-height: 320px;
    overflow: auto;
    padding: 8px;
    display: grid;
    gap: 6px;
}

.hermanos-progress-log-item {
    border: 1px solid #e2ece6;
    border-radius: 8px;
    background: #f9fcfa;
    padding: 6px 8px;
    font-size: 11px;
    color: #355845;
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.hermanos-progress-log-item.is-error {
    border-color: #f0c7bf;
    background: #fff5f3;
    color: #8e2f22;
}

.hermanos-progress-log-item.is-ok {
    border-color: #c9e8d5;
    background: #f1fbf5;
    color: #1c5e3c;
}

.hermanos-progress-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.hermanos-progress-cancel {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #e0b5ad;
    border-radius: 10px;
    background: linear-gradient(180deg, #fff7f6, #ffeae7);
    color: #8a2a1e;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.16s ease;
}

.hermanos-progress-cancel:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(138, 42, 30, 0.16);
}

.hermanos-progress-cancel:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.recompute-result-table th,
.recompute-result-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e6edf5;
    text-align: left;
    vertical-align: top;
}

.recompute-result-table th {
    position: sticky;
    top: 0;
    background: #eef4fa;
    color: #264763;
    font-size: 11px;
    z-index: 1;
}

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

.recompute-result-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.recompute-result-status.is-updated {
    background: #e4f6ea;
    color: #19613e;
}

.recompute-result-status.is-same {
    background: #edf2f7;
    color: #536578;
}

.recompute-result-match {
    font-weight: 700;
    color: #19613e;
}

.recompute-result-mismatch {
    font-weight: 700;
    color: #a0392a;
}

.recompute-result-empty {
    margin: 0;
    padding: 12px 14px;
    border: 1px dashed #c8d8e6;
    border-radius: 12px;
    background: #ffffff;
    color: #526d86;
    font-size: 12px;
}

.backend-badge {
    margin-left: auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: #ffffff;
}

.backend-badge.online {
    color: var(--ok);
    border-color: #bee8d3;
    background: var(--ok-soft);
}

.backend-badge.offline {
    color: var(--ko);
    border-color: #ffd0cb;
    background: var(--ko-soft);
}

.backend-badge.checking {
    color: #946200;
    border-color: #f6d79a;
    background: #fff6e7;
}

.a2-meta {
    border: 1px solid #d9e1ea;
    background: #f8fbff;
    border-radius: 8px;
    padding: 3px 6px;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    min-width: 0;
    overflow: hidden;
}

.a2-meta-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
    font-size: 10px;
    color: #2c445e;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
}

.a2-meta-item {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
}

.a2-meta-item-designation {
    flex: 1;
    min-width: 140px;
}

.a2-meta-item-pn {
    max-width: 130px;
}

.a2-meta-item-pn .a2-meta-v {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.a2-meta-k {
    color: #607a97;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.a2-meta-v {
    font-size: 11px;
    line-height: 1.1;
    color: #18314a;
}

.a2-meta-item-designation .a2-meta-v {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.a2-meta-sep {
    color: #9ab0c7;
    font-size: 10px;
}

.a2-toolbar .a2-meta-edit-btn,
.a2-meta-edit-btn {
    margin-left: auto;
    flex-shrink: 0;
    min-height: 22px;
    padding: 2px 8px;
    border: 1px solid #1b63cf;
    border-radius: 999px;
    background: linear-gradient(135deg, #1f6fe3, #195ec5);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: filter 120ms ease, box-shadow 120ms ease;
}

.a2-toolbar .a2-meta-edit-btn:hover,
.a2-meta-edit-btn:hover {
    filter: brightness(1.05);
    box-shadow: none;
}

.a2-toolbar .a2-meta-delete-btn,
.a2-meta-delete-btn {
    margin-left: 8px;
    border: 1px solid #ad231a;
    background: linear-gradient(135deg, #d6362a, #b32117);
}

.a2-toolbar #loadRecordBtn,
.a2-toolbar #openEditRecordBtn {
    min-height: 22px;
    height: 22px;
    padding: 2px 8px;
    border: 1px solid #1b63cf;
    border-radius: 999px;
    background: linear-gradient(135deg, #1f6fe3, #195ec5);
    color: #ffffff;
    font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.a2-toolbar #openRecomputeModalBtn {
    min-height: 22px;
    height: 22px;
    padding: 2px 8px;
    border: 1px solid #ad231a;
    border-radius: 999px;
    background: linear-gradient(135deg, #d6362a, #b32117);
    color: #ffffff;
    font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.a2-meta-edit-btn:focus-visible {
    outline: 2px solid #2680d8;
    outline-offset: 1px;
}

.a2-review-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: visible;
    overflow-y: visible;
    min-height: 36px;
    padding-top: 2px;
    padding-bottom: 2px;
}

.a2-review-status-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.a2-review-action-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: 0;
    justify-content: flex-start;
}

.a2-review-action-group>.a2-review-quick-buttons {
    flex: 0 1 auto;
}

.a2-review-quick-buttons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.a2-review-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #56708c;
    white-space: nowrap;
}

.a2-review-inline-label {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    margin: 0 2px 0 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #56708c;
    white-space: nowrap;
}

.a2-review-select-wrap select {
    min-width: 104px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid #c9d6e3;
    background: #f7fbff;
    color: #122235;
    font-size: 10px;
    font-weight: 400;
    padding: 0 6px;
}

.a2-review-select-wrap select:focus {
    outline: 2px solid #2680d8;
    outline-offset: 1px;
}

.a2-review-state-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 4px;
}

.a2-review-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #c9d6e3;
    background: linear-gradient(135deg, #f7fbff, #edf4fc);
}

.a2-review-pill-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #56708c;
}

.a2-review-pill-value {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.01em;
    color: #122235;
}

.a2-review-btn {
    border: 1px solid #d7dee7;
    border-radius: 10px;
    min-width: 74px;
    height: 30px;
    padding: 0 10px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #ffffff, #f5f8fb);
    color: var(--muted);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, filter 140ms ease;
    cursor: pointer;
}

#propagateHermanosBtn {
    min-width: 98px;
}

#propagateHermanosBookBtn {
    min-width: 140px;
    font-size: 9px;
}

.a2-review-btn:hover {
    filter: brightness(0.98);
}

.a2-review-btn.is-active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(17, 41, 69, 0.14);
}

.a2-review-btn.is-ok {
    border-color: #d0d8e3;
    background: linear-gradient(180deg, #f8fafc, #edf2f7);
    color: #5e6f84;
}

.a2-review-btn.is-ok.is-active {
    background: linear-gradient(180deg, #eefcf5, #def4e8);
    border-color: #1e8e5a;
    color: #115231;
    box-shadow: 0 6px 14px rgba(30, 142, 90, 0.2);
}

.a2-review-btn.is-copy {
    border-color: #d0d8e3;
    background: linear-gradient(180deg, #f8fafc, #edf2f7);
    color: #5e6f84;
}

.a2-review-btn.is-copy.is-active {
    background: linear-gradient(180deg, #fff6d3, #ffe28a);
    border-color: #b88717;
    color: #5b3f03;
    box-shadow: 0 6px 14px rgba(184, 135, 23, 0.2);
}

.a2-review-btn.is-review {
    border-color: #d0d8e3;
    background: linear-gradient(180deg, #f8fafc, #edf2f7);
    color: #5e6f84;
}

.a2-review-btn.is-review.is-active {
    background: linear-gradient(180deg, #f1e9ff, #e5d6ff);
    border-color: #8546d1;
    color: #4d2f83;
    box-shadow: 0 6px 14px rgba(133, 70, 209, 0.2);
}

.a2-review-btn.is-ko {
    border-color: #d0d8e3;
    background: linear-gradient(180deg, #f8fafc, #edf2f7);
    color: #5e6f84;
}

.a2-review-btn.is-ko.is-active {
    background: linear-gradient(180deg, #fff2ef, #ffdcd6);
    border-color: #c63c2c;
    color: #6a1f16;
    box-shadow: 0 6px 14px rgba(198, 60, 44, 0.2);
}

.a2-review-btn.is-pending {
    border-color: #d0d8e3;
    background: linear-gradient(180deg, #f8fafc, #edf2f7);
    color: #5e6f84;
}

.a2-review-btn.is-pending.is-active {
    background: linear-gradient(180deg, #ffe9e6, #ffc5bd);
    border-color: #d92d20;
    color: #7a1212;
    box-shadow: 0 6px 14px rgba(217, 45, 32, 0.28);
}

.a2-review-btn.is-reviewed {
    background: #ecf8f1;
    border-color: #6fae8f;
    color: #1b5a38;
}

.a2-review-btn.is-reviewed.is-active {
    background: #daf0e3;
    border-color: #328355;
    color: #0e4428;
    box-shadow: 0 6px 16px rgba(50, 131, 85, 0.28);
}

.a2-review-btn.is-edit {
    border-color: #b3c8f0;
    background: linear-gradient(180deg, #f5f9ff, #e8f0fc);
    color: #2a5da8;
}

.a2-review-btn.is-edit:hover {
    background: linear-gradient(180deg, #eaf2ff, #d6e8ff);
    border-color: #7aa8e8;
    color: #1a4690;
}

.a2-compare-table-card {
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    overflow: auto;
}

/* Pie de controles debajo de la tabla comparativa (field registry refactorizado) */
.a2-compare-table-debug-footer {
    display: flex;
    justify-content: flex-end;
    padding: 4px 8px;
    border-top: 1px solid var(--line);
}

.a2-debug-toggle {
    font-size: 11px;
    padding: 2px 8px;
    border: 1px solid #c0cfe0;
    border-radius: 4px;
    background: #f3f7fc;
    cursor: pointer;
    color: #4b6080;
}

.a2-debug-toggle:hover {
    background: #e0eaf5;
}

/* Modo depuración: muestra el nombre técnico del campo (data-field-key) debajo del valor */
.a2-compare-table.is-debug td[data-field-key]:not([data-field-key=''])::after {
    content: attr(data-field-key);
    display: block;
    font-size: 9px;
    color: #7090b0;
    font-family: 'IBM Plex Mono', monospace;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.a2-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    table-layout: fixed;
}

.a2-compare-table th,
.a2-compare-table td {
    border-bottom: 1px solid #e7edf5;
    border-right: 1px solid #e7edf5;
    padding: 6px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.a2-compare-table th:last-child,
.a2-compare-table td:last-child {
    border-right: 0;
}

.a2-compare-table th {
    background: #f3f7fc;
    color: #3b526a;
    text-transform: uppercase;
    font-size: 8px;
    letter-spacing: 0.05em;
    position: relative;
    user-select: none;
    padding-right: 8px;
}

.a2-compare-table th::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 6px;
    cursor: col-resize;
    background: transparent;
}

.a2-compare-table th.resizing {
    user-select: none;
    opacity: 0.8;
}

.a2-compare-table td.field {
    font-weight: 700;
    color: #233c57;
}

.a2-compare-table tr.separator-top td {
    border-top: 2px solid #8ea2ba !important;
    box-shadow: inset 0 2px 0 #8ea2ba;
}

.a2-compare-table td.pdf-loading {
    color: #6b7280;
    font-style: italic;
}

.a2-compare-table td.compare-match {
    background: rgba(41, 145, 96, 0.09);
}

.a2-compare-table td.compare-mismatch-soft {
    background: rgba(220, 38, 38, 0.12);
    color: #8b1e1e;
}

.a2-compare-table td.compare-raw-sust-match {
    box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.45);
}

.a2-compare-table td.compare-missing {
    background: rgba(198, 60, 44, 0.12);
}

/* Aviso discreto: celda PDF vacía aunque el campo _pdf existe (recompute-pdf-auto pendiente) */
.a2-compare-table td.pdf-empty-hint {
    background: repeating-linear-gradient(135deg,
            transparent,
            transparent 4px,
            rgba(180, 140, 0, 0.07) 4px,
            rgba(180, 140, 0, 0.07) 8px);
    color: #9c7c00;
    cursor: help;
}

.a2-compare-table td.compare-final-ok {
    background: rgba(22, 163, 74, 0.34) !important;
    color: #0f5132;
    font-weight: 600;
}

.a2-compare-table td.compare-final-error {
    background: rgba(220, 38, 38, 0.22) !important;
    font-weight: 600;
}

.a2-compare-table td.field-err {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    width: 32px;
    min-width: 32px;
    color: #9ca3af;
}

.a2-compare-table td.field-err.has-errors {
    color: var(--ko);
    background: var(--ko-soft);
    cursor: help;
}

@keyframes a2ErrorCellFlash {
    0% {
        background: #ffe3de;
        box-shadow: inset 0 0 0 1px #e25a4d;
    }

    100% {
        background: inherit;
        box-shadow: inset 0 0 0 1px transparent;
    }
}

.a2-compare-table td.field-err.a2-error-cell-flash {
    animation: a2ErrorCellFlash 1.6s ease-out;
}

.a2-compare-table th.err-col-header {
    cursor: pointer;
    text-decoration: underline dotted;
}

.a2-compare-table th.err-col-header:hover {
    background: #dce8f5;
}

/* Modal de checks */
.checks-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checks-modal[hidden] {
    display: none;
}

.checks-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.checks-modal-panel {
    position: relative;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: min(520px, 92vw);
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.checks-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--line);
}

.checks-modal-header h2 {
    margin: 0;
    font-size: 15px;
    color: #1a2d42;
}

.checks-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
}

.checks-modal-close:hover {
    background: #f3f7fc;
    color: #1a2d42;
}

.checks-modal-body {
    overflow-y: auto;
    padding: 16px 20px 20px;
}

.checks-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #6b7280;
    margin: 14px 0 6px;
}

.checks-group-title:first-child {
    margin-top: 0;
}

.checks-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.checks-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    background: #f3f7fc;
    font-size: 12px;
}

.checks-list li .check-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #3b526a;
    white-space: nowrap;
    flex-shrink: 0;
}

.checks-list li .check-label {
    color: #1a2d42;
}

.checks-list li.check-custom {
    background: #f0f7ff;
}

.checks-list li.check-custom .check-code {
    color: #1d6fb5;
}

.a2-process-card,
.a2-evidence-card {
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    padding: 10px;
}

.a2-process-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.a2-process-head h3,
.a2-evidence-card h3 {
    margin: 0;
    font-size: 14px;
}

.a2-process-actions {
    display: flex;
    gap: 6px;
}

.a2-process-summary {
    margin: 8px 0 10px;
    color: var(--muted);
    font-size: 12px;
}

.a2-process-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.a2-process-list li {
    border: 1px solid #e2e9f2;
    border-left-width: 6px;
    border-radius: 10px;
    padding: 8px;
    background: var(--panel-soft);
}

.a2-process-list li.pending {
    border-left-color: #9ba8b7;
}

.a2-process-list li.pass {
    border-left-color: var(--ok);
    background: #f2fbf6;
}

.a2-process-list li.fail {
    border-left-color: var(--ko);
    background: #fff4f2;
}

.a2-process-list li .head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.a2-process-list li .title {
    font-size: 12px;
    font-weight: 700;
}

.a2-process-list li .state {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.a2-process-list li p {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--muted);
}

.a2-edit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 8px;
}

.a2-edit-grid label {
    display: grid;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
}

.a2-edit-grid span {
    font-weight: 700;
    color: #405469;
}

.a2-outcome-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.a2-outcome-row .primary {
    background: linear-gradient(135deg, #0a4f8f, #1269b9);
    border-color: #0a4f8f;
    color: #ffffff;
}

.a2-outcome-row .ok {
    background: var(--ok-soft);
    border-color: #93dfb9;
    color: #156842;
}

.a2-outcome-row .ko {
    background: var(--ko-soft);
    border-color: #f5b1aa;
    color: #9f2f23;
}

.a2-verdict {
    margin-left: auto;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.a2-verdict.raw {
    background: var(--raw-soft);
    border-color: #f0c87f;
    color: var(--raw);
}

.a2-verdict.ok {
    background: var(--ok-soft);
    border-color: #9fe6c2;
    color: var(--ok);
}

.a2-verdict.ko {
    background: var(--ko-soft);
    border-color: #f5b5ae;
    color: var(--ko);
}

#a2HiddenForm {
    display: none;
}

#a2StatusText,
#statusText {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

#a2EvidenceList,
#evidenceList {
    margin: 8px 0 0;
    padding-left: 18px;
    max-height: 140px;
    overflow: auto;
    font-size: 12px;
}

#evidenceList li.ok {
    color: #16613f;
    font-weight: 700;
}

#evidenceList li.ko {
    color: #9f2f23;
    font-weight: 700;
}

.a2-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    background: #f7fafc;
}

.pdf-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pdf-quick-break {
    flex-basis: 100%;
    height: 0;
    padding: 0;
    margin: 0;
}

.pdf-zoom-wrap {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    overflow: hidden;
}

.pdf-zoom-btn {
    border: 0;
    border-radius: 0;
    background: #ffffff;
    cursor: pointer;
}

.pdf-zoom-select {
    border: 0;
    border-radius: 0;
    background: #ffffff;
    padding: 0 8px;
    color: var(--text);
}

.pdf-row-debug-btn {
    height: 28px;
    border: 1px solid #d7dee7;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff, #f5f8fb);
    color: #5e6f84;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
    letter-spacing: 0.03em;
    padding: 0 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.pdf-btn-icon {
    display: none;
}

.pdf-btn-label {
    line-height: 1;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.pdf-row-debug-btn.is-step-load {
    border-color: #d7dee7;
    background: transparent;
    color: #5e6f84;
}

.pdf-row-debug-btn.is-step-read {
    border-color: #d7dee7;
    background: transparent;
    color: #5e6f84;
}

.pdf-row-debug-btn.is-step-mark {
    border-color: #d7dee7;
    background: transparent;
    color: #5e6f84;
}

.pdf-row-debug-btn.is-step-copy {
    border-color: #97b7e6;
    background: linear-gradient(180deg, #f2f7ff, #e2ecff);
    color: #1f4f95;
}

.pdf-row-debug-btn.is-step-check {
    border-color: #efb8b0;
    background: linear-gradient(180deg, #fff5f3, #ffe2de);
    color: #9a2f24;
}

.pdf-row-debug-btn.is-step-revision {
    border-color: #efcf98;
    background: linear-gradient(180deg, #fff8eb, #ffe9c7);
    color: #8a5a05;
}

.pdf-row-debug-btn.is-step-clear {
    border-color: #d7dee7;
    background: linear-gradient(180deg, #ffffff, #f5f8fb);
    color: #5e6f84;
}

#copyPdfReadToFinalBtn.pdf-row-debug-btn {
    border-color: #b7e0c8;
    background: linear-gradient(180deg, #f6fffa, #e8f8ef);
    color: #1e6c44;
}

.pdf-row-debug-btn:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
    cursor: pointer;
}

.pdf-row-debug-btn.is-active {
    filter: none;
    transform: translateY(0);
    box-shadow: inset 0 2px 4px rgba(17, 41, 69, 0.12);
}

.pdf-row-debug-btn:focus-visible {
    outline: 2px solid #f2d063;
    outline-offset: 1px;
}

@media (max-width: 720px) {
    .pdf-row-debug-btn {
        height: 24px;
        font-size: 9px;
        padding: 0 8px;
    }
}

/* Panel de debug para detección de cabecera */
.header-detection-debug-panel {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 480px;
    max-height: 400px;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
}

.header-detection-debug-panel[hidden] {
    display: none !important;
}

.header-debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: linear-gradient(90deg, #7c3ae5, #8b5cf6);
    color: #ffffff;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-debug-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.header-debug-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 0;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
}

.header-debug-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.header-debug-content {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow: hidden;
}

.header-debug-controls {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
}

.header-debug-btn {
    flex: 1;
    padding: 6px 10px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    color: #333;
}

.header-debug-btn:hover {
    background: #e8e8e8;
    border-color: #999;
}

.header-debug-log {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #fafafa;
    color: #333;
    line-height: 1.4;
}

.header-debug-log-entry {
    margin-bottom: 6px;
    padding: 4px;
    background: #ffffff;
    border-left: 3px solid #8b5cf6;
    border-radius: 2px;
}

.header-debug-log-stage {
    font-weight: 700;
    color: #7c3ae5;
}

.header-debug-log-data {
    color: #555;
    word-break: break-all;
    white-space: pre-wrap;
}

.header-debug-log-timestamp {
    font-size: 9px;
    color: #999;
}

@media (max-width: 1024px) {
    .header-detection-debug-panel {
        width: 90vw;
        max-width: 400px;
        right: 8px;
        bottom: 8px;
    }
}

.pdfviewer {
    flex: 1;
    min-height: 220px;
    overflow: auto;
    background: repeating-linear-gradient(45deg,
            #f7f9fb,
            #f7f9fb 12px,
            #f1f5f9 12px,
            #f1f5f9 24px);
}

.pdfviewer-inner {
    padding: 12px;
}

.pdfcanvas {
    box-shadow: 0 8px 20px rgba(25, 51, 80, 0.22);
}

.pdf-selection-highlight.is-read-field {
    border-color: rgba(220, 38, 38, 0.96);
    background: rgba(248, 113, 113, 0.32);
}

.pdf-selection-highlight.pdf-row-highlight-blue {
    border-width: 3px;
    border-color: rgba(9, 94, 196, 0.98);
    background: rgba(37, 99, 235, 0.32);
    box-shadow: none;
    pointer-events: none;
}

.pdf-selection-highlight.pdf-line-debug-highlight {
    border-width: 2px;
    border-color: rgba(37, 99, 235, 0.95);
    background: rgba(59, 130, 246, 0.14);
    box-shadow: none;
    pointer-events: none;
    z-index: 3;
}

.pdf-selection-highlight.pdf-line-debug-highlight--pn {
    border-width: 3px;
    border-color: rgba(8, 95, 214, 0.98);
    background: rgba(59, 130, 246, 0.24);
}

.pdf-selection-highlight.pdf-row-highlight-red-row {
    border: 3px dashed rgba(220, 38, 38, 0.98);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    pointer-events: none;
}

.pdf-selection-highlight.pdf-row-highlight-orange-row {
    border: 3px dashed rgba(234, 88, 12, 0.98);
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    pointer-events: none;
}

.pdf-selection-highlight.pdf-row-highlight-violet-row {
    border-width: 3px 0;
    border-color: rgba(124, 58, 237, 0.95);
    background: rgba(139, 92, 246, 0.2);
    border-radius: 0;
    box-shadow: none;
    pointer-events: none;
}

.pdf-selection-highlight.pdf-column-highlight-violet {
    border-width: 0 2px;
    border-color: rgba(124, 58, 237, 0.9);
    background: rgba(139, 92, 246, 0.14);
    border-radius: 0;
    box-shadow: none;
    pointer-events: none;
}

.pdf-meta-foot {
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
    padding: 8px;
    background: #f9fbfd;
}

/* ── Header detection debug panel ── */
.header-detection-panel {
    border-top: 2px solid rgba(37, 99, 235, 0.45);
    background: #f8faff;
    padding: 8px 10px 10px;
    font-size: 11.5px;
    font-family: 'Manrope', 'Segoe UI', Arial, sans-serif;
}

.header-detection-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.header-detection-panel-title {
    font-size: 12px;
    color: #1e3a5f;
    flex: 1;
}

.header-detection-confidence {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.10);
    color: #1e40af;
    font-weight: 600;
}

.header-detection-close-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    padding: 2px 4px;
}

.header-detection-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.header-detection-legend-chip {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1.5px solid currentColor;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.header-detection-legend-chip.is-missing {
    opacity: 0.35;
    text-decoration: line-through;
}

.header-detection-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}

.header-detection-entry {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 2px 8px;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1.5px solid;
}

.header-detection-entry.is-missing {
    opacity: 0.5;
}

.header-detection-entry-label {
    font-weight: 700;
    font-size: 11px;
    align-self: center;
}

.header-detection-entry-meta {
    font-size: 10.5px;
    color: var(--muted);
    line-height: 1.5;
}

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

    .a2-splitter {
        display: none;
    }

    .a2-right {
        min-height: 360px;
    }
}

@media (max-width: 860px) {
    .a2-topbar {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .a2-nav,
    .backend-status,
    .backend-status-wrap {
        justify-self: start;
    }

    .backend-status-wrap {
        align-items: flex-start;
    }

    .a2-toolbar-top {
        grid-template-columns: minmax(88px, 120px) minmax(110px, 160px) 22px minmax(120px, 1fr) auto;
        gap: 8px;
    }

    .a2-toolbar-primary-actions {
        width: 100%;
        flex-wrap: wrap;
    }

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

    .a2-review-actions {
        display: grid;
        grid-template-columns: 1fr;
        overflow-x: visible;
    }

    .a2-review-status-group,
    .a2-review-action-group {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .a2-review-quick-buttons {
        flex-wrap: wrap;
    }

    .a2-meta-inline {
        flex-wrap: wrap;
        row-gap: 2px;
    }

    .a2-stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .a2-stat-card.is-import-sep {
        margin-left: 0;
    }

    .a2-stat-main {
        min-height: 20px;
    }

    .a2-stat-total {
        font-size: 20px;
    }

    .a2-stat-current {
        font-size: 12px;
    }

    .a2-stat-of {
        font-size: 10px;
    }

    .a2-stat-unique {
        font-size: 10px;
    }

    .a2-auto-recompute-controls {
        grid-template-columns: 1fr;
        grid-template-areas:
            "engine"
            "id"
            "dry"
            "update"
            "force"
            "run"
            "pdf";
    }

    .a2-recompute-current-actions {
        grid-template-columns: 1fr;
    }

    .lrs-stats {
        grid-template-columns: 1fr;
    }

    .lrs-item-label {
        min-width: 90px;
    }

    .recompute-result-summary {
        grid-template-columns: 1fr 1fr;
    }

    .a2-edit-grid {
        grid-template-columns: 1fr;
    }

    .a2-outcome-row {
        flex-direction: column;
        align-items: stretch;
    }

    .a2-verdict {
        margin-left: 0;
        text-align: center;
    }
}

@media (max-width: 560px) {
    .a2-toolbar-top {
        grid-template-columns: 1fr;
    }

    .a2-toolbar-bottom {
        grid-template-columns: 1fr;
    }

    .a2-meta-inline {
        gap: 4px;
    }

    .a2-meta-sep {
        display: none;
    }

    .a2-stats-row {
        grid-template-columns: 1fr;
    }

    .a2-stat-card.is-import-sep {
        margin-left: 0;
    }

    .a2-stat-main {
        min-height: 18px;
    }

    .a2-stat-total {
        font-size: 18px;
    }

    .a2-stat-current {
        font-size: 11px;
    }

    .a2-stat-of {
        font-size: 9px;
    }
}

.a2-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5ecf4;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.a2-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1f6fe3, #195ec5);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.a2-progress-text {
    font-size: 10px;
    color: #5a7a8f;
    margin-top: 4px;
}

/* Modal de edición de registro */
.edit-record-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-record-modal[hidden] {
    display: none;
}

.edit-record-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.edit-record-modal-panel {
    position: relative;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: min(600px, 92vw);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.edit-record-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--line);
}

.edit-record-modal-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1a2d42;
}

.edit-record-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
}

.edit-record-modal-close:hover {
    background: #f3f7fc;
    color: #1a2d42;
}

.edit-record-modal-body {
    overflow-y: auto;
    padding: 16px 20px;
    flex: 1;
}

#editRecordForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.edit-record-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.edit-record-row:last-of-type {
    grid-template-columns: 1fr;
}

.edit-record-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edit-record-row label span {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.edit-record-row input,
.edit-record-row select {
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    background: #ffffff;
}

.edit-record-row input:focus,
.edit-record-row select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.edit-record-status {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    min-height: 18px;
}

.edit-record-status.is-ok {
    color: #16613f;
}

.edit-record-status.is-error {
    color: #9f2f23;
}

.edit-record-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    background: #f9fafc;
}

.edit-record-footer button {
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    height: 32px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: #edf4fb;
    color: #0e4f8d;
    transition: background 120ms ease, color 120ms ease;
}

.edit-record-footer button:hover {
    background: #dde9f6;
    color: #0a3866;
}

.edit-record-footer #editRecordSaveBtn {
    background: linear-gradient(135deg, #0a4f8f, #156fc0);
    border-color: #0b5ea8;
    color: #ffffff;
}

.edit-record-footer #editRecordSaveBtn:hover {
    background: linear-gradient(135deg, #083d6f, #1361a8);
}

.pdf-action-status {
    font-size: 0.78rem;
    min-height: 1.2em;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s, color 0.2s;
    color: transparent;
}

.pdf-action-status.is-busy {
    color: #555;
    background: #f0f0f0;
}

.pdf-action-status.is-ok {
    color: #1a6b1a;
    background: #e6f4e6;
    animation: pdfActionStatusFadeOut 4s ease-out forwards;
}

.pdf-action-status.is-error {
    color: #8b1a1a;
    background: #fde8e8;
    animation: pdfActionStatusFadeOut 4s ease-out forwards;
}

@keyframes pdfActionStatusFadeOut {
    0% {
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}