/* esmartbooks final theme layer: the one place for screen-wide overrides.
   Loaded after every module stylesheet. Print and document paper keep their own styles.
   Sections keep their original cascade order:
     1. Dark-mode tokens and contrast   (was dark-global-fix.css)
     2. Global menu surfaces            (was workspace-menu-repair.css)
     3. Phone layout                    (was mobile-unified.css)
     4. Control and text contrast       (was contrast-system.css)
     5. Brand palette                   (was brand-theme.css)
   Put new screen-wide overrides in the matching section instead of adding another file. */

/* ===== Dark-mode tokens and contrast ===== */
/* Navigation icon geometry is independent of viewport and sidebar state. */
@media screen {
 html body[data-auth-state="authenticated"] aside.sidebar #nav#nav .nav-item .nav-svg {
  display:block!important;width:18px!important;height:18px!important;
  min-width:18px!important;max-width:18px!important;min-height:18px!important;max-height:18px!important;
  flex:0 0 18px!important;color:inherit!important;stroke:currentColor!important;
 }
 html body[data-auth-state="authenticated"] aside.sidebar #nav#nav .nav-item>span:first-child {color:inherit!important}
 html body[data-auth-state="authenticated"] aside.sidebar :is(.nav-section-label,.nav-group-title) {color:#b8c8d9!important;opacity:1!important}
 html body[data-auth-state="authenticated"] #global-menubar#global-menubar svg.menu-svg {
  display:block!important;width:18px!important;height:18px!important;
  min-width:18px!important;max-width:18px!important;min-height:18px!important;max-height:18px!important;
  flex:0 0 18px!important;
 }
}
@media screen and (min-width:769px) {
 html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon {display:none!important}
}
/* Final dark-mode contrast rules. Screen UI only; public pages and document paper
   keep their own palettes. Load after module and public styles. */
@media screen {
html[data-theme="dark"] body[data-auth-state="authenticated"] {
  color-scheme: dark;
  --dark-canvas: #071422;
  --dark-surface: #0e2136;
  --dark-raised: #18334c;
  --dark-input: #091a2b;
  --dark-text: #eef4fb;
  --dark-muted: #b8c8d9;
  --dark-border: #63829e;
  --dark-action: #16365c;
  --dark-action-hover: #234a70;
  --dark-link: #91c6ff;
  --dark-focus: #8ac6ff;
  --bg: var(--dark-canvas);
  --panel: var(--dark-surface);
  --surface: var(--dark-surface);
  --surface-2: var(--dark-raised);
  --ink: var(--dark-text);
  --text: var(--dark-text);
  --muted: var(--dark-muted);
  --line: var(--dark-border);
  --border: var(--dark-border);
  --green: var(--dark-action);
  --green-dark: var(--dark-action-hover);
  --esb-ink: var(--dark-text);
  --esb-muted: var(--dark-muted);
  --esb-panel: var(--dark-surface);
  --esb-line: var(--dark-border);
  --esb-green: var(--dark-action);
  --esb-green-dark: var(--dark-action-hover);
  --esb-link: var(--dark-link);
  --books-ink: var(--dark-text);
  --books-muted: var(--dark-muted);
  --books-line: var(--dark-border);
  --books-panel: var(--dark-surface);
  --books-green: var(--dark-action);
  --books-green-dark: var(--dark-action-hover);
  --v72-text: var(--dark-text);
  --v72-muted: var(--dark-muted);
  --v72-border: var(--dark-border);
  --v72-input: var(--dark-input);
  --v72-primary: var(--dark-action);
  --v72-primary-hover: var(--dark-action-hover);
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(.panel, .card, .form-card, .metric, .kpi, .stat, .settings-card, .sb-settings-main, .cap-section, .sbpay-card, .report-main-panel, .report-kpi, .commercial-summary-card, .modal, .modal-head, .modal-body, .modal-foot, .pos-totals):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-surface) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(h1, h2, h3, h4, h5, h6, strong, b):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  color: var(--dark-text) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(label, legend, small, .muted, .side-note, .help-text, .hint, .subtitle, .empty, .loading):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  color: var(--dark-muted) !important;
  opacity: 1;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .topbar) :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]):not([type=button]):not([type=submit]), textarea, select):not(.sb-search-select > select):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-input) !important;
  color: var(--dark-text) !important;
  -webkit-text-fill-color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  color-scheme: dark;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(.btn, .icon-btn):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-raised) !important;
  color: var(--dark-text) !important;
  -webkit-text-fill-color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .sidebar) :is(.btn.primary, .commercial-primary, .report-primary, .board-primary, .create-btn, .sbpay-run):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-action) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  border-color: var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .sidebar) :is(.btn.primary, .commercial-primary, .report-primary, .board-primary, .create-btn, .sbpay-run):hover:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-action-hover) !important;
  color: #fff !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(.btn.danger, .btn.success):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-raised) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) .btn.danger:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  color: #ffaba3 !important;
  -webkit-text-fill-color: #ffaba3 !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) .btn.success:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  color: #98dfb2 !important;
  -webkit-text-fill-color: #98dfb2 !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, #global-menubar, .topbar) :is(button, input, textarea, select):disabled:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  opacity: 1 !important;
  color: var(--dark-muted) !important;
  -webkit-text-fill-color: var(--dark-muted) !important;
  background: var(--dark-surface) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, #global-menubar, .topbar) :is(a, .link):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  color: var(--dark-link) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, #global-menubar, .topbar, .sidebar) :is(button, a, input, textarea, select, [tabindex]):focus-visible:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  outline: 2px solid var(--dark-focus) !important;
  outline-offset: 2px !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(input[type=checkbox], input[type=radio]):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  accent-color: var(--dark-focus);
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) :is(table, .table-wrap, td):not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-surface) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) th:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-raised) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app, #modal-root, .modal, .sb-account-menu, .sb-more-menu, .sb-col-pop, .sb-search-select-list) tbody tr:hover > td:not(:where(.doc-print, .doc-print *, .sb-paper, .sb-paper *, .financial-sheet, .financial-sheet *, .live-sheet, .live-sheet *, .qr-document, .qr-document *, .sb-report-preview-sheet, .sb-report-preview-sheet *, .slipview-slip, .slipview-slip *, .chq-leaf, .chq-leaf *, .presentation-slide, .presentation-slide *)) {
  background: var(--dark-raised) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(.doc-print, .sb-paper, .financial-sheet, .live-sheet, .qr-document, .sb-report-preview-sheet, .chq-leaf) {
  background: #fff !important;
  color: #111827 !important;
  color-scheme: light;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(.doc-print, .sb-paper, .financial-sheet, .live-sheet, .qr-document, .sb-report-preview-sheet, .chq-leaf) :is(h1, h2, h3, h4, p, small, strong, b, td, th, label) {
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
}
/* Light paper uses dark links; dark dashboard data marks need a bright fill. */
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(.doc-print, .sb-paper, .financial-sheet, .live-sheet, .qr-document, .sb-report-preview-sheet, .chq-leaf) a {
  color: #16365c !important;
  -webkit-text-fill-color: #16365c !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app.route-dashboard, #app .route-dashboard) .esb-rank i {
  background: var(--dash-income, #8ac6ff) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app.route-dashboard, #app .route-dashboard) .esb-rank i.loss {
  background: #ffaba3 !important;
}
}
/* Keep process links and customer controls readable on the dark canvas. */
@media screen {
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-search-mark {
  background: transparent !important;
  border-color: var(--dark-text) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-search-mark::after {
  background: var(--dark-text) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app :is(.sb-bank-card-top button, .sb-sales-path button, .center-ledger-link) {
  color: var(--dark-link) !important;
  -webkit-text-fill-color: var(--dark-link) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app .center-detail > .center-actions {
  background: var(--dark-surface) !important;
  border-color: var(--dark-border) !important;
}


}

/* Report screen colors are separate from white print/preview paper.
   Reset inherited text-fill as well as color: Chromium otherwise paints
   dark document ink over the dark table even when computed color is light. */
@media screen {
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#app .sb-reports-controller, #modal-root .sb-report-customizer, #modal-root .sb-custom-builder) {
  --rpt-ink:var(--dark-text); --rpt-muted:var(--dark-muted);
  --rpt-blue:var(--dark-link); --rpt-line:var(--dark-border);
  --rpt-soft:var(--dark-raised); --rpt-white:var(--dark-surface);
  --rpt-green:var(--dark-action); --rpt-green-dark:var(--dark-action-hover);
  color:var(--dark-text); -webkit-text-fill-color:currentColor;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app .sb-reports-controller *,
html[data-theme="dark"] body[data-auth-state="authenticated"] #modal-root :is(.sb-report-customizer, .sb-custom-builder) * {
  -webkit-text-fill-color:currentColor !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(.sb-paper, .financial-sheet, .financial-statement, .report-table, .table-wrap, .sb-ledger-group, .sb-customer-group) {
  background:var(--dark-surface) !important; color:var(--dark-text) !important;
  border-color:var(--dark-border) !important; color-scheme:dark;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(h1,h2,h3,h4,h5,h6,p,span,strong,b,td,th,label,div,li) {
  color:var(--dark-text) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(small,em,.muted,.fs-notes,.fs-detail,.fs-expand-hint,.esb-software-stamp,.sb-masthead p,.sb-masthead small,.sb-customer-group h4 small) {
  color:var(--dark-muted) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(a,button.fs-account-no,button.fs-amount-link,.is-interactive h3) {
  color:var(--dark-link) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(td,th) {
  border-color:var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(thead th,tfoot td,.fs-section td,.fs-subsection td) {
  background:var(--dark-raised) !important; color:var(--dark-text) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(.fs-subtotal,.fs-grand,.fs-net) td {
  background:var(--dark-raised) !important; border-color:var(--dark-muted) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output tbody tr:hover > td {
  background:var(--dark-raised) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(.fs-highlights article,.sb-report-kpis span,.sb-compare-kpis article,.empty,.loading,.financial-warning) {
  background:var(--dark-raised) !important; color:var(--dark-text) !important; border-color:var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(.sb-compare-kpis .up b,.fs-balanced) {
  color:#98dfb2 !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app #sb-report-output :is(.sb-compare-kpis .down b,.financial-warning) {
  color:#ffaba3 !important;
}


html[data-theme="dark"] body[data-auth-state="authenticated"] #app :is(.sb-report-star,.sb-report-group-title,.sb-report-name,.sb-report-card h4) {
  color:var(--dark-link) !important; -webkit-text-fill-color:currentColor !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app .sb-report-star.on {color:#f3cc77 !important}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app .sb-report-group-title::before {border-top-color:var(--dark-muted)}
html[data-theme="dark"] body[data-auth-state="authenticated"] #app .sb-report-group-section.is-collapsed .sb-report-group-title::before {border-left-color:var(--dark-muted);border-top-color:transparent}
html[data-theme="dark"] body[data-auth-state="authenticated"] #modal-root :is(.sb-custom-tools,.sb-custom-section-head,.sb-view-options,.sb-view-columns label,.sb-report-filter-row) {
  background:var(--dark-surface) !important; color:var(--dark-text) !important; border-color:var(--dark-border) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] #modal-root :is(.sb-custom-intro,.sb-custom-section-head,.sb-customizer-head) p {
  color:var(--dark-muted) !important;
}

}

/* Shared module surfaces and active states found by the real-page audit. */
@media screen {
html[data-theme="dark"] body[data-auth-state="authenticated"] #app :is(.sb-paybills-pay,.sb-receive-more),
html[data-theme="dark"] body[data-auth-state="authenticated"] #modal-root .sb-custom-builder {
  background:var(--dark-surface) !important; color:var(--dark-text) !important;
  border-color:var(--dark-border) !important;
}


html[data-theme="dark"] body[data-auth-state="authenticated"] #app .esb-dash-big.amount-display {
  color:var(--dark-text) !important; -webkit-text-fill-color:currentColor !important;
}
}

@media screen {
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-account-who span {
  color:var(--dark-muted) !important;
  -webkit-text-fill-color:currentColor !important;
  overflow-wrap:anywhere;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-account-menu button {
  color:var(--dark-text) !important;
  -webkit-text-fill-color:currentColor !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-account-menu [data-acct="out"] {
  color:#ffb4ab !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-account-menu button:is(:hover,:focus-visible) {
  background:var(--dark-raised) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] .sb-account-menu button:focus-visible {
  outline:2px solid var(--dark-focus);
  outline-offset:-2px;
}
}

/* Printing reports uses paper colors regardless of the workspace theme. */
@media print {
html[data-theme="dark"] body[data-auth-state="authenticated"],
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(main,#app,.sb-reports-controller,.sb-report-result,#sb-report-output) {
  background:#fff !important; color:#111827 !important; color-scheme:light;
}
html body #app #sb-report-output,
html body #app #sb-report-output :is(.sb-paper,.financial-sheet,.financial-statement,.report-table,.table-wrap,thead,tbody,tfoot,tr,th,td,.sb-report-kpis span,.sb-compare-kpis article,.fs-highlights article) {
  background:#fff !important; color:#111827 !important; border-color:#475569 !important;
}
html body #app #sb-report-output * {
  color:#111827 !important; -webkit-text-fill-color:currentColor !important;
}
}

/* ===== Global menu surfaces ===== */
/* Shared menu surfaces must use foreground and background from the same theme. */
html body[data-auth-state="authenticated"] #global-menubar .global-menu-popup {
  background:var(--books-panel) !important;
  color:var(--books-ink) !important;
  border-color:var(--books-line) !important;
}
html body[data-auth-state="authenticated"] #global-menubar :is(.global-menu-item,.global-menu-subheading,.lists-menu-link) {
  color:var(--books-ink) !important;
  -webkit-text-fill-color:currentColor !important;
}
html body[data-auth-state="authenticated"] #global-menubar .global-menu-subheading {
  color:var(--books-muted) !important;
}
html body[data-auth-state="authenticated"] #global-menubar :is(.global-menu-item,.lists-menu-link):is(:hover,:focus-visible) {
  background:var(--books-hover) !important;
  color:var(--books-ink) !important;
}
html body[data-auth-state="authenticated"] #global-menubar .global-menu-item svg {
  color:inherit !important;
}
html body[data-auth-state="authenticated"] #global-menubar .global-menu:not(.open) > .global-menu-popup {
  display:none !important;
  visibility:hidden !important;
  pointer-events:none !important;
}
html body[data-auth-state="authenticated"] #global-menubar .global-menu.open[data-sb-popup="fixed"] > .global-menu-popup {
  position:fixed !important;
  left:var(--sb-popup-left,8px) !important;
  top:var(--sb-popup-top,36px) !important;
  right:auto !important;
  min-width:0 !important;
  max-width:calc(100vw - 16px) !important;
  max-height:var(--sb-popup-height,70vh) !important;
  overflow:auto !important;
}
html body[data-auth-state="authenticated"] header.topbar :is(.icon-btn,.theme-toggle,.avatar) {
  background:var(--books-panel) !important;
  color:var(--books-ink) !important;
  -webkit-text-fill-color:currentColor !important;
  border-color:var(--books-line) !important;
}

/* Reports has one layout owner. Desktop dropdowns scroll locally;
   the mobile menu keeps its existing full-width accordion behavior. */
html body[data-auth-state="authenticated"] #global-menubar .reports-menu.open > .global-menu-popup,
html body[data-auth-state="authenticated"] #global-menubar .reports-menu.open.has-menu-cols > .global-menu-popup,
html body[data-auth-state="authenticated"] #global-menubar .reports-menu.open[data-sb-popup="fixed"] > .global-menu-popup {
  display:block !important;
  grid-template-columns:none !important;
  grid-auto-flow:row !important;
  columns:auto !important;
  height:auto !important;
  min-height:0 !important;
  padding:8px !important;
  overscroll-behavior:contain;
}
html body[data-auth-state="authenticated"] #global-menubar .reports-menu :is(.menu-lead,.menu-colpack,.menu-col) {
  display:block !important;
  width:auto !important;
  min-width:0 !important;
  height:auto !important;
  margin:0 !important;
  padding:0 !important;
}
html body[data-auth-state="authenticated"] #global-menubar .reports-menu .global-menu-subheading {
  padding:12px 10px 4px;
  border-top:1px solid var(--books-line);
  font-size:10px;
  letter-spacing:.06em;
}
html body[data-auth-state="authenticated"] #global-menubar .reports-menu .global-menu-item {
  display:flex !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  white-space:normal !important;
  text-align:left;
  line-height:1.35;
}
html body[data-auth-state="authenticated"] #global-menubar .reports-menu .global-menu-item span {
  min-width:0;
  white-space:normal !important;
  overflow-wrap:anywhere;
}
@media(min-width:769px) {
  html body[data-auth-state="authenticated"] #global-menubar .reports-menu.open > .global-menu-popup,
  html body[data-auth-state="authenticated"] #global-menubar .reports-menu.open.has-menu-cols > .global-menu-popup,
  html body[data-auth-state="authenticated"] #global-menubar .reports-menu.open[data-sb-popup="fixed"] > .global-menu-popup {
    width:340px !important;
    min-width:0 !important;
    max-width:calc(100vw - 16px) !important;
    max-height:min(480px,70vh,var(--sb-popup-height,70vh)) !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
  }
  html body[data-auth-state="authenticated"] #global-menubar .reports-menu .menu-lead {
    position:sticky;
    top:-8px;
    padding:8px 0 !important;
    background:var(--books-panel);
    z-index:1;
    border-bottom:1px solid var(--books-line);
  }
}

/* ===== Phone layout ===== */
/* Phone rules that must follow the dark tokens and menu surfaces above (moved from mobile-app.css). */
@media screen and (max-width: 768px) {
html[data-theme="dark"] body[data-auth-state="authenticated"] { --muted: #bccbdc; --books-muted: #bccbdc; }
html body[data-auth-state="authenticated"] #global-menubar .global-menu.open > .global-menu-popup, html body[data-auth-state="authenticated"] #global-menubar .global-menu.open[data-sb-popup="fixed"] > .global-menu-popup { position: static !important; display: block !important; inset: auto !important; transform: none !important; width: 100% !important; min-width: 0px !important; max-width: 100% !important; max-height: none !important; margin: 0px !important; padding: 0px 0px 8px 8px !important; border: 0px !important; box-shadow: none !important; overflow: visible !important; }
}
/* Shared mobile visual system. Screen-only so accounting documents keep paper geometry. */
@media screen and (max-width:768px) {
  html body[data-auth-state="authenticated"] #app {
    --mobile-radius:18px;
    --mobile-space:16px;
    /* Summary cards: two always fit side by side on a phone. */
    --kpi-min-width:140px;
    padding:16px 12px 24px!important;
  }
  html body[data-auth-state="authenticated"] #app :is(.esb-mobile-page-hero,.esb-settings-hero,.dashboard-hero,.c360-hero,.dash-hero) {
    box-sizing:border-box!important;
    min-width:0!important;
    border:1px solid #285469!important;
    border-radius:var(--mobile-radius)!important;
    padding:14px 16px!important;
    margin:0 0 12px!important;
    background:linear-gradient(125deg,#102b46,#155563)!important;
    color:#fff!important;
    box-shadow:0 8px 24px #102b4612;
  }
  html body[data-auth-state="authenticated"] #app :is(.esb-mobile-page-hero,.esb-settings-hero,.dashboard-hero,.c360-hero,.dash-hero) :is(h2,.sb-settings-title) {
    color:#fff!important;font-size:21px!important;line-height:1.25!important;letter-spacing:-.02em!important;overflow-wrap:anywhere;margin:0!important;
  }
  html body[data-auth-state="authenticated"] #app :is(.esb-mobile-page-hero,.esb-settings-hero,.dashboard-hero,.c360-hero,.dash-hero) :is(p,.eyebrow,.sb-settings-lede,small,.esb-dash-span) {
    color:#d6e9ed!important;font-size:13px!important;line-height:1.45!important;
  }
  html body[data-auth-state="authenticated"] #app .esb-mobile-page-hero p {margin:2px 0 0!important;max-width:48ch;}
  /* Page hero: module, title and purpose on the left, the page's main action on the right. */
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero {display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:end!important;gap:10px 12px!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-text {display:grid;gap:2px;min-width:0;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero small {color:#9fdde0!important;font-size:14px!important;font-weight:700!important;letter-spacing:.08em!important;text-transform:uppercase;line-height:1.3!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-button {min-height:40px!important;padding:0 14px!important;border:0!important;border-radius:10px!important;background:#fff!important;color:#0f3b4f!important;font-weight:700!important;white-space:nowrap!important;box-shadow:0 2px 8px #0000002e;}
  @media (max-width:380px){html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero {grid-template-columns:1fr!important;align-items:start!important;}}
  html body[data-auth-state="authenticated"] #app .esb-dashboard-actions {gap:8px!important;margin-top:12px;}
  html body[data-auth-state="authenticated"] #app :is(.cards,.ex-summary,.dash-kpis,.sbpay-cost,.paycenter-ss-kpis) {
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;margin:0 0 18px!important;min-width:0;
  }
  html body[data-auth-state="authenticated"] #app :is(.cards>.metric,.ex-summary>div,.dash-kpis>div,.sbpay-cost>div,.paycenter-ss-kpis>div) {
    min-width:0!important;box-sizing:border-box;border:1px solid var(--line)!important;border-radius:16px!important;padding:16px 12px!important;background:var(--panel)!important;color:var(--ink)!important;box-shadow:0 3px 12px #102b4605;
  }
  html body[data-auth-state="authenticated"] #app :is(.cards>.metric strong) {color:var(--ink)!important;font-size:clamp(18px,5vw,24px)!important;line-height:1.3!important;font-variant-numeric:tabular-nums;letter-spacing:-.025em;overflow-wrap:anywhere;}
  html body[data-auth-state="authenticated"] #app :is(.panel,.esb-dash-card,.sb-pref-card,.fs-card) {border-radius:var(--mobile-radius)!important;}
  html body[data-auth-state="authenticated"] #app :is(.page-actions,.panel-head,.commercial-register-head) {gap:12px!important;}
  html body[data-auth-state="authenticated"] #app :is(button,a,input,select,textarea):focus-visible {outline:3px solid #36b6bf!important;outline-offset:3px;}
}
@media (prefers-reduced-motion:reduce) {
  #esb-mobile-nav *,#app .esb-dash-card {scroll-behavior:auto!important;transition:none!important;}
}

/* ===== Phone hero design (approved 26 Oct 2026, mobile-hero-design.png) ===== */
@media screen and (max-width:768px) {
  /* Hero: module with icon, title, purpose, three key figures, actions. */
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero {display:block!important;position:relative;overflow:hidden;padding:18px 18px 16px!important;border-radius:22px!important;border:0!important;
    background:radial-gradient(120% 140% at 100% 0%,#1f8a8f 0%,transparent 55%),linear-gradient(135deg,#0f2a44,#14506a)!important;box-shadow:0 10px 26px #0f2a4433!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero::after {content:"";position:absolute;right:-46px;bottom:-64px;width:190px;height:190px;border-radius:50%;background:#ffffff10;pointer-events:none;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-eyebrow {display:flex!important;align-items:center;gap:8px;color:#a8e3e6!important;font-size:14px!important;font-weight:700!important;letter-spacing:.09em!important;text-transform:uppercase;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-eyebrow[hidden] {display:none!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-eyebrow i {display:grid;place-items:center;width:28px;height:28px;border-radius:9px;background:#ffffff1f;color:#fff;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-eyebrow i svg {width:16px;height:16px;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero h2 {margin:10px 0 2px!important;font-size:26px!important;line-height:1.15!important;letter-spacing:-.02em!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero p {color:#cfe6ec!important;font-size:13.5px!important;line-height:1.45!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-stats {position:relative;z-index:1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:14px 0 2px;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-stat {display:grid;justify-items:start;gap:2px;min-width:0;padding:9px 10px!important;border-radius:14px!important;border:1px solid #ffffff22!important;background:#ffffff17!important;color:#fff!important;text-align:left;box-shadow:none!important;min-height:0!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-stat b {font-size:19px!important;line-height:1.15;color:#fff!important;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-stat span {font-size:11px!important;line-height:1.3;color:#cfe6ec!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-stat.is-warn {background:#f5a6231f!important;border-color:#f5a62366!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-action {position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:8px;margin-top:14px;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-action:empty {display:none;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-button {min-height:42px!important;padding:0 16px!important;border-radius:12px!important;font-size:14px!important;}
  html body[data-auth-state="authenticated"] #app > .esb-mobile-page-hero .esb-hero-ghost {min-height:42px!important;padding:0 14px!important;border-radius:12px!important;background:#ffffff1c!important;color:#fff!important;border:1px solid #ffffff33!important;font-weight:700!important;font-size:14px!important;white-space:nowrap;}
  html body[data-auth-state="authenticated"] #app .esb-hero-mirrored.esb-hero-mirrored.esb-hero-mirrored {display:none!important;}

  /* Remaining figure cards (all pages, incl. the owner console): two columns, readable labels. */
  html body[data-auth-state="authenticated"] #app#app :is(.cards.esb-kpi-row.esb-kpi-row.esb-kpi-row,.cards.esb-owner-kpis.esb-owner-kpis.esb-owner-kpis,.platform-kpis.platform-kpis.platform-kpis) {display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;}
  html body[data-auth-state="authenticated"] #app :is(.cards,.platform-kpis) > :is(.metric,div,button) :is(small,em,span,label) {font-size:12px!important;line-height:1.35!important;}
  /* Section headings. */
  html body[data-auth-state="authenticated"] #app .panel > .panel-head :is(h2,h3) {font-size:16px!important;color:var(--ink,#0f2a44)!important;}

  /* Lists: initials, name, detail line, amount or date, status pill, actions. */
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr:not(.esb-mobile-empty-row) {display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:4px 10px!important;padding:12px!important;margin:0 0 10px!important;border:0!important;border-radius:18px!important;background:var(--panel,#fff)!important;box-shadow:0 1px 3px #0f2a440f!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td {border:0!important;padding:0!important;background:transparent!important;min-width:0!important;width:auto!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td:is(.esb-r-title,.esb-r-right,.esb-r-sub,.esb-r-status,.esb-r-actions)::before {display:none!important;content:none!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-title {order:1;flex:1 1 0!important;display:grid!important;grid-template-columns:42px minmax(0,1fr);column-gap:12px;align-items:center;font-size:15px!important;font-weight:700!important;color:#0f2a44!important;overflow:hidden;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-title > .esb-r-av {grid-row:1 / span 3;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-title > :not(.esb-r-av) {grid-column:2;display:block!important;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-title > :not(.esb-r-av):not(:first-of-type) {font-size:12px!important;font-weight:500!important;color:#64748b!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr:not(.esb-mobile-empty-row)::after {content:"";order:3;flex-basis:100%;height:0;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich .esb-r-av {flex:0 0 42px;display:grid;place-items:center;width:42px;height:42px;border-radius:13px;color:#fff;font-size:14px;font-weight:800;letter-spacing:.02em;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-right {order:2;flex:0 0 auto!important;max-width:42%;white-space:nowrap;margin-left:auto!important;text-align:right!important;font-size:14px!important;font-weight:700!important;color:#0f2a44!important;font-variant-numeric:tabular-nums;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-sub {order:4;flex:0 1 auto!important;font-size:12.5px!important;color:#64748b!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-sub:first-of-type, html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-title + td.esb-r-sub {margin-left:54px!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-sub ~ td.esb-r-sub::before {display:inline!important;content:"·"!important;margin:0 6px 0 0!important;color:#94a3b8;font-size:inherit!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-status {order:5;margin-left:auto!important;display:inline-block!important;padding:3px 9px!important;border-radius:999px!important;background:#eef2f6!important;color:#334155!important;font-size:11.5px!important;font-weight:700!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-status[data-tone="ok"] {background:#dff5ea!important;color:#13734b!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-status[data-tone="bad"] {background:#fde6e6!important;color:#a83232!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-status[data-tone="warn"] {background:#fff3d6!important;color:#8a5a00!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-status :is(.badge,.status,span) {background:transparent!important;padding:0!important;color:inherit!important;font:inherit!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-more {display:none!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-actions {order:6;flex:1 1 100%!important;display:flex!important;flex-wrap:wrap;gap:8px;margin-top:6px!important;padding-top:10px!important;border-top:1px solid #eef2f6!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich > tbody > tr > td.esb-r-actions :is(button,.btn) {min-height:38px!important;border-radius:11px!important;}
  html body[data-auth-state="authenticated"] #app table.esb-mobile-record-table.esb-rich {background:transparent!important;border:0!important;box-shadow:none!important;}

  /* Filters as chips. */
  html body[data-auth-state="authenticated"] #app .esb-filter-chips {display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;scrollbar-width:none;padding:2px 0 4px;margin:0 0 6px;max-width:100%;}
  html body[data-auth-state="authenticated"] #app .esb-filter-chips::-webkit-scrollbar {display:none;}
  html body[data-auth-state="authenticated"] #app .esb-chip {flex:0 0 auto;min-height:36px;padding:0 14px;border-radius:999px;border:1px solid #dbe3ea;background:#fff;color:#33475b;font-size:13px;font-weight:600;white-space:nowrap;}
  html body[data-auth-state="authenticated"] #app .esb-chip.is-on {background:#0f2a44;border-color:#0f2a44;color:#fff;}
  html body[data-auth-state="authenticated"] #app select.esb-chip-select {position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;overflow:hidden!important;}

  /* All-modules sheet: tiles. */
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles {display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important;align-content:start!important;align-items:stretch!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .esb-mobile-menu-head {grid-column:1 / -1;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu {height:auto!important;min-height:0!important;margin:0!important;}
  html body[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles .global-menu {min-width:0;}
  html body[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles .global-menu > .global-menu-button {display:grid!important;justify-items:center;gap:8px;width:100%!important;min-height:96px!important;padding:14px 6px!important;border-radius:18px!important;background:var(--panel,#fff)!important;border:1px solid #e3e9ef!important;box-shadow:0 1px 3px #0f2a440d;color:var(--ink,#0f2a44)!important;font-size:12.5px!important;font-weight:700!important;text-align:center!important;white-space:normal!important;}
  html body[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles .global-menu > .global-menu-button::after {display:none!important;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon {display:grid;place-items:center;width:44px;height:44px;border-radius:14px;background:#e0f2f1;color:#0f766e;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon svg {width:22px!important;height:22px!important;min-width:22px;min-height:22px;max-width:22px;max-height:22px;flex:none;display:block;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon[data-tone="2"] {background:#e0e7ff;color:#3730a3;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon[data-tone="3"] {background:#fef3c7;color:#92400e;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon[data-tone="4"] {background:#dcfce7;color:#166534;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon[data-tone="5"] {background:#ede9fe;color:#5b21b6;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon[data-tone="6"] {background:#e0f2fe;color:#075985;}
  html body[data-auth-state="authenticated"] #global-menubar .esb-tile-icon:is([data-tone="7"],[data-tone="9"],[data-tone="0"]) {background:#f1f5f9;color:#334155;}
  html body[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles .global-menu.open {grid-column:1 / -1;}
  html body[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles .global-menu.open > .global-menu-button {min-height:0!important;grid-auto-flow:column;justify-content:start;align-items:center;padding:10px 12px!important;background:#0f2a44!important;color:#fff!important;}
}
/* Phone polish: every page at 360px. Figures, strips, chips, sort row, grid lists, reports, menu and toolbars. */
@media screen and (max-width:768px) {
  /* Hero figures: money reads as a list (label left, amount right); four short figures sit two by two. */
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats[data-count="4"]:not(.is-list) {grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats.is-list {grid-template-columns:minmax(0,1fr)!important;gap:0!important;padding:2px 14px!important;background:rgba(255,255,255,.08)!important;border:1px solid rgba(255,255,255,.16)!important;border-radius:16px!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats.is-list > .esb-hero-stat {display:flex!important;flex-direction:row-reverse!important;justify-content:space-between!important;align-items:center!important;gap:12px!important;padding:11px 0!important;background:transparent!important;border:0!important;border-bottom:1px solid rgba(255,255,255,.12)!important;border-radius:0!important;box-shadow:none!important;min-height:0!important;width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats.is-list > .esb-hero-stat:last-child {border-bottom:0!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats.is-list > .esb-hero-stat b {font-size:17px!important;white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important;max-width:none!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats.is-list > .esb-hero-stat span {font-size:13.5px!important;text-align:left!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stats.is-list > .esb-hero-stat.is-warn b {color:#ffd58a!important;}
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-stat b {text-overflow:clip!important;}

  /* Sales and purchase path, section tabs: one swipeable row of pills; the current page is dark. */
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path-wrap {overflow:visible!important;margin:2px 0 12px!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs) {display:flex!important;flex-wrap:nowrap!important;align-items:center!important;gap:6px!important;overflow-x:auto!important;overscroll-behavior-x:contain;scrollbar-width:none;padding:2px 0 6px!important;margin:2px 0 10px!important;border:0!important;background:transparent!important;box-shadow:none!important;width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs)::-webkit-scrollbar {display:none;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs)::before, html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs)::after, html body[data-auth-state="authenticated"] #app#app .sb-sales-path-wrap::before, html body[data-auth-state="authenticated"] #app#app .sb-sales-path-wrap::after {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs) .sb-sales-same {display:contents!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs) button {flex:0 0 auto!important;width:auto!important;white-space:nowrap!important;min-height:38px!important;padding:0 14px!important;margin:0!important;border-radius:999px!important;border:1px solid #dbe3ea!important;background:#fff!important;color:#33475b!important;font-size:13.5px!important;font-weight:600!important;box-shadow:none!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs) button:is(.is-on,[aria-current="page"]) {background:#0f2a44!important;color:#fff!important;border-color:#0f2a44!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path.esb-path:not(.esb-tabs) .sb-sales-path-sep {flex:0 0 auto!important;color:var(--ui-muted,#52657a)!important;font-size:14px!important;margin:0 -2px!important;}

  /* Filter chips use the full width and swipe sideways; a drop-down filter fills its line. */
  html body[data-auth-state="authenticated"] #app#app :is(span,label,div):has(> .esb-filter-chips) {display:block!important;flex:1 1 100%!important;width:100%!important;max-width:100%!important;min-width:0!important;}
  html body[data-auth-state="authenticated"] #app#app :has(> :is(span,label,div) > .esb-filter-chips) {flex-wrap:wrap!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-filter-chips {display:flex!important;flex-wrap:nowrap!important;gap:8px!important;overflow-x:auto!important;overscroll-behavior-x:contain;scrollbar-width:none;padding:2px 0 4px!important;margin:0 0 8px!important;width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-filter-chips::-webkit-scrollbar {display:none;}
  html body[data-auth-state="authenticated"] #app#app .esb-filter-chips > .esb-chip {flex:0 0 auto!important;white-space:nowrap!important;}
  html body[data-auth-state="authenticated"] #app#app :is(span,label):has(> select:not(.esb-chip-select)):not(:has(input,textarea)) {flex:1 1 100%!important;max-width:100%!important;min-width:0!important;}
  html body[data-auth-state="authenticated"] #app#app :is(span,label):has(> select:not(.esb-chip-select)):not(:has(input,textarea)) > select {width:100%!important;max-width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app label.esb-record-status-filter {display:flex!important;align-items:center!important;gap:10px!important;}
  html body[data-auth-state="authenticated"] #app#app label.esb-record-status-filter > select {flex:1 1 auto!important;}

  /* Card lists: column headings become a small "Sort" row instead of boxes; tables that cannot sort hide them. */
  html body[data-auth-state="authenticated"] #app#app table.esb-rich:not(.esb-mobile-sortable-table) > thead {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich.esb-mobile-sortable-table > thead {display:block!important;position:static!important;margin:0 0 8px!important;background:transparent!important;border:0!important;box-shadow:none!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich.esb-mobile-sortable-table > thead > tr {display:flex!important;flex-wrap:nowrap!important;align-items:center!important;gap:6px!important;overflow-x:auto!important;scrollbar-width:none;padding:0 0 2px!important;background:transparent!important;border:0!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich.esb-mobile-sortable-table > thead > tr::-webkit-scrollbar {display:none;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich.esb-mobile-sortable-table > thead > tr::before {content:"Sort";flex:0 0 auto;font-size:12px;font-weight:700;color:#64748b;margin-right:2px;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich.esb-mobile-sortable-table > thead > tr > th {flex:0 0 auto!important;display:inline-flex!important;align-items:center!important;width:auto!important;min-width:0!important;max-width:none!important;height:auto!important;padding:6px 12px!important;margin:0!important;border:0!important;border-radius:999px!important;background:#eaf0f5!important;color:#33475b!important;font-size:12px!important;font-weight:600!important;white-space:nowrap!important;box-shadow:none!important;position:relative!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich.esb-mobile-sortable-table > thead > tr > th:is(:empty,.esb-mobile-cell-actions,[data-sb-label=""]) {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich > thead :is([class*="resize"],[class*="grip"],[class*="handle"]) {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich > thead :is(button,.sb-col-sort) {all:unset;font:inherit;color:inherit;cursor:pointer;white-space:nowrap;}

  /* Card rows: a calm detail line (no leading dots when it wraps) and compact actions under a hairline. */
  html body[data-auth-state="authenticated"] #app#app table.esb-rich > tbody > tr > td.esb-r-sub ~ td.esb-r-sub::before {display:none!important;content:none!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich > tbody > tr > td.esb-r-sub {margin-right:12px!important;line-height:1.5!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich > tbody > tr > td.esb-r-actions {justify-content:flex-start!important;gap:8px!important;margin-top:8px!important;padding-top:10px!important;border-top:1px solid #eef2f6!important;}
  html body[data-auth-state="authenticated"] #app#app table.esb-rich > tbody > tr > td.esb-r-actions :is(button,.btn,a.btn) {min-height:34px!important;height:34px!important;padding:0 14px!important;font-size:13px!important;border-radius:10px!important;}

  /* Lists drawn as grid lines (stock, stock movements, bank lines) read as the same cards. */
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list {display:block!important;overflow:visible!important;min-width:0!important;width:auto!important;}
  html body[data-auth-state="authenticated"] #app#app :has(> .esb-grid-list) {overflow:visible!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-head {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row {display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:4px 10px!important;grid-template-columns:none!important;width:auto!important;min-width:0!important;margin:0 0 10px!important;padding:12px 14px!important;background:var(--panel,#fff)!important;border:0!important;border-radius:18px!important;box-shadow:0 1px 3px rgba(15,42,68,.06)!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row::after {content:"";order:3;flex-basis:100%;height:0;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > * {min-width:0!important;max-width:100%;padding:0!important;border:0!important;white-space:normal!important;text-align:left!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-title {order:1;flex:1 1 0!important;display:grid!important;grid-template-columns:42px minmax(0,1fr);column-gap:12px;align-items:center;font-size:15px!important;font-weight:700!important;color:#0f2a44!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-title > .esb-r-av {grid-row:1 / span 3;display:grid;place-items:center;width:42px;height:42px;border-radius:13px;color:#fff;font-weight:800;font-size:14px;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-title > :not(.esb-r-av) {grid-column:2;display:block!important;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-title > :not(.esb-r-av):not(:first-of-type) {font-size:12.5px!important;font-weight:500!important;color:#64748b!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-right {order:2;flex:0 0 auto!important;margin-left:auto!important;font-size:14.5px!important;font-weight:700!important;color:#0f2a44!important;white-space:nowrap!important;text-align:right!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-sub {order:4;flex:0 1 auto!important;font-size:12.5px!important;color:#64748b!important;margin-right:12px!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-sub::before {content:attr(data-mobile-label) " ";font-weight:600;color:#94a3b8;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-status {order:5;margin-left:auto!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-more {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-actions {order:6;flex:1 1 100%!important;display:flex!important;gap:8px!important;}

  /* A heading squeezed beside chips or buttons gets its own line. */
  html body[data-auth-state="authenticated"] #app#app .esb-stack-row {flex-wrap:wrap!important;grid-template-columns:minmax(0,1fr)!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-stack-row > .esb-stack-head {flex:1 1 100%!important;width:100%!important;min-width:0!important;max-width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-stack-row > :not(.esb-stack-head) {min-width:0!important;max-width:100%!important;}

  /* Financial statements: the account name is always shown; amounts swipe sideways while the name stays. */
  html body[data-auth-state="authenticated"] #app#app .financial-sheet {overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement {table-layout:auto!important;width:max-content!important;min-width:100%!important;font-size:13px!important;}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement col {width:auto!important;}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement :is(.fs-no,.esb-fs-no) {display:none!important;}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement :is(td.fs-name,.esb-fs-name) {position:sticky!important;left:0;z-index:1;background:var(--panel,#fff)!important;min-width:158px!important;max-width:190px!important;width:auto!important;white-space:normal!important;padding:8px 10px 8px 0!important;box-shadow:6px 0 6px -6px rgba(15,42,68,.18);}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement td.fs-name[style*="padding-left"] {padding-left:12px!important;}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement :is(td.num,th.num,td.amount-display,td.sb-amt) {min-width:92px!important;width:auto!important;white-space:nowrap!important;padding:8px 8px!important;}
  html body[data-auth-state="authenticated"] #app#app table.financial-statement :is(th) {white-space:normal!important;font-size:12px!important;line-height:1.3!important;}

  /* Report library: each report is a comfortable tap row. */
  html body[data-auth-state="authenticated"] #app#app .sb-report-group-links {display:block!important;background:#fff!important;border-radius:16px!important;padding:2px 12px!important;margin:6px 0 14px!important;box-shadow:0 1px 3px rgba(15,42,68,.06)!important;columns:auto!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-card {display:flex!important;align-items:center!important;gap:10px!important;min-height:46px!important;padding:4px 0!important;margin:0!important;border:0!important;border-bottom:1px solid #eef2f6!important;background:transparent!important;box-shadow:none!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-card:last-child {border-bottom:0!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-card .sb-report-name {flex:1 1 auto!important;text-align:left!important;font-size:14.5px!important;font-weight:600!important;color:#0f2a44!important;padding:8px 0!important;min-height:0!important;background:none!important;border:0!important;box-shadow:none!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-card .sb-report-star {flex:0 0 auto!important;width:30px!important;height:30px!important;min-height:0!important;padding:4px!important;}

  /* Toolbars of buttons: one swipeable row, icon and text side by side. */
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row {display:flex!important;flex-wrap:nowrap!important;gap:8px!important;overflow-x:auto!important;overscroll-behavior-x:contain;scrollbar-width:none;width:100%!important;max-width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row::-webkit-scrollbar {display:none;}
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row > * {flex:0 0 auto!important;width:auto!important;min-width:max-content!important;white-space:nowrap!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row > :is(.btn,button) {display:inline-flex!important;flex-direction:row!important;align-items:center!important;gap:6px!important;min-height:40px!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row > :is(.btn,button) .esb-mobile-action-icon svg {width:18px!important;height:18px!important;}

  /* Wide tables that stay tables (payroll, pay details): the first column stays in view while the rest swipe. */
  html body[data-auth-state="authenticated"] #app#app table.sb-copy-table:not(.esb-rich) > :is(tbody,tfoot) > tr > :is(th,td):first-child {position:sticky!important;left:0;z-index:1;background:var(--panel,#fff)!important;box-shadow:6px 0 6px -6px rgba(15,42,68,.18);}
  html body[data-auth-state="authenticated"] #app#app table.sb-copy-table.esb-freeze-head:not(.esb-rich) > thead > tr > th:first-child {position:sticky!important;left:0;z-index:6;}
  html body[data-auth-state="authenticated"] #app#app table.sb-copy-table:not(.esb-rich) {font-size:13px!important;}
}
/* All-modules sheet (phone): the open area is a light panel with its own heading row, not a dark bar. */
@media screen and (max-width:768px) {
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu-direct {grid-column:1 / -1!important;height:auto!important;min-height:0!important;margin:0!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu-direct :is(a,button) {display:flex!important;align-items:center!important;width:100%!important;min-height:42px!important;padding:0 14px!important;border-radius:12px!important;background:var(--soft-blue,#f1f5f9)!important;color:var(--ink,#0f2a44)!important;font-size:14px!important;font-weight:600!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu.open {grid-column:1 / -1!important;display:block!important;height:auto!important;padding:6px!important;background:var(--panel,#fff)!important;border:1px solid #e3e9ef!important;border-radius:18px!important;box-shadow:0 2px 8px rgba(15,42,68,.06)!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu.open > .global-menu-button {display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:flex-start!important;gap:12px!important;width:100%!important;height:auto!important;min-height:52px!important;padding:8px 10px!important;border-radius:14px!important;background:var(--soft-blue,#eef4f8)!important;color:var(--ink,#0f2a44)!important;font-size:15.5px!important;font-weight:700!important;text-align:left!important;box-shadow:none!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu.open > .global-menu-button .esb-tile-icon {flex:0 0 36px!important;width:36px!important;height:36px!important;margin:0!important;border-radius:11px!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu.open > .global-menu-popup {position:static!important;inset:auto!important;transform:none!important;width:auto!important;max-height:none!important;margin:6px 0 0!important;padding:0 6px 4px!important;border:0!important;box-shadow:none!important;background:transparent!important;}
}
@media screen and (max-width:768px) {
  /* Panel headings with tools beside them stack: heading first, tools below. */
  html body[data-auth-state="authenticated"] #app#app .panel-head {grid-template-columns:minmax(0,1fr)!important;}
  html body[data-auth-state="authenticated"] #app#app .panel-head > * {min-width:0!important;max-width:100%!important;}
}
@media screen and (max-width:768px) {
  /* Toolbars start at the left edge so nothing is cut off; buttons mirrored into the hero stay hidden. */
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row {justify-content:flex-start!important;}
  html body[data-auth-state="authenticated"] #app#app .esb-chip-row > .esb-hero-mirrored.esb-hero-mirrored {display:none!important;}
  /* Report dates: branch and period on full lines, From and To side by side, Run report last. */
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar {display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;align-items:end!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar > * {grid-column:1 / -1!important;min-width:0!important;margin:0!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar > label:has(input[type="date"]) {grid-column:auto!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar > label {display:grid!important;gap:4px!important;font-size:12.5px!important;font-weight:600!important;color:#475569!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar :is(select,input) {width:100%!important;min-height:44px!important;font-size:15px!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar > .btn.primary {order:9;min-height:46px!important;width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-report-period-bar > details {order:10;}
}
@media screen and (max-width:768px) {
  /* All-modules sheet: the open area grows with its list; the title row reads logo, title, subtitle, close. */
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .global-menu.open {min-height:max-content!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar.esb-menu-tiles > .esb-mobile-menu-head {display:flex!important;align-items:center!important;justify-content:space-between!important;gap:12px!important;padding:4px 2px 12px!important;border-bottom:1px solid #e8eef3!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar .esb-mobile-menu-identity {display:flex!important;align-items:center!important;gap:12px!important;min-width:0!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar .esb-mobile-menu-identity .esb-mobile-menu-logo {width:40px!important;height:40px!important;flex:0 0 40px!important;margin:0!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar .esb-mobile-menu-identity > div {display:grid!important;gap:1px!important;min-width:0!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar .esb-mobile-menu-identity strong {font-size:19px!important;line-height:1.2!important;color:var(--ink,#0f2a44)!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar .esb-mobile-menu-subtitle {display:block!important;font-size:12.5px!important;color:var(--muted,#64748b)!important;margin:0!important;}
  html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar #esb-mobile-menu-close {flex:0 0 40px!important;width:40px!important;height:40px!important;border-radius:12px!important;background:var(--soft-blue,#f1f5f9)!important;font-size:22px!important;line-height:1!important;}
}
@media screen and (max-width:768px) {
  /* Record tabs (employee, customer, vendor): tabs on their own swipeable line, the filter below at full width. */
  html body[data-auth-state="authenticated"] #app#app .center-tabbar {display:flex!important;flex-wrap:wrap!important;gap:8px!important;align-items:center!important;}
  
  
  
  
  
  /* Employee header: name and contact on top, pay figure below, never squeezed side by side. */
  html body[data-auth-state="authenticated"] #app#app .sb-emp-id {flex-wrap:wrap!important;gap:10px!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-emp-id > * {flex:1 1 100%!important;min-width:0!important;max-width:100%!important;}
  html body[data-auth-state="authenticated"] #app#app .sb-emp-id-pay {text-align:left!important;align-items:flex-start!important;}
}
@media screen and (max-width:768px) {
  /* Wide tables that stay tables keep each value on one line and swipe sideways. */
  html body[data-auth-state="authenticated"] #app#app table.sb-copy-table:not(.esb-rich):not(.esb-mobile-entry-table) :is(th,td) {white-space:nowrap!important;}
  html body[data-auth-state="authenticated"] #app#app table.sb-copy-table:not(.esb-rich):not(.esb-mobile-entry-table) :is(th,td) .btn {min-height:32px!important;padding:0 10px!important;}
}
@media screen and (max-width:768px) {
  /* Filter chips inside a filter grid take the whole line. */
  html body[data-auth-state="authenticated"] #app#app :is(span,label,div):has(> .esb-filter-chips) {grid-column:1 / -1!important;}
}
/* Mobile record surfaces and their text must switch themes together. */
@media screen and (max-width:768px) {
  html body[data-auth-state="authenticated"] #app#app > .esb-mobile-page-hero .esb-hero-button {
    background:#fff!important;color:#0f3b4f!important;-webkit-text-fill-color:#0f3b4f!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-hero-stat em {
    color:#e2edf3!important;font-size:12px!important;line-height:1.4!important;font-style:normal;white-space:normal!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-hero-stats[data-count="5"] {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-hero-stats[data-count="5"] > :last-child {
    grid-column:1 / -1;
  }
  html body[data-auth-state="authenticated"] #app#app .cards.esb-owner-kpis.esb-hero-mirrored.esb-hero-mirrored.esb-hero-mirrored {
    display:none!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-owner-actions {
    margin:0 0 12px!important;padding:0!important;min-height:0!important;gap:0!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-owner-actions > div:has(> .esb-hero-mirrored):not(:has(> :not(.esb-hero-mirrored))) {
    display:none!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-owner-note {
    margin:0!important;font-size:13px!important;line-height:1.5!important;background:transparent!important;white-space:normal!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-attention-summary {
    display:block!important;color:var(--muted)!important;font-size:14px!important;line-height:1.5!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-health-row > #esb-db-health {display:contents;}
  html body[data-auth-state="authenticated"] #app#app .esb-owner-health-check {
    display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 16px;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-owner-health-check p {
    flex:1 1 220px;margin:0;color:var(--muted);font-size:13px;line-height:1.5;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-owner-health-check .btn {min-height:44px;}
}
/* Health status remains useful on larger screens too. */
.esb-health-row > #esb-db-health {display:contents;}
.esb-owner-health-check {display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:0 0 16px;}
.esb-owner-health-check p {flex:1 1 260px;margin:0;color:var(--muted);font-size:13px;}
@media screen and (max-width:768px) {
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app {
    --mobile-record-bg:#18344b;
    --mobile-record-ink:#f1f5f9;
    --mobile-record-muted:#cbd5e1;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app :is(table.esb-rich > tbody > tr:not(.esb-mobile-empty-row),.esb-grid-list > .esb-grid-row) {
    background:var(--mobile-record-bg)!important;
    color:var(--mobile-record-ink)!important;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > :not(.esb-r-status),
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-title :is(b,strong,small,code,.muted) {
    background:transparent!important;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app :is(.esb-r-title,.esb-r-right),
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > :is(.esb-r-title,.esb-r-right),
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-title :is(b,strong,a),
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .panel > .panel-head :is(h2,h3) {
    color:var(--mobile-record-ink)!important;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-sub,
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-grid-list > .esb-grid-row > .esb-r-sub,
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-sub::before,
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-title :is(small,code,.muted),
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-title > :not(.esb-r-av):not(:first-of-type) {
    color:var(--mobile-record-muted)!important;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app .esb-r-actions {
    border-top-color:#526b80!important;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app table.esb-rich > thead :is(tr,th,button,span),
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app table.esb-rich > thead > tr::before {
    color:var(--mobile-record-muted)!important;
    background:transparent!important;
  }
  html[data-theme="dark"] body[data-auth-state="authenticated"] #app#app table.esb-rich > thead > tr > th {
    background:var(--mobile-record-bg)!important;
  }
}

/* ===== Control and text contrast ===== */
/* Final screen contrast contract. Keep themed surfaces and text paired.
   Document paper and print styles retain their own foregrounds/backgrounds. */
@media screen {
  html {
    --ui-surface:#ffffff;--ui-soft:#edf3f8;--ui-ink:#102b46;
    --ui-muted:#52657a;--ui-border:#71869a;--ui-primary:#15566d;
    --ui-primary-ink:#ffffff;--ui-focus:#087b83;--ui-link:#15566d;
  }
  html[data-theme="dark"] {
    --ui-surface:#0e2136;--ui-soft:#18344b;--ui-ink:#eef4fb;
    --ui-muted:#b7c9dc;--ui-border:#718ba3;--ui-primary:#235e78;
    --ui-primary-ink:#ffffff;--ui-focus:#67e8f9;--ui-link:#a9d5ff;
  }
  /* Legacy text-fill declarations must follow the actual foreground color.
     Scope this to controls/navigation, not document contents or brand marks. */
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(.sbpay-link,.sb-inv-link,.so-order-link,.center-ledger-link,.sb-billing-link,.link-btn,.btn-link,.text-link):not(:where(.doc-print *,.sb-paper *,.slipview-slip *,.financial-sheet *,.financial-statement *,.report-paper *,.sb-report-paper *,.presentation-slide *)) {
    background:transparent!important;color:var(--ui-link)!important;-webkit-text-fill-color:currentColor!important;opacity:1;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(.sbpay-link,.sb-inv-link,.so-order-link,.center-ledger-link,.sb-billing-link,.link-btn,.btn-link,.text-link):hover {
    text-decoration:underline;text-underline-offset:3px;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) select option {
    background:var(--ui-surface);color:var(--ui-ink);-webkit-text-fill-color:currentColor;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) select option:checked {
    background:var(--ui-primary);color:var(--ui-primary-ink);-webkit-text-fill-color:currentColor;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(.btn,input,select,textarea),
  html body[data-auth-state="authenticated"] :is(#global-menubar#global-menubar,.sb-account-menu,.sb-search-hits) :is(button,a,span,small,strong),
  html body[data-auth-state="authenticated"] header.topbar :is(button,input,span) {
    -webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not(:where(.doc-print *,.sb-inv-paper *,.sb-doc-paper *,.listpage-paper *,.report-paper *,.sb-report-paper *)) {
    background:var(--ui-surface)!important;color:var(--ui-ink)!important;border-color:var(--ui-border)!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(input,textarea)::placeholder {
    color:var(--ui-muted)!important;-webkit-text-fill-color:var(--ui-muted)!important;opacity:1!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) .btn:not(.esb-hero-button):not(.esb-hero-ghost):not(.primary):not(.danger):not(.btn-danger) {
    background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-border)!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) .btn.primary:not(.esb-hero-button) {
    background:var(--ui-primary)!important;color:var(--ui-primary-ink)!important;border-color:var(--ui-primary)!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) .btn:is(.danger,.btn-danger) {
    background:#a62631!important;color:#fff!important;border-color:#a62631!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(.field > label,.form-card > h2,.form-card > h3,.panel-head > h2,.panel-head > h3,.modal-head > h2,.sb-settings-title) {
    color:var(--ui-ink)!important;
  }
  html body[data-auth-state="authenticated"] :is(#app#app,#modal-root#modal-root) :is(.field > small,.side-note,.panel-subtitle,.sb-settings-lede,.modal-body > .muted) {
    color:var(--ui-muted)!important;opacity:1!important;
  }
  
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path .sb-sales-path-sep {
    color:var(--ui-muted)!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #app#app .sb-logo-preview {
    background:var(--ui-surface)!important;color:var(--ui-muted)!important;
  }
  html body[data-auth-state="authenticated"] #app#app .sb-sales-path > button {
    background:var(--ui-soft)!important;color:var(--ui-ink)!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-r-av {
    background:#24636d!important;color:#fff!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #app#app .esb-pos-label small {
    color:inherit!important;opacity:1!important;
  }
  html body[data-auth-state="authenticated"] #modal-root#modal-root .sb-custom-intro :is(small,p) {
    color:var(--ui-muted)!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #app#app .sb-report-card {
    background:var(--ui-surface)!important;color:var(--ui-ink)!important;
  }
  html body[data-auth-state="authenticated"] #app#app .sb-report-card :is(.sb-report-name,.sb-report-name h4) {
    color:var(--ui-ink)!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #app#app :is(.esb-mobile-page-hero,.esb-settings-hero) {
    background:linear-gradient(125deg,#102b46,#155563)!important;
  }
  html body[data-auth-state="authenticated"] #app#app :is(.esb-mobile-page-hero,.esb-settings-hero) :is(h2,.sb-settings-title) {
    color:#fff!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #app#app :is(.esb-mobile-page-hero,.esb-settings-hero) :is(p,.sb-settings-lede) {
    color:#e0edf3!important;-webkit-text-fill-color:currentColor!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar :is(.global-menu,.global-menu-popup,.menu-colpack,.menu-col,.menu-lead) {
    background:var(--ui-surface)!important;color:var(--ui-ink)!important;border-color:var(--ui-border)!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar :is(.global-menu-button,.global-menu-direct,.global-menu-item,.lists-menu-link) {
    background:transparent!important;color:var(--ui-ink)!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar :is(.global-menu-item,.global-menu-button,.global-menu-direct,.lists-menu-link) :is(span,b,strong,small,svg) {
    color:inherit!important;background:transparent!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar :is(.global-menu-subheading,.esb-mobile-menu-subtitle) {
    color:var(--ui-muted)!important;opacity:1!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar .esb-mobile-menu-identity strong {
    color:var(--ui-ink)!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar :is(.global-menu-item,.global-menu-button,.global-menu-direct,.lists-menu-link):is(:hover,:focus-visible,.active,[aria-current="page"]) {
    background:var(--ui-soft)!important;color:var(--ui-ink)!important;
  }
  html body[data-auth-state="authenticated"] #global-menubar#global-menubar #esb-mobile-menu-close {
    background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-border)!important;
  }
  html body[data-auth-state="authenticated"] :is(#app,#modal-root,#global-menubar) :is(button,a,input,select,textarea,summary):focus-visible {
    outline:3px solid var(--ui-focus)!important;outline-offset:2px;
  }
  @media (max-width:768px) {
    html body.esb-mobile-menu-open[data-auth-state="authenticated"] #global-menubar#global-menubar .global-menu.open[data-sb-popup="fixed"] > .global-menu-popup {
      position:static!important;inset:auto!important;transform:none!important;max-height:none!important;
    }
  }
}

/* ===== Brand palette ===== */
/* esmartbooks brand theme (navy + teal), loaded last so every screen shares one palette.
   Signed-in app only, screen only: printed documents keep their own colours.
   Light:  page #F3F6F9 · cards #FFFFFF · lines #DCE3EA · text #0F2A44 · muted #5B6B7F
   Dark:   page #0B1724 · cards #0D2238 · lines #2A4560 · text #F4F8FF · muted #A9BDD3
   Brand:  navy #0F2A44 → #14506A (hero) · teal #14808A (actions, links, focus) · success #13734B · warning #B7791F · danger #B42318 */
@media screen{
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"]{
  /* Brand colours live in brand-tokens.css, shared with the public site. Shared variables older screens already read: */
  --panel:var(--brand-card);--line:var(--brand-line);--ink:var(--brand-ink);--muted:var(--brand-muted);--border:var(--brand-line);--bg:var(--brand-page);--navy:var(--brand-navy);
  background:var(--brand-page)!important;color:var(--brand-ink);
}
/* Dark brand colours: brand-tokens.css (html[data-theme="dark"]). */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(main,#app.content){background:var(--brand-page)!important}

/* Buttons: teal for the main action, quiet outline for the rest, red for destructive. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(#app,#modal-root,.sb-fmt-preview,#sb-form-layer) :is(.btn.primary,button.primary):not(:disabled){background:var(--brand-action)!important;border-color:var(--brand-action)!important;color:#fff!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(#app,#modal-root,.sb-fmt-preview,#sb-form-layer) :is(.btn.primary,button.primary):not(:disabled):hover{background:var(--brand-action-hover)!important;border-color:var(--brand-action-hover)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(#app,#modal-root) .btn:not(.primary):not(.danger):not(.esb-hero-button):not(.esb-hero-ghost):not(.esb-chip):not(:is(.esb-pos,.esb-mobile-page-hero,.sb-aud-hero,aside) .btn){background:var(--brand-card)!important;border-color:var(--brand-line)!important;color:var(--brand-ink)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(#app,#modal-root) .btn:not(.primary):not(.danger):not(.esb-hero-button):not(.esb-hero-ghost):not(.esb-chip):not(:is(.esb-pos,.esb-mobile-page-hero,.sb-aud-hero,aside) .btn):hover{border-color:var(--brand-teal)!important;color:var(--brand-teal)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(#app,#modal-root) .btn.danger{background:transparent!important;border-color:color-mix(in srgb,var(--brand-danger) 45%,transparent)!important;color:var(--brand-danger)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] :is(#app,#modal-root) :is(.btn,button,a,input,select,textarea):focus-visible{outline:2px solid var(--brand-teal)!important;outline-offset:2px!important}

/* Links and highlighted text. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app a:not(.btn):not(.nav-item):not([class*="esb-hero"]){color:var(--brand-link)}

/* Sidebar: brand navy with a teal "New" button and a teal marker on the open area. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav){background:var(--brand-navy)!important}
html[data-theme="dark"] body[data-auth-state="authenticated"] aside.sidebar{background:#081626!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .create-btn.create-btn{background:var(--brand-action)!important;border-color:var(--brand-action)!important;color:#fff!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .nav-item.nav-item.active{background:rgba(43,163,173,.22)!important;box-shadow:inset 4px 0 0 var(--brand-gold-shine,#FFD766)!important;color:#fff!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .nav-item:not(.active):hover{background:rgba(255,255,255,.08)!important}

/* The brand belongs to the rail in both themes, including its compact state. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .brand{
  background:transparent!important;border-bottom:1px solid rgba(193,208,224,.18)!important;
  box-shadow:none!important;min-height:76px;align-items:center;gap:12px;
}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .brandmark{
  background:transparent!important;border:0!important;border-radius:50%!important;padding:0!important;
  filter:none!important;mix-blend-mode:normal!important;box-shadow:0 0 0 1px rgba(193,208,224,.38)!important;
  object-fit:contain;flex-shrink:0;
}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .brand .esb-word{
  color:#f4f8ff!important;-webkit-text-fill-color:#f4f8ff!important;font-size:18px!important;letter-spacing:-.02em;
}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .brand .esb-e{
  color:var(--brand-gold-shine,#FFD766)!important;-webkit-text-fill-color:var(--brand-gold-shine,#FFD766)!important;
}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar:has(#nav) .brand .esb-tag{
  color:#c1d0e0!important;-webkit-text-fill-color:#c1d0e0!important;font-size:11px!important;letter-spacing:.06em;
}

/* Cards and panels: one surface, one border, one radius. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app :is(.panel,.card,.esb-attn,.esb-dash-card,.cards>.metric,.docform-summary-card,.table-wrap):not(.esb-pos):not(.esb-mobile-page-hero){background:var(--brand-card)!important;border-color:var(--brand-line)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app :is(.panel,.esb-attn,.esb-dash-card,.cards>.metric){border-radius:14px!important;box-shadow:0 1px 2px rgba(15,42,68,.05)!important}

/* Tables: a soft header row and quiet row lines. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app table:not(.print-table):not(.financial-statement) thead th:not(:where(.doc-print *,.sb-inv-paper *,.sb-paper *,.sb-doc-paper *,.financial-sheet *,.live-sheet *,.report-paper *,.sb-report-paper *,.qr-document *,.sb-report-preview-sheet *,.slipview-slip *,.chq-leaf *,.presentation-slide *)){background:var(--brand-head)!important;color:var(--brand-muted)!important;border-color:var(--brand-line)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app table:not(.print-table) tbody td{border-color:var(--brand-line)!important}

/* Tabs and path steps: teal marks the current one. */

html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app .sb-sales-path button:is(.is-on,[aria-current="page"]){color:var(--brand-link)!important;border-color:var(--brand-teal)!important}

/* Status colours. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app :is(.badge,.status-pill,.pill):is(.ok,.success,.paid,.posted,.active){color:var(--brand-success)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app :is(.badge,.status-pill,.pill):is(.warn,.warning,.draft,.pending){color:var(--brand-warning)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app :is(.badge,.status-pill,.pill):is(.bad,.danger,.overdue,.void,.cancelled){color:var(--brand-danger)!important}

/* Phone heroes share the brand gradient. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app>.esb-mobile-page-hero{background:var(--brand-hero)!important}

/* Dashboard hero: greeting and quick actions across the top of the money position band. */
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos{background:var(--brand-hero)!important;border-color:rgba(255,255,255,.10)!important;border-radius:20px!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos :is(.esb-hero-greet small,.esb-pos-head p,.esb-pos-sign,.esb-dash-period-field>span,.esb-pos-kicker,.esb-pos-profit em,dt){color:#e0edf7!important;-webkit-text-fill-color:currentColor!important;opacity:1}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos>.esb-hero-top{grid-column:1 / -1;display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;padding:0 0 18px;margin:0 0 4px;border-bottom:1px solid rgba(255,255,255,.12)}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-greet small{display:block;font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#a8e3e6}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-greet h1{margin:6px 0 0;font-size:clamp(1.5rem,2.3vw,2rem);letter-spacing:-.02em;color:#fff;line-height:1.15}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-quick{display:flex;gap:8px;flex-wrap:wrap}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-quick .btn{min-height:40px!important;padding:0 16px!important;border-radius:11px!important;font-weight:700!important;background:rgba(255,255,255,.10)!important;border:1px solid rgba(255,255,255,.22)!important;color:#fff!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-quick .btn:hover{background:rgba(255,255,255,.18)!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos .esb-hero-quick .btn.btn.esb-hero-quick-main{background:#fff!important;border-color:#fff!important;color:#0F3B4F!important;-webkit-text-fill-color:#0F3B4F!important}
html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos .esb-dashboard-actions .btn{background:rgba(255,255,255,.10)!important;border-color:rgba(255,255,255,.22)!important;color:#fff!important}
@media (max-width:768px){
  html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos>.esb-hero-top{order:-10!important}
  html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-pos>.esb-hero-top{flex-direction:column;align-items:stretch}
  html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-quick{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  html:is([data-theme],:not([data-theme])) body[data-auth-state="authenticated"] #app.route-dashboard .esb-hero-quick .btn{flex:0 0 auto}
}
}

/* Tablet widths (769-1000px): the title is hidden, so keep the menu and back buttons side by side instead of stacking out of the bar. */
@media screen and (min-width:769px) and (max-width:1000px){
 /* Unified topbar flex sizing moved to responsive.css */
}

/* Column headings never split inside a word ("Amou / nt"); wide tables already scroll sideways. */
body[data-auth-state="authenticated"] #app table th{overflow-wrap:normal!important;word-break:normal!important;hyphens:none}

/* Phone toolbars: the template picker and New button use the full row instead of stopping short. */
@media screen and (max-width:768px){
 body[data-auth-state="authenticated"] #app .esb-toolbar>.sb-inv-tools{flex:1 1 100%;min-width:0}
 body[data-auth-state="authenticated"] #app .esb-toolbar>.sb-inv-tools>.sb-inv-style-field{flex:1 1 auto;min-width:0}
}

/* Register rows that open their record on click (estimates, price lists). */
body[data-auth-state="authenticated"] #app :is(#listpage-list tbody tr,tr.sb-row-opens){cursor:pointer}

/* Inventory Stock and Recent movements are row lists, not tables: give them the same frozen heading
   as standard tables (own scroll box capped like .esb-table-scroll, heading row pinned to its top).
   Phones show these rows as cards without a heading, so they keep normal page scrolling. */
@media screen and (min-width:769px){
 body[data-auth-state="authenticated"] #app .sb-inv-lines:has(>.sb-inv-line.sb-inv-head){max-height:min(65vh,720px);overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
 body[data-auth-state="authenticated"] #app .sb-inv-lines>.sb-inv-line.sb-inv-head{position:sticky;top:0;z-index:3;background:var(--esb-head-bg,#f4f7f6);color:var(--esb-head-ink,inherit);box-shadow:0 1px 0 var(--esb-head-line,#dfe5ea)}
}

/* 9. TIER 1: SIDEBAR & TOP BARS -> GOLDEN + MAGNIFY ON CURSOR */
body[data-auth-state="authenticated"] [data-esb-hover="magnify"],
body[data-auth-state="authenticated"] [data-esb-neighbor="1"] {
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}
body[data-auth-state="authenticated"] aside.sidebar [data-esb-hover="magnify"] {
  transform: scale(1.075) translateX(4px) !important;
  background: rgba(212, 168, 67, 0.18) !important;
  color: var(--esb-gold-bright) !important;
  box-shadow: 0 6px 18px rgba(6, 14, 28, 0.38) !important;
  z-index: 6 !important;
}
body[data-auth-state="authenticated"] :is(#global-menubar, header.topbar) [data-esb-hover="magnify"] {
  transform: scale(1.07) translateY(-1px) !important;
  border-color: var(--esb-gold) !important;
  box-shadow: 0 4px 14px rgba(212, 168, 67, 0.24) !important;
  z-index: 12 !important;
}
body[data-auth-state="authenticated"] [data-esb-neighbor="1"] {
  transform: scale(1.02) !important;
}
body[data-auth-state="authenticated"] [data-esb-hover="magnify"] svg {
  transform: scale(1.2) !important;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), color 0.15s ease !important;
}
body[data-auth-state="authenticated"] aside.sidebar [data-esb-hover="magnify"] :is(span, b, svg),
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#global-menubar, header.topbar) [data-esb-hover="magnify"],
html[data-theme="dark"] body[data-auth-state="authenticated"] :is(#global-menubar, header.topbar) [data-esb-hover="magnify"] :is(span, b, svg) {
  color: var(--esb-gold-bright) !important;
  stroke: var(--esb-gold-bright) !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] :is(#global-menubar, header.topbar) [data-esb-hover="magnify"],
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] :is(#global-menubar, header.topbar) [data-esb-hover="magnify"] :is(span, b, svg) {
  color: var(--esb-gold-deep) !important;
  stroke: var(--esb-gold-deep) !important;
  background-color: rgba(212, 168, 67, 0.14) !important;
}

/* 10. TIER 2: ALL OTHER WORKSPACE ITEMS (Tables, Lists, KPIs, Cards, Tabs) -> GOLDEN ONLY, ZERO MAGNIFICATION */
body[data-auth-state="authenticated"] [data-esb-hover="gold"] {
  transform: none !important;
  border-color: var(--esb-gold) !important;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold"] {
  background-color: rgba(212, 168, 67, 0.14) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold"],
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold"] :is(td, span, b, strong, h3, h4, a, svg) {
  color: var(--esb-gold-bright) !important;
  stroke: var(--esb-gold-bright) !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold"] {
  background-color: rgba(212, 168, 67, 0.12) !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold"],
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold"] :is(td:first-child, span, b, strong, h3, h4, a, svg) {
  color: var(--esb-gold-deep) !important;
  stroke: var(--esb-gold-deep) !important;
}

@media screen and (max-width: 768px) {
  #esb-sidebar-pin {
    display: none !important;
  }
}
/* ESB-UNIFIED-UI-END */

/* ESB-UNIFIED-UI-START */
:root {
  --esb-sb-w: 204px;
  --esb-main-left: 204px;
  --esb-gold: var(--brand-gold, #D4A843);
  --esb-gold-bright: var(--brand-gold-shine,#FFD766);
  --esb-gold-deep: var(--brand-gold-deep, #8A5F10);
}
html.im-sidebar-collapsed,
body.im-sidebar-collapsed {
  --esb-sb-w: 56px;
  --esb-main-left: 56px;
}
html.im-sidebar-collapsed.im-sidebar-peek,
body.im-sidebar-collapsed.im-sidebar-peek {
  --esb-sb-w: 204px;
  --esb-main-left: 56px;
}

@media screen and (min-width: 769px) {
  html, body[data-auth-state="authenticated"] {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* 1. Sleek 204px / 56px sidebar container */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--esb-sb-w) !important;
    min-width: var(--esb-sb-w) !important;
    max-width: var(--esb-sb-w) !important;
    height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    z-index: 30060 !important;
    background: linear-gradient(180deg, #0b1c34 0%, #102747 100%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.12) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent !important;
    transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed.im-sidebar-peek aside.sidebar {
    box-shadow: 14px 0 36px rgba(6, 14, 28, 0.55) !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar::-webkit-scrollbar {
    width: 4px !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar::-webkit-scrollbar-track {
    background: transparent !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22) !important;
    border-radius: 999px !important;
  }

  /* 2. Brand header: prominent [Logo] eSmartBooks / FINANCIAL lockup with zero toggle overlap */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar .brand,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed.im-sidebar-peek aside.sidebar .brand {
    width: 100% !important;
    height: 50px !important;
    min-height: 50px !important;
    max-height: 50px !important;
    margin: 0 !important;
    padding: 0 18px 0 10px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar .brand > :not(:first-child):not(.esb-brand-title) { display: none !important; }
  html body[data-auth-state="authenticated"] aside.sidebar .brand > :first-child {
    width: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar .brand button,
  html body[data-auth-state="authenticated"] aside.sidebar :is(#sidebar-toggle, .sidebar-toggle, #sb-toggle, .sb-toggle, [data-sidebar-toggle]) {
    display: none !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar .brand svg,
  html body[data-auth-state="authenticated"] aside.sidebar .brand img {
    width: 32px !important;
    height: 32px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar .brand .esb-brand-line1 {
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    color: #ffffff !important;
    line-height: 1.05 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35) !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar .brand .esb-gold-e {
    color: var(--brand-gold-shine,#FFD766) !important;
    font-weight: 800 !important;
    font-style: normal !important;
    text-shadow: 0 0 12px rgba(255, 213, 79, 0.5) !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar .brand .esb-brand-line2 {
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: var(--brand-gold-shine,#FFD766) !important;
    line-height: 1.05 !important;
  }
  /* Reveal wordmark and labels cleanly when expanded or peeking */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"]:is(:not(.im-sidebar-collapsed), .im-sidebar-peek) aside.sidebar :is(.esb-word, .brand-sub, #nav .nav-item > b, #nav .nav-item > span:not(.nav-ico)) {
    display: inline-flex !important;
    align-items: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: visible !important;
  }

  /* 4. Sidebar navigation rows: clean theme neutral at rest, golden ONLY on cursor hover */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav {
    width: 100% !important;
    padding: 2px 8px 14px 8px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 2px !important;
    box-sizing: border-box !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed aside.sidebar #nav .nav-item,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item.active,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed aside.sidebar #nav .nav-item.active {
    position: relative !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    margin: 0 !important;
    padding: 0 11px !important;
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 11px !important;
    background: transparent !important;
    color: rgba(241, 245, 249, 0.88) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-align: left !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    transform-origin: left center !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed:not(.im-sidebar-peek) aside.sidebar #nav .nav-item,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed:not(.im-sidebar-peek) aside.sidebar #nav .nav-item.active {
    padding: 0 !important;
    justify-content: center !important;
  }

  /* Kill all pseudo-elements, curved arcs, and floating tooltips when labels are visible */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item::before,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item::after,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item *::before,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item *::after,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"]:is(:not(.im-sidebar-collapsed), .im-sidebar-peek) :is(#sb-rail-tip, #nav-tip, .sb-tooltip, .nav-tip, [role="tooltip"]) {
    content: none !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar #nav .nav-item svg {
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    display: block !important;
    color: rgba(241, 245, 249, 0.88) !important;
  }

  /* 5. Main workspace synced to --esb-main-left */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] main {
    margin-left: var(--esb-main-left) !important;
    width: calc(100vw - var(--esb-main-left)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - var(--esb-main-left)) !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    transition: margin-left 0.2s cubic-bezier(0.22, 1, 0.36, 1), width 0.2s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  /* 6. Clean stacked Menubar (38px) + Topbar (48px) */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] #global-menubar {
    position: sticky !important;
    top: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    padding: 0 14px 0 18px !important;
    display: flex !important;
    align-items: center !important;
    z-index: 30030 !important;
    box-sizing: border-box !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] header.topbar {
    position: sticky !important;
    top: 38px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    margin: 0 !important;
    padding: 0 16px 0 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    z-index: 30020 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] header.topbar #mobile-menu {
    display: none !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] header.topbar .top-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] header.topbar #sb-search {
    width: 165px !important;
    max-width: 165px !important;
  }

  /* 7. Content area below topbar */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] section#app.content {
    margin-top: 0 !important;
    padding: 12px 20px 24px 20px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] section#app.content > * {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] section#app.content > :first-child {
    margin-top: 0 !important;
  }

  /* 8. Sidebar toggle badge (#esb-sidebar-pin) moving synchronously with var(--esb-sb-w) */
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] #esb-sidebar-pin,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed #esb-sidebar-pin,
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"].im-sidebar-collapsed.im-sidebar-peek #esb-sidebar-pin {
    position: fixed !important;
    top: 12px !important;
    left: calc(var(--esb-sb-w) - 12px) !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 30080 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    background: var(--brand-action) !important;
    color: #ffffff !important;
    border: 2px solid #0b1c34 !important;
    box-shadow: 0 2px 8px rgba(6, 14, 28, 0.45) !important;
    transition: left 0.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.14s ease, transform 0.14s ease, color 0.14s ease !important;
  }
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] #esb-sidebar-pin:hover {
    background: var(--esb-gold) !important;
    color: #0b1c34 !important;
    transform: scale(1.14) !important;
  }
}

/* 9. CURSOR-ONLY TIER 1: SIDEBAR, TOP MENU BAR & TOP MENU LISTS -> GOLDEN ICON + NAME + MAGNIFY ON CURSOR */
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="magnify"],
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="magnify"] *,
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-neighbor="1"] {
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

/* Sidebar: BOTH icon and name turn luxury golden & magnify together */
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar [data-esb-hover="magnify"] {
  transform: scale(1.075) translateX(4px) !important;
  background: rgba(212, 168, 67, 0.18) !important;
  box-shadow: 0 6px 18px rgba(6, 14, 28, 0.38) !important;
  z-index: 6 !important;
}
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] aside.sidebar [data-esb-hover="magnify"] :is(b, span, strong) {
  font-weight: 600 !important;
}

/* Top Menu Bar, Top Bar & Top Menu Dropdown Lists: BOTH icon and name turn luxury golden & magnify together */
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] :not(aside.sidebar) [data-esb-hover="magnify"] {
  transform: scale(1.065) translateY(-1px) !important;
  border-color: var(--esb-gold) !important;
  box-shadow: 0 4px 14px rgba(212, 168, 67, 0.24) !important;
  z-index: 20 !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] :not(aside.sidebar) [data-esb-hover="magnify"] {
  background-color: rgba(212, 168, 67, 0.14) !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] :not(aside.sidebar) [data-esb-hover="magnify"] {
  background-color: rgba(212, 168, 67, 0.18) !important;
}

/* Neighbor proximity lift & icon scale inside Sidebar & Top Menus */
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-neighbor="1"] {
  transform: scale(1.02) !important;
}
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="magnify"] svg {
  transform: scale(1.2) !important;
}

/* 10. CURSOR-ONLY TIER 2: PAGE TABS, FILTER PILLS, LISTS & TABLE ROWS -> GOLDEN HOVER (ZERO SCALE) */
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="gold-tab"] {
  transform: none !important;
  border-color: var(--esb-gold) !important;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold-tab"] {
  background-color: rgba(212, 168, 67, 0.18) !important;
  border-color: var(--esb-gold) !important;
  box-shadow: 0 3px 12px rgba(212, 168, 67, 0.24) !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold-tab"] {
  background-color: rgba(212, 168, 67, 0.15) !important;
  border-color: var(--esb-gold) !important;
  box-shadow: 0 3px 12px rgba(212, 168, 67, 0.2) !important;
}

html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="gold-row"],
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="gold-row"] > :is(td, div, span) {
  transform: none !important;
  transition: background-color 0.14s ease, box-shadow 0.14s ease !important;
}
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold-row"],
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold-row"] > td {
  background-color: rgba(212, 168, 67, 0.16) !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold-row"],
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold-row"] > td {
  background-color: rgba(212, 168, 67, 0.14) !important;
}
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] [data-esb-hover="gold-row"] > td:first-child {
  box-shadow: inset 3px 0 0 var(--esb-gold) !important;
}

/* Mobile drawer behavior + Toggle Badge Styling */
@media screen and (max-width: 768px) {
  html body[data-auth-state="authenticated"] #esb-sidebar-pin {
    display: none !important;
  }
  html body[data-auth-state="authenticated"] aside.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 240px !important;
    transform: translateX(-100%) !important;
    transition: transform 0.22s ease !important;
    z-index: 30090 !important;
  }
  html body[data-auth-state="authenticated"].sb-open aside.sidebar {
    transform: translateX(0) !important;
  }
  html body[data-auth-state="authenticated"] #global-menubar,
  html body[data-auth-state="authenticated"] header.topbar,
  html body[data-auth-state="authenticated"] .main,
  html body[data-auth-state="authenticated"] main {
    left: 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
  }
}

html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] #esb-sidebar-pin {
  background: linear-gradient(135deg, var(--brand-action) 0%, var(--brand-action-hover) 100%) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35) !important;
  cursor: pointer !important;
  transition: transform 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease !important;
}
html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] #esb-sidebar-pin:hover {
  border-color: var(--esb-gold-bright) !important;
  color: var(--esb-gold-bright) !important;
  transform: scale(1.1) !important;
  box-shadow: 0 4px 14px rgba(212, 168, 67, 0.45) !important;
}

/* Global Golden Hover for Every Tab, Sub-Tab, Pill & Interactive Control Across All Pages */
html[data-theme="dark"] body[data-auth-state="authenticated"] [data-esb-hover="gold-tab"] {
  background-color: rgba(212, 168, 67, 0.18) !important;
  border-color: var(--esb-gold) !important;
  color: var(--esb-gold-bright) !important;
  box-shadow: 0 3px 12px rgba(212, 168, 67, 0.22) !important;
  transform: none !important;
}
html:not([data-theme="dark"]) body[data-auth-state="authenticated"] [data-esb-hover="gold-tab"] {
  background-color: rgba(212, 168, 67, 0.15) !important;
  border-color: var(--esb-gold) !important;
  color: var(--esb-gold-dark) !important;
  box-shadow: 0 3px 12px rgba(212, 168, 67, 0.18) !important;
  transform: none !important;
}
/* Module tabs stay in view at the top of the page area.
   On screens wider than 768px #app itself is the scroll box (auth-shell.css: height = viewport minus
   menu bar and header, overflow-y:auto), so the sticky offset is measured from the top of #app, not
   the window. top:-12px cancels #app's 12px top padding so the row sits flush under the header.
   (It was 86px, which counted the menu bar and header a second time: the row hung 86px low over the
   KPI cards and the first filters, leaving an empty band above it.) */
@media screen and (min-width: 769px) {
  html:is([data-theme], :not([data-theme])) body[data-auth-state="authenticated"] section#app.content {
    overflow-x: clip !important;
  }
  html body[data-auth-state="authenticated"] #app#app > .esb-module-bar {
    position: sticky !important;
    top: -12px !important;
    z-index: 30015 !important;
    margin-top: 0 !important;
    padding-top: 8px !important;
    padding-bottom: 6px !important;
    background: var(--brand-page) !important;
  }
}

/* Module tab row: keep New transaction on the tab line. The tabs take the free width (basis 0) and the
   Priority+ controller in modules.js moves tabs that do not fit into More, instead of the row wrapping
   to a second line. */
@media screen and (min-width: 769px) {
  html body[data-auth-state="authenticated"] #app#app > .esb-module-bar { flex-wrap: nowrap !important; }
  html body[data-auth-state="authenticated"] #app#app > .esb-module-bar > .esb-tabs { flex: 1 1 0 !important; min-width: 0 !important; }
}

/* ---------- Luxury sidebar controls: + New button and the collapse toggle (2026-11-16) ----------
   Deep navy with a fine gold rim and gold glyphs; on hover the rim brightens and glows (the toggle turns polished gold). */
html body[data-auth-state="authenticated"] aside.sidebar button.create-btn.create-btn.create-btn{
  position:relative!important;overflow:hidden!important;
  background:linear-gradient(160deg,#21426b 0%,#132c4d 48%,#0b1d36 100%)!important;
  color:#f3d68a!important;-webkit-text-fill-color:#f3d68a!important;
  border:1px solid rgba(232,196,104,.78)!important;border-radius:12px!important;
  box-shadow:inset 0 1px 0 rgba(255,236,186,.22),inset 0 -1px 0 rgba(0,0,0,.35),0 0 0 3px rgba(212,168,67,.10),0 8px 18px rgba(3,10,22,.5)!important;
  font-weight:700!important;letter-spacing:.04em!important;text-shadow:0 1px 0 rgba(0,0,0,.35)!important;
  transition:transform .18s cubic-bezier(.22,1,.36,1),box-shadow .18s ease,background .18s ease,color .18s ease,border-color .18s ease!important;
}
/* soft sheen across the top half */
html body[data-auth-state="authenticated"] aside.sidebar button.create-btn.create-btn.create-btn::before{
  content:"";position:absolute;inset:0 0 50% 0;pointer-events:none;border-radius:inherit;
  background:linear-gradient(180deg,rgba(255,236,186,.16),rgba(255,236,186,0))!important;
}
html body[data-auth-state="authenticated"] aside.sidebar button.create-btn.create-btn.create-btn :is(svg,path,line,.esb-new-label,span,em){
  color:inherit!important;-webkit-text-fill-color:currentColor!important;stroke:currentColor!important;
}
html body[data-auth-state="authenticated"] aside.sidebar button.create-btn.create-btn.create-btn:is(:hover,:focus-visible,[data-esb-hover="magnify"]){
  background:linear-gradient(160deg,#2b5487 0%,#173a63 50%,#0e2442 100%)!important;
  color:#ffe08a!important;-webkit-text-fill-color:#ffe08a!important;border-color:#ffe6a3!important;
  box-shadow:inset 0 1px 0 rgba(255,236,186,.35),0 0 0 3px rgba(232,196,104,.28),0 0 18px rgba(232,196,104,.35),0 10px 22px rgba(3,10,22,.5)!important;
  transform:translateY(-1px) scale(1.03)!important;outline:none!important;
}
html body[data-auth-state="authenticated"] aside.sidebar button.create-btn.create-btn.create-btn:active{transform:translateY(0) scale(.98)!important}

/* Collapse / expand toggle: a navy medallion with a gold rim and gold chevron. */
html body[data-auth-state="authenticated"] #esb-sidebar-pin#esb-sidebar-pin{
  width:26px!important;height:26px!important;top:12px!important;left:calc(var(--esb-sb-w) - 13px)!important;
  background:radial-gradient(circle at 32% 28%,#2b5185 0%,#14304f 55%,#0a1a30 100%)!important;
  color:#f3d68a!important;border:1.5px solid rgba(232,196,104,.9)!important;
  box-shadow:inset 0 1px 0 rgba(255,236,186,.28),0 0 0 3px rgba(11,29,54,.85),0 4px 12px rgba(3,10,22,.55)!important;
}
html body[data-auth-state="authenticated"] #esb-sidebar-pin#esb-sidebar-pin svg{stroke:currentColor!important;filter:drop-shadow(0 1px 0 rgba(0,0,0,.35))}
html body[data-auth-state="authenticated"] #esb-sidebar-pin#esb-sidebar-pin:is(:hover,:focus-visible){
  background:radial-gradient(circle at 32% 28%,#fff1c4 0%,#e6bf5c 55%,#b98a2b 100%)!important;
  color:#0b1d36!important;border-color:#fff0c2!important;transform:scale(1.12)!important;outline:none!important;
  box-shadow:0 0 0 3px rgba(11,29,54,.85),0 6px 18px rgba(212,168,67,.5)!important;
}

/* Sidebar + New button: the only sizing rules (2026-11-16). Older layers in styles.css and theme-dark.css removed.
   Open sidebar, or a collapsed sidebar opened by hovering (peek): full width with "+ New".
   Collapsed and not peeking: a square with a gold "+" (the sheen uses ::before, so the glyph uses ::after). */
@media screen and (min-width: 769px) {
  html body[data-auth-state="authenticated"]:is(:not(.im-sidebar-collapsed), .im-sidebar-peek) aside.sidebar button.create-btn.create-btn.create-btn {
    display:flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;
    width:calc(100% - 16px)!important;min-width:0!important;max-width:none!important;height:38px!important;min-height:38px!important;
    margin:8px 8px 10px!important;padding:0 14px!important;font-size:13.5px!important;line-height:1!important;white-space:nowrap!important;
  }
  html body[data-auth-state="authenticated"]:is(:not(.im-sidebar-collapsed), .im-sidebar-peek) aside.sidebar button.create-btn.create-btn.create-btn::after {content:none!important}
  html body[data-auth-state="authenticated"].im-sidebar-collapsed:not(.im-sidebar-peek) aside.sidebar button.create-btn.create-btn.create-btn {
    display:flex!important;align-items:center!important;justify-content:center!important;
    width:42px!important;min-width:42px!important;max-width:42px!important;height:38px!important;min-height:38px!important;
    margin:8px auto 10px!important;padding:0!important;font-size:0!important;line-height:0!important;overflow:hidden!important;
  }
  html body[data-auth-state="authenticated"].im-sidebar-collapsed:not(.im-sidebar-peek) aside.sidebar button.create-btn.create-btn.create-btn::after {
    content:"+"!important;display:block!important;font-size:22px!important;font-weight:700!important;line-height:1!important;
    color:var(--brand-gold-shine,#FFD766)!important;-webkit-text-fill-color:var(--brand-gold-shine,#FFD766)!important;
  }
}
