/* Global design of every Webbuilder platform site (WebbuilderFrontEnd, WebbuilderWeb, WebbuilderClientArea), served as
   _content/WebbuilderUI/css/app-ui.css: theme tokens (light / dark), base elements, buttons, motion effects, the shared
   app components, the fluid tooltip and skeleton loading. Each site loads it before its own CSS; site-only rules stay in the site.
   One rule also serves WebbuilderWeb's needs and does nothing elsewhere: areas showing the user's website
   ([data-user-site]), which keep their own look. */

/* ================
     theme tokens
   ================ */

/* Brand colours (Resource/Color.png) – fixed in both themes */
:root {
    --app-color-lilac-50: #F9F6FF;
    --app-color-peach: #FFB7A5;
    --app-color-muted: #786987;
    --app-color-primary: #763DE8;
    --app-color-primary-hover: #6A30DC;
    --app-color-deep: #29075C;
    --app-color-ink: #281343;
    --app-color-lilac-100: #EEE5FF;
    --app-color-border: #E7DFF0;
    --app-color-mist: #E9EEF4;
    --app-color-cream: #FFE8D9;
    --app-color-white: #FFFFFF;

    /* Bina's button (css/app-button.css): the brand colours turning round its edge; and a red that reads on the dark
       floating bars of an inverse icon button in both themes */
    --app-ai-edge: #763DE8, #9C74FF, #FFB7A5, #FFD27A, #B57CDF, #763DE8;
    --app-inverse-danger: #FF9DB0;

    /* Font (CJK fallbacks for Chinese text) */
    --app-font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', Arial, sans-serif;

    /* Layout */
    --app-wrap-width: 1240px;
    --app-wrap-gutter: 24px;
    --app-header-height: 80px;

    /* Solid button shadows: light and even all round, so the button never looks heavier below and its label never
       looks high (the same as the buttons in the island and the confirm dialog); a touch deeper on hover */
    --app-shadow-primary: 0 1px 3px rgba(76, 29, 170, 0.28);
    --app-shadow-primary-hover: 0 2px 6px rgba(76, 29, 170, 0.32);
    --app-shadow-danger: 0 1px 3px rgba(160, 30, 60, 0.28);
    --app-shadow-danger-hover: 0 2px 6px rgba(160, 30, 60, 0.32);

    /* Motion curves: smooth deceleration, a springy overshoot for playful details, and a gentle start and stop for
       something travelling across the screen */
    --app-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --app-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --app-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

    /* Bootstrap font override */
    --bs-body-font-family: var(--app-font-family);

    /* How far an icon beside a label moves down to look centred (see "optical icon centring"): Latin letters are
       mostly x-height and read lower than the middle of their line; Chinese characters fill the line and need none */
    --app-icon-nudge: 0.06em;
}

html:lang(zh) {
    --app-icon-nudge: 0em;
}

/* Light theme tokens (default), also forced inside .app-keep-light blocks in dark mode */
:root,
[data-theme="dark"] .app-keep-light {
    color-scheme: light;

    --app-bg: #FFFFFF;
    --app-bg-soft: #F9F6FF;
    --app-surface: #FFFFFF;
    --app-surface-soft: #F9F6FF;
    --app-text: #281343;
    --app-text-strong: #29075C;
    --app-text-muted: #786987;
    --app-line: #E7DFF0;
    --app-accent: #763DE8;
    --app-gradient-brand: linear-gradient(90deg, #763DE8 0%, #B57CDF 52%, #FFB7A5 100%);
    --app-header-bg: rgba(255, 255, 255, 0.94);
    --app-tooltip-bg: #281343;
    --app-tooltip-text: #FFFFFF;
    --app-shadow-soft: 0 8px 24px rgba(41, 7, 92, 0.08);
    --app-shadow-hover: 0 12px 28px rgba(41, 7, 92, 0.12);
    --app-shadow-card: 0 20px 40px rgba(41, 7, 92, 0.1);
    --app-shadow-menu: 0 24px 40px rgba(41, 7, 92, 0.12);

    /* Frosted glass of the floating bar at the bottom of a page (css/app-dock.css) and the deep shadow of what floats */
    --app-glass: rgba(255, 255, 255, 0.78);
    --app-glass-line: rgba(118, 61, 232, 0.18);
    --app-shadow-float: 0 18px 50px rgba(41, 7, 92, 0.22), 0 2px 8px rgba(41, 7, 92, 0.08);
    /* The controls set into a glass toolbar (css/app-toolbar.css): a tinted pill without a line of its own (a step
       deeper than --app-surface-soft, which is too close to the white glass to show its shape), deeper still while
       open, and the see-through tint of a count on the bar */
    --app-control-soft: #F3EEFD;
    --app-control-soft-open: #ECE4FC;
    --app-count-soft: rgba(118, 61, 232, 0.09);

    /* App surfaces and form fields */
    --app-accent-soft: #F4EFFF;
    /* Focus of a field or an open choice (inputs, search boxes, dropdowns): a 2px accent line on its own edge and a
       soft 4px halo of the focus colour round it, the look of an opened pill button; the danger pair for a field with
       an error */
    --app-field-focus: inset 0 0 0 1px var(--app-accent), 0 0 0 4px var(--app-focus-ring);
    --app-field-focus-danger: inset 0 0 0 1px var(--app-danger), 0 0 0 4px color-mix(in srgb, var(--app-danger) 16%, transparent);
    /* The same look for a button that opens a panel (open while its panel shows) but is drawn without a border of its
       own, as the docks' pill buttons are: the 2px accent line falls inside its edge, the halo round it */
    --app-open-ring: inset 0 0 0 2px var(--app-accent), 0 0 0 4px var(--app-focus-ring);

    /* Buttons (see "buttons" below). A gradient is drawn twice the button's width and slides by half on hover, so it
       flows across once and stays. The solid ones: the brand gradient (its magenta end deep enough for white words at
       4.5:1 or more) and the red-to-rose one for destructive actions, each with the halo and glow of a pointed-at
       button. The soft ones: a faint mist of the same colours behind dark words (deeper in its right half, which the
       hover slides in), red-to-peach for a destructive one, and the deeper words they take when pointed at or open. */
    --app-btn-primary-fill: linear-gradient(100deg, #6A30DC, #8D4FEA 35%, #A04FCB 65%, #8D4FEA);
    --app-btn-primary-glow: 0 0 0 4px var(--app-focus-ring), 0 8px 22px rgba(140, 70, 220, 0.38);
    --app-btn-danger-fill: linear-gradient(100deg, #C42D4E, #CB3160 35%, #C7337A 65%, #CB3160);
    --app-btn-danger-glow: 0 0 0 4px rgba(217, 61, 92, 0.16), 0 8px 22px rgba(196, 45, 78, 0.34);
    --app-btn-soft-fill: linear-gradient(100deg, rgba(118, 61, 232, 0.09), rgba(176, 93, 214, 0.11) 50%, rgba(118, 61, 232, 0.2) 75%, rgba(176, 93, 214, 0.22));
    --app-btn-soft-danger-fill: linear-gradient(100deg, rgba(217, 61, 92, 0.1), rgba(255, 140, 110, 0.12) 50%, rgba(217, 61, 92, 0.16) 75%, rgba(255, 140, 110, 0.19));
    --app-btn-soft-active-text: #6A30DC;
    --app-btn-danger-text: #B8284A;
    /* A button that has just done its work (css/app-button.css, "✓ Saved"): white words on a deep green that keeps
       4.5:1 or more, or green words on the soft success tint */
    --app-btn-done-bg: #157A50;
    --app-btn-done-text: #0B7A4B;

    --app-field-bg: #F8F6FB;
    --app-field-bg-focus: #FFFFFF;
    --app-field-line: #E7E1F0;
    --app-switch-off: #9A8EAF;
    --app-placeholder: #A59BB3;
    --app-focus-ring: rgba(118, 61, 232, 0.14);
    --app-scrim: rgba(23, 10, 40, 0.42);

    /* Status colours: text / icon colour and a soft background */
    --app-success: #12965F;
    --app-success-soft: #E9F8F1;
    --app-warning: #B86E00;
    --app-warning-soft: #FFF4E2;
    --app-danger: #D93D5C;
    --app-danger-soft: #FFF2F5;

    /* Skeleton loading: placeholder shapes and the light that sweeps across them */
    --app-skel-base: #EFE9F7;
    --app-skel-shine: rgba(255, 255, 255, 0.75);

    /* Scrollbar thumb, at rest and while its area is hovered */
    --app-scroll-thumb: rgba(118, 61, 232, 0.2);
    --app-scroll-thumb-hover: rgba(118, 61, 232, 0.42);

    /* The island and the confirm dialog (css/app-island.css, css/confirm-dialog.css): a white surface in Light, with a
       solid 1px outline (never see-through, so no background colour shows in it) and one short, faint shadow that
       stays clear of the top bar's bottom line */
    --app-island-bg: #FFFFFF;
    --app-island-text: #281343;
    --app-island-strong: #1E0A3C;
    --app-island-muted: #6F6280;
    --app-island-line: rgba(41, 7, 92, 0.14);
    --app-island-hover: rgba(118, 61, 232, 0.08);
    --app-island-glow: rgba(118, 61, 232, 0.09);
    --app-island-track: rgba(41, 7, 92, 0.1);
    --app-island-shadow: drop-shadow(0 4px 12px rgba(41, 7, 92, 0.12));
    --app-island-ring: #D6CEE2;
    --app-island-ok: #12835A;
    --app-island-ok-bg: #E1F5EC;
    --app-island-info: #6A30DB;
    --app-island-info-bg: #EFE7FF;
    --app-island-warn: #9A5800;
    --app-island-warn-bg: #FFF0D2;
    --app-island-error: #C9314F;
    --app-island-error-bg: #FFE6EC;
    --app-island-check-bg: #1FAE6E;
    --app-island-check-text: #FFFFFF;
    --app-island-progress: #763DE8;
    --app-island-action-bg: #EFE7FF;
    --app-island-action-text: #5520C2;
    --app-island-stack-1: #EFE9F7;
    --app-island-stack-2: #E3DBEE;
    --app-island-primary: #763DE8;
    --app-island-scrim: rgba(30, 14, 56, 0.36);
    /* The countdown traced round a card's outline: deeper in Light, brighter in Dark */
    --app-island-trace-1: #6A2FE0;
    --app-island-trace-2: #B84FD6;
    --app-island-trace-3: #F2836F;
    --app-island-bar: linear-gradient(90deg, #9C74FF, #FFB7A5);
    --app-island-badge-error: #E5486A;
    --app-island-badge-warn: #E7A12E;

    --bs-body-color: var(--app-text);
    --bs-body-bg: var(--app-bg);
}

/* Dark theme tokens. Platform controls drawn inside an .app-keep-light block (such as the menus over the website in
   the Editor's canvas) are marked .app-follow-theme to take the page's theme again. */
[data-theme="dark"],
[data-theme="dark"] .app-keep-light .app-follow-theme {
    color-scheme: dark;

    --app-bg: #110A1C;
    --app-bg-soft: #170E26;
    --app-surface: #1B1229;
    --app-surface-soft: #22163A;
    --app-text: #F2EDF9;
    --app-text-strong: #FFFFFF;
    --app-text-muted: #B3A6C6;
    --app-line: #33264A;
    --app-accent: #A684FF;
    --app-gradient-brand: linear-gradient(90deg, #9C74FF 0%, #C99BEA 52%, #FFB7A5 100%);
    --app-header-bg: rgba(17, 10, 28, 0.88);
    --app-tooltip-bg: #F2EDF9;
    --app-tooltip-text: #281343;
    --app-skel-base: #261A38;
    --app-skel-shine: rgba(255, 255, 255, 0.07);
    --app-scroll-thumb: rgba(166, 132, 255, 0.22);
    --app-scroll-thumb-hover: rgba(166, 132, 255, 0.48);
    --app-shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);
    --app-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.45);
    --app-shadow-card: 0 20px 40px rgba(0, 0, 0, 0.45);
    --app-shadow-menu: 0 24px 40px rgba(0, 0, 0, 0.5);

    --app-glass: rgba(27, 18, 41, 0.72);
    --app-glass-line: rgba(166, 132, 255, 0.22);
    --app-shadow-float: 0 18px 50px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
    --app-control-soft: #22163A;
    /* Solid (the accent at 14% over --app-control-soft): an open tool laid over a picture (a card's ⋯) must not let
       the picture show through it */
    --app-control-soft-open: #352555;
    --app-count-soft: rgba(166, 132, 255, 0.06);

    --app-accent-soft: rgba(166, 132, 255, 0.14);
    /* Focus of a field or an open choice (inputs, search boxes, dropdowns): a 2px accent line on its own edge and a
       soft 4px halo of the focus colour round it, the look of an opened pill button; the danger pair for a field with
       an error */
    --app-field-focus: inset 0 0 0 1px var(--app-accent), 0 0 0 4px var(--app-focus-ring);
    --app-field-focus-danger: inset 0 0 0 1px var(--app-danger), 0 0 0 4px color-mix(in srgb, var(--app-danger) 16%, transparent);
    /* The same look for a button that opens a panel (open while its panel shows) but is drawn without a border of its
       own, as the docks' pill buttons are: the 2px accent line falls inside its edge, the halo round it */
    --app-open-ring: inset 0 0 0 2px var(--app-accent), 0 0 0 4px var(--app-focus-ring);

    /* Buttons: the same solid gradients, with a soft glow of their own colour on hover; a brighter mist and words */
    --app-btn-primary-glow: 0 0 0 4px var(--app-focus-ring), 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 26px rgba(166, 132, 255, 0.5);
    --app-btn-danger-glow: 0 0 0 4px rgba(255, 122, 147, 0.18), 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 26px rgba(255, 122, 147, 0.42);
    --app-btn-soft-fill: linear-gradient(100deg, rgba(166, 132, 255, 0.16), rgba(214, 140, 230, 0.18) 50%, rgba(166, 132, 255, 0.3) 75%, rgba(214, 140, 230, 0.32));
    --app-btn-soft-danger-fill: linear-gradient(100deg, rgba(255, 122, 147, 0.16), rgba(255, 160, 130, 0.18) 50%, rgba(255, 122, 147, 0.26) 75%, rgba(255, 160, 130, 0.28));
    --app-btn-soft-active-text: #C7B0FF;
    --app-btn-danger-text: #FFA3B5;
    --app-btn-done-bg: #157A50;
    --app-btn-done-text: #3DD598;

    --app-field-bg: #160E23;
    --app-field-bg-focus: #1B1229;
    --app-field-line: #33264A;
    --app-switch-off: #6B5C85;
    --app-placeholder: #7E7192;
    --app-focus-ring: rgba(166, 132, 255, 0.2);
    --app-scrim: rgba(5, 2, 10, 0.6);

    --app-success: #3DD598;
    --app-success-soft: rgba(61, 213, 152, 0.12);
    --app-warning: #FFC15E;
    --app-warning-soft: rgba(255, 193, 94, 0.12);
    --app-danger: #FF7A93;
    --app-danger-soft: rgba(255, 122, 147, 0.1);

    --app-island-bg: #0B0712;
    --app-island-text: #FFFFFF;
    --app-island-strong: #FFFFFF;
    --app-island-muted: rgba(255, 255, 255, 0.66);
    --app-island-line: rgba(255, 255, 255, 0.18);
    --app-island-hover: rgba(255, 255, 255, 0.1);
    --app-island-glow: rgba(166, 132, 255, 0.2);
    --app-island-track: rgba(255, 255, 255, 0.14);
    --app-island-shadow: drop-shadow(0 6px 16px rgba(5, 0, 14, 0.5));
    --app-island-ring: #2D2638;
    --app-island-ok: #4BDDA3;
    --app-island-ok-bg: rgba(61, 213, 152, 0.16);
    --app-island-info: #D2C2FF;
    --app-island-info-bg: rgba(166, 132, 255, 0.2);
    --app-island-warn: #FFC86E;
    --app-island-warn-bg: rgba(255, 193, 94, 0.16);
    --app-island-error: #FF8BA0;
    --app-island-error-bg: rgba(255, 92, 122, 0.18);
    --app-island-check-bg: #3DD598;
    --app-island-check-text: #0B0712;
    --app-island-progress: #B79BFF;
    --app-island-action-bg: rgba(166, 132, 255, 0.24);
    --app-island-action-text: #E9E1FF;
    --app-island-stack-1: #2C2140;
    --app-island-stack-2: #211830;
    --app-island-primary: #763DE8;
    --app-island-scrim: rgba(10, 5, 20, 0.52);
    --app-island-trace-1: #A98BFF;
    --app-island-trace-2: #D59BEE;
    --app-island-trace-3: #FFB7A5;

    --bs-body-color: var(--app-text);
    --bs-body-bg: var(--app-bg);
}

@media (max-width: 1199.98px) {
    :root {
        --app-header-height: 76px;
    }
}

@media (max-width: 575.98px) {
    :root {
        --app-wrap-gutter: 20px;
        --app-header-height: 68px;
    }
}

/* ================
     theme tokens
   ================ */


/* =================
     base elements
   ================= */

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--app-header-height);
}

html, body {
    font-family: var(--app-font-family);
    color: var(--app-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Nothing wider than the window scrolls the page sideways. clip, not hidden: hidden would make the body a scroll box of
   its own whenever an open dialog or sheet stops the page scrolling (html overflow: hidden, confirm-dialog.css,
   app-sheet.css), and every sticky part (the dock in apg-dock, a drawer beside the page) would then jump off the
   screen. hidden stays only for a browser without clip. */
body {
    background: var(--app-bg);
    overflow-x: hidden;
    overflow-x: clip;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Areas that show the user's website (data-user-site: Editor canvas, previews) keep its own rules, as on the published site */
img:not([data-user-site] img) {
    max-width: 100%;
}

/* No grey tap flash; js/app-motion.js gives tapped elements a press-and-bounce instead */
a, button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--app-accent);
    outline-offset: 3px;
}

/* A field one types into marks its focus on its own edge: one 2px accent line, the 1px border plus 1px inside it
   (box-shadow: inset 0 0 0 1px), so nothing moves. No soft ring outside it and no outline a few pixels away: beside the
   edge either reads as a second line. Every text field (and a box that wraps one) follows this; see rules/UI.md R24. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):focus-visible,
textarea:focus-visible {
    outline: none;
}

h1:focus {
    outline: none;
}

/* Disable transitions for one frame while the theme switches, so every colour changes at once */
.app-theme-switching *,
.app-theme-switching *::before,
.app-theme-switching *::after {
    transition: none !important;
}

/* ---------- scrollbars ---------- */

/* One scrollbar for every scrolling area of the platform (the page, the sidebar, modals, drop-down lists...): a slim
   rounded brand-tinted thumb floating on no track. It deepens while its area is hovered and turns to the accent
   colour while it is dragged. Areas showing the user's website (data-user-site) keep the browser's own scrollbar.
   An area must not set scrollbar-width or scrollbar-color: Chrome then ignores these styles (scrollbar-width: none,
   to hide a scrollbar, is fine). An area may give the track a margin to keep the thumb clear of rounded corners. */
:where(:not([data-user-site], [data-user-site] *))::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

:where(:not([data-user-site], [data-user-site] *))::-webkit-scrollbar-track {
    background: transparent;
}

:where(:not([data-user-site], [data-user-site] *))::-webkit-scrollbar-thumb {
    min-height: 40px;
    border: 4px solid transparent;
    border-radius: 999px;
    background: var(--app-scroll-thumb) padding-box;
}

:where(:not([data-user-site], [data-user-site] *)):hover::-webkit-scrollbar-thumb {
    background: var(--app-scroll-thumb-hover) padding-box;
}

:where(:not([data-user-site], [data-user-site] *))::-webkit-scrollbar-thumb:active {
    background: var(--app-accent) padding-box;
}

:where(:not([data-user-site], [data-user-site] *))::-webkit-scrollbar-button,
:where(:not([data-user-site], [data-user-site] *))::-webkit-scrollbar-corner {
    display: none;
    background: transparent;
}

/* Firefox, which has no WebKit scrollbar styling: the same thin tinted thumb */
@supports not selector(::-webkit-scrollbar) {
    :where(:not([data-user-site], [data-user-site] *)) {
        scrollbar-width: thin;
        scrollbar-color: var(--app-scroll-thumb-hover) transparent;
    }
}

/* A website shown in a frame keeps the light scrollbar it has on the published site: the browser would otherwise pass
   the platform's dark scheme from the frame on to the website's scrollbar. A website that declares its own
   color-scheme still uses it. */
[data-user-site] iframe,
iframe[data-user-site] {
    color-scheme: light;
}

/* =================
     base elements
   ================= */


/* =============
     utilities
   ============= */

/* Page content container: 1240px max width with side gutters */
.app-wrap {
    width: 100%;
    max-width: calc(var(--app-wrap-width) + var(--app-wrap-gutter) * 2);
    margin: 0 auto;
    padding-left: var(--app-wrap-gutter);
    padding-right: var(--app-wrap-gutter);
}

/* Brand gradient text */
.app-gradient-text {
    background: var(--app-gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Small section label above titles */
.app-eyebrow {
    display: inline-block;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: var(--app-gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Chinese headings use normal letter spacing; the tight tracking only suits Latin text */
:lang(zh) h1:not([data-user-site] h1),
:lang(zh) h2:not([data-user-site] h2),
:lang(zh) h3:not([data-user-site] h3) {
    letter-spacing: 0;
}

/* =============
     utilities
   ============= */


/* ===========
     buttons
   =========== */

/* One button for the whole platform, drawn without a border: the look comes from its fill alone.
     app-btn-primary         the page's main action: the brand gradient, white words
     app-btn-danger          a destructive action that cannot be undone: the red-to-rose gradient, white words
     app-btn-outline         a secondary action: a faint mist of the brand colours behind dark words
     app-btn-danger-outline  a destructive action beside others (remove, delete, cancel an order): a red mist, red words
     app-btn-ghost           the third level (Cancel, Later): words only
     app-btn-light           FrontEnd's white button on a coloured band
   Sizes: 54px (FrontEnd's calls to action), app-btn-md 46px (a page's main actions, form submits), app-btn-sm 36px
   (small buttons in cards, the island); the dock and the confirm dialog give their buttons the 42px middle size. A
   gradient is painted twice the button's width; pointing at the button slides it by half (background-position: a
   repaint of the button only, nothing re-laid out), so the colours flow across once and stay. A press shrinks every
   button to 0.94 and bounces it back (js/app-motion.js), with no data-press on the button. */
.app-btn {
    /* The button's height; a size or a place (the dock, the confirm dialog) sets it, and a button whose words may wrap
       (app-btn-wrap) keeps it as its least height */
    --app-btn-h: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: var(--app-btn-h);
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    background-color: transparent;
    background-position: 0 0;
    background-repeat: no-repeat;
    background-size: 200% 100%;
    font-family: var(--app-font-family);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    isolation: isolate;
    /* Own layer, so the label is not redrawn (a visible flash) each time the press bounce ends */
    will-change: transform;
    transition: background-position 0.9s var(--app-ease-out), box-shadow 0.3s ease, background-color 0.25s ease, color 0.25s ease;
}

/* Up-right arrow icon (up arrow rotated 45 degrees) */
.app-btn-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transform: rotate(45deg);
    transition: transform 0.35s var(--app-ease-spring);
}

.app-btn-primary {
    background-image: var(--app-btn-primary-fill);
    color: var(--app-color-white);
    box-shadow: var(--app-shadow-primary);
}

.app-btn-danger {
    background-image: var(--app-btn-danger-fill);
    color: var(--app-color-white);
    box-shadow: var(--app-shadow-danger);
}

/* The mist lies on the surface colour, so the button reads the same on a card, on glass or over a picture */
.app-btn-outline {
    background-color: var(--app-surface);
    background-image: var(--app-btn-soft-fill);
    color: var(--app-text-strong);
}

/* It stays red when pointed at, focused or open, never turning the accent colour */
.app-btn-danger-outline {
    background-color: var(--app-surface);
    background-image: var(--app-btn-soft-danger-fill);
    color: var(--app-btn-danger-text);
}

.app-btn-ghost {
    background-color: transparent;
    color: var(--app-text-muted);
}

/* Light surface button (FrontEnd, on a coloured band) */
.app-btn-light {
    background-color: var(--app-surface);
    color: var(--app-text);
    box-shadow: var(--app-shadow-soft);
}

/* Unavailable button: half see-through, with no hover, glow or press */
.app-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Waiting for a request to finish: a spinner takes the place of the button's icon and arrow, the label stays visible,
   clicks are ignored; the icon comes back once the button is no longer busy. This is the only busy spinner a button
   gets, so pages set aria-busy and never add their own spinner inside an .app-btn. */
.app-btn[aria-busy="true"] {
    opacity: 0.85;
    cursor: progress;
    pointer-events: none;
}

.app-btn[aria-busy="true"] .app-btn-arrow,
.app-btn[aria-busy="true"] > .bx,
.app-btn[aria-busy="true"] > img {
    display: none;
}

/* It takes the icon's place exactly: the button's own gap sets it apart from the label, and with no label shown (an
   icon-only button) it sits in the centre, as the icon did */
.app-btn[aria-busy="true"]::before {
    content: "";
    flex: none;
    width: 16px;
    height: 16px;
    /* A faint ring in the label colour with a solid arc spinning over it, readable on every button style */
    border: 2px solid currentColor;
    border-color: color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: app-btn-spin 0.7s linear infinite;
}

@keyframes app-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hover styles only on devices with a real pointer, so a tap on a phone never leaves a button stuck in its hover look.
   A button never moves when pointed at: its colours flow across once and stay. A solid one gains a 4px halo and a
   glow of its own colour; a soft one's mist deepens and its words turn purple (a red one's stay red); the third level
   only turns its words purple. No light sweeps across any of them. */
@media (hover: hover) {
    .app-btn:not(:disabled, [aria-disabled="true"]):hover {
        background-position: 100% 0;
    }

    .app-btn:not(:disabled, [aria-disabled="true"]):hover .app-btn-arrow {
        transform: translate(3px, -3px) rotate(45deg);
    }

    .app-btn-primary:not(:disabled, [aria-disabled="true"]):hover {
        color: var(--app-color-white);
        box-shadow: var(--app-btn-primary-glow);
    }

    .app-btn-danger:not(:disabled, [aria-disabled="true"]):hover {
        color: var(--app-color-white);
        box-shadow: var(--app-btn-danger-glow);
    }

    .app-btn:is(.app-btn-outline, .app-btn-ghost):not(:disabled, [aria-disabled="true"]):hover {
        color: var(--app-btn-soft-active-text);
    }

    .app-btn-danger-outline:not(:disabled, [aria-disabled="true"]):hover {
        color: var(--app-btn-danger-text);
    }

    .app-btn-light:not(:disabled, [aria-disabled="true"]):hover {
        color: var(--app-accent);
        box-shadow: var(--app-shadow-hover);
    }
}

/* On: a mode it turns on (aria-pressed="true", e.g. /pages Select) or the panel it opens (aria-expanded="true", e.g.
   /page-view Page settings). The mist stays as it is at rest and a 1px purple line with a soft 4px halo round it says
   "this is on", in purple words. As specific as the hover above and after it, so the pointer resting on an open button
   keeps the look. */
.app-btn:is(.app-btn-outline, .app-btn-ghost):is([aria-pressed="true"], [aria-expanded="true"]):not(:disabled, [aria-disabled="true"]) {
    background-position: 0 0;
    color: var(--app-btn-soft-active-text);
    box-shadow: var(--app-field-focus);
}

/* A label that may run to two lines (a long translation in a button of a set width, the confirm dialog's buttons):
   the button grows with its words from its size's height, the words centred. Two classes, so it wins over the sizes'
   padding written later in this file (app-btn-md, app-btn-sm). */
.app-btn.app-btn-wrap {
    height: auto;
    min-height: var(--app-btn-h);
    padding-top: 8px;
    padding-bottom: 8px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ===========
     buttons
   =========== */


/* =================
     scroll reveal
   ================= */

/* Elements are only hidden when JS is available, so content still shows without JS.
   The entrance is a keyframe animation on the separate translate / scale properties,
   so each element keeps its own transform and transition for hover effects. */
.app-js .app-reveal {
    opacity: 0;
}

.app-js .app-reveal.app-revealed {
    opacity: 1;
    /* "backwards": hidden during the delay, and once finished the element's own styles apply again */
    animation: app-reveal-rise 1s var(--app-ease-out) backwards;
}

/* Zoom variant for cards: rises and grows slightly into place */
.app-js .app-reveal-zoom.app-revealed {
    animation-name: app-reveal-zoom;
}

.app-js .app-reveal-delay-1 {
    animation-delay: 0.1s;
}

.app-js .app-reveal-delay-2 {
    animation-delay: 0.2s;
}

.app-js .app-reveal-delay-3 {
    animation-delay: 0.3s;
}

@keyframes app-reveal-rise {
    from {
        opacity: 0;
        translate: 0 36px;
    }

    to {
        opacity: 1;
        translate: none;
    }
}

@keyframes app-reveal-zoom {
    from {
        opacity: 0;
        translate: 0 40px;
        scale: 0.94;
    }

    to {
        opacity: 1;
        translate: none;
        scale: 1;
    }
}

/* Respect the system "reduce motion" setting */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .app-js .app-reveal,
    .app-js .app-reveal.app-revealed {
        opacity: 1;
        animation: none;
    }

    .app-btn,
    .app-btn-arrow {
        transition: none;
    }
}

/* =================
     scroll reveal
   ================= */


/* ==================
     motion effects
   ================== */

/* ---------- particle burst (js/app-motion.js, elements with data-burst) ---------- */

.app-burst-layer {
    position: fixed;
    inset: 0;
    /* Over panels and dialogs too, so a press inside them still bursts; only the tooltip is higher */
    z-index: 2147482000;
    overflow: hidden;
    pointer-events: none;
}

.app-burst-bit {
    position: absolute;
    top: 0;
    left: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    will-change: transform, opacity;
}

/* Four-point sparkle shape (colour from an .app-star-N class) */
.app-burst-star {
    width: 14px;
    height: 14px;
    border-radius: 0;
}

/* Four-point sparkles in the brand colours, drawn as small images. A clip-path star would be redrawn on every
   frame while it spins and grows, which dropped frames (a visible flicker) when the mouse moved fast. */
.app-star-1,
.app-star-2,
.app-star-3,
.app-star-4,
.app-star-5 {
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.app-star-1 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23763DE8' d='M50 0L62 38L100 50L62 62L50 100L38 62L0 50L38 38Z'/%3E%3C/svg%3E");
}

.app-star-2 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%239C74FF' d='M50 0L62 38L100 50L62 62L50 100L38 62L0 50L38 38Z'/%3E%3C/svg%3E");
}

.app-star-3 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23B57CDF' d='M50 0L62 38L100 50L62 62L50 100L38 62L0 50L38 38Z'/%3E%3C/svg%3E");
}

.app-star-4 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23FFB7A5' d='M50 0L62 38L100 50L62 62L50 100L38 62L0 50L38 38Z'/%3E%3C/svg%3E");
}

.app-star-5 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23FFD27A' d='M50 0L62 38L100 50L62 62L50 100L38 62L0 50L38 38Z'/%3E%3C/svg%3E");
}

/* Thin confetti strip */
.app-burst-strip {
    width: 5px;
    height: 12px;
    border-radius: 2px;
}

/* ---------- sparkle trail behind the mouse (js/app-motion.js), drawn in the same layer ---------- */

/* The sparkles are reused, so they stay in the page invisible between flights */
.app-trail {
    position: absolute;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    opacity: 0;
    will-change: transform, opacity;
}

/* ---------- cursor follower (desktop with a mouse only) ---------- */

/* Soft halo: hidden normally, it only appears (and grows) over links and buttons.
   The size changes with the scale property (moved by the graphics card) rather than width and height,
   so growing and shrinking never re-lays out or repaints the page. The script positions it with the
   translate property, which sits outside the scale, so the halo always stays centred on the mouse. */
.app-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2147481990;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border-radius: 50%;
    background: rgba(118, 61, 232, 0.12);
    pointer-events: none;
    opacity: 0;
    scale: 0.2;
    will-change: transform, opacity;
    /* Hiding: quick, so the halo is gone soon after the mouse leaves a link or button */
    transition: scale 0.18s var(--app-ease-out), background-color 0.35s ease, opacity 0.14s ease-out;
}

/* Over links and buttons the halo grows out around the mouse (a softer, slower entrance) */
.app-cursor-on.app-cursor-hover .app-cursor {
    opacity: 1;
    scale: 1;
    transition: scale 0.35s var(--app-ease-out), background-color 0.35s ease, opacity 0.3s ease;
}

/* The halo shrinks a little while the mouse button is held down */
.app-cursor-hover.app-cursor-down .app-cursor {
    scale: 0.77;
}

/* ---------- magnetic pull (js/app-motion.js, data-magnetic) ---------- */

/* An element with its own translate adds these two variables to it instead (e.g. .cta-btn) */
[data-magnetic] {
    translate: var(--app-mag-x, 0px) var(--app-mag-y, 0px);
}

[data-theme="dark"] .app-cursor {
    background: rgba(166, 132, 255, 0.16);
}

/* ---------- tap ripple on tilting cards (js/app-motion.js, data-tilt-tap) ---------- */

/* Sits behind the card text (the card needs position and isolation) */
.app-tilt-ripple {
    position: absolute;
    z-index: -1;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.28) 0%, rgba(255, 183, 165, 0.12) 45%, transparent 70%);
    pointer-events: none;
    animation: app-tilt-ripple 1s var(--app-ease-out) forwards;
}

@keyframes app-tilt-ripple {
    from {
        opacity: 1;
        transform: scale(0.2);
    }

    to {
        opacity: 0;
        transform: scale(36);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-tilt-ripple {
        display: none;
    }
}

/* ---------- theme switch: circle that grows from the toggle button (View Transitions API) ---------- */

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    z-index: 1;
}

/* ==================
     motion effects
   ================== */


/* ===================
     blazor error ui
   =================== */

/* Blazor shows this element when a circuit ends because of an unhandled error. It is only a signal: the site's
   startup script watches it and tells the user with its own banner (WebbuilderWeb js/blazor-reconnect.js), so it
   stays hidden even after Blazor sets its inline display. */
#blazor-error-ui {
    display: none !important;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===================
     blazor error ui
   =================== */




/* ==================
     app components
   ================== */

/* ---------- button sizes for app screens (the 54px base size is kept for FrontEnd's calls to action) ---------- */

/* Large: a page's main actions and form submits */
.app-btn-md {
    --app-btn-h: 46px;
    padding: 0 20px;
    font-size: 15px;
}

/* Small: buttons in cards, chips of choices, the island */
.app-btn-sm {
    --app-btn-h: 36px;
    padding: 0 16px;
    font-size: 14px;
    gap: 6px;
}

/* Round icon-only button (a floating action such as Send feedback): as wide as it is tall at every size, the icon an
   even number of pixels so it lands on whole pixels in the centre */
.app-btn-round {
    width: auto;
    aspect-ratio: 1;
    padding: 0;
}

/* As specific as the size rules below, and above the general ".app-btn .bx" that comes later in this file */
.app-btn.app-btn-round > .bx {
    font-size: 24px;
}

.app-btn-md.app-btn-round > .bx {
    font-size: 22px;
}

.app-btn-sm.app-btn-round > .bx {
    font-size: 20px;
}

.app-btn .bx {
    font-size: 1.15em;
    line-height: 1;
}

/* A picture icon (Bina's star) is as big as a font icon in the same button, whatever width its markup gives */
.app-btn > img {
    flex: none;
    width: 1.15em;
    height: 1.15em;
}

/* ---------- optical icon centring ---------- */

/* An icon and its label are centred as boxes; the icon then moves down by --app-icon-nudge so it lines up with the
   letters as the eye reads them. Pages use the same variable for their own icon-and-label rows. */
.app-btn > .bx,
.app-btn > img,
.app-segmented-option > .bx,
.app-sel-icon,
.app-sel-option-icon,
.app-sel-check {
    position: relative;
    top: var(--app-icon-nudge);
}

/* With no words beside it (an icon-only option, or a label folded away on a narrow screen; app-ui.js marks these) the
   icon sits in the exact centre */
[data-app-icon-only] > .bx,
[data-app-icon-only] > img {
    top: 0;
}

/* ---------- the way back (Components/AppBack.razor) ----------
   "‹ All pages" at the top of a page head: small muted words after a chevron, a soft accent pill on hover with the
   chevron stepping left. The pill's own edge lines up with the head's text column (no negative margin pulling it out),
   so at rest the chevron sits its padding in from the title below and the hover pill never reaches past the column. */
.app-back {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    max-width: 100%;
    height: 28px;
    margin: 0 0 4px;
    padding: 0 12px 0 6px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-family: var(--app-font-family);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    color: var(--app-text-muted);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.app-back .bx {
    flex: none;
    font-size: 19px;
    line-height: 1;
    position: relative;
    top: var(--app-icon-nudge);
    transition: transform 0.35s var(--app-ease-spring);
}

@media (hover: hover) {
    .app-back:hover {
        background: var(--app-accent-soft);
        color: var(--app-accent);
    }

    .app-back:hover .bx {
        transform: translateX(-3px);
    }
}

.app-back:focus-visible {
    color: var(--app-accent);
}

.app-back:disabled,
.app-back[aria-disabled="true"] {
    opacity: 0.5;
    background: transparent;
    color: var(--app-text-muted);
    pointer-events: none;
    cursor: default;
}

/* A finger gets 44px of height: an unseen strip above and below, the pill itself unchanged */
@media (pointer: coarse) {
    .app-back::after {
        content: "";
        position: absolute;
        inset: min(0px, calc((100% - 44px) / 2));
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-back,
    .app-back .bx {
        transition: none;
    }
}

/* ---------- round icon button (⋯, close, copy, a dock's previous and next) ----------
   The round twin of the soft button (app-btn-outline): 42px, the brand mist behind a dark icon, no border; pointing at
   it flows and deepens the mist and turns the icon purple. app-icon-btn-plain (the close × in a corner of a dialog or
   a panel) has no fill until pointed at. The top bar keeps its own round buttons (app-bar-btn, app-shell.css). */

.app-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--app-surface);
    background-image: var(--app-btn-soft-fill);
    background-position: 0 0;
    background-repeat: no-repeat;
    background-size: 200% 100%;
    color: var(--app-text-strong);
    font-size: 20px;
    line-height: 1;
    /* A link drawn as an icon button: no underline under the icon */
    text-decoration: none;
    cursor: pointer;
    /* Own layer, so the icon is not redrawn (a visible flash) each time the press bounce ends */
    will-change: transform;
    transition: background-position 0.9s var(--app-ease-out), color 0.25s ease, box-shadow 0.25s ease;
}

.app-icon-btn-plain {
    background-color: transparent;
    background-image: none;
}

.app-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (hover: hover) {
    .app-icon-btn:not(:disabled, [aria-disabled="true"]):hover {
        background-image: var(--app-btn-soft-fill);
        background-position: 100% 0;
        color: var(--app-btn-soft-active-text);
    }
}

/* Open (the menu or panel it opens shows) or on: the mist at rest, a 1px purple line with a soft 4px halo round it and
   a purple icon; as specific as the hover above and after it, so the pointer resting on it keeps the look */
.app-icon-btn:is([aria-expanded="true"], [aria-pressed="true"]):not(:disabled, [aria-disabled="true"]) {
    background-image: var(--app-btn-soft-fill);
    background-position: 0 0;
    color: var(--app-btn-soft-active-text);
    box-shadow: var(--app-field-focus);
}

/* A destructive one (remove a domain, delete a code): the red mist and a red icon, which stays red when pointed at;
   with app-icon-btn-plain it has no fill until pointed at */
.app-icon-btn-danger {
    background-image: var(--app-btn-soft-danger-fill);
    color: var(--app-btn-danger-text);
}

.app-icon-btn-danger.app-icon-btn-plain {
    background-image: none;
}

@media (hover: hover) {
    .app-icon-btn-danger:not(:disabled, [aria-disabled="true"]):hover {
        background-image: var(--app-btn-soft-danger-fill);
        color: var(--app-btn-danger-text);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-icon-btn {
        transition: none;
    }
}

/* Light / dark toggle: shows the moon in light mode and the sun in dark mode */
.app-theme-sun {
    display: none;
}

[data-theme="dark"] .app-theme-moon {
    display: none;
}

[data-theme="dark"] .app-theme-sun {
    display: inline-block;
}

/* ---------- cards ---------- */

.app-card {
    position: relative;
    border: 1px solid var(--app-line);
    border-radius: 24px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-soft);
}

/* ---------- choice card: one tile picked from a set (such as one of Bina's recent logo designs) ----------
   A button holding a picture or a small preview (a colour swatch too); the chosen one has aria-pressed="true", or, in a
   role="radiogroup", role="radio" with aria-checked="true". Like other cards it rises a little on hover; chosen, it
   carries the "open" ring; the page only sizes it and lays out what is inside. A small tile (a colour swatch) reaches
   44px on touch screens through its unseen ::after, its drawn shape keeping its size. */

.app-choice {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--app-line);
    border-radius: 14px;
    background: var(--app-surface);
    color: var(--app-text);
    font: inherit;
    cursor: pointer;
    transition: transform 0.25s var(--app-ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
    .app-choice:not(:disabled, [aria-disabled="true"]):hover {
        border-color: var(--app-accent);
        transform: translateY(-2px);
    }
}

.app-choice:focus-visible {
    outline: none;
    box-shadow: var(--app-field-focus);
}

/* Chosen, or holding open the panel it opens (the Wizard's custom colour swatch and its picker): the open look */
.app-choice[aria-pressed="true"],
.app-choice[aria-pressed="true"]:focus-visible,
.app-choice[role="radio"][aria-checked="true"],
.app-choice[role="radio"][aria-checked="true"]:focus-visible,
.app-choice[aria-expanded="true"],
.app-choice[aria-expanded="true"]:focus-visible {
    border-color: var(--app-accent);
    box-shadow: var(--app-open-ring);
}

.app-choice:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (pointer: coarse) {
    .app-choice::after {
        content: "";
        position: absolute;
        inset: min(0px, calc((100% - 44px) / 2));
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-choice {
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .app-choice:not(:disabled, [aria-disabled="true"]):hover {
        transform: none;
    }
}

/* ---------- credits left: a small ring and two lines ----------
   How many AI uses are left (Bina's logo designs, Bina's images): the ring fills by the share left (--app-credit, 0 to
   100) and holds the number; beside it a bold line and a muted note. Used up, the ring and the bold line turn amber.
     <div class="app-credit">
         <span class="app-credit-ring" style="--app-credit: 60" aria-hidden="true"><span>3</span></span>
         <span class="app-credit-text"><b>3 left today</b><small>Back to 5 every day</small></span>
     </div> */

.app-credit {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--app-text-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

.app-credit-ring {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: conic-gradient(var(--app-color-primary) calc(var(--app-credit, 0) * 1%), var(--app-line) 0);
}

/* Outfit's figures sit a little above the middle: 0.5px more room on top (rules/UI.md, round badges) */
.app-credit-ring > span {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding-top: 0.5px;
    border-radius: 50%;
    background: var(--app-surface);
    color: var(--app-text-strong);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.app-credit-text {
    min-width: 0;
}

.app-credit-text > b {
    display: block;
    color: var(--app-text-strong);
    font-size: 13px;
    font-weight: 600;
}

.app-credit-text > small {
    display: block;
    font-size: 12.5px;
}

.app-credit-empty .app-credit-ring {
    background: var(--app-warning-soft);
}

.app-credit-empty .app-credit-text > b {
    color: var(--app-warning);
}

/* ---------- form fields ---------- */

.app-field {
    display: block;
    margin: 0;
}

.app-label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--app-text-strong);
}

.app-input,
.app-textarea,
.app-select {
    display: block;
    width: 100%;
    padding: 0 16px;
    border: 1px solid var(--app-field-line);
    border-radius: 12px;
    background: var(--app-field-bg);
    font-family: inherit;
    font-size: 14px;
    color: var(--app-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.app-input,
.app-select {
    height: 48px;
}

.app-textarea {
    min-height: 104px;
    padding: 13px 16px;
    line-height: 1.55;
    resize: vertical;
}

.app-input::placeholder,
.app-textarea::placeholder {
    color: var(--app-placeholder);
    opacity: 1;
}

.app-input:focus,
.app-textarea:focus,
.app-select:focus {
    border-color: var(--app-accent);
    background: var(--app-field-bg-focus);
    box-shadow: var(--app-field-focus);
}

.app-input:disabled,
.app-textarea:disabled,
.app-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.app-input-invalid,
.app-input-invalid:focus {
    border-color: var(--app-danger);
    background: var(--app-danger-soft);
}

.app-input-invalid:focus {
    box-shadow: var(--app-field-focus-danger);
}

.app-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--app-text-muted);
}

.app-hint-danger {
    color: var(--app-danger);
}

/* ---------- password field with a show / hide button inside its end ----------
     <div class="app-password">
         <input class="app-input" type="password" … />
         <button type="button" class="app-password-toggle" aria-pressed="false" aria-label="Show password" data-tip="…">
             <i class="bx bx-show"></i>
         </button>
     </div>
   The page switches the input's type and the icon (bx-show / bx-hide); the button is a 36px circle, centred on the
   field's height, as far from the end as from the top and bottom. */

.app-password {
    position: relative;
}

.app-password > .app-input {
    padding-right: 48px;
}

.app-password-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-password-toggle .bx {
    line-height: 1;
}

@media (hover: hover) {
    .app-password-toggle:hover {
        background: var(--app-accent-soft);
        color: var(--app-accent);
    }
}

.app-password-toggle:focus-visible {
    outline: none;
    box-shadow: var(--app-field-focus);
}

@media (pointer: coarse) {
    :where(.app-password-toggle)::after {
        content: "";
        position: absolute;
        inset: min(0px, calc((100% - 44px) / 2));
    }
}

/* Checkbox with its label: <label class="app-check"><input type="checkbox" /><span>Text</span></label> */
/* ---------- touch hit areas ----------
   On touch screens every control can be tapped over at least 44 x 44 px. A control drawn smaller (a 36px or 42px
   button, a 20px check box with its line of text) keeps its look: an unseen ::after reaches out to 44px, centred on
   it, and only where the control is smaller (min() leaves a larger side as it is). position: relative sits in :where(),
   so a page that places the control itself (absolute, sticky) still wins (.app-btn is relative already). Tools do the
   same in app-toolbar.css, top bar controls in app-shell.css and preference-controls.css. */
@media (pointer: coarse) {
    :where(.app-icon-btn, .app-check, .app-switch) {
        position: relative;
    }

    .app-btn::after,
    .app-icon-btn::after,
    .app-check::after,
    .app-switch::after {
        content: "";
        position: absolute;
        inset: min(0px, calc((100% - 44px) / 2));
    }
}

.app-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--app-text);
    cursor: pointer;
    user-select: none;
}

.app-check input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1.5px solid var(--app-field-line);
    border-radius: 6px;
    background: var(--app-field-bg);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* The tick: a check mark drawn so that its ink is centred in the box (an SVG mask over the whole inner box), popping
   in when checked. Two rotated borders placed by pixel values looked off-centre (R31). */
.app-check input::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--app-color-white);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.6 8.3l2.9 2.9 5.9-6.1' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.6 8.3l2.9 2.9 5.9-6.1' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    transform: scale(0);
    transition: transform 0.3s var(--app-ease-spring);
}

.app-check input:checked {
    border-color: var(--app-color-primary);
    background: var(--app-color-primary);
}

.app-check input:checked::after {
    transform: scale(1);
}

.app-check input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--app-focus-ring);
}

/* Ticked with a pointer after typing elsewhere (a code, a form): the browser still counts the focus as from the
   keyboard, but the user clicked, so no halo is drawn; Tab brings it back (js/app-island.js keeps <html data-app-input>,
   as the confirm dialog's buttons do) */
html[data-app-input="pointer"] .app-check input:focus-visible {
    box-shadow: none;
}

.app-check input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------- status badge ---------- */

.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.app-badge .bx {
    font-size: 14px;
}

.app-badge-success {
    background: var(--app-success-soft);
    color: var(--app-success);
}

.app-badge-warning {
    background: var(--app-warning-soft);
    color: var(--app-warning);
}

.app-badge-danger {
    background: var(--app-danger-soft);
    color: var(--app-danger);
}

/* ---------- on / off switch (a button with aria-pressed) ---------- */

.app-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--app-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.app-switch-track {
    position: relative;
    flex: none;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: var(--app-switch-off);
    transition: background-color 0.25s ease;
}

.app-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(41, 7, 92, 0.2);
    transition: transform 0.35s var(--app-ease-spring);
}

.app-switch[aria-pressed="true"] .app-switch-track {
    background: var(--app-color-primary);
}

.app-switch[aria-pressed="true"] .app-switch-thumb {
    transform: translateX(18px);
}

.app-switch:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* ---------- segmented control (two or three exclusive options) ---------- */

.app-segmented {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface);
}

/* Options of equal standing (screen sizes, modes, a list's filters): every option as wide as the widest, in any language
   and with any number of options. A group never scrolls: where its labels run out of room it folds a step at a time
   (below, and the glass toolbar's own steps in app-toolbar.css). */
.app-segmented-even {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
}

.app-segmented-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--app-text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

/* The options share the whole group for clicks: each option's tap area reaches half-way into the 4px gap beside it and
   over the group's 4px padding, so a click between two options or at the group's edge picks the nearer option
   instead of landing on nothing (R31) */
.app-segmented-option {
    position: relative;
}

.app-segmented-option::after {
    content: "";
    position: absolute;
    top: -4px;
    right: -2px;
    bottom: -4px;
    left: -2px;
}

.app-segmented-option:first-child::after {
    left: -4px;
}

.app-segmented-option:last-child::after {
    right: -4px;
}

/* Each option keeps its label on one line at its full width. The group is never a scrolling box (overflow other than
   visible): a box that scrolls clips on both axes, so it would cut the sliding pill's glow into straight lines (R26).
   A group that may run out of room is an equal-width one (.app-segmented-even), which folds instead. */
.app-segmented:not(.app-segmented-even) > .app-segmented-option {
    flex-shrink: 0;
    white-space: nowrap;
}

.app-segmented-option .bx {
    font-size: 18px;
}

/* An equal-width group in a place too narrow for its labels (a settings drawer, a pop-up, a phone) folds a step at a time
   until every label fits (app-ui.js data-app-even-fit): 1, less padding; 2, the icons beside the labels fold away (only
   in options showing words, data-app-even-label; an option that shows just its icon keeps it); 3, smaller labels; 4, a
   label on two lines. Until that last step a label keeps to one line, so a label too long shows as one that does not
   fit (Chinese would otherwise break after every character and never look too wide). */
.app-segmented-even > .app-segmented-option {
    white-space: nowrap;
}

.app-segmented-even[data-app-even-fit] > .app-segmented-option {
    padding: 0 8px;
}

.app-segmented-even:is([data-app-even-fit="2"], [data-app-even-fit="3"], [data-app-even-fit="4"]) > .app-segmented-option[data-app-even-label] > .bx {
    display: none;
}

.app-segmented-even:is([data-app-even-fit="3"], [data-app-even-fit="4"]) > .app-segmented-option {
    padding: 0 6px;
    font-size: 12px;
}

.app-segmented-even[data-app-even-fit="4"] > .app-segmented-option {
    padding: 0 4px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
}

/* 5 (only a group whose labels are all marked data-tip-label): the labels fold away and the icons stay, each option's
   name shown by its tooltip */
.app-segmented-even[data-app-even-fit="5"] > .app-segmented-option > [data-tip-label] {
    display: none;
}

/* The chosen option: a pressed button, or the link to the page being shown (aria-current="true") */
.app-segmented-option[aria-pressed="true"],
.app-segmented-option[aria-current="true"] {
    background: var(--app-color-primary);
    color: var(--app-color-white);
    box-shadow: 0 6px 14px rgba(118, 61, 232, 0.28);
}

@media (hover: hover) {
    .app-segmented-option:not([aria-pressed="true"]):not([aria-current="true"]):where(:not([aria-disabled="true"])):hover {
        color: var(--app-accent);
    }
}

/* ---------- sliding pill (app-ui.js) ---------- */

/* In every pill option group (.app-segmented, or any group marked data-app-glide) the purple pill slides with a
   smooth stretch from the old choice to the new one, instead of jumping. The curve settles without overshooting,
   so a long move (first option to last) lands as calmly as a short one; a spring would overshoot in proportion to
   the distance and bounce back. app-ui.js measures the chosen option
   (aria-pressed, aria-current or aria-selected "true") into --app-glide-*; until then, and without JS, the chosen
   option keeps its own purple background. */
.app-segmented,
[data-app-glide] {
    position: relative;
    isolation: isolate;
}

.app-segmented::before,
[data-app-glide]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    width: var(--app-glide-w, 0px);
    height: var(--app-glide-h, 0px);
    border-radius: 999px;
    background: var(--app-color-primary);
    box-shadow: 0 6px 14px rgba(118, 61, 232, 0.28);
    opacity: 0;
    transform: translate(var(--app-glide-x, 0px), var(--app-glide-y, 0px));
    pointer-events: none;
    transition:
        transform 0.5s var(--app-ease-out),
        width 0.5s var(--app-ease-out),
        height 0.3s ease,
        opacity 0.3s ease;
}

[data-app-glide-ready]::before {
    opacity: 1;
}

/* Placed at once (first measure, resize), without sliding */
[data-app-glide-instant]::before {
    transition: none;
}

/* A group of another look (data-app-glide, e.g. the notification centre's underlined tabs) that scrolls sideways fades
   out on each side that has more options (app-ui.js marks the sides), so the cut-off options read as "scroll for
   more"; it shows no scrollbar of its own. A pill group (.app-segmented) never scrolls (above). */
[data-app-glide] {
    scrollbar-width: none;
}

[data-app-glide]::-webkit-scrollbar {
    display: none;
}

[data-app-scroll-end] {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent);
}

[data-app-scroll-start] {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px);
    mask-image: linear-gradient(90deg, transparent, #000 56px);
}

[data-app-scroll-start][data-app-scroll-end] {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
}

/* With the pill in place, the chosen option itself is see-through and only its text turns white */
[data-app-glide-ready] > [aria-pressed="true"],
[data-app-glide-ready] > [aria-current="true"],
[data-app-glide-ready] > [aria-selected="true"] {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

/* ---------- the arrow of a button that opens a panel ----------
   One arrow for every drop-down, menu and panel button on the platform (the language switch's): it points the way its
   panel opens (bx-chevron-down for one that opens below, bx-chevron-up for one that opens above, such as the docks'
   buttons), turns round while the panel shows (the button's aria-expanded="true") and, under the pointer, nudges 2px
   the way it points. A drop-down list that opens above its button for want of room below (app-ui.js marks it
   data-app-sel-up as the pointer or the focus reaches the button) turns its arrow up before it opens. */
.app-caret {
    --app-caret-turn: 0deg;
    --app-caret-shift: 0px;
    --app-caret-nudge: 2px;
    display: inline-block;
    line-height: 1;
    transform: rotate(var(--app-caret-turn)) translateY(var(--app-caret-shift));
    transition: transform 0.4s var(--app-ease-spring);
}

/* The nudge is along the arrow's own tip, so it turns with the arrow */
.bx-chevron-up.app-caret {
    --app-caret-nudge: -2px;
}

[aria-expanded="true"] .app-caret,
[data-app-sel-up] > [data-app-menu-toggle] .app-caret {
    --app-caret-turn: 180deg;
}

[data-app-sel-up] > [aria-expanded="true"] .app-caret {
    --app-caret-turn: 0deg;
}

@media (hover: hover) {
    :is(button, a, [role="button"]):not(:disabled, [aria-disabled="true"]):hover .app-caret {
        --app-caret-shift: var(--app-caret-nudge);
    }
}

/* ---------- drop-down choice (SelectMenu component) ---------- */

/* Quick repeated clicks open and choose; they never select the text of the button or the options */
.app-sel {
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

/* Even padding on both sides; the icon and the arrow are pulled out by the blank space Boxicons leaves inside their
   glyphs (about 1.5px for the icons, 4px for the arrow), as on the language switch, so the space seen before the icon
   (or the text) and after the arrow is the same */
.app-sel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 46px;
    padding: 0 16px;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: var(--app-text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.app-sel-toggle > .bx {
    transition: color 0.25s ease, transform 0.4s var(--app-ease-spring);
}

.app-sel-icon {
    flex: none;
    margin-inline-start: -1px;
    font-size: 18px;
    color: var(--app-text-muted);
    transition: color 0.25s ease;
}

/* A full line height, so letters that reach below the line (g, y, p) are not cut off by the overflow */
.app-sel-value {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.4;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* The platform's arrow (.app-caret above), in the colour of the button's text as on the language switch */
.app-sel-caret {
    flex: none;
    margin-right: -4px;
    font-size: 18px;
}

.app-sel-toggle:focus-visible {
    outline: none;
    border-color: var(--app-accent);
    box-shadow: var(--app-field-focus);
}

/* Open, and under the pointer: the language switch's look, the accent line (with the halo while open) and the text,
   icon and arrow in the accent colour */
.app-sel[data-open] .app-sel-toggle {
    border-color: var(--app-accent);
    color: var(--app-accent);
    box-shadow: var(--app-field-focus);
}

.app-sel[data-open] .app-sel-icon {
    color: var(--app-accent);
}

@media (hover: hover) {
    .app-sel-toggle:not(:disabled, [aria-disabled="true"]):hover {
        border-color: var(--app-accent);
        color: var(--app-accent);
    }

    .app-sel-toggle:not(:disabled, [aria-disabled="true"]):hover .app-sel-icon {
        color: var(--app-accent);
    }
}

/* The list: at least as wide as the button, springing open from its top edge */
.app-sel-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    min-width: 100%;
    margin: 0;
    padding: 6px;
    border: 1px solid var(--app-line);
    border-radius: 18px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-menu);
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.96);
    transform-origin: top center;
    transition: opacity 0.2s ease, transform 0.35s var(--app-ease-spring), visibility 0.2s, max-height 0s 0.2s, padding 0s 0.2s, border-width 0s 0.2s;
}

/* Closed, the list folds to no height once it has faded out, so a list under the last field of a page never makes
   the page longer than its content (an empty band to scroll into below the page) */
.app-sel:not([data-open]) .app-sel-list {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
}

.app-sel[data-open] .app-sel-list {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.2s ease, transform 0.35s var(--app-ease-spring), visibility 0.2s, max-height 0s, padding 0s, border-width 0s;
}

/* Options cascade in after the list opens */
.app-sel-list li {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.35s var(--app-ease-out);
}

.app-sel[data-open] .app-sel-list li {
    opacity: 1;
    transform: none;
    transition-delay: calc(min(var(--app-sel-i, 0), 8) * 0.035s);
}

/* A line between two groups of options (SelectMenuOption.StartsGroup), spanning the list inside its 6px padding with
   the 6px gap of the platform's menus above and below it */
.app-sel-list .app-sel-sep {
    height: 1px;
    margin: 6px 0;
    background: var(--app-line);
}

/* Too close to the bottom of the screen (app-ui.js): the list opens upward, springing from its bottom edge */
.app-sel[data-app-sel-up] .app-sel-list {
    top: auto;
    bottom: calc(100% + 8px);
    transform-origin: bottom center;
}

.app-sel[data-app-sel-up]:not([data-open]) .app-sel-list {
    transform: translateY(6px) scale(0.96);
}

/* A long list (e.g. countries) scrolls inside itself; reaching its end never scrolls the page behind */
.app-sel-list {
    max-height: min(320px, 50vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* The thumb stays clear of the list's rounded corners */
.app-sel-list::-webkit-scrollbar-track {
    margin: 12px 0;
}

/* Nothing chosen yet: the toggle shows the placeholder text, muted */
.app-sel-placeholder .app-sel-value {
    font-weight: 500;
    color: var(--app-text-muted);
}

.app-sel-toggle[aria-invalid="true"] {
    border-color: var(--app-danger);
}

.app-sel-toggle:disabled,
.app-sel-option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* The native <select> behind a drop-down built for a plain HTML form (app-ui.js): kept in the form, never seen */
.app-sel-native {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.app-sel-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.3;
    color: var(--app-text);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-sel-option-icon {
    font-size: 18px;
    color: var(--app-text-muted);
}

.app-sel-option-text {
    flex: 1 1 auto;
    min-width: 0;
}

/* The option's hint (SelectMenuOption.Hint): a muted second line in the list, muted text after the chosen value */
.app-sel-option-hint {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 500;
    color: var(--app-text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.app-sel-value-hint {
    margin-left: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--app-text-muted);
}

.app-sel-check {
    font-size: 18px;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s ease, transform 0.35s var(--app-ease-spring);
}

.app-sel-option:focus-visible {
    outline: none;
    background: var(--app-accent-soft);
    color: var(--app-accent);
}

.app-sel-option[aria-selected="true"] {
    font-weight: 600;
    color: var(--app-accent);
}

.app-sel-option[aria-selected="true"] .app-sel-option-icon {
    color: var(--app-accent);
}

.app-sel-option[aria-selected="true"] .app-sel-check {
    opacity: 1;
    transform: none;
}

@media (hover: hover) {
    .app-sel-option:hover {
        background: var(--app-bg-soft);
        color: var(--app-accent);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-segmented::before,
    [data-app-glide]::before,
    .app-caret,
    .app-sel-toggle > .bx,
    .app-sel-list,
    .app-sel-list li,
    .app-sel-check {
        transition: none;
    }
}

/* ---------- inline notice ---------- */

.app-alert {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: var(--app-accent-soft);
    color: var(--app-text);
}

.app-alert-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--app-surface);
    color: var(--app-accent);
    font-size: 20px;
}

.app-alert-warning {
    border-color: rgba(184, 110, 0, 0.18);
    background: var(--app-warning-soft);
}

.app-alert-warning .app-alert-icon {
    color: var(--app-warning);
}

.app-alert-success {
    border-color: rgba(18, 150, 95, 0.2);
    background: var(--app-success-soft);
}

.app-alert-success .app-alert-icon {
    color: var(--app-success);
}

.app-alert-danger {
    border-color: rgba(217, 61, 92, 0.22);
    background: var(--app-danger-soft);
}

.app-alert-danger .app-alert-icon {
    color: var(--app-danger);
}

/* ---------- loading ---------- */

.app-spinner {
    display: inline-block;
    flex: none;
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--app-line);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: app-btn-spin 0.8s linear infinite;
}

/* Centered "please wait" block while a page checks access or loads its data */
.app-wait {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 50vh;
    padding: 48px 20px;
    color: var(--app-text-muted);
    font-size: 14px;
    text-align: center;
}

/* ---------- fluid tooltip (app-ui.js, elements with data-tip) ---------- */

/* On a touch screen a finger held on a tooltip target shows its bubble: the system's own long-press callout (copy link,
   save image) and text selection stay away from it */
@media (pointer: coarse) {
    [data-tip] {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* One pill for the whole page, placed with the translate property; when it moves to another target, the position and
   the width glide with a springy curve, which makes it look like a drop flowing from one item to the next */
.app-tip {
    position: fixed;
    top: 0;
    left: 0;
    /* Above every panel, dialog and overlay: the tip belongs to whatever the pointer is on, whichever layer that is */
    z-index: 2147483000;
    height: 32px;
    padding: 0 12px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--app-tooltip-bg);
    box-shadow: 0 10px 24px rgba(41, 7, 92, 0.22);
    color: var(--app-tooltip-text);
    font-family: var(--app-font-family);
    font-size: 13px;
    font-weight: 500;
    line-height: 32px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    scale: 0.82;
    will-change: translate, width, height;
    transition:
        translate 0.5s var(--app-ease-spring),
        width 0.45s var(--app-ease-spring),
        height 0.45s var(--app-ease-spring),
        border-radius 0.3s ease,
        opacity 0.18s ease,
        scale 0.35s var(--app-ease-spring);
}

/* A text too long for one line wraps in a rounded box (height set by app-ui.js) */
.app-tip-wrap {
    padding: 8px 12px;
    border-radius: 14px;
    line-height: 18px;
    white-space: normal;
}

/* A word or address longer than the box (a file's link) breaks wherever it must, so nothing runs past the edge */
.app-tip-wrap .app-tip-text {
    right: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

[data-theme="dark"] .app-tip {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

/* It grows out of the side that faces its target */
.app-tip[data-side="right"] {
    transform-origin: left center;
}

.app-tip[data-side="left"] {
    transform-origin: right center;
}

.app-tip[data-side="bottom"] {
    transform-origin: center top;
}

.app-tip[data-side="top"] {
    transform-origin: center bottom;
}

.app-tip-show {
    opacity: 1;
    scale: 1;
}

/* First appearance: placed at once, only fading and growing in */
.app-tip-instant {
    transition: opacity 0.18s ease, scale 0.35s var(--app-ease-spring);
}

.app-tip-track {
    position: relative;
    display: block;
    height: 100%;
}

/* The pill clips the texts as they slide past each other */
.app-tip-text {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
}

.app-tip-text-in {
    animation: app-tip-text-in 0.42s var(--app-ease-out) both;
}

.app-tip-text-out {
    animation: app-tip-text-out 0.3s var(--app-ease-out) both;
}

@keyframes app-tip-text-in {
    from {
        opacity: 0;
        translate: var(--app-tip-from, 0 100%);
    }

    to {
        opacity: 1;
        translate: none;
    }
}

@keyframes app-tip-text-out {
    to {
        opacity: 0;
        translate: var(--app-tip-to, 0 -100%);
    }
}

/* Off-screen copy used to measure a new text's size; same font as .app-tip, never scaled */
.app-tip-measure {
    position: fixed;
    top: -9999px;
    left: -9999px;
    visibility: hidden;
    pointer-events: none;
    font-family: var(--app-font-family);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* Measuring a wrapped text: app-ui.js sets the width, the height is read back */
/* Wraps exactly as the bubble's text does (.app-tip-wrap .app-tip-text), so the bubble is as high as its lines */
.app-tip-measure-wrap {
    line-height: 18px;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
    .app-tip {
        scale: 1;
        transition: opacity 0.15s ease;
    }

    .app-tip-text-in,
    .app-tip-text-out {
        animation: none;
    }
}

/* ---------- skeleton loading (Skeleton, SkeletonRegion, PlanCardSkeleton components) ---------- */

/* While a page or a part of it loads, placeholder shapes stand where its content will be, laid out like that content.
   One soft light sweeps across every shape in step: the sweep is fixed to the screen, not to each shape (Safari on
   iPhone and iPad, which has no fixed backgrounds, sweeps each shape on its own). */
.app-skel {
    display: block;
    flex: none;
    max-width: 100%;
    height: 14px;
    border-radius: 8px;
    background-color: var(--app-skel-base);
    background-image: linear-gradient(100deg, transparent 35%, var(--app-skel-shine) 50%, transparent 65%);
    background-repeat: no-repeat;
    background-size: 200vw 100vh;
    background-attachment: fixed;
    animation: app-skel-sweep 1.8s ease-in-out infinite;
}

/* A line of text: its height follows the font size of the place it stands in */
.app-skel-text {
    height: 0.8em;
    border-radius: 6px;
}

.app-skel-circle {
    border-radius: 50%;
}

.app-skel-pill {
    border-radius: 999px;
}

/* A box, such as an image, a card or a field */
.app-skel-block {
    border-radius: 14px;
}

@keyframes app-skel-sweep {
    from {
        background-position: -150vw 0;
    }

    to {
        background-position: 50vw 0;
    }
}

/* The loading area: it fades in after a short pause, so a page that loads quickly never flashes the shapes. It answers
   no pointer: skeletons reuse the page's own classes, so a card's lift and glow, a row's tint or a button's hover would
   otherwise play on shapes that cannot be used yet; the cursor halo, which lights only over links and buttons, stays
   off with it (the sparkle trail behind the mouse still shows, as everywhere on the page) */
.app-skel-region {
    animation: app-skel-in 0.35s ease 0.12s backwards;
    pointer-events: none;
}

/* A skeleton shows no characters. Skeletons reuse the page's own classes and hold its real text unseen, but a line the
   page cuts with "…" draws the "…" in the line's own colour, not the hidden text's; it outranks the pages' rules. A
   paragraph clamped to a number of lines cannot drop its "…" this way: its skeleton cuts it by height instead. */
.app-skel-region,
.app-skel-region * {
    text-overflow: clip !important;
}

/* A loading area that takes the place of a skeleton already on screen shows at once (SkeletonRegion Immediate) */
.app-skel-region-now {
    animation: none;
}

@keyframes app-skel-in {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-skel {
        background-image: none;
        animation: none;
    }

    .app-skel-region {
        animation: none;
    }
}

/* ---------- page entrance ---------- */

.app-enter {
    animation: app-reveal-rise 0.7s var(--app-ease-out) backwards;
}

.app-enter-delay-1 {
    animation-delay: 0.06s;
}

.app-enter-delay-2 {
    animation-delay: 0.12s;
}

/* Content that takes the place of a skeleton already on the screen (app-ui.js marks it app-enter-in-place) stands
   where the skeleton stood: it only fades in. Rising into place would first show it lower than the skeleton was and
   then lift it, which reads as the page dropping and jumping back. */
.app-enter.app-enter-in-place {
    animation-name: app-enter-fade;
    animation-duration: 0.35s;
}

@keyframes app-enter-fade {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-enter,
    .app-enter.app-enter-in-place {
        animation: none;
    }

    .app-switch-thumb,
    .app-segmented-option {
        transition: none;
    }
}

/* ==================
     app components
   ================== */
