/* The native-mobile shell — shared by every PPPHP surface (core/Mobile/NativeShell.php).
 *
 * Three jobs, in order of how much they matter on a real phone:
 *
 *   1. ONE top row. The console's top bar carries a hamburger, a brand lockup, a
 *      page title, a back link, each page's own action buttons, search, the bell,
 *      the theme picker and the account menu. On a desktop that is one tidy row;
 *      on a 430px phone it wrapped into three rows of unlabelled icons and ate a
 *      third of the screen. Here the bar keeps what a phone screen needs — where
 *      am I, how do I get out, what is new, who am I — and the page's own actions
 *      move into a sheet behind one button, with their labels finally visible.
 *
 *   2. A bottom tab bar, in the browser as well as the installed app. It is the
 *      one navigation pattern every phone user already knows, and hiding it until
 *      someone installs the app meant nobody ever saw a reason to install it.
 *
 *   3. Safe areas and the browser-isms. `viewport-fit=cover` plus a translucent
 *      status bar means the page owns the whole screen, including the strip behind
 *      the Dynamic Island and the home indicator, so every fixed edge pays the
 *      inset back. Then: no zoom-on-focus, no grey tap flash, no rubber-banding
 *      past the ends, no text the system silently enlarges in landscape.
 *
 * Nothing here applies on a desktop: every rule is inside a phone query or keyed
 * to env() insets, which are 0 on a device that has none.
 */

:root {
    --pp-safe-t: env(safe-area-inset-top, 0px);
    --pp-safe-r: env(safe-area-inset-right, 0px);
    --pp-safe-b: env(safe-area-inset-bottom, 0px);
    --pp-safe-l: env(safe-area-inset-left, 0px);
    --pp-tabbar-h: 0px;          /* the runtime sets this where the bar is shown */
}

/* ── the fixed top bar clears the island / status bar ──────────────────── */
.navbar-top.fixed-top {
    padding-top: calc(.25rem + var(--pp-safe-t));
    padding-left: calc(.5rem + var(--pp-safe-l));
    padding-right: calc(.5rem + var(--pp-safe-r));
}
/* NOTE: the bar's own padding-top already contains the inset, so --pp-navbar-h
   (which the runtime measures off the rendered bar) contains it too. Adding the
   inset again to the body is the classic double-count — on an iPhone that is
   ~59px of dead space above every page heading. The body pays the measured
   height and nothing more. */

/* Landscape on a notched phone puts the island at one side. */
@media (orientation: landscape) {
    .pp-rail, .offcanvas-start { padding-left: var(--pp-safe-l); }
}

/* Anything the page pins to the bottom owes the home indicator its space. */
.acct-ava { display: none; }   /* phone-only; the phone block turns it on */
.pp-bell-menu, .dropdown-menu, .offcanvas, .modal-content { padding-bottom: env(safe-area-inset-bottom, 0px); }
.offcanvas-body { padding-bottom: calc(1rem + var(--pp-safe-b)); }

/* Off by default; the phone query below turns each on. */
.pp-tabbar, .pp-navx-btn, .pp-sheet, .pp-install { display: none; }

@media (max-width: 991.98px) {

    /* ═════════ 1. the top bar, on one row ═════════ */
    .navbar-top.fixed-top {
        flex-wrap: nowrap;
        gap: .35rem;
        padding-bottom: .25rem;
        min-height: calc(52px + var(--pp-safe-t));
    }
    .navbar-top > div { min-width: 0; }
    .navbar-top > div:last-child { flex: 0 0 auto; gap: .15rem !important; }

    /* The page's own buttons leave the bar — they reappear, with labels, in the
       sheet behind the ⋯ button. Moving (not duplicating) the nodes keeps every
       handler, id and data- attribute the page bound to them. */
    .pp-navx { display: none; }
    .pp-navx-btn { display: inline-flex; }

    /* A phone needs the screen's name more than the product's logo — the logo is
       already on the home-screen icon and the browser tab. */
    /* Bootstrap's .d-flex utility is !important, so hiding these needs to be too. */
    .navbar-top .navbar-brand { display: none !important; }
    .navbar-top .pp-nb-sep { display: none !important; }
    .navbar-top .pp-nb-title {
        display: inline-flex !important;
        max-width: none; min-width: 0; font-size: 1.02rem; letter-spacing: -.01em;
    }
    .navbar-top .pp-nb-title i { font-size: .95rem; }
    /* …but a page with no title still needs to say where it is. */
    .navbar-top:not(:has(.pp-nb-title)) .navbar-brand { display: inline-flex !important; }
    .navbar-top .pp-nb-back { padding: .25rem .45rem; border-color: transparent; }

    /* Search collapses to its icon; the shortcut cheat-sheet is desktop furniture.
       SCOPED to the console: a generated app has a search trigger of its own
       with a different label class, and squashing the button without hiding
       that label left the words spilling out of a 38px circle. Its own layer
       (app-mobile.css) owns its search. */
    html[data-pp-surface="console"] .pp-cmdk-trigger-txt,
    html[data-pp-surface="console"] .pp-cmdk-kbd,
    html[data-pp-surface="console"] .pp-kbd-hint { display: none !important; }
    html[data-pp-surface="console"] .pp-cmdk-trigger {
        height: 38px; width: 38px; justify-content: center; padding: 0; border-radius: 12px;
    }

    /* The theme picker stays — people change theme on a phone more often than on
       a desktop, not less (daylight). It becomes a single round swatch that
       SHOWS the theme you are on, which is both the control and its own label. */
    /* `:root[data-pp-surface]` on every one of these, not for specificity
       theatre: app-theme.css styles the same control with single-class
       selectors, and WHICH of the two files loads second depends on the page
       (favicon.php emits this layer in <head>, console-navbar.php emits it in
       <body>). Ties then resolve differently on different pages — the toggle
       came out as a 38px desktop pill beside 40px icon buttons on exactly the
       pages that load favicon.php first. The attribute is set before first
       paint by the same script that ships this file, so it is always there. */
    :root[data-pp-surface] .pp-theme-toggle-chevron { display: none !important; }
    :root[data-pp-surface] .pp-theme-toggle {
        width: 40px; height: 40px; justify-content: center; gap: 0;
        padding: 0; border: 0; border-radius: 12px; background: transparent;
        min-height: 0;
    }
    :root[data-pp-surface] .pp-theme-toggle .pp-theme-toggle-icon {
        display: grid; place-items: center; width: 24px; height: 24px;
        border-radius: 50%; font-size: 13px;
        background: linear-gradient(135deg,
            color-mix(in srgb, var(--pp-accent, #5b54ec) 92%, #fff 8%),
            color-mix(in srgb, var(--pp-accent, #5b54ec) 45%, var(--pp-topbar-bg, #0b1020)));
        box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--pp-topbar-text, #fff) 28%, transparent);
        color: #fff;
    }

    /* …and its menu drops from the BAR, not off a 38px anchor: eleven theme
       cards do not belong hanging from an icon. Anchored to the toggle, the
       392px desktop card hangs ~30px off the left edge of a 430px screen.

       FIXED, deliberately — not absolute. An absolute panel is placed against
       whichever ancestor happens to be positioned, and that answer differs per
       page. The first attempt neutralised the picker's own positioning
       (`.pp-theme-picker { position: static }`) so the bar would be that
       ancestor, but app-theme.css's `.pp-theme-picker { position: relative }`
       is the SAME specificity: on every page that loads app-theme.css after
       this file (any page including favicon.php in its <head> — the Dashboard,
       for one) the panel was anchored to the 38px toggle again and rendered as
       a ~45px sliver running down the screen. Order-dependent, so it looked
       correct on half the console.

       The viewport is the one anchor every page agrees on. Nothing in the
       bar's chain creates a containing block for a fixed child: the Apple
       themes' blur sits on `.navbar-top::before` precisely so that menus
       inside the bar are not trapped by it. Height comes from the measured
       --pp-navbar-h (which already contains the status-bar inset). */
    html[data-pp-surface="console"] .pp-theme-picker .pp-theme-menu {
        position: fixed;
        top: calc(var(--pp-navbar-h, 56px) + 6px);
        left: calc(10px + var(--pp-safe-l)); right: calc(10px + var(--pp-safe-r));
        bottom: auto;
        width: auto; max-width: none; max-height: min(70vh, 560px);
        border-radius: 20px; box-shadow: 0 22px 54px rgba(2, 6, 23, .5);
        /* Eleven full-width preview cards is a scroll and a squint. Three
           across, swatch over name, is the whole set at a glance. */
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 8px; padding: 12px 12px 14px;
    }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-menu-head { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 2px; }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-chip { justify-content: center; height: 36px; border-radius: 11px; font-size: .78rem; }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-option {
        align-items: center; gap: 6px; padding: 7px 4px 8px; text-align: center;
    }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-swatch { height: 46px; border-radius: 12px; }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-option > span { display: block; width: 100%; }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-option strong {
        display: block; font-size: .72rem; line-height: 1.2;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-option small { display: none; }
    :root[data-pp-surface] .pp-theme-picker .pp-theme-option-check {
        position: absolute; top: 5px; right: 5px; width: 18px; height: 18px;
        display: grid; place-items: center; border-radius: 50%; font-size: 11px;
        background: var(--pp-accent); color: var(--pp-accent-contrast, #fff);
    }

    /* Touch targets: 44px is Apple's floor and the bar's icon buttons are under it. */
    .navbar-top .btn, .pp-bell-btn, .navbar-top .dropdown-toggle, .pp-navx-btn { min-width: 40px; min-height: 40px; }

    /* ONE size for every icon in the bar. Each control arrived here with its
       own box — the hamburger 40×44 at radius 6, search 38×38 with a border,
       the bell and the theme swatch 40×40 at radius 12 — and side by side at
       phone width that reads as a row that was never designed, which is
       exactly what it was. Stated once, on the surface marker so no later
       stylesheet can out-rank it, instead of per control. */
    :root[data-pp-surface] .navbar-top .pp-rail-toggle,
    :root[data-pp-surface] .navbar-top .pp-cmdk-trigger,
    :root[data-pp-surface] .navbar-top .pp-bell-btn,
    :root[data-pp-surface] .navbar-top .pp-theme-toggle,
    :root[data-pp-surface] .navbar-top .pp-navx-btn {
        width: 40px; height: 40px; min-width: 40px; min-height: 40px;
        padding: 0; border: 0; border-radius: 12px;
        display: inline-flex; align-items: center; justify-content: center;
    }

    /* ── the bar's own look ───────────────────────────────────────────────
       A phone bar is a row of ICONS, not a row of buttons. Five bordered
       pills side by side is what made this read as clutter: each one drew a
       box, and the boxes competed with the title and with each other. The
       chrome comes off, the icons get room, and only the thing you are
       touching lights up. */
    /* One language for the whole row. Before this the bar held four different
       ideas at once — bare glyphs for search and the bell, a dark tile for the
       menu, a muted circle for the theme and a bright disc for the account —
       and a row of controls that do not agree with each other is what reads as
       unfinished, however well each one is drawn. They are all the same tile
       now: a hint of the bar's own text colour, a hairline edge and a lit top,
       so they look pressed out of the bar rather than stuck onto it. */
    .navbar-top .btn-outline-light,
    .navbar-top .pp-cmdk-trigger,
    .navbar-top .pp-bell-btn,
    .navbar-top .pp-theme-toggle,
    .pp-navx-btn {
        border-color: transparent !important;
        background: color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 9%, transparent) !important;
        box-shadow:
            inset 0 0 0 1px color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 10%, transparent),
            inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent) !important;
        color: var(--pp-topbar-text, #e8ecf6);
    }
    .navbar-top .btn-outline-light:active,
    .navbar-top .pp-cmdk-trigger:active,
    .navbar-top .pp-bell-btn:active,
    .navbar-top .pp-theme-toggle:active,
    .pp-navx-btn:active {
        background: color-mix(in srgb, var(--pp-topbar-text, #fff) 14%, transparent) !important;
        transform: scale(.92);
    }
    .navbar-top > div:last-child > *,
    .navbar-top .pp-cmdk-trigger,
    .navbar-top .pp-bell-btn { border-radius: 12px; }

    /* ── The page-actions trigger ───────────────────────────────────────
       It costs NO vertical space. A chip on its own full-width row was ~80px
       of a 812px screen spent on one button, pushing the page's own heading
       and its numbers below the fold — on a page whose whole job is to show
       numbers. It is a 38px round icon button now, sitting at the top-right
       of the page's first block, level with the heading.

       Two placements, in order of preference:
         · a page that offers a slot ([data-pp-actions-slot]) gets it IN FLOW
           inside its own heading row, which is always the tidiest result;
         · every other page gets it absolutely positioned in the top-right
           corner of the page body, which costs nothing and needs no
           co-operation from the page. */
    .pp-navx-btn.pp-navx-inpage {
        display: inline-grid !important; place-items: center;
        width: 40px; height: 40px; min-width: 40px; min-height: 40px; margin: 0; padding: 0;
        border: 0; border-radius: 50%; flex: none;
        background: color-mix(in srgb, var(--pp-text, #e8ecf6) 9%, transparent) !important;
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pp-text, #e8ecf6) 13%, transparent) !important;
        color: var(--pp-text, #e8ecf6);
        transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), background-color .18s ease;
    }
    .pp-navx-btn.pp-navx-inpage i { font-size: 1.1rem; }
    .pp-navx-btn.pp-navx-inpage > span { display: none; }   /* the icon says it */
    .pp-navx-btn.pp-navx-inpage:active {
        transform: scale(.92);
        background: color-mix(in srgb, var(--pp-text, #e8ecf6) 18%, transparent) !important;
    }
    /* Out of flow, so the heading keeps the full width and nothing is pushed
       down. The host is made a positioning context by the script. */
    .pp-navx-row {
        position: absolute; top: 0; right: 0; z-index: 3;
        display: flex; justify-content: flex-end; margin: 0; pointer-events: none;
    }
    .pp-navx-row > * { pointer-events: auto; }
    .pp-has-navx { position: relative; }
    /* …and the first heading keeps clear of it, so a long title cannot run
       underneath the button.
       Anchored on the row itself, never on :first-child: the script inserts
       the row AS the host's first child, so every :first-child form stopped
       matching the moment the row existed and the reserve was silently never
       applied. The heading is the row's next sibling, or sits inside it. */
    .pp-navx-row + h1,
    .pp-navx-row + h2,
    .pp-navx-row + .head-row,
    .pp-navx-row + * > h1:first-child,
    .pp-navx-row + * > h2:first-child,
    .pp-navx-row + * > .head-row:first-child { padding-right: 46px; }
    /* In a page's own slot it is in flow and needs no reserve. */
    [data-pp-actions-slot] .pp-navx-btn.pp-navx-inpage { position: static; }

    /* ── A slot a page offers in its own heading ────────────────────────
       `.pp-actions-slot` is the one markup a page writes: an empty span,
       FIRST child of its heading (or of a hero row). One declaration block
       covers both contexts, because a page should not have to know which
       one it is:
         · in a block heading `float` wins — the button sits at the top
           right and the title wraps around it, so the reserve the corner
           placement needs is not needed here at all. It has to be the
           first child: a float cannot rise above a line box already laid
           out, so written last it would land on the title's LAST line;
         · in a flex heading or hero row `float` is ignored and `order`
           with `margin-left: auto` park it at the end instead.
       The heading becomes a block formatting context so it CONTAINS the
       float — a 40px button in a 29px heading otherwise hangs out of the
       bottom and lands on the description below it. */
    .pp-actions-slot { float: right; padding-left: .6rem; order: 1; margin-left: auto; }
    h1:has(> .pp-actions-slot),
    h2:has(> .pp-actions-slot) { display: flow-root; }
    .pp-navx-btn:not(.pp-navx-inpage) > span { display: none; }

    /* ── A page head's explanation, folded ──────────────────────────────
       Marked `data-pp-clamp` by the page; the shell adds the class on a
       phone and takes it away again above the breakpoint, so one attribute
       is the whole of what a page has to do. The More is a real sibling
       button — a clamped box clips its own ::after, so the affordance has to
       live outside it. */
    .pp-clamp {
        display: -webkit-box; -webkit-box-orient: vertical;
        -webkit-line-clamp: var(--pp-clamp, 2); overflow: hidden;
    }
    .pp-clamp.is-open { -webkit-line-clamp: unset; }
    .pp-clamp-more {
        display: inline-flex; align-items: center; gap: .22rem;
        margin: .2rem 0 0; padding: .25rem 0; border: 0; background: none;
        font: inherit; font-size: .76rem; font-weight: 700; line-height: 1;
        color: var(--pp-accent, #4f46e5); cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .pp-clamp-more i { font-size: .85rem; transition: transform .2s ease; }
    .pp-clamp-more[aria-expanded="true"] i { transform: rotate(180deg); }
    .pp-clamp-more:active { opacity: .6; }

    /* A back arrow in the bar is a seventh control that only some pages have,
       and a phone already goes back with an edge swipe and its own gesture. */
    :root[data-pp-surface] .navbar-top .pp-nb-back { display: none !important; }

    .pp-navx-btn {
        align-items: center; justify-content: center;
        width: 38px; height: 38px; padding: 0;
        border: 0; border-radius: 12px; font-size: 19px;
        -webkit-tap-highlight-color: transparent;
    }

    /* ═════════ 1b. the page behind an open bar menu ═════════
       A menu that drops out of the top bar on a phone is a modal thing: the
       page under it must stop competing for attention, and a tap anywhere on
       it must mean "close". Without this the bell's list, the theme panel and
       the account menu all floated over a fully lit, fully live page — you
       could read the rows behind them and tap straight through to a link.

       Deliberately BELOW the bar (z-index 1035 against the bar's 1040): the
       bar stays lit because that is where the control you just touched is,
       and only the content dims. The scrim never swallows the tap — clicks
       bubble to the document handlers each menu already uses to close. */
    /* One z-index for the bar on every console page. Pages set their own —
       the Dashboard says 1030, console-navbar.php says 1040 — and the scrim
       below sits between the two, so on exactly those pages the bar and its
       open menu were painted UNDER the dimmer and came out greyed. The bar is
       chrome; its stacking is not a per-page decision. */
    html[data-pp-surface="console"] .navbar-top { z-index: 1040 !important; }
    /* The GENERATED app has the same bar and had the same bug. BuildWriter
       writes `.pp-topbar { z-index: 1030 }`, one below the scrim, so opening
       the language picker or the account menu on a phone painted the dimmer
       OVER the bar — and over the menu, which is a child of the bar and can
       never climb out of its stacking context however high its own z-index
       is. The menu you had just opened came out blurred and unreadable. The
       console half of this was fixed on the line above; this is its twin. */
    .pp-topbar { z-index: 1040 !important; }
    .pp-scrim {
        position: fixed; inset: 0; z-index: 1035;
        background: rgba(2, 6, 23, .45);
        -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
        opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s;
    }
    .pp-scrim.on { opacity: 1; visibility: visible; }
    @media (prefers-reduced-motion: reduce) { .pp-scrim { transition: none; } }

    /* The bell's own panel stops at 767.98px, but this layer's phone treatment
       runs to 991.98 — so between the two it was a desktop dropdown hanging off
       an icon in a phone bar. It also anchored to a hard-coded 56px instead of
       the bar's MEASURED height, which is wrong on every page whose bar wraps
       or carries a safe-area inset. */
    :root[data-pp-surface] .pp-bell-menu {
        position: fixed;
        top: calc(var(--pp-navbar-h, 56px) + 6px);
        left: calc(6px + var(--pp-safe-l)); right: calc(6px + var(--pp-safe-r));
        width: auto; max-width: none; border-radius: 16px;
    }

    /* Menus that drop out of the bar are touched, not pointed at: 36px rows at
       13px are a mouse target. 44px is the floor a thumb hits reliably, and the
       panel widens so a label never has to be read in a 240px column. */
    /* `.navbar.navbar-top .dropdown-menu …` and the surface prefix, both on
       purpose: app-theme.css styles this same menu with THREE classes and
       several !importants, so a two-class rule here is simply ignored — which
       is how the first attempt at this left 36px rows untouched while looking
       perfectly correct in the file. */
    :root[data-pp-surface] .navbar.navbar-top .dropdown-menu {
        /* Use the room the screen actually has: a 300px card on a 393px
           phone leaves two empty margins and makes the labels look cramped. */
        min-width: min(360px, calc(100vw - 16px)) !important;
        max-width: calc(100vw - 16px);
        border-radius: 16px !important; padding: 6px !important;
        box-shadow: 0 18px 44px rgba(2, 6, 23, .45) !important;
    }
    :root[data-pp-surface] .navbar.navbar-top .dropdown-menu .dropdown-item {
        display: flex; align-items: center; gap: .6rem;
        min-height: 44px; padding: .5rem .65rem; border-radius: 11px;
        font-size: .9rem; white-space: normal;
    }
    :root[data-pp-surface] .navbar.navbar-top .dropdown-menu .dropdown-item i { font-size: 1.05rem; }

    /* ── the account menu, as a panel rather than a desktop dropdown ──────
       It spans the bar like the bell and the theme panel do, so the three
       things that drop out of the top bar behave as one family. */
    :root[data-pp-surface] .navbar.navbar-top .acct-menu {
        position: fixed !important;
        top: calc(var(--pp-navbar-h, 56px) + 6px) !important;
        /* Two thirds of the screen, hugging the control it belongs to. Full
           width made a nine-item menu look like a page you had been taken to,
           and left nothing of the page visible to tap your way out of. */
        left: auto !important;
        right: calc(8px + var(--pp-safe-r)) !important;
        /* min-width too, or the generic bar-dropdown rule above (360px) wins:
           min-width beats width whatever the order. */
        width: min(74vw, 330px) !important;
        min-width: min(74vw, 330px) !important;
        max-width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - var(--pp-navbar-h, 56px) - var(--pp-tabbar-h, 0px) - 18px);
        overflow-y: auto; -webkit-overflow-scrolling: touch;
        transform: none !important; inset-inline: auto;
    }
    /* Who this account is. Without it the menu is a list of actions belonging
       to nobody — and on a phone the bar has no room to show the name. */
    :root[data-pp-surface] .acct-menu .acct-who {
        display: flex; align-items: center; gap: .6rem;
        padding: .6rem .65rem .7rem; margin: -2px 0 .3rem;
        border-bottom: 1px solid color-mix(in srgb, var(--pp-text, #fff) 10%, transparent);
    }
    :root[data-pp-surface] .acct-menu .acct-who-ava {
        flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
        display: grid; place-items: center;
        font-size: 1.05rem; font-weight: 800; color: #fff;
        background:
            radial-gradient(90% 90% at 32% 24%, rgba(255, 255, 255, .3) 0%, rgba(255, 255, 255, 0) 60%),
            linear-gradient(160deg,
                color-mix(in srgb, var(--pp-accent, #5b54ec) 92%, #fff) 0%,
                var(--pp-accent, #5b54ec) 58%,
                color-mix(in srgb, var(--pp-accent, #5b54ec) 80%, #000) 100%);
        box-shadow:
            inset 0 1px 0 color-mix(in srgb, #fff 42%, transparent),
            0 2px 6px -1px rgba(2, 6, 23, .45);
    }
    :root[data-pp-surface] .acct-menu .acct-who-txt { min-width: 0; flex: 1; }
    :root[data-pp-surface] .acct-menu .acct-who-txt strong {
        display: block; font-size: .95rem; font-weight: 700; line-height: 1.2;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    :root[data-pp-surface] .acct-menu .acct-who-txt small {
        display: block; font-size: .76rem; opacity: .7;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    :root[data-pp-surface] .acct-menu .acct-who-role {
        flex: 0 0 auto; font-size: .66rem; font-weight: 800; letter-spacing: .06em;
        text-transform: uppercase; padding: .25rem .5rem; border-radius: 999px;
        color: var(--pp-accent, #5b54ec);
        background: color-mix(in srgb, var(--pp-accent, #5b54ec) 16%, transparent);
    }
    /* Section headers earn their space; bare dividers between fourteen rows do not. */
    :root[data-pp-surface] .acct-menu .dropdown-header {
        font-size: .66rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
        opacity: .65; padding: .65rem .75rem .25rem;
    }
    :root[data-pp-surface] .acct-menu .dropdown-divider { margin: .3rem .55rem; opacity: .5; }
    /* Leaving is the one destructive thing here, and it should not look like
       "Profile" with a different word in it. */
    :root[data-pp-surface] .acct-menu .acct-signout {
        margin-top: .15rem; color: var(--pp-danger, #f87171) !important;
        font-weight: 700;
    }
    :root[data-pp-surface] .acct-menu .acct-signout i { color: inherit !important; }
    :root[data-pp-surface] .acct-menu .acct-signout:active {
        background: color-mix(in srgb, var(--pp-danger, #f87171) 16%, transparent) !important;
    }
    :root[data-pp-surface] .navbar.navbar-top .dropdown-menu .dropdown-item:active { transform: scale(.985); }
    :root[data-pp-surface] .navbar.navbar-top .dropdown-menu .dropdown-header { padding: .5rem .7rem .3rem; font-size: .7rem; }
    :root[data-pp-surface] .navbar.navbar-top .dropdown-menu .dropdown-divider { margin: .3rem .2rem; }

    /* A live notification, while the app is open. Bottom-right over a desktop
       is right; on a phone it belongs across the screen, clear of the tab bar
       and the home indicator, at a size a thumb can dismiss. */
    .pp-bell-toasts {
        left: calc(10px + var(--pp-safe-l)); right: calc(10px + var(--pp-safe-r));
        bottom: calc(10px + var(--pp-tabbar-h, 0px) + var(--pp-safe-b));
        max-width: none; align-items: stretch;
    }
    .pp-bell-toast { padding: 13px 14px; border-radius: 16px; }
    .pp-bell-toast-title { font-size: 14px; }
    .pp-bell-toast-text { font-size: 13px; }

    /* The one-time offer to turn alerts on, in the installed app. Same shape as
       the install banner it replaces — bottom sheet-ish card, clear of the bar. */
    .pp-push-nudge {
        position: fixed; z-index: 1600;
        left: calc(10px + var(--pp-safe-l)); right: calc(10px + var(--pp-safe-r));
        bottom: calc(10px + var(--pp-tabbar-h, 0px) + var(--pp-safe-b));
        display: flex; align-items: center; gap: 12px;
        padding: 13px 12px 13px 14px; border-radius: 18px;
        background: var(--pp-surface-raised, #121a2e); color: var(--pp-text, #e8ecf6);
        border: 1px solid var(--pp-border, rgba(255,255,255,.12));
        box-shadow: 0 18px 44px rgba(2, 6, 23, .5);
        transform: translateY(140%); opacity: 0;
        transition: transform .3s cubic-bezier(.32,.72,0,1), opacity .3s ease;
    }
    .pp-push-nudge.in { transform: translateY(0); opacity: 1; }
    .pp-push-nudge > i { font-size: 1.25rem; color: var(--pp-accent, #6366f1); }
    .pp-push-nudge b { display: block; font-size: .92rem; font-weight: 700; }
    .pp-push-nudge span { display: block; font-size: .78rem; opacity: .75; line-height: 1.35; }
    .pp-push-nudge > div { flex: 1; min-width: 0; }
    .pp-push-nudge-yes {
        flex: 0 0 auto; min-height: 40px; padding: 0 .9rem; border: 0; border-radius: 12px;
        background: var(--pp-accent, #6366f1); color: var(--pp-accent-contrast, #fff);
        font: inherit; font-size: .86rem; font-weight: 700; cursor: pointer;
    }
    .pp-push-nudge-x {
        flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center;
        border: 0; border-radius: 12px; background: transparent;
        color: var(--pp-text-muted, #94a3b8); font-size: .95rem; cursor: pointer;
    }
    .pp-push-nudge-yes:active, .pp-push-nudge-x:active { transform: scale(.94); }
    @media (prefers-reduced-motion: reduce) { .pp-push-nudge { transition: none; } }

    /* ── the brand, while the next screen loads ─────────────────────────
       Everything here is in service of one thing: the tap registered, the app
       is working, and tapping again will not help. It only appears when a page
       is actually slow (the runtime waits 420ms), it dims what you were
       reading rather than replacing it, and it takes the taps so a double-tap
       cannot post a form twice. */
    /* ── the waiting card ────────────────────────────────────────────────
       The app's OWN icon, the size of a Home Screen tile, turning gently in
       real perspective inside two counter-rotating rings, with a highlight
       travelling across its face. The icon IS the object — no logo sitting
       inside a second box — which is how a phone shows an app opening.

       The rings live on the OVERLAY, not on the card: the card clips to the
       icon's rounded corners, and a ring inside it would be clipped away. */
    .pp-navload {
        position: fixed; inset: 0; z-index: 1700;
        display: grid; place-items: center;
        /* An aurora, not a flat wash: two soft clouds of the app's own accent
           drifting in opposite directions behind the blur, over the page's own
           ground. It is three gradients and one slow animation, and it is the
           difference between "a grey sheet appeared" and "the app is thinking". */
        background:
            radial-gradient(44% 34% at 32% 38%,
                color-mix(in srgb, var(--pp-accent, #6366f1) 34%, transparent) 0%,
                rgba(255, 255, 255, 0) 70%),
            radial-gradient(40% 30% at 70% 64%,
                color-mix(in srgb, var(--pp-accent, #6366f1) 22%, transparent) 0%,
                rgba(255, 255, 255, 0) 72%),
            color-mix(in srgb, var(--pp-app-bg, #0b1120) 70%, transparent);
        background-size: 180% 180%, 170% 170%, 100% 100%;
        background-position: 20% 25%, 80% 75%, 0 0;
        background-repeat: no-repeat;
        -webkit-backdrop-filter: blur(9px) saturate(140%); backdrop-filter: blur(9px) saturate(140%);
        /* An ANIMATION, not a transition, and no class to toggle: a page that
           is navigating has had its JavaScript frozen — no timers, and no
           requestAnimationFrame either — so anything that needs a script to
           run after the tap will never happen. A CSS animation starts the
           moment the element is rendered and runs on the compositor, delay
           and all. The 200ms delay is the grace period: a page that answers
           quickly is torn down before the fade begins, so nothing flashes. */
        opacity: 0;
        perspective: 760px;            /* real depth, so the turn below is a turn */
        animation:
            ppLoadIn .26s ease .2s forwards,
            ppLoadAurora 9s ease-in-out infinite alternate;
    }
    @keyframes ppLoadIn { from { opacity: 0; } to { opacity: 1; } }
    /* Work the page starts itself (an import, a long save) has no grace
       period — the tap already happened and nothing else will answer it. */
    .pp-navload.is-now { animation-delay: 0s; }
    /* Leaving: JS is alive by definition here, so a transition is fine. */
    .pp-navload.is-out { animation: none; opacity: 0; transition: opacity .2s ease; }
    .pp-navload::before, .pp-navload::after {
        content: ""; position: absolute; top: 50%; left: 50%;
        border-radius: 50%; border: 2px solid transparent; pointer-events: none;
    }
    /* bright, quick, clockwise */
    .pp-navload::after {
        width: 132px; height: 132px; margin: -66px 0 0 -66px;
        border-top-color: var(--pp-accent, #6366f1);
        border-right-color: color-mix(in srgb, var(--pp-accent, #6366f1) 35%, transparent);
        filter: drop-shadow(0 0 7px color-mix(in srgb, var(--pp-accent, #6366f1) 55%, transparent));
        animation: ppSpin 1.05s linear infinite;
    }
    /* faint, slow, the other way — the counter-rotation is what reads as 3D */
    .pp-navload::before {
        width: 152px; height: 152px; margin: -76px 0 0 -76px; border-width: 1.5px;
        border-bottom-color: color-mix(in srgb, var(--pp-accent, #6366f1) 42%, transparent);
        border-left-color: color-mix(in srgb, var(--pp-accent, #6366f1) 12%, transparent);
        animation: ppSpinBack 2.6s linear infinite;
    }
    .pp-navload-mark {
        position: relative; overflow: hidden;
        display: grid; place-items: center;
        width: 96px; height: 96px; border-radius: 24px;
        background: color-mix(in srgb, var(--pp-surface, #111827) 92%, #000);
        /* Six layers, one light source above-left: a lit top edge, a shaded
           bottom one, a hairline rim, a tight contact shadow, the deep cast
           shadow that lifts it off the page, and an accent bloom under it. */
        box-shadow:
            inset 0 1.5px 0 color-mix(in srgb, #fff 30%, transparent),
            inset 0 -1.5px 0 color-mix(in srgb, #000 26%, transparent),
            inset 0 0 0 1px color-mix(in srgb, var(--pp-text, #fff) 10%, transparent),
            0 2px 4px rgba(2, 6, 23, .3),
            0 20px 42px -16px rgba(2, 6, 23, .65),
            0 36px 64px -30px color-mix(in srgb, var(--pp-accent, #6366f1) 60%, transparent);
        transform-style: preserve-3d;
        /* The face catches the light as it turns: the tile darkens as it leans
           away and lifts as it comes back, on exactly the same 3.2s clock as
           the turn. That agreement between shape and brightness is most of
           what makes a flat rectangle read as a solid object — a turn without
           it looks like a picture being rotated. */
        animation:
            ppLoadTurn 3.2s cubic-bezier(.45, 0, .55, 1) infinite,
            ppLoadFace 3.2s cubic-bezier(.45, 0, .55, 1) infinite;
        will-change: transform, background-color, box-shadow;
    }
    /* The icon rides the same light. */
    .pp-navload-mark > * { animation: ppLoadLit 3.2s cubic-bezier(.45, 0, .55, 1) infinite; }
    /* The reflection on the surface it is floating over. Fades out before it
       reaches anything, so it reads as light rather than as a second object. */
    .pp-navload-mark::before {
        content: ""; position: absolute; left: 50%; bottom: -34px;
        width: 128px; height: 26px; margin-left: -64px; border-radius: 50%;
        background: radial-gradient(50% 50% at 50% 50%,
            color-mix(in srgb, var(--pp-accent, #6366f1) 42%, transparent) 0%,
            rgba(255, 255, 255, 0) 72%);
        filter: blur(5px); pointer-events: none;
        animation: ppLoadShadow 3.2s cubic-bezier(.45, 0, .55, 1) infinite;
    }
    /* The icon fills the tile. A wide lockup (a client logo) is contained
       instead of cropped, which is what object-fit decides per image. */
    .pp-navload-mark > * {
        width: 100%; height: 100%; display: block;
        object-fit: cover; border-radius: inherit;
    }
    .pp-navload-mark > svg { object-fit: contain; padding: 14px; }
    /* The travelling highlight, ON TOP of the icon. */
    .pp-navload-mark::after {
        content: ""; position: absolute; inset: 0; pointer-events: none;
        background: linear-gradient(115deg,
            rgba(255, 255, 255, 0) 38%,
            color-mix(in srgb, #fff 30%, transparent) 48%,
            rgba(255, 255, 255, 0) 58%);
        background-size: 260% 100%; background-repeat: no-repeat;
        animation: ppLoadSheen 2.8s ease-in-out infinite;
    }
    /* An app with no icon still gets a heartbeat rather than a blank tile. */
    /* An app with no icon: the tile itself becomes the spinner's subject. */
    .pp-navload-mark.is-dot { background: color-mix(in srgb, var(--pp-surface, #111827) 96%, var(--pp-accent, #6366f1)); }
    .pp-navload-mark.is-dot::after { animation-duration: 2.2s; }
    @keyframes ppSpinBack { to { transform: rotate(-360deg); } }
    /* A pendulum of about 13° each way with a breath riding on it: the tile
       turns as if held up to you, which a spin never looks like. */
    @keyframes ppLoadTurn {
        0%,  100% { transform: rotateY(-13deg) rotateX(5deg) translateY(0) scale(1); }
        50%       { transform: rotateY(13deg) rotateX(-4deg) translateY(-5px) scale(1.05); }
    }
    @keyframes ppLoadFace {
        0%, 100% {
            background-color: color-mix(in srgb, var(--pp-surface, #111827) 86%, #000);
            box-shadow:
                inset 0 1.5px 0 color-mix(in srgb, #fff 22%, transparent),
                inset 0 -1.5px 0 color-mix(in srgb, #000 30%, transparent),
                inset 0 0 0 1px color-mix(in srgb, var(--pp-text, #fff) 9%, transparent),
                0 2px 4px rgba(2, 6, 23, .32),
                0 20px 42px -16px rgba(2, 6, 23, .7),
                0 36px 64px -30px color-mix(in srgb, var(--pp-accent, #6366f1) 50%, transparent);
        }
        50% {
            background-color: color-mix(in srgb, var(--pp-surface, #111827) 88%, #fff);
            box-shadow:
                inset 0 1.5px 0 color-mix(in srgb, #fff 42%, transparent),
                inset 0 -1.5px 0 color-mix(in srgb, #000 20%, transparent),
                inset 0 0 0 1px color-mix(in srgb, var(--pp-text, #fff) 14%, transparent),
                0 2px 6px rgba(2, 6, 23, .26),
                0 26px 52px -18px rgba(2, 6, 23, .62),
                0 44px 74px -32px color-mix(in srgb, var(--pp-accent, #6366f1) 72%, transparent);
        }
    }
    @keyframes ppLoadLit {
        0%, 100% { filter: brightness(.92) saturate(1); }
        50%      { filter: brightness(1.1) saturate(1.12); }
    }
    @keyframes ppLoadAurora {
        0%   { background-position: 20% 25%, 80% 75%, 0 0; }
        100% { background-position: 46% 58%, 50% 36%, 0 0; }
    }
    /* The cast shadow tightens as the tile rises — the cue that sells height. */
    @keyframes ppLoadShadow {
        0%, 100% { transform: scale(1); opacity: .9; }
        50%      { transform: scale(.82); opacity: .6; }
    }
    @keyframes ppLoadSheen {
        0%        { background-position: 140% 0; }
        55%, 100% { background-position: -60% 0; }
    }
    @media (prefers-reduced-motion: reduce) {
        .pp-navload { transition: none; }
        .pp-navload, .pp-navload::before, .pp-navload::after,
        .pp-navload-mark, .pp-navload-mark > *,
        .pp-navload-mark::after, .pp-navload-mark::before,
        .pp-navload-mark.is-dot::before { animation: none; }
        .pp-navload::after { border-top-color: color-mix(in srgb, var(--pp-accent, #6366f1) 55%, transparent); }
    }

    /* The SAME treatment for a generated app's own bar. Its widgets are
       <details> elements with a `.pp-user-menu` panel, so the selectors differ
       while every decision is identical: a panel that spans the bar instead of
       hanging off a 38px icon, rows a thumb can hit, and the page behind it
       dimmed by the shared scrim. This is the whole point of the Mobile module
       — the console and the app it builds behave the same way on a phone. */
    :root[data-pp-surface] .pp-topbar details[open] > .pp-user-menu {
        position: fixed;
        top: calc(var(--pp-navbar-h, 56px) + 6px);
        left: calc(8px + var(--pp-safe-l)); right: calc(8px + var(--pp-safe-r));
        width: auto; min-width: 0; max-width: none;
        max-height: min(70vh, 560px); overflow-y: auto;
        border-radius: 16px; padding: 6px;
        box-shadow: 0 18px 44px rgba(2, 6, 23, .45);
        z-index: 1045;
    }
    :root[data-pp-surface] .pp-topbar details[open] > .pp-user-menu > a,
    :root[data-pp-surface] .pp-topbar details[open] > .pp-user-menu > button {
        min-height: 44px; padding: .55rem .7rem; border-radius: 11px; font-size: .92rem;
    }
    :root[data-pp-surface] .pp-topbar details[open] > .pp-user-menu > a:active { transform: scale(.985); }
    /* The notification panel keeps its own inner layout; only the frame moves. */
    :root[data-pp-surface] .pp-topbar details[open] > .pp-user-menu.pp-notif-menu { padding: 0; }

    /* ── keys a phone does not have ──────────────────────────────────────
       Every one of these advertises a keystroke: ⌘K in the dashboard's search
       bar, the Esc chip beside the palette's field, the palette's own footer
       of arrow/enter/esc hints, and "Press ? to open · Esc to close" under the
       help sheet. On a touch screen they are instructions for hardware that is
       not there, taking up the room the real controls need. The guides that
       DOCUMENT shortcuts keep their <kbd>s — only the chrome loses them. */
    :root[data-pp-surface] .cmdbar .kbd,
    :root[data-pp-surface] .pp-cmdk-kbd,
    :root[data-pp-surface] .pp-kbd-hint,
    :root[data-pp-surface] .pp-cmdk-foot,
    :root[data-pp-surface] #ppAskPanel .ppask-foot > span:first-child { display: none !important; }
    /* …which leaves the help sheet's footer holding one link; let it sit right. */
    :root[data-pp-surface] #ppAskPanel .ppask-foot { justify-content: flex-end; }

    /* ── the account button ──────────────────────────────────────────────
       The last control on the bar, and the one that carries identity, so it
       is the one thing up there that is allowed to look like an object: a
       round disc in the app's accent with a lit top edge, a hairline ring and
       a shadow under it. The caret goes — on a phone the disc is obviously
       tappable and the caret only steals width from the title. */
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle {
        display: inline-grid; place-items: center;
        /* 38px like its neighbours, and a DEEPER accent than the swatch beside
           it: a pale disc the size of a coin read as a sticker pressed onto
           the bar. One ring, one soft shadow, no gloss. */
        width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
        background:
            linear-gradient(165deg,
                color-mix(in srgb, var(--pp-accent, #5b54ec) 86%, #fff) 0%,
                var(--pp-accent, #5b54ec) 52%,
                color-mix(in srgb, var(--pp-accent, #5b54ec) 76%, #000) 100%);
        box-shadow:
            inset 0 1px 0 color-mix(in srgb, #fff 30%, transparent),
            0 0 0 1px color-mix(in srgb, var(--pp-topbar-text, #fff) 16%, transparent),
            0 2px 5px -1px rgba(2, 6, 23, .4);
        color: #fff;
        transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), box-shadow .18s ease;
    }
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle::after { display: none !important; }
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle > .position-relative {
        display: grid; place-items: center; width: 100%; height: 100%;
    }
    /* The glyph steps aside for the initial — see console-user-menu.php. */
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle .bi-person-circle { display: none !important; }
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle .acct-ava {
        display: grid; place-items: center; width: 100%; height: 100%;
        font-size: .9rem; font-weight: 700; letter-spacing: .01em; line-height: 1;
        color: var(--pp-accent-contrast, #fff); text-shadow: 0 1px 2px rgba(2, 6, 23, .4);
    }
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle .nav-username { display: none !important; }
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle:active {
        transform: scale(.92);
        box-shadow:
            inset 0 1px 0 color-mix(in srgb, #fff 28%, transparent),
            inset 0 2px 6px color-mix(in srgb, #000 28%, transparent),
            0 0 0 1px color-mix(in srgb, var(--pp-topbar-text, #fff) 22%, transparent);
    }
    /* …and while its menu is open it reads as pressed-in rather than raised. */
    :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle[aria-expanded="true"] {
        box-shadow:
            inset 0 2px 6px color-mix(in srgb, #000 30%, transparent),
            0 0 0 2px color-mix(in srgb, var(--pp-accent, #5b54ec) 55%, transparent);
    }
    @media (prefers-reduced-motion: reduce) {
        :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle { transition: none; }
        :root[data-pp-surface] .navbar-top .dropdown > .dropdown-toggle:active { transform: none; }
    }

    /* ── the menu button ─────────────────────────────────────────────────
       The first control on the bar, and the one most often pressed, so it
       earns a little weight the other icons do not have: a soft raised tile
       rather than a bare glyph. The bars are DRAWN, not set in the icon font
       — three gradients at exact sizes, so they are crisp at any density,
       evenly spaced, and the short middle bar gives the mark some character.
       Pressing it squares the bars up and dips the tile, which is the whole
       animation: small, instant, and over before you have let go.

       Three selectors because three surfaces spell it differently: the
       console's own bar, the Dashboard's hand-rolled copy, and a generated
       app's `.pp-burger`. */
    :root[data-pp-surface] .navbar-top .pp-rail-toggle,
    :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"],
    :root[data-pp-surface] .pp-topbar .pp-burger {
        /* EVERY declaration is !important, and that is deliberate. Three pages
           spell this button three different ways (`btn btn-dark me-2`,
           `btn btn-dark d-lg-none me-2`, `btn btn-dark border-0 px-2
           pp-rail-toggle`) and each page's own stylesheet lands after this one,
           so the cascade was handing out a different mark per page: measured at
           375px, /dashboard came out with the tile tint and display:flex,
           /projects with NO tint and radius 10, /visitors with 8px of side
           padding. One shell, one hamburger — a page may not have an opinion
           about it. (The alternative, normalising the markup in five views, is
           the same fix spread over five files that can drift again.) */
        position: relative !important; display: inline-grid !important; place-items: center !important;
        width: 38px !important; height: 38px !important; min-width: 38px !important; min-height: 38px !important;
        padding: 0 !important; border: 0 !important; border-radius: 12px !important;
        background: color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 9%, transparent) !important;
        box-shadow:
            inset 0 0 0 1px color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 10%, transparent),
            inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent) !important;
        color: var(--pp-topbar-text, #e8ecf6) !important;
        margin: 0 8px 0 0 !important;
        transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), background-color .18s ease;
    }
    :root[data-pp-surface] .navbar-top .pp-rail-toggle > i,
    :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"] > i,
    :root[data-pp-surface] .pp-topbar .pp-burger > i { display: none !important; }
    :root[data-pp-surface] .navbar-top .pp-rail-toggle::before,
    :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"]::before,
    :root[data-pp-surface] .pp-topbar .pp-burger::before {
        content: ""; width: 16px; height: 12px;
        background-image:
            linear-gradient(currentColor, currentColor),
            linear-gradient(currentColor, currentColor),
            linear-gradient(currentColor, currentColor);
        background-repeat: no-repeat;
        /* Three EVEN bars. The fashionable short third bar was left-aligned,
           which at 16px reads as a rendering fault rather than a decision. */
        background-size: 15px 2px, 15px 2px, 15px 2px;
        background-position: center top, center center, center bottom;
        transition: background-size .2s cubic-bezier(.34, 1.56, .64, 1),
                    opacity .2s ease;
    }
    :root[data-pp-surface] .navbar-top .pp-rail-toggle:active,
    :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"]:active,
    :root[data-pp-surface] .pp-topbar .pp-burger:active {
        transform: scale(.92);
        background: color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 20%, transparent);
    }
    /* Pressed: the bars draw together towards the middle one. */
    :root[data-pp-surface] .navbar-top .pp-rail-toggle:active::before,
    :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"]:active::before,
    :root[data-pp-surface] .pp-topbar .pp-burger:active::before {
        background-size: 11px 2px, 15px 2px, 11px 2px;
    }
    @media (prefers-reduced-motion: reduce) {
        :root[data-pp-surface] .navbar-top .pp-rail-toggle,
        :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"],
        :root[data-pp-surface] .pp-topbar .pp-burger { transition: none; }
        :root[data-pp-surface] .navbar-top .pp-rail-toggle::before,
        :root[data-pp-surface] .navbar-top [data-bs-toggle="offcanvas"]::before,
        :root[data-pp-surface] .pp-topbar .pp-burger::before { transition: none; }
    }

    /* ── the navigation drawer ───────────────────────────────────────────
       Bootstrap's offcanvas is 400px wide, which on a 390pt phone is the whole
       screen: the drawer stops reading as a panel over your work and becomes a
       page you have been thrown into, with the bar it came from hidden behind
       it. A drawer should leave the page visible at the edge — that strip is
       both the way back and the proof you have not gone anywhere.

       So: never wider than 340px or 86% of the screen, rounded on the side it
       opens from, clear of the status bar and the home indicator, with rows a
       thumb can hit and a close button that is a real target. Applies to both
       surfaces, and to a drawer opened from either side. */
    :root[data-pp-surface] .offcanvas.offcanvas-start,
    :root[data-pp-surface] .offcanvas.offcanvas-end {
        width: min(72vw, 320px) !important; max-width: none !important;
        border: 0 !important;
        box-shadow: 0 0 70px rgba(2, 6, 23, .55);
        padding-top: var(--pp-safe-t);
        padding-bottom: calc(var(--pp-safe-b) + 6px);
    }
    :root[data-pp-surface] .offcanvas.offcanvas-start { border-radius: 0 22px 22px 0; }
    :root[data-pp-surface] .offcanvas.offcanvas-end   { border-radius: 22px 0 0 22px; }
    :root[data-pp-surface] .offcanvas .offcanvas-header {
        display: flex; align-items: center; justify-content: space-between;
        min-height: 56px; padding: .7rem .8rem .7rem 1rem;
    }
    /* The close sits at the far edge, whatever the header contains. Bootstrap
       says space-between, but a header whose title is a wide brand lockup
       leaves no space to put between — so the button claims the gap itself. */
    :root[data-pp-surface] .offcanvas .offcanvas-header > :first-child { min-width: 0; }
    :root[data-pp-surface] .offcanvas .offcanvas-header .btn-close { margin-left: auto !important; }
    /* Bootstrap's close is a 16px background image — a mouse target. */
    :root[data-pp-surface] .offcanvas .btn-close {
        width: 44px; height: 44px; flex: 0 0 auto; margin: 0; padding: 0;
        border-radius: 14px; opacity: 1; background-size: 16px 16px;
        background-position: center; background-repeat: no-repeat;
        background-color: color-mix(in srgb, var(--pp-text, #e8ecf6) 10%, transparent);
        box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pp-text, #e8ecf6) 12%, transparent);
    }
    :root[data-pp-surface] .offcanvas .btn-close:active { transform: scale(.92); opacity: 1; }
    /* Rows: 44px, with the icon in a fixed gutter so labels line up. */
    :root[data-pp-surface] .offcanvas .nav-link {
        display: flex; align-items: center; gap: .7rem;
        min-height: 44px; padding: .5rem .7rem; border-radius: 12px;
        font-size: .95rem;
    }
    :root[data-pp-surface] .offcanvas .nav-link:active { transform: scale(.985); }
    /* Where you are, in the drawer as well as in the launcher. */
    :root[data-pp-surface] .offcanvas .nav-link.active {
        background: color-mix(in srgb, var(--pp-accent, #6366f1) 20%, transparent);
        font-weight: 700;
    }
    :root[data-pp-surface] .offcanvas .nav-ic { width: 22px; display: inline-flex; justify-content: center; }
    :root[data-pp-surface] .offcanvas .nav-grouplabel { padding: .9rem .7rem .3rem; font-size: .68rem; letter-spacing: .09em; }
    :root[data-pp-surface] .offcanvas .nav-sep { margin: .35rem .5rem; }
    /* The strip of page still showing is a dismiss target, so it has to look
       like one rather than like a rendering accident. */
    :root[data-pp-surface] .offcanvas-backdrop.show { opacity: .55; }

    /* ═════════ 2. the sheet the actions moved into ═════════ */
    .pp-sheet {
        display: block; position: fixed; inset: 0; z-index: 1080;
        visibility: hidden; pointer-events: none;
    }
    .pp-sheet.is-open { visibility: visible; pointer-events: auto; }
    /* The page behind an open sheet does not scroll. Owned by a class so it
       cannot outlive the sheet (see openSheet in pp-native.js). */
    /* The page behind an open sheet does not scroll.
       `position: fixed` on the body was tried here and REVERTED: it stops the
       scrolling, but it also takes the body out of flow, so the page lifts by
       the scroll offset and the fixed tab bar is left stranded above a band of
       bare html background. A scroll lock may not move anything.
       What holds without touching layout: overflow hidden on BOTH html and
       body, `overscroll-behavior: none` so nothing chains or rubber-bands,
       and — for iOS, which honours none of that reliably — a touchmove guard
       in pp-native.js that refuses any drag outside the open panel. */
    html.pp-sheet-open, html.pp-sheet-open body { overflow: hidden; overscroll-behavior: none; }
    html.pp-sheet-open body { touch-action: none; }
    /* The sheet rises ABOVE the tab bar and stops there — the bar stays lit
       and tappable, the way it does on a phone, so you can still see where
       you are and leave by another route. Covering it made the launcher read
       as a page you had been dropped into with no way back, which is exactly
       what "the menu is overlay and not visible" meant. */
    .pp-sheet-veil {
        position: absolute; left: 0; right: 0; top: 0;
        bottom: var(--pp-tabbar-h, 0px);
        background: rgba(2, 6, 23, .55);
        opacity: 0; transition: opacity .22s ease;
        -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    }
    .pp-sheet.is-open .pp-sheet-veil { opacity: 1; }
    .pp-sheet-card {
        position: absolute; left: 0; right: 0; bottom: var(--pp-tabbar-h, 0px);
        max-height: calc(82vh - var(--pp-tabbar-h, 0px));
        overflow-y: auto; -webkit-overflow-scrolling: touch;
        padding: 10px 14px 16px;
        background: var(--pp-surface, #0f172a); color: var(--pp-text, #e2e8f0);
        border-radius: 20px 20px 0 0; border-top: 1px solid var(--pp-border, rgba(255,255,255,.12));
        box-shadow: 0 -16px 48px rgba(2, 6, 23, .45);
        transform: translateY(102%); transition: transform .28s cubic-bezier(.32, .72, 0, 1);
    }
    .pp-sheet.is-open .pp-sheet-card { transform: translateY(0); }
    .pp-sheet-grip { width: 38px; height: 4px; border-radius: 999px; margin: 2px auto 10px;
        background: var(--pp-border, rgba(255,255,255,.22)); }
    .pp-sheet-title { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
        color: var(--pp-text-muted, #94a3b8); margin: 0 2px 8px; }

    /* ── The page's actions, as a proper action list ────────────────────
       The page's own buttons are re-dressed as sheet rows without touching
       their markup — they stay the SAME elements, so whatever the page bound
       to them keeps working and nothing can fall out of step with a copy.

       Shaped the way a phone shows a list of actions: one tall row each, a
       tinted icon chip to find it by, the label at a readable size, and a
       chevron where the row leads somewhere else. A grid of small buttons is
       what a desktop toolbar looks like; this is what a phone looks like. */
    .pp-sheet .pp-navx { display: flex; flex-direction: column; gap: 6px; }
    .pp-sheet .pp-navx > * {
        position: relative;
        display: flex !important; align-items: center; gap: .75rem; width: 100%;
        min-height: 54px; justify-content: flex-start; text-align: left;
        padding: .6rem .8rem; border-radius: 16px; font-size: .95rem; font-weight: 600;
        border: 1px solid var(--pp-border, rgba(255,255,255,.1));
        background: color-mix(in srgb, var(--pp-text, #e2e8f0) 5%, transparent);
        color: var(--pp-text, #e2e8f0); text-decoration: none;
        transition: transform .14s cubic-bezier(.34, 1.56, .64, 1), background-color .16s ease;
    }
    .pp-sheet .pp-navx > *:active { transform: scale(.985); background: color-mix(in srgb, var(--pp-text, #e2e8f0) 11%, transparent); }
    /* The icon becomes a chip — the same device the rest of this console uses
       to make a list scannable (the bell's rows, the stat tiles). */
    .pp-sheet .pp-navx > * > i:first-child {
        flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px;
        display: grid; place-items: center; font-size: 1rem; text-align: center;
        color: var(--pp-accent, #818cf8);
        background: color-mix(in srgb, var(--pp-accent, #4f46e5) 15%, transparent);
    }
    /* The page's primary action stays the primary action — lifted, not just
       coloured, so it reads as the one thing most people came to do. */
    /* The one thing most people came to do is read first. In a toolbar the
       primary action earns its place by colour; in a vertical list colour
       alone leaves it stranded halfway down, so it leads.
       With `order`, not by moving the node: the page's toolbar goes back to
       the page above the breakpoint, and a DOM move left it reordered there
       for good — a desktop window dragged narrow and wide again came back
       with the page's own buttons in a different order. */
    .pp-sheet .pp-navx > .btn-primary,
    .pp-sheet .pp-navx > .primary,
    .pp-sheet .pp-navx > .btn-success { order: -1; }
    .pp-sheet .pp-navx > .btn-primary,
    .pp-sheet .pp-navx > .primary {
        background: var(--pp-accent, #4f46e5); border-color: transparent; color: #fff;
        box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--pp-accent, #4f46e5) 90%, transparent);
    }
    .pp-sheet .pp-navx > .btn-primary > i:first-child,
    .pp-sheet .pp-navx > .primary > i:first-child { color: #fff; background: rgba(255,255,255,.18); }
    .pp-sheet .pp-navx > .btn-success { background: var(--pp-success, #16a34a); border-color: transparent; color: #fff; }
    /* Share sits in its own group after the page's own actions, with a hair
       of space, so it reads as "and also" rather than as one of them. */
    .pp-sheet .pp-navx-extra { margin-top: 6px; }
    .pp-sheet .pp-navx > .btn-success > i:first-child { color: #fff; background: rgba(255,255,255,.18); }
    /* Destructive reads red WITHOUT shouting: a filled red row in a list of
       ordinary actions is a button that looks like it has already gone wrong. */
    .pp-sheet .pp-navx > .btn-danger,
    .pp-sheet .pp-navx > .danger { color: var(--pp-danger, #f87171); }
    .pp-sheet .pp-navx > .btn-danger > i:first-child,
    .pp-sheet .pp-navx > .danger > i:first-child {
        color: var(--pp-danger, #f87171);
        background: color-mix(in srgb, var(--pp-danger, #dc2626) 16%, transparent);
    }
    /* A row that navigates says so. */
    .pp-sheet .pp-navx > a[href]::after {
        content: '\F285'; font-family: 'bootstrap-icons'; font-size: .8rem;
        margin-left: auto; opacity: .45; flex: none;
    }
    /* Their labels are hidden on small screens in the bar — in the sheet they are
       the whole point, so bring every one of them back. */
    .pp-sheet .pp-navx .d-none { display: inline !important; }
    .pp-sheet .pp-navx .badge { margin-left: auto; }
    .pp-sheet .pp-navx > a[href] .badge { margin-left: auto; margin-right: .4rem; }

    /* The launcher grid behind the last tab — a phone home screen, not a menu:
       big targets, one word each, three across. */
    .pp-launch-grid {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px; margin-top: 2px;
    }
    .pp-launch {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
        padding: 14px 6px 12px; min-height: 86px;
        border: 1px solid var(--pp-border, rgba(255,255,255,.1)); border-radius: 16px;
        background: color-mix(in srgb, var(--pp-text, #e2e8f0) 5%, transparent);
        color: var(--pp-text, #e2e8f0); text-decoration: none;
        font-size: .76rem; font-weight: 650; text-align: center; line-height: 1.2;
        -webkit-tap-highlight-color: transparent;
    }
    .pp-launch i { font-size: 1.45rem; color: var(--pp-accent, #6366f1); }
    /* The page you are on, in the launcher: a lit tile and a tick in the
       corner. Two cues, because colour alone is not a cue for everyone. */
    .pp-launch.is-on {
        background: color-mix(in srgb, var(--pp-accent, #6366f1) 18%, transparent);
        border-color: color-mix(in srgb, var(--pp-accent, #6366f1) 55%, transparent);
        color: var(--pp-text, #e2e8f0);
        box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 14%, transparent);
    }
    .pp-launch.is-on > span { font-weight: 800; }
    .pp-launch { position: relative; }
    .pp-launch .pp-launch-tick {
        position: absolute; top: 7px; right: 8px; font-size: .95rem;
        color: var(--pp-accent, #6366f1);
        filter: drop-shadow(0 1px 2px rgba(2, 6, 23, .5));
    }
    .pp-launch span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pp-launch:active { transform: scale(.95); background: color-mix(in srgb, var(--pp-accent, #6366f1) 18%, transparent); }
    .pp-launch:hover { color: var(--pp-text, #e2e8f0); text-decoration: none; }
    .pp-launch-all { grid-column: 1 / -1; flex-direction: row; min-height: 52px; gap: .55rem; }
    .pp-launch-all i { font-size: 1.15rem; }
    @media (prefers-reduced-motion: reduce) { .pp-launch:active { transform: none; } }

    /* ═════════ 3. the bottom tab bar ═════════ */
    .pp-tabbar {
        /* Above the sheets (1080), because a sheet that covers the bar leaves
           no way back and hides where you are. */
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1085;
        align-items: stretch; gap: 2px;
        /* Shorter: 3px of padding instead of 6, and the tab itself gives back
           another 4. The bar is the one piece of chrome that is on screen the
           whole time, so every pixel it does not take is a pixel of content.
           The bottom padding also carries the home-indicator inset, so the
           last row of tabs never sits under it. */
        padding: 3px calc(6px + var(--pp-safe-r)) calc(3px + var(--pp-safe-b)) calc(6px + var(--pp-safe-l));
        /* A raised surface, not a flat strip: lighter along the top edge where
           the light is, settling to the bar's own colour below. With the
           hairline and the upward shadow that is three cues agreeing, which is
           what makes a 54px strip read as something standing in front of the
           page. */
        background:
            linear-gradient(
                color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 5%, var(--pp-topbar-bg, #0b1020)) 0%,
                color-mix(in srgb, var(--pp-topbar-bg, #0b1020) 94%, transparent) 42%,
                color-mix(in srgb, var(--pp-topbar-bg, #0b1020) 92%, transparent) 100%);
        -webkit-backdrop-filter: saturate(140%) blur(16px); backdrop-filter: saturate(140%) blur(16px);
        border-top: 1px solid var(--pp-topbar-border, rgba(255,255,255,.12));
        /* The depth: a hairline of light along the very top edge, and a shadow
           cast UPWARD onto the page. Together they read as a surface sitting
           in front of the content rather than a strip painted on it — which is
           what a phone's own tab bars do, and why they look solid. */
        box-shadow:
            inset 0 1px 0 color-mix(in srgb, #fff 9%, transparent),
            0 -10px 26px -14px rgba(2, 6, 23, .7);
    }
    /* Scoped to the console: a generated app has its own shell, its own bar and
       its own cushions (app-mobile.css), and this file ships there too. Every
       other rule here is either keyed to a selector only one surface has, or
       universally wanted. These two are not. */
    html[data-pp-surface="console"][data-pp-chrome="bar"] body { padding-bottom: calc(54px + var(--pp-safe-b)); }

    .pp-tab {
        position: relative; flex: 1 1 0; min-width: 0;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
        padding: 3px 2px 2px;
        border: 0; background: transparent; border-radius: 14px;
        color: var(--pp-topbar-text, #c7cde0); text-decoration: none;
        font-size: 10px; font-weight: 650; letter-spacing: .01em;
        -webkit-tap-highlight-color: transparent;
        transition: color .18s ease, transform .16s cubic-bezier(.34, 1.56, .64, 1);
    }
    /* The selected tab wears a pill behind its ICON, not behind the whole
       column: the label stays on the bar's own ground, so the bar keeps one
       flat baseline and only the thing you are "in" lifts off it. The pill is
       a tint of the accent with a light top edge and a shadow under it —
       three cheap layers that read as raised rather than merely coloured. */
    .pp-tab i {
        position: relative; display: grid; place-items: center;
        width: 46px; height: 24px; border-radius: 12px;
        font-size: 18px; line-height: 1;
        transition: background-color .22s ease, box-shadow .22s ease,
                    transform .26s cubic-bezier(.34, 1.56, .64, 1);
    }
    .pp-tab:hover, .pp-tab:focus-visible { color: #fff; text-decoration: none; }
    /* The press: the whole tab dips, and the pill dips a touch further, so the
       touch feels like it lands ON something. 160ms with a slight overshoot is
       the difference between "responds" and "springs back". */
    .pp-tab:active { transform: scale(.93); }
    .pp-tab:active i, .pp-tab.is-pressed i { transform: scale(.9); }
    /* The press answers on touch-DOWN. `:active` on iOS is unreliable for a
       target the finger may roll on, and waiting for the click is what made a
       tap feel ignored on a slow page. */
    .pp-tab.is-pressed { background: color-mix(in srgb, var(--pp-topbar-text, #e8ecf6) 8%, transparent); }
    /* No double-tap-to-zoom delay on the one control people hammer. */
    .pp-tab { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
    .pp-tab.is-on { color: #fff; background: transparent; }
    .pp-tab.is-on i {
        background: color-mix(in srgb, var(--pp-accent, #5b54ec) 30%, transparent);
        box-shadow:
            inset 0 1px 0 color-mix(in srgb, #fff 26%, transparent),
            inset 0 -1px 0 color-mix(in srgb, #000 16%, transparent),
            0 3px 10px -4px color-mix(in srgb, var(--pp-accent, #5b54ec) 85%, transparent);
        animation: ppTabPop .32s cubic-bezier(.34, 1.56, .64, 1);
    }
    @keyframes ppTabPop {
        0%   { transform: scale(.84); }
        60%  { transform: scale(1.06); }
        100% { transform: scale(1); }
    }
    .pp-tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .pp-tab.is-on .pp-tab-label { font-weight: 750; }
    @media (prefers-reduced-motion: reduce) {
        .pp-tab, .pp-tab i { transition: none; }
        .pp-tab:active, .pp-tab:active i, .pp-navx-btn:active { transform: none; }
        .pp-tab.is-on i { animation: none; }
    }

    /* The floating Ask button would land on the last tab — and it has no business
       floating over an open sheet either. */
    #ppAskBtn { bottom: calc(68px + var(--pp-safe-b)) !important; }
    html.pp-sheet-open #ppAskBtn, html.pp-install-open #ppAskBtn { opacity: 0; pointer-events: none; }

    /* ═════════ 4. the install offer ═════════ */
    .pp-install {
        display: flex; position: fixed; left: 10px; right: 10px; z-index: 1070;
        bottom: calc(var(--pp-tabbar-h, 0px) + var(--pp-safe-b) + 12px);
        align-items: center; gap: .7rem; padding: .8rem .9rem;
        background: var(--pp-surface, #fff); color: var(--pp-text, #0f172a);
        border: 1px solid var(--pp-border, rgba(148,163,184,.25)); border-radius: 16px;
        box-shadow: 0 12px 40px rgba(2, 6, 23, .3);
        transform: translateY(160%); opacity: 0;
        transition: transform .32s cubic-bezier(.32, .72, 0, 1), opacity .3s ease;
    }
    .pp-install.show { transform: translateY(0); opacity: 1; }
    .pp-install > i { font-size: 1.5rem; color: var(--pp-accent, #4f46e5); flex: 0 0 auto; }
    .pp-install-tx { flex: 1 1 auto; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
    .pp-install-tx b { font-size: .93rem; }
    .pp-install-tx span { font-size: .79rem; color: var(--pp-text-muted, #64748b); }
    .pp-install-add { flex: 0 0 auto; border: 0; border-radius: 11px; padding: .55rem .95rem;
        font-weight: 700; cursor: pointer; background: var(--pp-accent, #4f46e5); color: #fff; }
    .pp-install-x { flex: 0 0 auto; border: 0; background: none; color: var(--pp-text-muted, #64748b);
        width: 34px; height: 34px; cursor: pointer; }
    /* iOS: point at the Share button the instruction talks about. */
    .pp-install-ios::after {
        content: ""; position: absolute; left: 50%; bottom: -9px; width: 18px; height: 18px;
        transform: translateX(-50%) rotate(45deg);
        background: var(--pp-surface, #fff);
        border-right: 1px solid var(--pp-border, rgba(148,163,184,.25));
        border-bottom: 1px solid var(--pp-border, rgba(148,163,184,.25));
    }

    /* ═════════ 5. the browser-isms ═════════ */
    /* iOS zooms the page when a focused input is under 16px and leaves it zoomed.
       The fix is the font size, not user-scalable=no — which also disables
       pinch-zoom and fails an accessibility audit. */
    input, select, textarea, .form-control, .form-select { font-size: 16px; }
    .form-control-sm, .form-select-sm, .btn-sm { font-size: 16px; }

    html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
    /* No double-tap-to-zoom wait before a tap counts: the browser knows straight
       away that this element is not a zoom target. This is the difference
       between a button that answers and one that feels a beat behind. */
    a, button, [role="button"], input, select, textarea, label, summary, .pp-tab, .pp-navx-btn {
        touch-action: manipulation;
    }
    .table-responsive, .pp-scroll, .dl-scroll, .offcanvas-body { -webkit-overflow-scrolling: touch; }

    /* Console pages hard-code `body { padding-top: 56px }` for the desktop bar.
       The bar measures itself into --pp-navbar-h; this makes every page honour
       it. The !important is deliberate: it overrides a hard-coded value in ~40
       page stylesheets, not a considered one. */
    html[data-pp-surface="console"][data-pp-chrome="bar"] body { padding-top: var(--pp-navbar-h, 56px) !important; }

    /* …and NOTHING else pays it a second time.
       A console page that offsets its own wrapper for the fixed bar — a
       `margin-top: 56px` on .main-content, .ad-main, .studio — adds that
       height ON TOP of the body padding above, so the first card started
       ~116px down a 393px-wide screen: an empty band taller than the bar
       itself before anything you came for. The body is the one place the bar
       is paid for; a wrapper that also pays is corrected here rather than in
       each page, because the same mistake is in several of them and will be
       in the next one. The page keeps its own breathing room (its padding),
       which is a design decision; only the duplicated bar height goes. */
    html[data-pp-surface="console"][data-pp-chrome="bar"] .main-content,
    html[data-pp-surface="console"][data-pp-chrome="bar"] .ad-main,
    html[data-pp-surface="console"][data-pp-chrome="bar"] .studio,
    html[data-pp-surface="console"][data-pp-chrome="bar"] .pp-page-main { margin-top: 0 !important; }
    /* A viewport-height wrapper measured against a bar it is already clear of
       runs off the bottom by exactly that much. */
    html[data-pp-surface="console"][data-pp-chrome="bar"] .studio { height: calc(100dvh - var(--pp-navbar-h, 56px)) !important; }
    /* The room above the first card: generous on a desktop, half of it here. */
    html[data-pp-surface="console"][data-pp-chrome="bar"] .main-content,
    html[data-pp-surface="console"][data-pp-chrome="bar"] .ad-main { padding-top: .7rem !important; }
}

/* A phone in landscape is short: give the sheet and the bar less chrome. */
@media (max-width: 991.98px) and (max-height: 460px) {
    .pp-sheet-card { max-height: 92vh; }
    .pp-tab-label { display: none; }
}

/* Page-to-page motion is opted into from the head (core/Mobile/NativeShell.php)
   so a surface can turn it off: `@view-transition` is a document-level at-rule
   and cannot be scoped by a selector. What lives here is only the part that
   says WHICH elements keep their identity across the navigation.

   Only elements with nothing positioned out of them get a name: an element with
   a view-transition-name becomes the containing block for its fixed-position
   descendants, which silently moved the theme menu off the top of the screen
   when the top bar was named. */
@media (prefers-reduced-motion: no-preference) {
    .pp-tabbar { view-transition-name: pp-tabbar; }
    #ppAskBtn  { view-transition-name: pp-fab; }

    ::view-transition-group(pp-tabbar),
    ::view-transition-group(pp-fab) { animation-duration: .01s; }
}

/* The swipe-back chevron — only ever drawn in the installed app, where the
   platform's own gesture is gone. */
.pp-edge-back {
    position: fixed; left: 0; top: 50%; z-index: 1075;
    display: grid; place-items: center;
    width: 42px; height: 42px; margin-left: -12px;
    border-radius: 50%; opacity: 0; pointer-events: none;
    transform: translateY(-50%);
    background: var(--pp-accent, #5b54ec); color: #fff; font-size: 18px;
    box-shadow: 0 8px 22px rgba(2, 6, 23, .35);
    transition: opacity .12s ease, background .12s ease;
}
.pp-edge-back.show { opacity: 1; }
.pp-edge-back.ready { background: var(--pp-success, #16a34a); }

/* Pull-to-refresh — again, only in the installed app, where the browser's own
   is gone. */
.pp-ptr {
    position: fixed; top: calc(var(--pp-safe-t) + 6px); left: 50%; z-index: 1075;
    display: grid; place-items: center; width: 38px; height: 38px;
    border-radius: 50%; opacity: 0; pointer-events: none;
    transform: translateX(-50%);
    background: var(--pp-surface, #fff); color: var(--pp-accent, #5b54ec); font-size: 17px;
    border: 1px solid var(--pp-border, rgba(148,163,184,.25));
    box-shadow: 0 8px 22px rgba(2, 6, 23, .3);
    transition: opacity .14s ease, color .14s ease;
}
.pp-ptr.show { opacity: 1; }
.pp-ptr.ready { color: var(--pp-success, #16a34a); }
.pp-ptr.spinning i { animation: ppSpin .7s linear infinite; }
@keyframes ppSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pp-ptr.spinning i { animation: none; } }

/* The tap has to answer before the server does. This hairline fills across the
   top the moment a navigation starts, so a slow connection feels like a loading
   app rather than a dead one. */
.pp-nav-progress {
    position: fixed; top: 0; left: 0; height: 2.5px; width: 0; z-index: 2000;
    background: var(--pp-accent, #5b54ec);
    box-shadow: 0 0 10px var(--pp-accent, #5b54ec);
    opacity: 0; pointer-events: none;
    transition: width .25s ease, opacity .2s ease;
}
.pp-nav-progress.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .pp-nav-progress { transition: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Wide tables, on a phone — shared by the console and every generated app
   ══════════════════════════════════════════════════════════════════════════
   A data table is the one component that cannot simply reflow. Up to three
   columns of real content a row becomes a labelled CARD; beyond that it
   becomes a LIST ROW (pp-native.js decides which). Entirely class-driven, so
   dropping a class gives the previous shape back.

   The query is compound on purpose: a phone held in landscape is still a
   phone (844–932px wide), and gating on width alone tore the treatment off
   the moment someone rotated the device. */
@media (max-width: 767.98px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
    .ppm-cardified-wrap { overflow: visible !important; border-radius: 0 !important; -webkit-overflow-scrolling: auto; min-width: 0 !important; }
    .ppm-cardified { border-collapse: separate; border-spacing: 0; table-layout: auto !important; }
    .ppm-cardified,
    .ppm-cardified tbody,
    .ppm-cardified tr,
    .ppm-cardified td {
        display: block !important;
        width: 100% !important; min-width: 0 !important; max-width: 100% !important;
        box-sizing: border-box; height: auto !important;
    }
    .ppm-cardified colgroup, .ppm-cardified col { display: none !important; }
    .ppm-cardified thead { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
    .ppm-cardified tr {
        background: var(--pp-surface, #fff); border-radius: 16px; margin: 0 0 .7rem;
        box-shadow: 0 1px 2px rgba(2,6,23,.06), 0 10px 24px rgba(2,6,23,.05);
        padding: .15rem .2rem; border: none; overflow: hidden;
    }
    .ppm-cardified td {
        display: flex !important; align-items: center; justify-content: space-between; gap: .35rem 1rem; flex-wrap: wrap;
        padding: .62rem .95rem; border: none; border-bottom: 1px solid var(--pp-border, #eef1f6);
        white-space: normal !important; text-align: right; min-height: 44px;
    }
    .ppm-cardified tr td:last-child { border-bottom: none; }
    .ppm-cardified td::before {
        content: attr(data-label); flex: 0 0 34%; text-align: left; word-break: break-word;
        font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
        color: var(--pp-muted, #64748b);
    }
    /* the value sits to the right and may wrap to its own full-width line */
    .ppm-cardified td > * { max-width: 100%; }
    .ppm-cardified td.ppm-cell-plain { justify-content: flex-end; min-height: 0; padding: .3rem .95rem; border-bottom: none; }
    .ppm-cardified td.ppm-cell-plain:empty { display: none !important; }   /* drop truly empty leading cells */
    .ppm-cardified td.ppm-cell-plain::before { content: ""; display: none; }
    .ppm-cardified td .ppd-row-actions, .ppm-cardified td .pp-act-more { margin-left: auto; }
    /* keep a selected card a light tint + ring, not a heavy fill */
    .ppm-cardified tr.pp-selected, .ppm-cardified tr.is-selected, .ppm-cardified tr.selected,
    .ppm-cardified tr:has(input[type=checkbox]:checked) {
        background: color-mix(in srgb, var(--pp-primary, #4f46e5) 8%, var(--pp-surface, #fff)) !important;
        box-shadow: 0 0 0 1.5px var(--pp-primary, #4f46e5) inset, 0 1px 2px rgba(2,6,23,.06);
    }
    .ppm-cardified input[type=checkbox] { width: 22px; height: 22px; border-radius: 6px; accent-color: var(--pp-primary, #4f46e5); }
    /* a master-detail ("DETAILS") cell with no link (e.g. the inline-add row) is a
       dummy on mobile — hide it so the card doesn't show an empty labelled row */
    .ppm-cardified td.ppm-cell-hide { display: none !important; }

    /* ── the compact list row ──────────────────────────────────────────────
       One line that says which record this is, a line or two of supporting
       detail, a state at the trailing edge, and the row's own menu. The rest
       of the columns are on the record's page, one tap away. Laid out as a
       grid so no wrapper elements are needed: dropping .ppm-compact gives the
       labelled card back, and dropping .ppm-cardified gives the table back. */
    .ppm-compact tr {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 0 .5rem;
        padding: .72rem .35rem .72rem .85rem;
        margin-bottom: .5rem;
    }
    .ppm-compact td { display: none !important; }
    /* A host table may mark a row by drawing an inset accent on every CELL —
       the fleet monitor marks "this server" that way. Once the cells are
       stacked, a per-cell left accent is a 3px stripe drawn straight over the
       text. The cells are no longer columns, so the accent goes. */
    .ppm-cardified td, .ppm-compact td { box-shadow: none !important; }
    /* Same reasoning for a cell background: in a list row the cells are lines
       of text, and a column tint painted behind two of them reads as a stray
       block. The row owns the surface. */
    .ppm-compact td { background: transparent !important; }
    .ppm-compact td::before { content: none !important; display: none !important; }
    .ppm-compact td.ppm-c-primary,
    .ppm-compact td.ppm-c-sub {
        display: block !important;
        grid-column: 2; min-width: 0;
        padding: 0; border: 0; min-height: 0;
        text-align: left; overflow: hidden; text-overflow: ellipsis;
        /* the cardified rule above sets `white-space: normal !important`, and a
           list row is one line per line */
        white-space: nowrap !important;
    }
    .ppm-compact td.ppm-c-primary {
        font-size: .975rem; font-weight: 650; line-height: 1.35;
        color: var(--pp-text, #0f172a);
    }
    .ppm-compact td.ppm-c-sub {
        font-size: .8rem; line-height: 1.4; color: var(--pp-muted, #64748b);
    }
    /* A supporting line reads as text, not as five separate links — and the row
       itself is the tap target. */
    .ppm-compact td.ppm-c-sub a,
    .ppm-compact td.ppm-c-primary a { color: inherit; text-decoration: none; }
    .ppm-compact td.ppm-c-trail {
        display: flex !important; grid-column: 3; grid-row: 1 / span 3;
        align-items: center; justify-content: flex-end;
        padding: 0; border: 0; min-height: 0; max-width: 38vw;
        font-size: .8rem; font-weight: 600; text-align: right;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .ppm-compact td.ppd-grid-select {
        display: flex !important; grid-column: 1; grid-row: 1 / span 3;
        align-items: center; padding: 0 .2rem 0 0; border: 0; min-height: 0;
    }
    /* A host table's actions cell is a row of controls, not a menu button, so
       it gets its own line under the record rather than a 40px column. */
    .ppm-compact td.ppm-c-acts {
        display: flex !important; grid-column: 1 / -1;
        flex-wrap: wrap; align-items: center; gap: .35rem;
        padding: .5rem 0 0; margin-top: .45rem; border: 0; min-height: 0;
        border-top: 1px solid var(--pp-border, rgba(148,163,184,.22));
    }
    /* The host usually keeps its action strip on one line; on a phone that line
       is wider than the screen, so let it wrap rather than run off the card. */
    .ppm-compact td.ppm-c-acts > * { flex: 0 1 auto; min-width: 0; max-width: 100%; flex-wrap: wrap !important; }
    .ppm-compact td.ppm-c-acts > *:not(a):not(button) { display: flex !important; gap: .35rem; row-gap: .35rem; }
    .ppm-compact td.ppd-grid-actions {
        display: flex !important; grid-column: 4; grid-row: 1 / span 3;
        align-items: center; justify-content: flex-end; padding: 0; border: 0; min-height: 0;
    }
    /* The whole row is the tap target, so say so. */
    .ppm-compact tr:active { background: color-mix(in srgb, var(--pp-primary, #4f46e5) 7%, var(--pp-surface, #fff)); }
    @media (prefers-reduced-motion: reduce) { .ppm-compact tr:active { background: var(--pp-surface, #fff); } }
}
