/* Company accent is read by the layout from PostgreSQL, including modal actions. */
html body .document-table>tbody>tr:hover>td,
html body .daily-rate-table tbody tr.selected td,
html body .daily-rate-table tbody tr:focus-within td,
html body .partner-search-results>button:hover { background:var(--neutral-button-bg); }
html body .history-pagination button.secondary-document {
    background:var(--neutral-button-bg);border:1px solid var(--neutral-button-border);color:var(--neutral-button-text);
}
html body .history-pagination button.secondary-document:disabled {
    opacity:1;color:color-mix(in srgb,var(--neutral-button-text) 55%,var(--neutral-button-bg));cursor:not-allowed;
}
/* Neutral actions: clear, keep, pagination, return and dialog close. */
:root { --neutral-button-bg:#e2e5e9; --neutral-button-hover:#d2d7dd; --neutral-button-border:#bbc2cb; --neutral-button-text:#374151; }
html[data-theme="dark"] { --neutral-button-bg:#3b424c; --neutral-button-hover:#4a535f; --neutral-button-border:#657080; --neutral-button-text:#f1f3f5; }
html body :is(button.secondary-document,.json-modal>header>button,.graph-header>button,button.udf-close) {
    background:var(--neutral-button-bg); color:var(--neutral-button-text); border:1px solid var(--neutral-button-border);
    transition:background-color .15s ease,border-color .15s ease;
}
html body :is(button.secondary-document,.json-modal>header>button,.graph-header>button,button.udf-close):hover:not(:disabled) { background:var(--neutral-button-hover); }
html body :is(button.secondary-document,.json-modal>header>button,.graph-header>button,button.udf-close):focus-visible { outline:2px solid var(--neutral-button-text);outline-offset:2px; }
html body :is(button.secondary-document,.json-modal>header>button,.graph-header>button,button.udf-close):disabled { opacity:.5;cursor:not-allowed; }

/* Los SVG del menú se generan dinámicamente y no reciben el atributo de CSS isolation. */
.sidebar .submodule-icon { color:#fff; }
.sidebar .submodule-icon svg { width:14px;height:14px;display:block;fill:none!important;stroke:#fff!important;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.sidebar .submodule-icon svg * { fill:none!important;stroke:#fff!important; }
.udf-expand-button svg { width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
html[data-theme="dark"] { --udf-surface:#202e3e; }
.page-content:has(.document-view-page) { max-width:none;padding:20px; }
.full-document-view .viewer-header,.full-document-view .viewer-summary { max-height:none !important;overflow:visible !important; }
.full-document-view>.document-table-wrap { display:block;min-height:160px;max-height:65vh;overflow:auto;margin:16px 20px; }
.full-document-view .document-table thead th { position:sticky;top:0;z-index:1;background:#f3f6fa; }
html[data-theme="dark"] .full-document-view .document-table thead th { background:#263548; }
.full-document-view .document-titlebar h2 { margin:0; }
@media(max-width:700px){.full-document-view .document-titlebar{flex-wrap:wrap;gap:12px;}.full-document-view .document-table{min-width:950px;}}
.sales-form-viewer .viewer-header { flex:0 0 auto;max-height:26vh;overflow:auto; }
.sales-form-viewer .viewer-title-actions { display:flex;align-items:center;gap:14px; }
.sales-form-viewer .document-tabs { flex:0 0 auto; }
.sales-form-viewer .viewer-summary { flex:0 0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,380px);gap:24px;max-height:32vh;overflow:auto;padding:18px 24px; }
.sales-form-viewer .document-notes textarea { min-height:70px;resize:none; }
.sales-form-viewer .document-header input[readonly] { cursor:default; }
@media(max-width:700px){.sales-form-viewer .viewer-summary{grid-template-columns:1fr;max-height:35vh;padding:12px;gap:14px;}.sales-form-viewer .viewer-header{max-height:23vh;}}
.json-modal.sales-detail-modal.document-view-modal { width:94vw;max-width:94vw;height:90vh;height:90dvh;max-height:90dvh; }
.document-view-modal>header,.document-view-modal>footer { flex:0 0 auto; }
.document-view-modal>.sale-detail-header { flex:0 0 auto;max-height:23vh;overflow:auto; }
.json-modal.document-view-modal>.document-table-wrap { flex:1 1 auto;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;margin:12px 20px; }
.document-view-modal .document-table thead th { position:sticky;top:0;z-index:1;background:#f3f6fa; }
html[data-theme="dark"] .document-view-modal .document-table thead th { background:#263548; }
.json-modal.document-view-modal>footer { align-items:center;gap:22px; }
.document-view-modal>footer>button { flex:0 0 auto; }
@media(max-width:700px){.json-modal.document-view-modal>footer{flex-wrap:wrap;gap:10px;padding:12px;max-height:35dvh;overflow:auto;}.document-view-modal>.sale-detail-header{padding:12px;}.json-modal.document-view-modal>.document-table-wrap{margin:8px;}}
.app-theme-scope .operations-metrics .metric.accent,
html[data-theme="dark"] .app-theme-scope .operations-metrics .metric.accent {
    background: linear-gradient(145deg, var(--company-accent), color-mix(in srgb, var(--company-accent) 80%, white));
    color: #fff;
    border-color: var(--company-accent);
}
.app-theme-scope .operations-metrics .metric.accent span,
.app-theme-scope .operations-metrics .metric.accent small { color: #fff4e6; }
.app-theme-scope .primary-document,
.app-theme-scope .action-button,
.app-theme-scope .confirm-password,
.app-theme-scope .save-rate,
.app-theme-scope .line-entry > button,
.app-theme-scope .partner-search-control button {
    background: linear-gradient(135deg, color-mix(in srgb, var(--company-accent) 80%, white), var(--company-accent));
    color: white;
    border-color: var(--company-accent);
}
.app-theme-scope .operations-button,
.app-theme-scope .view-document,
.app-theme-scope .view-document.payment-document {
    background: var(--company-accent);
    color: white;
}
.app-theme-scope .view-document:hover { background: color-mix(in srgb, var(--company-accent) 80%, black); }
.app-theme-scope .partner-search-results { background: #f3f4f6; }
.app-theme-scope .partner-search-results > button {
    background: #f3f4f6;
    color: #263445;
    border-color: #dde1e6;
    border-radius: 0;
}
.app-theme-scope .partner-search-results > button:hover,
.app-theme-scope .partner-search-results > button:focus-visible { background: #e5e7eb; }
.app-theme-scope .partner-search-results strong { color: #354457; }
.app-theme-scope .partner-search-results small { color: #596575; }
.app-theme-scope button:disabled { cursor: not-allowed; }
html[data-theme="dark"] { color-scheme: dark; --ink: #e3eaf3; --muted: #a5b2c3; --line: #344154; --paper: #111923; }
html[data-theme="dark"] body { background: #111923; color: #e3eaf3; }
html[data-theme="dark"] :is(.topbar,.panel,.metric,.sap-document,.json-modal,.confirm-modal,.user-dropdown,.user-dropdown>button,.login-panel) { background: #1b2634; color: #e3eaf3; border-color: #344154; }
html[data-theme="dark"] :is(.document-titlebar,.document-header,.document-actions,.document-tabs,.document-footer,.history-filters,.line-entry,.sale-detail-header,.partner-detail-grid,.item-master-tab,.json-modal>footer,.relationship-column) { background: #202e3e; color: #e3eaf3; border-color: #344154; }
html[data-theme="dark"] :is(input,select,textarea),
html[data-theme="dark"] .item-master-tab .customer-block>label { background: #152130; color: #e3eaf3; border-color: #48586d; }
html[data-theme="dark"] :is(input,select,textarea):disabled,
html[data-theme="dark"] input[readonly] { background: #253243; color: #a5b2c3; }
html[data-theme="dark"] :is(.secondary-document,.cancel-button,.user-menu-button,.mobile-menu,.row-options summary) { background: #253243; color: #e3eaf3; border-color: #48586d; }
html[data-theme="dark"] .document-table th { background: #2a394b; color: #dce5f1; border-color: #48586d; }
html[data-theme="dark"] .document-table td { border-color: #344154; }
html[data-theme="dark"] .document-table>tbody>tr:hover>td,
html[data-theme="dark"] .daily-rate-table tbody tr.selected td,
html[data-theme="dark"] .daily-rate-table tbody tr:focus-within td { background: #354355; }
html[data-theme="dark"] :is(.code-cell,.eyebrow,.total-cell,.grand-total,.document-status,.sale-detail-header strong,.partner-detail-grid strong) { color: #cadcf4 !important; }
html[data-theme="dark"] :is(.history-message,.page-heading p,.document-header label,.line-entry label,.history-filters label,.document-notes label,.document-totals>div,.rate-legend,.daily-rate-cell span,.daily-rate-cell label,.exchange-toolbar label,.sale-detail-header small,.confirm-modal p) { color: #b6c2d2; }
html[data-theme="dark"] .row-options>div { background: #1b2634; border-color: #48586d; }
html[data-theme="dark"] .row-options>div button { color: #e3eaf3; }
html[data-theme="dark"] :is(.row-options>div button:hover,.user-dropdown>button:hover) { background: #354355; }
html[data-theme="dark"] :is(.relationship-grid .relationship-node,.relationship-links>div) { background: #253243; color: #e3eaf3; }
html[data-theme="dark"] :is(.relationship-node span,.relationship-node time,.relationship-node small,.relationship-node b,.relationship-links time) { color: #b6cce7; }
html[data-theme="dark"] .modal-backdrop { background: #0009; }
html[data-theme="dark"] .service-layer-result h2 { color: #e3eaf3; }
html[data-theme="dark"] .service-layer-result p { color: #b6c2d2; }
