/* =====================================================================================================
   mobile.css: the phone (<= 767px) and tablet (768-1023px) layer for every app shell: Practice, Suite, Books, Audit.
   Loaded LAST by each layout (after night.css), so it only has to win on layout, never on colour.
   Owner rules: white + navy + red, bordered buttons, no gradients or glows, nothing smaller than 12px.
   The ribbon / appbar files belong to the shell session; this sheet only overrides them at narrow widths.
   Companion: public/assets/js/mobile.js (ribbon folds to its tab row on a phone, app switch in the user menu,
   keyboard hints on inputs). Checked at 390 x 844 and 768 x 1024 (scrollWidth must equal the viewport).
   ===================================================================================================== */

/* ── 0. Everywhere narrow: no sideways page scroll, media never wider than the screen ─────────────────── */
@media (max-width: 1023.98px) {
    img, svg, video, canvas, iframe { max-width: 100%; }
    pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }

    /* tables: a scroll box with the first column pinned, so a wide register reads like a sheet */
    .table-responsive, .lv-wrap, .tbl-wrap, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; max-width: 100%; }
    .table-responsive > table th:first-child, .table-responsive > table td:first-child,
    .lv-wrap > table th:first-child, .lv-wrap > table td:first-child,
    .tbl-wrap > table th:first-child, .tbl-wrap > table td:first-child,
    .table-wrap > table th:first-child, .table-wrap > table td:first-child {
        position: sticky; left: 0; z-index: 1; background: var(--surface, #fff);
        box-shadow: inset -1px 0 0 var(--border, #e4e7ec) !important;
    }
    .table-responsive > table thead th:first-child, .lv-wrap > table thead th:first-child,
    .tbl-wrap > table thead th:first-child, .table-wrap > table thead th:first-child { z-index: 2; background: var(--surface-2, #f9fafb); }

    /* registers: the desktop's 9.5-11.5px table print goes up to the 12px floor */
    html body .kq-main table th, html body .kq-main table td.mono, html body .kq-main table td.faint, html body .kq-main table .tcm-index,
    html body .kq-main .badge, html body .kq-main .mm-sup, html body .kq-main span.count, html body .kq-main .lv-st,
    html body .kq-main .cl-code, html body .ob-ribbon .r-label, html body .ob-ribbon .och-mod { font-size: 12px !important; }
    /* client record print (rail counts, fact labels, id chips, small buttons) on phones and tablets */
    html body.tcs-on .kq-main .obk .clx-rail-i .n, html body.tcs-on .kq-main .obk .ob-facts dt, html body.tcs-on .kq-main .obk .ob-tab .n,
    html body .kq-main .rec-node .s, html body .kq-main .rec-chip .k, html body .kq-main .rec-chip .v, html body .kq-main .rh-eyebrow,
    html body .kq-main .btn-sm, html body .kq-main .sb-num, html body .pr-appbar .avatar { font-size: 12px !important; }
    html body .kq-main a.cl-fig { display: inline-block; padding: 6px 0; }

    /* a register whose first column is the row checkbox: pin the checkbox (40px) and the name column beside it */
    html body .kq-main table:has(> thead > tr > th:first-child input[type="checkbox"]) > * > tr > :first-child { width: 40px; min-width: 40px; max-width: 40px; }
    html body .table-responsive > table:has(> thead > tr > th:first-child input[type="checkbox"]) > * > tr > :nth-child(2),
    html body .lv-wrap > table:has(> thead > tr > th:first-child input[type="checkbox"]) > * > tr > :nth-child(2),
    html body .tbl-wrap > table:has(> thead > tr > th:first-child input[type="checkbox"]) > * > tr > :nth-child(2),
    html body .table-wrap > table:has(> thead > tr > th:first-child input[type="checkbox"]) > * > tr > :nth-child(2) {
        position: sticky; left: 40px; z-index: 1; background: var(--surface, #fff); box-shadow: inset -1px 0 0 var(--border, #e4e7ec) !important;
    }
    /* list-view registers (.lv-tbl) turn into cards on a phone: no pinned cells there */
    @media (max-width: 767.98px) {
        html body .kq-main table.lv-tbl > * > tr > th, html body .kq-main table.lv-tbl > * > tr > td {
            position: static !important; left: auto !important; width: auto; min-width: 0; max-width: none; background: transparent; box-shadow: none !important;
        }
    }

    /* a workspace's side list (Buckets / Category) turns into a chip row at this width: chips keep their own height
       instead of stretching to the page's (the document checklist drew 370px-tall chips) */
    @media (max-width: 1000px) {
        html body .kq-main .obk .ws { align-content: start; grid-auto-rows: auto; }
        html body .kq-main .obk .ws > .ws-nav { align-items: center; align-self: start; height: auto !important; min-height: 0 !important; max-height: none !important; }
        html body .kq-main .obk .ws > .ws-nav > a { align-self: center; flex: 0 0 auto; min-height: 40px; }
        /* the Documents section tree rides at the end of that chip row as a 360px-tall block; in chip mode it goes
           (the ribbon's Documents tab has the same links); on a page whose side list is only that tree it stays */
        html body .kq-main .obk .ws > .ws-nav:has(> a) > .dx-nav { display: none; }
    }

    /* dialogs fit the screen */
    dialog, .modal-dialog { max-width: calc(100vw - 16px) !important; }
    dialog.tc-dlg, dialog { max-height: calc(100dvh - 32px); }
    .modal-dialog { margin: 8px auto !important; }
    .modal-content { max-height: calc(100dvh - 16px); overflow: auto; }
    .dropdown-menu { max-width: calc(100vw - 16px); }
}

/* ── 1. Phone shell (<= 767px) ─────────────────────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* safety net: a phone page never scrolls sideways (wide registers scroll inside their own box). Tablets keep normal
       overflow, every checked page already fits 768px without it */
    html, body { max-width: 100%; overflow-x: clip; }

    /* appbar: one row, every control a 40px square tap target (44px hit area with the 2px gaps) */
    html body .pr-appbar { gap: 2px; padding: 0 6px 0 10px; }
    html body .pr-appbar .actions { gap: 2px; }
    html body .pr-appbar .ab-btn,
    html body .pr-appbar .pr-search-btn,
    html body .pr-appbar .tc-nv-btn { width: 40px; height: 40px; min-width: 40px; border-radius: 10px; }
    html body .pr-appbar .year-pill, html body .pr-appbar .tc-ps-btn { min-width: 40px; height: 40px; }
    html body .pr-appbar .user-chip { min-width: 40px; height: 40px; justify-content: center; }
    html body .pr-appbar .brand { display: inline-flex; align-items: center; min-height: 44px; padding-right: 4px; }
    html body .pr-appbar .avatar { font-size: 12px; }
    html body .tb-badge, html body .pr-count { font-size: 12px; }

    /* Suite / Audit appbar (layouts/suite.blade.php, app.css .appbar): its seven controls ran 137px past a 390px screen.
       Phone keeps logo, app switch (icons), search (icon), period, bell, avatar; help, night view and the crumbs go
       (help = the "?" key, night view = My account). */
    html body .appbar { gap: 4px; padding-left: 10px; padding-right: 6px; }
    html body .appbar .brand-logo { height: 16px; width: auto; }
    html body .appbar > .divider, html body .appbar > .crumbs, html body .appbar .gsearch .kbd,
    html body .appbar .actions > .ab-btn[title="Help"], html body .appbar .actions > .tc-nv { display: none !important; }
    html body .appbar .gsearch { flex: 0 0 40px !important; width: 40px; min-width: 0 !important; max-width: 40px; height: 40px; padding: 0 !important; justify-content: center; overflow: hidden; }
    html body .appbar .gsearch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
    html body .appbar .app-switch { flex: none; padding: 2px; }
    html body .appbar .app-switch .asw-item { width: 34px; min-width: 34px; height: 36px; padding: 0 !important; justify-content: center; }
    html body .appbar .app-switch .asw-item span { display: none; }
    html body .appbar .actions { gap: 2px; margin-left: auto; }
    html body .appbar .actions .ab-btn { width: 40px; height: 40px; }
    html body .appbar .year-pill { height: 40px; padding: 0 8px; }
    html body .appbar .year-pill .lbl { display: none; }
    html body .appbar .user-chip { padding: 2px; }
    html body .appbar .user-chip > div:not(.avatar) { display: none; }

    /* Suite / Audit page bodies (body.ob-shell): the same 12px floor, no keyboard hints on a touch screen */
    html body.ob-shell .sw-desc, html body.ob-shell .fig, html body.ob-shell .sb-pin, html body.ob-shell .badge,
    html body.ob-shell .lbl, html body.ob-shell .ob-ribbon .r-label { font-size: 12px !important; }
    html body.ob-shell main .kbd, html body.ob-shell main .kbd-sm, html body.ob-shell main kbd { display: none; }
    /* the client / company picker (suite/picker.css) sized itself to its widest row and ran 6px off the screen */
    html body .pk { min-width: 0; max-width: 100%; }
    html body .pk .table-wrap, html body .pk table { max-width: 100%; }
    html body .pk table { table-layout: fixed; width: 100%; }
    html body .pk td, html body .pk th { overflow-wrap: anywhere; }
    html body .pk-code, html body .pk-av { font-size: 12px !important; }

    /* user menu: full width sheet under the appbar, 44px rows */
    html body .pr-appbar .pr-user-menu { width: min(320px, calc(100vw - 16px)) !important; }
    html body .pr-appbar .pr-user-menu .dropdown-item { min-height: 44px; display: flex; align-items: center; gap: 10px; font-size: 14px; }

    /* app switch copied into the user menu by mobile.js (the appbar's own switch is hidden below 480px) */
    .mb-apps { display: none; }
    .mb-apps-on .mb-apps { display: block; padding: 8px 12px 10px; border-bottom: 1px solid var(--border, #e4e7ec); }
    .mb-apps-t { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted, #667085); }
    .mb-apps .app-switch { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 !important; margin: 0; background: none !important; border: 0 !important; }
    .mb-apps .app-switch a, .mb-apps .app-switch button {
        display: flex !important; align-items: center; justify-content: center; height: 44px !important; padding: 0 8px !important;
        border: 1px solid var(--border-2, #d0d5dd) !important; border-radius: 10px !important; background: var(--surface, #fff) !important;
        color: var(--text, #182230) !important; font-size: 14px !important; font-weight: 600; text-decoration: none !important; gap: 6px;
    }
    .mb-apps .app-switch a span { display: inline !important; }
    .mb-apps .app-switch a.asw-on, .mb-apps .app-switch a[aria-current="page"] {
        border-color: var(--tc-navy, #0b1f3a) !important; background: var(--tc-navy, #0b1f3a) !important; color: #fff !important;
    }
    .mb-apps .app-switch .kbd, .mb-apps .app-switch kbd, .mb-apps .app-switch .tk { display: none !important; }

    /* ribbon: tab strip = 44px tap targets, scrolls sideways; mobile.js folds the panes so only the tab row is pinned,
       a tab tap drops its pane down over the page (office-b.js "peek") */
    html body .ob-ribbon > .tabs { padding: 0 6px; scroll-snap-type: x proximity; scroll-padding: 0 6px; }
    html body .ob-ribbon .tabs .tab { min-height: 44px; padding: 10px 14px; font-size: 14px; scroll-snap-align: start; }
    html body .ob-ribbon .tabs .tab.active { margin-top: 0; }
    html body .ob-ribbon .ob-collapse { display: none; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active {
        flex-wrap: wrap; align-content: flex-start; row-gap: 8px; max-height: calc(100dvh - 56px - 44px - 72px); overflow-y: auto; overflow-x: hidden;
        scrollbar-width: none; overscroll-behavior: contain;
        padding: 8px 8px 12px; border-bottom: 2px solid var(--tc-navy, #0b1f3a); background: var(--surface, #fff);
    }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active::-webkit-scrollbar { display: none; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active > * { flex: 1 1 100%; max-width: 100%; }
    /* the dropped pane reads as a menu: group name on top, its buttons in a two-column grid of bordered 44px rows */
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rgroup { flex-direction: column; padding: 4px 4px 10px; border-right: 0; border-bottom: 1px solid var(--border, #e4e7ec); }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rgroup:last-child { border-bottom: 0; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rgroup .r-label { order: -1; padding: 0 2px 6px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted, #667085); }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rgroup .r-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn-stack { display: contents; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn,
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn-sm {
        position: relative; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px;
        width: auto; min-width: 0; height: auto; min-height: 44px; padding: 6px 10px; margin: 0;
        border: 1px solid var(--border, #e4e7ec); border-radius: 10px; background: var(--surface, #fff);
        font-size: 13px; line-height: 1.25; text-align: left; white-space: normal;
    }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn br { display: none; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn.active,
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn-sm.active { border-color: var(--brand-600, #1d4ed8); }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn.active::after { display: none; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn svg { width: 18px; height: 18px; }
    html body .ob-ribbon.collapsed.peek .ribbon-body.active .rbtn .rb-pip { position: static; margin-left: auto; }
    html body .ob-ribbon .ribbon-body { scroll-snap-type: x proximity; }
    html body .ob-ribbon .ribbon-body .rb-lbl, html body .ob-ribbon .ribbon-body .lbl, html body .ob-ribbon .r-label,
    html body .ob-ribbon .ribbon-body .group-label { font-size: 12px; }
    html body .ob-ribbon .rb-n, html body .ob-ribbon .rb-pip { font-size: 12px; min-width: 18px; }

    /* step bar: numbers only stay tappable, the current step keeps its label */
    html body .sb { overflow-x: auto; scrollbar-width: none; }
    html body .sb::-webkit-scrollbar { display: none; }
    html body .sb .sb-link { min-height: 44px; min-width: 32px; padding: 3px 2px; justify-content: center; }
    html body .sb .sb-list { overflow-x: auto; scrollbar-width: none; }
    html body .sb .sb-list::-webkit-scrollbar { display: none; }
    html body .sb .sb-step + .sb-step::before { flex-basis: 8px; margin: 0 2px; }
    html body .sb .sb-num { font-size: 12px; }
    html body .sb .sb-current { flex: none; }
    html body .sb .sb-current .sb-label { overflow: visible; text-overflow: clip; max-width: none; }
    html body .sb .sb-next { min-height: 40px; }
    html body .sb .sb-k, html body .sb .sb-f, html body .sb .sb-lh { font-size: 12px; }

    /* bottom tab bar labels */
    html body .tcm-tab-l { font-size: 12px; }

    /* ── page bodies ── */
    html body .kq-main.tc-page { padding-left: 12px !important; padding-right: 12px !important; }

    /* forms: one column, labels above, full-width inputs, 16px text so iOS never zooms */
    html body .kq-main .form-grid, html body .kq-main .fs-body.fs-2col, html body .kq-main .fg-2, html body .kq-main .fg-3, html body .kq-main .fg-4 { grid-template-columns: minmax(0, 1fr) !important; }
    /* a field with an inline "grid-column: span 2" would otherwise open a second, 60px-wide implicit column */
    html body .kq-main .form-grid > *, html body .kq-main .fg-2 > *, html body .kq-main .fg-3 > *, html body .kq-main .fg-4 > * { grid-column: 1 / -1 !important; min-width: 0; }
    html body .kq-main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    html body .kq-main select, html body .kq-main textarea { max-width: 100%; font-size: 16px !important; min-height: 44px; }
    html body .kq-main .form-label, html body .kq-main label.form-label, html body .kq-main .fl { display: block; font-size: 13px; margin-bottom: 4px; }
    html body .kq-main .input-group { flex-wrap: nowrap; }
    html body .kq-main .input-group > .form-control { min-width: 0; }

    /* client form (80/20 split): tabs scroll sideways, the side card drops under the form, the save bar sticks to the bottom */
    html body .kq-main .cf-tabs { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity; }
    html body .kq-main .cf-tabs::-webkit-scrollbar { display: none; }
    html body .kq-main .cf-tabs .cf-tab { flex: 0 0 auto !important; min-width: auto !important; min-height: 44px; height: 44px !important; padding: 0 14px !important; white-space: nowrap; scroll-snap-align: start; font-size: 14px; }
    html body .kq-main .fs-layout { grid-template-columns: minmax(0, 1fr) !important; }
    html body .kq-main .fs-side { order: 2; }
    html body .kq-main .fs-side .fs-tick { min-height: 40px; font-size: 13px !important; }
    html body.tcs-on .kq-main .obk form[data-form-split] .cf-actions, html body .kq-main form .cf-actions { margin-left: 0 !important; margin-right: 0 !important; border-radius: 12px; border: 1px solid var(--border, #e4e7ec) !important; }
    html body .kq-main form .cf-actions .btn { flex: 1 1 0; min-height: 44px; justify-content: center; }

    /* page heads: actions wrap into an even grid, buttons 44px high */
    html body .kq-main .btn, html body .kq-main .tc-btn, html body .kq-main .ob-btn { min-height: 40px; }
    html body .kq-main .btn-sm { min-height: 36px; min-width: 36px; }
    html body .kq-main .lv-nm-s, html body .kq-main .lv-pill, html body .kq-main .lv-band-l, html body .kq-main .lv-bulk-n,
    html body .kq-main .fs-n, html body .kq-main .hint, html body .kq-main .form-text { font-size: 12px !important; }

    /* small print on lists / home cards: never under 12px */
    html body .kq-main .sw-desc, html body .kq-main .fig, html body .kq-main .when, html body .kq-main .r-label,
    html body .kq-main .lbl, html body .kq-main .text-xs, html body .kq-main .badge, html body .ob-facts dt,
    html body .ob-tab .n, html body .clx-rail-i .n, html body .kq-main .rec-node .s, html body .kq-main .rec-chip .k, html body .kq-main .rec-chip .v,
    html body .kq-main .rh-eyebrow,
    html body.tcs-on .kq-main .obk .clx-rail-i .n, html body.tcs-on .kq-main .obk .ob-facts dt, html body.tcs-on .kq-main .obk .ob-tab .n { font-size: 12px !important; }

    /* client list: status tabs on one sideways-scrolling row (they wrapped to four lines) */
    html body .kq-main .cl-tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    html body .kq-main .cl-tabs::-webkit-scrollbar { display: none; }
    html body .kq-main .cl-tabs > * { flex: none; }
    html body .kq-main .cl-tabs .cl-tab { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

    /* client record: the section tabs scroll sideways, each a 44px target */
    html body .kq-main .ob-tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
    html body .kq-main .ob-tabs::-webkit-scrollbar { display: none; }
    html body .kq-main .ob-tabs .ob-tab { flex: none; min-height: 44px; }
    html body .kq-main .rec-chip { min-height: 32px; }
    html body .kq-main .kbd, html body .kq-main .kbd-sm, html body .kq-main kbd, html body .kq-main .dcl-search-hint { display: none; }
    html body .kq-main .dcl-svc-code, html body .kq-main .dcl-svc-count, html body .kq-main .dcl-cat-count, html body .kq-main .dcl-gp-sub,
    html body .kq-main .dcl-cat-pill .cnt, html body .kq-main .ws-nav .count { font-size: 12px !important; }

    /* compliance calendar: the month grid hid every due date below 700px; each one comes back as a coloured dot
       (the day still opens its list below the grid) */
    html body .kq-main .obk .pb-cal-d { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 3px; }
    html body .kq-main .obk .pb-cal-d .pb-cal-n { flex: 0 0 100%; }
    html body .kq-main .obk .pb-cal-ev { display: block !important; width: 7px; height: 7px; padding: 0 !important; border: 0 !important; border-radius: 50%;
        background: var(--c) !important; font-size: 0 !important; overflow: hidden; }
    html body .kq-main .obk .pb-cal-ev.is-done { opacity: .45; }

    /* segmented switches (settings sections, Month / List): one row that scrolls, never squeezed labels under icons */
    html body .kq-main .seg { display: flex; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    html body .kq-main .seg::-webkit-scrollbar { display: none; }
    html body .kq-main .seg > a, html body .kq-main .seg > button, html body .kq-main .seg > label { flex: 1 0 auto; white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

    /* chip / filter rows scroll sideways instead of wrapping into five lines */
    html body .kq-main .ob-chips, html body .kq-main .cl-chips, html body .kq-main .lv-chips, html body .kq-main .seg-row {
        flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }

    /* dialogs: a bottom sheet */
    dialog.tc-dlg { width: calc(100vw - 16px) !important; margin: auto auto 8px; }
    dialog.tc-dlg .tc-dlg-foot .tc-btn { flex: 1 1 0; justify-content: center; min-height: 44px; }
    dialog.tc-dlg .tc-dlg-x { width: 40px; height: 40px; }
}

/* ── 1b. Below 900px the phone tab bar is the bottom chrome: a form's save bar sticks just above it, full width ── */
@media (max-width: 899.98px) {
    /* "overflow-x: hidden" on the page wrappers made them scroll boxes, so nothing inside could stick; clip cuts the
       same sideways overflow without that */
    html body .kq-shell, html body .kq-main, html body .kq-main > .obk, html body .kq-main .cf-page { overflow-x: clip !important; overflow-y: visible !important; }
    html body.tcs-on .kq-main .obk form[data-form-split] .cf-actions, html body .kq-main form .cf-actions {
        position: sticky !important; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 20; margin-top: 12px !important; margin-bottom: 0 !important; padding: 8px 12px !important;
        background: var(--surface, #fff) !important; border-top: 1px solid var(--border, #e4e7ec) !important; pointer-events: auto !important;
    }
    html body.tcs-on .kq-main .obk form[data-form-split] .cf-actions > div, html body.tcs-on .kq-main .obk form[data-form-split] .cf-actions > div > div,
    html body .kq-main form .cf-actions > div, html body .kq-main form .cf-actions > div > div {
        display: flex !important; gap: 8px; width: 100%; margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: none !important;
    }
    html body .kq-main form .cf-actions .btn { min-height: 44px; justify-content: center; box-shadow: none !important; }
    /* the kit's action bar (invoice / quote / receipt forms) stuck at the status-bar height, i.e. under the tab bar */
    html body.tcs-on .kq-main .obk .ob-actionbar { bottom: calc(60px + env(safe-area-inset-bottom)) !important; flex-wrap: wrap; row-gap: 6px; }
    html body.tcs-on .kq-main .obk .ob-actionbar .ab-state { flex: 1 1 100%; font-size: 12px; }
    html body.tcs-on .kq-main .obk .ob-actionbar .push { display: flex; gap: 8px; width: 100%; margin-left: 0; }
    html body.tcs-on .kq-main .obk .ob-actionbar .push > .btn, html body.tcs-on .kq-main .obk .ob-actionbar .push > a, html body.tcs-on .kq-main .obk .ob-actionbar .push > button { flex: 1 1 0; min-height: 44px; justify-content: center; }
}

/* ── 2. Tablet (768-1023px) ───────────────────────────────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023.98px) {
    html body .ob-ribbon .tabs .tab { min-height: 40px; padding: 9px 14px; font-size: 13.5px; }
    html body .ob-ribbon .ribbon-body .rb-lbl, html body .ob-ribbon .ribbon-body .lbl { font-size: 12px; }
    html body .pr-appbar .ab-btn { width: 40px; height: 40px; }
    html body .pr-appbar .app-switch .asw-item { min-width: 36px; height: 36px; justify-content: center; }
    html body .pr-appbar .year-pill, html body .pr-appbar .user-chip { height: 40px; }
    html body .ob-ribbon .ob-qat-btn, html body .ob-ribbon .ob-qat-more, html body .ob-ribbon .ob-collapse { min-width: 36px; height: 36px; }
    html body .ob-ribbon .rbtn-sm { min-height: 26px; }
    html body .tcm-tab-l { font-size: 12px; }
    html body .kq-main .fs-layout { grid-template-columns: minmax(0, 1fr) !important; }
    html body .kq-main .cf-tabs { flex-wrap: nowrap !important; overflow-x: auto !important; scrollbar-width: none; }
    html body .kq-main .cf-tabs .cf-tab { flex: 0 0 auto !important; min-width: auto !important; }
    html body .kq-main .sw-desc, html body .kq-main .fig, html body .kq-main .when, html body .kq-main .r-label,
    html body .kq-main .obk .pb-cal-ev { font-size: 12px !important; }
    html body .kq-main input:not([type="checkbox"]):not([type="radio"]), html body .kq-main select, html body .kq-main textarea { font-size: 15px; }
    /* Suite / Audit appbar ran 88px past a 768px screen: crumbs, help and the user's name go, search shrinks */
    html body .appbar > .divider, html body .appbar > .crumbs, html body .appbar .actions > .ab-btn[title="Help"],
    html body .appbar .user-chip > div:not(.avatar), html body .appbar .gsearch .kbd { display: none !important; }
    html body .appbar .gsearch { flex: 1 1 160px !important; min-width: 120px !important; }
    html body .appbar .actions .ab-btn { width: 40px; height: 40px; }
    html body .appbar .app-switch .asw-item { min-width: 36px; height: 36px; }
    /* step bar: seven squeezed labels read "S.." "T.."; the current one keeps its label, the rest show numbers (as on a phone) */
    html body .sb .sb-label { display: none; }
    html body .sb .sb-current .sb-label { display: inline; overflow: visible; text-overflow: clip; }
    html body .sb .sb-link { min-height: 40px; min-width: 36px; justify-content: center; }
}

/* ── 3. Sign-in pages (up to 860px, auth-signin.css's own break): form first, chart behind, clear of the keyboard ── */
/* the card sits first (auth-signin.css orders it under the logo), so the e-mail, password and Sign in button stay above
   an open keyboard; a focused field keeps 16px clear of the top when the browser scrolls it into view */
@media (max-width: 860px) {
    body.w9-auth .stage { min-height: 100dvh; }
    body.w9-auth .card input { font-size: 16px; scroll-margin-top: 16px; scroll-margin-bottom: 120px; }
    body.w9-auth .card .fld-row a, body.w9-auth .c-top nav a { min-height: 44px; display: inline-flex; align-items: center; }
}
/* tablet portrait: one 480px column in the middle instead of a full-width card */
@media (min-width: 600px) and (max-width: 860px) {
    body.w9-auth .stage > .center, body.w9-auth .stage > .c-left { align-self: center; width: 100%; max-width: 480px; margin-left: auto; margin-right: auto; }
}
/* a touch screen has no Enter key hint to read */
@media (hover: none) and (pointer: coarse) {
    body.w9-auth .card button .kbd, body.w9-auth .card button kbd { display: none; }
}
