/* BizPanel design system: the one source of truth for tokens, the app shell and shared components.
   Loaded LAST (after theme.css). Spec for page authors: upgrade_docs or the agent spec DESIGN_SYSTEM.md.
   1 Tokens  2 Base  3 App shell  4 Components (.ui-*)  5 Legacy class aliases  6 Print */

/* ───────────────────────────── 1. TOKENS ───────────────────────────── */
:root {
    /* colour roles (light) */
    --bp-bg: #f3f6fb;
    --bp-surface: #ffffff;
    --bp-soft: #edf3fa;
    --bp-field: #ffffff;
    --bp-text: #24364b;
    --bp-muted: #52657c;
    --bp-border: #d5dfeb;
    --bp-border-strong: #b9c4d2;
    --bp-accent: #1d5bbf;
    --bp-accent-hover: #174a9c;
    --bp-tint: #e8f0fd;
    --bp-primary: #255fc4;
    --bp-primary-hover: #174a9c;
    --bp-on-primary: #ffffff;
    --bp-success: #146c43;
    --bp-success-bg: #e3f4ea;
    --bp-save-fill: #13744b;
    --bp-save-hover: #0e5a39;
    --bp-danger: #b3261e;
    --bp-danger-bg: #fbe9e7;
    --bp-danger-solid: #b3261e;
    --bp-warning: #7a5200;
    --bp-warning-bg: #fdf2d8;
    --bp-info: #0b607c;
    --bp-info-bg: #e2f2f7;
    --bp-neutral-bg: #e9edf2;
    --bp-row-hover: #f3f7fd;
    --bp-zebra: #f8fafc;
    --bp-overlay: rgba(15, 23, 34, .5);
    --bp-shadow: 0 4px 16px rgba(30, 52, 83, .09);
    --bp-shadow-pop: 0 8px 28px rgba(22, 34, 51, .18);
    --bp-focus: #1d5bbf;
    /* shell */
    --bp-header-bg: #193b65;
    --bp-header-text: #ffffff;
    --bp-header-muted: #dce9f7;
    --bp-header-control: rgba(255, 255, 255, .1);
    --bp-header-control-hover: rgba(255, 255, 255, .18);
    --bp-header-border: rgba(255, 255, 255, .22);
    --bp-tenant-banner: linear-gradient(110deg, #435bc0, #7345a5);
    --bp-header-h: 60px;
    --bp-sidebar-w: 236px;
    --bp-rail-w: 56px;
    /* spacing scale (4px base) */
    --bp-s1: 4px; --bp-s2: 8px; --bp-s3: 12px; --bp-s4: 16px; --bp-s5: 20px; --bp-s6: 24px; --bp-s7: 32px; --bp-s8: 40px;
    /* radius */
    --bp-r-sm: 6px; --bp-r: 8px; --bp-r-lg: 12px; --bp-r-pill: 999px;
    /* type scale */
    --bp-font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --bp-font-num: var(--bp-font);
    --bp-fs-xs: 12px; --bp-fs-sm: 13px; --bp-fs: 14px; --bp-fs-lg: 16px; --bp-fs-xl: 18px; --bp-fs-2xl: 22px;
    --bp-lh: 1.45;
    /* controls and tables */
    --bp-control-h: 36px;
    --bp-control-h-sm: 30px;
    --bp-control-px: 12px;
    --bp-row-h: 36px;
    --bp-cell-px: 12px;
    --bp-cell-py: 7px;
    /* layers */
    --bp-z-sticky: 5; --bp-z-sidebar: 999; --bp-z-header: 1000; --bp-z-drawer: 1001; --bp-z-pop: 1100;
    /* breakpoints (documentation; media queries cannot read variables): phone < 768, tablet 768-1199, desktop >= 1200 */
    --bp-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23566578' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 6l5 5 5-5'/%3e%3c/svg%3e");
}
@media screen {
    :root[data-theme="dark"] {
        color-scheme: dark;
        --bp-bg: #0f1722;
        --bp-surface: #18222f;
        --bp-soft: #202c3b;
        --bp-field: #121b27;
        --bp-text: #e6edf5;
        --bp-muted: #a9b8c9;
        --bp-border: #334456;
        --bp-border-strong: #4a5d73;
        --bp-accent: #8ab6ff;
        --bp-accent-hover: #b0cdff;
        --bp-tint: #1f3354;
        --bp-primary: #2c68cf;
        --bp-primary-hover: #3c78de;
        --bp-on-primary: #ffffff;
        --bp-success: #7fdcae;
        --bp-success-bg: #153526;
        --bp-save-fill: #13744b;
        --bp-save-hover: #0c603c;
        --bp-danger: #ffa4a0;
        --bp-danger-bg: #40201f;
        --bp-danger-solid: #c2413a;
        --bp-warning: #f3cb7c;
        --bp-warning-bg: #3a2e14;
        --bp-info: #86d3ea;
        --bp-info-bg: #143340;
        --bp-neutral-bg: #2a3848;
        --bp-row-hover: #1e2c3e;
        --bp-zebra: #1b2634;
        --bp-overlay: rgba(0, 0, 0, .6);
        --bp-shadow: 0 1px 2px rgba(0, 0, 0, .3);
        --bp-shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
        --bp-focus: #8ab6ff;
        --bp-header-bg: #121c2a;
        --bp-tenant-banner: linear-gradient(110deg, #263b83, #542d77);
        --bp-header-border: rgba(255, 255, 255, .18);
        --bp-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a9b8c9' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 6l5 5 5-5'/%3e%3c/svg%3e");
    }
}

/* ───────────────────────────── 2. BASE ───────────────────────────── */
@media screen {
    html body.tenant-app {
        font-family: var(--bp-font); font-size: var(--bp-fs); line-height: var(--bp-lh);
        background: var(--bp-bg); color: var(--bp-text);
        -webkit-text-size-adjust: 100%; overflow-x: hidden;
    }
    body.tenant-app :is(button, input, select, textarea) { font-family: inherit; }
    :where(body.tenant-app) a { color: var(--bp-accent); }
    body.tenant-app ::selection { background: var(--bp-tint); color: var(--bp-text); }
}
.bp-icon { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bp-icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.bp-icon-lg { width: 22px; height: 22px; vertical-align: -5px; }
.ui-sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ui-num, .ui-amount { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ui-muted { color: var(--bp-muted); }
.ui-text-lines { white-space: pre-line; overflow-wrap: anywhere; }
.ui-nowrap { white-space: nowrap; }
.ui-pos { color: var(--bp-success); }
.ui-neg { color: var(--bp-danger); }

/* ───────────────────────────── 3. APP SHELL ───────────────────────────── */
@media screen {
    /* Header */
    html body.tenant-app .bp-topbar {
        position: fixed; inset: 0 0 auto 0; z-index: var(--bp-z-header); height: var(--bp-header-h);
        display: flex; align-items: center; gap: var(--bp-s3); padding: 0 var(--bp-s4) 0 var(--bp-s2);
        background: var(--bp-header-bg); color: var(--bp-header-text); box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
        font-size: var(--bp-fs);
    }
    .bp-topbar .bp-topbar-btn {
        display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
        width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--bp-r);
        background: transparent; color: var(--bp-header-text); cursor: pointer; text-decoration: none;
    }
    .bp-topbar .bp-topbar-btn:hover { background: var(--bp-header-control-hover); color: var(--bp-header-text); }
    .bp-topbar .bp-topbar-btn .bp-icon { width: 20px; height: 20px; }
    .bp-topbar :is(a, button):focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }
    .bp-topbar .bp-brand, .bp-topbar .bp-brand:hover { color: var(--bp-header-text); }
    .bp-brand { display: flex; align-items: center; gap: var(--bp-s2); min-width: 0; flex: 0 1 auto; max-width: 30%; color: inherit; text-decoration: none; }
    .bp-brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: var(--bp-r); background: var(--bp-header-control); }
    .bp-brand-name { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--bp-header-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bp-crumbs { display: flex; align-items: center; gap: var(--bp-s2); min-width: 0; flex: 1 1 auto; padding-left: var(--bp-s3); margin-left: var(--bp-s1); border-left: 1px solid var(--bp-header-border); color: var(--bp-header-muted); font-size: var(--bp-fs-sm); white-space: nowrap; overflow: hidden; }
    .bp-crumbs .bp-crumb-sep { opacity: .6; flex: 0 0 auto; }
    .bp-crumbs .bp-crumb-current { color: var(--bp-header-text); font-weight: 600; font-size: var(--bp-fs); overflow: hidden; text-overflow: ellipsis; }
    .bp-crumbs .bp-crumb-action { flex: 0 0 auto; padding: 1px 8px; border-radius: var(--bp-r-pill); background: var(--bp-header-control); color: var(--bp-header-text); font-size: var(--bp-fs-xs); }
    .bp-topbar-actions { display: flex; align-items: center; gap: var(--bp-s2); flex: 0 0 auto; margin-left: auto; }
    .bp-topbar .bp-new { position: relative; }
    .bp-topbar .bp-new-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--bp-header-border); border-radius: var(--bp-r); background: var(--bp-header-control); color: var(--bp-header-text); font-size: var(--bp-fs-sm); font-weight: 600; cursor: pointer; white-space: nowrap; }
    .bp-topbar .bp-new-btn:hover { background: var(--bp-header-control-hover); }

    /* Easy / Pro switch (keeps the existing ids, classes and behaviour) */
    html body.tenant-app .bp-topbar .accounting-mode-toggle {
        position: relative; isolation: isolate; overflow: hidden; display: inline-flex; align-items: stretch; flex: 0 0 auto;
        width: 112px; min-width: 112px; height: 34px; padding: 3px; gap: 0; margin: 0;
        border: 1px solid var(--bp-header-border); border-radius: var(--bp-r); background: rgba(0, 0, 0, .22); box-shadow: none;
        color: var(--bp-header-text); font-size: var(--bp-fs-sm); cursor: pointer; white-space: nowrap; transform: none;
    }
    html body.tenant-app .bp-topbar .accounting-mode-toggle::before { left: 3px; top: 3px; width: calc(50% - 3px); height: calc(100% - 6px); border-radius: 4px; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
    html body.tenant-app .bp-topbar .accounting-mode-toggle[data-mode="pro"]::before { transform: translateX(100%); background: #ffe7a3; }
    html body.tenant-app .bp-topbar .accounting-mode-toggle .mode-label { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 3px; font-weight: 600; letter-spacing: 0; color: var(--bp-header-muted); }
    html body.tenant-app .bp-topbar .accounting-mode-toggle[data-mode="easy"] .mode-easy { color: #17273d; }
    html body.tenant-app .bp-topbar .accounting-mode-toggle[data-mode="pro"] .mode-pro { color: #4a3505; }
    .bp-topbar .accounting-mode-toggle .mode-spark { display: inline-flex; margin: 0; }
    .bp-topbar .accounting-mode-toggle .mode-spark .bp-icon { width: 12px; height: 12px; vertical-align: 0; }
    html body.tenant-app .bp-topbar [data-theme-toggle] { border: 0; font-size: inherit; }
    .bp-topbar [data-theme-toggle] .bp-theme-sun, html[data-theme="dark"] .bp-topbar [data-theme-toggle] .bp-theme-moon { display: none; }
    html[data-theme="dark"] .bp-topbar [data-theme-toggle] .bp-theme-sun { display: inline-block; }

    /* User menu and header dropdowns */
    .bp-user { position: relative; flex: 0 0 auto; }
    .bp-topbar .bp-user-btn { display: inline-flex; align-items: center; gap: var(--bp-s2); height: 40px; padding: 0 6px 0 4px; border: 0; border-radius: var(--bp-r); background: transparent; color: var(--bp-header-text); cursor: pointer; max-width: 220px; }
    .bp-topbar .bp-user-btn:hover, .bp-user.active .bp-user-btn { background: var(--bp-header-control-hover); }
    .bp-user-avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; background: #2f6fd6; color: #ffffff; font-weight: 600; font-size: var(--bp-fs-sm); }
    .bp-user-meta { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; text-align: left; }
    .bp-user-name { max-width: 140px; font-size: var(--bp-fs-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bp-user-role { font-size: 11px; color: var(--bp-header-muted); }
    html body.tenant-app .bp-menu {
        position: absolute; top: calc(100% + 6px); right: 0; z-index: var(--bp-z-pop); min-width: 216px; margin: 0; padding: var(--bp-s1);
        background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow-pop);
        opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s, visibility .12s; pointer-events: none;
    }
    html body.tenant-app .bp-menu.show { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
    html body.tenant-app .bp-menu .dropdown-item { display: flex; align-items: center; gap: var(--bp-s2); min-height: 38px; padding: 0 var(--bp-s3); border-radius: var(--bp-r-sm); color: var(--bp-text); background: transparent; font-size: var(--bp-fs); text-decoration: none; white-space: nowrap; }
    html body.tenant-app .bp-menu .dropdown-item:hover { background: var(--bp-tint); color: var(--bp-accent); }
    html body.tenant-app .bp-menu .dropdown-item .bp-icon { color: var(--bp-muted); }
    html body.tenant-app .bp-menu .dropdown-divider { height: 1px; margin: var(--bp-s1) 0; background: var(--bp-border); }
    .bp-menu-caption { padding: 6px var(--bp-s3) 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--bp-muted); }

    /* Layout: header + sidebar + scrolling content */
    html body.tenant-app .main-container, html body.tenant-app .main-wrapper {
        display: block; margin: var(--bp-header-h) 0 0 0; padding: 0; min-height: 0; max-width: none;
        height: calc(100vh - var(--bp-header-h)); height: calc(100dvh - var(--bp-header-h)); background: var(--bp-bg);
    }
    html body.tenant-app .main-container > .content, html body.tenant-app .main-wrapper > :is(.content, .dashboard-container) {
        display: block; height: 100%; margin: 0 0 0 var(--bp-sidebar-w); padding: var(--bp-s4) var(--bp-s5) var(--bp-s8); max-width: none; width: auto;
        overflow-y: auto; overflow-x: hidden; background: var(--bp-bg); min-width: 0; transition: margin-left .18s ease;
    }
    /* Pages that never included the sidebar get it from the footer; give them the same frame. */
    html body.tenant-app:has(> .bp-topbar):not(:has(.main-container, .main-wrapper)) { padding: calc(var(--bp-header-h) + var(--bp-s4)) var(--bp-s5) var(--bp-s8) calc(var(--bp-sidebar-w) + var(--bp-s5)); transition: padding-left .18s ease; }

    /* Sidebar */
    html body.tenant-app .bp-sidebar {
        position: fixed; top: var(--bp-header-h); left: 0; bottom: 0; z-index: var(--bp-z-sidebar); width: var(--bp-sidebar-w); height: auto;
        display: flex; flex-direction: column; margin: 0; padding: 0; overflow: hidden; transform: none;
        background: var(--bp-surface); color: var(--bp-text); border: 0; border-right: 1px solid var(--bp-border); box-shadow: none;
        font-size: var(--bp-fs); transition: width .18s ease, transform .2s ease;
    }
    .bp-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: var(--bp-s2); scrollbar-width: thin; scrollbar-color: var(--bp-border-strong) transparent; }
    .bp-nav ul { list-style: none; margin: 0; padding: 0; }
    .bp-nav-top > li { margin: 0 0 2px; }
    .bp-nav :is(a.bp-nav-link, button.bp-nav-head) {
        display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; margin: 0; padding: 0 8px 0 10px; box-sizing: border-box;
        border: 0; border-radius: var(--bp-r); background: transparent; color: var(--bp-text); font: inherit; font-weight: 600; font-size: var(--bp-fs);
        text-align: left; text-decoration: none; text-transform: none; letter-spacing: 0; cursor: pointer; white-space: nowrap; transform: none; box-shadow: none;
    }
    .bp-nav :is(a.bp-nav-link, button.bp-nav-head) > .bp-icon { color: var(--bp-muted); width: 18px; height: 18px; }
    .bp-nav .bp-nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .bp-nav .bp-nav-caret { width: 14px; height: 14px; color: var(--bp-muted); transition: transform .15s ease; }
    .bp-nav .bp-nav-head[aria-expanded="true"] .bp-nav-caret { transform: rotate(90deg); }
    .bp-nav :is(a.bp-nav-link, button.bp-nav-head):hover { background: var(--bp-soft); color: var(--bp-text); }
    .bp-nav .bp-nav-section.has-active > .bp-nav-head { color: var(--bp-accent); }
    .bp-nav .bp-nav-section.has-active > .bp-nav-head > .bp-icon { color: var(--bp-accent); }
    .bp-nav a.bp-nav-link.active { background: var(--bp-tint); color: var(--bp-accent); }
    .bp-nav a.bp-nav-link.active > .bp-icon { color: var(--bp-accent); }
    .bp-nav .bp-nav-items { margin: 0 0 var(--bp-s1); padding: 0 0 0 18px; }
    .bp-nav .bp-nav-items[hidden] { display: none; }
    .bp-nav .bp-nav-items > li { border-left: 1px solid var(--bp-border); }
    .bp-nav a.bp-nav-sub {
        position: relative; display: flex; align-items: center; min-height: 32px; margin: 0 0 0 -1px; padding: 4px 8px 4px 14px; box-sizing: border-box;
        border-left: 2px solid transparent; border-radius: 0 var(--bp-r-sm) var(--bp-r-sm) 0; background: transparent;
        color: var(--bp-text); font-size: var(--bp-fs-sm); font-weight: 400; line-height: 1.3; text-decoration: none; transform: none;
    }
    .bp-nav a.bp-nav-sub:hover { background: var(--bp-soft); color: var(--bp-text); }
    .bp-nav a.bp-nav-sub.active { border-left-color: var(--bp-accent); background: var(--bp-tint); color: var(--bp-accent); font-weight: 600; }
    .bp-nav :is(a, button):focus-visible { outline: 2px solid var(--bp-focus); outline-offset: -2px; }
    /* Section panels (.bp-nav-flyout, business app and platform admin): a section head opens the section's links in a panel beside the
       menu, over the page. Captions become titled groups laid out in columns; a section without captions is one list.
       Phone: the panel fills the screen under the header, with Back to the menu. */
    html body.tenant-app .bp-sidebar { --bp-nav-panel-left: var(--bp-sidebar-w); }
    .bp-nav-flyout button.bp-nav-head[aria-expanded="true"] { background: var(--bp-tint); }
    .bp-nav-flyout .bp-nav-head[aria-expanded="true"] .bp-nav-caret { transform: none; }
    .bp-nav .bp-nav-panel {
        position: fixed; top: var(--bp-header-h); bottom: 0; left: var(--bp-nav-panel-left); z-index: 1;
        display: flex; flex-direction: column; width: min(var(--bp-nav-panel-w, 284px), calc(100vw - var(--bp-nav-panel-left) - var(--bp-s4)));
        margin: 0; padding: 0; background: var(--bp-surface); color: var(--bp-text); border-right: 1px solid var(--bp-border); box-shadow: var(--bp-shadow-pop);
        font-size: var(--bp-fs); line-height: var(--bp-lh); white-space: normal; text-align: left; animation: bp-nav-panel-in .14s ease-out;
    }
    .bp-nav .bp-nav-panel[hidden] { display: none; }
    .bp-nav .bp-nav-panel-2col { --bp-nav-panel-w: 500px; }
    .bp-nav .bp-nav-panel-3col { --bp-nav-panel-w: 728px; }
    @keyframes bp-nav-panel-in { from { opacity: 0; transform: translateX(-8px); } }
    @keyframes bp-nav-sheet-in { from { opacity: 0; transform: translateX(16px); } }
    @keyframes bp-nav-dim-in { from { opacity: 0; } }
    /* a very light dim over the page while a panel is open (look only: clicks still reach the page handler) */
    html body.tenant-app .bp-sidebar:not(.show):has(.bp-nav-flyout .bp-nav-panel:not([hidden]))::after {
        content: ""; position: fixed; top: var(--bp-header-h); right: 0; bottom: 0; left: var(--bp-nav-panel-left); z-index: 0;
        background: var(--bp-overlay); opacity: .22; pointer-events: none; animation: bp-nav-dim-in .16s ease-out;
    }
    .bp-nav-panel-head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: var(--bp-s3) var(--bp-s3) var(--bp-s3) var(--bp-s4); border-bottom: 1px solid var(--bp-border); }
    .bp-nav-panel-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 34px; height: 34px; border-radius: var(--bp-r-lg); background: var(--bp-tint); color: var(--bp-accent); }
    .bp-nav .bp-nav-panel-title { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; font-family: inherit; font-size: var(--bp-fs-lg); font-weight: 700; line-height: 1.3; letter-spacing: -.005em; text-transform: none; color: var(--bp-text); }
    .bp-nav :is(.bp-nav-panel-back, .bp-nav-panel-close) {
        display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 32px; height: 32px; margin: 0; padding: 0;
        border: 0; border-radius: var(--bp-r); background: transparent; color: var(--bp-muted); cursor: pointer; box-shadow: none; transition: background-color .12s ease, color .12s ease;
    }
    .bp-nav :is(.bp-nav-panel-back, .bp-nav-panel-close):hover { background: var(--bp-soft); color: var(--bp-text); }
    .bp-nav .bp-nav-panel-back { display: none; }
    .bp-nav-panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--bp-s4) var(--bp-s4) var(--bp-s5); scrollbar-width: thin; scrollbar-color: var(--bp-border-strong) transparent; }
    /* recently opened pages of this section (filled by shell.js; hidden when there are none) */
    .bp-nav-recent { margin: 0 0 var(--bp-s4); }
    .bp-nav .bp-nav-recent-title { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--bp-s2); font-size: var(--bp-fs-xs); font-weight: 600; line-height: 1.3; color: var(--bp-muted); }
    .bp-nav .bp-nav-recent-title > .bp-icon { width: 14px; height: 14px; }
    .bp-nav .bp-nav-chips { display: flex; flex-wrap: wrap; gap: 6px; }
    .bp-nav a.bp-nav-chip {
        display: inline-flex; align-items: center; max-width: 100%; min-height: 28px; padding: 3px 12px; box-sizing: border-box;
        border: 1px solid var(--bp-border); border-radius: var(--bp-r-pill); background: var(--bp-surface); color: var(--bp-text);
        font-size: var(--bp-fs-xs); font-weight: 500; line-height: 1.3; text-decoration: none; transition: background-color .12s ease, border-color .12s ease, color .12s ease;
    }
    .bp-nav a.bp-nav-chip:hover { border-color: var(--bp-accent); background: var(--bp-tint); color: var(--bp-accent); }
    /* groups are soft cards in equal columns; a section without captions is one card */
    .bp-nav-groups, .bp-nav-panel-body > .bp-nav-list:has(+ .bp-nav-groups) { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--bp-s3); align-items: start; }
    .bp-nav-panel-body > .bp-nav-list:has(+ .bp-nav-groups) { margin-bottom: var(--bp-s3); }
    .bp-nav :is(.bp-nav-group, .bp-nav-panel-body > .bp-nav-list:not(:has(+ .bp-nav-groups)), .bp-nav-panel-body > .bp-nav-list:has(+ .bp-nav-groups) > li) { min-width: 0; margin: 0; padding: 6px; border-radius: var(--bp-r-lg); background: var(--bp-soft); }
    .bp-nav .bp-nav-group { padding-top: var(--bp-s2); }
    .bp-nav .bp-nav-group-title { display: flex; align-items: center; gap: var(--bp-s2); margin: 0 0 6px; padding: 2px 6px 8px; border-bottom: 1px solid var(--bp-border); font-family: inherit; font-size: var(--bp-fs-sm); font-weight: 700; line-height: 1.3; letter-spacing: 0; text-transform: none; color: var(--bp-text); }
    .bp-nav .bp-nav-group-title > .bp-icon { width: 16px; height: 16px; color: var(--bp-accent); }
    .bp-nav .bp-nav-panel .bp-nav-list > li + li { margin-top: 1px; }
    .bp-nav .bp-nav-panel a.bp-nav-sub { min-height: 34px; margin: 0; padding: 6px 26px 6px 10px; border-left: 0; border-radius: var(--bp-r); transition: background-color .12s ease, color .12s ease; }
    @media (hover: hover) { .bp-nav .bp-nav-panel a.bp-nav-sub:hover { background: var(--bp-tint); color: var(--bp-text); } }
    @media (hover: none) { .bp-nav .bp-nav-panel a.bp-nav-sub:not(.active):hover { background: transparent; } }
    .bp-nav .bp-nav-panel a.bp-nav-sub::after {
        content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; box-sizing: border-box;
        border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; opacity: 0; transform: translateX(-5px) rotate(45deg); transition: opacity .14s ease, transform .14s ease;
    }
    .bp-nav .bp-nav-panel a.bp-nav-sub:focus-visible::after { opacity: .75; transform: translateX(0) rotate(45deg); }
    @media (hover: hover) { .bp-nav .bp-nav-panel a.bp-nav-sub:hover::after { opacity: .75; transform: translateX(0) rotate(45deg); } }
    .bp-nav .bp-nav-panel a.bp-nav-sub.active { background: var(--bp-tint); color: var(--bp-accent); font-weight: 600; }
    .bp-nav .bp-nav-panel a.bp-nav-sub.active::before { content: ""; position: absolute; left: 3px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--bp-accent); }
    .bp-nav-pro { margin-left: 6px; padding: 0 5px; border-radius: 3px; background: var(--bp-warning-bg); color: var(--bp-warning); font-size: 10px; font-weight: 700; letter-spacing: .03em; line-height: 16px; flex: 0 0 auto; }
    .bp-sidebar-foot { flex: 0 0 auto; display: flex; align-items: center; gap: var(--bp-s2); min-height: 44px; padding: var(--bp-s2) var(--bp-s3); border-top: 1px solid var(--bp-border); background: var(--bp-surface); color: var(--bp-muted); font-size: var(--bp-fs-xs); line-height: 1.3; }
    .bp-sidebar-foot .bp-plan-name { display: block; color: var(--bp-text); font-weight: 600; font-size: var(--bp-fs-sm); }
    .bp-sidebar-foot .bp-plan-text { min-width: 0; overflow: hidden; }
    .bp-sidebar-foot .bp-plan-text > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    html body.tenant-app .sidebar-overlay { display: none; position: fixed; inset: 0; z-index: var(--bp-z-header); background: var(--bp-overlay); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }

    /* Desktop: sidebar can collapse to an icon rail (html.bp-rail, remembered per browser) */
    @media (min-width: 1200px) {
        html.bp-rail body.tenant-app .bp-sidebar { width: var(--bp-rail-w); }
        html.bp-rail body.tenant-app .main-container > .content, html.bp-rail body.tenant-app .main-wrapper > :is(.content, .dashboard-container) { margin-left: var(--bp-rail-w); }
        html.bp-rail body.tenant-app:has(> .bp-topbar):not(:has(.main-container, .main-wrapper)) { padding-left: calc(var(--bp-rail-w) + var(--bp-s5)); }
        html.bp-rail .bp-nav :is(.bp-nav-label, .bp-nav-caret, .bp-nav-items, .bp-nav-pro), html.bp-rail .bp-sidebar-foot .bp-plan-text { display: none; }
        html.bp-rail .bp-nav :is(a.bp-nav-link, button.bp-nav-head) { justify-content: center; padding: 0; }
        html.bp-rail .bp-sidebar-foot { justify-content: center; padding: var(--bp-s2) 0; }
        html.bp-rail body.tenant-app .bp-sidebar { --bp-nav-panel-left: var(--bp-rail-w); }
    }
    /* Tablet: icon rail always visible; the header button opens the full menu over the page */
    @media (min-width: 768px) and (max-width: 1199.98px) {
        html body.tenant-app .main-container > .content, html body.tenant-app .main-wrapper > :is(.content, .dashboard-container) { margin-left: var(--bp-rail-w); padding-left: var(--bp-s4); padding-right: var(--bp-s4); }
        html body.tenant-app:has(> .bp-topbar):not(:has(.main-container, .main-wrapper)) { padding-left: calc(var(--bp-rail-w) + var(--bp-s4)); padding-right: var(--bp-s4); }
        html body.tenant-app .bp-sidebar:not(.show) { width: var(--bp-rail-w); }
        .bp-sidebar:not(.show) .bp-nav :is(.bp-nav-label, .bp-nav-caret, .bp-nav-items, .bp-nav-pro), .bp-sidebar:not(.show) .bp-sidebar-foot .bp-plan-text { display: none; }
        .bp-sidebar:not(.show) .bp-nav :is(a.bp-nav-link, button.bp-nav-head) { justify-content: center; padding: 0; min-height: 44px; }
        .bp-sidebar:not(.show) .bp-sidebar-foot { justify-content: center; padding: var(--bp-s2) 0; }
        html body.tenant-app .bp-sidebar.show { z-index: var(--bp-z-drawer); width: min(300px, 86vw); box-shadow: var(--bp-shadow-pop); }
        html body.tenant-app .bp-sidebar:not(.show) { --bp-nav-panel-left: var(--bp-rail-w); }
        html body.tenant-app .bp-sidebar.show { --bp-nav-panel-left: min(300px, 86vw); }
        html body.tenant-app .sidebar-overlay { display: block; top: var(--bp-header-h); z-index: var(--bp-z-sidebar); }
        html body.tenant-app .sidebar-overlay.show { opacity: 1; visibility: visible; }
        .bp-crumbs .bp-crumb-parent, .bp-crumbs .bp-crumb-parent + .bp-crumb-sep { display: none; }
        .bp-user-meta { display: none; }
        .bp-brand { max-width: 26%; }
    }
    /* Phone: off-canvas drawer */
    @media (max-width: 767.98px) {
        html body.tenant-app .bp-topbar { gap: var(--bp-s1); padding: 0 var(--bp-s2) 0 var(--bp-s1); }
        html body.tenant-app .main-container > .content, html body.tenant-app .main-wrapper > :is(.content, .dashboard-container) { margin-left: 0; padding: var(--bp-s3) var(--bp-s3) var(--bp-s8); }
        html body.tenant-app:has(> .bp-topbar):not(:has(.main-container, .main-wrapper)) { padding: calc(var(--bp-header-h) + var(--bp-s3)) var(--bp-s3) var(--bp-s8); }
        html body.tenant-app .bp-sidebar { z-index: var(--bp-z-drawer); width: min(300px, 86vw); transform: translateX(-105%); box-shadow: none; }
        html body.tenant-app .bp-sidebar.show { transform: none; box-shadow: var(--bp-shadow-pop); }
        html body.tenant-app .sidebar-overlay { display: block; top: var(--bp-header-h); z-index: var(--bp-z-header); }
        html body.tenant-app .sidebar-overlay.show { opacity: 1; visibility: visible; }
        .bp-nav :is(a.bp-nav-link, button.bp-nav-head) { min-height: 44px; }
        .bp-nav a.bp-nav-sub { min-height: 40px; font-size: var(--bp-fs); }
        html body.tenant-app .bp-sidebar { --bp-nav-panel-left: 0px; }
        .bp-nav .bp-nav-panel { right: 0; width: auto; border-right: 0; box-shadow: none; animation-name: bp-nav-sheet-in; }
        .bp-nav-panel-head { gap: var(--bp-s2); padding: var(--bp-s2) var(--bp-s2) var(--bp-s2) var(--bp-s1); }
        .bp-nav-panel-icon { width: 32px; height: 32px; }
        .bp-nav .bp-nav-panel-back { display: inline-flex; }
        .bp-nav :is(.bp-nav-panel-back, .bp-nav-panel-close) { width: 40px; height: 40px; }
        .bp-nav-panel-body { padding: var(--bp-s3) var(--bp-s3) var(--bp-s6); }
        .bp-nav-groups, .bp-nav-panel-body > .bp-nav-list:has(+ .bp-nav-groups) { grid-template-columns: minmax(0, 1fr); }
        .bp-nav .bp-nav-panel a.bp-nav-sub { min-height: 44px; }
        .bp-nav a.bp-nav-chip { min-height: 40px; padding: 6px 14px; font-size: var(--bp-fs-sm); }
        .bp-nav .bp-nav-group-title { font-size: var(--bp-fs); }
        .bp-brand-mark, .bp-user-meta, .bp-crumbs .bp-crumb-parent, .bp-crumbs .bp-crumb-parent + .bp-crumb-sep, .bp-crumbs .bp-crumb-action, .bp-new-btn .bp-new-text { display: none; }
        .bp-brand { display: none; }
        .bp-crumbs { border-left: 0; margin-left: 0; padding-left: var(--bp-s1); }
        .bp-topbar .bp-new-btn { width: 40px; height: 40px; padding: 0; justify-content: center; border: 0; background: transparent; }
        html body.tenant-app .bp-topbar .accounting-mode-toggle { width: 92px; min-width: 92px; height: 40px; }
        .bp-topbar .bp-user-btn { padding: 0 2px; }
        .bp-topbar .bp-user-btn > .bp-icon { display: none; }
        .bp-topbar-actions { gap: 2px; }
    }
    @media (prefers-reduced-motion: reduce) { .bp-sidebar, .sidebar-overlay, .bp-menu, .bp-nav .bp-nav-caret, .main-container > .content { transition: none !important; } }
    @media (prefers-reduced-motion: reduce) { .bp-nav .bp-nav-panel, .bp-sidebar::after, .bp-nav-panel :is(a, button), .bp-nav-panel a::after { animation: none !important; transition: none !important; } }
}

/* ───────────────────────────── 4. COMPONENTS ───────────────────────────── */
/* Page header: title, optional one-line subtitle, actions on the right */
.ui-page-header { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s3) var(--bp-s4); flex-wrap: wrap; margin: 0 0 var(--bp-s4); padding: 0; background: none; border: 0; box-shadow: none; }
.ui-page-header .ui-page-heading { min-width: 0; flex: 1 1 280px; }
.ui-page-title { display: flex; align-items: center; gap: var(--bp-s2); margin: 0; font-size: var(--bp-fs-2xl); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: var(--bp-text); }
.ui-page-subtitle { margin: 2px 0 0; font-size: var(--bp-fs-sm); color: var(--bp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* tablets and phones: the one line under the title wraps instead of being cut off */
@media (max-width: 1023.98px) { .ui-page-subtitle { white-space: normal; overflow: visible; } }
.ui-page-actions { display: flex; align-items: center; gap: var(--bp-s2); flex-wrap: wrap; justify-content: flex-end; }
.ui-section-title { display: flex; align-items: center; gap: var(--bp-s2); margin: 0; font-size: var(--bp-fs-lg); font-weight: 600; line-height: 1.3; color: var(--bp-text); }

/* Buttons */
.ui-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; box-sizing: border-box; height: var(--bp-control-h); min-width: 0; padding: 0 14px; margin: 0;
    border: 1px solid var(--bp-border-strong); border-radius: var(--bp-r); background: var(--bp-surface); color: var(--bp-text);
    font: 600 var(--bp-fs-sm)/1 var(--bp-font); text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none; transition: background .12s, border-color .12s, color .12s;
}
.ui-btn:hover { background: var(--bp-soft); border-color: var(--bp-border-strong); color: var(--bp-text); text-decoration: none; }
.ui-btn:focus-visible { outline: 2px solid var(--bp-focus); outline-offset: 2px; }
.ui-btn:disabled, .ui-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.ui-btn .bp-icon { width: 16px; height: 16px; vertical-align: 0; }
.ui-btn-primary { background: var(--bp-primary); border-color: var(--bp-primary); color: var(--bp-on-primary); }
.ui-btn-primary:hover { background: var(--bp-primary-hover); border-color: var(--bp-primary-hover); color: var(--bp-on-primary); }
/* Choose the colour by what the control does. A draft is an outlined save. */
.ui-btn-save { background: var(--bp-save-fill); border-color: var(--bp-save-fill); color: #fff; }
.ui-btn-save:not(:disabled):hover { background: var(--bp-save-hover); border-color: var(--bp-save-hover); color: #fff; }
.ui-btn-save-draft { background: var(--bp-surface); border-color: var(--bp-success); color: var(--bp-success); }
.ui-btn-save-draft:not(:disabled):hover { background: var(--bp-success-bg); border-color: var(--bp-success); color: var(--bp-success); }
.ui-btn-open { background: var(--bp-surface); border-color: var(--bp-border-strong); color: var(--bp-accent); }
.ui-btn-open:hover { background: var(--bp-tint); border-color: var(--bp-accent); color: var(--bp-accent); }
.ui-btn-warning { background: var(--bp-warning-bg); border-color: var(--bp-warning); color: var(--bp-warning); }
.ui-btn-warning:not(:disabled):hover { background: var(--bp-warning); border-color: var(--bp-warning); color: var(--bp-surface); }
.ui-btn-danger { background: var(--bp-surface); border-color: var(--bp-danger); color: var(--bp-danger); }
.ui-btn-danger:hover { background: var(--bp-danger-solid); border-color: var(--bp-danger-solid); color: #ffffff; }
.ui-btn-danger-solid { background: var(--bp-danger-solid); border-color: var(--bp-danger-solid); color: #ffffff; }
.ui-btn-danger-solid:hover { background: var(--bp-danger-solid); border-color: var(--bp-danger-solid); color: #fff; filter: brightness(.9); }
.ui-btn-ghost { background: transparent; border-color: transparent; color: var(--bp-accent); }
.ui-btn-ghost:hover { background: var(--bp-tint); border-color: transparent; color: var(--bp-accent); }
.ui-btn-sm { height: var(--bp-control-h-sm); padding: 0 10px; font-size: var(--bp-fs-xs); }
.ui-btn-icon { width: var(--bp-control-h); padding: 0; }
.ui-btn-icon.ui-btn-sm { width: var(--bp-control-h-sm); }
.ui-btn-group { display: inline-flex; gap: var(--bp-s1); flex-wrap: nowrap; align-items: center; }
/* Stacked action choices keep long business labels readable at narrow widths. */
.ui-choice-list { display: flex; flex-direction: column; align-items: stretch; gap: var(--bp-s2); min-width: 0; }
.ui-choice-list-scroll { max-height: min(16rem, 45vh); overflow-y: auto; padding: var(--bp-s1); }
.ui-choice-list .ui-check input { flex: 0 0 16px; }
.ui-choice-list > .ui-btn { justify-content: flex-start; white-space: normal; text-align: left; overflow-wrap: anywhere; height: auto; min-height: var(--bp-control-h); padding-block: var(--bp-s2); }
.ui-choice-group { min-width: 0; }
.ui-choice-group > .ui-section-title { margin-bottom: var(--bp-s2); }

/* Toolbar / filter bar: one row that wraps cleanly; labels sit above their control and align */
.ui-toolbar { display: flex; align-items: flex-end; gap: var(--bp-s3); flex-wrap: wrap; margin: 0 0 var(--bp-s4); padding: var(--bp-s3); background: var(--bp-surface); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); }
.ui-toolbar > form { display: contents; }
.ui-toolbar .ui-field { flex: 0 1 180px; min-width: 130px; }
.ui-toolbar .ui-field-grow { flex: 1 1 220px; }
.ui-toolbar-spacer { flex: 1 1 auto; }
.ui-toolbar-end { display: flex; align-items: flex-end; gap: var(--bp-s2); margin-left: auto; flex-wrap: wrap; }
.ui-toolbar-plain { padding: 0; background: none; border: 0; }
/* Quiet full-width line under the controls (period summary, quick-period chips): last child of the toolbar. */
.ui-toolbar-note { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--bp-s1) var(--bp-s2); margin: 0; font-size: var(--bp-fs-sm); color: var(--bp-muted); }
.ui-toolbar-note strong { color: var(--bp-text); font-weight: 600; }

/* Forms */
.ui-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--bp-s3) var(--bp-s4); align-items: start; }
.ui-form-grid.ui-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-form-grid.ui-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ui-form-grid.ui-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ui-form-grid .ui-span-2 { grid-column: span 2; }
.ui-form-grid .ui-span-all { grid-column: 1 / -1; }
.ui-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.ui-label, .ui-field > label { display: flex; align-items: center; gap: 4px; margin: 0; font-size: var(--bp-fs-xs); font-weight: 600; line-height: 1.3; color: var(--bp-muted); white-space: normal; }
.ui-label .ui-req, .ui-field > label .ui-req { color: var(--bp-danger); }
.ui-input, .ui-select, .ui-textarea {
    display: block; box-sizing: border-box; width: 100%; height: var(--bp-control-h); min-height: 0; margin: 0; padding: 0 var(--bp-control-px);
    border: 1px solid var(--bp-border-strong); border-radius: var(--bp-r); background-color: var(--bp-field); color: var(--bp-text);
    font: 400 var(--bp-fs)/1.3 var(--bp-font); transition: border-color .12s, box-shadow .12s;
}
.ui-textarea { height: auto; min-height: 72px; padding: 8px var(--bp-control-px); resize: vertical; line-height: var(--bp-lh); }
.ui-select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: var(--bp-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px; }
:is(.ui-input, .ui-select, .ui-textarea):focus { outline: 0; border-color: var(--bp-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bp-focus) 22%, transparent); }
:is(.ui-input, .ui-select, .ui-textarea):disabled, :is(.ui-input, .ui-textarea)[readonly] { background-color: var(--bp-soft); color: var(--bp-muted); }
.ui-input.ui-num { text-align: right; font-variant-numeric: tabular-nums; }
.ui-input-sm, .ui-select-sm { height: var(--bp-control-h-sm); font-size: var(--bp-fs-sm); }
.ui-hint { font-size: var(--bp-fs-xs); color: var(--bp-muted); line-height: 1.35; }
.ui-error-text { font-size: var(--bp-fs-xs); color: var(--bp-danger); }
.ui-check { display: inline-flex; align-items: center; gap: var(--bp-s2); min-height: var(--bp-control-h); font-size: var(--bp-fs); color: var(--bp-text); cursor: pointer; }
label.ui-check, .ui-field > label.ui-check { font-size: var(--bp-fs); font-weight: 400; color: var(--bp-text); white-space: normal; }
.ui-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--bp-primary); }
.ui-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--bp-s2); flex-wrap: wrap; margin-top: var(--bp-s4); padding-top: var(--bp-s3); border-top: 1px solid var(--bp-border); }

/* Cards */
.ui-card { background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow); margin: 0 0 var(--bp-s4); min-width: 0; }
.ui-card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s3); min-height: 44px; padding: var(--bp-s2) var(--bp-s4); border-bottom: 1px solid var(--bp-border); }
.ui-card-title { display: flex; align-items: center; gap: var(--bp-s2); margin: 0; font-size: var(--bp-fs); font-weight: 600; line-height: 1.3; color: var(--bp-text); }
.ui-card-body { padding: var(--bp-s4); }
.ui-card-body-flush { padding: 0; }
.ui-card-footer { padding: var(--bp-s2) var(--bp-s4); border-top: 1px solid var(--bp-border); color: var(--bp-muted); font-size: var(--bp-fs-sm); }
.ui-grid { display: grid; gap: var(--bp-s4); grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); align-items: stretch; margin: 0 0 var(--bp-s4); }
.ui-grid > .ui-card { margin: 0; display: flex; flex-direction: column; }
.ui-grid > .ui-card > .ui-card-body { flex: 1 1 auto; }
.ui-grid.ui-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-grid.ui-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* KPI tiles: equal height, one row that reflows 4 -> 2 -> 1 */
.ui-kpis { display: grid; gap: var(--bp-s3); grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); align-items: stretch; margin: 0 0 var(--bp-s4); }
.ui-kpis.ui-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ui-kpi { display: flex; flex-direction: column; justify-content: space-between; gap: var(--bp-s1); min-width: 0; min-height: 84px; padding: var(--bp-s3) var(--bp-s4); background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow); text-decoration: none; }
a.ui-kpi:hover { border-color: var(--bp-accent); color: var(--bp-text); }
.ui-kpi-label { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s2); font-size: var(--bp-fs-xs); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--bp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-kpi-label .bp-icon { width: 16px; height: 16px; }
.ui-kpi-value { font-size: var(--bp-fs-2xl); font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--bp-text); }
.ui-kpi-meta { font-size: var(--bp-fs-xs); color: var(--bp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-kpi.is-pos .ui-kpi-value { color: var(--bp-success); }
.ui-kpi.is-neg .ui-kpi-value { color: var(--bp-danger); }
.ui-kpi.is-warn .ui-kpi-value { color: var(--bp-warning); }

/* Data tables */
.ui-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--bp-surface); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); margin: 0 0 var(--bp-s4); }
.ui-card .ui-table-wrap { border: 0; border-radius: 0; margin: 0; }
.ui-table-wrap.ui-table-sticky { max-height: min(70vh, 720px); overflow-y: auto; }
.ui-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; background: var(--bp-surface); color: var(--bp-text); font-size: var(--bp-fs-sm); line-height: 1.35; }
.ui-table :is(th, td) { height: var(--bp-row-h); padding: var(--bp-cell-py) var(--bp-cell-px); border: 0; border-bottom: 1px solid var(--bp-border); text-align: left; vertical-align: middle; background: transparent; color: inherit; }
.ui-table thead th { position: sticky; top: 0; z-index: var(--bp-z-sticky); background: var(--bp-soft); color: var(--bp-muted); font-size: var(--bp-fs-xs); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--bp-border-strong); }
.ui-table tbody tr:hover > td { background: var(--bp-row-hover); }
.ui-table tbody tr:last-child > td { border-bottom: 0; }
.ui-table.ui-table-zebra tbody tr:nth-child(even) > td { background: var(--bp-zebra); }
.ui-table.ui-table-zebra tbody tr:hover > td { background: var(--bp-row-hover); }
.ui-table :is(th, td):is(.ui-num, .ui-amount) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table td.ui-actions, .ui-table th.ui-actions { text-align: right; white-space: nowrap; width: 1%; }
.ui-table td.ui-actions > * + * { margin-left: var(--bp-s1); }
/* Holds the place of a row's More menu when that row has nothing in it, so the buttons line up down the column:
   <span class="ui-btn ui-btn-sm ui-btn-icon ui-menu-spacer" aria-hidden="true"></span> */
.ui-menu-spacer { visibility: hidden; pointer-events: none; }
.ui-table-wrap .ui-table :is(th, td).ui-actions { position: sticky; right: 0; z-index: 2; background: var(--bp-surface); box-shadow: -1px 0 0 var(--bp-border); }
.ui-table-wrap .ui-table thead th.ui-actions { z-index: calc(var(--bp-z-sticky) + 1); background: var(--bp-soft); }
.ui-table-wrap .ui-table tbody tr:hover > td.ui-actions { background: var(--bp-row-hover); }
.ui-table-wrap .ui-table.ui-table-zebra tbody tr:nth-child(even):not(:hover) > td.ui-actions { background: var(--bp-zebra); }
.ui-table-wrap .ui-table :is(tfoot, tr.ui-total) :is(td, th).ui-actions { background: var(--bp-soft); }
.ui-table.ui-table-stack td.ui-actions { position: static; box-shadow: none; }
.ui-table tfoot :is(td, th), .ui-table tr.ui-total > :is(td, th) { background: var(--bp-soft); font-weight: 600; border-top: 1px solid var(--bp-border-strong); border-bottom: 0; }
.ui-table a:not(.ui-btn) { color: var(--bp-accent); text-decoration: none; }
.ui-table a:not(.ui-btn):hover { text-decoration: underline; }
.ui-table-compact :is(th, td) { height: 30px; padding: 4px 10px; }
/* Phone: opt-in stacked rows (each td needs data-label) */
@media (max-width: 767.98px) {
    .ui-table.ui-table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .ui-table.ui-table-stack, .ui-table.ui-table-stack tbody, .ui-table.ui-table-stack tr, .ui-table.ui-table-stack td { display: block; width: 100%; box-sizing: border-box; }
    .ui-table.ui-table-stack tr { padding: var(--bp-s2) 0; border-bottom: 1px solid var(--bp-border-strong); }
    .ui-table.ui-table-stack td { display: flex; justify-content: space-between; gap: var(--bp-s3); height: auto; min-height: 28px; padding: 3px var(--bp-cell-px); border: 0; text-align: right; white-space: normal; }
    .ui-table.ui-table-stack td::before { content: attr(data-label); flex: 0 0 40%; text-align: left; font-size: var(--bp-fs-xs); font-weight: 600; color: var(--bp-muted); }
    .ui-table.ui-table-stack td.ui-actions { width: 100%; justify-content: flex-end; }
    .ui-table.ui-table-stack td.ui-actions::before { content: none; }
}

/* Tabs (links or buttons); the current tab carries .active and aria-current="page" / aria-selected="true" */
.ui-tabs { display: flex; align-items: stretch; gap: var(--bp-s1); margin: 0 0 var(--bp-s4); padding: 0; list-style: none; border-bottom: 1px solid var(--bp-border-strong); overflow-x: auto; scrollbar-width: none; }
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tab { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; height: 38px; margin: 0 0 -1px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; border-radius: var(--bp-r) var(--bp-r) 0 0; background: transparent; color: var(--bp-muted); font: 600 var(--bp-fs)/1 var(--bp-font); text-decoration: none; white-space: nowrap; cursor: pointer; }
.ui-tab:hover { color: var(--bp-text); background: var(--bp-soft); text-decoration: none; }
.ui-tab:is(.active, [aria-current="page"], [aria-selected="true"]) { color: var(--bp-accent); border-bottom-color: var(--bp-accent); background: transparent; }
.ui-tab:focus-visible { outline: 2px solid var(--bp-focus); outline-offset: -2px; }
.ui-tab .ui-badge { margin-left: 2px; }

/* Badges / status chips */
.ui-badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--bp-r-pill); background: var(--bp-neutral-bg); color: var(--bp-text); font-size: 11px; font-weight: 600; line-height: 1; letter-spacing: .02em; white-space: nowrap; vertical-align: middle; }
.ui-badge-success { background: var(--bp-success-bg); color: var(--bp-success); }
.ui-badge-danger { background: var(--bp-danger-bg); color: var(--bp-danger); }
.ui-badge-warning { background: var(--bp-warning-bg); color: var(--bp-warning); }
.ui-badge-info { background: var(--bp-info-bg); color: var(--bp-info); }
.ui-badge-accent { background: var(--bp-tint); color: var(--bp-accent); }
.ui-badge-muted { background: var(--bp-neutral-bg); color: var(--bp-muted); }

/* Alerts */
.ui-alert { display: flex; align-items: flex-start; gap: var(--bp-s2); margin: 0 0 var(--bp-s4); padding: 10px var(--bp-s3); border: 1px solid var(--bp-border); border-left-width: 3px; border-radius: var(--bp-r); background: var(--bp-surface); color: var(--bp-text); font-size: var(--bp-fs-sm); line-height: 1.45; }
.ui-alert > .bp-icon { margin-top: 1px; }
.ui-alert-info { border-color: var(--bp-info); background: var(--bp-info-bg); }
.ui-alert-info > .bp-icon { color: var(--bp-info); }
.ui-alert-success { border-color: var(--bp-success); background: var(--bp-success-bg); }
.ui-alert-success > .bp-icon { color: var(--bp-success); }
.ui-alert-warning { border-color: var(--bp-warning); background: var(--bp-warning-bg); }
.ui-alert-warning > .bp-icon { color: var(--bp-warning); }
.ui-alert-danger { border-color: var(--bp-danger); background: var(--bp-danger-bg); }
.ui-alert-danger > .bp-icon { color: var(--bp-danger); }

/* Empty state */
.ui-empty { display: flex; flex-direction: column; align-items: center; gap: var(--bp-s2); padding: var(--bp-s7) var(--bp-s4); text-align: center; color: var(--bp-muted); font-size: var(--bp-fs-sm); }
.ui-empty > .bp-icon { width: 28px; height: 28px; color: var(--bp-border-strong); }
.ui-empty-title { margin: 0; font-size: var(--bp-fs); font-weight: 600; color: var(--bp-text); }

/* Pagination */
.ui-pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s3); flex-wrap: wrap; padding: var(--bp-s2) var(--bp-s3); font-size: var(--bp-fs-sm); color: var(--bp-muted); }
.ui-pagination-pages { display: flex; align-items: center; gap: var(--bp-s1); flex-wrap: wrap; }
.ui-page { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--bp-border); border-radius: var(--bp-r); background: var(--bp-surface); color: var(--bp-text); font-size: var(--bp-fs-sm); font-variant-numeric: tabular-nums; text-decoration: none; }
.ui-page:hover { background: var(--bp-soft); color: var(--bp-text); }
.ui-page:is(.active, [aria-current="page"]) { background: var(--bp-primary); border-color: var(--bp-primary); color: var(--bp-on-primary); }
.ui-page[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* Modal */
.ui-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: var(--bp-s4); background: var(--bp-overlay); }
.ui-modal[hidden] { display: none; }
.ui-modal-dialog { display: flex; flex-direction: column; width: min(560px, 100%); max-height: min(88vh, 100%); background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow-pop); overflow: hidden; }
.ui-modal-dialog.ui-modal-lg { width: min(880px, 100%); }
.ui-modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s3); min-height: 48px; padding: 0 var(--bp-s2) 0 var(--bp-s4); border-bottom: 1px solid var(--bp-border); }
.ui-modal-title { margin: 0; font-size: var(--bp-fs-lg); font-weight: 600; }
.ui-modal-body { padding: var(--bp-s4); overflow-y: auto; }
.ui-modal-footer { display: flex; justify-content: flex-end; gap: var(--bp-s2); padding: var(--bp-s3) var(--bp-s4); border-top: 1px solid var(--bp-border); background: var(--bp-soft); }
/* Native dialogs use the same surfaces and sections, including when moved to body. */
dialog.ui-native-dialog { box-sizing: border-box; width: min(560px, calc(100% - var(--bp-s7))); max-width: none; max-height: calc(100vh - var(--bp-s7)); max-height: calc(100dvh - var(--bp-s7)); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); background: var(--bp-surface); color: var(--bp-text); box-shadow: var(--bp-shadow-pop); }
dialog.ui-native-dialog[open] { display: flex; flex-direction: column; }
dialog.ui-native-dialog:not([open]) { display: none; }
dialog.ui-native-dialog::backdrop { background: var(--bp-overlay); }
.ui-native-dialog > :is(.ui-modal-header, .ui-modal-footer) { flex: 0 0 auto; }
.ui-native-dialog > .ui-modal-body { min-height: 0; overscroll-behavior: contain; }
.ui-native-dialog > .ui-modal-footer { flex-wrap: wrap; }

/* Help tooltip: <details class="ui-help"><summary aria-label="Help">?</summary><div class="ui-help-pop">…</div></details> */
.ui-help { position: relative; display: inline-block; vertical-align: middle; }
.ui-help > summary { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid var(--bp-border-strong); border-radius: 50%; background: var(--bp-surface); color: var(--bp-muted); font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; list-style: none; user-select: none; }
.ui-help > summary::-webkit-details-marker { display: none; }
.ui-help > summary:hover, .ui-help[open] > summary { border-color: var(--bp-accent); color: var(--bp-accent); background: var(--bp-tint); }
.ui-help > summary:focus-visible { outline: 2px solid var(--bp-focus); outline-offset: 2px; }
.ui-help-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--bp-z-pop); width: max-content; max-width: min(360px, 80vw); padding: var(--bp-s3); background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow-pop); font-size: var(--bp-fs-sm); font-weight: 400; line-height: 1.5; letter-spacing: 0; text-transform: none; text-align: left; white-space: normal; }
.ui-help-pop :is(p, ul, ol) { margin: 0 0 var(--bp-s2); }
.ui-help-pop > :last-child { margin-bottom: 0; }
.ui-help.ui-help-end .ui-help-pop { left: auto; right: 0; }
/* shell.js shows the open help text in the top layer beside its mark (see .ui-menu-pop below): never clipped by a
   table, card or dialog, never off the screen on a scrolled page; the rules above are the no-script fallback. */
.ui-help .ui-help-pop[popover], .ui-help .ui-help-pop.is-floating { position: fixed; inset: auto; left: 0; top: 0; margin: 0; overflow-y: auto; }

/* Definition list for record details */
.ui-dl { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px var(--bp-s4); margin: 0; font-size: var(--bp-fs-sm); }
.ui-dl dt { color: var(--bp-muted); font-weight: 400; }
.ui-dl dd { margin: 0; color: var(--bp-text); }
.ui-list { list-style: none; margin: 0; padding: 0; }
.ui-list > li { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s3); min-height: 40px; padding: 6px var(--bp-s4); border-bottom: 1px solid var(--bp-border); font-size: var(--bp-fs-sm); }
.ui-list > li:last-child { border-bottom: 0; }
.ui-list a { color: var(--bp-text); text-decoration: none; }
.ui-list a:hover { color: var(--bp-accent); }
.ui-stack { display: flex; flex-direction: column; gap: var(--bp-s2); }
.ui-row { display: flex; align-items: center; gap: var(--bp-s2); flex-wrap: wrap; }
.ui-progress { height: 6px; border-radius: var(--bp-r-pill); background: var(--bp-neutral-bg); overflow: hidden; }
.ui-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--bp-primary); }
.ui-progress.is-warn > span { background: var(--bp-warning); }
.ui-progress.is-danger > span { background: var(--bp-danger-solid); }

/* ───────────────────────────── 4b. ADDITIONS (2026-11-13) ───────────────────────────── */
/* Row-action menu: <details class="ui-menu"><summary class="ui-btn ui-btn-sm" aria-label="More actions">…</summary>
   <div class="ui-menu-pop"><a class="ui-menu-item" href>…</a><button type="button" class="ui-menu-item">…</button></div></details>
   shell.js shows the open panel in the browser's top layer (popover="manual") beside its button, flipped up / to the
   right at the viewport edges, so no scrolling table, card or dialog clips it and no sticky cell, sticky header, save
   bar or later row paints over it; it follows its button on scroll / resize, closes on outside click, Esc, Tab out and
   after an entry is chosen; focus moves into it and Esc returns focus to the button. A browser without popovers gets
   .is-floating (fixed, with its action cell raised as .ui-menu-host). Without the script the panel opens in place. */
.ui-menu { position: relative; display: inline-block; vertical-align: middle; }
.ui-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.ui-menu > summary::-webkit-details-marker { display: none; }
.ui-menu[open] > summary { background: var(--bp-tint); border-color: var(--bp-accent); color: var(--bp-accent); }
.ui-menu-pop { position: static; min-width: 180px; max-width: min(300px, calc(100vw - 16px)); max-height: min(60vh, 420px); overflow-y: auto; margin: var(--bp-s1) 0 0; padding: var(--bp-s1); background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow-pop); text-align: left; white-space: normal; }
.ui-menu-pop[popover], .ui-menu-pop.is-floating { position: fixed; inset: auto; left: 0; top: 0; margin: 0; }
.ui-menu-pop.is-floating { z-index: var(--bp-z-pop); }
.ui-table-wrap .ui-table :is(th, td).ui-actions.ui-menu-host, .ui-menu-host { z-index: calc(var(--bp-z-sidebar) - 1); }
.ui-menu-pop form { display: contents; }
.ui-menu-item, .ui-table td.ui-actions .ui-menu-item { display: flex; align-items: center; gap: var(--bp-s2); box-sizing: border-box; width: 100%; min-height: 36px; margin: 0; padding: 0 var(--bp-s3); border: 0; border-radius: var(--bp-r-sm); background: transparent; color: var(--bp-text); font: 400 var(--bp-fs)/1.3 var(--bp-font); text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.ui-menu-item:hover, .ui-menu-item:focus-visible { background: var(--bp-tint); color: var(--bp-accent); text-decoration: none; outline: 0; }
.ui-menu-item .bp-icon { width: 16px; height: 16px; color: var(--bp-muted); }
.ui-menu-item.is-danger, .ui-menu-item.is-danger .bp-icon { color: var(--bp-danger); }
.ui-menu-item.is-danger:hover { background: var(--bp-danger-bg); color: var(--bp-danger); }
.ui-menu-item:disabled, .ui-menu-item[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.ui-menu-sep { height: 1px; margin: var(--bp-s1) 0; background: var(--bp-border); }
@media (max-width: 767.98px) { .ui-menu-item, .ui-table td.ui-actions .ui-menu-item { min-height: 44px; } }
.ui-page-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 32px; color: var(--bp-muted); }

/* Line-item entry grid (invoice / purchase bill / note lines). One component for every document form.
   New names: .ui-lines > .ui-lines-title + .ui-lines-body > (.ui-line.ui-line-head + .ui-line …) + .ui-lines-foot.
   The existing names (.items-header, .invoice-items-container, .invoice-item-row, .item-header-row, .add-item-section,
   .btn-add-item, .btn-remove) are the same component, so invoices and purchases share it. Each page sets ONLY its
   column template: .pg-xyz .ui-line { grid-template-columns: … } (feature-dependent columns stay page-defined). */
@media screen {
    html body :is(.ui-lines, .invoice-items-section) { background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: none; overflow: hidden; margin: 0 0 var(--bp-s4); padding: 0; }
    html body :is(.ui-lines-title, .items-header) { display: flex; align-items: center; gap: var(--bp-s2); min-height: 40px; margin: 0; padding: 0 var(--bp-s3); background: var(--bp-surface); color: var(--bp-text); border: 0; border-bottom: 1px solid var(--bp-border); font-size: var(--bp-fs); font-weight: 600; }
    html body.tenant-app :is(.items-header, .btn-add-item)::before { content: none; }
    html body :is(.ui-lines-body, .invoice-items-container) { margin: 0; padding: 0; background: var(--bp-surface); overflow-x: auto; -webkit-overflow-scrolling: touch; }
    html body :is(.ui-line, .invoice-item-row) { display: grid; gap: var(--bp-s2); align-items: center; margin: 0; padding: 6px var(--bp-s3); background: var(--bp-surface); color: var(--bp-text); border: 0; border-bottom: 1px solid var(--bp-border); border-radius: 0; box-shadow: none; transform: none; transition: none; font-size: var(--bp-fs-sm); }
    html body :is(.ui-line, .invoice-item-row):hover { box-shadow: none; transform: none; background: var(--bp-row-hover); }
    html body :is(.ui-line, .invoice-item-row) > * { min-width: 0; }
    html body :is(.ui-line, .invoice-item-row) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select) { box-sizing: border-box; width: 100%; height: 32px; min-height: 32px; margin: 0; padding: 0 8px; border: 1px solid var(--bp-border-strong); border-radius: var(--bp-r-sm); background-color: var(--bp-field); color: var(--bp-text); font-size: var(--bp-fs-sm); }
    html body :is(.ui-line, .invoice-item-row) select { padding-right: 24px; }
    html body :is(.ui-line, .invoice-item-row) input:is([type="number"], .ui-num, [inputmode="decimal"]) { text-align: right; font-variant-numeric: tabular-nums; }
    html body :is(.ui-line, .invoice-item-row) :is(input, select):focus { border-color: var(--bp-focus); outline: 2px solid var(--bp-focus); outline-offset: 0; }
    html body :is(.ui-line, .invoice-item-row) :is(input[readonly], input:disabled) { background-color: var(--bp-soft); color: var(--bp-text); }
    html body :is(.ui-line.ui-line-head, .invoice-item-row.item-header-row, .item-header-row) { position: sticky; top: 0; z-index: 1; margin: 0 !important; padding: 0 var(--bp-s3) !important; min-height: 32px; background: var(--bp-soft) !important; color: var(--bp-muted) !important; border: 0 !important; border-bottom: 1px solid var(--bp-border-strong) !important; border-radius: 0 !important; font-size: var(--bp-fs-xs) !important; font-weight: 600 !important; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
    html body :is(.ui-lines-foot, .add-item-section) { display: flex; align-items: center; justify-content: space-between; gap: var(--bp-s3); flex-wrap: wrap; margin: 0; padding: var(--bp-s2) var(--bp-s3); background: var(--bp-surface); border: 0; border-top: 1px solid var(--bp-border); }
    html body :is(.ui-line-add, .btn-add-item) { display: inline-flex; align-items: center; gap: 6px; height: var(--bp-control-h-sm); padding: 0 10px; border: 1px dashed var(--bp-accent); border-radius: var(--bp-r); background: transparent; color: var(--bp-accent); font: 600 var(--bp-fs-sm)/1 var(--bp-font); white-space: nowrap; cursor: pointer; box-shadow: none; transform: none; }
    html body :is(.ui-line-add, .btn-add-item):hover { background: var(--bp-tint); box-shadow: none; transform: none; }
    html body :is(.ui-line-remove, .btn-remove) { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--bp-r); background: transparent; color: var(--bp-danger); font: 600 var(--bp-fs-xs)/1 var(--bp-font); white-space: nowrap; cursor: pointer; box-shadow: none; transform: none; }
    html body :is(.ui-line-remove, .btn-remove):hover { background: var(--bp-danger-bg); border-color: var(--bp-danger); box-shadow: none; transform: none; }
    /* Tablet and phone (the menu is an overlay below 1200px, the content is too narrow for the full grid below 1024px):
       each line becomes a labelled card, four figures across on a tablet and two on a phone, so nothing is scrolled out
       of sight. Captions come from data-label, which main.js stamps from the heading row. This layout is central and
       wins over page column templates on purpose. */
    @media (max-width: 1023.98px) {
        html body :is(.ui-line.ui-line-head, .invoice-item-row.item-header-row, .item-header-row) { display: none !important; }
        html body :is(.ui-line, .invoice-item-row) { position: relative; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: var(--bp-s2) var(--bp-s3) !important; align-items: start !important; min-width: 0 !important; margin: var(--bp-s2) !important; padding: var(--bp-s3) !important; border: 1px solid var(--bp-border) !important; border-radius: var(--bp-r-lg) !important; box-shadow: none !important; background: var(--bp-surface); }
        html body :is(.ui-line, .invoice-item-row):hover { background: var(--bp-surface); }
        html body :is(.ui-line, .invoice-item-row) > [data-label] { flex-wrap: wrap; }
        html body :is(.ui-line, .invoice-item-row) > [data-label]::before { content: attr(data-label); display: block; flex-basis: 100%; margin: 0 0 3px; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--bp-muted); }
        html body :is(.ui-line, .invoice-item-row) > :is([data-label=""], [data-label="Action"], [data-label="Actions"], [data-label="Line"], [data-label="Remove"])::before { content: none; }
        html body :is(.ui-line, .invoice-item-row) > :is([data-label^="Product"], [data-label^="Item"], [data-label^="Description"], [data-label^="Account"], [data-label="Salesperson"], :last-child) { grid-column: 1 / -1; }
        /* Remove is a compact icon button (it carries aria-label), never a full-width red bar: it sits at the card's
           top right corner beside the first caption (wherever its cell sits among the row's children: scripts may
           append hidden fields after it); without :has() it keeps its own short row, right aligned. */
        html body :is(.ui-line, .invoice-item-row) > :last-child:is(:not([data-label]), [data-label=""], [data-label="Action"], [data-label="Actions"], [data-label="Remove"]) { display: flex; justify-content: flex-end; }
        html body :is(.ui-line, .invoice-item-row) :is(.ui-line-remove, .btn-remove, .remove-item) { width: 32px; min-width: 32px; height: 32px; padding: 0; border-color: transparent; }
        html body :is(.ui-line, .invoice-item-row) > :has(> :is(.ui-line-remove, .btn-remove, .remove-item, [class*="btn-remove"])) { position: absolute; top: 4px; right: 4px; z-index: 1; }
        html body :is(.ui-line, .invoice-item-row):has(> * > :is(.ui-line-remove, .btn-remove, .remove-item, [class*="btn-remove"])) > :first-child { padding-right: 36px; }
    }
    @media (max-width: 767.98px) {
        html body :is(.ui-line, .invoice-item-row) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select) { height: 40px; min-height: 40px; font-size: 16px; }
        html body :is(.ui-line, .invoice-item-row) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
        html body :is(.ui-line-add, .btn-add-item) { height: 40px; }
        html body :is(.ui-line, .invoice-item-row) :is(.ui-line-remove, .btn-remove, .remove-item) { width: 40px; min-width: 40px; height: 40px; }
        html body :is(.ui-line, .invoice-item-row) > :has(> :is(.ui-line-remove, .btn-remove, .remove-item, [class*="btn-remove"])) { top: 0; right: 0; }
        html body :is(.ui-line, .invoice-item-row):has(> * > :is(.ui-line-remove, .btn-remove, .remove-item, [class*="btn-remove"])) > :first-child { padding-right: 40px; }
    }
}

/* ───────────────────────────── 4c. ADDITIONS (2026-11-13, c) ───────────────────────────── */
/* The hidden attribute always wins over a component's display value (scripts toggle element.hidden). */
[hidden] { display: none !important; }
/* Collapsible: (a) whole card  <details class="ui-card ui-fold"><summary class="ui-card-header">…</summary><div class="ui-card-body">
   (b) quiet inline toggle inside a card body  <details class="ui-fold"><summary>More filters</summary><div class="ui-fold-body">… */
.ui-fold > summary { display: flex; align-items: center; gap: var(--bp-s2); list-style: none; cursor: pointer; user-select: none; }
.ui-fold > summary::-webkit-details-marker { display: none; }
.ui-fold > summary::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin: 0 3px 0 2px; border: solid var(--bp-muted); border-width: 0 1.75px 1.75px 0; transform: rotate(-45deg); transition: transform .15s ease; }
.ui-fold[open] > summary::before { transform: rotate(45deg); }
.ui-fold > summary:focus-visible { outline: 2px solid var(--bp-focus); outline-offset: 2px; border-radius: var(--bp-r-sm); }
.ui-fold:not(.ui-card) > summary { display: inline-flex; min-height: 32px; padding: 0 var(--bp-s2) 0 0; color: var(--bp-accent); font-size: var(--bp-fs-sm); font-weight: 600; }
.ui-fold:not(.ui-card) > summary:hover { color: var(--bp-accent-hover); }
.ui-fold:not(.ui-card) > summary::before { border-color: currentColor; }
.ui-fold:not(.ui-card) > :not(summary), .ui-fold-body { padding: var(--bp-s2) 0 var(--bp-s3) var(--bp-s4); }
details.ui-card.ui-fold > summary.ui-card-header { justify-content: flex-start; }
details.ui-card.ui-fold > summary.ui-card-header > :last-child:not(:first-child) { margin-left: auto; }
details.ui-card.ui-fold:not([open]) > summary.ui-card-header { border-bottom: 0; }
details.ui-card.ui-fold > summary.ui-card-header:hover { background: var(--bp-soft); border-radius: var(--bp-r-lg); }
details.ui-card.ui-fold[open] > summary.ui-card-header:hover { border-radius: var(--bp-r-lg) var(--bp-r-lg) 0 0; }
details.ui-card.ui-fold > .ui-fold-body { padding: var(--bp-s4); }
/* Field group: borderless, small legend; readable when disabled; nesting adds no frame. */
.ui-fieldset { min-width: 0; margin: 0 0 var(--bp-s4); padding: 0; border: 0; }
.ui-fieldset > legend { float: none; width: auto; margin: 0 0 var(--bp-s2); padding: 0; font-size: var(--bp-fs-sm); font-weight: 600; line-height: 1.3; color: var(--bp-text); }
.ui-fieldset:disabled { opacity: 1; }
.ui-fieldset:disabled > legend, .ui-fieldset:disabled :is(label, .ui-hint) { color: var(--bp-muted); }
.ui-fieldset:disabled :is(.ui-input, .ui-select, .ui-textarea) { background-color: var(--bp-soft); color: var(--bp-text); -webkit-text-fill-color: var(--bp-text); opacity: 1; }
.ui-fieldset .ui-fieldset { margin-bottom: var(--bp-s3); }
.ui-fieldset > :last-child { margin-bottom: 0; }
/* A table placed inside a padded card body keeps its own frame (flush tables sit directly in the card). */
.ui-card .ui-card-body .ui-table-wrap { border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); margin: 0 0 var(--bp-s3); }
.ui-card .ui-card-body .ui-table-wrap:last-child { margin-bottom: 0; }
/* Technical text (references, payload excerpts, hashes): pre.ui-pre is a block, code.ui-ref sits inside a sentence or cell */
.ui-ref { font: 400 var(--bp-fs-xs)/1.4 ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; color: var(--bp-text); background: none; padding: 0; border: 0; overflow-wrap: anywhere; word-break: break-all; }
pre.ui-pre, .ui-pre { margin: 0 0 var(--bp-s3); padding: var(--bp-s2) var(--bp-s3); max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bp-soft); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r); font: 400 var(--bp-fs-xs)/1.5 ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace; }

/* Step strip for multi-step flows: <ol class="ui-steps"><li class="is-current|is-done|is-waiting"><a href><span class="ui-step-no">1</span>Label <span class="ui-badge">n</span></a></li>…
   .ui-step-no also works alone (e.g. inside .ui-card-title). */
.ui-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--bp-s2); list-style: none; margin: 0 0 var(--bp-s4); padding: 0; counter-reset: none; }
.ui-steps > li { display: flex; min-width: 0; margin: 0; padding: 0; }
.ui-steps > li > :is(a, button, span.ui-step) { display: flex; align-items: center; gap: var(--bp-s2); flex: 1 1 auto; box-sizing: border-box; min-width: 0; min-height: 44px; margin: 0; padding: 6px var(--bp-s3); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); background: var(--bp-surface); color: var(--bp-text); font: 600 var(--bp-fs-sm)/1.3 var(--bp-font); text-align: left; text-decoration: none; cursor: pointer; }
.ui-steps > li > span.ui-step { cursor: default; }
.ui-steps > li > :is(a, button):hover { border-color: var(--bp-accent); color: var(--bp-text); text-decoration: none; }
.ui-steps > li > :is(a, button):focus-visible { outline: 2px solid var(--bp-focus); outline-offset: 2px; }
.ui-steps > li > * > .ui-badge { margin-left: auto; flex: 0 0 auto; }
.ui-steps > li.is-current > * { border-color: var(--bp-accent); background: var(--bp-tint); color: var(--bp-accent); }
.ui-steps > li.is-waiting > * { color: var(--bp-muted); }
.ui-steps > li.is-done > * { border-color: var(--bp-success); }
.ui-step-no { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--bp-tint); color: var(--bp-accent); font-size: var(--bp-fs-xs); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.ui-steps > li.is-current .ui-step-no { background: var(--bp-primary); color: var(--bp-on-primary); }
.ui-steps > li.is-waiting .ui-step-no { background: var(--bp-neutral-bg); color: var(--bp-muted); }
.ui-steps > li.is-done .ui-step-no { background: var(--bp-success-bg); color: var(--bp-success); }
@media (max-width: 1199.98px) { .ui-steps { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .ui-steps { grid-template-columns: minmax(0, 1fr); } }
@media print { .ui-steps { display: none !important; } }
/* Compact phone rows for list tables: <table class="ui-table ui-table-cards">, cells classed by role.
   Phone (< 768px): line 1 = .ui-col-primary (left) + .ui-col-amount (right, bold);
   line 2 = .ui-col-meta cells joined by a middot (left) + .ui-col-status (right); .ui-actions on its own line;
   every other cell (.ui-col-extra or unclassed) is hidden until the row is tapped (tr.is-open, shell.js) and then
   shows as label: value lines (data-label). Desktop and tablet: an ordinary table. */
@media (max-width: 767.98px) {
    .ui-table.ui-table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .ui-table.ui-table-cards, .ui-table.ui-table-cards :is(tbody, tfoot) { display: block; width: 100%; }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--bp-s2); padding: 10px var(--bp-cell-px); border-bottom: 1px solid var(--bp-border); }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr:last-child { border-bottom: 0; }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr::before, .ui-table.ui-table-cards :is(tbody, tfoot) tr::after { content: ""; flex: 0 0 100%; height: 0; }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr::before { order: 3; }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr::after { order: 6; }
    .ui-table.ui-table-cards :is(tbody, tfoot) :is(td, th) { display: none; height: auto; padding: 0; border: 0; background: transparent !important; text-align: left; white-space: normal; min-width: 0; }
    .ui-table.ui-table-cards :is(td, th).ui-col-primary { display: block; order: 1; flex: 1 1 0; font-size: var(--bp-fs); font-weight: 600; color: var(--bp-text); overflow-wrap: anywhere; }
    .ui-table.ui-table-cards :is(td, th).ui-col-amount { display: block; order: 2; flex: 0 0 auto; margin-left: auto; font-size: var(--bp-fs); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
    .ui-table.ui-table-cards :is(td, th).ui-col-meta { display: block; order: 4; flex: 0 1 auto; font-size: var(--bp-fs-sm); color: var(--bp-muted); }
    .ui-table.ui-table-cards :is(td, th).ui-col-meta:not(:empty) ~ td.ui-col-meta::before { content: "\00B7"; margin-right: var(--bp-s2); color: var(--bp-muted); }
    .ui-table.ui-table-cards td.ui-col-meta:empty { display: none; }
    .ui-table.ui-table-cards :is(td, th).ui-col-status { display: block; order: 5; flex: 0 0 auto; margin-left: auto; text-align: right; }
    .ui-table.ui-table-cards :is(td, th).ui-actions { display: flex; order: 9; flex: 1 1 100%; justify-content: flex-end; align-items: center; gap: var(--bp-s2); width: auto; margin-top: 6px; position: static; box-shadow: none; }
    .ui-table.ui-table-cards :is(td, th).ui-actions > * + * { margin-left: 0; }
    .ui-table.ui-table-cards td[colspan] { display: block; flex: 1 1 100%; padding: var(--bp-s3) 0; text-align: center; color: var(--bp-muted); }
    .ui-table.ui-table-cards tr.is-open > td:not(.ui-col-primary):not(.ui-col-amount):not(.ui-col-meta):not(.ui-col-status):not(.ui-actions):not([colspan]) { display: flex; order: 7; flex: 1 1 100%; justify-content: space-between; gap: var(--bp-s3); padding: 2px 0; font-size: var(--bp-fs-sm); text-align: right; }
    .ui-table.ui-table-cards tr.is-open > td:not(.ui-col-primary):not(.ui-col-amount):not(.ui-col-meta):not(.ui-col-status):not(.ui-actions):not([colspan])::before { content: attr(data-label); flex: 0 0 42%; text-align: left; font-size: var(--bp-fs-xs); font-weight: 600; color: var(--bp-muted); }
    /* totals: one line, label left (.ui-col-primary) and figure right (.ui-col-amount); other figures as extra lines */
    .ui-table.ui-table-cards :is(tfoot tr, tr.ui-total) { background: var(--bp-soft); border-top: 1px solid var(--bp-border-strong); border-bottom: 0; }
    .ui-table.ui-table-cards :is(tfoot tr, tr.ui-total) > :is(td, th):not(.ui-col-primary):not(.ui-col-amount):not(.ui-col-meta):not(.ui-col-status):not(.ui-actions):not([colspan]):not(:empty)[data-label] { display: flex; order: 7; flex: 1 1 100%; justify-content: space-between; gap: var(--bp-s3); padding: 2px 0; font-size: var(--bp-fs-sm); font-weight: 600; text-align: right; }
    .ui-table.ui-table-cards :is(tfoot tr, tr.ui-total) > :is(td, th):not(.ui-col-primary):not(.ui-col-amount):not(.ui-col-meta):not(.ui-col-status):not(.ui-actions):not([colspan]):not(:empty)[data-label]::before { content: attr(data-label); flex: 0 0 42%; text-align: left; font-size: var(--bp-fs-xs); font-weight: 600; color: var(--bp-muted); }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr[data-ui-expandable] { cursor: pointer; }
    .ui-table.ui-table-cards :is(tbody, tfoot) tr:hover > td { background: transparent; }
    /* compact rows have no header to pin: no scroll box inside the page on a phone */
    .ui-table-wrap.ui-table-sticky:has(> .ui-table-cards) { max-height: none; }
}
/* Tablet and desktop: the party name keeps a readable width; a crowded list scrolls sideways instead of breaking the name into single words. */
@media (min-width: 768px) {
    .ui-table.ui-table-cards td.ui-col-primary { min-width: 9rem; }
}
/* Tablet and small laptop: the least-needed columns (.ui-col-wide on th and td) wait for a wide screen, so the amount and
   status never sit under the pinned actions; a phone still shows them when the row is tapped. Tablet cells are tighter. */
@media (min-width: 768px) and (max-width: 1359.98px) {
    .ui-table.ui-table-cards :is(th, td).ui-col-wide { display: none; }
    /* the same by column number, for a whole list: <table class="ui-table ui-table-cards" data-wide-cols="3 5"> */
    :is(.ui-table.ui-table-cards[data-wide-cols~="1"] tr > :nth-child(1):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="2"] tr > :nth-child(2):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="3"] tr > :nth-child(3):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="4"] tr > :nth-child(4):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="5"] tr > :nth-child(5):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="6"] tr > :nth-child(6):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="7"] tr > :nth-child(7):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="8"] tr > :nth-child(8):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="9"] tr > :nth-child(9):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="10"] tr > :nth-child(10):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="11"] tr > :nth-child(11):not([colspan]), .ui-table.ui-table-cards[data-wide-cols~="12"] tr > :nth-child(12):not([colspan])) { display: none; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
    .ui-table.ui-table-cards { --bp-cell-px: 8px; }
}
/* Docked save bar for long entry forms: last child of the <form>.
   <div class="ui-savebar"><span class="ui-savebar-info">Total 1,18,000.00</span><a class="ui-btn">Cancel</a>
   <button class="ui-btn ui-btn-save-draft">Save draft</button><button class="ui-btn ui-btn-save">Save &amp; Post</button></div>
   It sticks to the bottom of the scrolling content (so it follows the sidebar / rail by itself), is solid, and sits
   under every popup (searchable-select list, menus, help, modals). */
.ui-savebar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: flex-end; gap: var(--bp-s2); flex-wrap: wrap; margin: var(--bp-s4) 0 0; padding: var(--bp-s2) var(--bp-s4); background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-bottom: 0; border-radius: var(--bp-r-lg) var(--bp-r-lg) 0 0; box-shadow: 0 -6px 18px rgba(22, 34, 51, .12); }
.ui-savebar-info { margin-right: auto; min-width: 0; font-size: var(--bp-fs-sm); color: var(--bp-muted); font-variant-numeric: tabular-nums; }
.ui-savebar-info strong { color: var(--bp-text); font-size: var(--bp-fs-lg); font-weight: 600; }
html body.tenant-app .main-container > .content:has(.ui-savebar) { padding-bottom: 0; }
@media (max-width: 767.98px) {
    .ui-savebar { margin-left: calc(-1 * var(--bp-s3)); margin-right: calc(-1 * var(--bp-s3)); padding: var(--bp-s2) var(--bp-s3) calc(var(--bp-s2) + env(safe-area-inset-bottom, 0px)); border-left: 0; border-right: 0; border-radius: 0; }
    .ui-savebar-info { flex: 1 1 100%; }
    .ui-savebar .ui-btn { flex: 1 1 auto; }
}
@media print { .ui-savebar { display: none !important; } }
/* The text box that main.js puts in front of select.searchable-select looks like any other field (line rows size their own). */
html body.tenant-app input.ss-input:not(:is(.ui-line, .invoice-item-row) *) { box-sizing: border-box; width: 100%; height: var(--bp-control-h); min-height: 0; padding: 0 32px 0 var(--bp-control-px); border: 1px solid var(--bp-border-strong); border-radius: var(--bp-r); background-color: var(--bp-field); background-image: var(--bp-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px; color: var(--bp-text); font: 400 var(--bp-fs)/1.3 var(--bp-font); }
html body.tenant-app input.ss-input:focus { outline: 0; border-color: var(--bp-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bp-focus) 22%, transparent); }
@media (max-width: 767.98px) { html body.tenant-app input.ss-input:not(:is(.ui-line, .invoice-item-row) *) { height: 40px; font-size: 16px; } }
/* Small shared pieces (2026-11-13, l) */
.ui-modal.hidden { display: none; }                                   /* main.js toggles .hidden on .modal-overlay dialogs */
.ui-modal-dialog > form { display: flex; flex-direction: column; min-height: 0; margin: 0; }   /* form between dialog and body: body scrolls, footer stays */
.ui-menu-pop.ui-menu-form { padding: var(--bp-s3); min-width: 240px; }
.ui-menu-pop.ui-menu-form form { display: flex; flex-direction: column; gap: var(--bp-s2); }
:is(td.ui-actions, .ui-page-actions, .ui-form-actions, .ui-btn-group, .ui-savebar) > form { display: inline-flex; margin: 0; }
.ui-divide { margin-top: var(--bp-s4); padding-top: var(--bp-s4); border-top: 1px solid var(--bp-border); }
.ui-kpi-value.ui-kpi-text { font-size: var(--bp-fs-lg); white-space: normal; }
.ui-table :is(th, td).ui-col-bar { width: 40%; min-width: 80px; }
@media (min-width: 768px) and (max-width: 1199.98px) { .ui-table :is(th, td).ui-col-wide { display: none; } }
/* ───────────────────────────── 5. LEGACY ALIASES ─────────────────────────────
   Existing class names keep working and pick up the tokens, so untouched pages improve.
   Geometry is only normalised where it is safe for every page. */
@media screen {
    html body.tenant-app .content :is(h1, h2, h3, h4, h5, h6):not([class*="ui-"]) { color: var(--bp-text); font-family: var(--bp-font); letter-spacing: 0; }
    html body.tenant-app .content h1:not([class*="ui-"]) { font-size: var(--bp-fs-2xl); font-weight: 600; line-height: 1.25; }
    html body.tenant-app .content h2:not([class*="ui-"]) { font-size: var(--bp-fs-xl); font-weight: 600; }
    html body.tenant-app .content h3:not([class*="ui-"]) { font-size: var(--bp-fs-lg); font-weight: 600; }
    /* Buttons: one height family, never wrap, token colours */
    html body.tenant-app :is(.btn, .toolbar-btn) { min-height: var(--bp-control-h); padding: 0 14px; border-radius: var(--bp-r); font-family: var(--bp-font); font-size: var(--bp-fs-sm); font-weight: 600; line-height: 1.2; white-space: nowrap; gap: 6px; box-shadow: none; transform: none; text-decoration: none; cursor: pointer; box-sizing: border-box; }
    html body.tenant-app :is(.btn, .toolbar-btn):hover { transform: none; box-shadow: none; text-decoration: none; }
    html body.tenant-app .btn:is(.btn-sm, .btn-xs) { min-height: var(--bp-control-h-sm); padding: 0 10px; font-size: var(--bp-fs-xs); }
    html body.tenant-app .btn.btn-lg { min-height: 40px; padding: 0 18px; font-size: var(--bp-fs); }
    html body.tenant-app :is(.btn-primary, .toolbar-btn-primary, .btn-info) { background: var(--bp-primary); border: 1px solid var(--bp-primary); color: var(--bp-on-primary); }
    html body.tenant-app :is(.btn-primary, .toolbar-btn-primary, .btn-info):hover { background: var(--bp-primary-hover); border-color: var(--bp-primary-hover); color: var(--bp-on-primary); }
    html body.tenant-app :is(.btn-secondary, .btn-outline, .btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-default, .btn-cancel, .toolbar-btn:not(.toolbar-btn-primary):not(.toolbar-btn-success):not(.toolbar-btn-danger):not(.toolbar-btn-warning)) { background: var(--bp-surface); border: 1px solid var(--bp-border-strong); color: var(--bp-text); }
    html body.tenant-app :is(.btn-secondary, .btn-outline, .btn-outline-secondary, .btn-outline-primary, .btn-light, .btn-default, .btn-cancel, .toolbar-btn:not(.toolbar-btn-primary):not(.toolbar-btn-success):not(.toolbar-btn-danger):not(.toolbar-btn-warning)):hover { background: var(--bp-soft); border-color: var(--bp-border-strong); color: var(--bp-text); }
    html body.tenant-app :is(.btn-success, .toolbar-btn-success) { background: var(--bp-success-bg); border: 1px solid var(--bp-success); color: var(--bp-success); }
    html body.tenant-app :is(.btn-success, .toolbar-btn-success):hover { background: var(--bp-success); color: var(--bp-surface); }
    html body.tenant-app :is(.btn-warning, .toolbar-btn-warning) { background: var(--bp-warning-bg); border: 1px solid var(--bp-warning); color: var(--bp-warning); }
    html body.tenant-app :is(.btn-warning, .toolbar-btn-warning):hover { background: var(--bp-warning); color: var(--bp-surface); }
    html body.tenant-app :is(.btn-danger, .btn-outline-danger, .toolbar-btn-danger) { background: var(--bp-surface); border: 1px solid var(--bp-danger); color: var(--bp-danger); }
    html body.tenant-app :is(.btn-danger, .btn-outline-danger, .toolbar-btn-danger):hover { background: var(--bp-danger-solid); border-color: var(--bp-danger-solid); color: #ffffff; }
    html body.tenant-app :is(.btn, .toolbar-btn):focus-visible { outline: 2px solid var(--bp-focus); outline-offset: 2px; }
    /* Surfaces */
    html body.tenant-app :is(.card, .table-card, .form-card, .accounting-panel, .stat-card, .summary-card, .dashboard-card, .report-card, .action-card, .gst-card) { background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: var(--bp-shadow); }
    html body.tenant-app :is(.stat-card, .action-card, .report-card):hover { transform: none; box-shadow: var(--bp-shadow); border-color: var(--bp-accent); }
    html body.tenant-app .content :is(.page-header, .page-toolbar) { background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); border-radius: var(--bp-r-lg); box-shadow: none; }
    html body.tenant-app .content .page-header h1 { margin: 0; font-size: var(--bp-fs-xl); }
    /* Fields: readable in both themes, visible chevron on every select */
    html body.tenant-app :is(.form-control, .form-select, .toolbar-filter :is(input, select)) { border-color: var(--bp-border-strong); border-radius: var(--bp-r); font-size: var(--bp-fs); color: var(--bp-text); background-color: var(--bp-field); }
    html body.tenant-app :is(select.form-control, .form-select, select.ui-select) { appearance: none; -webkit-appearance: none; background-image: var(--bp-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px; padding-right: 32px; color: var(--bp-text); }
    html body.tenant-app select { min-height: var(--bp-control-h); color: var(--bp-text); }
    html body.tenant-app :is(input, select, textarea):focus-visible { outline: 2px solid var(--bp-focus); outline-offset: 1px; }
    html[data-theme="dark"] body.tenant-app :is(input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"])::-webkit-calendar-picker-indicator { filter: invert(.85); }
    html body.tenant-app :is(.form-group, .toolbar-filter) > label { color: var(--bp-muted); font-size: var(--bp-fs-xs); font-weight: 600; }
    /* Tables */
    html body.tenant-app :is(.table, .data-table, .report-table, .gst-table, .ledger-table) { font-size: var(--bp-fs-sm); color: var(--bp-text); border-color: var(--bp-border); }
    html body.tenant-app :is(.table, .data-table, .report-table, .gst-table, .ledger-table) thead th { background: var(--bp-soft); color: var(--bp-muted); border-color: var(--bp-border); font-size: var(--bp-fs-xs); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
    html body.tenant-app :is(.table, .data-table, .report-table, .gst-table, .ledger-table) td { border-color: var(--bp-border); color: var(--bp-text); }
    html body.tenant-app :is(.table, .data-table) :is(th, td) { padding: var(--bp-cell-py) var(--bp-cell-px); }
    html body.tenant-app :is(.table, .data-table, .gst-table) tbody tr:hover { background: var(--bp-row-hover); }
    html body.tenant-app :is(td, th):is(.text-right, .text-end, .amount, .num, .numeric) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
    /* Badges and chips: tinted background + readable text in both themes */
    html body.tenant-app :is(.badge, .gst-chip, .status-badge) { border-radius: var(--bp-r-pill); font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
    html body.tenant-app :is(.badge-success, .badge-active, .status-active, .status-paid, .status-posted, .st-filed, .gst-conn.on, .gst-prov.books) { background: var(--bp-success-bg); color: var(--bp-success); }
    html body.tenant-app :is(.badge-danger, .badge-error, .badge-deactivated, .status-cancelled, .status-overdue, .st-has_errors) { background: var(--bp-danger-bg); color: var(--bp-danger); }
    html body.tenant-app :is(.badge-warning, .status-pending, .status-partial, .status-draft, .st-draft, .gst-ribbon) { background: var(--bp-warning-bg); color: var(--bp-warning); border-color: var(--bp-warning); }
    html body.tenant-app :is(.badge-info, .badge-primary, .st-saved_to_portal, .st-ready_to_file, .gst-prov.portal, .gst-prov.b2b) { background: var(--bp-info-bg); color: var(--bp-info); }
    html body.tenant-app :is(.badge-secondary, .badge-light, .status-inactive, .st-not_started, .gst-chip:not([class*="st-"]), .gst-conn.off, .gst-prov.locked) { background: var(--bp-neutral-bg); color: var(--bp-muted); }
    /* Alerts */
    html body.tenant-app .alert { border: 1px solid var(--bp-border); border-left-width: 3px; border-radius: var(--bp-r); font-size: var(--bp-fs-sm); color: var(--bp-text); background: var(--bp-surface); }
    html body.tenant-app .alert-success { border-color: var(--bp-success); background: var(--bp-success-bg); color: var(--bp-text); }
    html body.tenant-app :is(.alert-danger, .alert-error) { border-color: var(--bp-danger); background: var(--bp-danger-bg); color: var(--bp-text); }
    html body.tenant-app .alert-warning { border-color: var(--bp-warning); background: var(--bp-warning-bg); color: var(--bp-text); }
    html body.tenant-app .alert-info { border-color: var(--bp-info); background: var(--bp-info-bg); color: var(--bp-text); }
    /* GST hub labels and tabs (dim in dark mode before) */
    html body.tenant-app .gst-tabs { border-bottom: 1px solid var(--bp-border-strong); }
    html body.tenant-app .gst-tab { color: var(--bp-muted); border-bottom-width: 2px; }
    html body.tenant-app :is(.gst-tab.active, .gst-tab:hover) { color: var(--bp-accent); border-bottom-color: var(--bp-accent); }
    html body.tenant-app :is(.gst-card h3, .gst-table th) { color: var(--bp-text); }
    html body.tenant-app :is(.gst-muted, .gst-days, .gst-help ol) { color: var(--bp-muted); }
    html body.tenant-app .gst-help summary { color: var(--bp-accent); }
    /* Dark mode: inline light-only chips, white-on-colour badges and hard-coded greys become readable */
    html[data-theme="dark"] body.tenant-app .content :is([style*="background:#fff"], [style*="background: #fff"], [style*="background:white"], [style*="background: white"], [style*="background-color:#fff"], [style*="background-color: #fff"], [style*="background-color: white"], [style*="background:#f8f9fa"], [style*="background: #f8f9fa"], [style*="background:#f8fafc"], [style*="background: #f8fafc"], [style*="background:#f9fafb"], [style*="background: #f9fafb"], [style*="background:#f3f4f6"], [style*="background: #f3f4f6"], [style*="background:#f1f5f9"], [style*="background: #f1f5f9"]) { background: var(--bp-soft) !important; color: var(--bp-text) !important; border-color: var(--bp-border) !important; }
    html[data-theme="dark"] body.tenant-app .content :is([style*="color:#333"], [style*="color: #333"], [style*="color:#666"], [style*="color: #666"], [style*="color:#374151"], [style*="color: #374151"], [style*="color:#1f2937"], [style*="color: #1f2937"], [style*="color:#1e293b"], [style*="color: #1e293b"], [style*="color:#2d3748"], [style*="color: #2d3748"], [style*="color:#111"], [style*="color: #111"]):not([style*="background"]) { color: var(--bp-text) !important; }
    html[data-theme="dark"] body.tenant-app .content :is([style*="color:#64748b"], [style*="color: #64748b"], [style*="color:#6b7280"], [style*="color: #6b7280"], [style*="color:#718096"], [style*="color: #718096"], [style*="color:#888"], [style*="color: #888"], [style*="color:#999"], [style*="color: #999"], [style*="color:#94a3b8"], [style*="color: #94a3b8"], [style*="color:#6c757d"], [style*="color: #6c757d"], [style*="color:#475569"], [style*="color: #475569"]):not([style*="background"]) { color: var(--bp-muted) !important; }
    /* Modals */
    html body.tenant-app :is(.modal-container, .modal-content, .gst-modal-box) { background: var(--bp-surface); color: var(--bp-text); border-color: var(--bp-border); }
    /* Pagination */
    html body.tenant-app .pagination-container { border-radius: var(--bp-r-lg); font-size: var(--bp-fs-sm); }
    /* inside a card the pager is the card's foot, not a second box */
    html body.tenant-app .ui-card > .pagination-container { margin: 0; border: 0; border-top: 1px solid var(--bp-border); border-radius: 0; background: transparent; }
    /* Empty state */
    html body.tenant-app .empty-state { color: var(--bp-muted); }
}
@media screen and (max-width: 767.98px) {
    /* No horizontal page scroll on phones: wide tables scroll inside their own box */
    html body.tenant-app .content :is(.table-card, .table-responsive, .table-container, .ledger-table-container) { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    html body.tenant-app .content > table:not(.ui-table-stack), html body.tenant-app .content .card > table:not(.ui-table-stack) { display: block; overflow-x: auto; max-width: 100%; }
    html body.tenant-app :is(.btn, .toolbar-btn, .ui-btn) { min-height: 40px; }
    .ui-btn { height: 40px; }
    .ui-btn-sm { height: 40px; padding: 0 12px; }
    .ui-btn-icon.ui-btn-sm { width: 40px; padding: 0; }
    .ui-page { min-width: 40px; height: 40px; }
    /* help text opens across the screen instead of hanging off its edge */
    .ui-help-pop, .ui-help.ui-help-end .ui-help-pop { position: fixed; left: 12px; right: 12px; top: auto; width: auto; max-width: none; }
    .ui-input, .ui-select { height: 40px; font-size: 16px; }
    .ui-page-title { font-size: var(--bp-fs-xl); }
    .ui-tab { height: 40px; }
    .ui-fold:not(.ui-card) > summary { min-height: 40px; }
    /* the help mark keeps its size; its touch area grows to 40px */
    .ui-help > summary { position: relative; }
    .ui-help > summary::after { content: ""; position: absolute; inset: -11px; }
    .ui-tabs { flex-wrap: nowrap; }
    .ui-kpis, .ui-kpis.ui-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ui-grid.ui-cols-2, .ui-grid.ui-cols-3, .ui-form-grid.ui-cols-2, .ui-form-grid.ui-cols-3, .ui-form-grid.ui-cols-4 { grid-template-columns: minmax(0, 1fr); }
    .ui-form-grid .ui-span-2 { grid-column: auto; }
    .ui-toolbar .ui-field { flex: 1 1 140px; }
    /* a long label wraps in its share instead of squeezing the figure beside it */
    .ui-dl { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
    .ui-page-actions { justify-content: flex-start; }
    .ui-modal { padding: 0; align-items: flex-end; }
    .ui-modal-dialog, .ui-modal-dialog.ui-modal-lg { width: 100%; max-height: 92vh; border-radius: var(--bp-r-lg) var(--bp-r-lg) 0 0; }
    dialog.ui-native-dialog { width: 100%; max-height: 92vh; max-height: 92dvh; margin: auto auto 0; border-radius: var(--bp-r-lg) var(--bp-r-lg) 0 0; }
}
@media screen and (min-width: 768px) and (max-width: 1199.98px) {
    .ui-kpis.ui-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ui-grid.ui-cols-3, .ui-form-grid.ui-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 420px) {
    .ui-kpis, .ui-kpis.ui-cols-4 { grid-template-columns: minmax(0, 1fr); gap: var(--bp-s2); }
    /* phone: one slim line per figure (label left, figure right, note under), so the list below is not pushed off the first screen */
    .ui-kpi { flex-flow: row wrap; align-items: baseline; justify-content: space-between; gap: 2px var(--bp-s3); min-height: 0; padding: 10px var(--bp-s4); }
    .ui-kpi-label { flex: 0 1 auto; min-width: 0; }
    .ui-kpi-label .bp-icon { display: none; }
    .ui-kpi-value { flex: 1 1 auto; font-size: var(--bp-fs-xl); text-align: right; }
    .ui-kpi-meta { flex: 0 0 100%; }
}

/* ───────────────────────────── 6. PRINT ───────────────────────────── */
@media print {
    .bp-topbar, .bp-sidebar, .sidebar-overlay, .ui-page-actions, .ui-toolbar, .ui-tabs, .ui-pagination, .ui-help, .ui-btn, .ui-no-print { display: none !important; }
    body.tenant-app, body.tenant-app:has(> .bp-topbar):not(:has(.main-container, .main-wrapper)) { padding: 0 !important; background: #ffffff !important; color: #000000 !important; }
    body.tenant-app .main-container, body.tenant-app .main-wrapper { display: block !important; height: auto !important; margin: 0 !important; }
    body.tenant-app .main-container > .content, body.tenant-app .main-wrapper > :is(.content, .dashboard-container) { margin: 0 !important; padding: 0 !important; height: auto !important; overflow: visible !important; }
    .ui-card, .ui-kpi, .ui-table-wrap { box-shadow: none !important; border-color: #999999 !important; break-inside: avoid; }
    .ui-table-wrap { overflow: visible !important; max-height: none !important; }
    .ui-table thead th { position: static !important; background: #eeeeee !important; color: #000000 !important; }
    .ui-table { font-size: 10pt; }
    .ui-table :is(th, td) { height: auto; padding: 3pt 5pt; border-bottom: 0.5pt solid #999999; }
    .ui-print-only { display: block !important; }
}
.ui-print-only { display: none; }

/* 2026-11-13 (m) Plain disclosures and field groups on legacy pages: a fieldset never forces the page wider than the
   screen, and a plain <summary> is a 40px touch target on phones (the .ui-fold / .ui-help / .ui-menu ones size themselves). */
body.tenant-app .content fieldset { min-width: 0; }
@media (max-width: 767.98px) {
    body.tenant-app .content details:not(.ui-help):not(.ui-menu):not(.ui-fold) > summary:not(.ui-btn):not(.ui-card-header) { min-height: 40px; padding-block: 10px; }
}

/* Journal lines of the voucher page on phones: four columns fit the screen, so nothing scrolls under the Remove button. */
@media (max-width: 767.98px) {
    body.tenant-app #journalLines { width: 100%; min-width: 0; table-layout: fixed; }
    body.tenant-app #journalLines :is(th, td) { padding-inline: var(--bp-s1); }
    body.tenant-app #journalLines th:first-child { width: 34%; }
    body.tenant-app #journalLines th.ui-actions { width: 84px; }
    body.tenant-app #journalLines :is(input, select) { width: 100%; min-width: 0; }
}


/* Colours shared by the business and administration workspaces. */
@media screen {
    :root {
        --bp-sidebar-fill: linear-gradient(145deg, #f8fafc, #f1f5f9 55%, #e4eaf2);
        --bp-action-fill: linear-gradient(135deg, #2d68ce, #2354ad);
        --bp-section-fill: linear-gradient(105deg, #edf3fc, #f8faff);
    }
    :root[data-theme="dark"] {
        --bp-sidebar-fill: linear-gradient(145deg, #1b293a, #15202f);
        --bp-section-fill: linear-gradient(105deg, #21334a, #1c2a3b);
    }
    html body.tenant-app .bp-topbar {
        background: var(--bp-tenant-banner);
        box-shadow: 0 3px 12px rgb(25 59 101 / 22%);
    }
    html body.tenant-app .bp-sidebar { background: var(--bp-sidebar-fill); }
    .bp-nav-accordion .bp-nav-section + .bp-nav-section { margin-top: 4px; }
    .bp-nav.bp-nav-accordion .bp-nav-section.has-active > .bp-nav-head,
    .bp-nav.bp-nav-accordion .bp-nav-head[aria-expanded="true"] { background: var(--bp-tint); color: var(--bp-accent); }
    .bp-nav.bp-nav-accordion .bp-nav-items { margin-block: var(--bp-s1) var(--bp-s2); padding-left: var(--bp-s5); }
    .bp-nav.bp-nav-accordion .bp-nav-caption,
    .bp-nav.bp-nav-accordion a.bp-nav-sub {
        display: flex; align-items: center; gap: var(--bp-s2); min-height: 36px;
        padding: var(--bp-s1) var(--bp-s2) var(--bp-s1) var(--bp-s3);
    }
    .bp-nav.bp-nav-accordion .bp-nav-caption {
        color: var(--bp-muted); font-size: var(--bp-fs-xs); font-weight: 700;
    }
    .bp-nav-accordion summary.bp-nav-caption { border-radius: var(--bp-r-sm); cursor: pointer; }
    .bp-nav-accordion summary.bp-nav-caption::-webkit-details-marker { display: none; }
    .bp-nav-accordion summary.bp-nav-caption:hover { background: var(--bp-soft); color: var(--bp-text); }
    .bp-nav-accordion summary.bp-nav-caption:focus-visible { outline: 2px solid var(--bp-focus); outline-offset: -2px; }
    .bp-nav-accordion .bp-nav-caption > .bp-nav-caret { flex: 0 0 auto; margin-inline-start: auto; }
    .bp-nav-accordion .bp-nav-disclosure[open] > summary .bp-nav-caret { transform: rotate(90deg); }
    .bp-nav-accordion .bp-nav-disclosure.has-active > summary { color: var(--bp-accent); }
    .bp-nav.bp-nav-accordion .bp-nav-group-links { margin-inline-start: var(--bp-s2); border-left: 1px solid var(--bp-border); }
    .bp-nav-accordion .bp-nav-sub-icon {
        box-sizing: content-box; flex: 0 0 auto; width: 14px; height: 14px; padding: 3px; border-radius: 5px;
        color: var(--nav-ink, var(--bp-accent)); background: var(--nav-fill, var(--bp-tint));
    }
    .bp-nav-accordion a.active > .bp-nav-sub-icon { color: #fff; background: var(--bp-header-control-hover); }
    .bp-nav.bp-nav-accordion a.bp-nav-sub.active { background: var(--bp-action-fill); color: #fff; border-left-color: transparent; }
    @media (max-width: 1199.98px) {
        .bp-nav.bp-nav-accordion :is(a.bp-nav-sub, .bp-nav-caption) { min-height: 44px; }
    }
    .bp-nav a.bp-nav-link.active,
    .bp-nav .bp-nav-panel a.bp-nav-sub.active {
        background: var(--bp-action-fill);
        color: white;
        box-shadow: 0 2px 7px rgb(37 95 196 / 20%);
    }
    .bp-nav a.bp-nav-link.active > .bp-icon { color: inherit; }
    .bp-nav .bp-nav-panel a.bp-nav-sub.active::before { background: white; }
    .bp-nav-head:is([data-section="sales"], [data-section="banking"]),
    .bp-nav-accordion .bp-nav-section:has(> .bp-nav-head:is([data-section="sales"], [data-section="banking"])) {
        --nav-ink: var(--bp-success); --nav-fill: var(--bp-success-bg);
    }
    .bp-nav-head:is([data-section="inventory"], [data-section="assets"]),
    .bp-nav-accordion .bp-nav-section:has(> .bp-nav-head:is([data-section="inventory"], [data-section="assets"])) {
        --nav-ink: var(--bp-warning); --nav-fill: var(--bp-warning-bg);
    }
    .bp-nav-head:is([data-section="gst"], [data-section="payroll"]),
    .bp-nav-accordion .bp-nav-section:has(> .bp-nav-head:is([data-section="gst"], [data-section="payroll"])) {
        --nav-ink: var(--bp-info); --nav-fill: var(--bp-info-bg);
    }
    .bp-nav button.bp-nav-head > .bp-icon:first-child {
        box-sizing: border-box; width: 26px; height: 26px; padding: 4px; border-radius: 7px;
        background: var(--nav-fill, var(--bp-tint)); color: var(--nav-ink, var(--bp-accent));
    }
    .ui-card-header { background: var(--bp-section-fill); border-radius: var(--bp-r-lg) var(--bp-r-lg) 0 0; }
    .kpi-income { --kpi-ink: var(--bp-success); --kpi-fill: var(--bp-success-bg); }
    .kpi-purchases { --kpi-ink: var(--bp-warning); --kpi-fill: var(--bp-warning-bg); }
    .kpi-payments { --kpi-ink: var(--bp-info); --kpi-fill: var(--bp-info-bg); }
    .kpi-customers { --kpi-ink: #7046ae; --kpi-fill: #f1eafa; }
    html[data-theme="dark"] .kpi-customers { --kpi-ink: #ceb0ff; --kpi-fill: #332747; }
    .ui-kpi { border-top: 3px solid var(--kpi-ink, var(--bp-accent)); }
    .ui-kpi.is-pos { border-top-color: var(--bp-success); }
    .ui-kpi.is-warn { border-top-color: var(--bp-warning); }
    .ui-kpi.is-neg { border-top-color: var(--bp-danger); }
    .ui-kpi-label .bp-icon {
        box-sizing: content-box; padding: 5px; border-radius: 8px;
        color: var(--kpi-ink, var(--bp-accent)); background: var(--kpi-fill, var(--bp-tint));
    }
    .ui-btn-primary:not(:disabled),
    html body.tenant-app :is(.btn-primary, .toolbar-btn-primary):not(:disabled) {
        background: var(--bp-action-fill);
        box-shadow: 0 2px 5px rgb(37 95 196 / 18%);
    }
    .ui-btn-primary:not(:disabled):hover,
    html body.tenant-app :is(.btn-primary, .toolbar-btn-primary):not(:disabled):hover {
        background: var(--bp-primary-hover);
    }
}

/* Icons use the same outlines as the tenant navigation. Existing inline icons take precedence. */
@media screen {
    .ui-action-review { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M12%204L2.5%2020h19z%20M12%2010v4.5%20M12%2017.2v.3%27/%3E%3C/svg%3E"); }
    .ui-action-back { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M19%2012H5%20M11%206l-6%206l6%206%27/%3E%3C/svg%3E"); }
    .ui-action-open { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M5%2012h14%20M13%206l6%206l-6%206%27/%3E%3C/svg%3E"); }
    .ui-action-whatsapp { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M4%205h16v11H9l-5%204z%27/%3E%3C/svg%3E"); }
    .ui-action-approve { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M5%2012.5l4.5%204.5L19%207.5%27/%3E%3C/svg%3E"); }
    .ui-action-verify { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M12%203a9%209%200%201%200%200%2018a9%209%200%200%200%200-18z%20M8%2012.5l2.8%202.8L16%209.8%27/%3E%3C/svg%3E"); }
    .ui-action-close { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M6%206l12%2012%20M18%206L6%2018%27/%3E%3C/svg%3E"); }
    .ui-action-copy { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M9%209h11v11H9z%20M5%2015H4V4h11v1%27/%3E%3C/svg%3E"); }
    .ui-action-download { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M12%204v11%20M7.5%2011l4.5%204.5l4.5-4.5%20M5%2020h14%27/%3E%3C/svg%3E"); }
    .ui-action-correct, .ui-action-edit { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M4%2020h4L18.5%209.5a2.1%202.1%200%200%200-3-3L5%2017z%20M14%208l3%203%27/%3E%3C/svg%3E"); }
    .ui-action-view { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M2.5%2012S6%205.5%2012%205.5S21.5%2012%2021.5%2012S18%2018.5%2012%2018.5S2.5%2012%202.5%2012z%20M12%209.5a2.5%202.5%200%201%200%200%205a2.5%202.5%200%200%200%200-5z%27/%3E%3C/svg%3E"); }
    .ui-action-filter { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M4%205h16l-6%207.5V19l-4-2v-4.5z%27/%3E%3C/svg%3E"); }
    .ui-action-history { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M4.5%2012a7.5%207.5%200%201%200%202.2-5.3%20M4.5%204.5v4h4%20M12%208v4.5l3%201.5%27/%3E%3C/svg%3E"); }
    .ui-action-attach { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M10%2014a4%204%200%200%200%205.7%200l3-3a4%204%200%200%200-5.7-5.7l-1%201%20M14%2010a4%204%200%200%200-5.7%200l-3%203a4%204%200%200%200%205.7%205.7l1-1%27/%3E%3C/svg%3E"); }
    .ui-action-mail { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M3.5%206h17v12h-17z%20M3.5%207l8.5%206l8.5-6%27/%3E%3C/svg%3E"); }
    .ui-action-new { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M12%205v14%20M5%2012h14%27/%3E%3C/svg%3E"); }
    .ui-action-print { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M7%209V4h10v5%20M7%2017H5a1%201%200%200%201-1-1v-6a1%201%200%200%201%201-1h14a1%201%200%200%201%201%201v6a1%201%200%200%201-1%201h-2%20M7%2014h10v6H7z%27/%3E%3C/svg%3E"); }
    .ui-action-refresh { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M19.5%2012a7.5%207.5%200%201%201-2.2-5.3%20M19.5%204.5v4h-4%27/%3E%3C/svg%3E"); }
    .ui-action-save, .ui-action-draft { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M5%204h11l3%203v13H5z%20M8%204v5h7V4%20M8%2020v-6h8v6%27/%3E%3C/svg%3E"); }
    .ui-action-search { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M11%204a7%207%200%201%200%200%2014a7%207%200%200%200%200-14z%20M16.5%2016.5L20%2020%27/%3E%3C/svg%3E"); }
    .ui-action-danger { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M4%207h16%20M9%207V4h6v3%20M6.5%207l1%2013h9l1-13%20M10%2011v5%20M14%2011v5%27/%3E%3C/svg%3E"); }
    .ui-action-reset, .ui-action-reverse { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M9%207L4.5%2011.5L9%2016%20M5%2011.5h9a5%205%200%200%201%200%2010h-3%27/%3E%3C/svg%3E"); }
    .ui-action-upload { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M12%2016V5%20M7.5%209L12%204.5L16.5%209%20M5%2020h14%27/%3E%3C/svg%3E"); }
    .ui-action-payment { --bp-action-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271.7%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%3E%3Cpath%20d%3D%27M4%207h15a1%201%200%200%201%201%201v11H5a1%201%200%200%201-1-1z%20M4%207V6a1%201%200%200%201%201-1h12v2%20M16%2013.5h.01%27/%3E%3C/svg%3E"); }
    :is(.ui-btn,.btn,.toolbar-btn,.ui-menu-item,summary)[class*="ui-action-"]:not(:has(svg,.bp-icon,.biz-spin,i,.spinner-border))::before {
        content: ""; display: inline-block; width: 1em; height: 1em; flex: 0 0 1em; vertical-align: -.12em;
        background: currentColor; mask: var(--bp-action-icon) center / contain no-repeat;
    }
    :is(.ui-action-mail, .ui-action-copy) { --bp-tool-ink: #49338b; --bp-tool-fill: #f1eaff; }
    [data-theme="dark"] :is(.ui-action-mail, .ui-action-copy) { --bp-tool-ink: #d6c4ff; --bp-tool-fill: #332747; }
    :is(.ui-action-whatsapp) { --bp-tool-ink: #146442; --bp-tool-fill: #def6e8; }
    [data-theme="dark"] :is(.ui-action-whatsapp) { --bp-tool-ink: #95e8b9; --bp-tool-fill: #183b2b; }
    :is(.ui-action-download, .ui-action-print, .ui-action-upload, .ui-action-attach) { --bp-tool-ink: #125a78; --bp-tool-fill: #def2fb; }
    [data-theme="dark"] :is(.ui-action-download, .ui-action-print, .ui-action-upload, .ui-action-attach) { --bp-tool-ink: #9be1f6; --bp-tool-fill: #163848; }
    :is(.ui-action-correct) { --bp-tool-ink: #754800; --bp-tool-fill: #fff0cf; }
    [data-theme="dark"] :is(.ui-action-correct) { --bp-tool-ink: #ffdb98; --bp-tool-fill: #44351e; }
    :is(.ui-action-edit, .ui-action-view, .ui-action-search, .ui-action-filter, .ui-action-refresh) { --bp-tool-ink: #244f97; --bp-tool-fill: #eaf1ff; }
    [data-theme="dark"] :is(.ui-action-edit, .ui-action-view, .ui-action-search, .ui-action-filter, .ui-action-refresh) { --bp-tool-ink: #b2ccff; --bp-tool-fill: #223653; }
    :is(body.tenant-app, .no-print) :is(summary,.ui-menu-item,.ui-btn,.btn,.toolbar-btn):is(.ui-action-mail, .ui-action-copy, .ui-action-whatsapp, .ui-action-download, .ui-action-print, .ui-action-upload, .ui-action-attach, .ui-action-correct, .ui-action-edit, .ui-action-view, .ui-action-search, .ui-action-filter, .ui-action-refresh) {
        color: var(--bp-tool-ink); background: var(--bp-tool-fill); border-color: color-mix(in srgb, var(--bp-tool-ink) 45%, var(--bp-tool-fill));
    }
    :is(body.tenant-app, .no-print) :is(summary,.ui-menu-item,.ui-btn,.btn,.toolbar-btn):is(.ui-action-mail, .ui-action-copy, .ui-action-whatsapp, .ui-action-download, .ui-action-print, .ui-action-upload, .ui-action-attach, .ui-action-correct, .ui-action-edit, .ui-action-view, .ui-action-search, .ui-action-filter, .ui-action-refresh):enabled:hover,
    body.tenant-app a:is(.ui-action-mail, .ui-action-copy, .ui-action-whatsapp, .ui-action-download, .ui-action-print, .ui-action-upload, .ui-action-attach, .ui-action-correct, .ui-action-edit, .ui-action-view, .ui-action-search, .ui-action-filter, .ui-action-refresh):hover { background: color-mix(in srgb, var(--bp-tool-ink) 12%, var(--bp-tool-fill)); }
    summary.ui-action-correct::before { margin-inline-end: .45em; }
    body.tenant-app .ui-menu-item[class*=" ui-action-"] .bp-icon { color: inherit; }
}
