/* == Module header (D6). Purpose/Status are hand-written; Module-Map.py --check verifies the rest. ==
   Purpose:   One look on every page: palette, type scale, buttons, popups, fields, focus and
              switches.
   Status:    active
   Loaded by: alarm-monitoring.html, bug-report-markup.html, change-password.html,
              customer-portal.html, customer-welcome.html, dashboard.html, files.html,
              fire-inspections.html, inventory.html, login.html, monitoring-devices.html,
              phone-sign-in.html, and 11 more (MODULES.md)
   Replaces:  none
   History:   242, 274, 367, 368, 469, 489, 517, 520, 521, 528, 549, 581, 585, 598, 628, 631, 632,
              641, 665, 698, 703, 769, 819, 854, 856, 874, 969, 1004, 1006
   == end of module header == */
/* LF 368 / BSS 469 (2026-10-25, brand tokens): brand colours below are var(--brand-ink | --brand-fill | --brand-fill-hover | --brand-tint |
   --brand-line | --brand-panel | --brand-tint-text | --danger-ink | --danger-tint | --warn-ink, <LF colour>). LF leaves
   these tokens unset, so LF keeps the colour after the comma; BSS sets them in brand-tokens.css. */
/* LF 367 / BSS 469 (2026-10-25, layer fold): the suite-wide look the design review set (I1-I4, I9, I10, C1-C14) and the control alignment pass
   (LF 242), moved out of the ui-layer files suite_look.py used to add to every page. Rules keep their
   html[data-ui-page] prefix: suite_look.py still tags each page with its kind. Linked last in every page's
   head, where the layers sat, so the cascade is unchanged. */

/* ---- from ui-layer-229: look and consistency ---- */
/* LogicFortress palette. Red is the brand and the main action; it is no longer used for
   Cancel, secondary buttons or statuses. */
@layer app {
    html[data-ui-page]:root, html[data-ui-page]:root body {
        --u-page: #f4f5f7;
        --u-card: #ffffff;
        --u-raised: #ffffff;
        --u-line: #dfe2e6;
        --u-line-strong: #c9cdd3;
        --u-hover: #eef0f2;
        --u-input: #ffffff;
        --u-text: #202327;
        --u-muted: #5f656d;
        --u-accent: var(--brand-ink, #b81925);
        --u-accent-soft: var(--brand-tint, #fbe5e7);
        --u-primary: var(--brand-fill, #b81925);
        --u-primary-hover: var(--brand-fill-hover, #9c1520);
        --u-on-primary: #ffffff;
        --u-danger: var(--danger-ink, #b81925);
        --u-danger-soft: var(--danger-tint, #fbe5e7);
        --u-warn: #8a5a00;
        --u-warn-soft: #fff3d6;
        --u-ok: #137d48;
        --u-ok-soft: #e3f3e9;
        --u-shadow: 0 12px 32px rgba(20, 22, 26, .16), 0 2px 6px rgba(20, 22, 26, .08);
        --u-focus: var(--brand-ink, #b81925);
    }
    html[data-ui-page].dark, html[data-ui-page].dark body {
        --u-page: #131415;
        --u-card: #1c1e20;
        --u-raised: #26292c;
        --u-line: #33373c;
        --u-line-strong: #474c53;
        --u-hover: #2a2d31;
        --u-input: #17191b;
        --u-text: #e8eaed;
        --u-muted: #a6acb4;
        --u-accent: var(--brand-ink, #ff939b);
        --u-accent-soft: var(--brand-tint, #3d2226);
        --u-primary: var(--brand-fill, #c41e2b);
        --u-primary-hover: var(--brand-fill-hover, #d63340);
        --u-on-primary: #ffffff;
        --u-danger: var(--danger-ink, #ff8f98);
        --u-danger-soft: var(--danger-tint, #3d2226);
        --u-warn: #f0bf57;
        --u-warn-soft: #3a3020;
        --u-ok: #5fd391;
        --u-ok-soft: #1d3a2a;
        --u-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
        --u-focus: var(--brand-ink, #ff939b);
    }

    /* ---- I2: map every older surface token onto one three-step ladder (page, card, raised) ---- */
    html[data-ui-page]:root, html[data-ui-page]:root body,
    html[data-ui-page].dark, html[data-ui-page].dark body {
        --bg: var(--u-page);
        --page: var(--u-page);
        --panel: var(--u-card);
        --surface: var(--u-card);
        --panel31: var(--u-card);
        --raised: var(--u-raised);
        --input31: var(--u-input);
        --text: var(--u-text);
        --ink: var(--u-text);
        --ink31: var(--u-text);
        --muted: var(--u-muted);
        --muted31: var(--u-muted);
        --line: var(--u-line);
        --line31: var(--u-line);
        --hover: var(--u-hover);
        --search: var(--u-hover);
        --badge: var(--u-hover);
        --surface44: var(--u-raised);
        --ink44: var(--u-text);
        --border44: var(--u-line-strong);
        --hover44: var(--u-hover);
        --lf-search77: var(--u-hover);
        --lf-input77: var(--u-input);
        --bss-search77: var(--u-hover);
        --bss-input77: var(--u-input);
    }
    html[data-ui-page] body { color: var(--u-text); }

    /* ---- I3: one typeface and one type scale ---- */
    @font-face {
        font-family: Montserrat;
        src: url('/static/fonts/Montserrat.ttf') format('truetype');
        font-style: normal;
        font-weight: 100 900;
        font-display: swap;
    }
    html[data-ui-page]:not([data-ui-page="sign-in"]):not([data-ui-page="support"]) body,
    html[data-ui-page]:not([data-ui-page="sign-in"]):not([data-ui-page="support"]) :is(button, input, select, textarea, table) {
        font-family: Montserrat, Arial, system-ui, sans-serif !important;
    }

    html[data-ui-page] body table th {
        color: var(--u-muted) !important;
    }
    html[data-ui-page] body table td { font-variant-numeric: tabular-nums; }
    html[data-ui-page] body :is(.metric29 strong, .money-cell) { font-variant-numeric: tabular-nums; }

    /* ---- C7: one page header: title (and subtitle) left, actions right, filters on the next row ---- */

    html[data-ui-page="dashboard"] body .page-title > div:first-child:has(> h1) { display: flex; flex-direction: column; }

    /* ---- Buttons (I1): brand fill for the main action only; secondary actions are neutral ---- */
    html[data-ui-page] body :is(button.primary, .button.primary, a.button.primary, .bss-primary90) {
        background: var(--u-primary) !important;
        border-color: var(--u-primary) !important;
        color: var(--u-on-primary) !important;
    }
    html[data-ui-page] body :is(button.primary, .bss-primary90):not(:disabled):hover {
        background: var(--u-primary-hover) !important;
        border-color: var(--u-primary-hover) !important;
    }
    html[data-ui-page] body button.text-button:not(.ui-danger):not(.navigation-edit-next) {
        color: var(--u-text) !important;
        font-weight: 600 !important;
    }
    html[data-ui-page] body button.text-button:not(.ui-danger):not(:disabled):hover {
        color: var(--u-accent) !important;
        background: var(--u-hover) !important;
    }
    html[data-ui-page] body a:not([class]):not(nav a):not(header a):not(.ui-plain) { color: var(--u-accent); }
    html[data-ui-page] body nav.nav31 a { color: var(--u-muted) !important; }
    html[data-ui-page] body nav.nav31 a:is([aria-current], .active, :hover) { color: var(--u-text) !important; }
    html[data-ui-page] body .ui-danger:not(.primary) {
        color: var(--u-danger) !important;
        background: transparent !important;
    }
    html[data-ui-page] body .ui-danger:not(.primary):not(:disabled):hover { background: var(--u-danger-soft) !important; }
    html[data-ui-page] body button.primary.ui-danger {
        background: #c43838 !important;
        border-color: #c43838 !important;
        color: #fff !important;
    }
    html[data-ui-page] body button.primary.ui-danger:not(:disabled):hover { background: #a92e2e !important; border-color: #a92e2e !important; }

    /* ---- C10: disabled controls look disabled ---- */

    /* LF 549 / BSS 665 (2026-11-02, say why Check out is grey), Daniel "Why are the red buttons grey without explanation": a main
       button that is waiting reads as waiting, not as a faded red that looks broken. Material's disabled look: the text
       colour at 12% behind and 45% for the words, so it suits light and dark and both suites' colours. */
    /* LF 581 / BSS 698 (2026-11-03, person-style walkthrough): Engagements' main buttons (.btn.pri: Order list's Open all links
       and Send to billing) still faded to pink */
    html[data-ui-page] body :is(button.primary, .button.primary, a.button.primary, .bss-primary90, #pr241 .btn.pri):is(:disabled, [aria-disabled="true"]),
    html[data-ui-page] body button.primary:disabled:hover,
    html[data-ui-page] body .ss-split.ss-off > .ss-arrow {
        background: color-mix(in srgb, var(--u-text) 12%, transparent) !important;
        border-color: transparent !important;
        color: color-mix(in srgb, var(--u-text) 45%, transparent) !important;
    }

    /* ---- C10 / C3: statuses use amber for "to do" and keep their words on one line ---- */

    html[data-ui-page] body .ui-zero-dot { --ui-dot: var(--u-muted); }

    /* ---- C8: one date format, no words split in the middle ---- */
    html[data-ui-page] body td { overflow-wrap: break-word; }

    /* ---- I10: every app in the top menu has its own icon colour ---- */
    /* LF 489 / BSS 598 (2026-10-30, menu colours): four apps had their own colour, the Brothers ones stayed grey
       and the current one turned the accent, so the menu looked patchy. Now each app keeps one colour of the same lightness and
       strength (the current page still shows by its label and underline), and dark mode gets a lighter set. An app
       without a colour here keeps the grey. */
    html[data-ui-page] body nav.nav31 a { --nav-icon: var(--u-muted); }
    html[data-ui-page] body nav.nav31 a[data-key="tickets"] { --nav-icon: #4170cb; }
    html[data-ui-page] body nav.nav31 a[data-key="monitoring"] { --nav-icon: #008e88; }
    html[data-ui-page] body nav.nav31 a[data-key="alarms"] { --nav-icon: #bb475d; }
    html[data-ui-page] body nav.nav31 a[data-key="inspections"] { --nav-icon: #ba4e25; }
    html[data-ui-page] body nav.nav31 a[data-key="inventory"] { --nav-icon: #a66300; }
    html[data-ui-page] body nav.nav31 a[data-key="proposals"] { --nav-icon: #9555b0; }
    html[data-ui-page] body nav.nav31 a[data-key="files"] { --nav-icon: #0081ba; }
    html[data-ui-page] body nav.nav31 a[data-key="dashboard"] { --nav-icon: #1d8b3d; }
    html[data-ui-page].dark body nav.nav31 a[data-key="tickets"] { --nav-icon: #8db7ff; }
    html[data-ui-page].dark body nav.nav31 a[data-key="monitoring"] { --nav-icon: #3ed0c8; }
    html[data-ui-page].dark body nav.nav31 a[data-key="alarms"] { --nav-icon: #fa96a3; }
    html[data-ui-page].dark body nav.nav31 a[data-key="inspections"] { --nav-icon: #f99c7c; }
    html[data-ui-page].dark body nav.nav31 a[data-key="inventory"] { --nav-icon: #e4ac59; }
    html[data-ui-page].dark body nav.nav31 a[data-key="proposals"] { --nav-icon: #d4a0ec; }
    html[data-ui-page].dark body nav.nav31 a[data-key="files"] { --nav-icon: #59c5f5; }
    html[data-ui-page].dark body nav.nav31 a[data-key="dashboard"] { --nav-icon: #80cd8b; }

    /* ---- C2: the current sidebar page reads at 4.5:1 or better ---- */
    html[data-ui-page] body .sidebar-link.active {
        color: var(--u-accent) !important;
        background: var(--u-accent-soft) !important;
    }
    html[data-ui-page] body .sidebar-link:not(.active) { color: var(--u-muted) !important; }
    html[data-ui-page] body .sidebar-link:not(.active):hover { color: var(--u-text) !important; background: var(--u-hover) !important; }

    /* ---- C14: the sidebar edit control sits under the list and says what it edits ---- */
    html[data-ui-page] body button.navigation-edit-next {
        color: var(--u-muted) !important;
        padding: 8px 12px !important;
    }
    html[data-ui-page] body button.navigation-edit-next:hover { color: var(--u-text) !important; background: var(--u-hover) !important; }
    html[data-ui-page] body button.navigation-edit-next::before {
        content: "";
        width: 16px;
        height: 16px;
        flex: none;
        background: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-lin\
ecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E\
") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='ro\
und' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E") center / contain no-repeat;
    }

    /* ---- C4: one popup template ---- */
    html[data-ui-page] body dialog:is(
        .dialog31,
        .lf-dialog,
        .themed-dialog-next,
        .bss-dialog93,
        .bss-dialog95,
        .dialog101,
        .new-ticket79,
        .row-dialog140,
        .dialog163,
        .bss-inventory-dialog95,
        #confirm-dialog,
        #file-prompt,
        #movement-details,
        #shortcuts-dialog,
        #modal):not(.account-menu32):not(.calendar31
    ) {
        /* LF 520 / BSS 631 (2026-11-01, one popup look): card shading, no side border, suite-colour top line, 20 px edges. */
        background: var(--u-card) !important;
        --panel: var(--u-card);
        --panel31: var(--u-card);
        --surface: var(--u-card);
    }
    html[data-ui-page] body dialog:is(.new-ticket79, .wide-dialog, .bss-subscriber-dialog96, .detail-dialog31, .image-editor105) { --ui-dialog-max: 760px; }
    html[data-ui-page] body dialog::backdrop { background: rgba(10, 12, 14, .55) !important; }

    /* LF 517 / BSS 628 (2026-11-01): Gmail's popup close, a round 40 px target with the 24 px grey X, its middle level with the
       middle of the popup title (measured: title middle 38 px from the popup top, so top 17 px inside the 1 px border). */
    html[data-ui-page] body dialog.ui-dialog .ui-dialog-close {
        background: transparent !important;
        color: var(--ui-x-ink) !important;
        z-index: 2;
    }
    html[data-ui-page] body dialog.ui-dialog .ui-dialog-close:hover { background: var(--ui-x-hover) !important; color: var(--ui-x-ink) !important; }
    /* LF 517 / BSS 628 (2026-11-01): Movement details has a taller title row (21 px title), so its X sits 2 px lower to stay level. */
    /* LF 528 / BSS 641 (2026-11-01, full-size close X): level with its taller title's capitals */

    html[data-ui-page] body dialog.ui-dialog { position: fixed; }
    html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions {
        grid-column: 1 / -1;
    }
    html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions > :is(button, a.button) {
        padding: 0 18px !important;
    }
    html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions > button:not(.primary):not(.ui-danger) {
        background: transparent !important;
        color: var(--u-text) !important;
        font-weight: 600 !important;
    }
    html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions > button:not(.primary):not(.ui-danger):hover {
        background: var(--u-hover) !important;
        color: var(--u-text) !important;
    }
    html[data-ui-page] body dialog.ui-dialog :is(p, small, .section-help) { color: var(--u-muted); }

    /* LF 520 / BSS 631 (2026-11-01, one popup look): the Engagements popup shading was chosen (card colour, no side
       border, suite-colour top line) and equal spacing: 20 px on every edge and 20 px from the last line to the buttons. */
    html[data-ui-page] body dialog.ui-dialog :is(p, div):has(+ .ui-dialog-actions, + p[hidden] + .ui-dialog-actions, + [role=alert][hidden] + .ui-dialog-actions) {
        text-box: trim-end text alphabetic; /* the line's own spacing under the letters no longer adds to the 20 px gap */
    }

    /* ---- C5: one field style in popups and forms ---- */

    html[data-ui-page] body dialog.ui-dialog :is(
        input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]),
        textarea,
        select:not(.native44)
    ) {
        background: var(--u-input) !important;
        border: 1px solid var(--u-line-strong) !important;
        font-size: 14px !important;
        box-shadow: none !important;
    }

    html[data-ui-page] body dialog.ui-dialog :is(input, textarea, select):focus-visible {
        border-color: transparent !important;
    }
    html[data-ui-page] body dialog.ui-dialog button.select44 {
        font-size: 14px !important;
        font-weight: 400 !important;
        background: var(--u-input) !important;
        border: 1px solid var(--u-line-strong) !important;
        color: var(--u-text) !important;
        padding: 8px 32px 8px 12px !important;
    }
    @media (min-width: 700px) {
        html[data-ui-page] body button.select44 { font-size: 14px !important; }
    }
    /* Native selects in pages that do not load the shared dropdown (site monitoring frame, public request form). */
    html[data-ui-page] body select:not(.native44):not([multiple]):not([size]) {
        font: inherit !important;
        font-size: 14px !important;
        cursor: pointer;
    }

    /* ---- C6: a section's Save sits under the settings it saves ---- */

    /* ---- I4: the theme switch on public pages shows a clear icon ---- */
    html[data-ui-page] body :is(header.auth-header79, header.customer-header74, .welcome76 header) nav button:only-of-type,
    html[data-ui-page] body .ui-theme-button {
        background: var(--u-card) !important;
        color: var(--u-text) !important;
    }
    html[data-ui-page] body .ui-theme-button::before {
        content: "";
        width: 20px;
        height: 20px;
        background: currentColor;
        -webkit-mask: var(--ui-theme-icon) center / contain no-repeat;
        mask: var(--ui-theme-icon) center / contain no-repeat;
    }
    html[data-ui-page] body .ui-theme-button {
        --ui-theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-\
linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 1\
9.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
    }
    html[data-ui-page].dark body .ui-theme-button {
        --ui-theme-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-\
linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z'/%3E%3C/svg%3E");
    }

    /* ---- C12: every category in the category menu carries an icon ---- */
    html[data-ui-page] body .ui-cat-icon { width: 16px; height: 16px; flex: none; color: var(--u-muted); }

    /* ---- Focus is always visible ---- */

    /* ---- C3: two-way switches (Transaction Log "Inventory | Ticket billing") look like one control ---- */

    /* ---- LF 367 / BSS 469 (2026-10-25, layer fold), from ui-layer-231: empty screens offer the next step (I9); a ticket list shows the customer once (C9) ---- */
    html[data-ui-page] body .ui-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
        color: var(--u-muted);
    }
    html[data-ui-page] body .ui-empty strong {
        color: var(--u-text);
        font-size: 15px;
        font-weight: 600;
    }
    html[data-ui-page] body .ui-empty .ui-empty-hint { font-size: 13px; }
    html[data-ui-page] body .ui-empty button.primary { min-height: 40px; padding: 0 18px; }

    /* ---- C9: ticket list shows the customer once (the site has its own column) ---- */
    html[data-ui-page] body td.ui-dedup { white-space: nowrap; }

    /* ---- from ui-layer-242: control alignment (2026-10-12); every rule was re-checked by the alignment sweep ---- */
    /* Custom dropdowns: the value follows the icon instead of floating to the right; the chevron stays at the edge. */

    /* iPhone pass (2026-10-12): typing boxes use 16px text on phones, so the iPhone doesn't zoom the page
       in when one is tapped (the two ids that never exist give this rule the weight to win over dialog-specific sizes);
       dropdowns in a form match the 16px boxes beside them. */
    @media (max-width: 800px), (pointer: coarse) and (max-height: 720px) {
        /* LF 769 / BSS 874 (2026-11-13, device catch-up): also the iPhone Duo opened flat (about 950 x 670), which zoomed in on 12-14px boxes */
        html[data-ui-page] body :is(
            input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]):not([type=submit]):not([type=button]):not([type=image]):not([type=reset]),
            select,
            textarea,
            #lf242-x#lf242-y
        ) {
            font-size: 16px !important;
        }
        html[data-ui-page] body :is(form, dialog, label, #lf242-x#lf242-y) button.select44 {
            font-size: 16px !important;
        }
    }

    /* Fingertip-sized targets on touch screens; the extra room is invisible padding, so nothing moves.
       LF 274 (2026-10-15): .person-button is a link (open in a new tab), so the selector no longer says button. */
    @media (pointer: coarse) {
        
    }

    /* LF 517 / BSS 628 (2026-11-01): one close X everywhere (suite-look.js closeIcons). The icon is the Material close Gmail
       uses: a thin square-ended X drawn in the button's own colour. It never takes the click, so a button's own handler
       still sees the button. Popup corner closes are Gmail's: a 24 px grey X on a round 40 px target that greys on hover. */
    :root { --ui-x-ink: #444746; --ui-x-hover: rgba(68, 71, 70, .08); }
    :root.dark { --ui-x-ink: #c4c7c5; --ui-x-hover: rgba(227, 227, 227, .10); }
    .ui-x-icon { pointer-events: none; flex: none; display: block; }
    .ui-x-text > .ui-x-icon { width: 1.1em; height: 1.1em; }
    /* LF 528 / BSS 641 (2026-11-01, full-size close X): the X was too small. Every close is the full-size icon wherever it sits (a card's
       own close, like the Send window's, stayed text-sized); remove Xs on chips keep the text size. 26 px, not Material's
       nominal 24: in Gmail the X is exactly as tall as the title's capitals, and 24 px came out 11%
       short. The two ids that never exist give it the weight to beat a card's own tool-icon size (#pr241 #dlg .cardtool svg). */
    :is(.ui-x-close, .ui-dialog-close, .dialog-close) > .ui-x-icon:not(#ui-x-a#ui-x-b) { width: 26px; height: 26px; }
    :is(.ui-dialog-close, .dialog-close).ui-x { color: var(--ui-x-ink); }
    :is(.ui-dialog-close, .dialog-close).ui-x:hover { background: var(--ui-x-hover); }

    /* S1 Equal spacing (LF 521 / BSS 632, 2026-11-01: padding always equal around the edges). A card, tile
       or banner shows the same space on all four sides, measured from the visible letters, as the popups do (C4): where text
       meets the top or bottom edge its own line spacing is trimmed (letter tops above, baseline below), and the first and last
       pieces inside add no margin of their own. Each box's padding itself is set once, equal on all sides, in its own file. */
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :first-child { margin-top: 0; text-box-trim: trim-start; text-box-edge: cap alphabetic; }
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :is(:last-child, :has(+ :is([hidden], :empty):last-child)) { margin-bottom: 0; text-box-trim: trim-end; text-box-edge: cap alphabetic; }
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :is(:empty, [hidden]):last-child { margin: 0; }
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :first-child:is(:last-child, :has(+ :is([hidden], :empty):last-child)) { text-box-trim: trim-both; }
    /* The same one level down, for a first or last row laid out side by side (a title with a note or button beside it). */
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :first-child > :first-child:not(button, input, select, textarea, a, svg, img, canvas, [role=switch]) { text-box-trim: trim-start; text-box-edge: cap alphabetic; }
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :is(:last-child, :has(+ :is([hidden], :empty):last-child)) > :last-child:not(button, input, select, textarea, a, svg, img, canvas, [role=switch]) { text-box-trim: trim-end; text-box-edge: cap alphabetic; }
    /* A text button has no visible box: on a box's first or last row it adds no hidden space above or below, and its words
       line up with the box's padding at the side, as Gmail and Outlook place a text button in a card corner. */
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :is(:first-child, :last-child, :has(+ :is([hidden], :empty):last-child)) > .text-button { margin-block: -9px; }
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) > :is(:first-child, :last-child, :has(+ :is([hidden], :empty):last-child)) > .text-button:first-child { margin-inline-start: -16px; }
    html[data-ui-page] body :is(.settings-card, .identity-card, .table-card, .ui-insight, .metric29, .pm-card, .esig-ch, .esig-cb, .two-sites-banner, .two-sites-empty, .portal-staff-strip-head, .portal-staff-address, .backup-restore80, .overview79 .card, .am-card, .fi-card) :is(div, li, header, section) > .text-button:last-child:not(:first-child) { margin-inline-end: -16px; }
}

/* priority rules. Rules above sit in the app layer; these plain rules
   win over any of them (what !important used to do), and compete with each other as before. */
html[data-ui-page] body {
    background: var(--u-page);
}
html[data-ui-page] body :is(.page-title h1, .dash-page29 > h1, .transaction-heading205 h1, #files-title, .files-main h1) {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.25;
    margin: 0;
}
html[data-ui-page] body :is(.settings-card h2, .card-heading29 h2, #metrics29 > h2, .overview79 .card h2) {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0;
}
html[data-ui-page] body :is(.settings-subtitle80, .dash-page29 > p.muted) {
    font-size: 14px;
    color: var(--u-muted);
    margin-top: 4px;
}
html[data-ui-page] body table th {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .01em;
}
html[data-ui-page="dashboard"] body .page-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    min-height: 44px;
    margin: 0 0 20px;
}
html[data-ui-page="dashboard"] body .page-title:has(> .settings-subtitle80) {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}
html[data-ui-page="dashboard"] body .dash-page29 > h1 {
    margin-bottom: 4px;
}
html[data-ui-page="dashboard"] body .dash-page29 > h1 + :not(p) {
    margin-top: 16px;
}
html[data-ui-page="dashboard"] body .dash-page29 > p.muted {
    margin-bottom: 20px;
}
html[data-ui-page] body :is(button.primary, .button.primary, a.button.primary, .bss-primary90) {
    border-radius: 8px;
    font-weight: 600;
}
html[data-ui-page] body .ui-danger:not(.primary) {
    border: 1px solid currentColor;
    border-radius: 8px;
}
html[data-ui-page] body :is(button, .button):is(:disabled, [aria-disabled="true"]) {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
    filter: none;
}
html[data-ui-page] body :is(button.primary, .button.primary, a.button.primary, .bss-primary90, #pr241 .btn.pri):is(:disabled, [aria-disabled="true"]), html[data-ui-page] body button.primary:disabled:hover, html[data-ui-page] body .ss-split.ss-off > .ss-arrow {
    opacity: 1;
}
html[data-ui-page] body .billing-status-button-next.awaiting-next, html[data-ui-page] body .billing-status-button-next.awaiting-next * {
    color: var(--u-warn);
}
html[data-ui-page] body .billing-status-button-next {
    white-space: nowrap;
}
html[data-ui-page] body .billing-status-button-next > span:last-child {
    white-space: nowrap;
}
/* BSS 1004 / LF 854 (2026-11-19, billing label fits): a long label ("Awaiting billing" and a customer) ends in "..." inside the Billing column
   instead of running past the table; the whole text is in the tip a tap opens. */
html[data-ui-page] body .columns-table4612 .billing-status-button-next {
    min-width: 0;
    max-width: 100%;
}
/* BSS 1006 / LF 856 (2026-11-20, page check rerun): in the Transaction log a date longer than its column ("Nov 20 · 12:57 AM") wraps after the dot
   instead of being cut; table-columns.js sizes the column to fit it first */
html[data-ui-page] body #transaction-log31 td.ui-date {
    white-space: normal;
}
html[data-ui-page] body .columns-table4612 .billing-status-button-next > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
html[data-ui-page] body .ui-zero-dot::before, html[data-ui-page] body .ui-zero-dot::after {
    background: var(--u-muted);
    border-color: var(--u-muted);
    color: var(--u-muted);
}
html[data-ui-page] body .ui-zero-dot {
    color: var(--u-muted);
}
html[data-ui-page] body td {
    word-break: normal;
}
html[data-ui-page] body .log-person-next {
    white-space: nowrap;
}
html[data-ui-page] body nav.nav31 a svg, html[data-ui-page] body nav.nav31 a svg * {
    color: var(--nav-icon);
    stroke: var(--nav-icon);
}
html[data-ui-page] body nav.nav31 a svg [fill]:not([fill="none"]) {
    fill: currentColor;
}
html[data-ui-page] body button.navigation-edit-next {
    margin-top: 8px;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 13px;
    border-radius: 8px;
    position: static;
    inset: auto;
}
html[data-ui-page] body dialog:is( .dialog31, .lf-dialog, .themed-dialog-next, .bss-dialog93, .bss-dialog95, .dialog101, .new-ticket79, .row-dialog140, .dialog163, .bss-inventory-dialog95, #confirm-dialog, #file-prompt, #movement-details, #shortcuts-dialog, #modal):not(.account-menu32):not(.calendar31 ) {
    color: var(--u-text);
    border: 0;
    border-top: 3px solid var(--u-primary);
    border-radius: 14px;
    box-shadow: var(--u-shadow);
    padding: 20px;
    max-width: min(calc(100vw - 32px), var(--ui-dialog-max, 640px));
}
html[data-ui-page] body dialog.ui-dialog :is(.ui-dialog-title) {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    margin: 0 44px 12px 0;
    /* LF 520 / BSS 631: title to text 12 px, as in the approved popup */
    padding: 0;
    color: var(--u-text);
}
html[data-ui-page] body dialog.ui-dialog .dialog-heading31 {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    min-height: 0;
}
html[data-ui-page] body dialog.ui-dialog .dialog-heading31 .ui-dialog-title {
    margin: 0 44px 0 0;
}
html[data-ui-page] body dialog.ui-dialog .ui-dialog-close {
    position: absolute;
    top: 12px;
    /* LF 528 / BSS 641 (2026-11-01, full-size close X): the 26 px X spans the title's capitals, top to baseline, as in Gmail */
    right: 10px;
    /* LF 520 / BSS 631: with the 20 px edge */
    width: 40px;
    height: 40px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
html[data-ui-page] body dialog#movement-details.ui-dialog .ui-dialog-close {
    top: 14px;
}
html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin: 20px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
}
html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions > :is(button, a.button) {
    min-height: 40px;
    border-radius: 8px;
    font-size: 14px;
    margin: 0;
}
html[data-ui-page] body dialog.ui-dialog .ui-dialog-actions > button:not(.primary):not(.ui-danger) {
    border: 1px solid var(--u-line-strong);
}
html[data-ui-page] body dialog.ui-dialog p {
    font-size: 14px;
    line-height: 1.5;
}
html[data-ui-page] body dialog.ui-dialog label:not(.check29):not(.switch):not(:has(> input[type=checkbox])):not(:has(> input[type=radio])) {
    font-size: 13px;
    font-weight: 600;
    color: var(--u-text);
    letter-spacing: 0;
}
html[data-ui-page] body dialog.ui-dialog :is( input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]), textarea, select:not(.native44) ) {
    color: var(--u-text);
    border-radius: 8px;
    font-weight: 400;
}
html[data-ui-page] body dialog.ui-dialog :is( input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]), select:not(.native44) ) {
    min-height: 40px;
    padding: 8px 12px;
}
html[data-ui-page] body dialog.ui-dialog textarea {
    padding: 10px 12px;
}
html[data-ui-page] body dialog.ui-dialog :is(input, textarea, select):focus-visible {
    outline: 2px solid var(--u-focus);
    outline-offset: 1px;
}
html[data-ui-page] body dialog.ui-dialog button.select44 {
    min-height: 40px;
    border-radius: 8px;
}
html[data-ui-page] body select:not(.native44):not([multiple]):not([size]) {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--u-input);
    color: var(--u-text);
    border: 1px solid var(--u-line-strong);
    border-radius: 8px;
    padding: 8px 34px 8px 12px;
    min-height: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23889099' stroke-width='2' st\
roke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}
html[data-ui-page] body .ui-save-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}
html[data-ui-page] body :is(header.auth-header79, header.customer-header74, .welcome76 header) nav button:only-of-type, html[data-ui-page] body .ui-theme-button {
    font-size: 0;
    width: 40px;
    height: 40px;
    /* LF 585 / BSS 703 (2026-11-03, theme icon centred): "BSS moon is not centered": as a grid the hidden ◐ glyph took a
           second row (29 px + 9 px), so the drawn sun or moon sat 4.5 px high; a flex row has no row for it */
    display: flex;
    /* the rule above it and sign-in.css force these on buttons */
    align-items: center;
    /* the rule above it and sign-in.css force these on buttons */
    justify-content: center;
    /* the rule above it and sign-in.css force these on buttons */
    padding: 0;
    /* the rule above it and sign-in.css force these on buttons */
    line-height: 0;
    /* the rule above it and sign-in.css force these on buttons */
    border-radius: 50%;
    border: 1px solid var(--u-line);
    cursor: pointer;
}
html[data-ui-page] body :is(button, a, [role=button], summary):focus-visible {
    outline: 2px solid var(--u-focus);
    outline-offset: 2px;
}
html[data-ui-page] body .toolbar:has(> button[aria-pressed]):not(dialog .toolbar) {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--u-line);
    border-radius: 10px;
    background: var(--u-hover);
    width: auto;
}
html[data-ui-page] body .toolbar:not(dialog .toolbar) > button[aria-pressed] {
    min-height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--u-muted);
    font-weight: 600;
    box-shadow: none;
}
html[data-ui-page] body .toolbar:not(dialog .toolbar) > button[aria-pressed="true"] {
    background: var(--u-card);
    color: var(--u-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
html[data-ui-page] body .ui-empty {
    padding: 40px 16px;
}
html[data-ui-page] body button.select44 {
    justify-content: flex-start;
    column-gap: 10px;
}
@media (pointer: coarse) {
    html[data-ui-page] body button.sort31, html[data-ui-page] body .person-button {
        padding-top: 8px;
        padding-bottom: 8px;
        margin-top: -8px;
        margin-bottom: -8px;
    }
}

/* LF 819 / BSS 969 (2026-11-18): one drawn ⓘ on every page. Each screen drew its own (a letter i in a 1 px ring, some in a
   slanted serif), so rings looked thin and oval and the i sat off centre. Every ⓘ now shows the same picture as the Proposals
   builder's ⓘ (circle r 9.5, line and dot, 1.8 stroke on a 24 grid), drawn by ::before, 18 px, centred in the button whatever
   its size, in one grey that turns to the text colour on hover or while open (as the builder's does). The old letter or picture stays in the page for screen readers but is not painted.
   ::after is the one 34 px tap area for all of them. The #pr241 entry only lifts this rule above the Engagements owner's id
   selectors. A new ⓘ maker adds its class to the list (or uses one of these classes). */
@layer app {
    html[data-ui-page] body :is(.pm-info, .ip-place-tip, .rebuild-info, .two-sites-info, .esig-info, .cpa-info, .updates-info,
            .vfixinfo, .billing-account-help496, .stripe-info, .alarm-help, .am-info, .alarm-info, .fi-info, .info-scan,
            .help-scan, .help31, #pr241 #plist .esd-info) {
        position: relative; box-sizing: border-box; flex: none; min-width: 18px; min-height: 18px; border: 0; overflow: visible;
        color: var(--u-muted, var(--muted, #6b6f76)); opacity: 1; -webkit-text-fill-color: transparent; cursor: pointer;
    }
    html[data-ui-page] body :is(.pm-info, .ip-place-tip, .rebuild-info, .two-sites-info, .esig-info, .cpa-info, .updates-info,
            .vfixinfo, .billing-account-help496, .stripe-info, .alarm-help, .am-info, .alarm-info, .fi-info, .info-scan,
            .help-scan, .help31, #pr241 #plist .esd-info):is(:hover, :focus-visible, [aria-expanded="true"], .open) {
        color: var(--u-text, var(--ink, currentColor));
    }
    html[data-ui-page] body :is(.pm-info, .ip-place-tip, .rebuild-info, .two-sites-info, .esig-info, .cpa-info, .updates-info,
            .vfixinfo, .billing-account-help496, .stripe-info, .alarm-help, .am-info, .alarm-info, .fi-info, .info-scan,
            .help-scan, .help31, #pr241 #plist .esd-info) > svg { visibility: hidden; }
    html[data-ui-page] body :is(.pm-info, .ip-place-tip, .rebuild-info, .two-sites-info, .esig-info, .cpa-info, .updates-info,
            .vfixinfo, .billing-account-help496, .stripe-info, .alarm-help, .am-info, .alarm-info, .fi-info, .info-scan,
            .help-scan, .help31, #pr241 #plist .esd-info)::before {
        content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
        background: currentColor; pointer-events: none;
        -webkit-mask: var(--info-icon) center / 18px 18px no-repeat; mask: var(--info-icon) center / 18px 18px no-repeat;
    }
    html[data-ui-page] body :is(.pm-info, .ip-place-tip, .rebuild-info, .two-sites-info, .esig-info, .cpa-info, .updates-info,
            .vfixinfo, .billing-account-help496, .stripe-info, .alarm-help, .am-info, .alarm-info, .fi-info, .info-scan,
            .help-scan, .help31, #pr241 #plist .esd-info)::after { content: ""; position: absolute; inset: -8px; }
    html[data-ui-page] { --info-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 11v5.5M12 7.6v.1'/%3E%3C/svg%3E"); }
}
