:root {
    color-scheme: light;
    --bg: #f5f7f9;
    --surface: #ffffff;
    --text: #18212f;
    --muted: #687386;
    --line: #dce3ea;
    --brand: #1f7a67;
    --accent: #b45309;
    --danger: #b42318;
    --warn: #a15c07;
    --ok: #16754f;
}

/* Mercancias: tabla con scroll interno y encabezados fijos. Mantener al final para ganar a reglas responsive previas. */
.merchandise-candidates-table {
    max-height: min(68vh, 720px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.merchandise-candidates-table table {
    display: table !important;
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.merchandise-candidates-table thead {
    display: table-header-group !important;
}

.merchandise-candidates-table tbody {
    display: table-row-group !important;
}

.merchandise-candidates-table tr {
    display: table-row !important;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.merchandise-candidates-table th,
.merchandise-candidates-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0;
    white-space: normal;
    vertical-align: top;
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    overflow-wrap: anywhere;
}

.merchandise-candidates-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: 0 1px 0 var(--line);
    font-size: 12px;
}

.merchandise-candidates-table th:nth-child(1),
.merchandise-candidates-table td:nth-child(1) {
    width: 190px !important;
}

.merchandise-candidates-table th:nth-child(2),
.merchandise-candidates-table td:nth-child(2) {
    width: 86px !important;
}

.merchandise-candidates-table th:nth-child(3),
.merchandise-candidates-table td:nth-child(3) {
    width: 330px !important;
}

.merchandise-candidates-table th:nth-child(4),
.merchandise-candidates-table td:nth-child(4) {
    width: 86px !important;
    text-align: right;
}

.merchandise-candidates-table th:nth-child(5),
.merchandise-candidates-table td:nth-child(5) {
    width: 130px !important;
}

.merchandise-candidates-table th:nth-child(6),
.merchandise-candidates-table td:nth-child(6) {
    width: 120px !important;
}

.merchandise-candidates-table th:nth-child(7),
.merchandise-candidates-table td:nth-child(7) {
    width: 250px !important;
}

.merchandise-candidates-table td::before {
    content: none !important;
}

.merchandise-candidates-table small,
.merchandise-candidates-table .pill,
.merchandise-candidates-table .severity {
    font-size: 12px;
    line-height: 1.25;
}

.merchandise-candidates-table .form-grid.compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin: 0;
}

.merchandise-candidates-table .form-grid label {
    gap: 3px;
    font-size: 11px;
    line-height: 1.2;
}

.merchandise-candidates-table input,
.merchandise-candidates-table select {
    min-height: 32px;
    padding: 5px 7px;
    font-size: 12px;
    border-radius: 7px;
}

.merchandise-candidates-table button {
    min-height: 32px;
    width: 100%;
    padding: 6px 9px;
    font-size: 12px;
}

/* Mercancias: regla final para inventario y captura de salidas. */
.merchandise-inventory-table {
    max-height: min(72vh, 760px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.merchandise-inventory-table table {
    width: 100%;
    min-width: 1380px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.merchandise-inventory-table th,
.merchandise-inventory-table td {
    white-space: normal;
    vertical-align: top;
    padding: 10px 9px;
    background: #fff;
    overflow-wrap: anywhere;
}

.merchandise-inventory-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: 0 1px 0 var(--line);
    font-size: 12px;
}

.merchandise-inventory-table th:nth-child(1),
.merchandise-inventory-table td:nth-child(1) {
    width: 190px;
}

.merchandise-inventory-table th:nth-child(2),
.merchandise-inventory-table td:nth-child(2) {
    width: 330px;
}

.merchandise-inventory-table th:nth-child(3),
.merchandise-inventory-table td:nth-child(3) {
    width: 120px;
}

.merchandise-inventory-table th:nth-child(4),
.merchandise-inventory-table td:nth-child(4) {
    width: 135px;
}

.merchandise-inventory-table th:nth-child(5),
.merchandise-inventory-table td:nth-child(5) {
    width: 115px;
}

.merchandise-inventory-table th:nth-child(6),
.merchandise-inventory-table td:nth-child(6) {
    width: 490px;
}

.merchandise-inventory-table .disclosure-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
    margin-bottom: 8px;
    background: #fbfcfd;
}

.merchandise-inventory-table .disclosure-panel:last-child {
    margin-bottom: 0;
}

.merchandise-inventory-table .disclosure-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

.merchandise-inventory-table .disclosure-panel[open] summary {
    margin-bottom: 9px;
}

.merchandise-inventory-table .disclosure-panel summary::before {
    display: none;
}

.merchandise-inventory-table .disclosure-panel summary .pill {
    margin-right: 0;
    flex: 0 0 auto;
}

.merchandise-inventory-table .form-grid.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.merchandise-inventory-table .form-grid label {
    gap: 4px;
    font-size: 11px;
    line-height: 1.2;
}

.merchandise-inventory-table .form-grid label.wide,
.merchandise-inventory-table .form-grid button {
    grid-column: 1 / -1;
}

.merchandise-inventory-table input,
.merchandise-inventory-table select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 7px;
}

.merchandise-inventory-table button {
    min-height: 34px;
    width: 100%;
    padding: 7px 10px;
    font-size: 12px;
}

/* Mercancias: regla final para inventario y captura de salidas. */
.merchandise-inventory-table {
    max-height: min(72vh, 760px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.merchandise-inventory-table table {
    width: 100%;
    min-width: 1380px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.merchandise-inventory-table th,
.merchandise-inventory-table td {
    white-space: normal;
    vertical-align: top;
    padding: 10px 9px;
    background: #fff;
    overflow-wrap: anywhere;
}

.merchandise-inventory-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: 0 1px 0 var(--line);
    font-size: 12px;
}

.merchandise-inventory-table th:nth-child(1),
.merchandise-inventory-table td:nth-child(1) {
    width: 190px;
}

.merchandise-inventory-table th:nth-child(2),
.merchandise-inventory-table td:nth-child(2) {
    width: 330px;
}

.merchandise-inventory-table th:nth-child(3),
.merchandise-inventory-table td:nth-child(3) {
    width: 120px;
}

.merchandise-inventory-table th:nth-child(4),
.merchandise-inventory-table td:nth-child(4) {
    width: 135px;
}

.merchandise-inventory-table th:nth-child(5),
.merchandise-inventory-table td:nth-child(5) {
    width: 115px;
}

.merchandise-inventory-table th:nth-child(6),
.merchandise-inventory-table td:nth-child(6) {
    width: 490px;
}

.merchandise-inventory-table .disclosure-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
    margin-bottom: 8px;
    background: #fbfcfd;
}

.merchandise-inventory-table .disclosure-panel:last-child {
    margin-bottom: 0;
}

.merchandise-inventory-table .disclosure-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

.merchandise-inventory-table .disclosure-panel[open] summary {
    margin-bottom: 9px;
}

.merchandise-inventory-table .disclosure-panel summary::before {
    display: none;
}

.merchandise-inventory-table .disclosure-panel summary .pill {
    margin-right: 0;
    flex: 0 0 auto;
}

.merchandise-inventory-table .form-grid.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.merchandise-inventory-table .form-grid label {
    gap: 4px;
    font-size: 11px;
    line-height: 1.2;
}

.merchandise-inventory-table .form-grid label.wide,
.merchandise-inventory-table .form-grid button {
    grid-column: 1 / -1;
}

.merchandise-inventory-table input,
.merchandise-inventory-table select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 7px;
}

.merchandise-inventory-table button {
    min-height: 34px;
    width: 100%;
    padding: 7px 10px;
    font-size: 12px;
}

/* Mercancias: inventario con scroll interno y captura de salidas legible. */
.merchandise-inventory-table {
    max-height: min(72vh, 760px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.merchandise-inventory-table table {
    width: 100%;
    min-width: 1380px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.merchandise-inventory-table th,
.merchandise-inventory-table td {
    white-space: normal;
    vertical-align: top;
    padding: 10px 9px;
    background: #fff;
    overflow-wrap: anywhere;
}

.merchandise-inventory-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: 0 1px 0 var(--line);
    font-size: 12px;
}

.merchandise-inventory-table th:nth-child(1),
.merchandise-inventory-table td:nth-child(1) {
    width: 190px;
}

.merchandise-inventory-table th:nth-child(2),
.merchandise-inventory-table td:nth-child(2) {
    width: 330px;
}

.merchandise-inventory-table th:nth-child(3),
.merchandise-inventory-table td:nth-child(3) {
    width: 120px;
}

.merchandise-inventory-table th:nth-child(4),
.merchandise-inventory-table td:nth-child(4) {
    width: 135px;
}

.merchandise-inventory-table th:nth-child(5),
.merchandise-inventory-table td:nth-child(5) {
    width: 115px;
}

.merchandise-inventory-table th:nth-child(6),
.merchandise-inventory-table td:nth-child(6) {
    width: 490px;
}

.merchandise-inventory-table .disclosure-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
    margin-bottom: 8px;
    background: #fbfcfd;
}

.merchandise-inventory-table .disclosure-panel:last-child {
    margin-bottom: 0;
}

.merchandise-inventory-table .disclosure-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
}

.merchandise-inventory-table .disclosure-panel[open] summary {
    margin-bottom: 9px;
}

.merchandise-inventory-table .disclosure-panel summary::before {
    display: none;
}

.merchandise-inventory-table .disclosure-panel summary .pill {
    margin-right: 0;
    flex: 0 0 auto;
}

.merchandise-inventory-table .form-grid.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.merchandise-inventory-table .form-grid label {
    gap: 4px;
    font-size: 11px;
    line-height: 1.2;
}

.merchandise-inventory-table .form-grid label.wide,
.merchandise-inventory-table .form-grid button {
    grid-column: 1 / -1;
}

.merchandise-inventory-table input,
.merchandise-inventory-table select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 7px;
}

.merchandise-inventory-table button {
    min-height: 34px;
    width: 100%;
    padding: 7px 10px;
    font-size: 12px;
}

.fiscal-settings-summary article strong {
    font-size: 18px;
}

.fiscal-year-switch {
    margin: 14px 0 4px;
    align-items: end;
}

.fiscal-mini-form {
    margin: 12px 0 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.row-options .fiscal-mini-form {
    min-width: min(760px, 82vw);
    background: #fff;
}

.row-options summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 700;
}

.pp-workbook {
    display: grid;
    gap: 18px;
}

.pp-controls {
    align-items: end;
}

.pp-snapshot-form {
    align-items: end;
    grid-template-columns: minmax(240px, 1fr) auto;
    padding: 12px;
    border: 1px solid #d7e7e2;
    border-radius: 10px;
    background: #f8fcfa;
}

.pp-snapshot-form label {
    min-width: 0;
}

.pp-snapshots-panel summary {
    border-top: 3px solid #e5d9c1;
}

.pp-snapshot-table table {
    min-width: 980px;
}

.pp-snapshot-table th,
.pp-snapshot-table td {
    font-size: 13px;
    vertical-align: top;
}

.pp-excel-panel summary {
    border-top: 3px solid #d8e2ea;
}

.pp-excel-body {
    display: grid;
    gap: 12px;
}

.pp-excel-upload {
    align-items: end;
    grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1.2fr) minmax(150px, 0.55fr) minmax(220px, 1fr) auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfd;
}

.pp-year-lock {
    display: grid;
    gap: 2px;
    min-height: 54px;
    padding: 8px 10px;
    border: 1px solid #f0d8a8;
    border-radius: 8px;
    background: #fff9ed;
}

.pp-year-lock span,
.pp-year-lock small {
    color: var(--muted);
    font-size: 12px;
}

.pp-year-lock strong {
    color: var(--warn);
    font-size: 18px;
}

.pp-excel-metrics article strong {
    overflow-wrap: anywhere;
    font-size: 15px;
}

.pp-excel-diff-table table {
    min-width: 1040px;
}

.pp-excel-diff-table th,
.pp-excel-diff-table td {
    font-size: 13px;
    vertical-align: top;
}

.pp-excel-history-panel summary,
.pp-excel-version-panel summary {
    border-top: 3px solid #d7e7e2;
}

.pp-excel-history-table table,
.pp-excel-version-table table {
    min-width: 980px;
}

.pp-excel-history-table th,
.pp-excel-history-table td,
.pp-excel-version-table th,
.pp-excel-version-table td {
    font-size: 13px;
    vertical-align: top;
}

.pp-excel-history-table td:last-child {
    display: grid;
    gap: 6px;
}

.pp-difference-assistant {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid #f0d8a8;
    border-radius: 10px;
    background: #fff9ed;
}

.pp-difference-assistant p {
    margin: 4px 0 0;
    color: var(--muted);
}

.pp-difference-actions {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.pp-difference-actions .pp-quick-button {
    width: 100%;
    text-align: center;
}

.pp-table-wrap {
    display: block;
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.pp-table {
    min-width: 1180px;
    width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.pp-table th,
.pp-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid #eef2f6;
    text-align: right;
    white-space: nowrap;
}

.pp-workbook {
    overflow: hidden;
}

.pp-table td {
    max-width: 140px;
}

.pp-table th:first-child,
.pp-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 230px;
    max-width: 260px;
    text-align: left;
    background: #f8fafc;
    color: var(--text);
    font-weight: 700;
}

.pp-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eef5f3;
    color: #12382f;
    font-size: 12px;
    letter-spacing: 0;
}

.pp-table thead th:first-child {
    z-index: 3;
}

.pp-table tbody tr:hover td,
.pp-table tbody tr:hover th {
    background: #fbf7ed;
}

.pp-row-emphasis th,
.pp-row-emphasis td {
    background: #f4f8fb;
    font-weight: 700;
}

.pp-alert-dot {
    display: block;
    margin-top: 3px;
    color: var(--warn);
    font-weight: 700;
}

.pp-percent {
    color: var(--muted);
    font-weight: 700;
}

.pp-review-panel summary {
    border-top: 3px solid #d8e2ea;
}

.pp-alert-list {
    display: grid;
    gap: 12px;
}

.pp-alert-list article {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.pp-alert-list ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.pp-reconciliation-panel summary {
    border-top: 3px solid #d7e7e2;
}

.pp-month-accordion {
    display: grid;
    gap: 12px;
}

.pp-month-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.pp-month-card > summary {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    background: #fbfcfd;
}

.pp-month-card > summary small {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    color: var(--muted);
}

.pp-month-body {
    display: grid;
    gap: 14px;
    padding: 14px;
}

.pp-month-mini-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.pp-month-mini-metrics article {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.pp-month-mini-metrics span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.pp-month-mini-metrics strong {
    font-size: 18px;
}

.pp-bucket {
    display: grid;
    gap: 8px;
}

.pp-bucket-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pp-bucket-title h3 {
    margin: 0;
    font-size: 15px;
}

.pp-bucket-table table {
    min-width: 940px;
}

.pp-bucket-table th,
.pp-bucket-table td {
    font-size: 13px;
    vertical-align: top;
}

.pp-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.pp-quick-form {
    display: inline-flex;
    margin: 0;
}

.pp-deep-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 8px;
}

.pp-deep-actions a {
    min-height: 34px;
    align-items: center;
    justify-content: center;
}

.pp-resolution-options {
    margin-top: 6px;
}

.pp-resolution-options > div {
    min-width: 220px;
}

.pp-resolution-options .pp-quick-form,
.pp-resolution-options .pp-quick-button {
    width: 100%;
}

.fiscal-impact-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.fiscal-impact-checks .field-help {
    flex: 1 0 100%;
}

.pp-quick-button {
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.pp-quick-button.positive {
    border-color: rgba(22, 117, 79, 0.28);
    background: #edf8f3;
    color: var(--ok);
}

.pp-quick-button.warning {
    border-color: rgba(161, 92, 7, 0.28);
    background: #fff7e6;
    color: var(--warn);
}

.pp-quick-button.negative {
    border-color: rgba(180, 35, 24, 0.28);
    background: #fff1f0;
    color: var(--danger);
}

@media (max-width: 760px) {
    .pp-table {
        min-width: 1020px;
        font-size: 12.5px;
    }

    .pp-table th,
    .pp-table td {
        padding: 8px;
    }

    .pp-table th:first-child,
    .pp-table td:first-child {
        min-width: 190px;
        max-width: 210px;
    }

    .pp-month-card > summary {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .pp-bucket-table table {
        min-width: 820px;
    }

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

    .pp-quick-button {
        width: 100%;
    }

    .pp-snapshot-form {
        grid-template-columns: 1fr;
    }

    .pp-snapshot-form button {
        width: 100%;
    }

    .pp-snapshot-table table {
        min-width: 860px;
    }

    .pp-excel-upload {
        grid-template-columns: 1fr;
    }

    .pp-excel-upload button {
        width: 100%;
    }

    .pp-excel-diff-table table {
        min-width: 880px;
    }

    .pp-excel-history-table table,
    .pp-excel-version-table table {
        min-width: 840px;
    }

    .pp-difference-assistant {
        align-items: flex-start;
        flex-direction: column;
    }
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15.5px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--brand);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 44px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.content-shell {
    width: min(1220px, calc(100% - 32px));
    min-width: 0;
    margin: 0 auto;
    padding: 24px 0 44px;
}

.app-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100vh;
    padding: 18px 14px;
    border-right: 1px solid var(--line);
    background: #fff;
}

.sidebar-brand {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 19px;
    font-weight: 800;
}

.sidebar-brand strong,
.sidebar-context strong,
.sidebar-user span {
    display: block;
    overflow-wrap: anywhere;
}

.sidebar-brand small,
.sidebar-context span,
.sidebar-context small,
.sidebar-user small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.sidebar-context {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #f8fafb;
}

.sidebar-nav {
    display: grid;
    gap: 16px;
}

.sidebar-section {
    display: grid;
    gap: 6px;
}

.sidebar-section h2 {
    margin: 0 0 2px;
    padding: 0 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    min-height: 38px;
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}

.sidebar-link:hover {
    background: #eef4f2;
}

.sidebar-link.active {
    background: var(--brand);
    color: #fff;
}

.sidebar-user {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.topbar,
.grid,
.split {
    display: grid;
    gap: 16px;
}

.topbar {
    grid-template-columns: 1fr auto;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 44;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(24, 33, 47, 0.08);
    margin-bottom: 18px;
}

.topbar-heading {
    min-width: 0;
}

.user-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.topbar-menu-toggle,
.period-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid #2f3a47;
    border-radius: 8px;
    background: #2f3a47;
    color: #fff;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
}

.hamburger-icon {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.hamburger-icon::before {
    top: -5px;
}

.hamburger-icon::after {
    top: 5px;
}

.client-switcher {
    display: flex;
    align-items: center;
    min-width: min(360px, 100%);
}

.client-switcher label {
    display: grid;
    gap: 4px;
    width: 100%;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.client-switcher select {
    min-height: 36px;
    max-width: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 7px 10px;
    font-weight: 700;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tabs a {
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface);
    font-weight: 700;
}

.tabs a.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.2;
}

h2 {
    font-size: 19px;
    line-height: 1.25;
}

p {
    line-height: 1.45;
}

.status,
.pill,
.severity {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 13px;
    font-weight: 700;
}

.status.ok,
.severity.low {
    background: #e8f5ef;
    color: var(--ok);
}

.status.warn,
.severity.medium {
    background: #fff4df;
    color: var(--warn);
    text-decoration: underline;
    text-decoration-color: #f2c94c;
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
}

.severity.high,
.severity.critical {
    background: #feeceb;
    color: var(--danger);
}

.notice,
.panel,
.metrics article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.notice {
    margin-bottom: 16px;
    padding: 14px 16px;
    color: var(--muted);
}

.notice.success {
    border-color: #b8e1ce;
    background: #edf8f2;
    color: var(--ok);
}

.notice.positive {
    border-color: #b8e1ce;
    background: #edf8f2;
    color: var(--ok);
}

.notice.error {
    border-color: #f3bbb6;
    background: #fff0ee;
    color: var(--danger);
}

.notice.negative {
    border-color: #f3bbb6;
    background: #fff0ee;
    color: var(--danger);
}

.notice.warning {
    border-color: #f0d878;
    background: #fff8db;
    color: #8a5a00;
}

.compact-notice {
    margin-bottom: 0;
    padding: 10px 12px;
}

.sync-failure-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.sync-failure-list small {
    display: block;
    color: var(--muted);
    line-height: 1.35;
}

.visual-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
}

.metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 16px;
}

.metrics article {
    padding: 18px;
}

.metrics span,
.section-title p,
.item p {
    color: var(--muted);
}

.metrics strong {
    display: block;
    margin-top: 8px;
    font-size: 20px;
    line-height: 1.25;
}

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

.summary-grid article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.summary-grid span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.summary-grid strong {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
}

.panel {
    padding: 18px;
    margin-bottom: 16px;
}

.client-list {
    display: grid;
    gap: 12px;
}

.pending-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.pending-summary article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.pending-summary span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.pending-summary strong {
    display: block;
    margin-top: 6px;
    font-size: 22px;
}

.pending-board,
.pending-list {
    display: grid;
    gap: 12px;
}

.pending-group {
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.pending-group summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    cursor: pointer;
}

.pending-group summary small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.pending-list {
    padding: 0 14px 14px;
}

.pending-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.pending-card.priority-high {
    border-left: 5px solid var(--danger);
}

.pending-card.priority-medium {
    border-left: 5px solid #f2c94c;
}

.pending-card.priority-low {
    border-left: 5px solid var(--ok);
}

.pending-card h3 {
    margin: 0 0 4px;
    font-size: 17px;
    line-height: 1.25;
}

.pending-card p {
    color: var(--muted);
}

.pending-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.pending-meta span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.pending-actions {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.month-strip {
    display: grid;
    grid-template-columns: repeat(12, minmax(64px, 1fr));
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 12px;
}

.month-strip a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
}

.month-strip a.active {
    border-color: var(--brand);
    background: #e8f5ef;
    color: #134f43;
    box-shadow: inset 0 -3px 0 var(--brand);
}

.month-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--muted);
}

.month-dot.low {
    background: var(--ok);
}

.month-dot.medium {
    background: #f2c94c;
}

.month-dot.high,
.month-dot.critical {
    background: var(--danger);
}

.month-check {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #dff2ea;
    color: #1f7a4d;
    font-size: 12px;
    font-weight: 900;
}

.month-ready-inline {
    display: inline-block;
    margin-left: 6px;
    color: #1f7a4d;
    font-size: 12px;
    font-weight: 800;
}

.review-blockers-text {
    display: inline-block;
    margin-left: 6px;
    color: #b45309;
    font-size: 12px;
    font-weight: 700;
}

.konta-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.konta-table {
    min-width: 980px;
}

.konta-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.konta-table tr.selected td {
    background: #f5fbf8;
    box-shadow: inset 0 -1px 0 var(--brand), inset 0 1px 0 var(--brand);
}

.period-route {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid #b8e1ce;
    border-left: 5px solid var(--brand);
    border-radius: 8px;
    background: #f3fbf7;
    padding: 14px;
    overflow: visible;
}

.period-route strong {
    display: block;
    font-size: 18px;
}

.period-route > div:first-child {
    grid-column: 1 / -1;
}

.period-route p {
    color: var(--muted);
}

.period-route-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    overflow: visible;
}

.selected-period-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    border: 1px solid var(--brand);
    border-radius: 8px;
    background: #dff2ea;
    color: #134f43;
    padding: 8px 12px;
    font-weight: 800;
}

.period-back-action {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 8px 18px rgba(31, 122, 103, 0.22);
}

.period-nav-action {
    width: 42px;
    min-width: 42px;
    border-color: #cbd5e1;
    background: #f8fafc;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.month-switcher-modal {
    position: relative;
}

.month-switcher-modal[open] {
    z-index: 140;
}

.month-switcher-modal > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 42px;
    border: 1px solid #2f3a47;
    border-radius: 8px;
    padding: 0;
    background: #2f3a47;
    color: #fff;
    font-weight: 800;
    line-height: 1.25;
    cursor: pointer;
    list-style: none;
}

.month-switcher-modal > summary::-webkit-details-marker {
    display: none;
}

.month-switcher-modal > summary::after {
    display: none;
    content: "";
}

.month-switcher-modal[open] > summary::after {
    content: "";
}

.calendar-icon {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 4px;
}

.calendar-icon::before {
    content: "";
    position: absolute;
    left: -2px;
    right: -2px;
    top: 4px;
    border-top: 2px solid currentColor;
}

.calendar-icon::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 9px;
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 5px 0 0 currentColor, 10px 0 0 currentColor;
}

.month-switcher-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 140;
    width: min(520px, calc(100vw - 40px));
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(24, 33, 47, 0.18);
    padding: 14px;
}

.month-switcher-head {
    margin-bottom: 12px;
}

.month-switcher-head strong {
    font-size: 16px;
}

.month-switcher-head p {
    margin: 2px 0 0;
    font-size: 13px;
}

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

.month-switcher-grid a {
    display: grid;
    gap: 2px;
    min-height: 56px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    background: #f8fafc;
    color: var(--text);
    text-decoration: none;
}

.month-switcher-grid a.active {
    border-color: var(--brand);
    background: #dff2ea;
    color: #134f43;
    box-shadow: inset 0 -3px 0 var(--brand);
}

.month-switcher-grid span {
    font-weight: 900;
}

.month-switcher-grid small {
    color: var(--muted);
    font-weight: 700;
}

.monthly-focus-panel {
    border-left: 5px solid var(--brand);
}

.monthly-assistant {
    border-left: 5px solid #2f3a47;
}

.monthly-view-switch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border-left: 5px solid #4f46e5;
}

.monthly-view-switch strong {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
}

.view-switch-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.monthly-executive-panel {
    border-left: 5px solid #2f3a47;
}

.assistant-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f6;
    margin-bottom: 12px;
}

.assistant-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--brand);
}

.module-assistant {
    border-left: 5px solid var(--brand);
}

.assistant-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    margin-bottom: 12px;
}

.assistant-header h2 {
    margin: 0;
}

.compact-assistant-steps {
    margin-top: 12px;
}

.assistant-intro {
    margin-bottom: 14px;
    color: var(--muted);
}

.assistant-step-list {
    display: grid;
    gap: 10px;
}

.assistant-step {
    overflow: hidden;
    border: 1px solid var(--line);
    border-left: 5px solid #9aa7b5;
    border-radius: 8px;
    background: #fff;
}

.assistant-step-complete {
    border-left-color: var(--ok);
}

.assistant-step-attention {
    border-left-color: #f2c94c;
}

.assistant-step-missing {
    border-left-color: var(--danger);
}

.assistant-step-optional {
    border-left-color: #64748b;
}

.assistant-step summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    list-style: none;
}

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

.assistant-step-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #eef4f2;
    color: var(--brand);
    font-size: 11px;
    font-weight: 900;
}

.assistant-step-title {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.assistant-step-title strong,
.assistant-step-title small {
    overflow-wrap: anywhere;
}

.assistant-step-title small {
    color: var(--muted);
}

.assistant-step-body {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 12px;
    background: #fbfcfd;
}

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

.assistant-guidance-card {
    border: 1px solid #f0d48e;
    border-radius: 8px;
    background: #fff9ec;
    padding: 10px;
}

.assistant-guidance-card strong {
    display: block;
    margin-bottom: 4px;
}

.assistant-guidance-card p {
    color: #6b7280;
}

.assistant-guidance-next {
    border-color: #b8dfcb;
    background: #f1faf5;
}

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

.assistant-facts span {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.assistant-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.monthly-checklist-assistant {
    border-left: 5px solid #f2c94c;
}

.checklist-assistant-list {
    display: grid;
    gap: 10px;
}

.checklist-assistant-step {
    border-width: 2px;
}

.monthly-period-menu {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
    border: 1px solid #b8e1ce;
    border-left: 5px solid var(--brand);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(24, 33, 47, 0.08);
    padding: 12px;
}

.monthly-period-title {
    display: grid;
    gap: 2px;
    min-width: 170px;
}

.monthly-period-title span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.monthly-period-title strong {
    font-size: 20px;
    line-height: 1.15;
}

.monthly-period-nav {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

.monthly-menu-link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    padding: 8px 11px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.monthly-menu-link.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.period-quick-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    border-top: 1px solid #d7ecdf;
    padding-top: 10px;
}

.monthly-sticky-header {
    position: sticky;
    top: 86px;
    z-index: 80;
    display: grid;
    gap: 10px;
    margin: -6px 0 12px;
    padding-top: 6px;
    background: linear-gradient(to bottom, var(--bg) 84%, rgba(245, 247, 249, 0.55));
    overflow: visible;
}

.monthly-year-inline {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.monthly-year-inline.form-grid.compact {
    gap: 10px;
}

.monthly-modal-hub {
    border-left: 5px solid #2f3a47;
}

.modal-hub-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.workspace-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 118;
    background: rgba(10, 16, 28, 0.52);
    backdrop-filter: blur(2px);
}

.workspace-modal-backdrop[hidden],
.workspace-modal-toolbar[hidden] {
    display: none !important;
}

.workspace-modal-toolbar {
    position: fixed;
    top: 84px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 121;
    width: min(1180px, calc(100% - 34px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #c7d2de;
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
    box-shadow: 0 10px 24px rgba(24, 33, 47, 0.22);
}

.workspace-modal-toolbar strong {
    font-size: 16px;
    line-height: 1.2;
}

.workspace-modal-toolbar .workspace-modal-close {
    width: auto;
    min-height: 36px;
    padding: 8px 12px;
}

body.workspace-modal-active {
    overflow: hidden;
}

.workspace-modal-source {
    display: none;
}

.workspace-modal-source.workspace-modal-open {
    position: fixed;
    top: 134px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    display: block;
    width: min(1180px, calc(100% - 34px));
    max-height: calc(100vh - 156px);
    overflow: auto;
    margin: 0;
    border-width: 2px;
    box-shadow: 0 20px 46px rgba(24, 33, 47, 0.25);
}

details.workspace-modal-source.workspace-modal-open > summary {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    padding-top: 10px;
}

.monthly-focus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.focus-card {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 112px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
}

.focus-card:hover {
    border-color: var(--brand);
    box-shadow: 0 8px 20px rgba(24, 33, 47, 0.08);
}

.focus-card > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.focus-card strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 19px;
    line-height: 1.2;
}

.focus-card > small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.focus-card-result {
    border-color: #b8e1ce;
    background: #eef8f4;
}

.focus-card-income {
    border-color: #9fd4c0;
    background: #f0faf6;
}

.focus-card-warning {
    border-color: #f0d878;
    background: #fffaf0;
}

.monthly-action-drawer {
    border-left: 5px solid #2f3a47;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.monthly-calculation-body {
    display: grid;
    gap: 12px;
}

.monthly-calculation-body .metrics,
.monthly-calculation-body .notice {
    margin-bottom: 0;
}

.client-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.client-card.active {
    border-color: var(--brand);
    box-shadow: inset 4px 0 0 var(--brand);
}

.client-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
}

.client-card p,
.muted-text {
    color: var(--muted);
}

.client-actions,
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.checkbox-group {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.checkbox-group legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

.merchandise-candidates-table {
    overflow-x: visible;
}

.merchandise-candidates-table table {
    min-width: 0;
    table-layout: fixed;
}

.merchandise-candidates-table th,
.merchandise-candidates-table td {
    white-space: normal;
    vertical-align: top;
    padding: 10px 8px;
}

.merchandise-candidates-table th:nth-child(1),
.merchandise-candidates-table td:nth-child(1) {
    width: 18%;
}

.merchandise-candidates-table th:nth-child(2),
.merchandise-candidates-table td:nth-child(2) {
    width: 8%;
}

.merchandise-candidates-table th:nth-child(3),
.merchandise-candidates-table td:nth-child(3) {
    width: 28%;
}

.merchandise-candidates-table th:nth-child(4),
.merchandise-candidates-table td:nth-child(4) {
    width: 8%;
}

.merchandise-candidates-table th:nth-child(5),
.merchandise-candidates-table td:nth-child(5) {
    width: 10%;
}

.merchandise-candidates-table th:nth-child(6),
.merchandise-candidates-table td:nth-child(6) {
    width: 11%;
}

.merchandise-candidates-table th:nth-child(7),
.merchandise-candidates-table td:nth-child(7) {
    width: 17%;
}

.merchandise-candidates-table small,
.merchandise-candidates-table .pill,
.merchandise-candidates-table .severity {
    font-size: 12px;
    line-height: 1.35;
}

.merchandise-candidates-table .form-grid.compact {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 0;
}

.merchandise-candidates-table .form-grid label {
    gap: 4px;
    font-size: 12px;
}

.merchandise-candidates-table input,
.merchandise-candidates-table select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
}

.merchandise-candidates-table button {
    min-height: 34px;
    padding: 7px 10px;
}

.merchandise-candidates-table thead {
    display: none;
}

.merchandise-candidates-table table,
.merchandise-candidates-table tbody {
    display: block;
    width: 100%;
}

.merchandise-candidates-table tbody {
    display: grid;
    gap: 10px;
}

.merchandise-candidates-table tr {
    display: grid;
    grid-template-columns: minmax(150px, 0.9fr) minmax(240px, 1.5fr) minmax(120px, 0.6fr) minmax(230px, 1fr);
    gap: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.merchandise-candidates-table td {
    display: block;
    width: auto !important;
    min-width: 0;
    border-bottom: 0;
    padding: 0;
    overflow-wrap: anywhere;
}

.merchandise-candidates-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.merchandise-candidates-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 2;
}

.merchandise-candidates-table td:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
}

.merchandise-candidates-table td:nth-child(4) {
    grid-column: 3;
    grid-row: 1;
}

.merchandise-candidates-table td:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
}

.merchandise-candidates-table td:nth-child(6) {
    grid-column: 4;
    grid-row: 1;
}

.merchandise-candidates-table td:nth-child(7) {
    grid-column: 4;
    grid-row: 2;
}

.merchandise-candidates-table td:nth-child(4)::before,
.merchandise-candidates-table td:nth-child(5)::before,
.merchandise-candidates-table td:nth-child(6)::before,
.merchandise-candidates-table td:nth-child(7)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.merchandise-candidates-table td:nth-child(4)::before {
    content: "Cantidad";
}

.merchandise-candidates-table td:nth-child(5)::before {
    content: "Costo";
}

.merchandise-candidates-table td:nth-child(6)::before {
    content: "Estado";
}

.merchandise-candidates-table td:nth-child(7)::before {
    content: "Decision";
}

.merchandise-candidates-table td[colspan] {
    grid-column: 1 / -1;
}

@media (max-width: 1100px) {
    .merchandise-candidates-table tr {
        grid-template-columns: 1fr 1fr;
    }

    .merchandise-candidates-table td:nth-child(n) {
        grid-column: auto;
        grid-row: auto;
    }

    .merchandise-candidates-table td:nth-child(3),
    .merchandise-candidates-table td:nth-child(7) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .merchandise-candidates-table tr {
        grid-template-columns: 1fr;
    }

    .merchandise-candidates-table td:nth-child(n) {
        grid-column: 1;
    }
}

.cfdi-accordion {
    display: grid;
    gap: 16px;
}

.cfdi-accordion .review-section {
    margin-bottom: 0;
}

.disclosure-panel {
    width: 100%;
}

.disclosure-panel summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    list-style: none;
    margin: -4px 0 14px;
}

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

.disclosure-panel summary::before {
    content: ">";
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--brand);
    font-weight: 900;
    grid-row: 1;
    grid-column: 2;
    transform: rotate(90deg);
}

.disclosure-panel:not([open]) summary::before {
    transform: rotate(0deg);
}

.disclosure-panel summary .pill {
    grid-row: 1;
    grid-column: 2;
    margin-right: 34px;
}

.disclosure-title {
    display: grid;
    gap: 4px;
}

.disclosure-title strong {
    font-size: 19px;
    line-height: 1.25;
}

.disclosure-title small {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.35;
}

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

.review-accordion .review-section {
    margin-bottom: 0;
}

.review-section {
    overflow: hidden;
    border-width: 2px;
    border-left-width: 7px;
    box-shadow: 0 8px 22px rgba(24, 33, 47, 0.05);
}

.review-section[open] {
    background: #fff;
}

.review-section:not([open]) {
    background: #fbfcfd;
}

.review-section > summary {
    margin-bottom: 0;
    padding: 2px 0;
}

.review-section[open] > summary {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 2px solid #edf1f5;
}

.review-section:not([open]) > summary {
    margin-bottom: -4px;
}

.review-section-contributor,
.review-section-cfdi {
    border-left-color: var(--brand);
}

.review-section-checklist {
    border-left-color: #b7791f;
}

.review-section-bitacora {
    border-left-color: #4b6b8a;
}

.review-section-upload,
.review-section-docs {
    border-left-color: #64748b;
}

.review-section-body {
    align-items: start;
    margin-bottom: 0;
}

.review-subsection {
    min-width: 0;
    border: 1px solid #d6e0ea;
    border-left: 4px solid #9aa7b5;
    border-radius: 8px;
    background: #f8fafc;
    padding: 14px;
}

.review-subsection .section-title {
    margin-bottom: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    white-space: nowrap;
    font-size: 14px;
}

th {
    color: var(--muted);
    font-size: 13px;
}

.pill {
    background: #eef2f6;
    color: #374151;
}

.pill.positive {
    background: #e8f5ef;
    color: var(--ok);
}

.pill.negative {
    background: #feeceb;
    color: var(--danger);
}

.pill.warning {
    background: #fff4df;
    color: var(--warn);
    text-decoration: underline;
    text-decoration-color: #f2c94c;
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
}

.money-value {
    font-weight: 800;
}

.money-value.positive,
.money-value.favor {
    color: var(--ok);
}

.money-value.negative,
.money-value.against,
.money-value.payable {
    color: var(--danger);
}

.money-value.warning,
.alert-highlight {
    text-decoration: underline;
    text-decoration-color: #f2c94c;
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
}

.money-value.zero {
    color: var(--muted);
}

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

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.inline-form {
    margin-top: 6px;
}

.form-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    align-items: end;
}

.form-grid label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-grid label.wide {
    grid-column: 1 / -1;
}

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

.form-grid .check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

input,
select {
    min-height: 42px;
}

textarea {
    resize: vertical;
}

input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.25;
    text-align: center;
}

.button-muted {
    background: #2f3a47;
}

.login-shell {
    width: min(460px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    place-items: center;
    padding: 32px 0;
}

.login-panel {
    width: 100%;
}

.login-panel h1 {
    margin-bottom: 18px;
}

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

.primary-link,
.secondary-action,
.secondary-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
}

.primary-link {
    background: var(--brand);
    color: #fff;
}

.assistant-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 18px;
    border-left: 5px solid var(--brand);
}

.assistant-hero h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.assistant-hero p:last-child,
.assistant-status p {
    color: var(--muted);
    line-height: 1.45;
}

.assistant-status {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
}

.assistant-status .inline-form {
    margin: 0;
}

.assistant-status button {
    background: #2f3a47;
}

.compact-metrics article strong {
    font-size: 22px;
}

.secondary-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.secondary-links a {
    border: 1px solid var(--line);
    color: var(--text);
    background: #fff;
}

.secondary-action {
    border: 1px solid var(--line);
    color: var(--text);
    background: #fff;
}

.metric-link,
.section-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--brand);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.metric-link::after,
.section-link::after {
    content: ">";
    font-size: 12px;
}

.reference-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 10px;
}

.activity-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 8px;
}

.activity-row span {
    display: inline-flex;
    gap: 4px;
    align-items: baseline;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-actions form {
    margin: 0;
}

.table-actions button,
.table-actions a {
    min-height: 36px;
}

.checklist-edit {
    align-items: flex-start;
}

.checklist-edit .form-grid {
    margin-top: 10px;
    margin-bottom: 0;
}

.inline-upload {
    margin-top: 10px;
}

.inline-upload summary {
    cursor: pointer;
    color: var(--brand);
    font-weight: 800;
}

.inline-upload .form-grid {
    margin-top: 10px;
    margin-bottom: 0;
}

.required-documents-list {
    display: grid;
    gap: 14px;
}

.required-document-card {
    overflow: hidden;
    border: 2px solid var(--line);
    border-left: 7px solid var(--warn);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(24, 33, 47, 0.05);
}

.required-document-card summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
}

.required-document-card summary::-webkit-details-marker {
    display: none;
}

.required-document-card summary::before {
    content: ">";
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--brand);
    font-weight: 900;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    transform: rotate(90deg);
}

.required-document-card:not([open]) summary::before {
    transform: rotate(0deg);
}

.required-document-card summary .pill {
    grid-column: 2;
    grid-row: 1;
    margin-right: 34px;
}

.required-document-card[open] summary {
    border-bottom: 2px solid #edf1f5;
    background: #fffaf0;
}

.required-document-title {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.required-document-title strong,
.required-document-title small {
    overflow-wrap: anywhere;
}

.required-document-title small {
    color: var(--muted);
    line-height: 1.35;
}

.period-badge {
    width: fit-content;
    border-radius: 999px;
    background: #fff4df;
    color: var(--warn);
    padding: 4px 9px;
    font-size: 13px;
    font-weight: 800;
}

.required-document-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 16px 16px;
    background: #fbfcfd;
}

.required-document-block {
    min-width: 0;
    border: 1px solid #d6e0ea;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.required-document-block.wide,
.required-document-actions {
    grid-column: 1 / -1;
}

.required-document-block > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.required-document-block p {
    overflow-wrap: anywhere;
}

.warning-block {
    border-left: 4px solid #f2c94c;
}

.required-document-steps,
.required-file-list,
.required-reason-list {
    display: grid;
    gap: 7px;
    margin: 8px 0 0;
    padding-left: 20px;
}

.required-file-list code {
    white-space: normal;
    overflow-wrap: anywhere;
}

.required-document-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cfdi-name {
    min-width: 220px;
    white-space: normal;
}

.cfdi-name strong,
.cfdi-name span,
.table-note span {
    display: block;
}

.cfdi-name span,
.table-note span:not(.pill) {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.table-note {
    min-width: 240px;
    white-space: normal;
}

.inline-editor-row td {
    background: #f8fafc;
    white-space: normal;
}

.cfdi-treatment-form {
    margin-top: 12px;
}

.cfdi-workspace {
    border-left: 5px solid var(--brand);
}

.cfdi-tab-state {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cfdi-tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}

.cfdi-tab-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 9px 12px;
    font-weight: 800;
    cursor: pointer;
}

.cfdi-tab-label span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    border-radius: 999px;
    background: #eef2f6;
    color: var(--muted);
    font-size: 12px;
}

#tab-cfdi-received:checked ~ .cfdi-tab-list label[for="tab-cfdi-received"],
#tab-cfdi-issued:checked ~ .cfdi-tab-list label[for="tab-cfdi-issued"] {
    border-color: var(--brand);
    background: #e8f5ef;
    color: #134f43;
    box-shadow: inset 0 -3px 0 var(--brand);
}

.cfdi-tab-panel {
    display: none;
}

#tab-cfdi-received:checked ~ .cfdi-tab-panels .cfdi-panel-received,
#tab-cfdi-issued:checked ~ .cfdi-tab-panels .cfdi-panel-issued {
    display: grid;
    gap: 12px;
}

.cfdi-compact-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

.cfdi-compact-table {
    min-width: 1080px;
}

.cfdi-compact-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.cfdi-compact-table td {
    vertical-align: top;
}

.cfdi-main-row.active td {
    background: #f3fbf7;
}

.cfdi-party {
    min-width: 230px;
    white-space: normal;
}

.cfdi-party strong,
.cfdi-party small {
    display: block;
    overflow-wrap: anywhere;
}

.cfdi-party small,
.cfdi-concept {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.cfdi-concept {
    min-width: 260px;
    white-space: normal;
}

.cfdi-money {
    font-weight: 800;
}

.row-options {
    position: relative;
}

.row-options > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    padding: 7px 10px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.row-options > summary::-webkit-details-marker,
.cfdi-row-detail > summary::-webkit-details-marker {
    display: none;
}

.row-options > div {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 15;
    display: grid;
    gap: 6px;
    min-width: 190px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(24, 33, 47, 0.16);
    padding: 8px;
}

.row-options a {
    border-radius: 7px;
    padding: 8px 9px;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.row-options a:hover {
    background: #eef4f2;
    color: var(--brand);
}

.cfdi-detail-row {
    display: none;
}

.cfdi-detail-row.active-detail {
    display: table-row;
}

.cfdi-detail-row td {
    padding: 0;
    background: #fbfcfd;
    white-space: normal;
}

.cfdi-row-detail {
    border-top: 1px solid var(--line);
}

.cfdi-row-detail > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    color: var(--text);
    cursor: pointer;
    list-style: none;
}

.cfdi-row-detail > summary span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.cfdi-row-detail > summary small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.cfdi-row-detail:not([open]) .cfdi-card-body {
    display: none;
}

.cfdi-list {
    display: grid;
    gap: 10px;
}

.cfdi-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.cfdi-card summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

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

.cfdi-card summary::before {
    content: ">";
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    color: var(--brand);
    font-weight: 900;
    transform: rotate(90deg);
}

.cfdi-card:not([open]) summary::before {
    transform: rotate(0deg);
}

.cfdi-summary-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.cfdi-summary-main strong,
.cfdi-summary-main small {
    overflow-wrap: anywhere;
}

.cfdi-summary-main small {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.cfdi-summary-money {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    padding-right: 28px;
}

.cfdi-summary-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    grid-column: 1 / -1;
}

.cfdi-card-body {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 12px 14px 14px;
}

.cfdi-actions {
    justify-content: flex-start;
}

.inline-editor-box {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.manual-entry {
    display: block;
}

.manual-entry .form-grid {
    margin-bottom: 0;
}

.read-only-list {
    display: grid;
    gap: 12px;
}

.read-only-record {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 14px;
}

.record-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.record-field {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 10px;
    background: #f8fafc;
}

.record-field span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.record-field strong {
    display: block;
    color: var(--text);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.record-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.record-actions form {
    margin: 0;
}

.record-actions button,
.record-actions a {
    min-height: 36px;
}

.cfdi-export-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.excel-action {
    gap: 8px;
}

.excel-mark {
    display: inline-grid;
    place-items: center;
    min-width: 30px;
    height: 22px;
    padding: 0 6px;
    border-radius: 4px;
    background: #217346;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

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

.deploy-output {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111827;
    color: #e5e7eb;
    padding: 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.deploy-run-hint {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
}

.deploy-run-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.deploy-run-overlay[hidden] {
    display: none;
}

.deploy-run-card {
    width: min(460px, 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
    padding: 18px 20px;
    display: grid;
    gap: 8px;
}

.deploy-run-card strong {
    color: var(--text);
    font-size: 17px;
}

.deploy-run-card p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.deploy-run-spinner {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 3px solid #dbe4f4;
    border-top-color: #0f766e;
    animation: deploy-spin 0.9s linear infinite;
}

@keyframes deploy-spin {
    to {
        transform: rotate(360deg);
    }
}

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.entry-files {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.entry-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.entry-file {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
}

.entry-file form {
    margin: 0;
}

.entry-file button {
    min-height: 32px;
    padding: 6px 10px;
}

.field-help {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.35;
}

.advanced-tools {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #f8fafc;
    margin-bottom: 16px;
}

.advanced-tools summary {
    cursor: pointer;
    font-weight: 700;
}

.advanced-tools[open] summary {
    margin-bottom: 14px;
}

.list {
    display: grid;
    gap: 10px;
}

.item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.item p {
    margin-top: 5px;
    line-height: 1.4;
}

.item strong {
    font-size: 15px;
    line-height: 1.35;
}

.guidance {
    align-items: flex-start;
}

.item.read-only-record {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
}

.guidance b {
    color: var(--text);
}

.check-list {
    display: grid;
    gap: 8px;
}

code {
    background: #eef2f6;
    border-radius: 4px;
    padding: 2px 5px;
}

.instructions {
    white-space: normal;
    line-height: 1.6;
    color: var(--text);
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}

.compact-text {
    max-height: 180px;
    overflow: auto;
}

.external-link a {
    color: var(--brand);
    font-weight: 700;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 12px;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 8px;
    background: var(--muted);
}

.timeline-dot.high {
    background: var(--danger);
}

.timeline-dot.medium {
    background: var(--warn);
}

.timeline-dot.low {
    background: var(--ok);
}

.timeline-content {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

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

.timeline-content p {
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.4;
}

.timeline-content strong {
    font-size: 16px;
    line-height: 1.35;
}

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

.traffic-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.traffic-card strong,
.traffic-card span {
    display: block;
}

.traffic-card span {
    margin-top: 4px;
    font-weight: 700;
}

.traffic-card p {
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.35;
}

.traffic-card.red {
    border-left: 5px solid var(--danger);
}

.traffic-card.yellow {
    border-left: 5px solid var(--warn);
}

.traffic-card.green {
    border-left: 5px solid var(--ok);
}

.traffic-card.gray {
    border-left: 5px solid var(--muted);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

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

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

    .monthly-period-menu {
        grid-template-columns: 1fr;
    }

    .monthly-period-nav {
        justify-content: flex-start;
    }

    .app-sidebar {
        position: static;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-nav {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .sidebar-section {
        min-width: 190px;
    }

    .sidebar-user {
        display: none;
    }

    .content-shell {
        width: min(100% - 24px, 1220px);
        padding-top: 18px;
    }
}

@media (max-width: 760px) {
    html {
        font-size: 15px;
    }

    .app-sidebar {
        padding: 12px;
        gap: 12px;
    }

    .sidebar-brand {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .brand-mark {
        width: 36px;
        height: 36px;
    }

    .sidebar-context {
        padding: 10px;
    }

    .shell {
        width: min(100% - 20px, 1180px);
        padding: 16px 0 28px;
    }

    h1 {
        font-size: 23px;
    }

    h2 {
        font-size: 18px;
    }

    .topbar,
    .metrics,
    .split,
    .review-accordion,
    .assistant-hero,
    .assistant-status,
    .section-title,
    .form-grid,
    .form-grid.compact,
    .record-fields,
    .read-only-record {
        grid-template-columns: 1fr;
    }

    .topbar,
    .section-title,
    .item {
        display: grid;
    }

    .topbar {
        top: 0;
        gap: 10px;
        padding: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .topbar .user-box {
        display: none;
        grid-column: 1 / -1;
        border-top: 1px solid var(--line);
        padding-top: 8px;
        margin-top: 2px;
    }

    .topbar.is-open .user-box {
        display: grid;
        gap: 8px;
        justify-content: stretch;
    }

    .topbar-menu-toggle {
        display: inline-flex;
        width: 44px;
        min-height: 44px;
        padding: 0;
        justify-self: end;
    }

    .workspace-modal-toolbar {
        top: 62px;
        width: calc(100% - 18px);
        padding: 7px 8px;
    }

    .workspace-modal-toolbar strong {
        font-size: 14px;
    }

    .workspace-modal-source.workspace-modal-open {
        top: 112px;
        width: calc(100% - 18px);
        max-height: calc(100vh - 122px);
    }

    .user-box {
        justify-content: flex-start;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .tabs a {
        flex: 0 0 auto;
        min-height: 42px;
    }

    .panel,
    .notice,
    .metrics article,
    .traffic-card,
    .timeline-content,
    .item {
        padding: 12px;
    }

    .metrics strong {
        font-size: 18px;
    }

    .compact-metrics article strong {
        font-size: 20px;
    }

    .secondary-links {
        display: grid;
        grid-template-columns: 1fr;
    }

    .disclosure-panel summary {
        grid-template-columns: 1fr;
        padding-right: 34px;
        position: relative;
    }

    .disclosure-panel summary::before {
        position: absolute;
        top: 0;
        right: 0;
    }

    .disclosure-panel summary .pill {
        grid-row: auto;
        grid-column: auto;
        justify-self: start;
        margin-right: 0;
    }

    .required-document-card {
        border-left-width: 5px;
    }

    .required-document-card summary,
    .required-document-body {
        grid-template-columns: 1fr;
    }

    .required-document-card summary {
        padding: 12px;
        padding-right: 42px;
        position: relative;
    }

    .required-document-card summary::before {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    .required-document-card summary .pill {
        grid-column: auto;
        grid-row: auto;
        justify-self: start;
        margin-right: 0;
    }

    .required-document-body {
        padding: 12px;
    }

    .required-document-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .review-section {
        border-left-width: 5px;
    }

    .review-section[open] > summary {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .review-subsection {
        padding: 12px;
    }

    button,
    .primary-link,
    .secondary-action,
    .secondary-links a {
        width: 100%;
        min-height: 44px;
    }

    .topbar-menu-toggle,
    .period-menu-toggle {
        width: auto;
        min-height: 42px;
    }

    .table-actions,
    .client-actions,
    .record-actions,
    .reference-links,
    .activity-row,
    .entry-file-list {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .record-actions {
        justify-content: flex-start;
    }

    .client-card {
        grid-template-columns: 1fr;
    }

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

    .month-strip {
        grid-template-columns: repeat(12, minmax(76px, 96px));
    }

    .period-route {
        grid-template-columns: 1fr;
    }

    .period-route-actions {
        display: flex;
        justify-content: flex-start;
    }

    .monthly-view-switch {
        grid-template-columns: 1fr;
    }

    .view-switch-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .month-switcher-modal {
        justify-self: start;
        width: auto;
    }

    .month-switcher-modal > summary {
        width: 44px;
        min-height: 44px;
    }

    .month-switcher-panel {
        position: static;
        width: 100%;
        margin-top: 8px;
        box-shadow: 0 10px 24px rgba(24, 33, 47, 0.12);
    }

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

    .assistant-step summary {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .assistant-step summary .severity {
        grid-column: 2;
        justify-self: start;
    }

    .assistant-facts,
    .assistant-actions,
    .assistant-guidance-grid {
        grid-template-columns: 1fr;
    }

    .assistant-actions {
        display: grid;
    }

    .cfdi-tab-list {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .cfdi-tab-label {
        flex: 0 0 auto;
    }

    .cfdi-compact-table {
        min-width: 920px;
    }

    .row-options > div {
        position: static;
        min-width: 0;
        margin-top: 6px;
        box-shadow: none;
    }

    .cfdi-row-detail > summary {
        grid-template-columns: 1fr;
    }

    .monthly-sticky-header {
        top: 72px;
        gap: 8px;
        margin-bottom: 10px;
    }

    .modal-hub-grid {
        grid-template-columns: 1fr;
    }

    .monthly-period-menu {
        margin-bottom: 0;
        padding: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .period-menu-toggle {
        display: inline-flex;
        justify-self: end;
    }

    .monthly-period-nav {
        display: none;
        grid-column: 1 / -1;
        justify-content: flex-start;
        flex-wrap: wrap;
        padding-top: 8px;
    }

    .monthly-period-menu.is-open .monthly-period-nav {
        display: flex;
    }

    .monthly-period-title strong {
        font-size: 18px;
    }

    .monthly-menu-link {
        min-height: 40px;
        padding: 8px 10px;
    }

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

    .focus-card {
        min-height: 104px;
    }

    .focus-card strong {
        font-size: 17px;
    }

    .quick-action-grid {
        grid-template-columns: 1fr;
    }

    .pending-card,
    .pending-group summary {
        grid-template-columns: 1fr;
    }

    .pending-actions {
        justify-items: stretch;
    }

    .client-switcher,
    .client-switcher select {
        width: 100%;
        max-width: none;
    }

    .timeline-item {
        grid-template-columns: 1fr;
    }

    .timeline-dot {
        display: none;
    }

    .timeline-head {
        display: grid;
        grid-template-columns: 1fr;
    }

    .table-wrap {
        border: 1px solid var(--line);
        background: #fff;
    }

    table {
        min-width: 760px;
    }

    th,
    td {
        padding: 11px 9px;
        font-size: 14px;
    }

    .cfdi-name,
    .table-note {
        min-width: 220px;
    }

    .cfdi-card summary {
        grid-template-columns: 1fr;
        padding-right: 42px;
        position: relative;
    }

    .cfdi-card summary::before {
        position: absolute;
        top: 14px;
        right: 14px;
    }

    .cfdi-summary-money,
    .cfdi-summary-badges {
        grid-column: 1;
        justify-self: start;
        padding-right: 0;
    }

    .entry-file {
        display: grid;
        width: 100%;
    }

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

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

/* Mercancias: regla final para tabla con scroll interno y encabezados fijos. */
.merchandise-candidates-table {
    max-height: min(68vh, 720px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.merchandise-candidates-table table {
    display: table !important;
    width: 100%;
    min-width: 1120px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.merchandise-candidates-table thead {
    display: table-header-group !important;
}

.merchandise-candidates-table tbody {
    display: table-row-group !important;
}

.merchandise-candidates-table tr {
    display: table-row !important;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.merchandise-candidates-table th,
.merchandise-candidates-table td {
    display: table-cell !important;
    width: auto !important;
    min-width: 0;
    white-space: normal;
    vertical-align: top;
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    overflow-wrap: anywhere;
}

.merchandise-candidates-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    box-shadow: 0 1px 0 var(--line);
    font-size: 12px;
}

.merchandise-candidates-table th:nth-child(1),
.merchandise-candidates-table td:nth-child(1) {
    width: 190px !important;
}

.merchandise-candidates-table th:nth-child(2),
.merchandise-candidates-table td:nth-child(2) {
    width: 86px !important;
}

.merchandise-candidates-table th:nth-child(3),
.merchandise-candidates-table td:nth-child(3) {
    width: 330px !important;
}

.merchandise-candidates-table th:nth-child(4),
.merchandise-candidates-table td:nth-child(4) {
    width: 86px !important;
    text-align: right;
}

.merchandise-candidates-table th:nth-child(5),
.merchandise-candidates-table td:nth-child(5) {
    width: 130px !important;
}

.merchandise-candidates-table th:nth-child(6),
.merchandise-candidates-table td:nth-child(6) {
    width: 120px !important;
}

.merchandise-candidates-table th:nth-child(7),
.merchandise-candidates-table td:nth-child(7) {
    width: 250px !important;
}

.merchandise-candidates-table td::before {
    content: none !important;
}

.merchandise-candidates-table small,
.merchandise-candidates-table .pill,
.merchandise-candidates-table .severity {
    font-size: 12px;
    line-height: 1.25;
}

.merchandise-candidates-table .form-grid.compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin: 0;
}

.merchandise-candidates-table .form-grid label {
    gap: 3px;
    font-size: 11px;
    line-height: 1.2;
}

.merchandise-candidates-table input,
.merchandise-candidates-table select {
    min-height: 32px;
    padding: 5px 7px;
    font-size: 12px;
    border-radius: 7px;
}

.merchandise-candidates-table button {
    min-height: 32px;
    width: 100%;
    padding: 6px 9px;
    font-size: 12px;
}
