:root {
    --blue-950: #0a2540;
    --blue-900: #0d3158;
    --blue-800: #124578;
    --blue-700: #1760a8;
    --blue-600: #2477c8;
    --blue-100: #dceeff;
    --blue-50: #eff7ff;
    --slate-950: #172033;
    --slate-800: #344054;
    --slate-700: #475467;
    --slate-600: #667085;
    --slate-500: #7b8798;
    --slate-300: #d0d5dd;
    --slate-200: #e4e7ec;
    --slate-100: #f2f4f7;
    --slate-50: #f8fafc;
    --green-800: #05603a;
    --green-700: #067647;
    --green-100: #d1fadf;
    --green-50: #ecfdf3;
    --amber-800: #934b06;
    --amber-700: #b54708;
    --amber-100: #fef0c7;
    --amber-50: #fffaeb;
    --red-800: #912018;
    --red-700: #b42318;
    --red-100: #fee4e2;
    --red-50: #fff4f2;
    --purple-700: #6941c6;
    --purple-100: #ebe9fe;
    --cyan-700: #0e7090;
    --cyan-100: #cff9fe;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 10px 24px rgba(15, 35, 60, 0.10);
    --shadow-lg: 0 24px 70px rgba(10, 37, 64, 0.22);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--slate-50); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--slate-950);
    background:
        radial-gradient(circle at top right, rgba(36, 119, 200, 0.10), transparent 34%),
        var(--slate-50);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid rgba(36, 119, 200, 0.24);
    outline-offset: 2px;
}

.app-shell { min-height: 100vh; }
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 13px 22px;
    color: var(--white);
    background:
        radial-gradient(circle at 82% -35%, rgba(56, 139, 236, .46), transparent 34%),
        linear-gradient(118deg, #082c54, #0d3f78 54%, #0d55a2);
    box-shadow: var(--shadow-md);
}
.brand-block { display: flex; align-items: center; gap: 14px; min-width: 320px; }
.brand-copy { min-width: 0; }
.brand-mark {
    display: grid;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 14px;
    color: #e8f4ff;
    background: linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.07));
    font-size: 25px;
    font-weight: 900;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 20px rgba(0, 30, 70, .18);
}
.eyebrow {
    margin-bottom: 3px;
    color: #c5ddfb;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.app-header h1 { margin: 0; font-size: clamp(21px, 2vw, 29px); line-height: 1.08; }
.app-header p { margin: 5px 0 0; color: #d9e9fb; font-size: 10px; }
.header-session {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.session-item {
    position: relative;
    min-width: 104px;
    max-width: 210px;
    padding: 7px 10px 7px 11px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 10px;
    background: rgba(255,255,255,.07);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.session-item::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    border-radius: 10px 0 0 10px;
    background: #7fc2ff;
}
.session-item.session-user::before { background: #c7a6ff; }
.session-item.session-update::before { background: #70e3ad; }
.session-item span {
    display: block;
    color: #bed8f7;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .055em;
    text-transform: uppercase;
}
.session-item strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #fff;
    font-size: 10px;
    font-weight: 820;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.btn {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 780;
    transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .58; transform: none; }
.btn-header {
    color: #eef7ff;
    background: rgba(255,255,255,.065);
    border-color: rgba(154, 205, 255, .58);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-header:hover { background: rgba(255,255,255,.13); border-color: rgba(196,225,255,.92); }
.btn-refresh { color: #dfffee; background: rgba(40, 194, 120, .13); border-color: #68e3aa; }
.btn-refresh:hover { background: rgba(40, 194, 120, .22); border-color: #96f2c8; }
.btn-refresh.is-loading span { display: inline-block; animation: header-spin .8s linear infinite; }
.btn-excel { color: #e4fff0; background: rgba(31, 163, 93, .11); border-color: #6bd79d; }
.btn-pdf { color: #ffeaea; background: rgba(225, 87, 87, .10); border-color: #ef9696; }
.btn-print { color: #f1eaff; background: rgba(139, 105, 219, .12); border-color: #bca5ee; }
.btn-centers { color: #e4fbff; background: rgba(38, 175, 196, .11); border-color: #7ad7e5; }
.btn-danger {
    color: #ffe2df;
    background: rgba(255, 91, 78, .16);
    border-color: #ff6257;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px rgba(255,98,87,.08);
}
.btn-danger:hover {
    color: #fff;
    background: rgba(255, 91, 78, .27);
    border-color: #ff8178;
    box-shadow: 0 0 0 2px rgba(255,98,87,.12);
}
@keyframes header-spin { to { transform: rotate(360deg); } }
.btn-ghost { color: var(--blue-800); background: var(--white); border-color: var(--slate-300); }
.btn-small { min-height: 31px; padding: 5px 9px; font-size: 11px; }
.btn-link {
    padding: 0;
    color: var(--blue-700);
    border: 0;
    background: transparent;
    font-weight: 800;
    text-align: left;
}
.btn-link:hover { color: var(--blue-950); text-decoration: underline; }

.app-main { width: min(1540px, calc(100% - 32px)); margin: 22px auto 48px; }
.filter-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1.35fr) minmax(160px, .8fr) repeat(4, minmax(118px, .58fr)) minmax(205px, .82fr) minmax(138px, .62fr) auto;
    align-items: end;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow-sm);
}
.filter-field { min-width: 0; }
.filter-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--slate-600);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.filter-field input, .filter-field select {
    width: 100%;
    height: 39px;
    padding: 7px 10px;
    color: var(--slate-950);
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--white);
}
.filter-field input:disabled { color: var(--slate-600); background: var(--slate-100); }
.filter-field input:focus, .filter-field select:focus {
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(36,119,200,.14);
}
.filter-actions { display: flex; align-items: end; }
.residual-control { display: grid; grid-template-columns: minmax(118px, 1fr) 92px; gap: 6px; align-items: center; }
.money-input { position: relative; min-width: 0; }
.money-input span { position: absolute; left: 9px; top: 50%; z-index: 1; color: var(--slate-600); font-size: 11px; font-weight: 800; transform: translateY(-50%); pointer-events: none; }
.money-input input { padding-left: 21px; text-align: right; font-variant-numeric: tabular-nums; }
.money-input input:disabled { color: var(--slate-500); background: var(--slate-100); }
.filter-help { display: block; min-height: 12px; margin-top: 4px; color: var(--slate-500); font-size: 8px; font-weight: 700; white-space: nowrap; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 8px;
    margin: 12px 0;
}
.kpi-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 12px 13px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.kpi-card::after {
    content: "";
    position: absolute;
    right: -18px;
    top: -22px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--kpi-soft, var(--blue-50));
}
.kpi-label { position: relative; z-index: 1; color: var(--slate-600); font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.kpi-value { position: relative; z-index: 1; margin-top: 5px; color: var(--kpi-color, var(--blue-950)); font-size: 24px; font-weight: 880; line-height: 1.08; font-variant-numeric: tabular-nums; }
.kpi-note { position: relative; z-index: 1; margin-top: 6px; color: var(--slate-500); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 5px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.tab {
    flex: 0 0 auto;
    padding: 9px 14px;
    color: var(--slate-600);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    font-weight: 760;
}
.tab:hover { color: var(--blue-800); background: var(--blue-50); }
.tab.is-active { color: var(--white); background: var(--blue-800); }
.report-content { margin-top: 14px; }

.panel {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 14px; }
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--slate-200);
}
.panel-header h2 { margin: 0; color: var(--blue-950); font-size: 16px; }
.panel-header p { margin: 4px 0 0; color: var(--slate-600); font-size: 11px; }
.panel-body { padding: 15px; }
.panel-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
.panel-grid.equal { grid-template-columns: 1fr 1fr; }

.badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 850;
    white-space: nowrap;
}
.badge-blue { color: var(--blue-800); background: var(--blue-100); }
.badge-green { color: var(--green-700); background: var(--green-100); }
.badge-amber { color: var(--amber-700); background: var(--amber-100); }
.badge-red { color: var(--red-700); background: var(--red-100); }
.badge-purple { color: var(--purple-700); background: var(--purple-100); }
.badge-cyan { color: var(--cyan-700); background: var(--cyan-100); }
.badge-slate { color: var(--slate-700); background: var(--slate-100); }

.summary-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid #c9dff3;
    border-left: 4px solid var(--blue-700);
    border-radius: 10px;
    color: var(--slate-700);
    background: var(--blue-50);
}
.summary-callout strong { color: var(--blue-950); }
.summary-callout-metric { flex: 0 0 auto; color: var(--blue-950); font-size: 18px; font-weight: 900; }

.balance-stack { margin-top: 9px; }
.balance-track {
    display: flex;
    width: 100%;
    height: 24px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--slate-100);
}
.balance-segment { min-width: 2px; transition: width 220ms ease; }
.balance-segment.current { background: linear-gradient(90deg, #179a6d, #42c996); }
.balance-segment.due-soon { background: linear-gradient(90deg, #d88408, #f5b94c); }
.balance-segment.overdue { background: linear-gradient(90deg, #c62f26, #ee6a62); }
.balance-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.legend-item { padding: 9px 10px; border: 1px solid var(--slate-200); border-radius: 9px; background: var(--slate-50); }
.legend-label { display: flex; align-items: center; gap: 6px; color: var(--slate-600); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-value { margin-top: 4px; color: var(--slate-950); font-size: 15px; font-weight: 880; }
.legend-percent { margin-top: 2px; color: var(--slate-500); font-size: 10px; }

.bar-list { display: grid; gap: 10px; }
.bar-item { min-width: 0; }
.bar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.bar-label { min-width: 0; overflow: hidden; color: var(--slate-700); font-size: 11px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { flex: 0 0 auto; color: var(--blue-950); font-size: 11px; font-weight: 860; }
.bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--slate-100); }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-700), #57a4e8); }
.bar-fill.is-danger { background: linear-gradient(90deg, var(--red-700), #ef776f); }

.aging-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.aging-card { padding: 11px; border: 1px solid var(--slate-200); border-radius: 10px; background: var(--white); }
.aging-card[data-level="0"] { border-top: 4px solid var(--green-700); }
.aging-card[data-level="1"] { border-top: 4px solid #e0a11b; }
.aging-card[data-level="2"] { border-top: 4px solid #db7b1a; }
.aging-card[data-level="3"] { border-top: 4px solid #d34a31; }
.aging-card[data-level="4"] { border-top: 4px solid #a61b1b; }
.aging-card-title { color: var(--slate-600); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.aging-card-value { margin-top: 5px; color: var(--blue-950); font-size: 18px; font-weight: 900; }
.aging-card-meta { margin-top: 4px; color: var(--slate-500); font-size: 10px; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 9px; }
.table-toolbar-info { color: var(--slate-600); font-size: 11px; }
.table-shell { width: 100%; overflow: auto; border: 1px solid var(--slate-200); border-radius: 10px; }
.report-table { width: 100%; min-width: 900px; border-collapse: separate; border-spacing: 0; background: var(--white); }
.report-table th, .report-table td {
    padding: 8px 9px;
    border-right: 1px solid var(--slate-200);
    border-bottom: 1px solid var(--slate-200);
    text-align: left;
    vertical-align: middle;
}
.report-table th:last-child, .report-table td:last-child { border-right: 0; }
.report-table tr:last-child td { border-bottom: 0; }
.report-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    color: var(--blue-950);
    background: #eaf3fc;
    font-size: 10px;
    font-weight: 880;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
}
.report-table tbody tr:hover td { background: #f8fbff; }
.report-table .number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table .center { text-align: center; }
.report-table .strong { color: var(--blue-950); font-weight: 820; }
.report-table .muted { color: var(--slate-500); }
.report-table .money { color: #07596d; font-weight: 760; }
.report-table .danger { color: var(--red-700); font-weight: 830; }
.report-table .warning { color: var(--amber-700); font-weight: 830; }
.report-table .sticky-left { position: sticky; left: 0; z-index: 1; background: var(--white); }
.report-table thead .sticky-left { z-index: 3; background: #eaf3fc; }
.report-table .sticky-right { position: sticky; right: 0; z-index: 2; background: var(--white); box-shadow: -6px 0 10px rgba(15,35,60,.06); }
.report-table thead .sticky-right { z-index: 4; background: #eaf3fc; }
.report-table .total-row .sticky-right { background: #eaf3fc; }
.document-table .col-document { width: 132px; max-width: 132px; }
.document-table .col-provider { width: 230px; max-width: 230px; }
.document-table .col-cfdi { width: 155px; max-width: 155px; }
.document-table .col-reference { width: 150px; max-width: 150px; }
.document-table .col-actions { width: 78px; min-width: 78px; max-width: 78px; }
.document-table.is-compact .col-provider { width: 210px; max-width: 210px; }
.provider-name-ellipsis { display:block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.report-table .total-row td { color: var(--blue-950); background: #eaf3fc; font-weight: 880; border-top: 1px solid #b7d3ef; }
.report-table .heat-0 { background: #f0fbf5; color: var(--green-800); }
.report-table .heat-1 { background: #fffae8; color: #9b6500; }
.report-table .heat-2 { background: #fff1df; color: #9a4d08; }
.report-table .heat-3 { background: #ffe7df; color: #a43220; }
.report-table .heat-4 { background: #ffe0de; color: #8d1c18; }
.cell-main { color: var(--blue-950); font-weight: 820; }
.cell-sub { margin-top: 2px; color: var(--slate-500); font-size: 9px; }
.row-actions { display: flex; justify-content: center; gap: 5px; }
.icon-button {
    display: inline-grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border: 1px solid var(--slate-300);
    border-radius: 7px;
    color: var(--blue-800);
    background: var(--white);
    font-size: 13px;
    font-weight: 900;
}
.icon-button:hover { border-color: var(--blue-600); background: var(--blue-50); }

.priority-line { display: flex; align-items: center; gap: 8px; }
.priority-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--slate-300); }
.priority-dot.high { background: var(--red-700); box-shadow: 0 0 0 4px var(--red-100); }
.priority-dot.medium { background: var(--amber-700); box-shadow: 0 0 0 4px var(--amber-100); }
.priority-dot.low { background: var(--green-700); box-shadow: 0 0 0 4px var(--green-100); }

.empty-state {
    display: grid;
    min-height: 220px;
    place-items: center;
    padding: 30px;
    text-align: center;
    border: 1px dashed var(--slate-300);
    border-radius: var(--radius-md);
    color: var(--slate-600);
    background: rgba(255,255,255,.72);
}
.empty-state strong { display: block; margin-bottom: 5px; color: var(--blue-950); font-size: 16px; }

.modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,37,64,.66); backdrop-filter: blur(3px); }
.modal-card {
    position: relative;
    z-index: 1;
    width: min(1040px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    border-radius: var(--radius-lg);
    background: var(--white);
    box-shadow: var(--shadow-lg);
}
.modal-provider-wide .modal-card { width: min(1680px, 96vw); }
.modal-provider-wide .modal-body { padding: 16px; }

.modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    color: var(--white);
    background: linear-gradient(125deg, var(--blue-950), var(--blue-800));
}
.modal-header h2 { margin: 2px 0 0; font-size: 20px; }
.modal-header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.modal-action {
    min-height: 32px;
    padding: 6px 9px;
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 8px;
    color: var(--white);
    background: rgba(255,255,255,.10);
    font-size: 10px;
    font-weight: 820;
}
.modal-action:hover { background: rgba(255,255,255,.18); }
.modal-eyebrow { color: #b9d9f8; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.modal-close { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 9px; color: var(--white); background: rgba(255,255,255,.10); font-size: 24px; }
.modal-body { padding: 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.detail-item { min-width: 0; padding: 10px 11px; border: 1px solid var(--slate-200); border-radius: 9px; background: var(--slate-50); }
.detail-item.span-2 { grid-column: span 2; }
.detail-label { color: var(--slate-500); font-size: 9px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.detail-value { margin-top: 4px; overflow-wrap: anywhere; color: var(--slate-950); font-size: 12px; font-weight: 760; }
.detail-highlight { margin: 14px 0; padding: 14px; border: 1px solid var(--slate-200); border-radius: 10px; background: linear-gradient(100deg, #f2f8ff, #ffffff); }
.detail-highlight-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.detail-number-label { color: var(--slate-500); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.detail-number-value { margin-top: 4px; color: var(--blue-950); font-size: 19px; font-weight: 900; }
.detail-section-title { margin: 18px 0 8px; color: var(--blue-950); font-size: 14px; }
.cfdi-alert {
    margin: 12px 0;
    padding: 11px 12px;
    border: 1px solid var(--red-100);
    border-left: 4px solid var(--red-700);
    border-radius: 9px;
    color: var(--red-800);
    background: var(--red-50);
    font-size: 11px;
    line-height: 1.45;
}
.cfdi-ok {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--green-100);
    border-left: 4px solid var(--green-700);
    border-radius: 9px;
    color: var(--green-800);
    background: var(--green-50);
    font-size: 11px;
}
.currency-reference { color: var(--purple-700); font-weight: 760; }
.document-blocked td { background: #fff9f8; }
.document-blocked:hover td { background: #fff4f2 !important; }
.reference-note { margin-top: 3px; color: var(--slate-500); font-size: 9px; }
.stage-note { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--slate-300); border-radius: 9px; color: var(--slate-600); background: var(--slate-50); font-size: 10px; }

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1200;
    max-width: min(430px, calc(100% - 40px));
    padding: 11px 14px;
    border-radius: 9px;
    color: var(--white);
    background: var(--blue-950);
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 160ms ease, transform 160ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.fatal-error { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 20px; background: rgba(10,37,64,.72); backdrop-filter: blur(4px); }
.fatal-error[hidden] { display: none; }
.fatal-error-card { width: min(520px, 100%); padding: 28px; border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow-lg); text-align: center; }
.fatal-error-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 14px; place-items: center; border-radius: 50%; color: var(--red-700); background: var(--red-100); font-size: 27px; font-weight: 900; }
.fatal-error h2 { margin: 0 0 8px; color: var(--blue-950); }
.fatal-error p { color: var(--slate-600); }
.fatal-error code { color: var(--red-700); }

.print-only { display: none; }
body.pdf-mode .no-print { display: none !important; }
body.pdf-mode .app-main { width: 100%; margin: 10px 0; }
body.pdf-mode .app-header { padding: 10px 14px; color: var(--white); background: linear-gradient(125deg, var(--blue-950), var(--blue-800)); box-shadow: none; border-bottom: 0; }
body.pdf-mode .brand-mark { color: var(--blue-950); background: var(--white); }
body.pdf-mode .eyebrow, body.pdf-mode .app-header p { color: #d7e9fa; }
body.pdf-mode .kpi-card { background: var(--kpi-soft, var(--blue-50)); border-top: 3px solid var(--kpi-color, var(--blue-800)); }

@media (max-width: 1240px) {
    .filter-panel { grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(145px, .8fr)); }
    .filter-field-date, .filter-actions { grid-row: 2; }
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
    .app-header { align-items: flex-start; flex-direction: column; }
    .header-session { width: 100%; justify-content: flex-start; }
    .header-actions { justify-content: flex-start; }
}

@media (max-width: 880px) {
    .session-item { flex: 1 1 150px; max-width: none; }
    .header-actions { justify-content: flex-start; }
    .filter-panel { grid-template-columns: 1fr 1fr; }
    .filter-field-search { grid-column: 1 / -1; }
    .filter-field-residual { grid-column: span 2; }
    .filter-field-date, .filter-actions { grid-row: auto; }
    .panel-grid, .panel-grid.equal { grid-template-columns: 1fr; }
    .aging-cards { grid-template-columns: repeat(2, 1fr); }
    .detail-grid, .detail-highlight-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
    .app-header { padding: 17px; }
    .app-main { width: min(100% - 20px, 1540px); margin-top: 12px; }
    .filter-panel, .kpi-grid, .aging-cards { grid-template-columns: 1fr; }
    .filter-field-search, .filter-field-residual { grid-column: auto; }
    .residual-control { grid-template-columns: 1fr 92px; }
    .filter-actions .btn { width: 100%; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1 1 110px; }
    .panel-header { align-items: flex-start; flex-direction: column; }
    .badges { justify-content: flex-start; }
    .balance-legend { grid-template-columns: 1fr; }
    .detail-grid, .detail-highlight-grid { grid-template-columns: 1fr; }
    .detail-item.span-2 { grid-column: auto; }
}

@media print {
    @page { size: landscape; margin: 7mm; }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    html, body { background: #fff !important; }
    body { font-size: 9px; }
    .no-print, .header-actions, .tabs, .toast, .modal-close { display: none !important; }

    body.modal-print-mode .app-shell { display: none !important; }
    body.modal-print-mode .modal { display: block !important; }
    body.modal-print-mode .modal-card { border-radius: 0; }

    .print-only { display: block; }

    .app-header {
        min-height: 0;
        padding: 7px 10px;
        color: #fff !important;
        background: linear-gradient(125deg, #0a2540, #124578) !important;
        box-shadow: none;
        border: 0;
    }
    .brand-mark {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        color: #0d3158 !important;
        background: #fff !important;
        font-size: 20px;
    }
    .app-header h1 { color: #fff !important; font-size: 17px; }
    .eyebrow, .app-header p { color: #d7e9fa !important; }
    .eyebrow { font-size: 8px; }
    .app-header p { margin-top: 2px; font-size: 8px; }
    .header-session { gap: 4px; }
    .session-item { min-width: 78px; padding: 4px 6px; border-radius: 5px; background: rgba(255,255,255,.08) !important; }
    .session-item span { font-size: 6px; }
    .session-item strong { font-size: 7px; }

    .app-main { width: 100%; margin: 5px 0 0; }

    .kpi-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
        margin: 5px 0 6px;
    }
    .kpi-card {
        min-height: 0;
        padding: 5px 6px;
        border: 1px solid #d0d5dd;
        border-top: 3px solid var(--kpi-color, #124578);
        border-radius: 6px;
        background: var(--kpi-soft, #eff7ff) !important;
        box-shadow: none;
    }
    .kpi-card::after { display: none; }
    .kpi-label { color: #475467 !important; font-size: 7px; }
    .kpi-value { margin-top: 2px; color: var(--kpi-color, #0d3158) !important; font-size: 11px; }
    .kpi-note { margin-top: 2px; color: #667085 !important; font-size: 6.5px; }

    .report-content { margin-top: 5px; }

    /* No obligar al panel completo a pasar a la hoja siguiente. */
    .panel {
        break-inside: auto;
        page-break-inside: auto;
        box-shadow: none;
        border-color: #d0d5dd;
    }
    .panel + .panel { margin-top: 6px; }
    .panel-header {
        break-after: avoid;
        page-break-after: avoid;
        padding: 6px 7px;
        background: #eff7ff !important;
        border-bottom: 1px solid #b7d3ef;
    }
    .panel-header h2 { font-size: 11px; }
    .panel-header p { margin-top: 2px; font-size: 7px; }
    .panel-body { padding: 6px; }

    .summary-callout { padding: 6px 8px; margin-bottom: 5px; background: #eff7ff !important; }
    .summary-callout-metric { font-size: 13px; }
    .aging-cards { gap: 3px; }
    .aging-card { padding: 5px; }
    .aging-card-value { font-size: 11px; }

    .table-shell { overflow: visible; border-radius: 4px; }
    .report-table { min-width: 0 !important; width: 100% !important; }
    .report-table thead { display: table-header-group; }
    .report-table tfoot { display: table-footer-group; }
    .report-table tr { break-inside: avoid; page-break-inside: avoid; }
    .report-table th, .report-table td { padding: 3px 4px; font-size: 6.5px; }
    .report-table thead th {
        position: static;
        color: #fff !important;
        background: #124578 !important;
        border-color: #0d3158;
        font-size: 6.5px;
    }
    .report-table .sticky-left,
    .report-table .sticky-right { position: static; box-shadow: none; }
    .report-table .total-row td { color: #0d3158 !important; background: #dceeff !important; }
    .report-table .heat-0 { background: #f0fbf5 !important; }
    .report-table .heat-1 { background: #fffae8 !important; }
    .report-table .heat-2 { background: #fff1df !important; }
    .report-table .heat-3 { background: #ffe7df !important; }
    .report-table .heat-4 { background: #ffe0de !important; }
    .document-blocked td { background: #fff4f2 !important; }

    .badge { min-height: 17px; padding: 2px 5px; font-size: 6.5px; }
    .badge-blue { background: #dceeff !important; }
    .badge-green { background: #d1fadf !important; }
    .badge-amber { background: #fef0c7 !important; }
    .badge-red { background: #fee4e2 !important; }
    .badge-purple { background: #ebe9fe !important; }
    .badge-cyan { background: #cff9fe !important; }
    .badge-slate { background: #f2f4f7 !important; }

    .modal { position: static; display: block; padding: 0; }
    .modal[hidden] { display: none; }
    .modal-backdrop { display: none; }
    .modal-card,
    .modal-provider-wide .modal-card {
        width: 100%;
        max-height: none;
        overflow: visible;
        border-radius: 0;
        box-shadow: none;
    }
    .modal-header {
        position: static;
        padding: 7px 9px;
        color: #fff !important;
        background: linear-gradient(125deg, #0a2540, #124578) !important;
        border-bottom: 0;
    }
    .modal-header h2 { color: #fff !important; font-size: 14px; }
    .modal-eyebrow { color: #d7e9fa !important; }
    .modal-body { padding: 7px; }
    .detail-grid { gap: 4px; }
    .detail-item { padding: 5px 6px; }
    .detail-highlight {
        margin: 6px 0;
        padding: 6px;
        background: #eff7ff !important;
        border-top: 3px solid #1760a8;
    }
    .detail-highlight-grid { gap: 5px; }
    .detail-number-value { font-size: 11px; }
    .detail-section-title { margin: 7px 0 4px; font-size: 9px; }
    .cfdi-alert { background: #fff4f2 !important; }
    .cfdi-ok { background: #ecfdf3 !important; }
}


/* ============================================================
   Centro CxP v1.2.5 · botones de header pastel / outline
   ============================================================ */
.header-actions .btn-header {
    color: #eef7ff;
    background: rgba(220, 238, 255, .08);
    border-color: rgba(185, 217, 248, .62);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.header-actions .btn-header:hover {
    color: #fff;
    background: rgba(220, 238, 255, .17);
    border-color: #8fc8ff;
}
.header-actions .btn-refresh {
    color: #d9f7e8;
    background: rgba(209, 250, 223, .09);
    border-color: rgba(126, 232, 167, .72);
}
.header-actions .btn-refresh:hover {
    background: rgba(209, 250, 223, .18);
    border-color: #62ee9c;
}
.header-actions .btn-danger {
    color: #ffe6e3;
    background: rgba(254, 228, 226, .12);
    border-color: #ff665c;
}
.header-actions .btn-danger:hover {
    color: #fff;
    background: rgba(180, 35, 24, .72);
    border-color: #ff4d42;
}

/* Centro de Pedidos v0.2.0 · hereda el lenguaje visual de CxP v1.2.5. */
[hidden] { display:none !important; }
body { font-size:13px; }
.brand-mark svg { width:31px; height:31px; }
.app-header { gap:18px; padding:14px 20px; }
.brand-block { min-width:340px; }
.app-header h1 { font-size:26px; }
.app-header p { font-size:11px; }
.header-session { flex-direction:column; align-items:flex-end; gap:9px; }
.session-facts { display:flex; flex-wrap:wrap; gap:6px; }
.session-item { min-width:144px; max-width:250px; padding:6px 12px; }
.session-item span { font-size:9px; }
.session-item strong { font-size:11px; }
.session-company { min-width:186px; }
.header-actions .btn { min-height:31px; padding:6px 9px; font-size:11px; }
.app-main { width:min(1580px,calc(100% - 32px)); margin:12px auto 24px; }
.demo-strip { display:flex; align-items:center; gap:12px; margin-bottom:10px; color:var(--slate-700); font-size:11px; }
.demo-strip .btn-link { margin-left:auto; font-size:11px; }
.badge { min-height:23px; font-size:10px; border:1px solid rgba(16,24,40,.04); gap:4px; }
.filter-panel { grid-template-columns:minmax(190px,1.35fr) minmax(170px,1.1fr) repeat(4,minmax(120px,.8fr)) 130px auto; gap:9px; padding:12px; }
.filter-field label { color:var(--slate-700); font-size:9px; }
.filter-field input,.filter-field select { height:35px; font-size:11px; padding:6px 8px; }
.filter-actions .btn { min-height:35px; font-size:11px; padding:6px 9px; }
.kpi-grid { grid-template-columns:repeat(8,minmax(0,1fr)); gap:8px; }
.kpi-card { text-align:left; padding:11px 12px; min-height:100px; border-top:3px solid var(--kpi-color); cursor:pointer; }
.kpi-card:hover { border-color:var(--kpi-color); box-shadow:0 3px 12px #14395516; }
.kpi-card.is-selected { outline:2px solid var(--kpi-color); outline-offset:1px; }
.kpi-value { font-size:25px; margin-top:7px; }
.kpi-label { font-size:10px; }
.kpi-note { color:var(--slate-700); font-size:10px; margin-top:5px; }
.kpi-unit { font-size:11px; font-weight:700; }
.scope-note { display:flex; align-items:center; gap:7px; color:var(--slate-700); font-size:11px; margin:2px 0 12px; }
.tabs { padding:4px; }
.tab { font-size:12px; padding:8px 14px; }
.view-heading { display:flex; align-items:center; justify-content:space-between; margin:14px 0 9px; gap:8px; color:var(--blue-950); }
.view-heading>strong { font-size:14px; }
.view-heading>span { color:var(--slate-700); font-size:11px; }
.report-content { margin-top:0; }
.panel-header { padding:12px 14px; }
.panel-header h2 { font-size:14px; }
.panel-header p { font-size:11px; color:var(--slate-700); }
.panel-body { padding:13px; }
.panel-grid { grid-template-columns:1.13fr .87fr; gap:12px; align-items:start; }
.panel-grid>.panel+.panel { margin:0; }
.summary-attention { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:12px 16px; border:1px solid #eed6b5; border-left:4px solid #b76e08; background:linear-gradient(100deg,#fff6e7,#fffaf2); border-radius:11px; margin-bottom:12px; }
.summary-attention h2 { font-size:15px; margin:0 0 3px; color:#794209; }
.summary-attention p { margin:0; color:#745c35; font-size:11px; }
.btn-primary { color:white; background:var(--blue-800); border-color:var(--blue-800); font-size:11px; min-height:32px; }
.btn-primary:hover { background:var(--blue-950); }
.flow-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:8px; }
.flow-card { padding:12px 10px; text-align:left; border:1px solid var(--slate-200); border-top:3px solid var(--dept-color); border-radius:9px; background:linear-gradient(180deg,#f9fbff,white); min-height:118px; }
.flow-card:hover { border-color:var(--dept-color); background:var(--blue-50); }
.flow-card .flow-title { color:var(--slate-800); font-size:11px; font-weight:800; display:block; min-height:28px; }
.flow-value { display:block; font-size:22px; font-weight:880; color:var(--dept-color); }
.flow-meta { display:block; margin-top:5px; font-size:10px; color:var(--slate-700); }
.flow-flag { display:block; margin-top:8px; font-size:10px; color:var(--red-700); font-weight:760; }
.flow-bar { height:5px; border-radius:5px; background:#ecf0f5; margin-top:9px; overflow:hidden; }
.flow-bar span { height:100%; display:block; background:var(--dept-color); }
.small-note { font-size:10px; color:var(--slate-700); line-height:1.5; margin:10px 0 0; }
.distribution-layout { display:flex; align-items:center; gap:24px; min-height:173px; }
.donut { position:relative; flex:0 0 162px; width:162px; height:162px; }
.donut svg { width:100%; height:100%; transform:rotate(-90deg); }
.donut-center { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.donut-center strong { color:var(--blue-950); font-size:25px; }
.donut-center span { color:var(--slate-700); font-size:10px; margin-top:4px; }
.distribution-legend { flex:1; display:grid; gap:13px; }
.legend-row { display:grid; grid-template-columns:10px 1fr auto; gap:8px; align-items:center; }
.legend-row .legend-dot { width:8px;height:8px; }
.legend-row strong { font-size:12px; color:var(--blue-950); }
.legend-row small { display:block; color:var(--slate-700); font-size:10px; margin-top:2px; }
.legend-row>b { text-align:right; font-size:14px; color:var(--blue-950); }
.attention-list { display:grid; gap:7px; }
.attention-item { display:flex; gap:10px; padding:9px 10px; border:1px solid var(--slate-200); border-left:3px solid var(--attention-color); border-radius:8px; align-items:start; }
.attention-item strong { color:var(--blue-950); font-size:11px; }
.attention-item p { font-size:11px; margin:4px 0; color:var(--slate-800); }
.attention-item small { color:var(--slate-700);font-size:10px; }
.attention-item .btn-link { flex:0 0 auto; margin-left:auto; font-size:11px; }
.attention-body { flex:1; min-width:0; }
.section-gap { margin-top:12px; }
.table-toolbar { margin:0 0 9px; }
.table-toolbar label { font-size:11px; color:var(--slate-700); }
.table-toolbar select { border:1px solid var(--slate-300); padding:5px 8px; border-radius:6px; font-size:11px; color:var(--blue-950); background:white; }
.report-table { min-width:960px; font-size:11px; }
.report-table td { padding:8px; }
.report-table th { font-size:9px; padding:9px 8px; }
.report-table th button { padding:0; border:0; color:inherit; background:none; font-weight:inherit; font-size:inherit; text-transform:inherit; }
.report-table th button:hover { color:var(--blue-600); }
.report-table .cell-sub { color:var(--slate-700); font-size:10px; }
.report-table .btn-link { font-size:11px; }
.table-tight { min-width:740px; }
.table-empty { text-align:center!important; color:var(--slate-700); padding:28px!important; }
.progress-cell { width:90px; }
.mini-track { height:5px; background:#e8edf3; border-radius:9px; overflow:hidden; margin-top:5px; }
.mini-track span { display:block; height:100%; background:#2477c8; }
.progress-label { color:var(--blue-950); font-weight:800; font-size:11px; }
.location-tags { display:flex; flex-wrap:wrap; gap:3px; max-width:280px; }
.location-tags span { font-size:9px; background:#edf3f9; color:var(--blue-800); padding:3px 6px; border-radius:5px; white-space:nowrap; }
.cause-cell { min-width:210px;max-width:300px; }
.cause-cell p { margin:3px 0 0; font-size:10px;color:var(--slate-700); line-height:1.5; }
.report-table tfoot td { background:#edf4fc; color:var(--blue-950); font-weight:800; }
.matrix-table { min-width:1120px; }
.matrix-table td,.matrix-table th { text-align:right; }
.matrix-table td:first-child,.matrix-table th:first-child { text-align:left; }
.matrix-value { padding:4px 8px; border:0; background:#eaf4ff; color:#124578; font-size:11px; font-weight:800; border-radius:5px; min-width:49px; }
.matrix-value.late { color:#922117;background:#ffebe7; }
.matrix-value:hover { outline:1px solid currentColor; }
.week-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:9px; margin-bottom:12px; }
.week-card { padding:14px; border:1px solid var(--slate-200); border-top:3px solid var(--week-color); border-radius:10px; text-align:left; background:white; }
.week-card:hover,.week-card.is-active { background:var(--blue-50); border-color:var(--week-color); }
.week-card>span { display:block; font-size:11px; color:var(--slate-700); font-weight:800; }
.week-card strong { display:block; font-size:24px; margin:8px 0; color:var(--week-color); }
.week-card small { font-size:10px; color:var(--slate-700); }
.quick-filters { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.quick-filter { border:1px solid var(--slate-300); padding:6px 10px; background:white; color:var(--slate-700); border-radius:7px; font-size:11px; font-weight:750; }
.quick-filter:hover { background:var(--blue-50); }
.quick-filter.is-active { color:var(--blue-800);background:var(--blue-100);border-color:#9cbddd; }
.empty-state { min-height:180px; }
.modal-card { width:min(1250px,calc(100vw - 36px)); }
.modal-header { padding:13px 16px; }
.modal-header h2 { font-size:21px; }
.modal-body { padding:15px; }
.detail-grid { grid-template-columns:repeat(5,1fr); }
.detail-label { color:var(--slate-700); font-size:10px; }
.detail-item { padding:9px 11px; }
.detail-highlight-grid { grid-template-columns:repeat(6,1fr); }
.detail-number-label { color:var(--slate-700); font-size:10px; }
.detail-number-value { font-size:21px; }
.detail-highlight { margin:12px 0; padding:12px; }
.detail-section-title { margin:16px 0 8px; font-size:13px; }
.lot-context { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.detail-alert { border-radius:8px; background:#fff7e9; color:#814907; border:1px solid #efd8b0; padding:10px 12px; font-size:11px; line-height:1.5; margin:8px 0; }
.detail-alert.red { color:#912018; background:#fff1ee; border-color:#efc8c2; }
.detail-alert strong { display:block; margin-bottom:3px; }
.timeline { display:grid;gap:0; padding:5px 10px; }
.timeline-event { display:grid; grid-template-columns:125px 15px 1fr; gap:10px; position:relative; padding:10px 0; }
.timeline-date { font-size:11px; color:var(--slate-700); }
.timeline-marker { width:9px;height:9px;border-radius:50%;background:#2477c8;margin-top:3px;position:relative; }
.timeline-event:not(:last-child) .timeline-marker:after { content:'';position:absolute; width:2px;top:11px; height:47px;left:3px;background:#d6e4f3; }
.timeline-event strong { font-size:12px;color:var(--blue-950); }
.timeline-event small { font-size:10px;color:var(--slate-700); display:block; margin-top:4px; }
.route { display:flex;flex-wrap:wrap;gap:7px;margin:10px 0; }
.route span { padding:7px 11px;background:#f1f4f7;border-radius:7px;border:1px solid #d7dfe8;color:var(--slate-700);font-size:11px; }
.route span.current { background:#dceeff;color:var(--blue-800);border-color:#82b2dd;font-weight:850; }
.rules-list { display:grid;gap:12px;margin:0;padding-left:20px;font-size:12px;line-height:1.6;color:var(--slate-800); }
.rules-list strong { color:var(--blue-950); }
.center-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:12px 0; }
.center-card { border:1px solid var(--slate-200);border-radius:10px;padding:22px 15px;background:var(--blue-50); }
.center-card h3 { margin:0 0 8px;font-size:15px;color:var(--blue-950); }
.center-card p { margin:0 0 16px; color:var(--slate-700);font-size:11px;line-height:1.6; }
.session-ended { position:fixed;inset:0;z-index:1350;display:grid;place-items:center;background:linear-gradient(120deg,#0a2540,#124578); }
.session-ended .brand-mark { margin:0 auto 18px;background:var(--blue-800); }
.session-ended small { display:block;margin-top:16px;color:var(--slate-700); }
.app-footer { display:flex;justify-content:space-between;gap:12px;margin-top:20px;color:var(--slate-700);font-size:10px; }
@media(min-width:1580px) { .app-header { padding-left:calc((100vw - 1540px)/2);padding-right:calc((100vw - 1540px)/2); } }
@media(max-width:1300px) {
 .filter-panel { grid-template-columns:2fr 1.5fr 1.2fr 1.2fr; }
 .filter-field-date,.filter-actions { grid-row:auto; }
 .kpi-grid { grid-template-columns:repeat(4,1fr); }
 .kpi-card { min-height:88px; }
 .flow-grid { grid-template-columns:repeat(4,1fr); }
 .flow-card { min-height:108px; }
 .flow-card .flow-title { min-height:16px; }
}
@media(max-width:1100px) {
 .app-header { flex-direction:row;align-items:center; }
 .brand-block { min-width:280px; }
 .app-header h1 { font-size:24px; }
 .header-session { align-items:flex-end;width:auto; }
 .session-facts { justify-content:flex-end; }
 .session-item { min-width:120px; }
 .session-company { min-width:180px; }
 .header-actions { justify-content:flex-end; }
}
@media(max-width:880px) {
 .app-header { flex-direction:column;align-items:flex-start; }
 .header-session { width:100%;align-items:flex-start; }
 .session-facts,.header-actions { justify-content:flex-start; }
 .session-item { flex:1 1 150px; }
 .filter-panel { grid-template-columns:repeat(2,1fr); }
 .filter-field-search { grid-column:1/-1; }
 .panel-grid { grid-template-columns:1fr; }
 .detail-grid { grid-template-columns:repeat(2,1fr); }
 .detail-highlight-grid { grid-template-columns:repeat(3,1fr); }
 .week-grid { grid-template-columns:repeat(2,1fr); }
 .center-grid { grid-template-columns:1fr; }
}
@media(max-width:620px) {
 .app-header { padding:14px; }
 .brand-block { min-width:0;gap:10px; }
 .brand-mark { width:42px;height:42px; }
 .app-header h1 { font-size:23px; }
 .app-header p { font-size:10px; }
 .session-facts { display:grid;grid-template-columns:1fr 1fr;width:100%; }
 .session-item { min-width:0!important;max-width:none; }
 .session-company { grid-column:1/-1; }
 .header-actions { width:100%; }
 .header-actions .btn { flex:1 1 110px; }
 .demo-strip { flex-wrap:wrap;gap:7px; }
 .demo-strip .btn-link { margin-left:0; }
 .kpi-grid { grid-template-columns:repeat(2,1fr); }
 .flow-grid { grid-template-columns:repeat(2,1fr); }
 .filter-panel { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .filter-field-search { grid-column:1/-1; }
 .filter-actions .btn { width:100%; }
 .summary-attention { flex-direction:column;align-items:start; }
 .distribution-layout { gap:16px; }
 .donut { flex-basis:125px;width:125px;height:125px; }
 .donut-center strong { font-size:21px; }
 .distribution-legend { gap:10px; }
 .legend-row { grid-template-columns:8px 1fr; }
 .legend-row>b { grid-column:2; text-align:left;font-size:13px; }
 .legend-row strong { font-size:11px; }
 .modal { padding:7px; }
 .modal-card { width:calc(100vw - 14px);max-height:calc(100vh - 14px); }
 .modal-header { align-items:start;padding:12px; }
 .modal-header h2 { font-size:18px; }
 .modal-header-actions { max-width:180px; }
 .modal-body { padding:11px; }
 .timeline-event { grid-template-columns:95px 12px 1fr;gap:7px; }
 .app-footer { flex-direction:column;gap:6px; }
 .scope-note { line-height:1.5; }
}
@media print {
 .demo-strip .btn-link,.scope-note,.app-footer { display:none!important; }
 .app-header { display:flex!important;flex-direction:row;align-items:center;padding:7px 10px!important; }
 .brand-block { min-width:250px; }
 .header-session { width:auto; }
 .session-facts { flex-wrap:nowrap; }
 .session-item { min-width:80px!important; }
 .app-main { width:100%;margin:6px 0; }
 .demo-strip { margin:5px 0;font-size:8px; }
 .kpi-grid { grid-template-columns:repeat(8,1fr)!important;gap:4px; }
 .kpi-card { min-height:0; }
 .kpi-label,.kpi-note { font-size:7px; }
 .kpi-value { font-size:13px; }
 .view-heading { margin:8px 0;font-size:9px; }
 .view-heading>strong { font-size:12px; }
 .panel-grid { grid-template-columns:1.1fr .9fr; }
 .flow-grid { grid-template-columns:repeat(7,1fr); }
 .flow-card { min-height:0;padding:7px; }
 .flow-value { font-size:14px; }
 .flow-title,.flow-meta,.flow-flag { font-size:7px!important; }
 .flow-card .flow-title { min-height:18px; }
 .summary-attention { padding:8px 10px; }
 .summary-attention h2 { font-size:11px; }
 .summary-attention p { font-size:8px; }
 .donut { width:125px;height:125px;flex-basis:125px; }
 .donut-center strong { font-size:18px; }
 .distribution-layout { min-height:125px;gap:12px; }
 .legend-row strong,.legend-row small,.attention-item p,.attention-item strong,.attention-item small,.small-note { font-size:8px; }
 .attention-item { padding:6px;break-inside:avoid; }
 .distribution-legend { gap:8px; }
 .legend-row>b { font-size:11px; }
 .report-table { min-width:0!important; }
 .report-table td,.report-table th,.report-table .cell-sub,.report-table .btn-link,.matrix-value { font-size:7px;padding:4px; }
 .location-tags span { font-size:6px; }
 .cause-cell { min-width:90px; }
 .cause-cell p { font-size:6px; }
 .modal-header-actions { display:none!important; }
 .detail-grid { grid-template-columns:repeat(5,1fr); }
 .detail-highlight-grid { grid-template-columns:repeat(6,1fr); }
 .detail-label,.detail-number-label { font-size:7px; }
 .detail-value { font-size:9px; }
 .detail-number-value { font-size:15px; }
 .detail-alert { font-size:8px;padding:7px; }
 .week-grid { grid-template-columns:repeat(4,1fr); }
 .week-card { padding:8px; }
 .week-card strong { font-size:16px; }
 .timeline-event { padding:7px 0;break-inside:avoid; }
}

/* v0.2.0 · entrega por renglón y acciones de abastecimiento. */
.delivery-filter-panel { grid-column:1/-1;display:flex;gap:12px;align-items:end;padding-top:11px;border-top:1px solid #dbe5ef; }
.delivery-filter-panel .filter-field { flex:0 1 265px; }
.delivery-filter-panel p { flex:1;margin:0 0 4px;color:var(--slate-700);font-size:11px;line-height:1.5; }
.filter-error { color:var(--red-700)!important;font-weight:750; }
.report-table .scope-selected td { background:#f0f7ff; }
.report-table .scope-outside td { color:#667085; }
.row-context { font-size:10px;color:var(--slate-700);padding:8px 11px;background:#edf4fc;border-radius:7px;margin:9px 0;line-height:1.5; }
.material-note { padding:9px 12px;color:var(--blue-800);background:#eff7ff;border-radius:8px;margin:9px 0;font-size:11px;line-height:1.5; }
.oc-link { display:inline-flex;gap:4px;align-items:center;padding:4px 8px;border:1px solid #b9b1db;border-radius:6px;background:#f4f0fe;color:#6941c6;font-weight:800;font-size:11px; }
.oc-link:hover { background:#e9e0ff;border-color:#967cda; }
.oc-links { display:flex;flex-wrap:wrap;gap:5px; }
.oc-reference-card { padding:10px 12px;border:1px solid #dbd3ef;border-left:3px solid #7b5ac2;border-radius:8px;background:#f7f4ff;margin:10px 0; }
.oc-reference-card strong { color:#53348e;font-size:12px; }
.oc-reference-card p { color:var(--slate-700);font-size:11px;margin:5px 0;line-height:1.5; }
.order-scope-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:10px 0; }
@media(max-width:620px) { .delivery-filter-panel { flex-wrap:wrap;gap:9px; }.delivery-filter-panel .filter-field { flex:1 1 135px; }.delivery-filter-panel p { flex:1 1 100%; }.order-scope-grid { grid-template-columns:1fr; } }
@media print { .oc-link { border:0;background:none;font-size:7px; padding:0; }.material-note,.row-context,.oc-reference-card p { font-size:8px; }.report-table .scope-selected td { background:#edf4fc!important; } }

@media print { .print-context { color:#344054;font-size:7px;line-height:1.5;margin:6px 0; } }
