/* Accounting work surfaces: the operational dashboard palette follows the active theme. */
body[data-sysimple-shell] .acc-shell > .acc-module-heading[data-module-banner] {
    border-left: 4px solid var(--acc-brand)!important;
    background: linear-gradient(105deg, color-mix(in srgb, var(--acc-brand) 9%, var(--acc-panel-bg)), var(--acc-panel-bg) 65%)!important;
}
body .acc-module-heading h1 { font-weight: 650; }
body .acc-module-heading p { color: var(--acc-muted); }
body .acc-toolbar { background: var(--acc-panel-bg); border-bottom: 2px solid color-mix(in srgb, var(--acc-brand) 45%, var(--acc-stroke)); }
body .acc-toolbar h2 { font-weight: 650; }
body .acc-eyebrow { letter-spacing: .045em; }
body .acc-nav-panel { background: var(--acc-panel-bg); }
body .acc-nav-group h3 { color: var(--acc-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .055em; }
body .acc-period-card { border-left: 3px solid var(--acc-brand); background: color-mix(in srgb, var(--acc-brand) 5%, var(--acc-panel-bg)); }
body .acc-panel { box-shadow: 0 2px 6px #00000008; }
body .acc-panel-head { background: color-mix(in srgb, var(--acc-brand) 3%, var(--acc-panel-bg)); }
body[data-theme] .acc-workspace .acc-kpi { border-top: 3px solid var(--acc-brand)!important; box-shadow: 0 2px 6px #00000008; }
body .acc-table { background: var(--acc-panel-bg); }
body .acc-table th { color: var(--acc-muted); background: var(--acc-surface-bg); }
body .acc-table td { border-bottom-color: color-mix(in srgb, var(--acc-stroke) 55%, var(--acc-panel-bg)); }
body .acc-table tr:last-child td { border-bottom: 0; }

#bankWorkspace > .acc-panel-head { padding: 14px 0 8px; background: transparent; border: 0; }
#bankWorkspace > .acc-panel-head h3 { font-size: 18px; font-weight: 650; margin: 0; overflow-wrap: anywhere; }
#bankWorkspace .bank-statement-context { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--acc-muted); font-size: 12px; margin: 0 0 14px; }
#bankWorkspace .bank-state { display: inline-flex; gap: 7px; align-items: center; padding: 5px 9px; border: 1px solid var(--acc-stroke); color: var(--acc-text); background: var(--acc-panel-bg); font-weight: 600; border-radius: 3px; }
#bankWorkspace .bank-state.is-final { border-color: color-mix(in srgb, var(--acc-good) 45%, var(--acc-stroke)); }
#bankWorkspace .bank-state.is-final i { color: var(--acc-good); }
#bankWorkspace .bank-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) minmax(185px,1.2fr); padding: 0; gap: 0; border: 1px solid var(--acc-stroke); background: var(--acc-panel-bg); box-shadow: 0 2px 6px #00000008; }
#bankWorkspace .bank-metric { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px; border-right: 1px solid var(--acc-stroke); }
#bankWorkspace .bank-metric > span { font-size: 12px; color: var(--acc-muted); }
#bankWorkspace .bank-metric > strong { font-size: clamp(17px,1.5vw,24px); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#bankWorkspace .bank-difference { border: 0; border-top: 3px solid var(--acc-brand); padding-top: 13px; background: color-mix(in srgb,var(--acc-brand) 7%,var(--acc-panel-bg)); }
#bankWorkspace .bank-difference[data-balance-state=balanced] { border-top-color: var(--acc-good); background: color-mix(in srgb,var(--acc-good) 8%,var(--acc-panel-bg)); }
#bankWorkspace .bank-difference[data-balance-state=difference] { border-top-color: var(--acc-warn); background: color-mix(in srgb,var(--acc-warn) 8%,var(--acc-panel-bg)); }
#bankWorkspace .bank-difference small { font-size: 11px; color: var(--acc-text); }
#bankWorkspace .bank-difference small i { margin-right: 4px; }
#bankWorkspace .bank-metric:nth-child(1) { --bank-metric-color:#287caf; }
#bankWorkspace .bank-metric:nth-child(2) { --bank-metric-color:#7555b5; }
#bankWorkspace .bank-metric:nth-child(3) { --bank-metric-color:#b96516; }
#bankWorkspace .bank-metric:nth-child(4) { --bank-metric-color:#008a70; }
#bankWorkspace .bank-metric.bank-difference { --bank-metric-color:var(--acc-brand); }
#bankWorkspace .bank-difference[data-balance-state=balanced] { --bank-metric-color:var(--acc-good); }
#bankWorkspace .bank-difference[data-balance-state=difference] { --bank-metric-color:var(--acc-warn); }
#bankWorkspace .bank-metric {
    border-top:3px solid var(--bank-metric-color);
    background:color-mix(in srgb,var(--bank-metric-color) 24%,var(--acc-panel-bg));
    padding-top:13px;
}
#bankWorkspace .bank-metric > span { color:var(--acc-text); }
#bankWorkspace .bank-metric > strong { color:color-mix(in srgb,var(--bank-metric-color) 65%,var(--acc-text)); }
#bankWorkspace .bank-balances { gap: 12px; padding: 14px; margin-top: 12px; background: var(--acc-panel-bg); border: 1px solid var(--acc-stroke); }
#bankWorkspace .bank-balances label { font-size: 12px; color: var(--acc-muted); }
#bankWorkspace .bank-balances input:disabled { opacity: 1; background: var(--acc-surface-bg); color: var(--acc-text); border-color: transparent; }
#bankWorkspace .bank-readonly-balances { display: flex; flex-wrap: wrap; gap: 12px 30px; margin: 0; padding: 12px 0 4px; }
#bankWorkspace .bank-readonly-balances > div { display: flex; gap: 8px; align-items: baseline; }
#bankWorkspace .bank-readonly-balances dt { font-size: 12px; color: var(--acc-muted); }
#bankWorkspace .bank-readonly-balances dd { margin: 0; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
#bankWorkspace [data-lifecycle].acc-list-toolbar { justify-content: flex-start; gap: 8px; padding: 8px 0 14px; border: 0; background: transparent; min-height: 0; }
#bankWorkspace .bank-data-section { margin: 0 0 16px; border: 1px solid var(--acc-stroke); background: var(--acc-panel-bg); box-shadow: 0 2px 6px #00000008; min-width: 0; }
#bankWorkspace .bank-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--acc-stroke); }
#bankWorkspace .bank-section-heading h4 { margin: 3px 0 0; font-size: 15px; font-weight: 650; }
#bankWorkspace .bank-progress { display: grid; gap: 5px; width: 160px; flex-shrink: 0; font-size: 11px; color: var(--acc-muted); }
#bankWorkspace progress { appearance: none; width: 100%; height: 5px; border: 0; background: var(--acc-surface-bg); accent-color: var(--acc-good); }
#bankWorkspace progress::-webkit-progress-bar { background: var(--acc-surface-bg); }
#bankWorkspace progress::-webkit-progress-value { background: var(--acc-good); }
#bankWorkspace progress::-moz-progress-bar { background: var(--acc-good); }
#bankWorkspace .bank-section-tools.acc-list-toolbar { justify-content: flex-start; min-height: 0; border: 0; padding: 8px 14px; margin: 0; background: var(--acc-panel-bg); }
#bankWorkspace .bank-section-tools label { display: flex; align-items: center; gap: 8px; }
#bankWorkspace .bank-section-tools select { max-width: 360px; }
#bankWorkspace .bank-pager.acc-list-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 6px; border: 0; border-top: 1px solid var(--acc-stroke); margin: 0; padding: 8px 12px; min-height: 0; background: var(--acc-panel-bg); }
#bankWorkspace .bank-pager > span { margin-right: auto; color: var(--acc-muted); font-size: 12px; }
#bankWorkspace .acc-table table { min-width: 620px; }
#bankWorkspace .acc-table:focus-visible { outline: 2px solid var(--acc-brand); outline-offset: -2px; }
#bankWorkspace .acc-table th.acc-num { text-align: right; }
#bankWorkspace .acc-table td { padding: 11px 14px; }
#bankWorkspace .acc-table td:first-child:empty { width: 12px; padding: 0; }
#bankWorkspace .acc-table td.acc-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
#bankWorkspace .bank-match-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; white-space: nowrap; }
#bankWorkspace .bank-match-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--acc-warn); }
#bankWorkspace .bank-match-state[data-matched=true]::before { background: var(--acc-good); }
#bankWorkspace :is(input,select,button,summary):focus-visible { outline: 2px solid var(--acc-brand); outline-offset: 2px; }
@media(max-width:1100px) {
    #bankWorkspace .bank-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    #bankWorkspace .bank-metric { border-bottom: 1px solid var(--acc-stroke); }
    #bankWorkspace .bank-metric:nth-child(even) { border-right: 0; }
    #bankWorkspace .bank-difference { grid-column: 1/-1; border-bottom: 0; }
}
@media(max-width:600px) {
    #bankWorkspace .bank-metric { padding: 12px; }
    #bankWorkspace .bank-section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    #bankWorkspace .bank-progress { width: 100%; }
    #bankWorkspace .bank-balances { grid-template-columns: minmax(0,1fr); }
    #bankWorkspace .bank-section-tools select { max-width: 100%; }
    #bankWorkspace .bank-pager button { min-width: 44px; min-height: 44px; }
}

/* Shared spacing for supplier and purchase pagination. */
:is(#purchaseWorkspace,#supplierWorkspace) .acc-list-pagination {
    display:flex; justify-content:flex-end; align-items:center; flex-wrap:wrap;
    gap:8px; padding:12px 14px; min-height:58px;
}
:is(#purchaseWorkspace,#supplierWorkspace) .acc-list-pagination > span {
    margin-right:auto; font-weight:600; color:var(--acc-muted);
}
:is(#purchaseWorkspace,#supplierWorkspace) .acc-list-pagination > button { flex:0 0 auto; }
/* Shared metric cards: colors identify the metric; explicit states retain their meaning. */
body[data-theme] .acc-workspace .acc-kpi:nth-child(4n+1),
#housingWorkspace .housing-kpis > div:nth-child(4n+1) { --acc-metric-color:#287caf; }
body[data-theme] .acc-workspace .acc-kpi:nth-child(4n+2),
#housingWorkspace .housing-kpis > div:nth-child(4n+2) { --acc-metric-color:#b96516; }
body[data-theme] .acc-workspace .acc-kpi:nth-child(4n+3),
#housingWorkspace .housing-kpis > div:nth-child(4n+3) { --acc-metric-color:#7555b5; }
body[data-theme] .acc-workspace .acc-kpi:nth-child(4n+4),
#housingWorkspace .housing-kpis > div:nth-child(4n+4) { --acc-metric-color:#008a70; }
.acc-report-totals > div { --acc-metric-color:#287caf; }
.acc-report-totals > [data-metric-tone="good"] { --acc-metric-color:#008a70; }
.acc-report-totals > [data-metric-tone="warn"] { --acc-metric-color:#b96516; }
.acc-report-totals > [data-metric-tone="unknown"] { --acc-metric-color:var(--acc-muted); }
body[data-theme] #kpiGrid .acc-kpi,
#housingWorkspace .housing-kpis > div,
#reportContent .acc-report-totals > div {
    border:1px solid var(--acc-stroke)!important;
    border-top:3px solid var(--acc-metric-color)!important;
    border-left:4px solid var(--acc-metric-color)!important;
    background:color-mix(in srgb,var(--acc-metric-color) 24%,var(--acc-panel-bg))!important;
    color:var(--acc-text)!important;
}
body[data-theme] #kpiGrid .acc-kpi:hover {
    background:color-mix(in srgb,var(--acc-metric-color) 32%,var(--acc-panel-bg))!important;
}
body .acc-workspace .acc-kpi-head { color:var(--acc-text); }
body .acc-workspace .acc-kpi-value,
#housingWorkspace .housing-kpis > div strong,
#reportContent .acc-report-totals > div strong {
    color:color-mix(in srgb,var(--acc-metric-color) 70%,var(--acc-text));
}
#reportContent .acc-report-totals { gap:10px; }
#reportContent .acc-report-totals > div { padding:10px 12px; }

/* All owned pagers receive this class through accounting.commands.js. */
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination {
    display:flex!important; align-items:center; justify-content:flex-end!important; flex-wrap:wrap;
    gap:8px!important; padding:12px 14px!important; margin:0!important; min-height:58px!important;
    border:1px solid var(--acc-stroke); border-top:1px solid var(--acc-stroke);
    background:var(--acc-panel-bg); font-size:12px;
}
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination > span {
    order:-1; flex:1 1 120px; margin-right:auto; font-weight:600;
    color:var(--acc-muted); font-variant-numeric:tabular-nums;
}
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination > :is(div,label) {
    display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap;
}
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination :is(button,select) {
    min-height:34px; flex:0 0 auto;
}
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination button { min-width:34px; }
@media(max-width:600px) {
    :is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination :is(button,select) { min-height:44px; }
    :is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination button { min-width:44px; }
}
.acc-report-totals > [data-metric-tone=cost] { --acc-metric-color:#b96516; }
.acc-report-totals > [data-metric-tone=structure] { --acc-metric-color:#7555b5; }
.acc-report-totals > [data-metric-tone=flow] { --acc-metric-color:#008a70; }

@media(max-width:600px) {
    :is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination > span {
        flex:1 0 100%; width:100%;
    }
}
/* Live portal review: keep disabled page controls and bank differences consistent. */
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination button:disabled {
    opacity:.45!important; cursor:default!important; box-shadow:none!important;
}
#bankWorkspace .bank-metric.bank-difference[data-balance-state] {
    background:color-mix(in srgb,var(--bank-metric-color) 24%,var(--acc-panel-bg));
    border-top-color:var(--bank-metric-color);
}
/* Journal form controls must not stretch/wrap the page-size selector. */
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination label {
    display:inline-flex!important; flex-direction:row!important; flex-wrap:nowrap!important;
    align-items:center; gap:8px; white-space:nowrap;
}
:is(.acc-shell,.acc-modal,.acc-extension-panel) .acc-list-pagination select {
    width:68px!important; flex:0 0 68px!important; padding:3px 6px;
}
/* Document editing: one working surface, without nested decorative frames. */
.acc-document-editor-shell .acc-modal.acc-document-editor {
    border:0; box-shadow:none; background:var(--acc-panel-bg);
}
.acc-document-editor-shell .acc-document-editor .acc-modal-head {
    border:0; background:transparent; padding:12px 20px 0;
}
.acc-document-editor-shell .acc-document-editor .acc-document-body { gap:18px; padding:16px 20px; }
.acc-document-editor .acc-document-card {
    border:0; box-shadow:none; background:transparent; padding:0;
}
.acc-document-editor .acc-document-lines {
    border:0; background:transparent; padding:0; gap:10px;
}
.acc-document-editor .acc-document-lines-head { border:0; padding:0; }
.acc-document-editor .acc-customer-summary {
    border:0; box-shadow:none; background:transparent; padding:4px 0;
}
.acc-document-editor .acc-document-total {
    border-top:1px solid color-mix(in srgb,var(--acc-stroke) 40%,transparent);
    padding-top:12px;
}
.acc-document-editor-shell .acc-document-editor .acc-modal-actions {
    border:0; box-shadow:none; padding:10px 20px;
}
@media(max-width:600px) {
    .acc-document-editor-shell .acc-document-editor .acc-modal-head { padding:12px 12px 0; }
    .acc-document-editor-shell .acc-document-editor .acc-document-body { padding:14px 12px; }
    .acc-document-editor-shell .acc-document-editor .acc-modal-actions { padding:10px 12px; }
}
/* Customer search results are a list, not a stack of framed buttons. */
.acc-document-editor .acc-customer-results {
    display:flex!important; flex-direction:column; gap:0;
    border:0!important; box-shadow:none!important; border-radius:0;
    background:transparent; padding:0;
}
html body[data-theme] :is(#quoteEditorPanel,#invoiceEditorPanel) .acc-document-editor .acc-customer-results .acc-customer-option {
    display:grid!important; grid-template-columns:30px minmax(0,1fr) 24px;
    grid-template-rows:auto; flex:0 0 auto;
    height:auto!important; min-height:60px!important; max-height:none!important;
    border:0!important; border-radius:0!important; box-shadow:none!important;
    padding:10px 8px!important; gap:10px; background:transparent;
    white-space:normal; text-align:left;
}
html body[data-theme] :is(#quoteEditorPanel,#invoiceEditorPanel) .acc-document-editor .acc-customer-option:hover,
html body[data-theme] :is(#quoteEditorPanel,#invoiceEditorPanel) .acc-document-editor .acc-customer-option.is-selected {
    background:color-mix(in srgb,var(--acc-brand) 10%,var(--acc-panel-bg))!important;
}
.acc-document-editor .acc-customer-option .acc-customer-option-main {
    min-width:0; height:auto; overflow:visible;
}
.acc-document-editor .acc-customer-option-main :is(strong,em) {
    white-space:normal!important; overflow:visible; overflow-wrap:anywhere;
}
.acc-document-editor .acc-customer-option .acc-customer-avatar {
    border:0; box-shadow:none; background:transparent;
}
.acc-document-editor .acc-customer-option:focus-visible {
    outline:2px solid var(--acc-brand); outline-offset:-2px;
}
.acc-product-picker { display:grid; gap:4px; min-width:0; }
.acc-product-picker > input[type=search] { width:100%; min-width:0; }
.acc-product-search-status { color:var(--acc-muted); font-size:11px; line-height:1.35; }
.acc-product-search-status[hidden] { display:none; }
/* Reserve a real edge for the workspace scrollbar, including overlay scrollbars. */
@media (min-width:681px) {
    .acc-workspace > .acc-view.is-active {
        box-sizing:border-box;
        scrollbar-gutter:stable;
        padding-inline-end:12px;
        scroll-padding-block:12px;
    }
}
/* Shared table headers follow the alignment of their body column. */
body :is(.acc-shell,.acc-modal,.acc-extension-panel) th[data-acc-column-align=right] { text-align:right!important; }
body :is(.acc-shell,.acc-modal,.acc-extension-panel) th[data-acc-column-align=left] { text-align:left!important; }
body :is(.acc-shell,.acc-modal,.acc-extension-panel) th[data-acc-column-align=center] { text-align:center!important; }
body :is(.acc-shell,.acc-modal,.acc-extension-panel) th[data-acc-column-align] > button { text-align:inherit; }
body :is(.acc-shell,.acc-modal,.acc-extension-panel) th[data-acc-column-align=right] > button { justify-content:flex-end; }
body :is(.acc-shell,.acc-modal,.acc-extension-panel) th[data-acc-column-align=center] > button { justify-content:center; }

/* Overview items use a quiet surface rather than individual button frames. */
.acc-view[data-view-panel="overview"] .acc-flow { gap:6px;padding:10px 12px; }
@layer sysimple-actions {
html body[data-theme] .acc-shell .acc-view[data-view-panel="overview"] :is(.acc-flow-item,.acc-overview-entry,#kpiGrid .acc-kpi) {
    border:0!important;
    box-shadow:none!important;
    border-radius:3px;
    background:color-mix(in srgb,var(--acc-text) 4%,var(--acc-panel-bg))!important;
}
html body[data-theme] .acc-shell .acc-view[data-view-panel="overview"] :is(.acc-flow-item,#kpiGrid .acc-kpi):hover {
    background:color-mix(in srgb,var(--acc-brand) 10%,var(--acc-panel-bg))!important;
}
html body[data-theme] .acc-shell .acc-view[data-view-panel="overview"] :is(.acc-flow-item,#kpiGrid .acc-kpi):focus-visible {
    outline:2px solid var(--acc-brand);
    outline-offset:-2px;
}

}
