* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f6f8;
    color: #17202a;
}
.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
}
.topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 20px;
}
.topbar h1 { margin: 0 0 4px; font-size: 28px; }
.topbar p { margin: 0; color: #5d6d7e; }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
nav a {
    text-decoration: none;
    color: #263238;
    background: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid #dfe6e9;
}
nav a.active {
    background: #1f6feb;
    color: #fff;
    border-color: #1f6feb;
}
.card {
    background: #fff;
    border: 1px solid #dfe6e9;
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 4px 18px rgba(20, 40, 60, .05);
}
.card h2 { margin-top: 0; }
.card h3 { margin-bottom: 10px; }
.muted { color: #64748b; }
.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
}
input, select, textarea {
    width: 100%;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
button {
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    background: #1f6feb;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}
button.secondary { background: #546e7a; }
button.primary { background: #0f766e; }
button:disabled { opacity: .6; cursor: wait; }
.status {
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 12px;
    font-weight: 700;
}
.status.ok { background: #e8f5e9; color: #1b5e20; }
.status.warn, .warn-card { background: #fff8e1; color: #8a5a00; }
.status.error { background: #ffebee; color: #b71c1c; }
pre {
    background: #0f172a;
    color: #dbeafe;
    border-radius: 14px;
    padding: 14px;
    overflow: auto;
    max-height: 520px;
}
.auth-block { display: none; grid-column: span 2; }
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.endpoint-btn {
    text-align: left;
    background: #f8fafc;
    color: #17202a;
    border: 1px solid #dfe6e9;
    min-height: 78px;
}
.endpoint-btn strong { display: block; }
.endpoint-btn small { color: #64748b; }
.endpoint-btn.primary { background: #0f766e; color: #fff; }
.endpoint-btn.primary small { color: #d1fae5; }
.result-area { min-height: 100px; }
.table-wrap {
    width: 100%;
    overflow: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    vertical-align: top;
}
th { background: #f8fafc; font-weight: 800; }
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.error { background: #fee2e2; color: #991b1b; }
.check {
    flex-direction: row;
    align-items: center;
    font-weight: 600;
}
.check input { width: auto; }
.checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.metric {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    background: #f8fafc;
}
.metric span {
    display: block;
    color: #64748b;
    margin-bottom: 6px;
}
.metric strong {
    font-size: 22px;
}
@media (max-width: 760px) {
    .topbar { flex-direction: column; }
    .grid-form { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .summary-grid { grid-template-columns: 1fr; }
}

/* Fase 3.1 — normalização interativa */
.live-card { border-left: 5px solid #1f6feb; }
.live-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}
.live-counter {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 100px;
}
.live-counter strong {
    font-size: 28px;
    line-height: 1;
}
.live-counter span {
    color: #64748b;
    font-weight: 700;
}
.progress-shell {
    height: 12px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin: 12px 0;
}
.progress-bar {
    height: 100%;
    width: 0%;
    background: #1f6feb;
    border-radius: 999px;
    transition: width .25s ease;
}
.current-request {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}
.endpoint-check span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.endpoint-check small {
    color: #64748b;
    font-weight: 500;
    word-break: break-all;
}
.endpoint-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}
.endpoint-progress-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px;
    background: #f8fafc;
}
.endpoint-progress-card.running {
    border-color: #f59e0b;
    background: #fff7ed;
}
.endpoint-progress-card.success {
    border-color: #86efac;
    background: #f0fdf4;
}
.endpoint-progress-card.failed {
    border-color: #fecaca;
    background: #fff1f2;
}
.endpoint-progress-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.endpoint-progress-title strong {
    line-height: 1.2;
}
.endpoint-progress-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    font-size: 13px;
    color: #334155;
    margin-bottom: 10px;
}
.endpoint-progress-message {
    font-size: 14px;
    line-height: 1.35;
}
.endpoint-path {
    margin-top: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #475569;
    word-break: break-all;
}
.badge.warn { background: #fef3c7; color: #92400e; }
.error-text { color: #b91c1c; font-weight: 700; }
.live-log {
    min-height: 80px;
    max-height: 340px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f8fafc;
    padding: 10px;
}
.log-line {
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}
.log-line:last-child { border-bottom: 0; }
.log-line span {
    display: inline-block;
    min-width: 78px;
    color: #64748b;
    font-weight: 700;
}
.log-line.ok { color: #166534; }
.log-line.warn { color: #92400e; }
.log-line.error { color: #991b1b; font-weight: 700; }

@media (max-width: 760px) {
    .live-head { flex-direction: column; }
    .live-counter { align-items: flex-start; }
    .endpoint-progress-meta { grid-template-columns: 1fr; }
}

.raw-preview { margin-top: 10px; }
.raw-preview summary { cursor: pointer; font-weight: 700; }
.raw-preview pre { white-space: pre-wrap; overflow: auto; max-height: 260px; background: #111827; color: #f9fafb; border-radius: 10px; padding: 12px; }

/* Fase 4 — dashboard web */
.dashboard-shell { max-width: 1280px; }
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.dash-card {
    background: #fff;
    border: 1px solid #dfe6e9;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 4px 18px rgba(20, 40, 60, .05);
}
.dash-card span {
    display: block;
    color: #64748b;
    font-weight: 700;
    margin-bottom: 8px;
}
.dash-card strong {
    display: block;
    font-size: 24px;
    line-height: 1.15;
}
.dash-card.success { border-left: 5px solid #16a34a; }
.dash-card.danger { border-left: 5px solid #dc2626; }
.dash-card.primary { border-left: 5px solid #1f6feb; }
.split-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    gap: 18px;
}
.mini-chart.empty {
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 20px;
}
.chart-grid {
    display: grid;
    gap: 10px;
}
.chart-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) 150px;
    gap: 12px;
    align-items: center;
}
.chart-label {
    font-weight: 800;
    color: #334155;
}
.chart-bars {
    display: grid;
    gap: 5px;
}
.chart-bar-line {
    height: 16px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}
.chart-bar {
    height: 100%;
    min-width: 2px;
    border-radius: 999px;
    transition: width .25s ease;
}
.chart-bar.in { background: #16a34a; }
.chart-bar.out { background: #dc2626; }
.chart-values {
    font-size: 12px;
    color: #475569;
}
.negative { color: #b91c1c; }
.positive { color: #166534; }
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-card { grid-template-columns: 1fr; }
    .chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}


/* Fase 5 — drill-down */
.dash-card.clickable { cursor: pointer; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.dash-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(20, 40, 60, .12); }
.dash-card small { display: block; margin-top: 8px; color: #64748b; font-weight: 700; }
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 11px 16px;
    background: #1f6feb;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}
.button-link.secondary { background: #546e7a; }
.drill-help-card { border-left: 5px solid #0f766e; }
.drill-kpi-grid { margin-top: 0; }
.row-action-btn {
    background: #0f766e;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12px;
}
.drill-row-highlight { background: #f8fafc; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 9999;
}
.modal-card {
    width: min(940px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 12px;
    margin-bottom: 14px;
}
.modal-head h2 { margin: 0; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.detail-item {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 10px;
    background: #f8fafc;
}
.detail-item span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 4px;
}
.detail-item strong {
    display: block;
    word-break: break-word;
}
@media (max-width: 720px) {
    .detail-grid { grid-template-columns: 1fr; }
}

/* Correção Fase 5.1: garante que o modal de detalhe não apareça sozinho ao abrir o drill-down. */
.modal-backdrop[hidden],
[hidden].modal-backdrop {
    display: none !important;
}
.modal-card {
    position: relative;
}
.modal-close-primary {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}
.modal-close-primary:hover {
    background: #334155;
}

/* Fase 6 — Exploração BI */
.bi-intro-card { border-left: 5px solid #7c3aed; }
.bi-chart.empty {
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 20px;
}
.bi-chart {
    display: grid;
    gap: 12px;
}
.bi-chart-row {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 160px;
    gap: 14px;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 0;
}
.bi-chart-label {
    font-weight: 800;
    color: #334155;
    word-break: break-word;
}
.bi-chart-bars {
    display: grid;
    gap: 7px;
}
.bi-bar-line {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: #64748b;
}
.bi-bar-line::after {
    content: '';
}
.bi-bar-line > div {
    height: 18px;
    min-width: 2px;
    border-radius: 999px;
    transition: width .25s ease;
}
.bi-bar.in { background: #16a34a; }
.bi-bar.out { background: #dc2626; }
.bi-chart-values {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}
.bi-chart-values small { color: #64748b; font-weight: 700; }
@media (max-width: 900px) {
    .bi-chart-row { grid-template-columns: 1fr; }
    .bi-chart-values { align-items: flex-start; }
}

/* Fase 6.1 — selects pesquisáveis */
.native-select-hidden {
    position: absolute !important;
    left: -99999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.searchable-select-shell {
    position: relative;
    width: 100%;
}
.searchable-select-input {
    padding-right: 38px;
    background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}
.searchable-select-shell.open .searchable-select-input {
    border-color: #1f6feb;
    box-shadow: 0 0 0 3px rgba(31, 111, 235, .12);
}
.searchable-select-dropdown {
    position: absolute;
    z-index: 50;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow: auto;
    background: #fff;
    border: 1px solid #cfd8dc;
    border-radius: 12px;
    box-shadow: 0 16px 42px rgba(15, 23, 42, .16);
    padding: 6px;
}
.searchable-select-option {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
    color: #17202a;
    text-align: left;
    padding: 9px 10px;
    border-radius: 9px;
    font-weight: 600;
    cursor: pointer;
}
.searchable-select-option:hover,
.searchable-select-option.selected {
    background: #eaf2ff;
    color: #0f3f8c;
}
.searchable-select-option.empty {
    color: #64748b;
    cursor: default;
    font-weight: 500;
}
.searchable-select-option.empty:hover {
    background: #fff;
    color: #64748b;
}

/* Fase 6.4 — busca visível para selects nativos */
.select-search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.select-search-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
    color: #17202a;
}
.select-search-input:focus {
    outline: none;
    border-color: #1f6feb;
    box-shadow: 0 0 0 3px rgba(31, 111, 235, .12);
}
.native-filtered-select {
    width: 100%;
}

/* Fase 7 — auditoria e qualidade */
.dash-card.warn { border-left: 5px solid #f59e0b; }
.audit-kpi-grid .dash-card small { line-height: 1.35; }
.quality-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.quality-item {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 14px;
    background: #f8fafc;
}
.quality-item strong {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
}
.quality-item p {
    margin: 8px 0 0;
    color: #475569;
    line-height: 1.35;
}
.quality-item.ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.quality-item.warn {
    background: #fff7ed;
    border-color: #fed7aa;
}
.quality-item.error {
    background: #fff1f2;
    border-color: #fecdd3;
}
.audit-intro-card { border-left: 5px solid #0f766e; }

/* Fase 8 — visões salvas */
.section-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.saved-search-box input {
    min-width: 260px;
}
.saved-views-list {
    display: grid;
    gap: 14px;
}
.saved-view-card {
    border: 1px solid #dde5f0;
    border-radius: 16px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}
.saved-view-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
}
.saved-view-card h3 {
    margin: 0 0 6px;
}
.saved-view-kpis {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.saved-view-kpis span {
    min-width: 125px;
    border: 1px solid #e6edf5;
    background: #f8fafc;
    border-radius: 14px;
    padding: 10px;
}
.saved-view-kpis small {
    display: block;
    color: #64748b;
    font-size: 12px;
}
.saved-view-kpis strong {
    display: block;
    margin-top: 4px;
    font-size: 14px;
}
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
}
.pill.strong {
    font-weight: 700;
    background: #dbeafe;
}
.wrap-actions {
    flex-wrap: wrap;
}
.saved-view-actions {
    margin-top: 14px;
}
.danger-button {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border-color: #fecaca !important;
}
.import-label input {
    margin-top: 8px;
}
.compact-list {
    margin: 0;
    padding-left: 18px;
    color: #475569;
}
.compact-list li {
    margin: 5px 0;
}
.saved-view-card details {
    margin-top: 12px;
}
.saved-view-card summary {
    cursor: pointer;
    color: #1d4ed8;
    font-weight: 600;
}
.saved-view-card pre {
    max-height: 260px;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 12px;
}
button[disabled] {
    opacity: .55;
    cursor: not-allowed;
}
@media (max-width: 900px) {
    .saved-view-main {
        grid-template-columns: 1fr;
    }
    .saved-view-kpis {
        justify-content: flex-start;
    }
}

/* Fase 9 — Relatórios gerenciais */
.reports-shell .report-preview {
    background: #fff;
}
.empty-report-state {
    text-align: center;
    padding: 48px 16px;
    color: #667085;
}
.saved-view-picker {
    margin-top: 16px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    padding: 12px;
    background: #f9fafb;
}
.saved-view-picker.hidden { display: none; }
.saved-view-picker h3 { margin: 0 0 10px; }
.saved-view-pick {
    width: 100%;
    text-align: left;
    border: 1px solid #e4e7ec;
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    margin: 8px 0;
    cursor: pointer;
    display: grid;
    gap: 4px;
}
.saved-view-pick:hover { border-color: #98a2b3; background: #fefefe; }
.saved-view-pick:disabled { opacity: .5; cursor: not-allowed; }
.saved-view-pick span,
.saved-view-pick small { color: #667085; }
.checklist-fieldset {
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 14px;
}
.checklist-fieldset legend {
    padding: 0 8px;
    color: #344054;
    font-weight: 700;
}
.checklist-fieldset label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 500;
}
.print-report {
    color: #101828;
    background: #fff;
}
.report-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid #101828;
    padding-bottom: 18px;
    margin-bottom: 22px;
}
.report-header h1 {
    margin: 0 0 6px;
    font-size: 28px;
}
.report-header p { margin: 0; color: #475467; }
.report-meta {
    text-align: right;
    color: #475467;
    min-width: 220px;
    font-size: 13px;
}
.report-section {
    margin: 24px 0;
}
.report-section h2 {
    font-size: 20px;
    margin: 0 0 14px;
}
.report-section h3 {
    font-size: 16px;
    margin: 0 0 10px;
}
.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}
.report-kpi-grid div {
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    padding: 14px;
    background: #fcfcfd;
}
.report-kpi-grid span {
    display: block;
    color: #667085;
    font-size: 12px;
    margin-bottom: 6px;
}
.report-kpi-grid strong {
    font-size: 20px;
}
.report-note {
    background: #f9fafb;
    border-left: 4px solid #667085;
    padding: 12px;
    border-radius: 8px;
}
.report-chart-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475467;
    margin-bottom: 10px;
}
.report-chart-legend .legend {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}
.report-chart-legend .entrada { background: #12b76a; }
.report-chart-legend .saida { background: #f04438; }
.report-chart-bars {
    display: grid;
    gap: 8px;
}
.report-bar-row {
    display: grid;
    grid-template-columns: minmax(100px, 180px) minmax(120px, 1fr) 120px minmax(120px, 1fr) 120px;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.report-bar-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.report-bar-track {
    height: 12px;
    background: #f2f4f7;
    border-radius: 999px;
    overflow: hidden;
}
.report-bar {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 999px;
}
.report-bar.entrada { background: #12b76a; }
.report-bar.saida { background: #f04438; }
.report-bar-value {
    text-align: right;
    color: #475467;
}
.report-ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.report-footer {
    margin-top: 28px;
    padding-top: 12px;
    border-top: 1px solid #e4e7ec;
    color: #667085;
    font-size: 12px;
}
.page-break-before { break-before: page; }

@media (max-width: 860px) {
    .report-header { flex-direction: column; }
    .report-meta { text-align: left; }
    .report-bar-row {
        grid-template-columns: 1fr;
        border-bottom: 1px solid #e4e7ec;
        padding-bottom: 8px;
    }
    .report-bar-value { text-align: left; }
}

@media print {
    body { background: #fff !important; }
    .no-print,
    .topbar nav,
    .topbar,
    #reportRawResult,
    .reports-shell > section.card:not(.report-preview) {
        display: none !important;
    }
    .shell,
    .dashboard-shell {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .card,
    .report-preview {
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .print-report {
        font-size: 12px;
    }
    .report-header h1 { font-size: 24px; }
    .report-kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .report-ranking-grid { grid-template-columns: 1fr; }
    table { font-size: 10px; }
    th, td { padding: 4px 5px !important; }
    .page-break-before { page-break-before: always; }
}

/* Fase 10 — Simulações e cenários */
.scenario-shell .section-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.scenario-impact-box {
    margin: 1rem 0;
}
.scenario-impact {
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, .35);
    background: rgba(15, 23, 42, .03);
}
.scenario-impact.ok {
    border-color: rgba(22, 163, 74, .35);
    background: rgba(22, 163, 74, .08);
}
.scenario-impact.error {
    border-color: rgba(220, 38, 38, .35);
    background: rgba(220, 38, 38, .08);
}
.scenario-impact h3 {
    margin: 0 0 .65rem;
}
.scenario-impact div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .2rem 0;
}
.saved-scenarios-box {
    margin-top: 1rem;
    display: grid;
    gap: .75rem;
}
.scenario-saved-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}
.small {
    font-size: .82rem;
    padding: .35rem .55rem;
}

/* Fase 11 — Administração */
.endpoint-card {
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 16px;
    padding: 1rem;
    background: rgba(255, 255, 255, .75);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}
.endpoint-card h3 { margin: 0 0 .5rem; }
.endpoint-card p { margin: .25rem 0; }
.endpoint-card small { color: #64748b; word-break: break-all; }
.endpoint-card.ok { border-color: rgba(22, 163, 74, .35); background: rgba(22, 163, 74, .07); }
.endpoint-card.warn { border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .08); }
.endpoint-card.error { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .07); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.alert { margin-top: 1rem; padding: .85rem 1rem; border-radius: 14px; border: 1px solid rgba(148, 163, 184, .35); }
.alert.good { border-color: rgba(22, 163, 74, .35); background: rgba(22, 163, 74, .08); }
.alert.warn { border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .08); }
.alert.bad { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .08); }
.checklist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.compact-checks { max-height: 360px; overflow: auto; padding-right: .25rem; }
button.danger { background: #b91c1c; color: #fff; }
button.danger:hover { background: #991b1b; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

/* Fase 12 — banco e multiusuário */
.small-btn {
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
}
hr {
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 18px 0;
}

/* Fase 13 — matriz de permissões */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}
.permission-area {
    border: 1px solid #d8dee9;
    border-radius: 12px;
    padding: 12px;
    background: #fbfcff;
}
.permission-area h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}
.permission-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    align-items: start;
    padding: 8px 0;
    border-top: 1px solid #eef1f6;
}
.permission-item:first-of-type { border-top: 0; }
.permission-item small,
.permission-item code {
    display: block;
    color: #617084;
    margin-top: 3px;
}
.button-link {
    display: inline-block;
    border: 1px solid #2563eb;
    background: #2563eb;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
}
.button-link.secondary {
    background: #fff;
    color: #2563eb;
}

/* Fase 14 — performance/cache */
.row-warn { background: rgba(245, 158, 11, .08); }
button.danger, .button-link.danger {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
button.danger:hover, .button-link.danger:hover { filter: brightness(.96); }
.inline-check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.inline-check input { width: auto; }


/* Fase 15 — Homologação */
.checklist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 16px; }
.checklist-item { border: 1px solid var(--border, #d8dee8); border-radius: 14px; padding: 12px; background: #fff; display: flex; gap: 10px; align-items: flex-start; }
.checklist-item input { margin-top: 4px; }
.checklist-item strong { display: block; margin-bottom: 4px; }
.checklist-item small { color: var(--muted, #667085); line-height: 1.35; display: block; }
.steps-list li { margin: 8px 0; line-height: 1.45; }
@media print {
  nav, .actions, button { display: none !important; }
  .shell { max-width: none; margin: 0; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}

/* Fase 16 — Fluxo Matricial */
.wide-shell { max-width: 1540px; }
.matrix-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}
.matrix-hero .actions { flex-wrap: wrap; justify-content: flex-end; }
.matrix-filter-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.matrix-metrics { margin-bottom: 18px; }
.matrix-metrics .metric:nth-child(1) { background: #eef6ff; }
.matrix-metrics .metric:nth-child(2) { background: #ecfdf3; }
.matrix-metrics .metric:nth-child(3) { background: #fff1f2; }
.matrix-metrics .metric:nth-child(4) { background: #f8fafc; }
.matrix-table-wrap {
    width: 100%;
    max-height: 70vh;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
}
.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1080px;
    width: max-content;
    font-variant-numeric: tabular-nums;
}
.matrix-table th,
.matrix-table td {
    white-space: nowrap;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #edf2f7;
}
.matrix-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #0f172a;
    color: #fff;
    text-align: right;
}
.matrix-table thead th:first-child {
    left: 0;
    z-index: 6;
    text-align: left;
    min-width: 360px;
}
.matrix-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 3;
    background: inherit;
    min-width: 360px;
    max-width: 520px;
    white-space: normal;
}
.matrix-table .row-level-0 td { background: #e8f1ff; font-weight: 900; }
.matrix-table .row-level-1 td { background: #f8fafc; font-weight: 800; }
.matrix-table .row-level-2 td { background: #fff; }
.matrix-table .row-total td { background: #0f172a; color: #fff; font-weight: 900; }
.matrix-table .row-total .sticky-col { background: #0f172a; color: #fff; }
.matrix-table .row-balance td { background: #fef3c7; font-weight: 900; }
.matrix-table .amount { text-align: right; cursor: pointer; }
.matrix-table .amount:hover { background: #dbeafe; }
.matrix-table .amount.entrada { color: #166534; }
.matrix-table .amount.saida { color: #991b1b; }
.matrix-table .amount.negative { color: #b91c1c; font-weight: 900; }
.matrix-table .total-col { font-weight: 900; background: #f8fafc; }
.matrix-table .toggle-row {
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0 6px 0 0;
    font-weight: 900;
    cursor: pointer;
}
.matrix-table .indent-0 { padding-left: 12px; }
.matrix-table .indent-1 { padding-left: 32px; }
.matrix-table .indent-2 { padding-left: 54px; }
.matrix-table .small-line { display: block; color: #64748b; font-size: 12px; font-weight: 600; margin-top: 2px; }
.row-total .small-line { color: #cbd5e1; }
.matrix-legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 999px; margin-right: -4px; }
.legend-dot.entrada { background: #16a34a; }
.legend-dot.saida { background: #dc2626; }
.legend-dot.total { background: #0f172a; }
.matrix-detail-card { border-left: 5px solid #1f6feb; }
.matrix-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.matrix-detail-summary div {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
    background: #f8fafc;
}
.matrix-empty { padding: 18px; color: #64748b; }
@media (max-width: 980px) {
    .matrix-hero { flex-direction: column; }
    .matrix-filter-form { grid-template-columns: 1fr; }
    .matrix-detail-summary { grid-template-columns: 1fr; }
}
@media print {
    body { background: #fff; }
    .topbar nav, .matrix-filter-form, .matrix-hero .actions, #closeMatrixDetailBtn { display: none !important; }
    .shell, .wide-shell { max-width: none; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
    .matrix-table-wrap { max-height: none; overflow: visible; }
    .matrix-table { font-size: 10px; min-width: 0; width: 100%; }
    .matrix-table .sticky-col, .matrix-table thead th:first-child { position: static; min-width: 220px; }
}

/* Fase 16.1 — UI executiva da matriz */
.matrix-exec-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    background: linear-gradient(135deg, #f8fafc 0%, #eef6ff 100%);
    border: 1px solid #dbeafe;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 900;
    font-size: 12px;
    color: #1f6feb;
    margin-bottom: 4px;
}
.matrix-context {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(255,255,255,.78);
    border: 1px solid #dbeafe;
    border-radius: 999px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}
.matrix-head-actions { display: grid; gap: 10px; justify-items: end; }
.segmented {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}
.segmented button {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    background: transparent;
    color: #334155;
    font-weight: 900;
    cursor: pointer;
}
.segmented button.active { background: #0f172a; color: #fff; }
.matrix-executive-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
}
.matrix-executive-metrics .metric { min-height: 114px; }
.matrix-executive-metrics .metric strong { font-size: clamp(18px, 1.8vw, 26px); }
.matrix-executive-metrics .metric small {
    display: block;
    margin-top: 6px;
    color: #64748b;
    font-weight: 700;
}
.matrix-executive-metrics .metric:nth-child(4) { background: #f8fafc; }
.matrix-executive-metrics .metric:nth-child(5) { background: #eef6ff; }
.matrix-executive-metrics .metric:nth-child(6) { background: #fffbeb; }
.metric.metric-danger { background: #fff1f2 !important; border-color: #fecdd3; }
.metric.metric-danger strong { color: #b91c1c; }
.metric.metric-ok strong { color: #166534; }
.metric.metric-warn strong { color: #92400e; }
.matrix-alert-card { border-left: 5px solid #f59e0b; }
.matrix-alert-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}
.matrix-alert {
    border-radius: 14px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
}
.matrix-alert strong { display: block; margin-bottom: 4px; color: #0f172a; }
.matrix-alert span { color: #475569; font-size: 13px; }
.matrix-alert.critical { background: #fff1f2; border-color: #fecdd3; }
.matrix-alert.critical strong { color: #b91c1c; }
.matrix-alert.warn { background: #fffbeb; border-color: #fde68a; }
.matrix-alert.warn strong { color: #92400e; }
.matrix-alert.info { background: #eff6ff; border-color: #bfdbfe; }
.matrix-alert.ok { background: #ecfdf3; border-color: #bbf7d0; }
.quick-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.quick-pills button {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 8px 11px;
    font-weight: 900;
    cursor: pointer;
}
.quick-pills button:hover { background: #eff6ff; border-color: #93c5fd; }
.matrix-filter-form-v2 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.matrix-advanced-filters {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 0;
    background: #f8fafc;
}
.matrix-advanced-filters summary {
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 900;
    color: #0f172a;
}
.matrix-advanced-filters[open] summary { border-bottom: 1px solid #e5e7eb; }
.matrix-advanced-filters .nested-grid { padding: 14px; }
.check-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    font-weight: 800;
}
.check-row input { width: auto; }
.matrix-toolbar-actions { align-items: center; }
.matrix-mini-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 14px;
}
.matrix-mini-charts h3 { margin: 0 0 8px; font-size: 15px; }
.matrix-bar-chart { display: grid; gap: 8px; }
.bar-row {
    display: grid;
    grid-template-columns: 90px minmax(140px, 1fr) 150px;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    font-weight: 800;
}
.bar-row > div {
    height: 13px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}
.bar-row i { display: block; height: 100%; border-radius: 999px; }
.bar-row i.entrada { background: #16a34a; }
.bar-row i.saida { background: #dc2626; }
.trend-points {
    height: 100px;
    display: flex;
    align-items: end;
    gap: 3px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.trend-points span {
    display: block;
    min-width: 6px;
    flex: 1;
    max-width: 18px;
    background: #1f6feb;
    border-radius: 6px 6px 0 0;
}
.trend-points span.negative { background: #dc2626; }
.matrix-table-wrap-v2 { max-height: 72vh; }
.matrix-table-v2 th, .matrix-table-v2 td { padding: 9px 10px; }
.matrix-table-v2 thead th { box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.matrix-table-v2 .sticky-col {
    min-width: 430px;
    max-width: 560px;
    overflow: hidden;
}
.matrix-table-v2 .matrix-label-text {
    display: inline-block;
    max-width: 390px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}
.matrix-table-v2 .row-level-0 td { background: #e0ecff; font-weight: 950; }
.matrix-table-v2 .row-level-1 td { background: #f1f5f9; font-weight: 900; }
.matrix-table-v2 .row-level-2 td { background: #fff; }
.matrix-table-v2 .row-level-3 td { background: #ffffff; font-size: 13px; }
.matrix-table-v2 .row-negative .sticky-col { border-left: 4px solid #ef4444; }
.matrix-table-v2 .toggle-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    margin-right: 4px;
}
.matrix-table-v2 .toggle-row:hover { background: rgba(31,111,235,.12); }
.matrix-table-v2 .toggle-row.spacer { width: 24px; }
.matrix-table-v2 .total-col, .matrix-table-v2 .total-sticky {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #f8fafc;
    box-shadow: -1px 0 0 #e5e7eb;
    font-weight: 950;
}
.matrix-table-v2 thead .total-sticky { z-index: 5; background: #0f172a; color: #fff; }
.matrix-table-v2 .row-total .total-sticky { background: #0f172a; color: #fff; }
.matrix-table-v2 .row-balance .total-sticky { background: #fef3c7; }
.legend-dot.warning { background: #f59e0b; }
.matrix-side-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.35);
    z-index: 80;
}
.matrix-side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(720px, 96vw);
    height: 100vh;
    background: #fff;
    z-index: 90;
    transform: translateX(105%);
    transition: transform .22s ease;
    box-shadow: -16px 0 40px rgba(15,23,42,.18);
    border-left: 1px solid #e5e7eb;
}
.matrix-side-panel.open { transform: translateX(0); }
.matrix-side-panel-inner {
    height: 100%;
    overflow: auto;
    padding: 18px;
}
.matrix-side-panel .table-wrap { max-height: none; }
.matrix-detail-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.matrix-detail-summary span {
    display: block;
    color: #64748b;
    margin-top: 4px;
    font-size: 12px;
}
@media (max-width: 1180px) {
    .matrix-exec-head { grid-template-columns: 1fr; }
    .matrix-head-actions { justify-items: start; }
    .matrix-executive-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .matrix-mini-charts { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .matrix-executive-metrics { grid-template-columns: 1fr; }
    .matrix-filter-form-v2 { grid-template-columns: 1fr; }
    .matrix-advanced-filters.span-4, .matrix-toolbar-actions.span-4 { grid-column: auto; }
    .bar-row { grid-template-columns: 80px 1fr; }
    .bar-row b { grid-column: 2; }
}
@media print {
    .matrix-exec-head .actions, .segmented, .matrix-filter-card, .matrix-alert-card .secondary, .matrix-side-panel, .matrix-side-backdrop { display: none !important; }
    .matrix-mini-charts { display: none !important; }
}

/* Fase 16.2 — transparência de limite e paginação */
.mini-status { margin-top: 6px; padding: 6px 8px; border-radius: 10px; font-size: 12px; }
.matrix-source-card { border-left: 4px solid #64748b; }
.source-coverage-summary { padding: 10px 12px; border-radius: 12px; background: #f8fafc; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.warn-card-lite { background: #fff7ed; border: 1px solid #fed7aa; }
.source-coverage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.source-coverage-card { border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: #fff; }
.source-coverage-card.ok { border-left: 4px solid #16a34a; }
.source-coverage-card.warn { border-left: 4px solid #f59e0b; background: #fffbeb; }
.source-coverage-card.error { border-left: 4px solid #dc2626; background: #fef2f2; }
.source-coverage-card span, .source-coverage-card small { color: #475569; font-size: 12px; }
.grid-form label small.muted { display: block; margin-top: 4px; font-weight: 400; }

/* Fase 17 — refinamento UX/UI desktop */
:root {
    --ux-bg: #f5f7fb;
    --ux-card: #ffffff;
    --ux-border: #d9e2ec;
    --ux-text: #17202a;
    --ux-muted: #64748b;
    --ux-primary: #1f6feb;
    --ux-primary-dark: #174ea6;
    --ux-success: #15803d;
    --ux-danger: #b42318;
    --ux-warning: #b7791f;
    --ux-soft-blue: #eef6ff;
    --ux-soft-green: #ecfdf3;
    --ux-soft-red: #fff1f2;
    --ux-shadow: 0 12px 32px rgba(15, 23, 42, .08);
}
body.ux-desktop-app {
    background: radial-gradient(circle at top left, #eef6ff 0, #f5f7fb 32%, #f7f9fc 100%);
    color: var(--ux-text);
    font-size: 15px;
}
.ux-desktop-app .shell {
    max-width: 1440px;
    padding: 22px 28px 38px;
}
.ux-desktop-app .wide-shell { max-width: 1680px; }
.ux-desktop-app .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(10px);
    border: 1px solid var(--ux-border);
    box-shadow: var(--ux-shadow);
    border-radius: 22px;
    padding: 18px 18px 16px;
    align-items: stretch;
}
.ux-desktop-app .topbar h1 {
    font-size: 24px;
    letter-spacing: -.02em;
}
.ux-desktop-app .topbar p { max-width: 560px; line-height: 1.35; }
.ux-nav {
    max-width: 860px;
    align-items: center;
    gap: 7px;
}
.ux-nav-label {
    font-size: 11px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 0 4px 0 10px;
    align-self: center;
}
.ux-nav a {
    padding: 8px 11px;
    border-radius: 999px;
    font-weight: 750;
    font-size: 13px;
    background: #f8fafc;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.ux-nav a:hover { transform: translateY(-1px); border-color: #b6c6d6; background: #fff; }
.ux-nav a.active {
    background: linear-gradient(135deg, var(--ux-primary), #0f766e);
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(31, 111, 235, .22);
}
.ux-context-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin: -4px 0 18px;
    padding: 14px 18px;
    border: 1px solid #dbeafe;
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.ux-context-main { display: flex; flex-direction: column; gap: 3px; }
.ux-context-main strong { font-size: 18px; }
.ux-context-main span:last-child { color: var(--ux-muted); }
.ux-kicker {
    color: var(--ux-primary) !important;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 11px;
}
.ux-context-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ux-chip {
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    background: var(--ux-soft-blue);
    color: #1e3a8a;
    font-weight: 800;
    font-size: 12px;
    white-space: nowrap;
}
.ux-chip-soft { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
.ux-desktop-app .card {
    border-color: var(--ux-border);
    box-shadow: var(--ux-shadow);
    border-radius: 22px;
}
.ux-desktop-app .card h2 {
    letter-spacing: -.01em;
    margin-bottom: 6px;
}
.ux-desktop-app .muted { color: var(--ux-muted); line-height: 1.45; }
.ux-desktop-app button,
.ux-desktop-app .button,
.ux-desktop-app .button-link {
    min-height: 40px;
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(31, 111, 235, .12);
}
.ux-desktop-app button.secondary,
.ux-desktop-app .button.secondary,
.ux-desktop-app .button-link.secondary {
    background: #475569;
    box-shadow: none;
}
.ux-danger-action { background: #991b1b !important; }
.ux-export-action { background: #0f766e !important; }
.ux-primary-action { background: var(--ux-primary-dark) !important; }
.ux-desktop-app input,
.ux-desktop-app select,
.ux-desktop-app textarea {
    min-height: 41px;
    border-color: #cbd5e1;
    background: #fff;
}
.ux-desktop-app input:focus,
.ux-desktop-app select:focus,
.ux-desktop-app textarea:focus,
.ux-desktop-app button:focus,
.ux-desktop-app a:focus {
    outline: 3px solid rgba(31, 111, 235, .22);
    outline-offset: 2px;
}
.ux-report-principle,
.ux-matrix-guide {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    padding: 13px 16px;
    border-radius: 18px;
    margin-bottom: 16px;
}
.ux-matrix-guide {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
}
.ux-matrix-guide div {
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 14px;
    padding: 12px;
}
.ux-matrix-guide strong { display: block; margin-bottom: 4px; color: #0f172a; }
.ux-matrix-guide span { color: #475569; }
.ux-section-tag {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}
.ux-data-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    color: #334155;
    white-space: nowrap;
}
.ux-data-table td,
.ux-data-table th {
    padding: 10px 11px;
    border-bottom: 1px solid #edf2f7;
}
.ux-data-table tbody tr:hover { background: #f8fbff; }
.ux-data-table .ux-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ux-data-table .ux-negative { color: var(--ux-danger); font-weight: 800; }
.ux-data-table .ux-zero { color: #94a3b8; }
.ux-desktop-app .summary-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ux-desktop-app .metric {
    background: linear-gradient(180deg, #fff, #f8fafc);
    border-color: #e2e8f0;
    min-height: 112px;
}
.ux-desktop-app .metric strong {
    font-size: 24px;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.ux-matrix-page .matrix-exec-head {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
    gap: 20px;
    align-items: start;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 55%, #f0fdf4 100%);
}
.ux-matrix-page .matrix-filter-card .quick-pills button {
    background: #eef6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
    box-shadow: none;
}
.ux-matrix-page .matrix-filter-card .quick-pills button:hover { background: #dbeafe; }
.ux-matrix-page details.matrix-advanced-filters {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 14px;
    background: #fbfdff;
}
.ux-matrix-page details.matrix-advanced-filters summary {
    cursor: pointer;
    color: var(--ux-primary-dark);
    font-weight: 900;
}
.ux-matrix-page .matrix-table-wrap {
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
    max-height: 68vh;
}
.ux-matrix-page .matrix-table-wrap table { font-size: 13px; }
.ux-matrix-page .matrix-table-wrap th,
.ux-matrix-page .matrix-table-wrap td {
    padding: 9px 10px;
}
.ux-matrix-page .matrix-side-panel-inner {
    box-shadow: -18px 0 44px rgba(15,23,42,.14);
}
.ux-matrix-page .matrix-source-card {
    border-style: dashed;
    background: #fffdf8;
}
.ux-desktop-app pre {
    border: 1px solid #1e293b;
    font-size: 12px;
}
@media (min-width: 1100px) {
    .ux-desktop-app .grid-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ux-desktop-app .grid-form .span-2 { grid-column: span 2; }
    .ux-desktop-app .grid-form .span-4 { grid-column: span 4; }
}
@media (max-width: 1100px) {
    .ux-context-bar { flex-direction: column; align-items: flex-start; }
    .ux-context-chips { justify-content: flex-start; }
    .ux-matrix-page .matrix-exec-head { grid-template-columns: 1fr; }
    .ux-matrix-guide { grid-template-columns: 1fr; }
}


/* Fase 17.2 — Visual corporativo inspirado em SAP/Fiori (desktop)
   Objetivo: aproximar o produto de um padrão empresarial: shell bar clara,
   navegação por áreas, cards compactos, tabelas densas e foco em produtividade.
   Não utiliza assets, marcas ou componentes SAP; é apenas uma referência de UX corporativa. */
:root {
    --sap-bg: #f5f6f7;
    --sap-surface: #ffffff;
    --sap-surface-2: #f7f8f9;
    --sap-shell: #354a5f;
    --sap-shell-2: #2b3f52;
    --sap-primary: #0a6ed1;
    --sap-primary-hover: #0854a0;
    --sap-border: #d5dadd;
    --sap-border-strong: #b8c1c7;
    --sap-text: #223548;
    --sap-muted: #6a7d8f;
    --sap-success: #107e3e;
    --sap-danger: #bb0000;
    --sap-warning: #e9730c;
    --sap-information: #0a6ed1;
    --sap-focus: #0a6ed1;
    --sap-shadow: 0 1px 2px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
    --sap-radius: 8px;
}
body.sap-inspired-app,
body.ux-desktop-app.sap-inspired-app {
    background: var(--sap-bg) !important;
    color: var(--sap-text) !important;
    font-size: 14px;
    line-height: 1.42;
}
.sap-inspired-app .shell,
.sap-inspired-app .wide-shell {
    max-width: 1600px;
    padding: 0 24px 32px !important;
}
.sap-inspired-app .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    margin: 0 -24px 16px;
    padding: 0 24px;
    min-height: 56px;
    display: grid;
    grid-template-columns: minmax(260px, 390px) 1fr;
    align-items: stretch;
    gap: 0;
    border-radius: 0 !important;
    border: 0 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.16) !important;
    background: var(--sap-shell) !important;
    color: #fff;
    backdrop-filter: none !important;
}
.sap-inspired-app .topbar > div:first-child {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 18px 8px 0;
    min-width: 0;
}
.sap-inspired-app .topbar h1 {
    margin: 0 !important;
    color: #fff;
    font-size: 18px !important;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sap-inspired-app .topbar p {
    color: #dce7ef !important;
    font-size: 12px;
    margin-top: 2px !important;
    max-width: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sap-inspired-app nav.ux-nav,
.sap-inspired-app .topbar nav {
    max-width: none !important;
    display: flex;
    align-items: center;
    align-content: center;
    gap: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 0 4px;
    scrollbar-width: thin;
}
.sap-inspired-app .ux-nav-label {
    height: 56px;
    display: inline-flex;
    align-items: center;
    padding: 0 10px 0 18px !important;
    color: #b9c8d4 !important;
    font-size: 10px !important;
    letter-spacing: .08em;
    border-left: 1px solid rgba(255,255,255,.12);
}
.sap-inspired-app .ux-nav a,
.sap-inspired-app nav a {
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #edf5fb !important;
    font-size: 13px;
    font-weight: 600;
    box-shadow: none !important;
    position: relative;
    white-space: nowrap;
}
.sap-inspired-app .ux-nav a:hover,
.sap-inspired-app nav a:hover {
    transform: none !important;
    background: rgba(255,255,255,.09) !important;
}
.sap-inspired-app .ux-nav a.active,
.sap-inspired-app nav a.active {
    background: rgba(255,255,255,.14) !important;
    color: #fff !important;
    box-shadow: none !important;
}
.sap-inspired-app .ux-nav a.active::after,
.sap-inspired-app nav a.active::after {
    content: '';
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #91c8f6;
}
.sap-inspired-app .ux-context-bar {
    margin: 0 0 16px !important;
    padding: 14px 18px !important;
    border-radius: 0 0 var(--sap-radius) var(--sap-radius) !important;
    border: 1px solid var(--sap-border) !important;
    border-top: 0 !important;
    background: var(--sap-surface) !important;
    box-shadow: var(--sap-shadow) !important;
}
.sap-inspired-app .ux-context-main strong {
    color: var(--sap-text);
    font-size: 20px !important;
    font-weight: 700;
}
.sap-inspired-app .ux-kicker {
    color: var(--sap-muted) !important;
    letter-spacing: .04em !important;
}
.sap-inspired-app .ux-chip {
    border-radius: 4px !important;
    background: #eef4fb !important;
    border-color: #c6d5e4 !important;
    color: #174a7c !important;
    padding: 5px 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}
.sap-inspired-app .card {
    border: 1px solid var(--sap-border) !important;
    border-radius: var(--sap-radius) !important;
    background: var(--sap-surface) !important;
    box-shadow: var(--sap-shadow) !important;
    padding: 16px !important;
    margin-bottom: 14px !important;
}
.sap-inspired-app .card h2 {
    margin: 0 0 6px !important;
    color: var(--sap-text);
    font-size: 18px;
    font-weight: 700;
}
.sap-inspired-app .card h3 {
    color: var(--sap-text);
    font-size: 15px;
    font-weight: 700;
}
.sap-inspired-app .muted,
.sap-inspired-app p.muted {
    color: var(--sap-muted) !important;
    font-size: 13px;
}
.sap-inspired-app .grid-form,
.sap-inspired-app .matrix-filter-form,
.sap-inspired-app .matrix-filter-form-v2 {
    gap: 12px !important;
}
.sap-inspired-app label {
    gap: 5px;
    color: var(--sap-text);
    font-size: 13px;
    font-weight: 700;
}
.sap-inspired-app input,
.sap-inspired-app select,
.sap-inspired-app textarea,
.sap-inspired-app .select-search-input {
    min-height: 36px !important;
    border-radius: 4px !important;
    border: 1px solid var(--sap-border-strong) !important;
    background: #fff !important;
    color: var(--sap-text) !important;
    padding: 7px 9px !important;
    box-shadow: inset 0 0 0 1px transparent;
}
.sap-inspired-app input:hover,
.sap-inspired-app select:hover,
.sap-inspired-app textarea:hover {
    border-color: #899ba8 !important;
}
.sap-inspired-app input:focus,
.sap-inspired-app select:focus,
.sap-inspired-app textarea:focus,
.sap-inspired-app button:focus,
.sap-inspired-app a:focus {
    outline: 2px solid var(--sap-focus) !important;
    outline-offset: 1px !important;
    box-shadow: none !important;
}
.sap-inspired-app button,
.sap-inspired-app .button-link,
.sap-inspired-app .row-action-btn {
    min-height: 34px !important;
    border-radius: 4px !important;
    padding: 7px 13px !important;
    background: var(--sap-primary) !important;
    color: #fff !important;
    font-weight: 700 !important;
    border: 1px solid var(--sap-primary) !important;
    box-shadow: none !important;
}
.sap-inspired-app button:hover,
.sap-inspired-app .button-link:hover {
    background: var(--sap-primary-hover) !important;
    border-color: var(--sap-primary-hover) !important;
}
.sap-inspired-app button.secondary,
.sap-inspired-app .button-link.secondary,
.sap-inspired-app .secondary {
    background: #fff !important;
    color: var(--sap-primary) !important;
    border-color: #8ab4df !important;
}
.sap-inspired-app button.secondary:hover,
.sap-inspired-app .button-link.secondary:hover {
    background: #f3f8fc !important;
    color: var(--sap-primary-hover) !important;
}
.sap-inspired-app button.danger,
.sap-inspired-app .danger-button,
.sap-inspired-app .ux-danger-action {
    background: var(--sap-danger) !important;
    border-color: var(--sap-danger) !important;
    color: #fff !important;
}
.sap-inspired-app .ux-export-action {
    background: var(--sap-success) !important;
    border-color: var(--sap-success) !important;
    color: #fff !important;
}
.sap-inspired-app .status {
    border-radius: 4px !important;
    border: 1px solid var(--sap-border) !important;
    padding: 10px 12px !important;
}
.sap-inspired-app .status.ok { background: #f1fdf6 !important; color: var(--sap-success) !important; border-color: #a6e3be !important; }
.sap-inspired-app .status.warn,
.sap-inspired-app .warn-card { background: #fff8ee !important; color: #8a4b00 !important; border-color: #f5c58a !important; }
.sap-inspired-app .status.error { background: #fff1f1 !important; color: var(--sap-danger) !important; border-color: #f2b3b3 !important; }
.sap-inspired-app .summary-grid,
.sap-inspired-app .dashboard-grid,
.sap-inspired-app .matrix-executive-metrics {
    gap: 10px !important;
}
.sap-inspired-app .metric,
.sap-inspired-app .dash-card,
.sap-inspired-app .report-kpi-grid div {
    border-radius: var(--sap-radius) !important;
    border: 1px solid var(--sap-border) !important;
    box-shadow: none !important;
    background: var(--sap-surface) !important;
    padding: 13px 14px !important;
    min-height: 88px;
    position: relative;
}
.sap-inspired-app .metric::before,
.sap-inspired-app .dash-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #d1e7ff;
    border-radius: var(--sap-radius) var(--sap-radius) 0 0;
}
.sap-inspired-app .metric span,
.sap-inspired-app .dash-card span,
.sap-inspired-app .report-kpi-grid span {
    color: var(--sap-muted) !important;
    font-size: 12px;
    font-weight: 700;
}
.sap-inspired-app .metric strong,
.sap-inspired-app .dash-card strong,
.sap-inspired-app .report-kpi-grid strong {
    color: var(--sap-text);
    font-size: 22px !important;
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.sap-inspired-app .dash-card.success::before,
.sap-inspired-app .metric.metric-ok::before { background: var(--sap-success); }
.sap-inspired-app .dash-card.danger::before,
.sap-inspired-app .metric.metric-danger::before { background: var(--sap-danger); }
.sap-inspired-app .dash-card.primary::before { background: var(--sap-primary); }
.sap-inspired-app .metric.metric-warn::before { background: var(--sap-warning); }
.sap-inspired-app .table-wrap,
.sap-inspired-app .matrix-table-wrap {
    border: 1px solid var(--sap-border) !important;
    border-radius: var(--sap-radius) !important;
    background: #fff;
}
.sap-inspired-app table,
.sap-inspired-app .ux-data-table {
    font-size: 13px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}
.sap-inspired-app th,
.sap-inspired-app td,
.sap-inspired-app .ux-data-table th,
.sap-inspired-app .ux-data-table td {
    padding: 7px 9px !important;
    border-bottom: 1px solid #e5e9ec !important;
    vertical-align: middle !important;
}
.sap-inspired-app th,
.sap-inspired-app .ux-data-table th {
    background: #f7f7f7 !important;
    color: #3b4e5f !important;
    font-weight: 700 !important;
    border-bottom: 1px solid #c9d1d7 !important;
}
.sap-inspired-app tbody tr:hover td {
    background: #f2f8fe !important;
}
.sap-inspired-app td.ux-num,
.sap-inspired-app .amount,
.sap-inspired-app .total-col {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}
.sap-inspired-app .positive,
.sap-inspired-app .amount.entrada { color: var(--sap-success) !important; }
.sap-inspired-app .negative,
.sap-inspired-app .amount.saida,
.sap-inspired-app .amount.negative { color: var(--sap-danger) !important; }
.sap-inspired-app .badge {
    border-radius: 4px !important;
    padding: 3px 7px !important;
    font-size: 11px !important;
}
.sap-inspired-app .badge.ok { background: #e4f6e9 !important; color: var(--sap-success) !important; }
.sap-inspired-app .badge.warn { background: #fff2d9 !important; color: #8a4b00 !important; }
.sap-inspired-app .badge.error { background: #ffe4e4 !important; color: var(--sap-danger) !important; }
.sap-inspired-app .segmented {
    padding: 2px !important;
    border-radius: 4px !important;
    background: #eef2f5 !important;
    border-color: var(--sap-border) !important;
}
.sap-inspired-app .segmented button {
    border-radius: 3px !important;
    background: transparent !important;
    border: 0 !important;
    color: var(--sap-text) !important;
    min-height: 30px !important;
    padding: 5px 12px !important;
}
.sap-inspired-app .segmented button.active {
    background: var(--sap-primary) !important;
    color: #fff !important;
}
.sap-inspired-app .quick-pills button {
    background: #fff !important;
    color: var(--sap-primary) !important;
    border: 1px solid #8ab4df !important;
    border-radius: 4px !important;
}
.sap-inspired-app .quick-pills button:hover { background: #f3f8fc !important; }
.sap-inspired-app .matrix-exec-head {
    background: var(--sap-surface) !important;
    border-color: var(--sap-border) !important;
    border-top: 3px solid var(--sap-primary) !important;
}
.sap-inspired-app .eyebrow {
    color: var(--sap-primary) !important;
    letter-spacing: .04em !important;
}
.sap-inspired-app .matrix-context {
    border-radius: 4px !important;
    background: #f7f8f9 !important;
    border-color: var(--sap-border) !important;
    color: var(--sap-text) !important;
}
.sap-inspired-app .ux-matrix-guide {
    border-radius: var(--sap-radius) !important;
    background: #fff !important;
    border: 1px solid var(--sap-border) !important;
    box-shadow: var(--sap-shadow) !important;
}
.sap-inspired-app .ux-matrix-guide div {
    background: #f7f8f9 !important;
    border-radius: 6px !important;
}
.sap-inspired-app .matrix-alert-card {
    border-left: 0 !important;
    border-top: 3px solid var(--sap-warning) !important;
}
.sap-inspired-app .matrix-alert {
    border-radius: 6px !important;
    background: #fff !important;
}
.sap-inspired-app .matrix-alert.critical { border-left: 4px solid var(--sap-danger) !important; }
.sap-inspired-app .matrix-alert.warn { border-left: 4px solid var(--sap-warning) !important; }
.sap-inspired-app .matrix-alert.info { border-left: 4px solid var(--sap-information) !important; }
.sap-inspired-app .matrix-alert.ok { border-left: 4px solid var(--sap-success) !important; }
.sap-inspired-app .matrix-advanced-filters,
.sap-inspired-app .matrix-advanced-filters[open] {
    border-radius: var(--sap-radius) !important;
    border-color: var(--sap-border) !important;
    background: var(--sap-surface-2) !important;
}
.sap-inspired-app .matrix-table-wrap {
    max-height: 72vh !important;
    box-shadow: none !important;
}
.sap-inspired-app .matrix-table thead th,
.sap-inspired-app .matrix-table-v2 thead th,
.sap-inspired-app .matrix-table-v2 thead .total-sticky {
    background: #f7f7f7 !important;
    color: var(--sap-text) !important;
    border-bottom: 2px solid #b8c1c7 !important;
}
.sap-inspired-app .matrix-table thead th:first-child,
.sap-inspired-app .matrix-table .sticky-col {
    border-right: 1px solid #c9d1d7 !important;
}
.sap-inspired-app .matrix-table .row-level-0 td,
.sap-inspired-app .matrix-table-v2 .row-level-0 td {
    background: #eaf3fc !important;
    color: #173b5f;
    font-weight: 800 !important;
}
.sap-inspired-app .matrix-table .row-level-1 td,
.sap-inspired-app .matrix-table-v2 .row-level-1 td {
    background: #f2f5f7 !important;
    color: #223548;
    font-weight: 750 !important;
}
.sap-inspired-app .matrix-table .row-level-2 td,
.sap-inspired-app .matrix-table-v2 .row-level-2 td,
.sap-inspired-app .matrix-table-v2 .row-level-3 td {
    background: #fff !important;
}
.sap-inspired-app .matrix-table .row-total td,
.sap-inspired-app .matrix-table .row-total .sticky-col,
.sap-inspired-app .matrix-table-v2 .row-total .total-sticky {
    background: #354a5f !important;
    color: #fff !important;
}
.sap-inspired-app .matrix-table .row-balance td,
.sap-inspired-app .matrix-table-v2 .row-balance .total-sticky {
    background: #fff4db !important;
    color: #4d3500 !important;
}
.sap-inspired-app .matrix-table .total-col,
.sap-inspired-app .matrix-table-v2 .total-col,
.sap-inspired-app .matrix-table-v2 .total-sticky {
    background: #f7f8f9 !important;
    box-shadow: -1px 0 0 #c9d1d7 !important;
}
.sap-inspired-app .matrix-table .amount:hover {
    background: #e5f2ff !important;
    box-shadow: inset 0 0 0 1px #8cc5ff;
}
.sap-inspired-app .toggle-row {
    color: var(--sap-primary) !important;
}
.sap-inspired-app .matrix-side-backdrop { background: rgba(32, 49, 66, .38) !important; }
.sap-inspired-app .matrix-side-panel {
    border-left: 1px solid var(--sap-border-strong) !important;
    box-shadow: -8px 0 24px rgba(0,0,0,.18) !important;
}
.sap-inspired-app .matrix-side-panel-inner {
    padding: 16px !important;
}
.sap-inspired-app pre {
    background: #1d2d3e !important;
    color: #e7f0f7 !important;
    border-radius: var(--sap-radius) !important;
}
.sap-inspired-app .source-coverage-card,
.sap-inspired-app .endpoint-progress-card,
.sap-inspired-app .endpoint-card,
.sap-inspired-app .quality-item,
.sap-inspired-app .saved-view-card {
    border-radius: var(--sap-radius) !important;
    box-shadow: none !important;
}
.sap-inspired-app .source-coverage-card.ok { border-left-color: var(--sap-success) !important; }
.sap-inspired-app .source-coverage-card.warn { border-left-color: var(--sap-warning) !important; }
.sap-inspired-app .source-coverage-card.error { border-left-color: var(--sap-danger) !important; }
.sap-inspired-app .ux-report-principle,
.sap-inspired-app .matrix-load-card,
.sap-inspired-app .matrix-source-card {
    border-radius: var(--sap-radius) !important;
}
@media (min-width: 1200px) {
    .sap-inspired-app .split-card {
        grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr) !important;
    }
}
@media (max-width: 1100px) {
    .sap-inspired-app .topbar {
        grid-template-columns: 1fr;
        padding: 8px 16px;
    }
    .sap-inspired-app .topbar > div:first-child { padding-right: 0; }
    .sap-inspired-app .ux-nav-label,
    .sap-inspired-app .ux-nav a,
    .sap-inspired-app nav a { height: 42px; }
}
@media print {
    .sap-inspired-app .topbar,
    .sap-inspired-app .ux-context-bar,
    .sap-inspired-app .ux-matrix-guide { box-shadow: none !important; }
}

/* Fase 17.3 — Tabelas desktop confortáveis e legíveis */
:root {
    --sap-bg: #f5f6f7;
    --sap-border: #d9e0e7;
    --sap-header: #eef3f8;
    --sap-text: #1f2d3d;
    --sap-muted: #64748b;
    --sap-blue: #0a6ed1;
    --sap-green: #107e3e;
    --sap-red: #bb0000;
}

body {
    font-size: 13.5px;
    line-height: 1.42;
}

.shell {
    max-width: 1480px;
    padding: 18px 22px;
}

.topbar {
    align-items: center;
    gap: 14px;
    padding: 10px 0 14px;
}

.topbar h1 {
    font-size: 23px;
    letter-spacing: -.015em;
}

.topbar p {
    font-size: 13px;
}

nav a {
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12.5px;
}

.card {
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 6px;
}

.card h3 {
    font-size: 15px;
}

.grid-form {
    gap: 11px;
}

label {
    font-size: 12.8px;
    gap: 4px;
}

input, select, textarea {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 6px;
    font-size: 13px;
}

button,
.button-link {
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12.8px;
}

.summary-grid,
.dashboard-grid,
.matrix-executive-metrics {
    gap: 10px;
}

.metric,
.dash-card {
    border-radius: 9px;
    padding: 12px;
}

.metric strong,
.dash-card strong {
    font-size: 19px;
    letter-spacing: -.01em;
}

/* Tabela padrão: mais densa, legível e confortável no desktop */
.data-table-shell {
    display: grid;
    gap: 7px;
    width: 100%;
}

.data-table-caption {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: var(--sap-muted);
    font-size: 12px;
    padding: 2px 1px;
}

.data-table-caption strong {
    color: var(--sap-text);
}

.table-wrap,
.data-table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--sap-border);
    border-radius: 8px;
    background: #fff;
    max-height: 66vh;
}

.data-grid,
.table-wrap table:not(.matrix-table) {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    line-height: 1.28;
}

.data-grid th,
.data-grid td,
.table-wrap table:not(.matrix-table) th,
.table-wrap table:not(.matrix-table) td {
    border-bottom: 1px solid #edf1f5;
    border-right: 1px solid #f1f4f7;
    padding: 6px 8px;
    vertical-align: middle;
    background: #fff;
}

.data-grid thead th,
.table-wrap table:not(.matrix-table) thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--sap-header);
    color: #243447;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 var(--sap-border);
}

.data-grid tbody tr:nth-child(even) td,
.table-wrap table:not(.matrix-table) tbody tr:nth-child(even) td {
    background: #fbfcfe;
}

.data-grid tbody tr:hover td,
.table-wrap table:not(.matrix-table) tbody tr:hover td {
    background: #eaf4ff;
}

.data-cell > span {
    display: inline-block;
    max-width: 100%;
}

.cell-long > span {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-id_lancamento > span,
.col-fonte_origem > span,
.col-fonte_descricao > span {
    max-width: 145px;
}

.col-pessoa > span,
.col-documento > span,
.col-conta_fluxo_caixa > span,
.col-fluxo_caixa > span,
.col-natureza_operacao > span,
.col-conta_corrente > span {
    max-width: 230px;
}

.col-filial > span,
.col-filial_aplicacao > span,
.col-filial_cobranca > span {
    max-width: 210px;
}

.cell-money {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    min-width: 112px;
}

.cell-date {
    white-space: nowrap;
    min-width: 84px;
}

.cell-empty,
.cell-muted {
    color: #8a99aa;
    font-style: italic;
}

.cell-positive {
    color: var(--sap-green);
    font-weight: 650;
}

.cell-negative {
    color: var(--sap-red);
    font-weight: 650;
}

.cell-neutral {
    color: #6f5a00;
    font-weight: 650;
}

.dash-card.neutral {
    border-left: 4px solid #d0a800;
    background: #fffbea;
}

.empty-table-state {
    padding: 14px;
    color: var(--sap-muted);
    border: 1px dashed var(--sap-border);
    border-radius: 8px;
    background: #fbfcfe;
}

pre {
    font-size: 12px;
    max-height: 360px;
}

/* Matriz: compacta, mais próxima de ERP/SAP, sem sacrificar legibilidade */
.matrix-table-wrap,
.matrix-table-wrap-v2 {
    max-height: 74vh;
    border-radius: 8px;
    border: 1px solid var(--sap-border);
}

.matrix-table,
.matrix-table-v2 {
    font-size: 11.5px;
    line-height: 1.22;
}

.matrix-table th,
.matrix-table td,
.matrix-table-v2 th,
.matrix-table-v2 td {
    padding: 6px 7px !important;
}

.matrix-table .sticky-col,
.matrix-table-v2 .sticky-col {
    min-width: 300px;
    max-width: 390px;
}

.matrix-table .matrix-label-text,
.matrix-table-v2 .matrix-label-text,
.matrix-table .small-line,
.matrix-table-v2 .small-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.matrix-table .amount,
.matrix-table-v2 .amount {
    min-width: 92px;
    font-variant-numeric: tabular-nums;
}

.matrix-filter-form,
.matrix-filter-form-v2 {
    gap: 10px;
}

.matrix-alert-list {
    gap: 8px;
}

.matrix-alert {
    padding: 10px 11px;
    border-radius: 8px;
}

.matrix-mini-charts {
    gap: 12px;
}

/* Ajuda a leitura em telas grandes: menos largura perdida e blocos mais alinhados */
.live-head,
.section-head-row,
.matrix-exec-head {
    gap: 12px;
}

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

.badge {
    border-radius: 6px;
    padding: 3px 7px;
}

/* Fase 17.4 — carga compacta e confiança dos dados */
.compact-load-card {
    padding: 14px 16px;
}
.compact-load-card h2 {
    font-size: 18px;
    margin-bottom: 2px;
}
.compact-load-card .section-head-row,
.compact-load-card .live-head {
    margin-bottom: 10px;
}
.compact-load-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: end;
}
.compact-load-grid label {
    gap: 4px;
    font-size: 12px;
    color: #354052;
}
.compact-load-grid input,
.compact-load-grid select {
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
}
.compact-load-grid .check {
    min-height: 32px;
    align-items: center;
    padding: 6px 8px;
    border: 1px solid var(--sap-border, #d9e1ea);
    border-radius: 7px;
    background: #fbfcfe;
}
.compact-load-grid .check small {
    display: block;
    margin-left: 4px;
    line-height: 1.25;
}
.compact-load-grid .span-2 {
    grid-column: span 3;
}
.compact-load-grid .span-4 {
    grid-column: span 6;
}
.compact-source-panel {
    border: 1px solid var(--sap-border, #d9e1ea);
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfe;
}
.compact-source-panel h3 {
    font-size: 14px;
    margin: 0 0 4px;
}
.compact-source-panel p {
    margin: 0 0 8px;
    font-size: 12px;
}
.compact-source-panel .checks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.compact-source-panel .endpoint-check {
    padding: 6px 8px;
    border: 1px solid var(--sap-border, #d9e1ea);
    border-radius: 7px;
    background: #fff;
}
.compact-source-panel .endpoint-check strong {
    font-size: 12px;
}
.compact-source-panel .endpoint-check small {
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.data-origin-note {
    margin: 8px 0 12px;
    padding: 8px 10px;
    border-left: 3px solid var(--sap-blue, #0a6ed1);
    background: #f5f9ff;
    color: #475569;
    font-size: 11.5px;
    line-height: 1.35;
    border-radius: 6px;
}
.cell-confidence {
    min-width: 94px;
    max-width: 120px;
    white-space: nowrap;
    font-weight: 650;
}
.col-conta_corrente_confianca span,
.col-filial_aplicacao_confianca span,
.col-filial_cobranca_confianca span {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    background: #eef4fb;
    color: #24527a;
    font-size: 11px;
}
.col-qualidade_dados {
    min-width: 280px;
    max-width: 520px;
}
.col-qualidade_dados span,
.col-conta_corrente_origem span,
.col-filial_aplicacao_origem span,
.col-filial_cobranca_origem span {
    color: #526071;
    font-size: 11.5px;
}
.matrix-load-compact-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.matrix-load-compact-grid .actions {
    justify-content: flex-start;
}
@media (min-width: 1200px) {
    .compact-load-card {
        margin-bottom: 12px;
    }
}

/* Fase 17.5 — Normalização compacta por cards de endpoint */
.normalization-load-panel {
    padding: 12px 14px !important;
}
.normalization-headline {
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px !important;
}
.normalization-headline h2 {
    font-size: 17px !important;
    margin: 0 0 2px !important;
}
.normalization-headline p {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.35;
}
.normalization-head-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
}
.tiny-action {
    min-height: 28px !important;
    padding: 5px 9px !important;
    font-size: 11px !important;
}
.normalize-compact-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.load-params-strip {
    display: grid;
    grid-template-columns: 138px 138px 104px 88px 104px 132px 104px;
    gap: 8px;
    align-items: end;
    padding: 8px;
    border: 1px solid var(--sap-border, #d9e1ea);
    border-radius: 8px;
    background: #f8fafc;
}
.load-params-strip label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: #354052;
}
.load-params-strip label span {
    white-space: nowrap;
}
.load-params-strip input,
.load-params-strip select {
    min-height: 28px !important;
    height: 28px !important;
    padding: 4px 7px !important;
    border-radius: 5px !important;
    font-size: 12px !important;
}
.load-params-strip input[type="date"] {
    max-width: 138px;
}
.load-params-strip .small-field input {
    max-width: 104px;
}
.load-params-strip .compact-switch {
    height: 28px !important;
    min-height: 28px !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 4px 7px !important;
    border: 1px solid var(--sap-border, #d9e1ea);
    border-radius: 5px;
    background: #fff;
    font-size: 11px;
    cursor: pointer;
}
.load-params-strip .compact-switch input {
    width: 14px !important;
    height: 14px !important;
    min-height: 14px !important;
    padding: 0 !important;
}
.endpoint-source-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}
.endpoint-source-toolbar h3 {
    margin: 0 0 2px;
    font-size: 14px;
}
.endpoint-source-toolbar p {
    margin: 0;
    font-size: 12px;
}
.endpoint-source-grid.compact-endpoint-cards {
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 8px;
}
.endpoint-source-card {
    padding: 9px 10px !important;
    border-radius: 8px !important;
    background: #fff !important;
    border: 1px solid var(--sap-border, #d9e1ea) !important;
    min-height: 116px;
}
.endpoint-source-card.running {
    border-left: 4px solid #e9730c !important;
    background: #fff8ed !important;
}
.endpoint-source-card.success {
    border-left: 4px solid #188918 !important;
    background: #f7fbf7 !important;
}
.endpoint-source-card.failed {
    border-left: 4px solid #bb0000 !important;
    background: #fff6f6 !important;
}
.endpoint-card-mainline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}
.endpoint-card-check {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin: 0;
    cursor: pointer;
}
.endpoint-card-check input {
    width: 14px !important;
    height: 14px !important;
    min-height: 14px !important;
    padding: 0 !important;
    flex: 0 0 auto;
}
.endpoint-card-name {
    display: block;
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    color: #1f2d3d;
}
.endpoint-card-subtitle {
    font-size: 11px;
    line-height: 1.25;
    color: #5b6b7c;
    min-height: 28px;
    max-height: 28px;
    overflow: hidden;
    margin-bottom: 6px;
}
.endpoint-card-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px 8px !important;
    margin-bottom: 5px !important;
    font-size: 11px !important;
}
.endpoint-source-card .endpoint-progress-message {
    font-size: 11px !important;
    line-height: 1.3;
    max-height: 32px;
    overflow: auto;
}
.endpoint-source-card .mini-status {
    font-size: 11px !important;
    padding: 4px 6px !important;
    margin: 3px 0 !important;
}
.endpoint-source-card .raw-preview summary {
    font-size: 11px;
}
.compact-normalize-actions {
    display: flex;
    gap: 8px;
    margin-top: 0 !important;
}
.compact-normalize-actions button {
    min-height: 30px !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
}
.normalization-load-panel + .live-card {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}
.normalization-load-panel + .live-card h2 {
    font-size: 16px !important;
}
@media (max-width: 1280px) {
    .load-params-strip {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .endpoint-source-grid.compact-endpoint-cards {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
    }
}
@media (max-width: 900px) {
    .load-params-strip,
    .endpoint-source-grid.compact-endpoint-cards {
        grid-template-columns: 1fr;
    }
    .normalization-headline,
    .normalization-head-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Fase 17.6 — cabeçalho compacto e padrões reutilizáveis de ação
   Camada reutilizável: aplica-se a todas as telas existentes que usam .shell, .topbar,
   .card, .actions, .grid-form e tabelas padrão. */
:root {
    --ui-font-xs: 11px;
    --ui-font-sm: 12px;
    --ui-font-md: 13px;
    --ui-font-lg: 18px;
    --ui-control-h: 32px;
    --ui-radius-sm: 6px;
    --ui-radius-md: 8px;
    --ui-border: #d8dee6;
    --ui-muted: #5f6b7a;
    --ui-blue: #0a6ed1;
    --ui-blue-dark: #0854a0;
    --ui-bg: #f5f7fa;
}
body.ux-compact-shell {
    font-size: var(--ui-font-md);
    background: var(--ui-bg);
}
body.ux-compact-shell .shell {
    max-width: 1360px;
    padding: 12px 18px 22px;
}
body.ux-compact-shell .topbar.ux-shell-header {
    min-height: 48px;
    margin-bottom: 8px;
    padding: 8px 12px;
    align-items: center;
    gap: 14px;
    border: 1px solid #d9e2ec;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 1px 5px rgba(15, 23, 42, .06);
}
body.ux-compact-shell .topbar.ux-shell-header .ux-shell-brand {
    min-width: 180px;
    flex: 0 0 auto;
}
body.ux-compact-shell .topbar.ux-shell-header h1 {
    margin: 0;
    font-size: 15px;
    line-height: 1.1;
    letter-spacing: .01em;
    color: #1f2d3d;
    white-space: nowrap;
}
body.ux-compact-shell .topbar.ux-shell-header p {
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1.1;
    color: #6b7785;
    white-space: nowrap;
}
body.ux-compact-shell nav.ux-nav {
    flex: 1 1 auto;
    gap: 4px 6px;
    align-items: center;
    justify-content: flex-end;
}
body.ux-compact-shell .ux-nav-label {
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid #d8dee6;
    color: #6a7787;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .045em;
}
body.ux-compact-shell nav a,
body.ux-compact-shell nav .ux-nav-item {
    height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 650;
    line-height: 1;
    background: transparent;
    border-color: transparent;
    color: #2f3b4a;
}
body.ux-compact-shell nav a:hover {
    background: #edf4fc;
    border-color: #cfe3f8;
}
body.ux-compact-shell nav a.active {
    background: #d8ecff;
    border-color: #9dcbf5;
    color: var(--ui-blue-dark);
    box-shadow: inset 0 -2px 0 var(--ui-blue);
}
body.ux-compact-shell .ux-context-bar.ux-context-compact {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e1e7ef;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .04);
}
body.ux-compact-shell .ux-context-main {
    gap: 1px;
}
body.ux-compact-shell .ux-context-main strong {
    font-size: var(--ui-font-lg);
    line-height: 1.15;
    color: #1f2d3d;
}
body.ux-compact-shell .ux-context-main span:last-child {
    font-size: var(--ui-font-sm);
    color: #65758b;
}
body.ux-compact-shell .ux-context-chips {
    gap: 6px;
    align-items: center;
}
body.ux-compact-shell .ux-chip,
body.ux-compact-shell .chip,
body.ux-compact-shell .badge {
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}
body.ux-compact-shell .card {
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 6px rgba(15, 23, 42, .05);
}
body.ux-compact-shell .card h2 {
    font-size: 16px;
    margin: 0 0 8px;
}
body.ux-compact-shell .card h3 {
    font-size: 14px;
    margin: 0 0 8px;
}
body.ux-compact-shell .card p,
body.ux-compact-shell .muted,
body.ux-compact-shell small {
    font-size: 12px;
}
body.ux-compact-shell label {
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}
body.ux-compact-shell input,
body.ux-compact-shell select,
body.ux-compact-shell textarea {
    min-height: var(--ui-control-h);
    border-radius: var(--ui-radius-sm);
    padding: 6px 8px;
    font-size: 12px;
}
body.ux-compact-shell textarea { min-height: 72px; }
body.ux-compact-shell .grid-form {
    gap: 10px;
}
body.ux-compact-shell .actions,
body.ux-compact-shell .wrap-actions,
body.ux-compact-shell .matrix-head-actions {
    gap: 6px;
    flex-wrap: wrap;
}
body.ux-compact-shell button,
body.ux-compact-shell .button,
body.ux-compact-shell .button-link,
body.ux-compact-shell a.button-link {
    min-height: var(--ui-control-h);
    padding: 7px 10px;
    border-radius: var(--ui-radius-sm);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.1;
    box-shadow: none;
}
body.ux-compact-shell button:not(.secondary):not(.danger):not(.primary),
body.ux-compact-shell .button-link:not(.secondary):not(.danger) {
    background: var(--ui-blue);
}
body.ux-compact-shell button.secondary,
body.ux-compact-shell .button-link.secondary {
    background: #fff;
    color: #2f3b4a;
    border: 1px solid var(--ui-border);
}
body.ux-compact-shell button.primary,
body.ux-compact-shell .ux-primary-action {
    background: var(--ui-blue);
    color: #fff;
}
body.ux-compact-shell button.danger,
body.ux-compact-shell .ux-danger-action {
    background: #b42318;
    color: #fff;
}
body.ux-compact-shell .summary-grid,
body.ux-compact-shell .kpi-grid {
    gap: 8px;
}
body.ux-compact-shell .metric,
body.ux-compact-shell .kpi-card {
    border-radius: 8px;
    padding: 10px;
}
body.ux-compact-shell .metric span,
body.ux-compact-shell .kpi-card span {
    font-size: 11px;
    margin-bottom: 4px;
}
body.ux-compact-shell .metric strong,
body.ux-compact-shell .kpi-card strong {
    font-size: 18px;
}
body.ux-compact-shell table {
    font-size: 12px;
}
body.ux-compact-shell th,
body.ux-compact-shell td {
    padding: 6px 8px;
}
body.ux-compact-shell pre {
    border-radius: 8px;
    font-size: 11px;
    padding: 10px;
}
body.ux-compact-shell .status {
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12px;
}
/* Utilitários reutilizáveis para novas telas */
.ui-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ui-toolbar .ui-primary { order: 0; }
.ui-toolbar .ui-secondary { order: 1; }
.ui-compact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ui-context-note { font-size: 11px; color: var(--ui-muted); margin: 4px 0 8px; }
.ui-section-title { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.ui-section-title h2 { margin: 0; }
@media (max-width: 980px) {
    body.ux-compact-shell .topbar.ux-shell-header { align-items: flex-start; flex-direction: column; }
    body.ux-compact-shell nav.ux-nav { justify-content: flex-start; }
    body.ux-compact-shell .ux-context-bar.ux-context-compact { align-items: flex-start; flex-direction: column; }
}

/* Fase 17.7 — Dashboard compacto e executivo
   Reutiliza o padrão visual da normalização compacta e reduz ruído técnico após a carga. */
.dashboard-executive-page .dashboard-shell {
    max-width: 1460px;
}
.dashboard-executive-page .dashboard-load-panel {
    padding: 12px 14px;
}
.dashboard-executive-page .dashboard-headline h2 {
    margin-bottom: 2px;
}
.dashboard-compact-form {
    display: grid;
    gap: 10px;
}
.dashboard-params-strip {
    display: grid;
    grid-template-columns: 132px 132px 90px 120px 78px 92px 90px 105px 88px repeat(2, max-content);
    gap: 8px;
    align-items: end;
}
.dashboard-params-strip label {
    min-width: 0;
}
.dashboard-params-strip input,
.dashboard-params-strip select {
    width: 100%;
    min-height: 30px;
    padding: 5px 7px;
    font-size: 12px;
}
.dashboard-params-strip label > span {
    display: block;
    font-size: 10.8px;
    line-height: 1.1;
    margin-bottom: 3px;
    color: #53606f;
    font-weight: 800;
}
.dashboard-params-strip .compact-switch {
    align-self: end;
    height: 30px;
    white-space: nowrap;
    padding: 4px 8px;
    border: 1px solid #d8dee6;
    border-radius: 6px;
    background: #fff;
}
.dashboard-source-details {
    border: 1px solid #e1e7ef;
    border-radius: 8px;
    background: #f8fafc;
    padding: 7px 9px;
}
.dashboard-source-details > summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 850;
    color: #1f2d3d;
}
.dashboard-source-details[open] > summary {
    margin-bottom: 8px;
}
.dashboard-source-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.dashboard-source-card {
    padding: 9px 10px !important;
    min-height: 0;
    cursor: pointer;
}
.dashboard-source-card .endpoint-card-mainline,
.dashboard-source-card .endpoint-card-check {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}
.dashboard-source-card .endpoint-card-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
}
.dashboard-source-card .endpoint-card-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 10.8px;
    line-height: 1.25;
    color: #667085;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.dashboard-actions-row {
    justify-content: flex-start;
    padding-top: 0;
}
.dashboard-actions-row button,
.dashboard-actions-row .button-link {
    min-height: 30px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
}
.dashboard-load-details {
    padding: 0 !important;
    overflow: hidden;
}
.dashboard-load-details > summary {
    min-height: 36px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    background: #fff;
    border-bottom: 1px solid transparent;
    font-size: 12px;
    font-weight: 850;
    color: #1f2d3d;
}
.dashboard-load-details > summary::-webkit-details-marker { display: none; }
.dashboard-load-details > summary::before {
    content: '▸';
    color: #64748b;
    margin-right: 4px;
}
.dashboard-load-details[open] > summary::before { content: '▾'; }
.dashboard-load-details > summary small {
    font-size: 11px;
    font-weight: 650;
    color: #667085;
    margin-left: auto;
}
.dashboard-load-details.is-loading > summary {
    background: #f0f7ff;
    border-bottom-color: #d7e8fb;
}
.dashboard-load-details-body {
    padding: 10px 12px 12px;
    display: grid;
    gap: 10px;
}
.compact-live-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.compact-live-head h2,
.dashboard-load-details h3 {
    margin: 0 0 4px;
    font-size: 13px;
}
.compact-progress-shell {
    height: 7px;
    border-radius: 999px;
}
.dashboard-load-technical-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 10px;
}
.dashboard-endpoint-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}
.dashboard-runtime-endpoint-card {
    padding: 8px 9px !important;
    border-radius: 7px !important;
    box-shadow: none !important;
}
.dashboard-runtime-endpoint-card .endpoint-progress-title strong {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dashboard-runtime-endpoint-card .endpoint-progress-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 7px;
    font-size: 10.8px;
}
.compact-log {
    max-height: 190px;
    font-size: 11px;
}
.dashboard-executive-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.dashboard-executive-grid .dash-card {
    border-radius: 8px;
    padding: 11px 12px;
    box-shadow: 0 1px 6px rgba(15, 23, 42, .05);
    border-left-width: 4px;
}
.dashboard-executive-grid .dash-card span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .035em;
    color: #64748b;
    margin-bottom: 5px;
}
.dashboard-executive-grid .dash-card strong {
    font-size: 19px;
    line-height: 1.15;
}
.dashboard-executive-grid .dash-card small {
    font-size: 10.5px;
    margin-top: 4px;
    color: #64748b;
}
.dashboard-executive-grid .dash-card.result { border-left: 4px solid #64748b; }
.dashboard-main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
    gap: 12px;
    margin-bottom: 12px;
}
.dashboard-main-layout .card {
    margin-bottom: 0;
}
.dashboard-chart-card .mini-chart {
    min-height: 220px;
}
.dashboard-executive-page .chart-grid {
    gap: 7px;
}
.dashboard-executive-page .chart-row {
    grid-template-columns: 96px minmax(0, 1fr) 142px;
    gap: 9px;
}
.dashboard-executive-page .chart-label {
    font-size: 11.5px;
}
.dashboard-executive-page .chart-bars {
    gap: 4px;
}
.dashboard-executive-page .chart-bar-line {
    height: 13px;
    position: relative;
}
.dashboard-executive-page .chart-bar-line:hover {
    outline: 2px solid rgba(10, 110, 209, .18);
    outline-offset: 1px;
}
.dashboard-executive-page .chart-values {
    font-size: 10.8px;
    line-height: 1.25;
}
.dashboard-data-details > summary {
    cursor: pointer;
    font-weight: 850;
    font-size: 13px;
}
.compact-drill-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.compact-drill-help h2 { margin-bottom: 2px !important; }
.compact-drill-help p { margin: 0; }
@media (max-width: 1180px) {
    .dashboard-params-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dashboard-source-grid,
    .dashboard-endpoint-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-main-layout { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .dashboard-params-strip,
    .dashboard-source-grid,
    .dashboard-endpoint-grid,
    .dashboard-executive-grid,
    .dashboard-load-technical-grid { grid-template-columns: 1fr; }
    .compact-drill-help { display: block; }
}

/* Fase 17.8 — Menu lateral recolhível + cabeçalho único compacto
   Reaproveitável para todas as páginas. */
body.ux-side-layout-app {
    background: #f5f7fa;
    color: #1f2d3d;
    overflow-x: hidden;
}
body.ux-side-layout-app .ux-app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
}
body.ux-side-layout-app.ux-side-collapsed .ux-app-layout {
    grid-template-columns: 60px minmax(0, 1fr);
}
body.ux-side-layout-app .ux-side-nav {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    background: #fff;
    border-right: 1px solid #d8dee6;
    box-shadow: 1px 0 6px rgba(15, 23, 42, .04);
    overflow: hidden;
    z-index: 30;
}
body.ux-side-layout-app .ux-side-brand {
    height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-bottom: 1px solid #e1e7ef;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
body.ux-side-layout-app .ux-side-toggle {
    width: 34px;
    height: 34px;
    min-height: 34px;
    border-radius: 7px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    background: #eef5fd;
    color: #0a6ed1;
    border: 1px solid #cfe3f8;
    font-size: 16px;
}
body.ux-side-layout-app .ux-side-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    min-width: 0;
}
body.ux-side-layout-app .ux-side-brand-text strong {
    font-size: 13px;
    color: #1f2d3d;
}
body.ux-side-layout-app .ux-side-brand-text span {
    font-size: 11px;
    color: #5f6b7a;
    white-space: nowrap;
}
body.ux-side-layout-app .ux-side-scroll {
    height: calc(100vh - 54px);
    overflow: auto;
    padding: 10px 8px 18px;
}
body.ux-side-layout-app .ux-side-group {
    margin-bottom: 12px;
}
body.ux-side-layout-app .ux-side-group-title {
    padding: 7px 9px 5px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .055em;
    color: #7a8797;
    font-weight: 850;
}
body.ux-side-layout-app .ux-side-link {
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 9px;
    border-radius: 7px;
    color: #2f3b4a;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 650;
    border: 1px solid transparent;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.ux-side-layout-app .ux-side-link:hover {
    background: #edf4fc;
    border-color: #cfe3f8;
    color: #0a6ed1;
}
body.ux-side-layout-app .ux-side-link.active {
    background: #d8ecff;
    border-color: #9dcbf5;
    color: #0854a0;
    box-shadow: inset 3px 0 0 #0a6ed1;
}
body.ux-side-layout-app.ux-side-collapsed .ux-side-brand-text,
body.ux-side-layout-app.ux-side-collapsed .ux-side-group-title,
body.ux-side-layout-app.ux-side-collapsed .ux-side-link {
    font-size: 0;
}
body.ux-side-layout-app.ux-side-collapsed .ux-side-group-title {
    height: 4px;
    padding: 0;
    margin: 7px 0;
    border-top: 1px solid #e1e7ef;
}
body.ux-side-layout-app.ux-side-collapsed .ux-side-link {
    justify-content: center;
    width: 40px;
    height: 32px;
    padding: 0;
    margin: 2px auto;
}
body.ux-side-layout-app.ux-side-collapsed .ux-side-link::first-letter {
    font-size: 13px;
}
body.ux-side-layout-app .ux-app-main {
    min-width: 0;
}
body.ux-side-layout-app .shell {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 16px 22px !important;
    width: 100%;
}
body.ux-side-layout-app .topbar.ux-unified-header {
    position: sticky;
    top: 0;
    z-index: 25;
    min-height: 54px;
    margin: 0 -16px 12px;
    padding: 8px 16px;
    border: 0;
    border-bottom: 1px solid #d8dee6;
    border-radius: 0;
    background: rgba(255,255,255,.96);
    box-shadow: 0 1px 7px rgba(15, 23, 42, .06);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
body.ux-side-layout-app .ux-unified-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
body.ux-side-layout-app .ux-unified-title strong {
    font-size: 15px;
    line-height: 1.15;
    color: #1f2d3d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.ux-side-layout-app .ux-unified-title strong span {
    color: #0a6ed1;
    font-weight: 850;
}
body.ux-side-layout-app .ux-unified-title small {
    font-size: 11.5px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.ux-side-layout-app .ux-unified-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
body.ux-side-layout-app .ux-unified-meta .ux-chip {
    background: #f4f7fb;
    border: 1px solid #dfe7ef;
    color: #465467;
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}
body.ux-side-layout-app .ux-context-bar {
    display: none !important;
}
body.ux-side-layout-app .card:first-of-type {
    margin-top: 0;
}
body.ux-side-layout-app .ux-no-data-hint {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #f4c776;
    background: #fff8e6;
    color: #6b4a00;
    border-radius: 8px;
    font-size: 12.5px;
}
body.ux-side-layout-app .ux-no-data-hint a {
    color: #0a6ed1;
    font-weight: 800;
}
/* Normalização: todas as páginas por padrão e bloco mais denso. */
body.ux-side-layout-app .normalization-load-panel .load-params-strip input[type="date"] {
    max-width: 132px;
}
body.ux-side-layout-app .normalization-load-panel .load-params-strip input[name="id_filial"] {
    max-width: 86px;
}
body.ux-side-layout-app .normalization-load-panel .load-params-strip input[name="limit"],
body.ux-side-layout-app .normalization-load-panel .load-params-strip input[name="max_pages"] {
    max-width: 78px;
}
body.ux-side-layout-app .normalization-load-panel .compact-switch {
    white-space: nowrap;
}
@media (max-width: 1180px) {
    body.ux-side-layout-app .ux-app-layout,
    body.ux-side-layout-app.ux-side-collapsed .ux-app-layout {
        grid-template-columns: 1fr;
    }
    body.ux-side-layout-app .ux-side-nav {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid #d8dee6;
    }
    body.ux-side-layout-app .ux-side-scroll {
        height: auto;
        max-height: 210px;
    }
    body.ux-side-layout-app .ux-side-group {
        display: inline-block;
        vertical-align: top;
        width: 230px;
    }
    body.ux-side-layout-app.ux-side-collapsed .ux-side-brand-text,
    body.ux-side-layout-app.ux-side-collapsed .ux-side-group-title,
    body.ux-side-layout-app.ux-side-collapsed .ux-side-link {
        font-size: revert;
    }
    body.ux-side-layout-app.ux-side-collapsed .ux-side-link {
        justify-content: flex-start;
        width: auto;
        padding: 6px 9px;
    }
    body.ux-side-layout-app .topbar.ux-unified-header {
        position: relative;
        flex-direction: column;
        align-items: flex-start;
    }
    body.ux-side-layout-app .ux-unified-meta {
        justify-content: flex-start;
    }
}

/* Fase 17.8.3 — tabelas avançadas reutilizáveis */
.data-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.table-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}
.table-tools select {
    height: 26px;
    min-height: 26px;
    padding: 2px 22px 2px 6px;
    font-size: 11px;
}
.table-column-picker {
    position: relative;
}
.table-column-picker summary {
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--border, #d7dee8);
    border-radius: 4px;
    background: #fff;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 16px;
}
.table-column-picker[open] summary {
    border-color: var(--primary, #0a6ed1);
}
.table-column-picker > div {
    position: absolute;
    right: 0;
    z-index: 80;
    width: 250px;
    max-height: 280px;
    overflow: auto;
    padding: 8px;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border, #d7dee8);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
    border-radius: 6px;
}
.table-column-picker label {
    display: block;
    padding: 4px 3px;
    font-size: 11px;
    white-space: nowrap;
}
.is-hidden-column {
    display: none !important;
}
.enhanced-data-table .data-grid {
    table-layout: auto;
}
.enhanced-data-table.density-comfortable td,
.enhanced-data-table.density-comfortable th {
    font-size: 13px;
    padding: 8px 10px;
    line-height: 1.35;
}
.enhanced-data-table.density-compact td,
.enhanced-data-table.density-compact th {
    font-size: 12px;
    padding: 5px 7px;
    line-height: 1.25;
}
.enhanced-data-table.density-ultra td,
.enhanced-data-table.density-ultra th {
    font-size: 11px;
    padding: 3px 5px;
    line-height: 1.18;
}
.enhanced-data-table td span {
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}
.enhanced-data-table .cell-money span,
.enhanced-data-table .cell-date span,
.enhanced-data-table .cell-confidence span {
    max-width: none;
}
.enhanced-data-table .cell-money {
    text-align: right;
    white-space: nowrap;
}
.enhanced-data-table .cell-date,
.enhanced-data-table .cell-confidence,
.enhanced-data-table .col-registro {
    white-space: nowrap;
}
.mini-report-tooltip {
    position: fixed;
    display: none;
    z-index: 9999;
    width: 320px;
    max-width: 42vw;
    padding: 10px 11px;
    background: #1d2d3e;
    color: #fff;
    border-radius: 7px;
    box-shadow: 0 16px 36px rgba(0,0,0,.28);
    pointer-events: none;
    font-size: 11px;
    line-height: 1.25;
}
.mini-report-tooltip.is-visible { display: block; }
.mini-report-tooltip .mini-report-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
}
.mini-report-tooltip div:not(.mini-report-title) {
    display: grid;
    grid-template-columns: 95px minmax(0, 1fr);
    gap: 6px;
    padding: 2px 0;
    border-top: 1px solid rgba(255,255,255,.08);
}
.mini-report-tooltip span {
    color: rgba(255,255,255,.68);
}
.mini-report-tooltip strong {
    color: #fff;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fase 17.8.3 — BI com filtros avançados recolhidos */
.bi-main-filters,
.bi-grouping-compact {
    margin-bottom: 8px;
}
.advanced-filter-details {
    margin-top: 8px;
    border: 1px solid var(--border, #d7dee8);
    border-radius: 8px;
    background: rgba(250,252,255,.88);
    padding: 0;
}
.advanced-filter-details summary {
    cursor: pointer;
    padding: 9px 11px;
    font-weight: 700;
    font-size: 12px;
    color: var(--primary, #0a6ed1);
}
.advanced-filter-details .grid-form {
    padding: 0 11px 11px;
}


/* Fase 17.8.4 — Seletor de colunas profissional + exportação reutilizável */
.table-tools {
    gap: 6px;
    flex-wrap: wrap;
}
.table-tool-density {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #556575;
}
.table-column-picker,
.table-export-menu {
    position: relative;
}
.table-column-picker summary,
.table-export-menu summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--border, #d7dee8);
    border-radius: 4px;
    background: #fff;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 16px;
    color: #24364a;
}
.table-column-picker summary::-webkit-details-marker,
.table-export-menu summary::-webkit-details-marker {
    display: none;
}
.table-column-picker[open] summary,
.table-export-menu[open] summary {
    border-color: var(--primary, #0a6ed1);
    box-shadow: 0 0 0 2px rgba(10,110,209,.12);
}
.table-column-picker-panel,
.table-export-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 120;
    background: #fff;
    border: 1px solid #cfd9e5;
    box-shadow: 0 16px 38px rgba(11, 31, 53, .18);
    border-radius: 8px;
}
.table-column-picker-panel {
    width: 330px;
    padding: 10px;
}
.table-export-panel {
    width: 220px;
    padding: 6px;
}
.table-column-picker-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.table-column-picker-head strong {
    font-size: 12px;
    color: #172b3f;
}
.table-column-picker-head small {
    font-size: 10.5px;
    color: #667789;
    white-space: nowrap;
}
.table-column-search {
    width: 100%;
    height: 28px;
    min-height: 28px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccd7e3;
    border-radius: 5px;
    margin-bottom: 8px;
}
.table-column-actions {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
}
.table-column-actions button,
.table-export-panel button {
    appearance: none;
    border: 1px solid #d2dce7;
    background: #f7f9fc;
    border-radius: 4px;
    color: #1d354d;
    font-size: 11px;
    padding: 4px 7px;
    cursor: pointer;
}
.table-column-actions button:hover,
.table-export-panel button:hover {
    background: #eef5fd;
    border-color: #9fc4ea;
}
.table-column-groups {
    max-height: 290px;
    overflow: auto;
    padding-right: 2px;
}
.table-column-group {
    border-top: 1px solid #eef2f6;
    padding-top: 7px;
    margin-top: 7px;
}
.table-column-group:first-child {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}
.table-column-group-title {
    font-size: 10px;
    font-weight: 700;
    color: #697b8f;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}
.table-column-row {
    display: flex !important;
    align-items: center;
    gap: 7px;
    min-height: 24px;
    padding: 3px 4px !important;
    border-radius: 4px;
    font-size: 11.5px !important;
    color: #24364a;
    white-space: nowrap;
}
.table-column-row:hover {
    background: #f4f8fc;
}
.table-column-row input {
    flex: 0 0 auto;
}
.table-column-row span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.table-column-hint {
    margin: 8px 0 0;
    font-size: 10.5px;
    color: #748396;
    line-height: 1.25;
}
.table-export-panel {
    display: grid;
    gap: 4px;
}
.table-export-panel button {
    text-align: left;
    width: 100%;
    background: #fff;
}
.data-table-summary {
    min-width: 280px;
}
.data-table-summary span {
    color: #68798b;
}
@media (max-width: 1200px) {
    .table-column-picker-panel {
        right: auto;
        left: 0;
    }
}

.table-column-picker > .table-column-picker-panel { max-height: none; overflow: visible; margin-top: 0; }

/* Fase 17.8.8 — Auditoria com alertas visuais por severidade */
.audit-alert-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin: 6px 0 10px;
    font-size: 11px;
    color: var(--sap-muted, #607080);
}
.audit-alert-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--sap-border, #d7dee8);
    border-radius: 999px;
    padding: 3px 8px;
    background: #fff;
    white-space: nowrap;
}
.audit-alert-legend .legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
}
.audit-alert-legend .critical { background: #dc2626; }
.audit-alert-legend .warning { background: #f59e0b; }
.audit-alert-legend .info { background: #2563eb; }
.audit-alert-legend .neutral { background: #64748b; }

.enhanced-data-table .data-grid tbody tr.audit-alert-row td {
    transition: background .12s ease, box-shadow .12s ease;
}
.enhanced-data-table .data-grid tbody tr.audit-alert-critical td,
.data-grid tbody tr.audit-alert-critical td {
    background: #fff5f5;
    border-bottom-color: #fde2e2;
}
.enhanced-data-table .data-grid tbody tr.audit-alert-warning td,
.data-grid tbody tr.audit-alert-warning td {
    background: #fffbeb;
    border-bottom-color: #fdecc8;
}
.enhanced-data-table .data-grid tbody tr.audit-alert-info td,
.enhanced-data-table .data-grid tbody tr.audit-alert-quality td,
.data-grid tbody tr.audit-alert-info td,
.data-grid tbody tr.audit-alert-quality td {
    background: #eff6ff;
    border-bottom-color: #dbeafe;
}
.enhanced-data-table .data-grid tbody tr.audit-alert-neutral td,
.data-grid tbody tr.audit-alert-neutral td {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
}
.enhanced-data-table .data-grid tbody tr.audit-alert-critical td:first-child,
.data-grid tbody tr.audit-alert-critical td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.enhanced-data-table .data-grid tbody tr.audit-alert-warning td:first-child,
.data-grid tbody tr.audit-alert-warning td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
.enhanced-data-table .data-grid tbody tr.audit-alert-info td:first-child,
.enhanced-data-table .data-grid tbody tr.audit-alert-quality td:first-child,
.data-grid tbody tr.audit-alert-info td:first-child,
.data-grid tbody tr.audit-alert-quality td:first-child { box-shadow: inset 4px 0 0 #2563eb; }
.enhanced-data-table .data-grid tbody tr.audit-alert-neutral td:first-child,
.data-grid tbody tr.audit-alert-neutral td:first-child { box-shadow: inset 4px 0 0 #64748b; }
.enhanced-data-table .data-grid tbody tr.audit-alert-row:hover td,
.data-grid tbody tr.audit-alert-row:hover td {
    filter: saturate(1.05) brightness(.985);
}
.severity-chip {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    max-width: none !important;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.45;
    white-space: nowrap;
    border: 1px solid transparent;
}
.severity-critical {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}
.severity-warning {
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
}
.severity-info,
.severity-quality {
    color: #1e3a8a;
    background: #dbeafe;
    border-color: #bfdbfe;
}
.severity-neutral {
    color: #334155;
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* Fase 17.8.9 — Drill-down aderente ao modelo da planilha */
.context-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 12px;
    font-size: 12px;
    color: #334155;
}
.context-chip-row span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid #d9e2ec;
    background: #f8fafc;
    border-radius: 4px;
    white-space: nowrap;
}
.drill-selection-grid {
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 10px;
}
@media (max-width: 1200px) {
    .drill-selection-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}


/* Fase 18.2 — Previsões manuais e ajuda contextual */
.scenario-help-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px;
}
.scenario-help-strip span {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d8e3f0;
    background: #f6f9fc;
    color: #334155;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1.2;
    cursor: help;
}
.field-help {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 10.5px;
    line-height: 1.25;
}
.manual-report-note {
    margin: 8px 0 10px;
    padding: 8px 10px;
    border-left: 3px solid #2563eb;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 12px;
    border-radius: 6px;
}
.scenario-mode-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}
.scenario-mode-badge.sim {
    color: #334155;
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.scenario-mode-badge.manual {
    color: #92400e;
    background: #fffbeb;
    border-color: #fcd34d;
}
.manual-forecast-card .section-header-row {
    align-items: flex-start;
}

/* Fase 18.3 — Painel financeiro contextual no detalhe da célula da matriz */
.matrix-side-panel {
    width: min(840px, 96vw);
}
.cell-finance-panel {
    display: grid;
    gap: 14px;
}
.cell-finance-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}
.cell-finance-head h3 {
    margin: 2px 0 4px;
    font-size: 18px;
    line-height: 1.22;
    color: #0f172a;
}
.cell-finance-head p {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}
.cell-eyebrow {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #2563eb;
    font-weight: 900;
}
.cell-head-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.cell-context-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 12px;
}
.cell-context-strip span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-right: 1px solid #cbd5e1;
    padding-right: 8px;
}
.cell-context-strip span:last-child { border-right: 0; padding-right: 0; }
.cell-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.cell-kpi {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.cell-kpi span {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 4px;
}
.cell-kpi strong {
    display: block;
    font-size: 17px;
    color: #0f172a;
    line-height: 1.25;
}
.cell-kpi small {
    display: block;
    color: #64748b;
    margin-top: 4px;
    font-size: 11px;
}
.cell-kpi.ok { border-left: 4px solid #16a34a; background: #f7fef9; }
.cell-kpi.warn { border-left: 4px solid #f59e0b; background: #fffbeb; }
.cell-composition-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.cell-section-card {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    padding: 12px;
}
.cell-documents-card {
    padding: 12px;
}
.cell-section-title {
    font-weight: 900;
    color: #0f172a;
    font-size: 13px;
    margin-bottom: 8px;
}
.small-note {
    font-size: 11px !important;
    margin: 0 0 8px !important;
}
.cell-breakdown-list {
    display: grid;
    gap: 6px;
}
.cell-breakdown-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 7px 8px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    font-size: 12px;
}
.cell-breakdown-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #334155;
    font-weight: 700;
}
.cell-breakdown-item strong {
    font-variant-numeric: tabular-nums;
    color: #0f172a;
}
.cell-breakdown-item strong.negative { color: #b91c1c; }
.cell-breakdown-item small {
    color: #64748b;
    white-space: nowrap;
}
.cell-technical-details {
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    padding: 10px 12px;
    background: #f8fafc;
}
.cell-technical-details summary {
    cursor: pointer;
    font-weight: 900;
    color: #334155;
    font-size: 13px;
}
.cell-technical-details[open] summary { margin-bottom: 8px; }
.cell-finance-panel .table-shell {
    margin-top: 8px;
}
.cell-finance-panel .table-wrap {
    max-height: 340px;
    border-radius: 12px;
}
.cell-finance-panel table {
    font-size: 12px;
}
.cell-finance-panel th,
.cell-finance-panel td {
    padding: 7px 8px !important;
}
@media (max-width: 1180px) {
    .cell-summary-grid,
    .cell-composition-grid { grid-template-columns: 1fr; }
    .cell-finance-head { flex-direction: column; }
}


/* Fase 18.6 — refinamento final das visões financeiras */
.finance-consistency-panel {
    border-left: 4px solid #2f6fbb;
    background: linear-gradient(90deg, rgba(47,111,187,.07), rgba(255,255,255,1) 42%);
}
.finance-coherence-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 10px;
}
.finance-coherence-head strong { display: block; font-size: 14px; color: #172b4d; }
.finance-coherence-head span { display: block; font-size: 11px; color: #5f6b7a; margin-top: 2px; }
.finance-coherence-status {
    white-space: nowrap;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    background: #fff4d6;
    color: #7a5200;
    border: 1px solid #f3d27a;
}
.finance-coherence-status.ok { background: #e7f6ed; color: #17633a; border-color: #a8d9bb; }
.finance-coherence-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(100px, 1fr));
    gap: 8px;
}
.finance-mini-card {
    background: #fff;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 52px;
}
.finance-mini-card span { display:block; color:#667085; font-size:11px; margin-bottom:4px; }
.finance-mini-card strong { display:block; color:#1d2939; font-size:13px; line-height:1.25; }
.finance-mini-card.neutral { border-left:3px solid #2e8f5b; }
.finance-mini-card.neutral-out { border-left:3px solid #c94c4c; }
.finance-mini-card.primary { border-left:3px solid #2f6fbb; }
.finance-mini-card.danger { border-left:3px solid #c94c4c; background:#fff7f7; }
.finance-mini-card.quality { grid-column: span 2; }
@media (max-width: 1280px) {
    .finance-coherence-grid { grid-template-columns: repeat(4, minmax(110px, 1fr)); }
    .finance-mini-card.quality { grid-column: span 4; }
}

/* Fase 18.7 — Homologação financeira assistida */
.financial-homologation-page .financial-homologation-intro .section-head-row { align-items: flex-start; }
.hom-fin-note {
    margin-top: 12px;
    border: 1px solid #d6e3f2;
    background: #f6f9fd;
    color: #31445f;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 12px;
}
.hom-fin-filter-card { padding-bottom: 14px; }
.hom-fin-params {
    grid-template-columns: repeat(8, minmax(96px, 1fr));
    gap: 8px;
    align-items: end;
}
.hom-fin-params label span { font-size: 11px; }
.hom-fin-params input,
.hom-fin-params select { min-height: 30px; padding: 6px 8px; font-size: 12px; border-radius: 8px; }
.hom-fin-filter-actions { align-self: end; gap: 6px; }
.hom-fin-filter-actions button { min-height: 30px; padding: 7px 10px; font-size: 12px; }
.hom-fin-kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hom-fin-score-card strong { color: #123f68; }
.hom-fin-score-card small,
.metric small { display: block; margin-top: 5px; color: #64748b; font-size: 11px; font-weight: 600; }
.hom-fin-layout { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .75fr); }
.hom-fin-checklist { display: grid; gap: 8px; }
.hom-fin-check-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border: 1px solid #e5edf5;
    border-left: 4px solid #9aa8b6;
    border-radius: 10px;
    background: #fbfcfe;
}
.hom-fin-check-item.ok { border-left-color: #2f8f5b; background: #f2fbf6; }
.hom-fin-check-item.warning { border-left-color: #d38314; background: #fff8ec; }
.hom-fin-check-item.critical { border-left-color: #b42318; background: #fff1f0; }
.hom-fin-check-item strong { display: block; font-size: 12px; color: #172b4d; }
.hom-fin-check-item small { display: block; font-size: 11px; color: #65758a; margin-top: 2px; }
.hom-fin-check-item em { font-style: normal; font-size: 11px; color: #526174; white-space: nowrap; }
.hom-fin-status-pill {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    border: 1px solid #cfd8e3;
    background: #f8fafc;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.hom-fin-status-pill.ok { background: #e7f6ed; border-color: #9fd4b5; color: #17633a; }
.hom-fin-status-pill.warning { background: #fff0d6; border-color: #f1c27d; color: #8a5200; }
.hom-fin-status-pill.critical { background: #fee4e2; border-color: #f7a8a3; color: #9f1d14; }
.hom-fin-status-pill.neutral { background: #eef2f7; border-color: #cfd8e3; color: #475569; }
.hom-fin-dimensions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hom-fin-dim-card {
    border: 1px solid #e3eaf2;
    border-radius: 12px;
    padding: 10px;
    background: #fbfcfe;
    min-width: 0;
}
.hom-fin-dim-card h3 { margin: 0 0 8px; font-size: 13px; color: #172b4d; }
.hom-fin-dim-card .data-table-shell .table-toolbar { padding: 4px; }
.hom-fin-dim-card table { font-size: 11px; }
@media (max-width: 1180px) {
    .hom-fin-params { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
    .hom-fin-layout { grid-template-columns: 1fr; }
    .hom-fin-dimensions-grid { grid-template-columns: 1fr; }
}
