/* ============================================================
   Penguin Boat Club — Design System
   ============================================================

   TABLE OF CONTENTS
   -----------------
   0. Table of Contents (you are here)
   1. Design Tokens
   2. Reset & Base
   3. Layout (shell, sidebar, header, content)
   4. Components (buttons, inputs, cards, badges, dialogs,
      dropdowns, tabs, tooltips, separators, sheets, toasts,
      empty states)
   5. Patterns (library grids, data tables, upload zones,
      search bars, pagination)
   6. Editor (toolbar, tools panel, properties panel, canvas)
   7. Pages (login, dashboard, admin)
   8. Utilities (visually-hidden, truncate, scrollbar)
   9. Responsive (tablet 768px, desktop 1280px, wide 1536px)

   ============================================================ */


/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */

:root {
    /* --- Colors: Light Theme (2026 brand: navy ink on sand) --- */
    --brand-navy:             #1a213a;
    --brand-sand:             #d3d2cd;
    --signin-surface:         #eeeeef;   /* the sign-in, terms and share cards and the words on the sea: the sand, made neutral and lighter with the rest of the light theme (17 Nov 2026); the same in dark mode */
    --brand-yellow:           #ffec8d;

    --page:                   #f7f7f7; /* page body and pasteboard tint */
    --background:             #f7f7f7;   /* Phil's own pick, 17 Nov 2026 */
    --foreground:             #1a213a;
    --card:                   #fbfbfb; /* lighter sand than the page */
    --card-foreground:        #1a213a;
    --popover:                #fbfbfb;
    --popover-foreground:     #1a213a;
    --primary:                #1a213a;
    --primary-foreground:     #ffec8d;
    --secondary:              #eeeef0;
    --secondary-soft:         #f7f7f7;   /* fills on a light surface (a popover, a card): buttons, fields, icon tiles; #d6d5d0 read too dark there */
    --secondary-foreground:   #1a213a;
    --muted:                  #eeeef0;
    --muted-foreground:       #4a5069;
    --accent:                 #eeeef0;
    --accent-foreground:      #1a213a;
    --destructive:            hsl(0 72% 45%);   /* the red FILL under white words: 5.6:1 (hsl 0 84% 60% read 3.6:1; Phil 25 Oct 2026) */
    --destructive-foreground: hsl(0 0% 98%);
    --destructive-text:       hsl(0 72% 42%);   /* red as TEXT (errors, Delete): readable on every surface */
    --template-link:          hsl(265 52% 50%); /* a linked document's card border (round 3, 7 Nov 2026): never green; 5:1 on the card */
    --success:                hsl(142 71% 45%);
    --success-foreground:     #1a213a; /* navy ink: white on this green read 2.2:1 (WCAG AA needs 4.5) */
    --warning:                hsl(38 92% 50%);
    --warning-foreground:     #1a213a;
    --border:                 #eaebeb;
    --input:                  #767779;   /* a FIELD's edge (WCAG 1.4.11, 3:1): 4.0:1 on the card, 3.3:1 on the page (#c1c0bc read 1.7:1; Phil 25 Oct 2026) */
    --input-soft:             #e7e7e7;   /* the old field edge, for what is not a field's edge: the switch's off track, a drop zone, the dark card menu's rim */
    --ring:                   #1a213a;

    /* Sidebar */
    --sidebar:                        #f2f2f3;
    --sidebar-foreground:             #1a213a;
    --sidebar-primary:                #1a213a;
    --sidebar-primary-foreground:     #ffec8d;
    --sidebar-accent:                 #ececed;
    --sidebar-accent-foreground:      #1a213a;
    --sidebar-border:                 #eaebeb;
    --sidebar-muted:                  #4a5069;

    /* --- Typography --- */
    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system,
                 BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: Georgia, serif;   /* titles in Georgia regular (Phil, 30 Sep 2026: replaces Palm Springs) */
    --font-mono: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;

    --text-2xs:  0.6875rem;   /* 11px: small print, such as the key under a tooltip (Phil 31 Oct 2026) */
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;

    --leading-tight:   1.25;
    --leading-normal:  1.5;
    --leading-relaxed: 1.75;
    --tracking-tight: -0.025em;

    /* --- Spacing (4px base) --- */
    --sp-0:  0;
    --sp-px: 1px;
    --sp-0-5: 0.125rem;
    --sp-1:  0.25rem;
    --sp-1-5: 0.375rem;
    --sp-2:  0.5rem;
    --sp-3:  0.75rem;
    --sp-4:  1rem;
    --sp-5:  1.25rem;
    --sp-6:  1.5rem;
    --sp-8:  2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;
    --sp-20: 5rem;
    --sp-24: 6rem;

    /* --- Border Radius --- */
    --radius:      0.625rem;
    --radius-sm:   0.25rem;    /* Phil 23 Nov 2026: tighter corners (were 0.5, 0.625, 0.75 and 1rem) */
    --radius-md:   0.425rem;
    --radius-lg:   0.5rem;
    --radius-xl:   0.5rem;
    --radius-full: 9999px;

    /* --- Shadows --- */
    --shadow-xs:  0 1px 1px 0 rgb(26 33 58 / 0.05);
    --shadow-sm:  0 1px 2px 0 rgb(26 33 58 / 0.05);
    --shadow-md:  0 4px 6px -1px rgb(26 33 58 / 0.1), 0 2px 4px -2px rgb(26 33 58 / 0.1);
    --shadow-lg:  0 10px 15px -3px rgb(26 33 58 / 0.1), 0 4px 6px -4px rgb(26 33 58 / 0.1);
    --shadow-xl:  0 20px 25px -5px rgb(26 33 58 / 0.1), 0 8px 10px -6px rgb(26 33 58 / 0.1);

    /* --- Transitions --- */
    --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast:   150ms;
    --duration-normal: 200ms;
    --duration-slow:   300ms;
    /* The right panel opening and closing (Phil 15 Oct 2026: "a nice organic ramp (not a bounce)"): a critically damped
       spring as a curve, moving at once, easing into place and never past it; closing a little quicker */
    --ease-panel:           cubic-bezier(0.25, 0.25, 0.125, 1);
    --duration-panel:       280ms;
    --duration-panel-close: calc(var(--duration-panel) * 0.8);

    /* --- Layout --- */
    /* Fluid layout (2026): viewport-driven clamps, see fluid-type skill for the math */
    --sidebar-width:      clamp(13rem, 7rem + 6.6667vw, 15rem);  /* 208px @1440 -> 240px @1920 (Phil 2 Nov 2026). The floor is the foot's "(c) Penguin Boat Club 2.1.10": it needs 204px */
    --sidebar-width-icon: 4.5rem;    /* 72px folded: the logo badge and every icon keep their place */
    --sidebar-gap:        var(--sp-3);   /* the floating sidebar's inset from the window */
    --target-min:         max(44px, 2.75rem);   /* a row's height: 44px touch target (Apple HIG; WCAG 2.5.8 floor is 24px) */
    --header-height:      3.5rem;
    --content-max-width:  1680px;
    --content-pad:        clamp(1rem, 2.0833vw, 2.5rem);          /* 16px @768 -> 40px @1920 */
    --grid-gap:           clamp(0.75rem, 0.5rem + 0.5vw, 1.5rem); /* 12px -> 24px */
    --card-min:           clamp(11rem, 12.5vw, 15rem);           /* library card track: 176px -> 240px */

    /* --- Z-Index Scale --- */
    --z-dropdown:  50;
    --z-sticky:    100;
    --z-overlay:   200;
    --z-modal:     300;
    --z-popover:   400;
    --z-toast:     500;
    --z-tooltip:   600;

    /* --- Hover (ATOMIC, Phil 14 Oct 2026: "this needs to be a global reusable component/atomic style. so if you change
       one and improve it you update all of them"): every hover fill reads these; change them here, never per component.
       .pbc-hover draws the inset rounded fill (the size field's chevron); buttons and menu rows take --hover-fill. --- */
    --hover-fill:             var(--accent);
    --hover-fill-pressed:     var(--muted);
    --hover-fill-row:         rgba(26, 33, 58, 0.05);   /* a big row's hover (a menu row with an icon tile): a tint, never a block */
    --hover-radius:           6px;
    --hover-inset:            3px;
    /* --- Tooltip (ATOMIC, Phil 14 Oct 2026: "black background tool tip style like the new padding of the rotate icon"):
       .pbc-tip (tip.js) and the contextual toolbar's tips read these --- */
    --tip-bg:                 #000000;
    --tip-fg:                 #ffffff;
    --tip-ring:               transparent;
    --tip-radius:             8px;
    --tip-pad:                6px 10px;
    --tip-font:               var(--text-xs);
    /* every menu's down caret: the size field's chevron in the muted ink (one token for select.prop-input, select.input,
       .filter-select and the .select-caret component) */
    --select-chevron:         url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5069' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --form-field-ink:         #2563eb;   /* a fillable PDF form field: its Layers mark (the canvas tint is the same blue) */
}

/* --- Colors: Dark Theme (2026 brand: sand ink on navy) --- */
[data-theme="dark"] {
    --signin-surface:         #e2e2e3;   /* night keeps the old sand (the light theme's greys went 10%, then 20% twice more, toward white, 27 Nov 2026) */
    --tip-ring:               rgba(255, 255, 255, 0.14);   /* black on the navy UI: a hairline keeps its edge */
    --form-field-ink:         #8fb0ff;   /* 6.6:1 on the dark panel */
    --select-chevron:         url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8aec5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --hover-fill-row:         rgba(255, 255, 255, 0.05);
    /* DARK MODE IS NAVY, the 2026 brand (Phil 28 Oct 2026: "why is night mode black now? this is bad"; the straight black of
       25 Oct is gone): one token, --background, and the page body follows it (--page); the surfaces on it (cards, popovers,
       the sidebar) keep their own tones */
    --background:             #1a1f31;
    --page:                   #161923;   /* the page body behind the app's content, a step darker than --background (Phil 22 Nov 2026) */
    --foreground:             #d3d2cd;
    --card:                   #22293f;
    --card-foreground:        #d3d2cd;
    --popover:                #272e47;
    --popover-foreground:     #d3d2cd;
    --primary:                #d3d2cd;
    --primary-foreground:     #1a1f31;
    --secondary:              #2b324b;
    --secondary-soft:         #303854;
    --secondary-foreground:   #d3d2cd;
    --muted:                  #2b324b;
    --muted-foreground:       #a8aec5;   /* 4.6:1 on the hover fill --accent, 5.0:1 on --secondary-soft (#9aa0b9 read 3.9:1; Phil 25 Oct 2026) */
    --accent:                 #333c57;
    --accent-foreground:      #d3d2cd;
    --destructive:            hsl(0 63% 31%);
    --destructive-foreground: hsl(0 90% 85%);   /* lighter words on the brick-red fill: 5.9:1 (hsl 0 84% 70% read 3.5:1; Phil 25 Oct 2026) */
    --destructive-text:       hsl(0 85% 75%);   /* dark --destructive is a brick-red FILL; text on navy needs this (Phil, 6 Oct 2026) */
    --template-link:          hsl(265 75% 76%); /* on the navy card, 5:1 */
    --success:                hsl(142 71% 35%);
    --success-badge:          hsl(142 71% 42%); /* Approved / Active / Sent pills: navy ink reads 6:1 here, 4.3:1 on --success */
    --success-foreground:     #1a1f31; /* navy ink: white on this green read 2.2:1 (WCAG AA needs 4.5) */
    --warning:                hsl(38 92% 40%);
    --warning-foreground:     #1a1f31;   /* navy ink on the amber, as the green pills: 4.8:1 (white read 3.2:1; Phil 25 Oct 2026) */
    --border:                 #313852;
    --input:                  #717ca6;   /* a field's edge: 3.4:1 on the card, 3.1:1 on the popover (#3b4360 read 1.6:1) */
    --input-soft:             #3b4360;
    --ring:                   #7c86ad;

    --sidebar:                        #151a2a;
    --sidebar-foreground:             #d3d2cd;
    --sidebar-primary:                #d3d2cd;
    --sidebar-primary-foreground:     #1a1f31;
    --sidebar-accent:                 #2b324b;
    --sidebar-accent-foreground:      #d3d2cd;
    --sidebar-border:                 #313852;
    --sidebar-muted:                  #9aa0b9;

    --shadow-xs:  0 1px 1px 0 rgb(26 31 49 / 0.2);
    --shadow-sm:  0 1px 2px 0 rgb(26 31 49 / 0.3);
    --shadow-md:  0 4px 6px -1px rgb(26 31 49 / 0.4), 0 2px 4px -2px rgb(26 31 49 / 0.3);
    --shadow-lg:  0 10px 15px -3px rgb(26 31 49 / 0.5), 0 4px 6px -4px rgb(26 31 49 / 0.4);
    --shadow-xl:  0 20px 25px -5px rgb(26 31 49 / 0.6), 0 8px 10px -6px rgb(26 31 49 / 0.5);
}


/* ============================================================
   2. RESET & BASE
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    color: var(--foreground);
    background: var(--page, var(--background));
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img, svg {
    display: block;
    max-width: 100%;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    outline: none;
}

button {
    cursor: pointer;
}

table {
    border-collapse: collapse;
    width: 100%;
}

:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection {
    background: var(--primary);
    color: var(--primary-foreground);
}

/* Scrollbar base */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* where a vertical and a horizontal bar meet: the browser painted a white square there (Phil 14 Oct 2026: "this dot on
   bottom of editor scroll bar needs fixing"); it takes the surface behind it, as the tracks do */
::-webkit-scrollbar-corner {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}


/* ============================================================
   3. LAYOUT
   ============================================================ */

/* --- App Shell --- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: calc(var(--sidebar-width) + var(--sidebar-gap));   /* the floating sidebar and its inset; the page's own padding after it */
    transition: margin-left var(--duration-panel) var(--ease-panel);
}
.sidebar[data-folded] ~ .app-main { margin-left: calc(var(--sidebar-width-icon) + var(--sidebar-gap)); transition-duration: var(--duration-panel-close); }

/* --- The portal sidebar (Phil 31 Oct 2026; prototype portal-sidebar round 3 option 1, the floating look; js/shell/sidebar.js)
   A floating panel inset from the window on three sides with Phil's shadow and frosted glass (no grain: Phil 2 Nov 2026). Folding is a
   STATE on the aside (data-folded), never a redraw: the logo is clipped down to its badge, every icon keeps its place across
   (rows keep their 14px padding), the team row and the version line shrink away on the fold's own timing so the icons glide
   up with no gap under the badge or under Help (Phil 31 Oct 2026), labels fade out as it narrows and in once it has mostly
   opened (data-labels), and the aside clips while it moves (data-anim). A click on blank space folds or opens it
   (sidebar.js blankSpace). PBC's panel motion. */
.sidebar {
    --sb-pad-x: calc(var(--sp-3) + 2px);
    --sb-hover: color-mix(in srgb, var(--sidebar-accent) 45%, transparent);
    /* the panel's tone, set by eye and sampled (Phil 2 Nov 2026, once the grain went): --sb-fill at 72% over the blurred page shows
       as --sb-solid, one step darker than the page; the handle is opaque, so it takes --sb-solid to match */
    --sb-fill: #eeeeef;
    --sb-solid: #f1f1f1;
    --sb-rim: rgb(255, 255, 255);
    --sb-rim-soft: rgba(255, 255, 255, 0.15);
    /* Phil's shadow: a tight contact shadow, the lower lift wide and soft with a faint ambient spread, the 3px inset along
       the bottom like a key, and a hairline of light along the top and left rim for the glass */
    --sb-lift:
        rgba(0, 0, 0, 0.13) 0px 1px 3px,
        rgba(0, 0, 0, 0.08) 0px 0px 48px -4px,
        rgba(0, 0, 0, 0.03) 0px 32px 96px 0px;
    --sb-key: rgba(0, 0, 0, 0.2) 0px -3px 0px inset;
    --sb-shadow:
        var(--sb-lift),
        var(--sb-key),
        var(--sb-rim) 1px 1px 0px inset,
        var(--sb-rim-soft) 2px 2px 3px -1px inset;
    position: fixed;
    top: var(--sidebar-gap);
    left: var(--sidebar-gap);
    bottom: var(--sidebar-gap);
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    color: var(--sidebar-foreground);
    border: 1px solid var(--sidebar-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--sb-shadow);
    background: color-mix(in srgb, var(--sb-fill) 72%, transparent);   /* frosted glass: the panel colour at 72%, the page blurred behind it */
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    transition: width var(--duration-panel) var(--ease-panel);
}
[data-theme="dark"] .sidebar { --sb-fill: #171a24; --sb-solid: #181b28; --sb-rim: rgba(255, 255, 255, 0.22); --sb-rim-soft: rgba(255, 255, 255, 0.08); }   /* on navy a faint rim; white at half glared. Fill darker at night (Phil 22 Nov 2026, his value #171a24); the solid is that fill at 72% over the page (#1a1f31), so the edge handle still matches */
.sidebar[data-folded] { width: var(--sidebar-width-icon); transition-duration: var(--duration-panel-close); }
.sidebar[data-anim] { overflow: clip; }

.sidebar-header { display: flex; align-items: center; padding: var(--sp-3) var(--sp-3) var(--sp-2); flex-shrink: 0; }
.sidebar-home { display: block; flex: 1; min-width: 0; overflow: hidden; color: inherit; border-radius: var(--radius-sm); }
.sidebar-home:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* the 2026 masthead: the badge keeps its own navy, yellow and white; the words follow the sidebar ink. It never shrinks:
   folding clips it down to the badge */
.sidebar-mark { display: block; height: 3rem; width: auto; max-width: none; color: var(--sidebar-foreground); }
[data-theme="dark"] .sidebar-mark { color: #fff; }   /* the words are pure white at night (Phil 25 Nov 2026) */

.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-3); }
.sidebar[data-folded] .sidebar-nav { overflow: visible; }
.sidebar-footer {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; flex-shrink: 0;
    padding: var(--sp-2) var(--sp-3) var(--sp-3);
    border-bottom-left-radius: var(--radius-xl); border-bottom-right-radius: var(--radius-xl);
}
.sb-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.sb-icon { width: 1.25rem; height: 1.25rem; flex: none; max-width: none; }   /* the reset's svg max-width would shrink an icon in a folded row to nothing */

/* a row: icon and label (atom of the nav; the current page is filled, with aria-current) */
.sb-item {
    position: relative;
    display: flex; align-items: center; gap: var(--sp-3);
    width: 100%; min-height: var(--target-min); padding: 0 var(--sb-pad-x);
    border: 0; border-radius: var(--radius-sm); background: transparent;
    color: var(--sidebar-foreground); font: inherit; font-size: var(--text-sm); font-weight: 500; line-height: 1.25;
    text-align: start; text-decoration: none; cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-default);
}
.sb-item .sb-icon { color: var(--sidebar-muted); }
.sb-item:hover { background: color-mix(in srgb, var(--accent), var(--foreground) 6%); }   /* day: a step under the current page's 10% tile (Phil 22 Nov 2026: "can barely see hover state"; --sb-hover was --sidebar-accent at 45%) */
.sb-item:hover .sb-icon { color: var(--sidebar-foreground); }
.sb-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sb-item[aria-current="page"] { background: color-mix(in srgb, var(--accent), var(--foreground) 10%); color: var(--sidebar-primary); font-weight: 600; }   /* day: the tool rail's darker tile, no edge (Phil 22 Nov 2026: "needs to be darker but dont add the active border"); was --sidebar-accent #dedee0 on the #e2e2e3 panel */
.sb-item[aria-current="page"] .sb-icon { color: var(--sidebar-primary); }
/* night: the page you are on wears the tool rail's treatment, a dark well with the border colour as its edge (Phil 22 Nov 2026) */
[data-theme="dark"] .sb-item[aria-current="page"] { background: color-mix(in srgb, var(--accent), black 67%); box-shadow: inset 0 0 0 1px var(--border); }
/* night hovers go dark too, the same well without the edge: the edge comes only with the press that makes it current (Phil 22 Nov
   2026: "hover states are darker too and then the border appears on press for active states"); the rails follow below */
[data-theme="dark"] .sb-item:not([aria-current="page"]):hover { background: color-mix(in srgb, var(--accent), black 67%); }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-group { margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-1); color: var(--sidebar-muted); font-size: var(--text-xs); font-weight: 600; line-height: 1.33; }

/* Designs and Documents carry a small + at the row's end (New design, New document): on hover or keyboard focus, always on touch */
.sb-row { position: relative; }
.sb-row .sb-item { padding-right: calc(var(--sp-2) + 1.75rem); }
.sidebar[data-folded] .sb-row .sb-item { padding-right: var(--sb-pad-x); }
.sb-plus {
    position: absolute; top: 50%; right: var(--sp-2); transform: translateY(-50%);
    display: grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--sidebar-muted); cursor: pointer;
    opacity: 0; transition: opacity var(--duration-fast) var(--ease-default), background-color var(--duration-fast) var(--ease-default);
}
.sb-plus .sb-icon { width: 1.125rem; height: 1.125rem; }
.sb-row:is(:hover, :focus-within) .sb-plus { opacity: 1; }
.sb-plus:hover { background: var(--sidebar-accent); color: var(--sidebar-foreground); }
.sb-plus:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
@media (hover: none) { .sb-plus { opacity: 1; } }

/* the team heads the list: its name in 16 Semi Bold, a button opening the team menu for people with 2+ teams; no box, no arrows */
.sb-team {
    display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: var(--target-min);
    padding: var(--sp-1) var(--sp-2); border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
    color: var(--sidebar-foreground); font: inherit; text-align: start;
}
button.sb-team { cursor: pointer; }
button.sb-team:hover, button.sb-team[aria-expanded="true"] { background: var(--sb-hover); }
button.sb-team:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sb-team-name {
    flex: 1; min-width: 0; overflow: hidden; font-size: var(--text-base); font-weight: 600; line-height: 1.25;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;   /* a long name on two lines, the menu has it whole */
}
html[data-sb-switching] .sb-team { opacity: 0.6; cursor: progress; }

/* Find closes the list: looks like a field, opens the Find dialog (Ctrl+K, Cmd+K or /) */
.sb-find { border: 1px solid var(--sidebar-border); background: var(--card); color: var(--sidebar-muted); font-weight: 400; padding: 0 var(--sp-3) 0 calc(var(--sb-pad-x) - 1px); }
.sb-find:hover { background: var(--card); border-color: var(--sidebar-muted); }
.sb-find .sb-label { color: var(--sidebar-muted); }
.sb-kbd { padding: 0 var(--sp-1); border: 1px solid var(--sidebar-border); border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: var(--text-xs); color: var(--sidebar-muted); }
@media (hover: none), (pointer: coarse) { .sb-kbd { display: none; } }

/* Admin: in the foot while the work pages show; pressed, it rises to head the menu (a view transition shares its name across
   the two places) and the admin groups drop in 40 ms apart; pressed again they lift out last first, 30 ms apart, quicker
   than they came in, and only then does the row go back down */
.sb-view-title { margin: 0 0 var(--sp-2); font: inherit; }
.sb-admin { view-transition-name: sb-admin; }
::view-transition-group(sb-admin) { animation-duration: var(--duration-panel); animation-timing-function: var(--ease-panel); }
.sb-admin[aria-expanded="true"] { background: var(--sidebar-accent); color: var(--sidebar-primary); font-weight: 600; }
.sb-admin[aria-expanded="true"] .sb-icon { color: var(--sidebar-primary); }
.sb-chev { margin-left: auto; transform: scaleX(-1); }   /* pressing it goes back to the menu (Phil 2 Nov 2026) */
/* folded, Admin's menu stays and the chevron takes the gear's place (the row's own fades with the label) */
.sb-admin-ico { display: inline-grid; flex: none; }
.sb-admin-ico > .sb-icon { grid-area: 1 / 1; transition: opacity 260ms var(--ease-default); }
.sb-admin-back { opacity: 0; transform: scaleX(-1); }
.sidebar[data-folded] .sb-admin-back { opacity: 1; }
.sidebar[data-folded] .sb-admin[aria-expanded="true"] .sb-admin-ico > .sb-icon:first-child { opacity: 0; }
.sb-view[data-view="admin"] .sb-group { padding-left: var(--sp-3); }
/* backwards, not both: a fill left on a row keeps it a stacking context, and the edge handle then draws over the row's rail tooltip (Phil 2 Nov 2026) */
.sb-view[data-view="admin"][data-enter="forward"] > * { animation: sb-drop var(--duration-normal) var(--ease-default) backwards; animation-delay: calc(120ms + var(--i, 0) * 40ms); }
.sb-view[data-view="admin"][data-leave] > * { animation: sb-lift 150ms cubic-bezier(0.4, 0, 1, 1) both; animation-delay: calc((var(--n) - 1 - var(--i, 0)) * 30ms); }
.sb-view[data-enter="back"] { animation: sb-in-back var(--duration-normal) var(--ease-default); }
@keyframes sb-drop { from { transform: translateY(-0.75rem); opacity: 0; } }
@keyframes sb-lift { to { transform: translateY(-0.75rem); opacity: 0; } }
@keyframes sb-in-back { from { transform: translateX(-2rem); opacity: 0; } }
.sb-version { margin: 0; padding: var(--sp-1) var(--sp-3) 0; color: var(--sidebar-muted); font-size: var(--text-xs); line-height: 1.5; overflow: hidden; white-space: nowrap; height: calc(var(--text-xs) * 1.5 + var(--sp-1)); }

/* folding: labels and the + fade, never jump. The team row is a grid row that eases from 1fr (its own height) to 0fr, its
   wrap clipping it, and the version line eases its height to 0, both on the width's timing, so the icons glide up together
   instead of jumping; hidden once shrunk, shown at once on opening */
.sidebar :is(.sb-label, .sb-team-name, .sb-kbd, .sb-version, .sb-plus, .sb-chev, .sb-group) { white-space: nowrap; transition: opacity 260ms var(--ease-default); }
.sidebar .sb-team-name { white-space: normal; }
.sidebar[data-labels] :is(.sb-label, .sb-team-name, .sb-kbd, .sb-version, .sb-plus, .sb-chev, .sb-group) { opacity: 0; transition-duration: 200ms; }
.sidebar[data-folded] :is(.sb-label, .sb-team-name, .sb-kbd, .sb-version, .sb-plus, .sb-chev, .sb-group) { opacity: 0; }   /* a group's heading keeps its height: the gap sets the groups apart and no icon moves */
.sidebar[data-folded]:not([data-anim]) :is(.sb-item .sb-label, .sb-kbd) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.sidebar[data-folded] .sb-plus { visibility: hidden; }
/* (after the fades, so these transition lists win over the 200 ms one while data-labels is on) */
.sb-view[data-view="work"] { grid-template-rows: 1fr; transition: grid-template-rows var(--duration-panel) var(--ease-panel); }
.sb-team-wrap { min-width: 0; overflow: hidden; }
.sidebar .sidebar-footer .sb-version { transition: opacity 260ms var(--ease-default), height var(--duration-panel) var(--ease-panel), padding var(--duration-panel) var(--ease-panel), visibility 0s; }
.sidebar[data-labels] .sidebar-footer .sb-version { transition-duration: 200ms, var(--duration-panel), var(--duration-panel), 0s; }
.sidebar[data-folded] .sb-view[data-view="work"] { grid-template-rows: 0fr; transition-duration: var(--duration-panel-close); }
.sidebar[data-folded] .sb-team-wrap { visibility: hidden; transition: visibility 0s linear var(--duration-panel-close); }
.sidebar[data-folded] .sidebar-footer .sb-version { height: 0; padding-top: 0; visibility: hidden; transition: opacity 200ms var(--ease-default), height var(--duration-panel-close) var(--ease-panel), padding var(--duration-panel-close) var(--ease-panel), visibility 0s linear var(--duration-panel-close); }

/* the folded rail's tooltips: always drawn, hidden; they rise 4px into place as they fade in after a 120 ms pause (so
   sweeping the rail does not flicker them all) and sink 4px as they fade out at once */
.sidebar[data-folded]:not([data-anim]) .sb-item[data-tip]::after {
    content: attr(data-tip);
    position: absolute; left: calc(100% + var(--sp-2)); top: 50%; transform: translateY(calc(-50% + 0.25rem));
    padding: 6px 12px; border-radius: var(--radius-sm);
    background: var(--primary); color: var(--primary-foreground); white-space: nowrap; z-index: 30;
    font-size: var(--text-xs); font-weight: 600; line-height: 1.3; box-shadow: var(--shadow-md); pointer-events: none;
    opacity: 0; visibility: hidden;
    transition: opacity 120ms cubic-bezier(0.4, 0, 1, 1), transform 120ms cubic-bezier(0.4, 0, 1, 1), visibility 0s linear 120ms;
}
.sidebar[data-folded]:not([data-anim]) .sb-item[data-tip][popovertarget][aria-expanded="true"]::after { opacity: 0; visibility: hidden; transition: none; }   /* its menu is open */
.sidebar[data-folded]:not([data-anim]) .sb-item[data-tip]:not([aria-expanded="true"]):is(:hover, :focus-visible)::after {
    opacity: 1; visibility: visible; transform: translateY(-50%);
    transition: opacity 180ms var(--ease-default) 120ms, transform 180ms var(--ease-default) 120ms, visibility 0s linear 120ms;
}

/* the edge handle on the sidebar's border (no fold button): a 24px strip astride the edge with the three-dot notch at
   mid-height whenever the pointer is in the sidebar; the notch grows on hover and takes the ring colour on keyboard focus.
   No lit outline down the edge (Phil 31 Oct 2026: removed once a click on blank space folded it too) */
.sb-edge {
    position: absolute; top: 0; bottom: 0; right: -12px; z-index: 5; width: 24px; padding: 0;
    border: 0; background: transparent; color: var(--sidebar-muted); cursor: pointer;   /* a press folds or opens it; a resize cursor promised a drag it does not have (Phil 2 Nov 2026) */
}
.sb-edge:focus-visible { outline: none; }
.sb-edge-tab {
    position: absolute; top: 50%; left: 12px;
    display: grid; place-items: center; width: 1rem; height: 2.5rem;
    border: 1px solid var(--sidebar-border); border-left: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--sb-solid); color: inherit;
    /* the sidebar's own lift and key, with the light rim along the top only: its left side joins the sidebar (Phil 2 Nov 2026) */
    box-shadow: var(--sb-lift), var(--sb-key), var(--sb-rim) 0px 1px 0px inset, var(--sb-rim-soft) 0px 2px 3px -1px inset;
    /* it slides out from the sidebar's edge (Phil 2 Nov 2026): tucked one width to the left, with the same distance clipped off
       its left on the same timing, so nothing shows inside the sidebar and it never fades or blinks in. The clip leaves room for
       its shadow above, below and to the right once out, and none while tucked */
    transform: translate(-100%, -50%); transform-origin: left center; clip-path: inset(-120px 0 -120px 100%);
    transition: transform var(--duration-panel-close) var(--ease-panel), clip-path var(--duration-panel-close) var(--ease-panel),
        background-color var(--duration-fast) var(--ease-default), border-color var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default);
}
/* three dots in rem, so they scale with the tab on PBC's fluid type */
.sb-edge-tab::before { content: ''; width: 0.1875rem; height: 0.1875rem; border-radius: 50%; background: currentColor; box-shadow: 0 -0.375rem 0 currentColor, 0 0.375rem 0 currentColor; }
/* out when the pointer is in the sidebar or the handle has focus; tucked away while the sidebar folds, so it comes out again after */
.sidebar:not([data-anim]):hover .sb-edge-tab, .sidebar:not([data-anim]) .sb-edge:focus-visible .sb-edge-tab {
    transform: translate(0, -50%); clip-path: inset(-120px -120px -120px 0);
    transition-duration: 360ms, 360ms, var(--duration-fast), var(--duration-fast), var(--duration-fast);
    transition-timing-function: var(--ease-default);
}
/* on the handle it grows 20% out from the edge and eases back when the pointer moves off: slow and even, no overshoot (Phil 2 Nov 2026) */
.sidebar:not([data-anim]) .sb-edge:hover .sb-edge-tab {
    transform: translate(0, -50%) scale(1.2);
    transition-duration: 300ms, 300ms, var(--duration-fast), var(--duration-fast), var(--duration-fast);
}
.sb-edge:focus-visible { color: var(--ring); }   /* the notch takes the button's own colour, so the handle itself shows focus with the outline */
.sb-edge:focus-visible .sb-edge-tab { background: currentColor; border-color: currentColor; }
.sb-edge:focus-visible .sb-edge-tab::before { background: var(--sidebar); box-shadow: 0 -0.375rem 0 var(--sidebar), 0 0.375rem 0 var(--sidebar); }
@media (hover: none) { .sidebar:not([data-anim]) .sb-edge-tab { transform: translate(0, -50%); clip-path: inset(-120px -120px -120px 0); } }
/* the tooltip: what a click does, the key under it in 11px regular. Mid-height, since CSS cannot follow the pointer */
.sb-edge-tip {
    position: absolute; top: 50%; left: calc(100% + var(--sp-3)); transform: translateY(calc(-50% + 0.25rem)); z-index: 30;
    display: grid; padding: 6px 12px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-foreground);
    font-family: var(--font-sans); text-align: start; white-space: nowrap; box-shadow: var(--shadow-md); pointer-events: none;
    opacity: 0; visibility: hidden;
    transition: opacity 120ms cubic-bezier(0.4, 0, 1, 1), transform 120ms cubic-bezier(0.4, 0, 1, 1), visibility 0s linear 120ms;
}
.sb-edge:is(:hover, :focus-visible) .sb-edge-tip {
    opacity: 1; visibility: visible; transform: translateY(-50%);
    transition: opacity 180ms var(--ease-default) 120ms, transform 180ms var(--ease-default) 120ms, visibility 0s linear 120ms;
}
.sb-edge-tip b { font-size: var(--text-xs); font-weight: 600; line-height: 1.3; }
.sb-edge-tip kbd { font: inherit; font-size: var(--text-2xs); font-weight: 400; line-height: 1.4; opacity: 0.85; }

/* menus from the sidebar (team, Admin on the rail, Help and info): native popovers placed by sidebar.js; items Semi Bold 12,
   even 40px rows (Phil's Figma change) */
.sb-menu {
    position: fixed; inset: auto; margin: 0; padding: var(--sp-1);
    min-width: 15rem; max-width: min(22rem, calc(100vw - 2 * var(--sp-4)));
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-lg);
    font-family: var(--font-sans); font-size: var(--text-sm);
}
.sb-menu-label { margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-1); color: var(--muted-foreground); font-size: var(--text-xs); font-weight: 600; }
.sb-menu-sep { height: 1px; margin: var(--sp-1) 0; background: var(--border); }
.sb-menu-item {
    display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 2.5rem; padding: var(--sp-2) var(--sp-3);
    border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; text-align: start; text-decoration: none; cursor: pointer;
    font: inherit; font-size: var(--text-xs); font-weight: 600;
}
.sb-menu-item + .sb-menu-item, .sb-menu-list > .sb-menu-item + .sb-menu-item { margin-top: 2px; }
.sb-menu-item:hover, .sb-menu-item:focus-visible { background: var(--hover-fill); outline: none; }
.sb-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.sb-menu-item[hidden] { display: none; }
.sb-menu-item > .sb-icon:last-child:not(:first-child) { margin-left: auto; }
.sb-menu-meta { margin: 0; padding: var(--sp-2) var(--sp-3); color: var(--muted-foreground); font-size: var(--text-xs); line-height: 1.5; }
/* a one-line text field that is not a form <input> (password managers attach only to inputs): the caret on the text's line */
.sb-line { display: block; white-space: nowrap; overflow: hidden; outline: none; cursor: text; }
.sb-line:empty::before { content: attr(data-placeholder); color: var(--muted-foreground); pointer-events: none; }
.sb-menu-filter {
    width: calc(100% - 2 * var(--sp-1)); height: 2.5rem; line-height: calc(2.5rem - 2px); margin: 0 var(--sp-1) var(--sp-2); padding: 0 var(--sp-3);
    border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--card); color: var(--foreground); font-size: var(--text-sm);
}
.sb-menu-filter:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }

/* Find: a combobox over a grouped listbox (WAI-ARIA APG) in a modal dialog. Spacious and short (Phil 2 Nov 2026, "spacious and
   approachable"; NN/g progressive disclosure, Baymard on autocomplete): it opens on a few rows with no scrollbar, text is regular weight,
   rows are 44 px, no extra rules, and the lit row is a soft fill with the Enter key beside it */
.sb-find-dlg {
    width: min(40rem, calc(100vw - 2 * var(--sp-4))); max-height: min(36rem, 80dvh); margin: 14dvh auto auto; padding: 0; overflow: hidden;
    border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-lg);
}
.sb-find-dlg[open] { display: flex; flex-direction: column; }
.sb-find-dlg::backdrop { background: color-mix(in srgb, var(--background) 55%, transparent); }
.sb-find-field { display: flex; flex: none; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5); }
.sb-find-field > .sb-icon { color: var(--muted-foreground); }
.sb-find-q { flex: 1; min-width: 0; height: 3.75rem; line-height: 3.75rem; color: inherit; font-size: var(--text-base); }   /* one line box the row's height, so the caret sits on the text's line */
.sb-find-back { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; margin-left: calc(var(--sp-2) * -1); padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); cursor: pointer; }
.sb-find-back[hidden] { display: none; }
.sb-find-back .sb-icon { transform: scaleX(-1); }
.sb-find-back:hover { background: var(--hover-fill); color: var(--popover-foreground); }
.sb-find-back:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sb-find-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--sp-3) var(--sp-3); }
.sb-find-group + .sb-find-group { margin-top: var(--sp-3); }
.sb-find-group .sb-menu-label { padding: var(--sp-2) var(--sp-2) var(--sp-1); font-weight: 500; }
.sb-opt, .sb-opt-wait { display: flex; align-items: center; gap: var(--sp-3); min-height: 2.75rem; padding: 0 var(--sp-2); border-radius: var(--radius-md); }
.sb-opt { font-size: var(--text-sm); font-weight: 400; cursor: pointer; }
.sb-opt > .sb-icon { width: 1.125rem; height: 1.125rem; color: var(--muted-foreground); }
.sb-opt-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-match { background: transparent; color: inherit; font-weight: 600; }
.sb-hint { flex: none; color: var(--muted-foreground); font-size: var(--text-xs); font-weight: 400; }
.sb-opt-go { flex: none; visibility: hidden; font-family: inherit; font-size: var(--text-sm); color: var(--muted-foreground); }
.sb-opt:hover, .sb-opt:focus-visible { background: transparent; }
.sb-opt[aria-selected="true"] { background: var(--hover-fill); }
.sb-opt[aria-selected="true"] > .sb-icon { color: inherit; }
.sb-opt[aria-selected="true"] .sb-opt-go { visibility: visible; color: inherit; }   /* says which row Enter opens, in full contrast: the fill alone is too faint to carry it (WCAG 1.4.11) */
.sb-opt-wait i { flex: none; width: 1.125rem; height: 1.125rem; border-radius: var(--radius-sm); background: var(--hover-fill); }
.sb-opt-wait b { display: block; width: 40%; height: 0.75rem; border-radius: var(--radius-sm); background: var(--hover-fill); }
.sb-opt-wait:nth-of-type(2) b { width: 55%; }
.sb-opt-wait:nth-of-type(3) b { width: 32%; }
.sb-find-none { margin: 0; padding: var(--sp-6) var(--sp-3) var(--sp-8); color: var(--muted-foreground); font-size: var(--text-sm); text-align: center; }
.sb-find-more { margin: var(--sp-2) 0 0; padding: 0 var(--sp-2); color: var(--muted-foreground); font-size: var(--text-xs); }
.sb-find-foot { display: flex; flex: none; gap: var(--sp-4); margin: 0; padding: var(--sp-3) var(--sp-5); color: var(--muted-foreground); font-size: var(--text-xs); }
.sb-find-foot kbd { display: inline-block; min-width: 1.25rem; margin-right: 2px; padding: 0 var(--sp-1); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; font-size: inherit; text-align: center; }
@media (hover: none), (pointer: coarse) { .sb-find-foot { display: none; } }
@media (max-width: 47.99rem) { .sb-find-dlg { margin-top: var(--sp-4); max-height: calc(100dvh - 2 * var(--sp-4)); } .sb-find-field { padding: 0 var(--sp-4); } .sb-opt { min-height: 3rem; } }

/* the phone (under 768 px): a bottom bar (Material 3 navigation bar, Apple's tab bar), New document as a worded floating button,
   and More as a bottom sheet; the team and Find in the header */
.sb-phone, .sb-phone-lead { display: none; }
.sb-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-sticky);
    display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-2) calc(var(--sp-1) + env(safe-area-inset-bottom));
    background: var(--sidebar); border-top: 1px solid var(--sidebar-border);
}
.sb-bar-item {
    display: grid; justify-items: center; align-content: center; gap: var(--sp-1); width: 100%; min-height: 3.5rem; padding: var(--sp-1) 0;
    border: 0; border-radius: var(--radius-md); background: transparent; color: var(--sidebar-foreground);
    font: inherit; font-size: var(--text-xs); font-weight: 500; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer;
}
.sb-bar-item .sb-icon { width: 1.5rem; height: 1.5rem; color: var(--sidebar-muted); }
.sb-bar-item:hover { background: var(--sb-hover, color-mix(in srgb, var(--sidebar-accent) 45%, transparent)); }
.sb-bar-item:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sb-bar-item[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-primary); font-weight: 600; }
.sb-bar-item[aria-current="page"] .sb-icon { color: var(--sidebar-primary); }
.btn.sb-fab {
    position: fixed; right: var(--sp-4); bottom: calc(5rem + env(safe-area-inset-bottom)); z-index: calc(var(--z-sticky) + 1);
    height: auto; min-height: 3.5rem; padding: 0 var(--sp-4); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    background: var(--primary); color: var(--primary-foreground);
}
.btn.sb-fab .sb-icon { width: 1.25rem; height: 1.25rem; }
.sb-sheet {
    margin: auto 0 0; width: 100%; max-width: none; max-height: 85dvh; padding: var(--sp-4);
    border: 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; background: var(--sidebar); color: var(--sidebar-foreground);
}
.sb-sheet::backdrop { background: color-mix(in srgb, var(--background) 60%, transparent); }
.sb-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.sb-sheet-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: var(--text-xl); color: var(--sidebar-foreground); }
.sb-sheet-sec { display: grid; gap: 2px; }
.sb-sheet-sec + .sb-sheet-sec { margin-top: var(--sp-3); }
.sb-sheet .sb-item { --sb-pad-x: var(--sp-3); }
.sb-sheet .sb-item:hover { background: color-mix(in srgb, var(--sidebar-accent) 45%, transparent); }
.sb-phone-team { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 var(--sp-1); border: 0; border-radius: var(--radius-sm); background: transparent; }
button.sb-phone-team { cursor: pointer; }
button.sb-phone-team:hover { background: var(--hover-fill); }
button.sb-phone-team:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; }
/* the team's monogram: the brand yellow with navy ink, a pill when the name is long (NZDSA) */
.sb-mono { display: inline-grid; place-items: center; min-width: 2.25rem; height: 2.25rem; padding: 0 var(--sp-1); border-radius: var(--radius-sm); background: var(--brand-yellow); color: var(--brand-navy); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.02em; }
.btn.sb-phone-find, .sb-sheet-head .btn { width: 44px; height: 44px; }   /* 44px targets on a phone */

@media (prefers-reduced-motion: reduce) {
    .sidebar, .app-main, .sidebar :is(.sb-label, .sb-team-name, .sb-kbd, .sb-version, .sb-plus, .sb-chev, .sb-team-wrap, .sb-edge-tab), .sb-view { transition: none !important; }
    .sb-view[data-enter], .sb-view[data-enter] > *, .sb-view[data-leave] > * { animation: none; }
    .sidebar[data-folded] .sb-item[data-tip]::after { transform: translateY(-50%); }
}

/* --- Header Bar --- */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--content-pad);
    border-bottom: none;   /* 2026: quiet utility bar on the page tint */
    background: transparent;
    flex-shrink: 0;
}

/* 2026: the page's own Georgia title is the only heading; the header
   bar keeps just the team badge and account menu on the right */
.header-bar .breadcrumb { display: none; }

.header-left {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
/* the page's buttons, left of the avatar (Phil 26 Nov 2026): they arrive with their page and leave with it */
.header-actions { display: flex; align-items: center; gap: var(--sp-2); margin-right: var(--sp-2); transition: opacity 90ms var(--ease-default); }
.header-actions:not(:has(.page-actions)) { display: none; }
.header-actions-slot { display: contents; }
.header-actions .page-actions { animation: pbc-screen-in 240ms var(--ease-panel); }
.app-main:has(.pbc-screen.is-leaving) .header-actions { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .header-actions { transition: none; } .header-actions .page-actions { animation: none; } }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    min-width: 0;
}

.breadcrumb-item,
.breadcrumb-link,
.breadcrumb-current {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-link {
    color: var(--muted-foreground);
    text-decoration: none;
    cursor: pointer;
}

.breadcrumb-link:hover {
    color: var(--foreground);
}

.breadcrumb-item:last-child,
.breadcrumb-current {
    color: var(--foreground);
    font-weight: 600;
}

.breadcrumb-sep {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.breadcrumb-sep svg {
    width: 16px;
    height: 16px;
}

/* User avatar dropdown */

.user-menu {
    position: relative;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--primary-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--duration-fast) var(--ease-default);
}

.user-avatar:hover {
    opacity: 0.9;
}
/* Something to read in the account menu (terms to accept): a green dot at the avatar's top right */
.user-avatar { position: relative; }
.user-avatar.has-notice::after {
    content: ''; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--success, #16a34a); box-shadow: 0 0 0 2px var(--background);
}
#user-menu .dropdown-content { min-width: 15rem; }
.terms-dialog { max-width: 40rem; width: calc(100vw - 32px); display: flex; flex-direction: column; overflow: hidden; }
.terms-dialog .dialog-body { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 0; flex: 1 1 auto; }
.terms-dialog-body { max-height: min(55vh, 32rem); margin: 0; border: 1px solid var(--border); }
.terms-dialog .terms-agree { margin: 0; color: var(--foreground); }
.terms-dialog .terms-error { color: var(--destructive-text); }
.terms-dialog-footer { display: flex; align-items: center; gap: var(--sp-2); }
/* Notifications (notices.js, 2.0.38; the "Inbox drawer" picked in the prototype, Phil 9 Oct 2026). One row in the
   avatar menu with its count; the drawer from the right; Admin > Notifications list + detail, composer with a live preview. */
.notif-menu-row .notif-pill { margin-left: auto; padding: 0 var(--sp-2); border-radius: 999px; font-size: var(--text-xs); font-weight: 600; line-height: 1.6;
    background: color-mix(in srgb, var(--success) 22%, var(--popover)); color: var(--foreground); }
.notif-scrim { position: fixed; inset: 0; z-index: calc(var(--z-popover) + 10); background: color-mix(in srgb, var(--foreground) 22%, transparent); }
.notif-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: calc(var(--z-popover) + 11); width: min(24rem, 100vw);
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--popover); color: var(--foreground);
    border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(16px); opacity: 0;
    transition: transform var(--duration-normal, 200ms) var(--ease-default, ease), opacity var(--duration-normal, 200ms) var(--ease-default, ease); }
.notif-drawer.is-open { transform: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .notif-drawer { transition: none; } }
/* the head is the editor's panel header: 14px title, actions right, X far right */
.notif-drawer-head { display: flex; align-items: center; gap: var(--sp-1); min-height: 3rem; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--border); }
.notif-drawer-head h2 { flex: 1; margin: 0; font-size: var(--text-sm); font-weight: 600; }
.notif-drawer-head:has([data-back]) { padding-left: var(--sp-2); gap: var(--sp-2); }
.notif-textbtn { border: 0; padding: var(--sp-1) var(--sp-2); background: none; color: var(--foreground); font: inherit; font-size: var(--text-xs);
    text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer; border-radius: var(--radius-sm); }
.notif-textbtn:hover { background: var(--accent); }
.notif-drawer-body { overflow-y: auto; padding: var(--sp-2); }
.notif-group { margin: 0; padding: var(--sp-3) var(--sp-3) var(--sp-1); font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); }
.notif-none { margin: 0; padding: var(--sp-6) var(--sp-3); color: var(--muted-foreground); font-size: var(--text-sm); }
.notif-item { display: grid; grid-template-columns: 0.75rem minmax(0, 1fr); gap: 2px var(--sp-2); width: 100%; padding: var(--sp-3); border: 0;
    border-radius: var(--radius-md); background: none; color: var(--foreground); font: inherit; text-align: left; cursor: pointer; }
button.notif-item:hover { background: var(--accent); }
.notif-item-dot { width: 0.5rem; height: 0.5rem; margin-top: 0.4em; border-radius: 50%; background: var(--success); }
.notif-item.is-read .notif-item-dot { visibility: hidden; }
.notif-item-t { font-size: var(--text-sm); font-weight: 600; line-height: 1.35; }
.notif-item.is-read .notif-item-t { font-weight: 400; }
.notif-item-m { grid-column: 2; font-size: var(--text-xs); color: var(--muted-foreground); }
.notif-read { padding: var(--sp-2) var(--sp-3); }
.notif-read h3 { margin: 0; font-size: var(--text-lg); font-weight: 600; line-height: 1.3; }
.notif-read-m { margin: var(--sp-1) 0 var(--sp-4); font-size: var(--text-xs); color: var(--muted-foreground); }
.notif-read .notif-read-b, .notif-live-msg .notif-read-b { padding: 0; border: 0; max-height: none; background: none; font-size: var(--text-sm); }
.notif-drawer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3); border-top: 1px solid var(--border); }
.notif-step, .notif-acts { display: flex; align-items: center; gap: var(--sp-1); }
.notif-acts { gap: var(--sp-2); margin-left: auto; }
.notif-done { font-size: var(--text-xs); color: var(--muted-foreground); }
/* Admin > Notifications ("By status", prototype round 5, Phil 9 Oct 2026: "uses the pbc design system and components and is
   tidier"): three short lists by status, a page per notification, the form in PBC's permission rows with the preview beside. */
.notif-tabs { margin-bottom: var(--sp-5); }
.notif-tabs .tab-trigger { text-decoration: none; }
.notif-panel { container: notif / inline-size; }
.notif-loading { display: flex; align-items: center; gap: var(--sp-2); }
.notif-empty { max-width: 72rem; }
/* By email too (notices.js): the preview link under the tick, and the email itself in a wide dialog */
.notif-kicker { margin-top: var(--sp-4); margin-bottom: 0; }
.notif-email-prev { margin-top: var(--sp-2); }
.notif-email-dialog .dialog { max-width: 46rem; }
.notif-email-frame { display: block; width: 100%; height: min(70vh, 760px); margin-top: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: #e9e9ea; }
.notif-sec + .notif-sec { margin-top: var(--sp-8); }
.notif-sec-h { display: flex; align-items: baseline; gap: var(--sp-2); margin: 0 0 var(--sp-2); font-size: var(--text-base); font-weight: 600; }
.notif-sec-h span { font-size: var(--text-sm); font-weight: 400; color: var(--muted-foreground); }
.notif-cols, .notif-row { display: grid; grid-template-columns: minmax(0, 1fr) 11rem 6rem 6rem 1rem; gap: var(--sp-4); align-items: center; }
.notif-cols { padding: 0 var(--sp-3) var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); }
.notif-rows { border-bottom: 1px solid var(--border); }
.notif-row { width: 100%; padding: var(--sp-3); border: 0; border-top: 1px solid var(--border); background: none; color: var(--foreground);
    font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.notif-row:hover { background: var(--accent); }
.notif-row:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.notif-row-t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-row-to { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-row-n { font-variant-numeric: tabular-nums; }
.notif-row svg { color: var(--muted-foreground); }
@container notif (max-width: 40rem) {
    .notif-cols, .notif-row { grid-template-columns: minmax(0, 1fr) 5.5rem 1rem; }
    .notif-cols .notif-row-to, .notif-row .notif-row-to, .notif-cols .notif-row-n:nth-child(3), .notif-row .notif-row-n:nth-of-type(3) { display: none; }
}
.notif-page { display: grid; gap: var(--sp-4); }
.notif-back { display: inline-flex; align-items: center; gap: var(--sp-1); justify-self: start; min-height: 24px; padding: 0; border: 0; background: none;
    color: var(--foreground); font: inherit; font-size: var(--text-sm); cursor: pointer; }
.notif-back:hover { text-decoration: underline; text-underline-offset: 0.15em; }
.notif-page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.notif-page-t { margin: 0; font-size: var(--text-xl); font-weight: 600; line-height: 1.3; }
.notif-page-m { margin: var(--sp-1) 0 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.notif-page-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.notif-page-grid { display: grid; gap: var(--sp-5); }
@container notif (min-width: 52rem) {
    .notif-page-grid { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
    .notif-page-grid > aside { position: sticky; top: var(--sp-4); }
}
.notif-stats { display: flex; flex-wrap: wrap; gap: var(--sp-6); align-items: end; }
.notif-stat { display: grid; gap: var(--sp-1); min-width: 7rem; font-size: var(--text-xs); color: var(--muted-foreground); }
.notif-stat b { color: var(--foreground); font-weight: 600; }
.notif-stat-bar { display: block; height: 4px; border-radius: 999px; background: var(--accent); overflow: hidden; }
.notif-stat-bar i { display: block; height: 100%; width: var(--pct); background: var(--primary); }
.notif-prev, .notif-live { display: grid; gap: var(--sp-2); align-content: start; padding: var(--sp-4); border: 1px dashed var(--border); border-radius: var(--radius-md); background: var(--accent); color: var(--foreground); }
.notif-prev-l { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.notif-prev-btn { justify-self: start; display: inline-block; padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-md);
    background: var(--primary); color: var(--primary-foreground); font-size: var(--text-xs); font-weight: 600; }
.notif-live-btns { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.notif-live-row { padding: var(--sp-1); border-radius: var(--radius-md); background: var(--popover); border: 1px solid var(--border); }
.notif-live-row .notif-item { cursor: default; }
.notif-live-msg { display: grid; gap: var(--sp-2); padding: var(--sp-3); border-radius: var(--radius-md); background: var(--popover); border: 1px solid var(--border); font-size: var(--text-sm); }
/* the terms box's own white, fixed ink and height stay with the terms: a notification's text reads in the surface it sits on */
.notif-prev .notif-prev-b, .notif-live-msg .notif-read-b, .notif-read .notif-read-b { min-height: 0; margin-top: 0; padding: 0; border: 0; max-height: none;
    background: none; color: inherit; font-size: var(--text-sm); }
.notif-form { padding: var(--sp-6); }
.notif-form .form-group { margin-bottom: var(--sp-3); }
.notif-form .label { display: flex; align-items: center; gap: var(--sp-1); min-height: 24px; }
.notif-text { resize: vertical; min-height: 8rem; font: inherit; line-height: 1.5; }
.notif-date { max-width: 12rem; }
.notif-picks { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin-top: var(--sp-2); font-size: var(--text-sm); color: var(--foreground); }
.notif-pick-i { display: inline-flex; align-items: center; gap: var(--sp-1-5); min-height: 24px; cursor: pointer; }
.notif-pick-people { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); }
.notif-people { display: flex; flex-direction: column; max-height: 12rem; overflow-y: auto; padding: var(--sp-1) var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--foreground); }
.notif-picks[hidden], .notif-pick-people[hidden], .notif-act[hidden], .notif-people [hidden] { display: none; }
.notif-act { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--sp-2); margin-top: var(--sp-2); }
.notif-form .form-error { margin: var(--sp-3) 0 0; }
.notif-bar { position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding: var(--sp-3) 0;
    background: var(--page, var(--background)); border-top: 1px solid var(--border); }
.notif-bar-gap { flex: 1; }
.notif-drawer .terms-error { color: var(--destructive-text); margin: 0; }
.terms-dialog .terms-error { color: var(--destructive-text); margin: 0; }
.notif-who { min-width: 0; overflow-x: auto; }
@media (max-width: 640px) { .notif-act { grid-template-columns: 1fr; } }
.terms-dialog-footer .terms-note { margin-right: auto; color: var(--muted-foreground); }

/* --- Content Area --- */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--content-pad);
    background: var(--page, var(--background));
}

.content-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* Page header (title + actions) */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
    gap: var(--sp-4);
}

.page-title {
    font-family: var(--font-display);
    font-size: clamp(1.625rem, 1.2083rem + 0.8681vw, 2.25rem); /* 26px @768 -> 36px @1920 */
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.1;
    color: var(--foreground);
}

.page-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin-top: var(--sp-1);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}


/* ============================================================
   4. COMPONENTS
   ============================================================ */

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    white-space: nowrap;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    height: 36px;
    padding: 0 var(--sp-4);
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default),
                border-color var(--duration-fast) var(--ease-default),
                opacity var(--duration-fast) var(--ease-default);
    cursor: pointer;
    -webkit-user-select: none; user-select: none;
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Default variant */
.btn-default,
.btn {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-default:hover,
.btn:not([class*="btn-"]):hover {
    opacity: 0.9;
}

/* Destructive */
.btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-destructive:hover {
    opacity: 0.9;
}

/* Outline */
.btn-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

/* Secondary */
.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover {
    background: var(--accent);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

/* Link */
.btn-link {
    background: transparent;
    color: var(--primary);
    padding: 0;
    height: auto;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Button sizes */
.btn-sm {
    height: 32px;
    padding: 0 var(--sp-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    height: 40px;
    padding: 0 var(--sp-6);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 40px;
    height: 40px;
}

/* --- Inputs --- */
.input {
    display: flex;
    height: 36px;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: transparent;
    padding: 0 var(--sp-3);
    font-size: var(--text-sm);
    color: var(--foreground);
    transition: border-color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default);
}

.input::placeholder {
    color: var(--muted-foreground);
}

.input:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Textarea */
.textarea {
    display: flex;
    width: 100%;
    min-height: 80px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: transparent;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
    color: var(--foreground);
    resize: vertical;
    transition: border-color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default);
}

.textarea:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

/* Select */
.select {
    display: flex;
    height: 36px;
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: var(--background);
    padding: 0 var(--sp-8) 0 var(--sp-3);
    font-size: var(--text-sm);
    color: var(--foreground);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='0.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-default);
}

.select:focus {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

/* Checkbox / Radio — base styles for ALL checkboxes and radios */
input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    flex-shrink: 0;
    background: var(--background);
    transition: background var(--duration-fast) var(--ease-default),
                border-color var(--duration-fast) var(--ease-default);
    position: relative;
}

input[type="radio"] {
    border-radius: var(--radius-full);
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4.5px;
    top: 1.5px;
    width: 5px;
    height: 9px;
    /* tick in the primary's own foreground: white on the dark light-mode
       primary, dark on the white dark-mode primary (was always white, so
       every ticked box read as an empty white circle in dark mode) */
    border: solid var(--primary-foreground, white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
/* Mixed (some of a multi-selection): a bar instead of the tick */
input[type="checkbox"]:indeterminate {
    background: var(--primary);
    border-color: var(--primary);
}
input[type="checkbox"]:indeterminate::after {
    content: '';
    position: absolute;
    left: 3.5px;
    top: 6px;
    width: 7px;
    height: 2px;
    border: 0;
    border-radius: 1px;
    background: var(--primary-foreground, white);
    transform: none;
}

input[type="radio"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}
input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-foreground);
    transform: translate(-50%, -50%);
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Class aliases (legacy) */
.checkbox { /* inherits from input[type="checkbox"] */ }
.radio { /* inherits from input[type="radio"] */ }

/* Label */
.label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    display: block;
    margin-bottom: var(--sp-1-5);
}

/* Form group */
.form-group {
    margin-bottom: var(--sp-4);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: var(--sp-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--destructive-text);
    margin-top: var(--sp-1);
}

/* --- Cards --- */
.card {
    background: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1-5);
    padding: var(--sp-6);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
}

.card-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

.card-content {
    padding: 0 var(--sp-6) var(--sp-6);
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    padding: 2px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--duration-fast) var(--ease-default);
}

.badge-default {
    background: var(--primary);
    color: var(--primary-foreground);
}

.badge-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.badge-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.badge-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

.badge-success {
    background: var(--success-badge, var(--success));
    color: var(--success-foreground);
}

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

/* --- Dialogs / Modals --- */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgb(26 33 58 / 0.8);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    animation: fade-in var(--duration-normal) var(--ease-default);
}

.dialog-overlay[data-closing] {
    animation: fade-out var(--duration-fast) var(--ease-default) forwards;
}

.dialog {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 32rem;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: dialog-in var(--duration-normal) var(--ease-default);
}

.dialog-overlay[data-closing] .dialog {
    animation: dialog-out var(--duration-fast) var(--ease-default) forwards;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-6);
    border-bottom: 1px solid var(--border);
}

.dialog-title {
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
}

.dialog-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

.dialog-body {
    padding: var(--sp-4) var(--sp-6) var(--sp-6);
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--border);
}
/* Export is long: its buttons stay in view while the settings scroll (a 900 px high laptop never showed them) */
#exp-dialog > .dialog-footer { position: sticky; bottom: 0; flex-shrink: 0; background: var(--background); z-index: 1; }

.dialog-close {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default);
}

.dialog-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* The yes/no question (ui/confirm.js): one short question, a line of why, two named buttons */
.dialog-overlay.pbc-confirm { z-index: 10002; }   /* over what it can be asked from: the comment popover (10000), the editor's toasts (10001) */
.pbc-confirm .dialog { max-width: 26rem; }

/* The Google Fonts picker (google-fonts-dialog.js, 22 Nov 2026): find, kinds, each name in its own face */
.gf-overlay { z-index: 10002; }
.gf-dialog { width: min(36rem, calc(100vw - 2rem)); max-width: none; height: min(40rem, calc(100vh - 4rem)); display: flex; flex-direction: column; }
.gf-controls { display: flex; flex-direction: column; gap: var(--sp-3); padding: 0 var(--sp-6) var(--sp-3); }
.gf-kinds { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.gf-kind { height: 1.75rem; padding: 0 var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-full); background: transparent; color: var(--muted-foreground); font: inherit; font-size: var(--text-xs); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default); }
.gf-kind:hover { color: var(--foreground); }
.gf-kind[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.gf-kind:focus-visible, .gf-row:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.gf-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--sp-6) var(--sp-3); }
.gf-status { color: var(--muted-foreground); font-size: var(--text-sm); padding: var(--sp-4) 0; }
.gf-list { list-style: none; margin: 0; padding: 0; }
.gf-list li + li { border-top: 1px solid var(--border); }
.gf-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); width: 100%; min-height: 3rem; padding: var(--sp-2) var(--sp-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); text-align: start; cursor: pointer; transition: background-color var(--duration-fast) var(--ease-default); }
.gf-row:hover { background: var(--accent); }
.gf-row[aria-current="true"] .gf-name::after { content: " ✓"; font-family: var(--font-sans); font-size: var(--text-sm); }
.gf-name { font-size: 1.25rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-meta { flex: none; color: var(--muted-foreground); font-family: var(--font-sans); font-size: var(--text-xs); }
.gf-more { margin: var(--sp-3) auto 0; display: block; }
.gf-more[hidden], .gf-list[hidden], .gf-status[hidden] { display: none; }
/* Brand page: a brand family that is on Google Fonts, and the styles it lacks (brand-fonts.jsx GoogleOffer) */
.brand-google-add { margin-top: var(--sp-3); }
.brand-google-offers { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.brand-google-offer { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); font-size: var(--text-sm); }


.pbc-confirm .dialog-header { border-bottom: 0; padding-bottom: 0; }
.pbc-confirm .dialog-title { overflow-wrap: anywhere; }
.pbc-confirm .dialog-body { padding: var(--sp-2) var(--sp-6) 0; }
.pbc-confirm .dialog-footer { border-top: 0; }

/* --- Dropdown Menus --- */
.dropdown {
    position: relative;
    display: inline-flex;
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 8px);   /* clear of the avatar */
    right: 0;
    z-index: var(--z-dropdown);
    min-width: 12rem;
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: var(--sp-1);
    display: none;
    animation: fade-in var(--duration-fast) var(--ease-default);
}

.dropdown.open .dropdown-content {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    padding: var(--sp-2) var(--sp-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-default);
}

.dropdown-item:hover {
    background: var(--accent);
}

/* A menu row that holds a control rather than an action (the Appearance segment) */
.dropdown-item.dropdown-static { cursor: default; }
.dropdown-item.dropdown-static:hover { background: none; }
.dropdown-item.dropdown-static .theme-seg { margin-left: auto; }

.dropdown-item svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: var(--sp-1) 0;
}

.dropdown-label {
    padding: var(--sp-2) var(--sp-2) var(--sp-1);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
}

/* --- Tabs --- */
.tabs-list {
    display: inline-flex;
    align-items: center;
    background: var(--muted);
    border-radius: var(--radius-lg);
    padding: var(--sp-1);
    gap: var(--sp-1);
}

.tab-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: var(--radius-md);
    padding: var(--sp-1-5) var(--sp-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--muted-foreground);
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default);
    cursor: pointer;
}

.tab-trigger:hover {
    color: var(--foreground);
}

.tab-trigger.active {
    background: var(--background);
    color: var(--foreground);
    box-shadow: var(--shadow-xs);
}

/* the sliding tabs (components/tabs.jsx): the thumb carries the chosen tab's fill and moves under the labels, smooth, no overshoot.
   A row too wide for a phone scrolls inside itself */
.tabs-list[role="tablist"] { position: relative; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs-list[role="tablist"]::-webkit-scrollbar { display: none; }
.tabs-thumb {
    position: absolute; top: 0; left: 0; border-radius: var(--radius-md); background: var(--background); box-shadow: var(--shadow-xs);
    pointer-events: none;
}
.tabs-list[data-slide="on"] .tabs-thumb { transition: transform var(--duration-panel) var(--ease-default), width var(--duration-panel) var(--ease-default); }
.tabs-list[role="tablist"] .tab-trigger { position: relative; flex: none; border: 0; background: none; font: inherit; font-size: var(--text-sm); font-weight: 600; }
.tabs-list[role="tablist"] .tab-trigger.active { background: none; box-shadow: none; }
.tabs-list[role="tablist"] .tab-trigger:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
@media (pointer: coarse) { .tabs-list[role="tablist"] .tab-trigger { min-height: var(--target-min); } }
/* a panel arriving: in from the side of the tab it came from. No fill, so nothing stays on it afterwards */
.tab-panel-in[data-enter]:not([hidden]) { animation: tab-panel-in var(--duration-panel) var(--ease-default); }
@keyframes tab-panel-in { from { opacity: 0; transform: translateX(calc(var(--tab-from, 1) * 1rem)); } }
@media (prefers-reduced-motion: reduce) {
    .tabs-list[data-slide="on"] .tabs-thumb { transition: none; }
    .tab-panel-in[data-enter]:not([hidden]) { animation: none; }
}

.tab-content {
    margin-top: var(--sp-4);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* --- Tooltips --- */
.tooltip {
    position: relative;
}

.tooltip-content {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: var(--text-xs);
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-md);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    z-index: var(--z-tooltip);
    transition: opacity var(--duration-fast) var(--ease-default) 150ms;
}

.tooltip:hover .tooltip-content {
    opacity: 1;
}

/* --- Separators --- */
.separator {
    height: 1px;
    background: var(--border);
    width: 100%;
}

.separator-vertical {
    width: 1px;
    height: 100%;
    background: var(--border);
}

/* --- Sheets (slide-over panels) --- */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgb(26 33 58 / 0.8);
    z-index: var(--z-overlay);
    animation: fade-in var(--duration-normal) var(--ease-default);
}

.sheet-overlay[data-closing] {
    animation: fade-out var(--duration-fast) var(--ease-default) forwards;
}

.sheet {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-width: 100%;
    background: var(--background);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-overlay);
    overflow-y: auto;
    animation: sheet-in var(--duration-normal) var(--ease-default);
}

.sheet-overlay[data-closing] + .sheet,
.sheet[data-closing] {
    animation: sheet-out var(--duration-fast) var(--ease-default) forwards;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-4) var(--sp-6);
    border-bottom: 1px solid var(--border);
}

.sheet-title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.sheet-body {
    padding: var(--sp-6);
}

/* --- Toasts --- */
.toast-container {
    position: fixed;
    bottom: var(--sp-6);
    right: var(--toast-right, var(--sp-6));   /* the editor sets it: clear of the right rail and open panels (toast.js) */
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column-reverse;
    gap: var(--sp-3);
    pointer-events: none;
}

.toast {
    background: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 420px;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    pointer-events: auto;
    animation: toast-in var(--duration-normal) var(--ease-default);
}

/* Undo note (undo-note.js): what an undo or redo did, under the arrows; counts quick presses, spins on a slow restore */
.undo-note {
    position: fixed;
    z-index: var(--z-toast);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    max-width: 360px;
    padding: var(--sp-2) var(--sp-3);
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: var(--text-sm);
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity var(--duration-fast) var(--ease-default), transform var(--duration-fast) var(--ease-default);
}
.undo-note > span { overflow: hidden; text-overflow: ellipsis; }
.undo-note.is-centred { transform: translate(-50%, -4px); }
.undo-note.is-on { opacity: 1; transform: translateY(0); }
.undo-note.is-centred.is-on { transform: translate(-50%, 0); }
.undo-note .undo-note-sub { color: var(--muted-foreground); }
.undo-note .undo-note-spin { display: none; width: 12px; height: 12px; flex: 0 0 auto; }
.undo-note.is-busy .undo-note-spin { display: inline-block; }
@media (prefers-reduced-motion: reduce) { .undo-note { transition: none; } }

.toast[data-closing] {
    animation: toast-out var(--duration-fast) var(--ease-default) forwards;
}

.toast[data-variant="success"] {
    border-left: 3px solid var(--success);
}

.toast[data-variant="error"] {
    border-left: 3px solid var(--destructive);
}

.toast[data-variant="warning"] {
    border-left: 3px solid var(--warning);
}

.toast[data-variant="info"] {
    border-left: 3px solid var(--border);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-icon[data-variant="success"] { color: var(--success); }
.toast-icon[data-variant="error"]   { color: var(--destructive-text); }
.toast-icon[data-variant="warning"] { color: var(--warning); }

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: 600;
}

.toast-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin-top: var(--sp-1);
}

.toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default);
}

.toast-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* Task toast (Toast.task, 2.0.12): background work shown with its progress until closed (a PDF read on the server) */
.toast-spin {
    display: block; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
    border: 2px solid var(--border); border-top-color: var(--foreground);
    animation: spin .8s linear infinite;
}
.toast-progress { height: 4px; margin-top: var(--sp-2); border-radius: 999px; background: var(--border); overflow: hidden; }
.toast-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .4s ease; }
.toast-progress.is-indeterminate i { width: 35%; animation: prep-indeterminate 1.1s ease-in-out infinite; }
.toast-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
@media (prefers-reduced-motion: reduce) {
    .toast-spin { animation-duration: 2.4s; }
    .toast-progress.is-indeterminate i { animation-duration: 3s; }
}

/* Optional toast action (Toast.show({ action: { label, onClick } }), v1.80: Undo) */
.toast-action {
    align-self: center;
    flex-shrink: 0;
}

/* --- Empty States --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-16) var(--sp-6);
    text-align: center;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--muted-foreground);
    margin-bottom: var(--sp-4);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--sp-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    max-width: 24rem;
    margin-bottom: var(--sp-6);
}


/* ============================================================
   5. PATTERNS
   ============================================================ */

/* --- Library Grid --- */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr));
    gap: var(--grid-gap);
    align-items: start;   /* wells take each page's own shape (inline aspect-ratio), so a landscape deck's card ends at its content */
}

.library-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--duration-fast) var(--ease-default),
                box-shadow var(--duration-fast) var(--ease-default);
    cursor: pointer;
}

.library-card:hover {
    border-color: var(--ring);
    box-shadow: var(--shadow-md);
}

.library-card-thumb {
    aspect-ratio: 4 / 3;        /* every card the same landscape shape (Phil, 26 Sep 2026) */
    background: var(--muted);
    display: flex;
    align-items: safe center;   /* a tall page hangs from the top and crops; a short (landscape) page sits centred */
    justify-content: center;
    overflow: hidden;           /* a tall page is cropped at the bottom, never squeezed */
    cursor: pointer;
    padding: 0;
    position: relative;   /* anchors the card kebab overlay */
}

/* The page fills the card's width edge to edge; its height follows, and whatever runs past the well is hidden */
.library-card-thumb img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: fill;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: block;
}

/* A logo, cut-out or SVG sits whole in its well, never cropped (Phil 16 Nov 2026: the SIM 100 years logo showed only its middle,
   on black); a photo still fills the width */
.library-card-thumb img.is-fit { width: 100%; height: 100%; object-fit: contain; padding: var(--sp-3); }

.library-card-thumb img[src="pbc-favicon.svg"] {
    width: 48px;
    height: 48px;
    margin: auto;
    border: none;
}

/* A picture the list has just drawn (card-pictures.js) fades in once it is decoded, after the penguin fades out */
.library-card-thumb img.card-pic-in {
    animation: card-pic-in var(--duration-slow) var(--ease-default) both;
}
@keyframes card-pic-in {
    from { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .library-card-thumb img.card-pic-in { animation: none; }
}

.library-card-body {
    padding: var(--sp-3) var(--sp-4);
}

.library-card-title:has(> .card-open) { overflow: visible; }   /* the name's button carries the ellipsis and the focus ring */
/* A card's name is a button (RenameTitle, images): it opens the card from the keyboard; it looks like the name */
.card-open {
    display: block; max-width: 100%; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: inherit;
    text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--radius-sm);
}
.card-open:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.badge-faint { color: var(--muted-foreground); border-style: dashed; cursor: pointer; }   /* "+ category": faint by its ink, not by opacity (3.1:1) */
.library-card-title {
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.library-card-title[data-rename-id] {
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    margin: -2px -4px;
    transition: background 0.15s;
}
.library-card-title[data-rename-id]:hover {
    background: var(--muted);
}

/* Inline rename input on library cards */
.inline-rename-input {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--ring);
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    width: 100%;
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 25%, transparent);
}

.library-card-meta {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: var(--sp-1);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex-wrap: nowrap;          /* one line: the overset scrolls sideways under a fade (Phil, 26 Sep 2026) */
    overflow-x: auto;
    scrollbar-width: none;
    padding-right: 28px;        /* the last badge stops before the fade unless the row really overflows */
    min-width: 0;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.library-card-meta::-webkit-scrollbar { display: none; }
.library-card-meta > * { flex: none; }
/* Safety net for pathological single badges (very long category names) */
.library-card-meta .badge {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.library-card-meta .library-card-action { flex-shrink: 0; }

/* Card kebab: a circular ellipsis button overlaying the preview's top-right
   corner. Contrast adapts to the preview (black dot on light previews, white
   on dark — set by applyKebabContrast sampling the corner). Hover-revealed on
   fine pointers; always visible on touch, which has no hover. */
.card-kebab {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    padding: 0;
    cursor: pointer;
    background: rgba(26, 33, 58, 0.85);
    color: #fff;
    box-shadow: 0 1px 3px rgba(26, 33, 58, 0.3);
    transition: transform .12s ease;
}
.card-kebab:hover { transform: scale(1.08); }
.card-kebab.kebab-light { background: rgba(255, 255, 255, 0.95); color: #1a213a; }
@media (hover: hover) and (pointer: fine) {
    .card-kebab { opacity: 0; transition: opacity .12s ease, transform .12s ease; }
    .library-card:hover .card-kebab,
    .library-card:focus-within .card-kebab { opacity: 1; }
}
.card-kebab-menu {
    position: absolute;          /* placeKebabMenu (app.js) makes an open menu fixed, so the 4:3 thumb never crops it */
    top: 40px;
    right: 8px;
    z-index: var(--z-popover);   /* above the sidebar when a first-column card's menu reaches over it */
    min-width: 140px;
    padding: var(--sp-1);
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: none;
    flex-direction: column;
}
.card-kebab-menu.open { display: flex; }
.card-kebab-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    border: none;
    background: none;
    font-size: var(--text-sm);
    color: inherit;
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.card-kebab-item:hover { background: var(--accent); }
.card-kebab-item.destructive { color: var(--destructive-text); }

/* --- Document folders (v1.80) ---
   A rail INSIDE the Documents page (not the app sidebar), shown once the
   team has a folder; with none, the page is unchanged apart from the quiet
   "New folder" button. Markup: modules/doc-folders.js; state: app.js
   renderDocumentsList. Existing tokens only, so dark mode follows. */
.doc-new-folder[hidden],
.folder-rail[hidden],
.folder-results[hidden],
.folder-selbar[hidden],
.folder-row-error[hidden] { display: none; }

.doc-library.has-rail {
    display: grid;
    grid-template-columns: clamp(12rem, 9rem + 3vw, 15rem) minmax(0, 1fr);
    gap: var(--content-pad);
    align-items: start;
}
.doc-library-main { min-width: 0; }
.doc-library.has-rail .library-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

.folder-rail {
    position: sticky;
    top: var(--sp-4);
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* A long folder list scrolls inside the rail instead of off screen */
    max-height: calc(100vh - var(--header-height) - var(--sp-12));
    max-height: calc(100dvh - var(--header-height) - var(--sp-12));
    overflow-y: auto;
    scrollbar-width: thin;
}
.folder-rail-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    padding: var(--sp-3) var(--sp-1) var(--sp-1) 10px;
}
.folder-rail-add {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    color: var(--muted-foreground);
}
.folder-rail-add:hover { background: var(--accent); color: var(--foreground); }

.folder-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 34px;
    padding: 7px 8px 7px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--foreground);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.folder-row > svg, .folder-row-go > svg { flex: none; }
/* the row's name is its button (keyboard: Enter opens, F2 renames); it fills the row and looks like it (the ring is :focus-visible's) */
.folder-row-go { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 0; margin: 0; border: 0; background: none;
    font: inherit; color: inherit; text-align: left; cursor: pointer; }
.folder-row:hover { background: color-mix(in srgb, var(--accent), var(--foreground) 6%); }
.folder-row[aria-current="true"] { background: color-mix(in srgb, var(--accent), var(--foreground) 10%); font-weight: 600; }
/* the sidebar's and the rails' rule (Phil 22 Nov 2026): by day a hover 6% and the current place 10% toward the ink, no edge; at night
   both the dark well, the current one with the border colour as its edge */
[data-theme="dark"] .folder-row:hover { background: color-mix(in srgb, var(--accent), black 67%); }
[data-theme="dark"] .folder-row[aria-current="true"] { background: color-mix(in srgb, var(--accent), black 67%); box-shadow: inset 0 0 0 1px var(--border); }
.folder-row.is-muted { color: var(--muted-foreground); }
.folder-row-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-row-count {
    margin-left: auto;   /* the count at the row's far right, after the label and its (i) (Phil 22 Nov 2026) */
    font-size: var(--text-xs);
    font-weight: 400;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
}
.folder-row-more {
    width: 24px;    /* WCAG 2.5.8 (was 22) */
    height: 24px;
    margin: -1px -3px -1px 0;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--muted-foreground);
    opacity: 0;
}
.folder-row-more:hover { background: var(--border); color: var(--foreground); }
.folder-row:hover .folder-row-more,
.folder-row:focus-within .folder-row-more,
.folder-row-more[aria-expanded="true"] { opacity: 1; }
/* the count stays put when the row's buttons show (Phil 22 Nov 2026: "number of docs in folder breaks on hover"): they sit after it */
@media (hover: none) {
    .folder-row-more { opacity: 1; }
}
/* Search spans every folder, so no row reads as "current" while searching */
.folder-rail.is-searching .folder-row[aria-current="true"] { background: none; font-weight: 400; }
.folder-rail.is-searching .folder-row[aria-current="true"] { box-shadow: none; }
.folder-rail.is-searching .folder-row[aria-current="true"]:hover { background: color-mix(in srgb, var(--accent), var(--foreground) 6%); }
[data-theme="dark"] .folder-rail.is-searching .folder-row[aria-current="true"]:hover { background: color-mix(in srgb, var(--accent), black 67%); }
/* Drag a card over the rail: every target outlines, the hovered one fills */
.folder-rail.is-dragging .folder-row[data-drop] { box-shadow: inset 0 0 0 1px var(--border); }
.folder-rail .folder-row.is-drop-target {
    background: var(--accent);
    box-shadow: inset 0 0 0 2px var(--foreground);
}
.folder-rail-sep { height: 1px; background: var(--border); margin: var(--sp-2) 10px; }
/* round 2 (Phil 7 Nov 2026): My files and Team files each hold their folders, one step in under the place; a place's + is its
   New folder, shown as a folder's menu button is */
.folder-row.is-child, .folder-row-input.is-child { padding-left: calc(10px + 1.25rem); }
.folder-row + .folder-row:not(.is-child) { margin-top: var(--sp-2); }
.view-menu-item.is-child { padding-left: calc(var(--sp-2) + 1.5rem); }
/* the (i) on a folder menu's Delete folder (Phil 22 Nov 2026): a filled info icon at the row's end, in a quiet tint of the muted ink
   (not the row's red); pointing at it shows "Deleting a folder never deletes its documents." in PBC's tooltip (doc-folders.js) */
.view-menu-info { margin-left: auto; display: inline-flex; flex: none; color: color-mix(in srgb, var(--muted-foreground) 60%, var(--popover)); }
.view-menu-info:hover { color: var(--muted-foreground); }
/* on a danger row the (i) takes the row's red (Phil 22 Nov 2026: "make tooltip colour match the red text") */
.view-menu-item.is-danger .view-menu-info, .view-menu-item.is-danger .view-menu-info:hover { color: inherit; }
.folder-row-input {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 4px 6px 4px 10px;
    color: var(--muted-foreground);
}
.folder-row-input > svg { flex: none; }
.folder-row-input .input {
    height: 30px;
    padding: 0 var(--sp-2);
    min-width: 0;
    border-color: var(--ring);
    color: var(--foreground);
}
.folder-row-input .input[aria-invalid="true"] { border-color: var(--destructive); }
.folder-row-error { margin: 0; padding: 2px 10px 2px 34px; }

/* Cards: the where-is-it line, the selection tick, selected + dragging */
.card-folder {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin-top: var(--sp-2);
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
}
.card-folder svg { flex: none; }
.card-folder span { overflow: hidden; text-overflow: ellipsis; }
.card-check {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--ring);
    background: var(--background);
    color: var(--background);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-xs);
}
.card-check svg { stroke-width: 3; }
@media (hover: hover) and (pointer: fine) {
    .card-check { opacity: 0; transition: opacity .12s ease; }
    .library-card:hover .card-check,
    .library-card:focus-within .card-check,
    .library-grid.is-selecting .card-check { opacity: 1; }
}
.library-card.is-selected { border-color: transparent; box-shadow: 0 0 0 2px var(--foreground); }
.library-card.is-selected .card-check { background: var(--foreground); border-color: var(--foreground); opacity: 1; }
.library-card.is-dragging { opacity: .45; }

/* ==========================================================================
   Library cards: who is in it now (Phil 28 Oct 2026: "I really want to see at this level who is busy editing a
   document or template"). js/components/card-presence.jsx, on Templates, Documents and the dashboard's recent cards.
   The picture's top-left corner: overlapping avatars (initials on the person's colour, the only inline colour; a
   white 2 px ring), at most 3 then +N. Someone EDITING (a live pen and not idle) outlines the card 2 px in their
   colour (--card-editor-color, set on the card) and puts a pill on the picture's bottom-left. Ink: white initials,
   or the dark ink where white would fall under 4.5:1 on the colour (the atom picks .ink-dark). Nothing moves.
   ========================================================================== */
.card-presence {
    position: absolute;
    top: var(--sp-2);
    left: var(--sp-2);
    z-index: 2;
    display: flex;
    align-items: center;
    pointer-events: auto;
}
.card-check ~ .card-presence { left: calc(var(--sp-2) + 30px); }   /* clear of the Documents tick */
.card-presence-av {
    display: inline-grid;
    place-items: center;
    position: relative;
    width: 26px;
    height: 26px;
    margin-left: -3px;
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 2px #fff, var(--shadow-sm);   /* the white ring reads on any picture */
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .02em;
    cursor: default;
    -webkit-user-select: none; user-select: none;
}
.card-presence-av:first-child { margin-left: 0; }
/* the first (whoever is editing) on top, each next one tucked under it, so no initials are covered */
.card-presence-av:nth-child(1) { z-index: 4; }
.card-presence-av:nth-child(2) { z-index: 3; }
.card-presence-av:nth-child(3) { z-index: 2; }
.card-presence-av:nth-child(4) { z-index: 1; }
.card-presence-av.ink-light { color: #fff; }
.card-presence-av.ink-dark { color: #1a213a; }
.card-presence-av.card-presence-more { background: var(--secondary); color: var(--secondary-foreground); }
.card-presence-pill {
    position: absolute;
    left: var(--sp-2);
    bottom: var(--sp-2);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 2 * var(--sp-2));
    padding: 2px var(--sp-2) 2px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--popover);
    color: var(--popover-foreground);
    box-shadow: var(--shadow-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}
.card-presence-dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex: none; }
.library-card.is-being-edited { border-color: transparent; box-shadow: 0 0 0 2px var(--card-editor-color); }
.library-card.is-being-edited:hover { border-color: transparent; box-shadow: 0 0 0 2px var(--card-editor-color), var(--shadow-md); }
.library-card.is-being-edited.is-selected { box-shadow: 0 0 0 2px var(--card-editor-color), 0 0 0 4px var(--foreground); }
.doc-library.has-rail .library-card { user-select: none; -webkit-user-select: none; }
.doc-library.has-rail .library-card .inline-rename-input { user-select: text; -webkit-user-select: text; }

.folder-results {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin: calc(-1 * var(--sp-1)) 0 var(--sp-3);
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}
.folder-results-clear {
    color: var(--foreground);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Popovers: folder menu, delete confirm, Move to folder (on .view-menu) */
.folder-pop { min-width: 220px; max-width: 280px; }
.folder-pop .view-menu-heading {
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--text-xs);
    font-weight: 400;
    padding: 6px var(--sp-2) 2px;
}
.folder-pop .view-menu-item > svg { flex: none; }
.folder-pop .view-menu-item.is-active { background: var(--accent); }
.folder-pop .view-menu-item.is-danger { color: var(--destructive-text); }
.folder-pop .view-menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-pop-tick { margin-left: auto; display: inline-flex; }
.folder-pop-search { padding: var(--sp-1); }
.folder-pop-search .input { height: 32px; }
.folder-pop-list { display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; }
.folder-pop-empty { padding: var(--sp-2) var(--sp-3); font-size: var(--text-sm); color: var(--muted-foreground); }
.folder-pop-confirm p { padding: var(--sp-2) var(--sp-2) var(--sp-3); font-size: var(--text-sm); line-height: 1.45; }
.folder-pop-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0 var(--sp-1) var(--sp-1); }

/* Floating bar for a multi-selection */
.folder-selbar {
    position: fixed;
    left: 50%;
    bottom: calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px var(--sp-4);
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    white-space: nowrap;
}
.folder-selbar button {
    height: 30px;
    padding: 0 var(--sp-3);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-weight: 600;
}
.folder-selbar button:hover { background: color-mix(in srgb, var(--primary-foreground) 15%, transparent); }
.folder-selbar button:focus-visible { outline-color: var(--primary-foreground); }

/* Drag image for a multi-document drag ("3 documents"), parked off screen */
.folder-drag-ghost {
    position: fixed;
    top: -1000px;
    left: -1000px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--primary);
    color: var(--primary-foreground);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    white-space: nowrap;
}

/* Narrow (tablet portrait): the rail becomes a scrolling row of chips */
@media (max-width: 820px) {
    .doc-library.has-rail { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
    .folder-rail {
        position: static;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .folder-rail > * { flex: none; }
    .folder-rail .folder-row {
        width: auto;
        min-height: 32px;
        padding: 5px 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-full);
    }
    .folder-rail .folder-row-more,
    .folder-rail-label span,
    .folder-rail-sep,
    .folder-rail-label { padding: 0; }
    .folder-rail .folder-row:has(.folder-row-more) .folder-row-count { display: inline; }
    .folder-row-input .input { width: 160px; }
    .doc-library.has-rail .library-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
}

.library-card-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-2) var(--sp-4) var(--sp-3);
}

.library-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    color: var(--muted-foreground);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    transition: color var(--duration-fast) var(--ease-default),
                background var(--duration-fast) var(--ease-default);
}

.library-card-action:first-of-type {
    margin-left: auto;
}

.library-card-action:hover {
    color: var(--foreground);
    background: var(--accent);
}

.library-card-action.library-card-delete:hover {
    color: var(--destructive-text);
}

/* --- Data Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    white-space: nowrap;
}

.data-table td {
    font-size: var(--text-sm);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--duration-fast) var(--ease-default);
}

.data-table tbody tr:hover {
    background: var(--muted);
}

/* --- Upload Drop Zone --- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-10) var(--sp-6);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-default),
                background var(--duration-fast) var(--ease-default);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--accent);
}

.upload-zone-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto var(--sp-3);
    color: var(--muted-foreground);
}
/* The import dialogs' drop zones hold a plain svg icon; the reset makes every
   svg display:block, so text-align alone left it at the left edge */
.upload-zone > svg { margin-left: auto; margin-right: auto; }

.upload-zone-text {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

.upload-zone-text strong {
    color: var(--foreground);
}

/* --- Search Bar --- */
.search-bar {
    position: relative;
    width: 100%;
    max-width: 24rem;
}

.search-bar .input {
    padding-left: var(--sp-10);
}

.search-bar-icon {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-foreground);
    pointer-events: none;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-1);
    margin-top: var(--sp-6);
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    transition: background var(--duration-fast) var(--ease-default);
}

.pagination-btn:hover {
    background: var(--accent);
}

.pagination-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

.pagination-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.pagination-info {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin: 0 var(--sp-2);
}

/* --- Library Toolbar (search + filters row) --- */
.library-toolbar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}

.search-bar-clear {
    position: absolute;
    right: var(--sp-2);
    top: 50%;
    transform: translateY(-50%);
    width: 24px;    /* WCAG 2.5.8: 24 px target (was 20) */
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--muted-foreground);
    cursor: pointer;
    border: none;
    background: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast);
    padding: 0;
}

.search-bar.has-value .search-bar-clear {
    opacity: 1;
    pointer-events: auto;
}

.search-bar-clear:hover {
    color: var(--foreground);
    background: var(--accent);
}

.search-bar .input {
    padding-right: var(--sp-8);
}

/* --- Filter Select --- */
.filter-select {
    height: 36px;
    font-size: var(--text-sm);
    padding: 0 var(--sp-8) 0 var(--sp-3);
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    background: var(--background);
    color: var(--foreground);
    appearance: none;
    -webkit-appearance: none;
    background-image: var(--select-chevron);
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 25%, transparent);
}

/* Selects sharing the base .input component get the same treatment as
   .filter-select / select.prop-input — appearance:none + inset chevron.
   Without this, native selects render the caret glued to the right edge. */
select.input, .brand-font-category-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: var(--sp-8);
    background-image: var(--select-chevron);
    background-size: 16px 16px;
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    cursor: pointer;
}

/* --- Tag Pills --- */
.tag-pills {
    display: flex;
    gap: var(--sp-1);
    flex-wrap: wrap;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 var(--sp-3);
    font-size: var(--text-xs);
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.tag-pill:hover {
    border-color: var(--ring);
    background: var(--accent);
}

.tag-pill.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* --- Tag Editor (inline chips + input) --- */
.tag-editor {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
    padding: var(--sp-2);
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    min-height: 36px;
    align-items: center;
    cursor: text;
}

.tag-editor:focus-within {
    border-color: var(--ring);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 25%, transparent);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px var(--sp-2);
    font-size: var(--text-xs);
    background: var(--secondary);
    border-radius: var(--radius-sm);
    color: var(--secondary-foreground);
}

.tag-chip-remove {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    cursor: pointer;
    color: var(--muted-foreground);
    border: none;
    background: none;
    padding: 0;
}

.tag-chip-remove:hover {
    color: var(--destructive-text);
    background: var(--accent);
}

.tag-editor-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--text-sm);
    color: var(--foreground);
    flex: 1;
    min-width: 80px;
}

/* --- Image Detail Dialog --- */
.image-detail-content {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--sp-6);
}

.image-detail-preview {
    background: var(--muted);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 300px;
}

.image-detail-preview img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
}

.image-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.image-detail-meta dt {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.image-detail-meta dd {
    font-size: var(--text-sm);
    color: var(--foreground);
    margin-bottom: var(--sp-3);
}

/* --- Category Assign Dialog --- */
.category-option {
    display: flex;
    align-items: center;
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-sm);
    transition: background var(--duration-fast);
}

.category-option:hover {
    background: var(--accent);
}

.category-option.selected {
    background: var(--primary);
    color: var(--primary-foreground);
}

.category-new-input {
    display: flex;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .image-detail-content {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   6. EDITOR
   ============================================================ */

/* --- Editor Layout --- */
.editor-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--background);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--sp-3);
    border-bottom: 1px solid var(--border);
    background: var(--background);
    flex-shrink: 0;
    gap: var(--sp-2);
}

/* Zoom-step selector — % readout + caret grouped as one dropdown trigger */
.zoom-step-wrap { position: relative; display: inline-flex; align-items: center; }
.zoom-step-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 28px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}
.zoom-step-trigger:hover { background: var(--accent); border-color: var(--border); }
.zoom-step-trigger #ed-zoom-label { min-width: 32px; text-align: right; }
.zoom-step-caret { width: 8.25px; height: 8.25px; flex: none; opacity: 0.75; }
.zoom-step-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
    z-index: 200;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 64px;
}
.zoom-step-menu[hidden] { display: none; }
.zoom-step-menu button {
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    font-size: var(--text-xs);
    color: var(--foreground);
    padding: 5px 9px;
    border-radius: var(--radius-sm);
}
.zoom-step-menu button:hover { background: var(--accent); }
.zoom-step-menu button.active { background: var(--accent); font-weight: 600; }

/* Fit menu (fit canvas / fit to width): tick on the active mode + shortcut hint.
   The ticked entry is what Ctrl/Cmd+0 applies (persisted fit mode). */
.fit-menu button {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
}
.fit-menu .fit-check {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    visibility: hidden;
}
.fit-menu button.active .fit-check { visibility: visible; }
.fit-menu .fit-kbd {
    margin-left: auto;
    padding-left: 14px;
    font-size: 10px;
    color: var(--muted-foreground);
    visibility: hidden;
}
.fit-menu button.active .fit-kbd { visibility: visible; }

/* Editor entity name input */
.ed-entity-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    height: 32px;
    width: 184px;      /* its own: left to the browser it is 184 px in Chrome, 218 in Firefox, 238 in Safari, and the top bar folds Font weight away at 1400 */
    min-width: 120px;
    max-width: 240px;
    text-overflow: ellipsis;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.ed-entity-name:hover {
    border-color: var(--border);
    background: var(--muted);
}
.ed-entity-name:focus {
    border-color: var(--ring);
    background: var(--background);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 25%, transparent);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--foreground);
    transition: background var(--duration-fast) var(--ease-default);
}

.toolbar-btn:hover {
    background: var(--hover-fill);
}

.toolbar-btn.active {
    background: var(--accent);
    color: var(--primary);
}

/* Settings > Menus (editor.js showPageSettingsModal): a choice and its switch on one row */
.ds-switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-2) 0; }
.ds-switch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-switch-title { font-size: var(--text-sm); font-weight: 500; color: var(--foreground); }
.ds-switch-hint { font-size: var(--text-xs); color: var(--muted-foreground); }

/* a toolbar button with nothing to do (Undo with no steps, Redo with none undone) reads as resting, not as a target */
.toolbar-btn:disabled { color: var(--muted-foreground); opacity: 0.5; cursor: default; }
.toolbar-btn:disabled:hover { background: none; }

.guide-edit-badge,
.guide-eye-badge {
    color: var(--primary);
    filter: drop-shadow(0 0 1px var(--background));
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 var(--sp-1);
}

/* Top bar fit (v2.0.9, js/modules/topbar-fit.js): controls keep their size and the bar never wraps; the units
   that do not fit (data-tb-pri, highest first) move into the More tray beside Export. Save and Export never move:
   the document name gives way last, and the left group clips before the right group can be pushed off. */
.editor-toolbar > .toolbar-group { flex-shrink: 0; }
.editor-toolbar > .toolbar-group:first-child { flex-shrink: 1; min-width: 0; overflow-x: clip; }
.editor-toolbar .toolbar-group > *,
.editor-toolbar .toolbar-text-context > *,
.editor-toolbar .tb-unit > *,
.tb-tray > * { flex-shrink: 0; }
.editor-toolbar .prop-input { flex: none; }
.editor-toolbar .ed-entity-name { flex-shrink: 1; min-width: 96px; }
.editor-toolbar.tb-measuring > .toolbar-group:first-child,
.editor-toolbar.tb-measuring .ed-entity-name { flex-shrink: 0; }
.tb-unit { display: flex; align-items: center; gap: var(--sp-1); }
.toolbar-sep.tb-sep-off { display: none; }
.tb-more-wrap { position: relative; display: inline-flex; align-items: center; }
/* a cluster with nothing shown, and the More slot with More hidden: out of the row, so they take no gap (topbar-fit.js emptySlots) */
.editor-toolbar .tb-unit.tb-empty, .editor-toolbar .tb-more-wrap.tb-empty { display: none; }
.tb-more[hidden], .tb-tray[hidden] { display: none !important; }
.tb-more[aria-expanded="true"] { background: var(--accent); }
.tb-tray {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    z-index: 200;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-1);
    width: max-content;
    max-width: min(calc(100vw - 24px), 560px);
    padding: 6px;
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}
.tb-tray .toolbar-sep { height: 20px; }
.tb-tray .tb-tray-sep[hidden] { display: none; }
.editor-toolbar .tb-tray .prop-input { background-color: transparent; }

/* Editor Body (panels + canvas). The frame of the editor: it never scrolls. `hidden` still lets a focus or scrollIntoView scroll it, which left a blank band under the
   canvas and cut off the text pop-up (Phil 6 Nov 2026); `clip` does not, and asks for min-height 0 to keep to the window. */
.editor-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    overflow: clip;
}

/* Tools Strip (compact icon toolbar) */
.tools-strip {
    width: 48px;
    background: var(--background);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-2) 0;
    gap: var(--sp-1);
}

.tool-strip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--muted-foreground);
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

.tool-strip-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}

.tool-strip-btn svg {
    width: 18px;
    height: 18px;
}

/* Section separator in properties panel */
.prop-section-separator {
    height: 1px;
    background: var(--border);
    margin: var(--sp-2) 0;
}

/* --- Editor Image Library Panel --- */
.image-library-panel {
    width: 220px;
    background: var(--background);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.image-library-panel.open {
    display: flex;
    position: relative;
}

/* Drag an image from the page into the panel (modules/library-drop.js) */
.image-library-panel.is-drop-target {
    outline: 2px dashed var(--ring);
    outline-offset: -4px;
    background: color-mix(in srgb, var(--brand-yellow, #ffec8d) 22%, var(--background));
}
.image-library-panel.is-drop-target::after {
    content: 'Drop to add to the library';
    position: absolute;
    left: 10px; right: 10px; bottom: 56px;
    padding: 8px;
    text-align: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    pointer-events: none;
}
body.lib-drop-armed, body.lib-drop-armed * { cursor: copy !important; }
.image-library-hint { display: block; margin-top: var(--sp-2); font-size: 10px; line-height: 1.3; color: var(--muted-foreground); text-align: center; }
.ed-img-item.is-flash { outline: 2px solid var(--brand-yellow, #ffec8d); outline-offset: 2px; }
/* While a page object is dragged over the panel the tiles take no pointer: no hover ring on the tile under the drop (v1.99.6) */
body.lib-drop-armed .image-library-panel .ed-img-item { pointer-events: none; }
/* An upload in flight: the object's own preview, dimmed and softened, under a progress ring with the
   percentage; once the bytes are up the ring turns into a slow indeterminate arc while thumbnails are made */
.ed-img-item.is-uploading { cursor: progress; }
.ed-img-item.is-uploading .ed-img-thumb > img { opacity: .45; filter: blur(1.5px) saturate(.85); transform: scale(1.04); }
.ed-img-progress { position: absolute; inset: 0; display: grid; place-items: center; }
.ed-img-progress > svg { position: absolute; width: 44px; height: 44px; transform: rotate(-90deg); transform-origin: center; }
.ed-ring-track, .ed-ring-arc { fill: none; stroke-width: 3; stroke-linecap: round; }
.ed-ring-track { stroke: rgba(255, 255, 255, .35); }
.ed-ring-arc { stroke: var(--brand-yellow, #ffec8d); stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset var(--duration-fast) linear; }
.ed-img-progress > b {
    position: relative; font-size: 10px; font-weight: 600; letter-spacing: .02em; line-height: 1;
    color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); font-variant-numeric: tabular-nums;
}
.is-processing > .ed-img-progress > b, .is-processing .ed-img-progress > b { display: none; }
.is-processing .ed-ring-arc { stroke-dasharray: 26 74; stroke-dashoffset: 0; transition: none; animation: ed-ring-spin .9s linear infinite; transform-origin: 20px 20px; }
@keyframes ed-ring-spin { to { transform: rotate(360deg); } }
/* A picture on its way to the page (js/modules/picture-landing.js, CLAUDE.md "Waits: one rule"): the person's own picture, dimmed,
   where it will land, at once; the shared ring and its words from the first second; it fades off the real picture when that is in.
   A layer in the canvas's wrapper, never on the canvas: nothing to select, save or export. */
.pic-landing { position: absolute; z-index: 3; pointer-events: none; overflow: hidden; border-radius: 2px;
    outline: 1px solid color-mix(in srgb, var(--brand-navy, #1a213a) 35%, transparent); outline-offset: -1px;
    background: color-mix(in srgb, var(--muted, #eee) 70%, transparent); transition: opacity var(--duration-fast) var(--ease-default); }
.pic-landing > img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; filter: blur(1.5px) saturate(.85); }
.pic-landing > .ed-img-progress { opacity: 0; transition: opacity var(--duration-fast) var(--ease-default); }
.pic-landing.is-busy > .ed-img-progress { opacity: 1; }
.pic-landing > .ed-img-progress > svg { width: 56px; height: 56px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.pic-landing > .ed-img-progress > b { font-size: 11px; }
.pic-landing-words { position: absolute; left: 8px; right: 8px; top: calc(50% + 36px); text-align: center; font-size: var(--text-xs, 12px); font-weight: 600;
    line-height: 1.3; white-space: pre-line; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); opacity: 0; transition: opacity var(--duration-fast) var(--ease-default); }
.pic-landing.is-busy > .pic-landing-words { opacity: 1; }
.pic-landing.is-small > .pic-landing-words { display: none; }
.pic-landing.is-small > .ed-img-progress > svg { width: 36px; height: 36px; }
.pic-landing.is-leaving { opacity: 0; }
.pic-landing.is-failed { outline-color: var(--destructive-text, #c22); }
@media (prefers-reduced-motion: reduce) { .pic-landing, .pic-landing > * { transition: none; } .is-processing .ed-ring-arc { animation-duration: 2.4s; } }

.image-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    font-weight: 600;
}

.image-library-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted-foreground);
    border: none;
    background: none;
    padding: 0;
}

.image-library-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

.image-library-search {
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border);
}

.image-library-grid {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-2);
    display: grid;
    /* Definite tracks, not 1fr: flexible columns resolve after the rows, so a square
       thumbnail (height from width) measured as 0 or as the image's natural shape and the
       row clipped it. Two columns of (100% - gap) / 2 are known before the rows are sized. */
    grid-template-columns: repeat(2, calc((100% - var(--sp-2)) / 2));
    grid-auto-rows: max-content;   /* auto rows measured the square thumbnail as 0; max-content sizes to it (measured live, 26 Sep 2026) */
    gap: var(--sp-2);
    align-content: start;
}

.ed-img-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: grab;
    transition: border-color var(--duration-fast);
}

.ed-img-item:hover {
    border-color: var(--ring);
}
/* Actions on a library picture (three dots, top right; also right-click): Delete from library (2.0.36) */
.ed-img-more {
    position: absolute; top: 4px; right: 4px; z-index: 1; width: 26px; height: 26px; display: grid; place-items: center;
    border: none; border-radius: var(--radius-sm); background: var(--card); color: var(--muted-foreground);
    box-shadow: var(--shadow-sm); cursor: pointer; opacity: 0; transition: opacity var(--duration-fast) var(--ease-default);
}
.ed-img-item:hover .ed-img-more, .ed-img-item:focus-within .ed-img-more, .ed-img-more[aria-expanded="true"] { opacity: 1; }
.ed-img-more:hover, .ed-img-more[aria-expanded="true"] { color: var(--foreground); background: var(--accent); }
.ed-img-more:focus-visible { opacity: 1; outline: 2px solid var(--ring); outline-offset: 1px; }
@media (hover: none) { .ed-img-more { opacity: 1; } }

.ed-img-item:active {
    cursor: grabbing;
}

.ed-img-thumb {
    position: relative;
    width: 100%;
    padding-top: 100%;      /* a square from the column width, reliable inside grid rows */
    background: var(--muted);
    overflow: hidden;
}
.ed-img-thumb > img,
.ed-img-thumb > div,
.ed-img-thumb > .skel-block {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}
.ed-img-thumb > img.is-fit { object-fit: contain; padding: 6px; }   /* a logo or cut-out whole in its tile, not cropped to its middle */

.ed-img-name {
    display: block;
    font-size: 10px;
    color: var(--muted-foreground);
    padding: 2px var(--sp-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-library-footer {
    padding: var(--sp-2) var(--sp-3) var(--sp-3);
    border-top: 1px solid var(--border);
}

.image-library-footer .btn {
    width: 100%;
    justify-content: center;
}

/* THE TOOL IN USE (Phil 21 Nov 2026: "need a more obvious active state"; his own values from the prototype, option 8 "Soft tile
   and edge", ~/Sites/_prototypes/pbc/tool-rail): by day a tile 10% darker than hover toward the ink with a 1px #b6b6b6 edge; at
   night a dark well (hover 67% toward black) with the border colour as its edge. Every tool button carries a clear 1px border so
   lighting one moves nothing. It fades in on the button's own 150 ms. Image and Parts open a library or a drawer, and Shapes its
   picker: those show open with the plain soft tile and no edge, so only a tool ever lights. */
.tool-strip-btn { border: 1px solid transparent; }
.tool-strip-btn.panel-active,
.tool-strip-btn.panel-active:hover {
    background: color-mix(in srgb, var(--accent), var(--foreground) 10%);
    border-color: #d5d5d5;
    color: var(--foreground);
}
/* night: a hover is the same dark well with no edge; the edge comes with the press that picks the tool (Phil 22 Nov 2026) */
[data-theme="dark"] .tool-strip-btn:not(.panel-active):not(.panel-open):hover { background: color-mix(in srgb, var(--accent), black 67%); }
[data-theme="dark"] .tool-strip-btn.panel-active,
[data-theme="dark"] .tool-strip-btn.panel-active:hover {
    background: color-mix(in srgb, var(--accent), black 67%);
    border-color: var(--border);
}
.tool-strip-btn.panel-active[data-tool="image"],
.tool-strip-btn.panel-active[data-tool="parts"],
.tool-strip-btn.panel-open {
    background: var(--accent);
    border-color: transparent;
    color: var(--foreground);
}

/* Tool groups (js/modules/tool-groups.js, Phil 25 Oct 2026): related tools share one button, which shows the one last used; a
   small triangle in its corner says more are under it (hold or right-click opens the flyout). Every tool keeps its own button
   in the markup; the ones not shown wear .tg-off. The page's own rules that hide a tool (drawing, flow, restricted, guest)
   win over these, so tool-groups.js reads them to know which tools a group can offer. */
.tool-group { display: contents; }
.tool-group > .tool-strip-btn.tg-off { display: none; }
.tool-group > .tool-strip-btn.tg-many { position: relative; }
.tool-group > .tool-strip-btn.tg-many::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    border-style: solid;
    border-width: 0 0 5px 5px;
    border-color: transparent transparent currentColor transparent;
    pointer-events: none;
}
/* The flyout: PBC's menu (.view-menu.folder-pop) beside the button: the mark, the tool's icon, its name, its key */
.tool-flyout { min-width: 200px; }
.tool-flyout .tool-flyout-icon { display: inline-flex; flex: none; width: 18px; height: 18px; color: var(--muted-foreground); }
.tool-flyout .tool-flyout-icon svg { width: 18px; height: 18px; }
.tool-flyout .view-menu-item[aria-checked="true"] .tool-flyout-icon { color: var(--primary); }
.tool-flyout .view-menu-label { flex: 1; }
.tool-flyout .tool-flyout-key { margin-left: var(--sp-4); font-variant-numeric: tabular-nums; }

/* Canvas Viewport */
/* The canvas's Tab stop (html-template.js): over the page area, a ring when the keyboard is on it, never in the mouse's way */
.ed-canvas-stop { grid-column: 2; grid-row: 2; position: absolute; inset: 0; pointer-events: none; z-index: 6; border-radius: 2px; }
.ed-canvas-stop:focus { outline: none; }
.ed-canvas-stop:focus-visible { outline: 2px solid var(--ring); outline-offset: -3px; }
.canvas-viewport {
    flex: 1;
    overflow: hidden;
    background: var(--muted);
    display: grid;
    grid-template-columns: 20px 1fr;
    grid-template-rows: 20px 1fr;
    position: relative;
}

/* ──────────────────────────────────────────────────────────────────────
   Document (fill-in) mode — strip the editor to only what the template
   leaves editable, for CREATORS only. Driven by .doc-restricted (+ caps-*)
   on #editor-root, set by applyDocToolPolicy() in editor.js. Designers and
   master_admin never get this class, so they keep the full toolset.
   ────────────────────────────────────────────────────────────────────── */
/* Left tools strip: keep only the Select tool (+ Comment — reviewing isn't authoring) */
.doc-restricted #ed-tools-strip [data-tool]:not([data-tool="select"]):not([data-tool="comment"]),
.doc-restricted #ed-tools-strip .tools-strip-sep,
/* Right props strip: keep only Layers / History / Pages */
.doc-restricted #ed-props-strip [data-flyout="position"],
.doc-restricted #ed-props-strip [data-flyout="group"],
.doc-restricted #ed-props-strip [data-flyout="selection"],
.doc-restricted #ed-props-strip [data-flyout="effects"],
.doc-restricted #ed-props-strip [data-flyout="align"],
.doc-restricted #ed-props-strip [data-flyout="pathfinder"],
.doc-restricted #ed-props-strip [data-flyout="textwrap"],
.doc-restricted #ed-props-strip [data-flyout="swatches"],
.doc-restricted #ed-props-strip [data-flyout="gradient"],
.doc-restricted #ed-props-strip [data-flyout="table"],
.doc-restricted #ed-props-strip .props-strip-sep,
/* Top toolbar: drop page/document settings, header/footer, view toggles
   (Export follows the member's export permissions: .no-export below) */
.doc-restricted #ed-btn-page-settings,
.doc-restricted #ed-btn-layout-guides,
.doc-restricted #ed-tool-edit-header,
.doc-restricted #ed-tool-edit-footer,
.doc-restricted #ed-btn-view-menu,
.doc-restricted .editor-toolbar .toolbar-sep,
/* Layers panel: select + rename only — no lock/unlock/duplicate/hide/delete/reorder */
.doc-restricted .layers-tb-btn,
.doc-restricted .layer-actions,
.doc-restricted .layer-drag-handle,
.doc-restricted [data-layers-unlock],
/* Pages flyout: keep navigation (click a thumb), drop add/duplicate/delete/settings */
.doc-restricted .page-thumb-action,
.doc-restricted #ed-pages-add,
/* Top toolbar Group/Ungroup button (separate from the hidden Group flyout) */
.doc-restricted #ed-btn-group { display: none !important; }

/* Member permissions (v1.79): no export format allowed = Export is quiet, and a press says why (editor.js showExportModal). A guest's link has none of it */
.no-export #ed-btn-export { color: var(--muted-foreground); }
.pbc-guest #ed-btn-export { display: none !important; }

/* Capability-gated controls (hidden only when the template locks that capability) */
.doc-restricted.caps-no-textstyle #ed-font-family-field,
.doc-restricted.caps-no-textstyle #ed-size-field,
.doc-restricted.caps-no-textstyle #ed-font-weight-field,
.doc-restricted.caps-no-textstyle #ed-btn-bold,
.doc-restricted.caps-no-textstyle #ed-btn-italic,
.doc-restricted.caps-no-textstyle #ed-btn-underline,
.doc-restricted.caps-no-textstyle #ed-btn-align-left,
.doc-restricted.caps-no-textstyle #ed-btn-align-center,
.doc-restricted.caps-no-textstyle #ed-btn-align-right,
.doc-restricted.caps-no-textstyle #ed-props-strip [data-flyout="stroke"],
.doc-restricted.caps-no-textstyle #ed-props-strip [data-flyout="character"],
.doc-restricted.caps-no-textstyle #ed-props-strip [data-flyout="paragraph"],
.doc-restricted.caps-no-textstyle #ed-props-strip [data-flyout="pstyles"],
.doc-restricted.caps-no-textstyle #ed-props-strip [data-flyout="cstyles"],
.doc-restricted.caps-no-colour #ed-tool-color { display: none !important; }

/* Hide the rulers and reclaim their grid tracks */
.doc-restricted .canvas-viewport { grid-template-columns: 0 1fr; grid-template-rows: 0 1fr; }
.doc-restricted .ruler-corner,
.doc-restricted .ruler-h-container,
.doc-restricted .ruler-v-container { display: none !important; }

/* New Template dialog — intent cards (step 1) + page setup (step 2) */
.kind-options { display: flex; flex-direction: column; gap: var(--sp-3); }
.kind-option {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    width: 100%; padding: var(--sp-4);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--card); color: var(--foreground);
    text-align: left; cursor: pointer; font: inherit;
    transition: border-color .15s ease, background-color .15s ease;
}
.kind-option:hover:not(:disabled) { border-color: var(--ring); background: var(--accent); }
.kind-option:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.kind-option:disabled { opacity: .5; cursor: not-allowed; }
.kind-option[hidden] { display: none; }

/* Member permissions (Admin > Users > Edit > Permissions, v1.79).
   Divider lists: rules between rows only, label left, explanation right. */
/* .dialog.perm-dialog outranks the tablet rule that stretches every dialog */
.dialog.perm-dialog {
    max-width: min(42rem, calc(100vw - var(--sp-8)));
    display: flex; flex-direction: column;
    overflow: hidden;
}
.perm-dialog .dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.perm-team-name { font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--sp-4); }
.perm-note {
    font-size: var(--text-xs); line-height: 1.45;
    background: var(--muted); color: var(--foreground);
    border-radius: var(--radius-md);
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-4);
}
.perm-panel[hidden] { display: none; }
.perm-section + .perm-section { margin-top: var(--sp-6); }
.perm-section-title {
    font-size: var(--text-sm); font-weight: 600;
    color: var(--foreground);
    margin: 0 0 var(--sp-1);
}
.perm-section-hint {
    font-size: var(--text-xs); line-height: 1.45;
    color: var(--muted-foreground);
    margin: 0 0 var(--sp-1);
}
.perm-row {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: var(--sp-3);
    align-items: start;
    padding: 0.625rem 0;
    cursor: pointer;
}
.perm-row + .perm-row { border-top: 1px solid var(--border); }
.perm-control {
    display: flex; align-items: center; gap: var(--sp-2);
    font-size: var(--text-sm); font-weight: 600;
    color: var(--foreground);
}
.perm-desc {
    font-size: var(--text-xs); line-height: 1.5;
    color: var(--muted-foreground);
    padding-top: 1px;
}
.perm-section .form-error[hidden] { display: none; }
.perm-footer { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.perm-footer-note {
    flex: 1 1 14rem;
    font-size: var(--text-xs); line-height: 1.45;
    color: var(--muted-foreground);
    margin: 0;
}
.perm-footer-actions { display: flex; gap: var(--sp-2); margin-left: auto; }
/* Admin > Users > Edit: Details | Permissions in one dialog */
.user-dialog-tabs { display: flex; margin-bottom: var(--sp-5); }
.user-dialog-tabs .tab-trigger { flex: 1 1 0; }
[data-user-panel][hidden] { display: none; }
.perm-team-picker { margin-bottom: var(--sp-5); }
.perm-team-picker .select { width: 100%; }
.user-password-title { margin-top: var(--sp-6); margin-bottom: var(--sp-3); }
.user-email-action {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
    border-top: 1px solid var(--border);
    padding-top: var(--sp-4);
    margin-bottom: var(--sp-4);
}
.user-email-action-title { font-size: var(--text-sm); font-weight: 600; margin: 0; }
.user-email-action-desc {
    font-size: var(--text-xs); line-height: 1.45;
    color: var(--muted-foreground);
    margin: 2px 0 0;
}
.user-email-action .btn { flex: none; }
@media (max-width: 560px) {
    .user-email-action { flex-direction: column; align-items: stretch; }
}
@media (max-width: 560px) {
    .perm-row { grid-template-columns: 1fr; gap: var(--sp-1); }
    .perm-desc { padding-left: calc(16px + var(--sp-2)); }
}
.kind-option > svg { flex: none; margin-top: 1px; color: var(--muted-foreground); }
.kind-option .kind-text { display: block; min-width: 0; }
.kind-option .kind-title { display: block; font-weight: 600; font-size: var(--text-sm); }
.kind-option .kind-desc {
    display: block; margin-top: 2px;
    font-size: var(--text-xs); line-height: 1.45;
    color: var(--muted-foreground); white-space: normal;
}
/* atom: one choice of a few, as a card with its outcome (a radio in a radio group; New template's Fonts and colours, the
   Brand page's default for new templates). The picked card carries the primary edge, as the import's choices do. */
.kind-choices { gap: var(--sp-2); }
.kind-option.kind-choice { align-items: flex-start; padding: var(--sp-3) var(--sp-4); }
.kind-option.kind-choice > input[type="radio"] { flex: none; margin-top: 2px; }
.kind-option.kind-choice:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.kind-option.kind-choice:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
fieldset:disabled .kind-option.kind-choice { opacity: .6; cursor: default; }
fieldset.new-file-rules, fieldset.brand-rules-default { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.new-file-rules > legend, fieldset.brand-rules-default > legend { padding: 0; margin-bottom: var(--sp-2); }
/* New document: the Blank kinds, then the team's templates to start from */
.new-file-head { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); }
.new-file-head:first-child { margin-top: 0; }
.library-grid.new-file-templates { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.tpl-setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.tpl-setup-grid .full { grid-column: 1 / -1; }
.tpl-setup-grid .form-label {
    display: block; margin-bottom: var(--sp-1);
    font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground);
}
.tpl-margin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.tpl-margin-cap {
    display: block; margin-top: 2px; text-align: center;
    font-size: 10px; color: var(--muted-foreground);
}
/* Chain-link toggle beside a 4-input row: linked = one value drives all sides */
.tpl-link-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; padding: 0;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted-foreground); cursor: pointer;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.tpl-link-btn:hover { background: var(--accent); color: var(--foreground); }
.tpl-link-btn.is-linked { color: var(--primary); border-color: var(--border); background: var(--secondary); }
.tpl-link-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

/* The View menu: labelled checklist popover from the toolbar eye button
   (Figma view-menu pattern; labels + checkmarks carry the state) */
.view-menu {
    position: fixed;
    z-index: 10001;
    min-width: 220px;
    padding: var(--sp-1);
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}
.view-menu-item {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    width: 100%;
    padding: var(--sp-2) var(--sp-3);
    border: none;
    background: none;
    font-size: var(--text-sm);
    color: inherit;
    text-align: left;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.view-menu-item:hover { background: var(--hover-fill); }
.view-menu-check { width: 14px; display: inline-flex; align-items: center; flex: none; }
.view-menu-label { flex: 1; }
.view-menu-hint { font-size: var(--text-xs); color: var(--muted-foreground); }
.view-menu-indent { padding-left: calc(var(--sp-3) + 14px + var(--sp-2)); }
.view-menu-indent .view-menu-check { width: 14px; }
.view-menu-sep { border-top: 1px solid var(--border); margin: var(--sp-1) 0; }
.view-menu-heading {
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--muted-foreground);
    padding: var(--sp-1) var(--sp-2);
}
.view-menu-item:disabled { color: var(--muted-foreground); cursor: default; opacity: 0.6; }
.view-menu-item:disabled:hover { background: none; }
.field-menu { max-height: 70vh; overflow-y: auto; }

/* Master pages (v1.64): [A] tag on page thumbs + editing-mode hint */
.page-thumb-master-tag {
    position: absolute; top: 3px; left: 3px;
    font-size: 9px; font-weight: 600; line-height: 1;
    padding: 2px 4px; border-radius: 4px;
    background: var(--secondary); color: var(--secondary-foreground);
    border: 1px solid var(--border); pointer-events: none;
}
.page-thumb-item { position: relative; }
.editing-master #ed-canvas-wrapper { outline: 2px solid #8b5cf6; outline-offset: -2px; }
.masters-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.master-tile { flex: 0 0 76px; width: 76px; max-width: 76px; min-width: 0; cursor: grab; }
.master-tile .page-thumb-label { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-thumb-item.master-drop { outline: 2px solid #8b5cf6; outline-offset: 1px; border-radius: var(--radius-sm); }
.master-ctx .view-menu-item.destructive { color: var(--destructive-text); }

/* Presence (v1.70): toolbar avatar stack + Pages panel viewer dots + sync banner */
.presence-stack { display: flex; align-items: center; margin-right: var(--sp-2); }
.presence-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--secondary); color: var(--secondary-foreground);
    border: 2px solid var(--border);
    font-size: 10px; font-weight: 600; letter-spacing: 0.02em;
    margin-left: -6px; cursor: default; -webkit-user-select: none; user-select: none;
}
.presence-stack .presence-avatar:first-child { margin-left: 0; }
button.presence-avatar { position: relative; padding: 0; font-family: inherit; line-height: 1; cursor: pointer; }
button.presence-avatar:hover { background: var(--accent); color: var(--accent-foreground); z-index: 1; }
button.presence-avatar:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; z-index: 1; }
.presence-more { border-color: var(--border) !important; color: var(--muted-foreground); }
.page-presence { position: absolute; bottom: 26px; right: 4px; display: flex; gap: 2px; }
.page-presence-dot {
    width: 8px; height: 8px; border-radius: 50%;
    border: 1.5px solid var(--card); box-shadow: var(--shadow-xs);
}
.claim-banner {
    position: absolute; left: 50%; top: 52px; transform: translateX(-50%);
    z-index: var(--z-overlay, 50);
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border); border-left: 3px solid #8b5cf6;
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    padding: var(--sp-2) var(--sp-4); font-size: var(--text-sm);
    pointer-events: none;
}
.sync-view-only .canvas-wrapper { cursor: default; }
/* View-only means view-only (v2.0.0): the tools, formatting and object panels take no input; navigation panels
   (pages, history, comments, layers for selection) stay usable */
.sync-view-only #ed-tools-strip .tool-btn:not([data-tool="select"]),
.sync-view-only #ed-tools-strip [data-tool]:not([data-tool="select"]) { pointer-events: none; opacity: .4; }
.sync-view-only #ed-flyout-panel:not([data-flyout="pages"]):not([data-flyout="history"]):not([data-flyout="comments"]):not([data-flyout="layers"]):not([data-flyout="approval"]):not([data-flyout="share"]) .dock-body { pointer-events: none; opacity: .55; }
.sync-view-only .tb-text, .sync-view-only #ed-btn-group, .sync-view-only #ed-btn-insert-field, .sync-view-only #ed-btn-page-settings { pointer-events: none; opacity: .4; }
/* The banner carries the pen: who holds the page and the Ask to edit action */
.claim-banner { display: flex; align-items: center; gap: var(--sp-3); max-width: min(720px, 92%); }
.claim-banner .claim-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.claim-banner .btn { flex: none; pointer-events: auto; }   /* the banner lets presses through to the page; its buttons take them
   (Ask to edit, Cancel, Ask again, Edit here instead could not be pressed until 19 Oct 2026) */
.claim-modal .claim-modal-body { padding: var(--sp-5) var(--sp-6); }
.claim-modal .claim-modal-body p { margin: var(--sp-2) 0 var(--sp-4); font-size: var(--text-sm); color: var(--muted-foreground); }
.claim-modal .dialog-footer { padding: 0; border: 0; background: none; }
/* Pages panel: the initials of whoever holds a page */
.page-pen { position: absolute; top: 4px; right: 4px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; color: #fff;
    font-size: 9px; font-weight: 700; letter-spacing: .02em; display: inline-grid; place-items: center; box-shadow: var(--shadow-sm); border: 1.5px solid var(--card); }

.sync-banner {
    position: absolute; left: 50%; top: 52px; transform: translateX(-50%);
    z-index: var(--z-overlay, 50);
    display: flex; align-items: center; gap: var(--sp-3);
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--warning, #d97706); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2) var(--sp-4); font-size: var(--text-sm);
}
/* When work cannot reach the server (sync/scheduler.js): under any other banner, its words on as many lines as they need */
.sync-banner-warn { top: 100px; width: max-content; max-width: min(720px, 92%); }
.sync-banner-warn .btn { flex: none; }

/* Autosave status IN the Save button (v1.73.4): the BUTTON's colour is the
   status (green whole-button = saved, black = an action is available, red =
   not saved) and the ICON carries the motion: disk (action), spinner while
   saving, tick when saved. No dot. */
/* Saving: the ordinary button colours (ink on the primary), only the icon spins */
#ed-btn-save.save-busy { color: var(--primary-foreground); }
#ed-btn-save.save-ok,
#ed-btn-save.save-ok:hover { background: #0f7a50; color: #fff; }
/* Dark mode: a lighter green with dark ink reads on the navy toolbar (white on mid green did not) */
[data-theme="dark"] #ed-btn-save.save-ok,
[data-theme="dark"] #ed-btn-save.save-ok:hover { background: #3ec97f; color: #0d1a12; }
#ed-btn-save.save-err,
#ed-btn-save.save-err:hover { background: var(--destructive, #dc2626); color: #fff; }
#ed-save-icon.spin { animation: save-spin 0.9s linear infinite; }
@keyframes save-spin { to { transform: rotate(360deg); } }

/* View & Guides modal (design-system rebuild of the old inline-styled
   Layout & Guides). Rides .dialog-overlay/.dialog + .settings-tab*. */
.lg-dialog { width: 480px; max-width: calc(100vw - 32px); max-height: 85vh; display: flex; flex-direction: column; overflow-x: hidden; }
/* Here the tab bar sits directly in the dialog, not inside a padded body, so
   the shared negative side margins pushed it 24px past both edges and the
   dialog grew a horizontal scrollbar. Flush margins; the padding lines the
   first tab's label up with the title. */
.lg-dialog > .settings-tabs { margin: 0; padding: 0 var(--sp-3); flex-shrink: 0; }
.lg-body { overflow-y: auto; overflow-x: hidden; flex: 1; }
.lg-section-label {
    font-size: var(--text-xs); font-weight: 600;
    margin: var(--sp-3) 0 var(--sp-2); color: var(--foreground);
}
.lg-check-row {
    display: flex; align-items: center; gap: var(--sp-2);
    font-size: var(--text-xs); cursor: pointer; margin-bottom: var(--sp-1);
}
.lg-check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1) var(--sp-3); }
.lg-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.lg-divider { border-top: 1px solid var(--border); margin: var(--sp-3) 0; }
.lg-subhead { font-size: 10px; color: var(--muted-foreground); margin-bottom: 4px; }
.lg-hint { font-size: var(--text-xs); color: var(--muted-foreground); margin-top: var(--sp-3); }
.prop-input.lg-colour { width: 40px; height: 28px; padding: 2px; cursor: pointer; flex: 0 0 40px; }

/* Appearance (v1.92): interface + pasteboard segments, guide colours as a
   2 x 2 swatch grid instead of four sparse label rows */
.lg-app { display: flex; flex-direction: column; gap: var(--sp-3); }
.lg-app-row { display: flex; align-items: center; gap: var(--sp-3); }
.lg-app-label { font-size: var(--text-xs); color: var(--muted-foreground); min-width: 76px; }
.lg-seg {
    display: inline-flex; flex: 1;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    overflow: hidden; background: var(--background);
}
.lg-seg button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 30px; padding: 0 var(--sp-2);
    font-size: var(--text-xs); color: var(--muted-foreground);
    background: none; border: none; cursor: pointer;
}
.lg-seg button + button { border-left: 1px solid var(--border); }
.lg-seg button:hover { color: var(--foreground); }
.lg-seg button[aria-checked="true"] {
    color: var(--foreground); font-weight: 600;
    background: color-mix(in srgb, var(--accent) 90%, black);
}
[data-theme="dark"] .lg-seg button[aria-checked="true"] { background: color-mix(in srgb, var(--accent) 90%, white); }
.lg-paste-chip { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); flex: 0 0 12px; }
.lg-paste-light { background: #f1f1f3; }
.lg-paste-dark { background: #161923; }
.lg-paste-match { background: linear-gradient(135deg, #f1f1f3 50%, #222b4a 50%); }
.lg-swatches { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2) var(--sp-3); }
.lg-swatch {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: 6px var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: var(--text-xs); color: var(--foreground); cursor: pointer; background: var(--background);
}
.lg-swatch:hover { border-color: var(--muted-foreground); }
.lg-swatch input.lg-colour {
    width: 22px; height: 22px; flex: 0 0 22px; padding: 0; border: none; border-radius: 5px;
    background: none; cursor: pointer;
}
.lg-swatch input.lg-colour::-webkit-color-swatch-wrapper { padding: 0; }
.lg-swatch input.lg-colour::-webkit-color-swatch { border: 1px solid rgba(26,33,58,0.15); border-radius: 5px; }
.lg-swatch input.lg-colour::-moz-color-swatch { border: 1px solid rgba(26,33,58,0.15); border-radius: 5px; }
/* Footer: Preview on the left, Cancel / OK on the right */
.lg-footer { align-items: center; }
.lg-footer .lg-preview { margin: 0; font-size: var(--text-xs); }

/* FLOW documents (kind='flow') for restricted creators: the Word-like "just
   type" surface. Pages auto-create and auto-remove as they type, so the
   layout/guide chrome would only mislead. */
.doc-flow.doc-restricted #ed-tool-toggle-snap,
.doc-flow.doc-restricted #ed-btn-layers,
.doc-flow.doc-restricted #ed-props-strip [data-flyout="locks"] { display: none !important; }

/* Flow DOCUMENTS (any role): text-box creation and threading are template
   work — the drawing tools disappear for everyone (_setActiveTool guards the
   keyboard shortcuts; _canThreadFrame kills the thread ports). */
.doc-flow-doc #ed-tools-strip [data-tool="text"],
.doc-flow-doc #ed-tools-strip [data-tool="textOnPath"] { display: none !important; }

/* Header/footer editing buttons: since v1.62 they are the FLOW Word-style
   header/footer editor (layout templates keep their zone semantics until
   Master Pages retires them). Flow tooltips drop the "Zone" wording via JS.
   Word model (v1.63): in flow docs the editor is a DOCUMENT-USER feature, so
   the two buttons survive the restricted toolbar strip; enterZoneEditMode
   enforces the template's locked_header/locked_footer switches. */
.doc-restricted.doc-flow #ed-tool-edit-header,
.doc-restricted.doc-flow #ed-tool-edit-footer { display: flex !important; }

/* Editor preloader — record-style spinning disc (held for >= 2 turns by editor.js) */
@keyframes pbc-disc-spin { to { transform: rotate(360deg); } }
.pbc-disc-spin {
    animation: pbc-disc-spin 1.98s linear infinite;   /* 1.98s/rev (~30 rpm); JS _PL_SPIN_MS must match */
    transform-origin: 50% 50%;
    will-change: transform;
    filter: drop-shadow(0 1px 7px rgba(26, 33, 58, 0.16));
    border-radius: 50%;
}
@media (prefers-reduced-motion: reduce) {
    .pbc-disc-spin { animation-duration: 3.96s; }   /* one calm turn over the minimum hold */
}

/* Input with a trailing affix button (e.g. password show/hide eye) */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix > .input { flex: 1; padding-right: 40px; }
.input-affix-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.input-affix-btn:hover { color: var(--foreground); background: var(--accent); }
.input-affix-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

/* Admin Activity — expandable item groups */
.activity-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    margin-bottom: 8px;
    overflow: hidden;
}
.activity-group > summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    -webkit-user-select: none; user-select: none;
}
.activity-group > summary::-webkit-details-marker { display: none; }
.activity-group > summary::before {
    content: '▸';
    color: var(--muted-foreground);
    margin-right: 8px;
    font-size: 11px;
    transition: transform 0.15s ease;
    display: inline-block;
}
.activity-group[open] > summary::before { transform: rotate(90deg); }
.activity-group > summary:hover { background: var(--accent); }
.activity-group-title { font-weight: 600; font-size: var(--text-sm); flex: 1; }
.activity-group-meta { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }
.activity-group-body { border-top: 1px solid var(--border); padding: 4px 14px 8px 34px; }
.activity-row {
    display: grid;
    grid-template-columns: 150px 1fr 130px 1fr;
    gap: 12px;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-xs);
}
.activity-row:last-child { border-bottom: none; }
.activity-when { color: var(--muted-foreground); white-space: nowrap; }
.activity-action { font-weight: 600; color: var(--foreground); }
.activity-user { color: var(--muted-foreground); }
.activity-details { color: var(--muted-foreground); }

/* Canvas right-click context menu + asset link picker */
.ed-ctx-menu {
    position: fixed;
    z-index: 1000;
    min-width: 210px;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ed-ctx-item {
    border: none;
    background: none;
    text-align: left;
    font-size: var(--text-sm);
    color: var(--foreground);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.ed-ctx-item:hover { background: var(--accent); }
.ed-ctx-item[data-key] { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-6); }
.ed-ctx-item[data-key]::after { content: attr(data-key); flex: none; color: var(--muted-foreground); font-size: var(--text-xs); }
.ed-link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}
.ed-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 8px;
    cursor: pointer;
}
.ed-link-item:hover { border-color: var(--ring); background: var(--accent); }
.ed-link-item img {
    width: 100%;
    height: 84px;
    object-fit: contain;
    background: repeating-conic-gradient(#f0f0f3 0% 25%, #fff 0% 50%) 50% / 16px 16px;
    border-radius: var(--radius-sm);
}
.ed-link-item span {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ruler-corner {
    grid-column: 1;
    grid-row: 1;
    background: var(--background);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    z-index: 3;
}

.ruler-h-container {
    grid-column: 2;
    grid-row: 1;
    overflow: hidden;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    z-index: 2;
    min-width: 0;
}

.ruler-h-container canvas {
    display: block;
}

.ruler-v-container {
    grid-column: 1;
    grid-row: 2;
    overflow: hidden;
    background: var(--background);
    border-right: 1px solid var(--border);
    z-index: 2;
    min-height: 0;
}

.ruler-v-container canvas {
    display: block;
}

.canvas-scroll-area {
    grid-column: 2;
    grid-row: 2;
    overflow: auto;
    min-width: 0;
    min-height: 0;
    background: var(--pasteboard, transparent);
}
#editor-root.presenting .canvas-scroll-area { background: #1a213a; }

.canvas-wrapper {
    position: relative;
    /* Background + shadow are on the canvas-container, not the
       wrapper, because the wrapper is oversized for over-scroll */
}
.canvas-wrapper .canvas-container {
    box-shadow: var(--shadow-lg);
}

/* Properties Icon Strip (right edge) */
.props-strip {
    width: 40px;
    background: var(--background);
    border-left: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--sp-2) 0;
    gap: var(--sp-1);
}

.props-strip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    color: var(--muted-foreground);
    transition: background var(--duration-fast) var(--ease-default),
                color var(--duration-fast) var(--ease-default);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    position: relative;
    isolation: isolate;
}

.props-strip-btn:hover {
    background: var(--hover-fill);
    color: var(--foreground);
}

/* The open panel's button wears the tool rail's treatment (Phil 22 Nov 2026: "the new active tool colour treatment for night mode
   where it gets darker too", then "match day too"): by day the tile 10% toward the ink with a 1px #b6b6b6 edge, at night a dark
   well with the border colour as its edge. The edge is an inset ring, not a border, so the panel mark (::before) keeps its place
   on the rail's edge. */
.props-strip-btn.active {
    background: color-mix(in srgb, var(--accent), var(--foreground) 10%);
    box-shadow: inset 0 0 0 1px #d5d5d5;
    color: var(--primary);
}
[data-theme="dark"] .props-strip-btn:not(.active):hover { background: color-mix(in srgb, var(--accent), black 67%); }   /* night hover: the well, no edge */
[data-theme="dark"] .props-strip-btn.active {
    background: color-mix(in srgb, var(--accent), black 67%);
    box-shadow: inset 0 0 0 1px var(--border);
}

/* Panel marks (14 Oct 2026, Phil: "change the background wash to a left hand bar border that attached to edge of right
   side menu and add a little circle notification yellow dot top right of icon to highlight available too"; the yellow
   wash behind the icons before, v1.96.4 to 2.0.55). The object panels whose settings act on the selection get a bar on
   the rail's left edge beside them and a dot at the icon's top right. updatePanelWash (flyout-panel.js) still sets
   .wash, and .wash-up / .wash-down where a marked neighbour joins it, so a run is one bar across the rail gap.
   INK, NOT YELLOW (Phil, same day: "the yellow is not working. not enough contrast.. maybe we should be using the ink
   blue var?"): yellow on the sand rail measured 1.2:1. Light: the navy ink #1a213a, 11.9:1 on #e0dfdb; dark: the dark
   theme's lighter ink blue #7c86ad (its --ring), 4.4:1 on #1a213a, where navy would vanish.
   THE LINE ONLY (2.0.55-tables.30, Phil 14 Oct 2026: "remove the dots just use the line but make the line full circular end
   caps not half circular"): no dot at the icon; the bar's ends are whole half circles (a pill), a joined run round at its
   two ends only. */
.props-strip {
    --wash-mark: var(--brand-navy);
    --wash-ink: var(--foreground);
}
[data-theme="dark"] .props-strip { --wash-mark: #7c86ad; }
.props-strip-btn::before {       /* the bar, centred on the rail's left edge (its 1 px border): (40 - 1 - 32) / 2 to the border,
                                    then half the bar past its middle (Phil 14 Oct 2026: "overlap left edge (horizontally centred on the edge)") */
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -5.5px;
    width: 3px;
    border-radius: 9999px;
    background: var(--wash-mark);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-default);
    pointer-events: none;
}
.props-strip-btn.wash::before { opacity: 1; }
.props-strip-btn.wash-down::before { bottom: calc(-1 * var(--sp-1)); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }   /* across the .props-strip gap */
.props-strip-btn.wash-up::before { border-top-left-radius: 0; border-top-right-radius: 0; }
.props-strip-btn.wash { color: var(--wash-ink); }
@media (prefers-reduced-motion: reduce) { .props-strip-btn::before { transition: none; } }
/* View menu: Appearance as one row with a segmented icon toggle */
.view-menu-item.view-menu-static { cursor: default; }
.view-menu-item.view-menu-static:hover { background: none; }
.theme-seg {
    display: inline-flex;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.theme-seg button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 24px;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
}
.theme-seg button + button { border-left: 1px solid var(--border); }
.theme-seg button:hover { color: var(--foreground); }
.theme-seg button[aria-checked="true"] {
    background: color-mix(in srgb, var(--accent) 90%, black);
    color: var(--primary);
}
[data-theme="dark"] .theme-seg button[aria-checked="true"] {
    background: color-mix(in srgb, var(--accent) 90%, white);
}
/* Settings > Document: Orientation as two icon buttons and the Units menu beside Page Size (Phil 22 Nov 2026) */
.orient-seg { margin-left: 0; border-radius: var(--radius-sm); }
.orient-seg button { height: 26px; }   /* with its 1 px border, the 28 px of the fields beside it */
.orient-seg button { transition: background-color var(--duration-fast, 150ms) ease-out, color var(--duration-fast, 150ms) ease-out; }
.orient-seg button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
/* Size: W, H and the units on one row (as Canva's custom size), lined up under Page Size on the same 80 px label column */
.ds-dims { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 64px; gap: var(--sp-2); align-items: center; }
.ds-dims > .ds-units { width: 100%; min-width: 0; }
.ds-dims-u { font-size: var(--text-xs); color: var(--muted-foreground); }
/* Margins and Bleed on the same column (Top Bottom / Left Right, as Text Frame Options' padding), the chain beside them spanning
   both rows under the units menu; the label sits level with the first row */
.ds-sides-row { align-items: flex-start; }
.ds-sides-row > .prop-label { line-height: 28px; }
.ds-sides { grid-template-rows: 28px 28px; row-gap: var(--sp-2); --so-bracket: 10px; }
.ds-sides > .so-link { grid-column: 3; grid-row: 1 / span 2; align-self: center; justify-self: start; }
@media (prefers-reduced-motion: reduce) { .orient-seg button { transition: none; } }

.props-strip-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.props-strip-btn svg {
    width: 18px;
    height: 18px;
}

.props-strip-sep {
    height: 1px;
    width: 24px;
    background: var(--border);
    margin: var(--sp-1) 0;
}
/* what does not fit the window's height waits under More (modules/rail-more.js) */
#ed-props-strip, #ed-tools-strip { min-height: 0; }
#ed-props-strip > *, #ed-tools-strip > *, #ed-tools-strip .tool-strip-btn { flex-shrink: 0; }
.rail-folded { display: none !important; }
/* and what still does not fit scrolls in the rail: only then, because a rail set to scroll cuts off what sits across its edge (the panels' marks come in by a hair) */
.rail-scrolls { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.rail-scrolls::-webkit-scrollbar { display: none; }
.rail-scrolls .props-strip-btn::before { left: -3.5px; }
/* taller than the window, it scrolls (Phil 3 Nov 2026: "this needs to be scrollable") */
.rail-more-menu { position: fixed; min-width: 180px; max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; flex-wrap: nowrap; }
.rail-more-menu .view-menu-item { flex: none; }
.rail-more-menu .view-menu-label { flex: 1; }
.rail-more-menu .view-menu-hint { margin-left: var(--sp-4); }
.rail-more-menu .view-menu-check { width: 16px; }
.rail-more-menu .view-menu-check svg { width: 16px; height: 16px; }

/* Flyout Panel */
.flyout-panel {
    width: 280px;
    min-width: 200px;
    max-width: 400px;
    background: var(--background);
    border-left: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Opening and closing (flyout-panel.js _setPanelOpen): the width runs from nothing on the panel tokens while its
   content keeps its own width (set on #ed-dock) and slides in with the edge; the canvas glides with the view (zoom.js).
   A tab, a second stack, the resize handle and the editor opening never move it. clip: focus in a field cannot scroll
   the content sideways while it is narrower. Reduced motion: it opens at once and its content fades in. */
.flyout-panel.is-moving {
    min-width: 0;
    overflow: clip;
    transition: width var(--duration-panel) var(--ease-panel);
}
.flyout-panel.is-moving.is-closing { transition-duration: var(--duration-panel-close); }
@media (prefers-reduced-motion: reduce) {
    .flyout-panel > .dock-stacks { animation: fade-in var(--duration-fast) var(--ease-default); }
}

.flyout-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 1;
    background: transparent;
    transition: background var(--duration-fast);
}

.flyout-resize-handle:hover,
.flyout-resize-handle.dragging {
    background: var(--ring);
}

.flyout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.flyout-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
}

/* Panel header actions (v1.72.10): title is a plain label on the left; the
   right side stacks [ellipsis panel menu, when registered] then the minimise
   arrow as its own standalone button on the far right, pointing at the edge
   the panel collapses into. No separate X. */
.flyout-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: -4px -6px -4px 0;
}
.flyout-minimise {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted-foreground);
}
.flyout-minimise:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* Panel menu button (v1.69.1): ellipsis top right of the header opens the
   panel's flyout menu (InDesign panel-menu pattern) */
.flyout-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted-foreground);
}
.flyout-menu-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}
.panel-menu .view-menu-item:disabled { color: var(--muted-foreground); cursor: default; opacity: 0.6; }

.flyout-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted-foreground);
    border: none;
    background: none;
    padding: 0;
}

.flyout-close:hover {
    background: var(--accent);
    color: var(--foreground);
}

.flyout-body {
    flex: 1;
    padding: var(--sp-3);
    overflow-y: auto;
}

/* --- Panel dock (v1.87): stacked, tabbed panels --- */
.dock-stacks {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.dock-stack {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    border-bottom: 1px solid var(--border);
}
.dock-stack:last-child { border-bottom: none; }
/* The edge between stacked panels (Phil 9 Nov 2026): drag it, double-click to fold the panel below to its tabs */
.dock-stack { position: relative; }
.dock-edge { position: absolute; left: 0; right: 0; top: -4px; height: 8px; z-index: 6; cursor: row-resize; touch-action: none; }
.dock-edge[hidden] { display: none; }
.dock-edge::after { content: ''; position: absolute; left: 0; right: 0; top: 3px; height: 2px; background: var(--ring); opacity: 0; transition: opacity var(--duration-fast) var(--ease-default); }
.dock-edge:hover::after, .dock-edge.dragging::after, .dock-edge:focus-visible::after { opacity: 1; }
.dock-edge:focus-visible { outline: none; }
.dock-stack.collapsed { flex: 0 0 auto; }
.dock-stack.collapsed .dock-body { display: none; }
.flyout-header.dock-tabs {
    padding: 0 var(--sp-1) 0 0;
    gap: var(--sp-1);
    background: var(--muted, var(--accent));
}
.dock-tabbar {
    display: flex;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.dock-tabbar::-webkit-scrollbar { display: none; }
.dock-tabstrip {
    display: flex;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;      /* scrolls (wheel / trackpad / drag), no bar */
    overscroll-behavior-x: contain;
}
.dock-tabstrip::-webkit-scrollbar { display: none; }
.dock-tabstrip { user-select: none; -webkit-user-select: none; position: relative; }
/* Edge fades (v1.92.3): a soft fade on whichever side has tabs out of view,
   so the strip reads as swipeable */
.dock-tabstrip.fade-r {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}
.dock-tabstrip.fade-l {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px);
    mask-image: linear-gradient(to right, transparent, #000 32px);
}
.dock-tabstrip.fade-l.fade-r {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
}
.dock-tabstrip.dragging, .dock-tabstrip.dragging .dock-tab { cursor: grabbing; }
.dock-tab {
    flex: 0 0 auto;
    padding: 9px 10px 7px;
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted-foreground);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--duration-fast) var(--ease-default);
}
.dock-tab:hover { color: var(--foreground); }
.dock-tab.active {
    color: var(--foreground);
    background: var(--background);
    border-bottom-color: var(--primary);
}
.dock-more {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    align-self: center;
    padding: 0;
    color: var(--muted-foreground);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.dock-more:hover { color: var(--foreground); }
.dock-body { flex: 1; min-height: 0; }
/* Bottom-edge fade (v1.96.5): an overset panel fades its bottom edge until it is
   scrolled to the end, so it reads as scrollable (.fade-b from _bodyFade in
   flyout-panel.js; same mask technique as the tab strip's side fades) */
.dock-body.fade-b, .stp-list.fade-b, .dt-list.fade-b {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
}

/* --- Hyperlinks panel --- */
.links-head, .links-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 5px 4px;
    font-size: var(--text-xs);
}
.links-head {
    color: var(--muted-foreground);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.links-row { border-bottom: 1px solid var(--border); cursor: pointer; }
.links-row:hover { background: var(--accent); }
.links-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links-page { flex: 0 0 28px; text-align: right; color: var(--primary); font-variant-numeric: tabular-nums; }
.links-status { flex: 0 0 40px; display: flex; justify-content: center; }

/* --- Gradient multi-stop slider --- */
.grad-ramp-wrap {
    position: relative;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    overflow: visible;
}
.grad-ramp-checker {
    position: absolute;
    inset: 0;
    border-radius: 3px;
    background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 8px 8px;
}
.grad-ramp {
    position: absolute;
    inset: 0;
    border-radius: 3px;
    cursor: crosshair;
}
.grad-stops {
    position: absolute;
    left: 0; right: 0;
    bottom: -10px;
    height: 14px;
    pointer-events: none;
}
.grad-stop {
    position: absolute;
    width: 14px;
    height: 14px;
    transform: translateX(-50%);
    cursor: pointer;
    pointer-events: all;
    z-index: 2;
}
.grad-stop-handle {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 2px solid var(--border);
    box-sizing: border-box;
    transition: border-color 0.1s;
}
.grad-stop.selected .grad-stop-handle {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
.grad-midpoints {
    position: absolute;
    left: 0; right: 0;
    top: -8px;
    height: 10px;
    pointer-events: none;
}
.grad-midpoint {
    position: absolute;
    width: 8px;
    height: 8px;
    transform: translateX(-50%) rotate(45deg);
    background: var(--muted-foreground);
    cursor: ew-resize;
    pointer-events: all;
    opacity: 0.5;
    transition: opacity 0.1s;
}
.grad-midpoint:hover {
    opacity: 1;
}
.grad-stop-editor {
    padding-top: 10px;
}

.flyout-subsection {
    margin-bottom: var(--sp-4);
}

.flyout-subsection-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: var(--sp-2);
}
/* A panel opened at one of its sections (flyout-panel.js openFlyoutAt: the text pop-up's Bullet settings): the section is
   tinted once so the eye lands on it; the tint reaches past its edges without moving anything. Reduced motion: the tint
   shows and goes without fading. */
.flyout-subsection.flyout-flash { border-radius: var(--radius-sm); animation: flyout-flash 1.6s ease-out; }
@keyframes flyout-flash {
    0%, 35% { background: var(--hover-fill); box-shadow: 0 0 0 6px var(--hover-fill); }
    100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}
@media (prefers-reduced-motion: reduce) { .flyout-subsection.flyout-flash { animation-timing-function: steps(1, end); } }

.lock-toggle-btn {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--muted-foreground);
    transition: background 0.15s, color 0.15s;
}
.lock-toggle-btn:hover {
    background: var(--accent);
}
.lock-toggle-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}
.lock-toggle-btn svg {
    width: 14px;
    height: 14px;
}
.lock-toggle-btn[hidden] { display: none; }
/* a section title row holding more than one control (Effects > Feather: the edge link and the switch) */
.fx-head-ctl { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* ------------------------------------------------------------------
   Drawing kind (v1.81, modules/drawing.js): chrome only shows on a drawing */
[data-dwchrome] { display: none !important; }
#editor-root.doc-drawing [data-dwchrome] { display: flex !important; }
#editor-root.doc-drawing.doc-restricted [data-tool="wire"] { display: none !important; }
/* v1.97.6: no pen, type on path or gradients on a sheet (Drawing.HIDDEN_TOOLS guards the shortcuts) */
#editor-root.doc-drawing [data-tool="pen"], #editor-root.doc-drawing [data-tool="textOnPath"],
#editor-root.doc-drawing [data-tool="gradient"], #editor-root.doc-drawing [data-tool="feather"],
#editor-root.doc-drawing [data-tool="scale"], #editor-root.doc-drawing [data-tool="shear"],
#editor-root.doc-drawing [data-tool="parts"] + .tools-strip-sep { display: none !important; }
/* 2.0.20: New component at the top of the Parts drawer, and the Team tag on a team component's tile */
.dw-newcomp { width: 100%; margin-bottom: var(--sp-2); justify-content: center; }
.dw-teamtag { font-size: 10px; line-height: 1.4; padding: 0 6px; border-radius: var(--radius-full); background: var(--accent); color: var(--muted-foreground); }
/* 2.0.19 (Phil 30 Sep 2026): no right-hand panels a sheet has no use for. Type on a path is not a drawing tool;
   effects, text styles and hyperlinks are not part of a schematic */
#editor-root.doc-drawing .props-strip-btn[data-flyout="textpath"], #editor-root.doc-drawing .props-strip-btn[data-flyout="effects"],
#editor-root.doc-drawing .props-strip-btn[data-flyout="cstyles"], #editor-root.doc-drawing .props-strip-btn[data-flyout="pstyles"],
#editor-root.doc-drawing .props-strip-btn[data-flyout="links"],
#editor-root.doc-drawing .props-strip-btn[data-flyout="gradient"],
#editor-root.doc-drawing .props-strip-btn[data-flyout="textwrap"] { display: none !important; }
.dw-search { width: 100%; margin-bottom: var(--sp-2); }
.dw-hint { font-size: var(--text-xs); color: var(--muted-foreground); line-height: 1.45; margin: 0 0 var(--sp-2); }
.dw-sec + .dw-sec { border-top: 1px solid var(--border); }
.dw-sec h3 { margin: var(--sp-3) 0 var(--sp-2); }
.dw-sec-t { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 4px 2px; margin: 0 -2px; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); border-radius: var(--radius-sm); }
.dw-sec-t:hover { color: var(--foreground); background: var(--accent); }
.dw-sec-t svg { width: 13px; height: 13px; flex: none; transition: transform var(--duration-fast); }
.dw-sec-t .dw-cnt { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; background: var(--muted); border-radius: 10px; padding: 1px 7px; }
.dw-sec.is-collapsed .dw-sec-t svg { transform: rotate(-90deg); }
.dw-sec.is-collapsed .dw-tiles { display: none; }
.is-searching .dw-sec.is-collapsed .dw-tiles { display: grid; }
.dw-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dw-tile { display: flex; flex-direction: column; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 8px 4px 7px; cursor: pointer; font: inherit; font-size: 11.5px; line-height: 1.25; text-align: center; color: var(--foreground); }
.dw-tile:hover { border-color: var(--ring); }
.dw-tile.is-armed { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.dw-tile img { width: 92px; height: 40px; object-fit: contain; }
[data-theme="dark"] .dw-tile img, [data-theme="dark"] .dw-var img { filter: invert(1); }
.dw-pop { min-width: 0; max-width: min(720px, calc(100vw - 24px)); padding: var(--sp-2); }
.dw-pop-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dw-pop-row + .dw-pop-row { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.dw-pop-size span { font-size: var(--text-xs); color: var(--muted-foreground); padding: 0 4px; }
.dw-var { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 4px 5px 3px; cursor: pointer; min-width: 56px; font: inherit; color: var(--muted-foreground); }
.dw-var img { width: 46px; height: 24px; object-fit: contain; }
.dw-var span { font-size: 10.5px; white-space: nowrap; }
.dw-var:hover { border-color: var(--ring); }
.dw-var.is-on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); color: var(--foreground); }
.dw-size { border: 1px solid var(--border); background: var(--card); color: var(--foreground); border-radius: var(--radius-sm); padding: 5px 9px; min-width: 30px; cursor: pointer; font: inherit; font-size: 12px; }
.dw-size.is-on { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.dw-dsec { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); margin: var(--sp-4) 0 var(--sp-2); }
.dw-dsec span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.dw-fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--sp-2); }
.dw-fld > span { font-size: var(--text-xs); color: var(--muted-foreground); }
.dw-fld .input { width: 100%; }
.dw-row2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--sp-2); }
.dw-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; align-self: flex-start; }
.dw-seg button { border: 0; border-right: 1px solid var(--border); background: var(--card); color: var(--foreground); padding: 6px 14px; cursor: pointer; font: inherit; font-size: 12px; }
.dw-seg button:last-child { border-right: 0; }
.dw-seg button.is-on { background: var(--primary); color: var(--primary-foreground); }
.dw-lrow { display: flex; gap: 6px; margin-bottom: 6px; }
.dw-tiles-wide { grid-template-columns: 1fr; }
.dw-tiles-wide .dw-tile img { width: 100%; height: 58px; }
.dw-tile-lib { position: relative; }
.dw-rm { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); font-size: 13px; line-height: 15px; display: none; }
.dw-tile-lib:hover .dw-rm { display: block; }
.dw-rm:hover { color: var(--foreground); border-color: var(--ring); }
.dw-nothumb { display: block; width: 100%; height: 58px; background: var(--muted); border-radius: 4px; }
.dw-empty { grid-column: 1 / -1; margin: 0; }
.dw-pop-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.dw-check { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted-foreground); margin-top: 4px; }
.dw-drawer { width: 236px; }
.dw-drawer-body { flex: 1; overflow-y: auto; padding: var(--sp-3); }
#editor-root.doc-drawing.doc-restricted [data-tool="parts"] { display: flex !important; }
.dw-pop-title { font-weight: 600; white-space: nowrap; padding: 0 4px; }
.dw-pop-lbl { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }
.dw-pop .dw-seg button { padding: 5px 9px; min-width: 30px; }
.dw-pop .dw-lines button { display: flex; align-items: center; padding: 5px 7px; }
/* v1.97.6: wire end connectors (click a wire's end handle) */
.dw-pop .dw-pop-grp { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; }   /* a label wraps with its buttons */
.dw-pop .dw-caps button { display: flex; align-items: center; justify-content: center; padding: 4px 5px; min-width: 38px; }
.dw-pop .dw-caps button.is-on svg { --popover: var(--primary); }
.dw-pop .dw-caps img { width: 24px; height: 14px; object-fit: contain; }
/* v1.97.6: one control height in the drawing popovers, everything centred on the row (segmented controls were
   pinned to the top by .dw-seg's align-self and ran shorter than the buttons beside them) */
.dw-pop .dw-seg { align-self: center; height: 28px; box-sizing: border-box; }
.dw-pop .dw-seg button { height: 100%; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.dw-pop .dw-act { height: 28px; box-sizing: border-box; display: inline-flex; align-items: center; line-height: 1; padding: 0 10px; }
.dw-pop .dw-len { height: 28px; box-sizing: border-box; align-self: center; }
.dw-pop .dw-pop-title, .dw-pop .dw-pop-lbl { align-self: center; line-height: 1; }
.dw-pop .dw-pop-lbl b { font-weight: 600; color: var(--foreground); }

/* Contextual toolbar over the canvas selection (context-bar.js, v2.0.9). A layer over the canvas area holds an
   invisible proxy that tracks the selection on every render; the bar is anchored to it with CSS anchor positioning
   (Baseline 2026) in the band above it, centred and kept inside the canvas area, below when there is no room.
   ONE row: what does not fit goes into the More menu (priority+, done in JS). Engines without anchor positioning
   get left/top from JS (.ctx-js). Visibility is derived in JS and shown with data-open. */
.ctx-layer { grid-column: 2; grid-row: 2; position: relative; min-width: 0; min-height: 0; pointer-events: none; z-index: var(--z-dropdown); container-type: inline-size; }
.ctx-proxy { position: absolute; anchor-name: --pbc-ctx; pointer-events: none; }   /* empty, so unseen; never visibility:hidden (an anchored box hides with an invisible anchor) */
.ctx-bar {
    position: absolute; pointer-events: auto;
    position-anchor: --pbc-ctx; position-area: top; justify-self: anchor-center; margin: 10px 6px;
    position-try-fallbacks: flip-block;
    position-visibility: always;   /* off-screen is decided in JS (data-offscreen) */
    flex-wrap: nowrap; align-items: center; gap: 1px;
    padding: 4px; width: max-content; max-width: calc(100cqi - 12px); overflow: hidden;   /* cqi: the canvas area (a % would resolve against the anchor band) */
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    /* hidden = not rendered (display:none), so every opening places the bar afresh: anchor positioning remembers
       the last position that fitted for as long as a box exists. Entry and exit fade with @starting-style and
       transition-behavior: allow-discrete (Baseline 2024). */
    display: none; opacity: 0; translate: 0 3px;
    transition: opacity var(--duration-fast) var(--ease-default), translate var(--duration-fast) var(--ease-default), display var(--duration-fast) allow-discrete;
}
.ctx-bar.ctx-pass { pointer-events: none; }   /* clicks in quick succession reach the text under it (context-bar.js) */
.ctx-bar[data-open]:not([data-offscreen]) { display: flex; opacity: 1; translate: 0 0; }
@starting-style { .ctx-bar[data-open]:not([data-offscreen]) { opacity: 0; translate: 0 3px; } }
.ctx-bar.ctx-js { margin: 0; }
.ctx-inner { display: contents; }
.ctx-bar .ctx-inner > [hidden] { display: none !important; }
.ctx-title { font-size: var(--text-sm); font-weight: 600; padding: 0 8px; white-space: nowrap; flex: none; }
.ctx-sep { width: 1px; align-self: stretch; margin: 5px 4px; background: var(--border); flex: none; }
.ctx-btn, .ctx-pick {
    height: 30px; min-width: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 7px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit;
    font: inherit; font-size: var(--text-sm); line-height: 1; white-space: nowrap; cursor: pointer;
}
.ctx-btn:hover, .ctx-pick:hover, .ctx-btn[aria-expanded="true"], .ctx-pick[aria-expanded="true"] { background: var(--hover-fill); }
.ctx-btn.has-text { padding: 0 9px; }
.ctx-btn.has-text svg { opacity: .75; }
.ctx-btn.is-danger { color: var(--destructive-text); }
.ctx-btn.is-on { background: var(--accent); color: var(--primary); }   /* a pressed toggle (Bold), as the top bar's */
.ctx-pick.ctx-pick-plain { font-weight: 400; gap: 8px; padding: 0 8px; }   /* the text pop-up's paragraph style: "Aa Heading 1" */
/* the style's name keeps its descenders (line-height 1 with overflow hidden cut the p, g and y: Phil 14 Oct 2026, "text is
   clipping in the paragraph style text"), and the Aa sits on the name's baseline, not the button's middle */
.ctx-pick.ctx-pick-plain .ctx-pick-t { max-width: 180px; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.ctx-pick.ctx-pick-plain .ctx-ico { transform: translateY(var(--ctx-aa-drop, 2px)); }
/* a colour swatch has no baseline: it sits on the button's middle (Phil 18 Nov 2026: the highlight colour's square hung 2 px low) */
.ctx-pick.ctx-pick-sw .ctx-ico { transform: none; }
.ctx-pick.ctx-pick-sw .ctx-pick-t:empty { display: none; }
.ctx-pick { padding: 0 6px 0 8px; font-weight: 600; }
.ctx-pick img { width: 30px; height: 16px; object-fit: contain; }
.ctx-pick > svg { opacity: .55; margin-left: -2px; }
.ctx-ico { display: inline-flex; align-items: center; }
.ctx-lbl { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; padding: 0 4px; }
.ctx-text { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; padding: 0 6px; flex: none; }
.ctx-text b { color: var(--foreground); font-weight: 600; }
.ctx-seg { display: inline-flex; align-items: center; gap: 2px; padding: 0 3px; flex: none; }
.ctx-seg-in { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--muted); }
.ctx-seg-in button {
    height: 26px; min-width: 26px; padding: 0 7px; border: 0; border-radius: calc(var(--radius-sm) - 1px);
    display: inline-flex; align-items: center; justify-content: center; background: transparent; color: var(--muted-foreground);
    font: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer;
}
.ctx-seg-in button:hover { color: var(--foreground); }
.ctx-seg-in button.is-on { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px rgba(26, 33, 58, .16); }
.ctx-thumbs .ctx-seg-in { background: transparent; padding: 0; }
.ctx-thumbs .ctx-seg-in button { width: 32px; height: 32px; min-width: 32px; padding: 0; overflow: hidden; border: 1px solid var(--border); background: var(--muted); }
.ctx-thumbs .ctx-seg-in button:hover { border-color: var(--ring); }
.ctx-thumbs .ctx-seg-in button.is-on { border: 2px solid var(--foreground); box-shadow: none; }
.ctx-thumbs .ctx-seg-in img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ctx-field { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px; flex: none; }
.ctx-field .input { height: 28px; width: 66px; padding: 0 6px; font-size: var(--text-sm); }
.ctx-bar :focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ctx-tip {
    position: absolute; pointer-events: none; padding: var(--tip-pad); border-radius: var(--tip-radius);
    background: var(--tip-bg); color: var(--tip-fg); box-shadow: 0 0 0 1px var(--tip-ring), 0 4px 14px rgba(0, 0, 0, 0.18);
    font-size: var(--tip-font); font-weight: 500; line-height: 1.3; white-space: nowrap;
    opacity: 0; transition: opacity var(--duration-fast) var(--ease-default);
}
.ctx-tip[data-open] { opacity: 1; }
.ctx-menu { max-height: min(420px, calc(100vh - 80px)); overflow-y: auto; }
.ctx-menu-foot { position: sticky; bottom: calc(-1 * var(--sp-1)); margin-bottom: calc(-1 * var(--sp-1)); padding-bottom: var(--sp-1); background: var(--popover); }   /* a long list of styles scrolls under the actions, down to the menu's edge */
.ctx-menu-ask { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-1); }
.ctx-menu-ask .view-menu-heading { padding: 0; }
.ctx-menu-ask-btns { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.ctx-menu .ctx-menu-thumb { width: 38px; height: 18px; object-fit: contain; flex: none; }
.ctx-menu .ctx-menu-ico { display: inline-flex; width: 38px; justify-content: center; flex: none; }
[data-theme="dark"] .ctx-pick img, [data-theme="dark"] .ctx-menu .ctx-menu-thumb { filter: invert(1); }
@media (prefers-reduced-motion: reduce) { .ctx-bar, .ctx-bar[data-open]:not([data-offscreen]), .ctx-tip { transition: none; translate: none; } }
/* v1.97.6: title block From / For in Sheet details: Show, Logo (thumbnail + Change + remove), name */
.dw-logo { display: flex; align-items: center; gap: 6px; }
.dw-logo-thumb { flex: none; width: 88px; height: 40px; padding: 4px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; overflow: hidden; cursor: pointer; }
.dw-logo-thumb:hover { border-color: var(--ring); }
.dw-logo-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dw-logo-none { font-size: var(--text-xs); color: var(--muted-foreground); }
.dw-logo .btn-sm { height: 28px; }
.dw-logo-rm { width: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--muted-foreground); }
.dw-logo-rm:hover { color: var(--foreground); }
.dw-link { align-self: flex-start; border: 0; background: none; padding: 2px 0 0; font: inherit; font-size: var(--text-xs); color: var(--muted-foreground); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.dw-link:hover { color: var(--foreground); }
.dw-seg button:disabled { opacity: .45; cursor: default; }
.dw-logo-picker { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.dw-logo-picker[hidden] { display: none; }
.dw-logo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-height: 200px; overflow-y: auto; }
.dw-logo-tile { aspect-ratio: 1; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dw-logo-tile:hover { border-color: var(--ring); }
.dw-logo-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dw-logo-up { align-self: flex-start; cursor: pointer; }
.dw-len { width: 68px; height: 28px; padding: 0 6px; text-align: right; }
.dw-act { border: 1px solid var(--border); background: var(--card); color: var(--foreground); border-radius: var(--radius-sm); padding: 6px 9px; cursor: pointer; font: inherit; font-size: 12px; white-space: nowrap; }
.dw-act:hover { background: var(--accent); }
.dw-act.is-danger { color: hsl(0 72% 45%); }
.dw-sec h3, .dw-grp h4 { display: flex; align-items: center; gap: 4px; margin: var(--sp-3) 0 var(--sp-2); }
.dw-grp h4 { margin: var(--sp-2) 0; }
.dw-grp { grid-column: 1 / -1; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 8px 8px; }
.dw-grp .dw-sec-t { text-transform: none; letter-spacing: 0; font-size: 12px; min-width: 0; }
/* titles read from the left; a section title may wrap, a group's own name stays on one line (full name in its tooltip) */
.dw-sec-t > span:not(.dw-cnt) { text-align: left; min-width: 0; }
.dw-grp .dw-gname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-grp.is-collapsed .dw-tiles { display: none; }
.dw-grp.is-collapsed .dw-sec-t svg { transform: rotate(-90deg); }
.dw-mini { border: 1px solid var(--border); background: var(--card); color: var(--muted-foreground); border-radius: var(--radius-sm); padding: 2px 7px; font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.dw-mini:hover { color: var(--foreground); border-color: var(--ring); }
/* Library (v2.0.9): an ellipsis menu beside each saved circuit and group (Rename, Duplicate, Move, Delete) instead of
   a bare remove button; saved circuits also live inside the built-in sections (.dw-saved). */
.dw-libcard { position: relative; min-width: 0; }
.dw-libcard > .dw-tile { width: 100%; }
.dw-more {
    width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); cursor: pointer;
}
.dw-more:hover, .dw-more[aria-expanded="true"] { background: var(--accent); color: var(--foreground); }
.dw-libcard > .dw-more { position: absolute; top: 4px; right: 4px; background: var(--card); box-shadow: var(--shadow-sm); opacity: 0; transition: opacity var(--duration-fast) var(--ease-default); }
.dw-libcard:hover > .dw-more, .dw-libcard:focus-within > .dw-more, .dw-libcard > .dw-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .dw-libcard > .dw-more { opacity: 1; } }
.dw-grp h4 .dw-more { margin-left: auto; }
.dw-saved { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px dashed var(--border); }
.lib-note { font-weight: 400; color: var(--muted-foreground); text-transform: none; letter-spacing: 0; }
.lib-pop { width: 300px; }
.lib-pop .folder-pop-list { max-height: 240px; }
.dw-drop { grid-column: 1 / -1; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 12px 8px; font-size: 11.5px; color: var(--muted-foreground); text-align: center; transition: all var(--duration-fast); }
.dw-drop.is-over { border-color: var(--primary); border-style: solid; color: var(--foreground); background: var(--accent); }
.dw-lrow .input { flex: 1; min-width: 0; }

/* Document-mode swap popover */
/* Pen Tool active state — crosshair cursor on canvas */
.pen-tool-active .canvas-container {
    cursor: crosshair !important;
}
.pen-tool-active .upper-canvas {
    cursor: crosshair !important;
}

/* Left tools strip separator */
.tools-strip-sep {
    height: 1px;
    width: 28px;
    background: var(--border);
    margin: var(--sp-2) 0;
}

.prop-section {
    margin-bottom: var(--sp-4);
}

.prop-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--sp-2);
}

.prop-row {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}

.prop-label {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    min-width: 52px;
    flex-shrink: 0;
}
.prop-hint {
    font-size: 11px;
    color: var(--muted-foreground);
    flex-shrink: 0;
    white-space: nowrap;
}
/* a hint that is a sentence under a section title (the Paragraph panel's Optical margin) */
.flyout-subsection > p.prop-hint { white-space: normal; margin: 0 0 var(--sp-2); line-height: 1.4; }
.prop-row.oma-ignore { justify-content: space-between; }
.prop-row.oma-ignore .prop-label { min-width: 0; }

.prop-input {
    flex: 1;
    height: 28px;
    font-size: var(--text-xs);
    padding: 0 var(--sp-2);
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--foreground);
}
select.prop-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: var(--sp-7);
    background-image: var(--select-chevron);
    background-size: 14px 14px;
    background-repeat: no-repeat;
    background-position: right var(--sp-2) center;
    cursor: pointer;
}

.prop-input:focus {
    border-color: var(--ring);
}

/* NUMBER FIELD (the atom, 2.0.55-tables.21; Phil 14 Oct 2026, the Paragraph panel first: "please use best practice ui/ux and
   optimised the spacing here too"). One box holds a short label (a word, or a side icon), the number and its unit, as in
   Figma's and InDesign's panels: fields pair up two to a row on one grid, a value never runs into its unit, and a box is
   as wide as numbers need. The whole box is the label (a click anywhere focuses the number); spinners are hidden (arrow
   keys still step it); an empty field shows its placeholder (Auto) without its unit. flyout-panel.js `_numField`. */
/* ---- Tab stops and leaders (tab-stops.js): the Paragraph panel's Tabs section, Style Options, and the ruler over a text frame ---- */
.tab-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--sp-2); }
.tab-chip {
    display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 var(--sp-2); max-width: 100%;
    border: 1px solid var(--input); border-radius: var(--radius-sm); background: transparent; color: var(--foreground);
    font-size: var(--text-xs); cursor: pointer; white-space: nowrap;
}
.tab-chip:hover { background: var(--hover-fill); }
.tab-chip:focus-visible, .tab-tile:focus-visible, .tab-mark:focus-visible, .tab-ruler-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tab-chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.tab-chip-add { border-style: dashed; color: var(--muted-foreground); }
.tab-chip-i { display: inline-flex; }
.tab-chip-i svg { width: 14px; height: 14px; }
.tab-row { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.tab-row .num-field { flex: 1 1 0; }
.tab-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-bottom: var(--sp-2); }
.tab-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; min-height: 44px; padding: 6px 2px 4px;
    border: 1px solid var(--input); border-radius: var(--radius-sm); background: transparent; color: var(--foreground); cursor: pointer; min-width: 0;
}
.tab-tile:hover { background: var(--hover-fill); }
.tab-tile.is-on { border-color: var(--foreground); box-shadow: inset 0 0 0 1px var(--foreground); }
.tab-tile svg { width: 100%; height: 14px; display: block; }
.tab-tile-n { font-size: var(--text-2xs, 11px); color: var(--muted-foreground); }
.tab-tile.is-on .tab-tile-n { color: var(--foreground); }
.tab-tile-char { height: 14px; line-height: 14px; font-size: 13px; max-width: 100%; overflow: hidden; }
.tab-tile-none { height: 14px; }
.tab-scale { margin-top: var(--sp-2); justify-content: space-between; }
.tab-colour { display: flex; min-width: 0; }
.tab-colour input[type="color"] { flex: 1 1 auto; min-width: 0; }
.tab-acts { display: flex; gap: var(--sp-2); }
.tab-acts-end { justify-content: flex-end; margin-top: var(--sp-1); }
.tab-remove { gap: 4px; color: var(--muted-foreground); }
.tab-remove svg { width: 14px; height: 14px; }
/* a sentence here wraps in the panel (.prop-hint is one line) */
.prop-hint.tab-hint { white-space: normal; flex-shrink: 1; margin: 0 0 var(--sp-2); line-height: 1.4; }
/* paragraphs that differ: each set of tabs in words and at its real size; the one pressed goes on all of them */
.tab-sets { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--sp-2); }
.tab-set {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px var(--sp-2); padding: 6px var(--sp-2); width: 100%; text-align: left;
    border: 1px solid var(--input); border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font-size: var(--text-xs); cursor: pointer;
}
.tab-set:hover { background: var(--hover-fill); }
.tab-set:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tab-set-words { min-width: 0; overflow-wrap: anywhere; }
.tab-set-n { color: var(--muted-foreground); font-size: var(--text-2xs, 11px); white-space: nowrap; }
.tab-set-look { grid-column: 1 / -1; display: block; width: 100%; }

.tab-ruler {
    --tab-ruler-tick: var(--border);
    position: fixed; z-index: var(--z-sticky); pointer-events: none; user-select: none; -webkit-user-select: none;
}
.tab-ruler[hidden] { display: none; }
.tab-ruler-tools {
    position: relative; display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 2px; margin-bottom: 2px; pointer-events: auto;
    width: max-content; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--popover); color: var(--popover-foreground); box-shadow: var(--shadow-sm);
}
.tab-ruler-group { display: inline-flex; gap: 1px; padding-right: 2px; margin-right: 2px; border-right: 1px solid var(--border); }
.tab-ruler-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 24px; height: 24px; padding: 0 3px; border: 0; border-radius: var(--hover-radius);
    background: none; color: inherit; font-size: var(--text-xs); cursor: pointer;
}
.tab-ruler-btn svg { width: 14px; height: 14px; }
.tab-ruler-btn:hover { background: var(--hover-fill); }
.tab-ruler-btn.is-on { background: var(--primary); color: var(--primary-foreground); }
.tab-ruler-word { padding: 0 6px; }
.tab-ruler-say { font-size: var(--text-xs); color: var(--muted-foreground); padding: 0 4px; font-variant-numeric: tabular-nums; }
.tab-ruler-say:empty { display: none; }
.tab-ruler-track {
    position: relative; height: 20px; pointer-events: auto; cursor: copy; touch-action: none;
    background: var(--popover); box-shadow: 0 0 0 1px var(--border); border-radius: 2px 2px 0 0;
}
.tab-ruler-track canvas { position: absolute; left: 0; top: 0; display: block; }
.tab-ruler-marks { position: absolute; inset: 0; }
.tab-mark {
    position: absolute; top: 0; width: 24px; height: 20px; margin-left: -12px; padding: 0; border: 0; background: none; color: var(--foreground); cursor: ew-resize; touch-action: none;
    display: flex; align-items: flex-end; justify-content: center;
}
.tab-mark svg { width: 20px; height: 20px; stroke-width: 2.5; }
.tab-mark:hover { color: var(--ring); }
.tab-mark.is-on { color: var(--ring); }
.tab-mark.is-on::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ring); opacity: .25; }
.tab-mark.is-ghost { opacity: .4; pointer-events: none; }
.tab-ruler.is-removing .tab-ruler-track { cursor: not-allowed; }
.tab-ruler-guide { position: fixed; width: 0; border-left: 1px dashed var(--ring); z-index: var(--z-sticky); pointer-events: none; }
.tab-ruler-guide[hidden] { display: none; }

.num-field {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    height: 28px; padding: 0 var(--sp-2);
    border: 1px solid var(--input); border-radius: var(--radius-sm);
    background: transparent; color: var(--foreground);
    font-size: var(--text-xs); cursor: text;
}
.num-field:focus-within { border-color: var(--ring); }
.num-field-k { flex: none; display: flex; align-items: center; color: var(--muted-foreground); white-space: nowrap; -webkit-user-select: none; user-select: none; }
.num-field-k svg { width: 14px; height: 14px; }
.num-field input {
    flex: 1 1 auto; width: 100%; min-width: 0; height: 100%; padding: 0;
    border: 0; outline: none; background: none;
    font: inherit; color: inherit; font-variant-numeric: tabular-nums;
    appearance: textfield; -moz-appearance: textfield;
}
.num-field input::-webkit-inner-spin-button, .num-field input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-field input::placeholder { color: var(--muted-foreground); opacity: 1; }
.num-field-u { flex: none; color: var(--muted-foreground); -webkit-user-select: none; user-select: none; }
.num-field input:placeholder-shown + .num-field-u { visibility: hidden; }
.num-field:has(input:disabled) { opacity: 0.5; cursor: default; }
/* two to a row on one grid; one to a row when the panel is too narrow for two (auto-fill keeps a lone field half wide) */
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(96px, calc((100% - var(--sp-2)) / 2)), 1fr)); gap: 6px var(--sp-2); }
/* a number field with a list (the Character panel's Leading, js/modules/leading.js): a chevron at the end opens PBC's list; the
   select sits over it, unseen, so a press on the chevron opens it and the field stays the one box */
.num-field-list { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 2px; color: var(--muted-foreground); border-radius: var(--radius-sm); }
.num-field-list:hover { color: var(--foreground); background: var(--accent); }
.num-field-list > select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.num-field-list:has(select:focus-visible) { outline: 2px solid var(--ring); outline-offset: 1px; }
/* three to a row: a min / ideal / max range (the Paragraph panel's Justification, compose/settings.js) */
.num-grid.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.num-grid.is-three .num-field-k { max-width: 3.2em; overflow: hidden; text-overflow: ellipsis; }
/* a panel whose sections stack their rows evenly: 8 px between rows, 16 px between sections */
.flyout-stack .flyout-subsection { display: flex; flex-direction: column; gap: var(--sp-2); }
.flyout-stack .flyout-subsection > * { margin: 0; }
.flyout-subsection-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 24px; }
.flyout-subsection-head .flyout-subsection-title { margin: 0; }
/* a set of icon toggles (text alignment, vertical alignment) and a lone icon toggle in a row, 28 px */
.tbtn-group { display: flex; gap: 2px; }
.tbtn-group .toolbar-btn, .flyout-stack .prop-row > .toolbar-btn { flex: none; width: 28px; height: 28px; }
.tbtn-group .toolbar-btn svg, .flyout-stack .prop-row > .toolbar-btn svg { width: 16px; height: 16px; }
/* THE SHAPE PANEL on the same atoms (2.0.55-tables.22; Phil 14 Oct 2026: "couldnt we inline these and tidy up based on best
   practice ui/ux research?"): a section's title row carries its switch (Stroke) or its menu (Fill), menus open PBC's list in
   the caret component, numbers are number fields two to a row, actions stack full width at the end */
.flyout-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.flyout-note { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
/* THE STYLE LOCK (js/modules/style-lock.js, Phil 15 Oct 2026: "one rule for all"): a panel that only restyles shows a
   style-locked selection's values with its controls greyed, under a note saying how to restyle; a frame's picture
   ([data-content]: Fill | Fit, Adjust picture, Replace, Remove) stays open. Each control is greyed once, never inside another. */
.style-lock-note { display: flex; gap: var(--sp-2); align-items: flex-start; margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm); background: var(--secondary-soft); color: var(--foreground); font-size: var(--text-xs); line-height: 1.45; }
.style-lock-note svg { flex: none; margin-top: 1px; color: var(--muted-foreground); }
.dock-body.is-style-locked :is(.num-field:has(input:disabled), .select-field:has(select:disabled), button:disabled, input:disabled:not(.num-field *), select:disabled:not(.select-field *)) { opacity: .5; }
.dock-body.is-style-locked :disabled { cursor: not-allowed; }
.flyout-actions .btn { width: 100%; }
.flyout-stack .flyout-subsection.flyout-actions { gap: 6px; }
.select-field--compact > select.prop-input { width: 112px; height: 26px; }
.num-grid > .select-field { display: flex; min-width: 0; }
.num-grid > .select-field > select.prop-input { width: 100%; min-width: 0; height: 28px; }
/* EVERY PANEL ON THE FIELDS (2.0.55-tables.29, Phil 14 Oct 2026: "moving the remaining panels onto the new number boxes";
   js/modules/ui/panel-fields.js): a field with a long label takes its row; a read-out is the box without its border; a menu
   alone in a row, or beside its label, fills it */
.num-field.is-wide { grid-column: 1 / -1; }
.num-field.is-static { border-color: transparent; cursor: default; }
.num-field-v { flex: 1 1 auto; min-width: 0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-row > .select-field, .tbl-field > .select-field { display: flex; flex: 1 1 auto; min-width: 0; }
.prop-row > .select-field > select.prop-input, .tbl-field > .select-field > select.prop-input { width: 100%; min-width: 0; height: 28px; }
/* scrubbing: a field's label drags its value (Figma's panels; the sliders went), so it wears the left-right cursor */
.num-field:not(:has(input:disabled)) .num-field-k { cursor: ew-resize; }
body.num-scrubbing, body.num-scrubbing * { cursor: ew-resize !important; -webkit-user-select: none !important; user-select: none !important; }
/* the Character panel's No Break beside B I U */
.flyout-stack .prop-row > .toolbar-btn.nobreak-btn { width: auto; padding: 0 var(--sp-2); font-size: var(--text-xs); white-space: nowrap; }
/* the gradient ramp with its two stop buttons beside it */
.grad-ramp-row { display: flex; align-items: center; gap: var(--sp-2); }
.grad-ramp-row > .grad-ramp-wrap { flex: 1 1 auto; min-width: 0; }

/* Editor Status Bar */
.editor-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 28px;
    padding: 0 var(--sp-3);
    border-top: 1px solid var(--border);
    background: var(--background);
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    flex-shrink: 0;
}

#ed-status-right { display: flex; align-items: center; gap: var(--sp-3); }
/* Continuous pages (2.0.11): pages still being prepared, and a spinner over a page with no render yet */
.status-prep { display: inline-flex; align-items: center; gap: var(--sp-2); font-variant-numeric: tabular-nums; }
.status-prep[hidden] { display: none; }
.status-prep-bar { width: 56px; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.status-prep-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--muted-foreground); transition: width .3s ease; }
.status-prep.is-loading .status-prep-bar i { width: 40%; animation: prep-indeterminate 1.1s ease-in-out infinite; }
@keyframes prep-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.strip-loading-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.strip-loading {
    position: absolute; left: 0; top: 0;
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 6px 12px 6px 10px; border-radius: 999px;
    background: var(--popover); color: var(--muted-foreground); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); font-size: var(--text-xs); white-space: nowrap;
}
.strip-spin {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--border); border-top-color: var(--muted-foreground);
    animation: spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .strip-spin { animation-duration: 2.4s; } .status-prep.is-loading .status-prep-bar i { animation-duration: 3s; } }

/* Toolbar text labels */
.toolbar-btn strong { font-weight: 700; }
.toolbar-btn em { font-style: italic; }
.toolbar-btn u { text-decoration: underline; }

.toolbar-btn.active {
    background: var(--accent);
    color: var(--accent-foreground);
    font-weight: 600;
}

/* Toolbar selects/inputs. background-COLOR: the shorthand also wiped select.prop-input's chevron, so the font and weight
   menus showed no down caret (Phil 14 Oct 2026: "where is the carrot down here?") */
.editor-toolbar .prop-input {
    border: 1px solid var(--border);
    background-color: var(--background);
    color: var(--foreground);
}
/* ATOMIC HOVER (see the --hover-* tokens): an inset rounded fill behind a control's icon, never a full-bleed block against
   its neighbours; the size field's steps and chevron and every .select-field caret wear it */
.pbc-hover { position: relative; isolation: isolate; }
.pbc-hover::before {
    content: '';
    position: absolute;
    inset: var(--hover-inset);
    z-index: -1;
    border-radius: var(--hover-radius);
    background: var(--hover-fill);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-default);
    pointer-events: none;
}
.pbc-hover:hover::before, .pbc-hover:focus-visible::before { opacity: 1; }
.pbc-hover:active::before, .pbc-hover[aria-expanded="true"]::before { opacity: 1; background: var(--hover-fill-pressed); }
.pbc-hover:hover, .pbc-hover[aria-expanded="true"] { color: var(--foreground); }
@media (prefers-reduced-motion: reduce) { .pbc-hover::before { transition: none; } }

/* A menu with its caret as a control (select-menu.js; the top bar's font and weight): the select keeps its look and value,
   the caret is a .pbc-hover that lights while the menu is pointed at, and stays pressed while its list is open */
.select-field { position: relative; display: inline-flex; align-items: center; flex: none; }
.select-field > select.prop-input, .select-field > select.input { background-image: none; padding-right: 30px; }
.select-caret {
    position: absolute; top: 1px; right: 1px; bottom: 1px; width: 28px;
    display: grid; place-items: center;
    color: var(--muted-foreground);
    pointer-events: none;
}
.select-field:hover .select-caret::before { opacity: 1; }
.select-field:hover .select-caret { color: var(--foreground); }
.select-field.is-open .select-caret::before { opacity: 1; background: var(--hover-fill-pressed); }

/* The size field (js/modules/size-field.js, 14 Oct 2026): InDesign's steps on the left, the size to type into, and the
   list of five sizes from the chevron. One bordered box like the toolbar's other inputs; the ring shows on the box. */
.size-field {
    display: inline-flex;
    align-items: stretch;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--foreground);
    overflow: hidden;
    flex: none;
}
.size-field:focus-within { border-color: var(--ring); }
.size-steps { display: flex; flex-direction: column; width: 18px; border-right: 1px solid var(--border); }
.size-step, .size-open {
    display: grid;
    place-items: center;
    padding: 0;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
}
.size-step { flex: 1; min-height: 0; }
.size-step + .size-step { border-top: 1px solid var(--border); }
/* the steps and the chevron wear the atomic hover (.pbc-hover): an inset rounded fill that never meets the size (Phil
   14 Oct 2026: "this carrot hover state looks bad.. 'p' is budded up to it"); the steps are small, so a tighter inset */
.size-open { width: 28px; }
.size-step { --hover-inset: 2px; --hover-radius: 4px; }
.size-input {
    width: 80px;              /* "100.333 pt" whole (79 px with the padding): three decimals and the unit */
    min-width: 0;
    padding: 0 6px 0 var(--sp-2);
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    outline: none;
}
.tb-tray .size-field { background: transparent; }
.size-list { min-width: 0; padding: var(--sp-1); }
.size-list .view-menu-item { gap: var(--sp-2); padding: 6px var(--sp-2); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.size-list .view-menu-item.is-active { background: var(--hover-fill); }

/* The tooltip PBC draws (tip.js): one look everywhere, from the --tip-* tokens */
.pbc-tip {
    position: fixed; z-index: var(--z-tooltip); pointer-events: none;
    padding: var(--tip-pad); border-radius: var(--tip-radius);
    background: var(--tip-bg); color: var(--tip-fg); box-shadow: 0 0 0 1px var(--tip-ring), 0 4px 14px rgba(0, 0, 0, 0.18);
    font-size: var(--tip-font); font-weight: 500; line-height: 1.3; white-space: nowrap;
    opacity: 0; transition: opacity var(--duration-fast) var(--ease-default);
}
.pbc-tip[data-open] { opacity: 1; }
.pbc-tip[data-wide] { white-space: normal; max-width: 280px; font-weight: 400; line-height: 1.45; }
@media (prefers-reduced-motion: reduce) { .pbc-tip { transition: none; } }
/* the tip sits over every popover (view menus 10001, the colour picker 10002): it points at things inside them */
.pbc-tip { z-index: 10050; }

/* THE COLOUR PICKER (ui/color-picker.js, 14 Oct 2026; Phil: "5th screenshot is what I want for all colour pickers. a
   comprehensive atomic component/organism?"). Built from the atoms: the field box (.prop-input's border and height), the
   caret's atomic hover (.pbc-hover), the shared tooltip, .dw-seg and .btn; colours from the tokens. Every native colour
   input stays in the page (.cp-native, hidden) as the field's value; a swatch with its own look keeps it (data-cp="bare"). */
.cp-native {
    position: absolute !important; width: 1px !important; height: 1px !important; margin: 0 !important; padding: 0 !important;
    border: 0 !important; opacity: 0 !important; pointer-events: none !important; clip-path: inset(50%) !important;
}
.cp-trigger {
    display: inline-flex; align-items: center; gap: 5px; flex: none; min-width: 0;
    height: 28px; padding: 0 2px 0 6px;
    border: 1px solid var(--input); border-radius: var(--radius-sm);
    background: var(--background); color: var(--foreground);
    font: inherit; font-size: var(--text-xs); font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.cp-trigger--field { flex: 1 1 auto; }   /* the row's room: the colour's name and value (Phil 14 Oct 2026: "there is place for the colour name") */
.cp-trigger:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.cp-trigger:disabled { opacity: 0.5; cursor: default; }
.cp-swatch {
    width: 16px; height: 16px; flex: none; border-radius: 50%;
    background: var(--cp-color, #000); box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18);
}
[data-theme="dark"] .cp-swatch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.cp-trigger.is-mixed .cp-swatch { background: linear-gradient(135deg, #fff 0 50%, var(--brand-navy, #1a213a) 50% 100%); }
.cp-hex { flex: 1; min-width: 0; text-align: left; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a brand colour or swatch: its name, then its value in the muted ink (the name gives way first) */
.cp-name { flex: 0 0 auto; max-width: 60%; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-trigger.has-name .cp-hex { flex: 0 1 auto; color: var(--muted-foreground); }
.cp-trigger.has-name .cp-name + .cp-hex { margin-left: 2px; }
.cp-trigger.has-name .cp-chev { margin-left: auto; }   /* the caret keeps to the right edge */
/* the caret: an inset hover that lights while the field is pointed at and stays pressed while the picker is open */
.cp-chev { width: 20px; height: 24px; flex: none; display: grid; place-items: center; color: var(--muted-foreground); --hover-inset: 1px 0; }
.cp-trigger:not(:disabled):hover .cp-chev::before { opacity: 1; }
.cp-trigger:not(:disabled):hover .cp-chev, .cp-trigger[aria-expanded="true"] .cp-chev { color: var(--foreground); }
.cp-trigger[aria-expanded="true"] .cp-chev::before { opacity: 1; background: var(--hover-fill-pressed); }
.cp-trigger[aria-expanded="true"] { border-color: var(--ring); }

.cp-pop {
    position: fixed; z-index: 10002; left: 0; top: 0;
    width: 368px; max-width: calc(100vw - 16px);
    display: flex; flex-direction: column; gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    font-size: var(--text-xs);
}
.cp-main { display: grid; grid-template-columns: minmax(0, 1fr) 14px 136px; gap: 10px; }
.cp-sv {
    position: relative; height: 156px; border-radius: var(--radius-sm); cursor: crosshair; touch-action: none;
    background: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, var(--cp-hue, #f00));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.cp-sv-knob {
    position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; pointer-events: none;
    border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.cp-hue {
    position: relative; border-radius: 7px; cursor: ns-resize; touch-action: none;
    background: linear-gradient(to bottom, #f00 0%, #ff0 16.67%, #0f0 33.33%, #0ff 50%, #00f 66.67%, #f0f 83.33%, #f00 100%);
}
.cp-hue-knob {
    position: absolute; left: -2px; right: -2px; height: 8px; margin-top: -4px; border-radius: 4px; pointer-events: none;
    border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.cp-sv:focus-visible, .cp-hue:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* OPACITY (fill-alpha.js, 24 Oct 2026): a colour's own opacity under the square, a strip from clear to the colour over the
   transparency checks, and its % field (the panel's own Opacity field is the source of truth) */
.cp-alpha { display: grid; grid-template-columns: minmax(0, 1fr) 124px; gap: 10px; align-items: center; }
.cp-alpha .num-field { min-width: 0; }
.cp-alpha-strip {
    position: relative; height: 14px; margin: 0 7px; border-radius: 7px; cursor: ew-resize; touch-action: none;
    background: linear-gradient(to right, transparent, var(--cp-color, #000)), var(--cp-checks);
    box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18);
}
[data-theme="dark"] .cp-alpha-strip { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.cp-alpha-knob {
    position: absolute; top: -2px; bottom: -2px; width: 8px; margin-left: -4px; border-radius: 4px; pointer-events: none;
    border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
}
.cp-alpha-strip:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* the new colour shows its opacity over the same checks (the old half stays as it was) */
.cp-pop { --cp-checks: repeating-conic-gradient(#d6d5d0 0% 25%, #ffffff 0% 50%) 0 0 / 8px 8px; }
.cp-preview { background: var(--cp-checks); }
.cp-new { opacity: var(--cp-alpha, 1); }
.cp-side { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
/* the colour now over the colour it started from (press that half to go back) */
.cp-preview {
    flex: 1; min-height: 52px; display: grid; grid-template-rows: 3fr 2fr;
    border-radius: var(--radius-sm); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18);
}
[data-theme="dark"] .cp-preview { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.cp-new, .cp-was { display: block; }
.cp-was { border: 0; padding: 0; cursor: pointer; }
.cp-was:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.cp-value-row { position: relative; display: flex; }
.cp-value { width: 100%; min-width: 0; flex: 1; padding: 0 28px 0 var(--sp-2); font-variant-numeric: tabular-nums; background: var(--background); }
.cp-value:focus { outline: none; border-color: var(--ring); }
.cp-copy {
    position: absolute; top: 1px; right: 1px; bottom: 1px; width: 26px; padding: 0;
    display: grid; place-items: center; border: 0; background: none; color: var(--muted-foreground); cursor: pointer;
    --hover-inset: 2px; --hover-radius: 4px;
}
.dw-seg.cp-fmt { display: flex; align-self: stretch; }
.dw-seg.cp-fmt button { flex: 1 1 auto; padding: 5px 0; font-size: 10.5px; font-weight: 500; letter-spacing: 0.01em; }
.dw-seg.cp-fmt button[data-fmt="cmyk"] { flex-grow: 1.4; }
.cp-section { display: flex; flex-direction: column; gap: 6px; }
.cp-section[hidden] { display: none; }   /* In this document / Recent with nothing to show */
.cp-heading { font-weight: 500; color: var(--muted-foreground); }
.cp-note { color: var(--muted-foreground); }
.cp-dots { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 22px; }
.cp-dot {
    width: 22px; height: 22px; flex: none; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--cp-color, transparent); box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18);
}
[data-theme="dark"] .cp-dot { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.cp-dot:not(.cp-dot-add):hover { box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18), 0 0 0 2px var(--popover), 0 0 0 3px var(--muted-foreground); }
.cp-dot.is-on, .cp-dot.is-on:hover { box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18), 0 0 0 2px var(--popover), 0 0 0 4px var(--foreground); }
.cp-dot:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.cp-dot-add {
    display: grid; place-items: center; color: var(--muted-foreground);
    background: none; box-shadow: inset 0 0 0 1px var(--border);
    --hover-inset: 2px; --hover-radius: 50%;
}
.cp-dot-add.is-dashed { box-shadow: none; outline: 1px dashed var(--border); outline-offset: -1px; }
.cp-dot-add.is-dashed:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; }
.cp-empty { color: var(--muted-foreground); margin-right: var(--sp-1); }
/* the footer: Clear, Eyedropper and Add to swatches as the panels' own filled buttons (.btn-secondary), icon and word, no
   rule above them (Phil 14 Oct 2026: "clear icon needs similar formatting", "the outline on these buttons seems
   inconsistant with the ui design system", "we dont need the rule above buttons here") */
.cp-foot { display: flex; gap: var(--sp-2); }
.cp-foot .btn { padding: 0 10px; }
.cp-foot-btn { flex: 1 1 auto; gap: 6px; }
.cp-foot .btn-secondary { background: var(--secondary-soft); }   /* Phil 14 Oct 2026: "this shade is too dark" */
.cp-foot .btn-secondary:hover { background: var(--secondary); }
/* FILL TABS (2.0.55-tables.34, Phil 14 Oct 2026: "the Solid / Gradient / Image tabs inside the colour picker itself"): a fill
   field's picker has Solid, Gradient and Image tabs; Gradient adds its type, Angle, Reverse, Remove stop and the ramp over the
   same square; Image holds the picture's buttons in place of the square and swatches (ui/color-picker.js setTab) */
.cp-tabs { display: flex; align-self: stretch; }
.cp-tabs button { flex: 1 1 0; padding: 6px 0; }
.cp-pop [data-cp-tab-hidden] { display: none !important; }
.cp-grad { display: flex; flex-direction: column; gap: 12px; }
.cp-grad[hidden], .cp-image[hidden] { display: none; }
.cp-grad-head { display: flex; align-items: center; gap: 6px; }
.cp-grad-head .num-field { flex: 1 1 auto; min-width: 0; }
.cp-grad-head .num-field[hidden] { display: none; }
.cp-grad-head .dw-seg { align-self: center; }
.cp-grad-btn {
    position: relative; flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border: 0; border-radius: var(--hover-radius); background: none; color: var(--foreground); cursor: pointer;
}
.cp-grad-btn svg { position: relative; }
.cp-grad-btn:disabled { opacity: 0.4; cursor: default; }
.cp-ramp { position: relative; height: 22px; margin: 0 7px 2px; cursor: copy; touch-action: none; }
.cp-ramp-bar { position: absolute; inset: 0; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.18); }
.cp-ramp-stops { position: absolute; inset: 0; }
.cp-stop {
    position: absolute; top: 50%; width: 14px; height: 30px; padding: 0; transform: translate(-50%, -50%);
    border: 2px solid #fff; border-radius: 4px; background: var(--cp-color, #000);
    box-shadow: 0 0 0 1px rgba(26, 33, 58, 0.45), var(--shadow-sm); cursor: ew-resize;
}
.cp-stop.is-on { box-shadow: 0 0 0 2px var(--ring), var(--shadow-sm); z-index: 1; }
/* the picker's midpoints, Location and Angle (16 Nov 2026): a diamond over the ramp between each two stops, as the Gradient panel's */
.cp-grad-gap { flex: 1 1 auto; }
.cp-ramp { margin-top: 12px; }
.cp-ramp-mids { position: absolute; left: 0; right: 0; top: -12px; height: 10px; pointer-events: none; }
.cp-mid {
    position: absolute; top: 0; width: 9px; height: 9px; padding: 0; border: 0; border-radius: 1px; pointer-events: auto;
    transform: translateX(-50%) rotate(45deg); background: var(--muted-foreground); opacity: 0.55; cursor: ew-resize;
}
.cp-mid:hover, .cp-mid:focus-visible { opacity: 1; }
.cp-mid.is-on { opacity: 1; background: var(--primary); }
.cp-grad-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cp-grad-nums .num-field { min-width: 0; }
.cp-grad-nums .num-field[hidden] { display: none; }
/* the Gradient panel's ramp for a plain colour (16 Nov 2026): the gradient it would start, faint until a press puts it on */
.grad-controls.is-preview .grad-ramp { opacity: 0.55; cursor: pointer; transition: opacity var(--duration-fast, 120ms) ease-out; }
.grad-controls.is-preview .grad-ramp:hover, .grad-controls.is-preview .grad-ramp:focus-visible { opacity: 1; }
.grad-controls.is-preview .grad-ramp:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.grad-controls.is-preview .grad-stop { pointer-events: none; }
.cp-image { display: flex; flex-direction: column; gap: var(--sp-2); }
.cp-image .cp-note { margin: 0; line-height: 1.45; }
.cp-wide { width: 100%; }
.cp-fit { align-self: stretch; display: flex; }
.cp-fit button { flex: 1 1 0; }
.cp-pic-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cp-pic-btns .btn:first-child { grid-column: 1 / -1; }
.cp-pic-btns.is-two .btn:first-child { grid-column: auto; }
.cp-pic-btns .btn, .cp-image .btn { background: var(--secondary-soft); }
.cp-pic-btns .btn:hover, .cp-image .btn:hover { background: var(--secondary); }
/* the Images library where a picture is being chosen: the Image tab, Text Frame Options */
.frame-bg-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; max-height: 200px; overflow-y: auto; padding: var(--sp-2) 0 0; }
.frame-bg-picker-item { aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--muted); cursor: pointer; }
.frame-bg-picker-item:hover { border-color: var(--ring); }
.frame-bg-picker-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Image swap in the Image tab: the switch, then the options as a row of small pictures, compact */
.cp-swap { display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.cp-swap-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.cp-swap-head .cp-heading { margin: 0; }
.cp-swap-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.cp-swap-item { position: relative; width: 44px; height: 44px; }
.cp-swap-pick { width: 100%; height: 100%; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--muted); cursor: pointer; }
.cp-swap-pick:hover { border-color: var(--ring); }
.cp-swap-item.is-on .cp-swap-pick { border: 2px solid var(--foreground); }
.cp-swap-pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cp-swap-x { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; background: var(--popover); color: var(--foreground); cursor: pointer; opacity: 0; transition: opacity var(--duration-fast) var(--ease-default); }
.cp-swap-item:hover .cp-swap-x, .cp-swap-x:focus-visible { opacity: 1; }
.cp-swap-add { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.cp-swap-add .btn { min-width: 0; padding-inline: 4px; }
.cp-swap-lib { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; max-height: 160px; overflow-y: auto; }
.cp-swap-lib[hidden] { display: none; }
.cp-swap-lib-item { aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--muted); cursor: pointer; }
.cp-swap-lib-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cp-clear { flex-grow: 0; }
/* a field with no colour: the swatch slashed, as the colour popover's [None] */
.cp-trigger.is-none .cp-swatch {
    background: linear-gradient(to top right, transparent calc(50% - 0.75px), var(--destructive-text) calc(50% - 0.75px), var(--destructive-text) calc(50% + 0.75px), transparent calc(50% + 0.75px)), var(--background);
}

/* Page headers (page-head.js, 14 Oct 2026): a layer over the canvas, so no artwork can cover them. "Page N" above each
   page's top left; above the live page's top right its locks, Duplicate and Add a page (the atomic hover). The layer
   takes no clicks; only the buttons do. */
.page-head-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
/* the Page tool's toolbar stands in for the page's header row while the tool is on (page-tool.js) */
.page-head-layer > * { transition: opacity var(--duration-fast) ease-out; }
.page-head-layer.is-aside > * { opacity: 0; pointer-events: none !important; }
@media (prefers-reduced-motion: reduce) { .page-head-layer > * { transition: none; } }
.page-head {
    position: absolute; left: 0; top: 0; height: 30px;
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
    will-change: transform;
}
.page-head-label { font-size: var(--text-xs); font-weight: 500; color: var(--muted-foreground); white-space: nowrap; }
.page-head.is-live .page-head-label { font-weight: 600; color: var(--foreground); }
.page-head-tools { display: flex; gap: 2px; pointer-events: auto; }
.page-head-btn {
    width: 30px; height: 30px; display: grid; place-items: center;
    padding: 0; border: 0; background: none; color: var(--muted-foreground); cursor: pointer;
}
.page-head-btn.is-locked { color: var(--foreground); }
/* Delete page looks like its neighbours (Phil 14 Oct 2026: "dont make the trash icon look any different to the others") */
/* a locked page's padlock wears its permission's icon on a tile, as in Phil's mock */
.page-head-btn.is-locked::before { opacity: 1; background: var(--muted); }
.page-head-btn.is-locked:hover::before { background: var(--hover-fill); }

/* PAGE PERMISSIONS (page-head.js; Phil's "Version 5" mock, 14 Oct 2026): four choices on icon tiles with his words, the
   current one ticked in the ink (PBC's palette: navy, its lighter blue in dark), then Apply to at the foot */
.pp-menu {
    position: fixed; z-index: 10001; width: 360px; max-width: calc(100vw - 16px);
    padding: var(--sp-2); display: flex; flex-direction: column; gap: 2px;
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
}
.pp-head { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground); }
.pp-note { padding: 0 var(--sp-3) var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); }
.pp-opt {
    display: grid; grid-template-columns: 44px minmax(0, 1fr) 22px; align-items: center; gap: var(--sp-3);
    width: 100%; padding: var(--sp-2); border: 0; border-radius: var(--radius-lg);
    background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
/* a row's hover is a light tint (--hover-fill-row), so its icon tile stays a tile (Phil 14 Oct 2026: the full fill was
   "aweful": the tile vanished into it); the picked row is the ink's tint */
.pp-opt:hover { background: var(--hover-fill-row); }
.pp-opt:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ring); }
.pp-menu { --pp-pick: color-mix(in srgb, var(--ring) 10%, transparent); }
.pp-opt.is-on, .pp-opt.is-on:hover { background: var(--pp-pick); }
.pp-tile { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-md); background: var(--secondary-soft); color: var(--foreground); }
/* the tile is the light surface's soft fill (Phil 14 Oct 2026: "the drop down shade and the shade behind the icons needs
   softening too"); a row's hover and pick tint the tile with the row, so it never vanishes into them */
.pp-opt:hover .pp-tile { background-image: linear-gradient(var(--hover-fill-row), var(--hover-fill-row)); }
.pp-opt.is-on .pp-tile { background-image: linear-gradient(var(--pp-pick), var(--pp-pick)); }
.pp-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pp-title { font-size: var(--text-sm); font-weight: 600; line-height: 1.3; }
.pp-hint { font-size: var(--text-xs); line-height: 1.4; color: var(--muted-foreground); }
.pp-check { width: 22px; height: 22px; display: grid; place-items: center; --pp-tick: var(--ring); --pp-tick-ink: var(--popover); }
.pp-sep { height: 1px; margin: var(--sp-1) var(--sp-2); background: var(--border); }
/* "Apply to [This page v] [Apply]" on one row (Phil: "something like this but put the apply button in line"); a page list
   opens under it when Select pages... or Select spreads... is chosen */
.pp-apply { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: var(--sp-2); row-gap: 6px; padding: var(--sp-2) var(--sp-2) var(--sp-1) var(--sp-3); }
.pp-apply-label { font-size: var(--text-sm); color: var(--muted-foreground); white-space: nowrap; }
.pp-scope-field { display: flex; min-width: 0; }
.pp-scope-field > select.prop-input { width: 100%; height: 32px; font-size: var(--text-sm); background-color: var(--secondary-soft); }
.pp-apply-btn { height: 32px; padding: 0 var(--sp-4); }
.pp-range { grid-column: 2 / 4; height: 30px; font-size: var(--text-sm); font-variant-numeric: tabular-nums; background: var(--secondary-soft); }
.pp-range.is-invalid { border-color: var(--destructive-text); }
/* Select spreads...: the pages its spreads cover, under the list (Phil 15 Oct 2026: "select pages or select spreads too?") */
.pp-cover { grid-column: 2 / 4; font-size: var(--text-xs); line-height: 1.4; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.pp-error { grid-column: 2 / 4; font-size: var(--text-xs); line-height: 1.4; color: var(--foreground); }
.pp-error::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--destructive-text); vertical-align: 1px; }
/* a <select> opened as PBC's list (select-menu.js: the font menu), the size list's look; long lists scroll */
.select-list { max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.select-list .view-menu-item:focus { outline: none; }   /* the active row's fill shows where the keyboard is */
.select-list .view-menu-item[aria-disabled="true"] { color: var(--muted-foreground); opacity: 0.6; cursor: default; }

/* Color swatch inputs */
.editor-toolbar input[type="color"] {
    -webkit-appearance: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}
.editor-toolbar input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
.editor-toolbar input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
}

/* Every native colour swatch: the colour's corners follow its box's, concentric (the box's 8 px radius less its 2 px
   padding and 1 px border), so the preview reads as one shape (Phil 14 Oct 2026: "border radiuses need to be better
   shaped to match for these colour preview icons"). The toolbar's, the Swatches add tile and the style list set their own. */
input[type="color"] { -webkit-appearance: none; appearance: none; background-color: transparent; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(26, 33, 58, 0.18); border-radius: calc(var(--radius-sm) - 3px); }
input[type="color"]::-moz-color-swatch { border: 1px solid rgba(26, 33, 58, 0.18); border-radius: calc(var(--radius-sm) - 3px); }
[data-theme="dark"] input[type="color"]::-webkit-color-swatch { border-color: rgba(255, 255, 255, 0.2); }
[data-theme="dark"] input[type="color"]::-moz-color-swatch { border-color: rgba(255, 255, 255, 0.2); }

/* Brand colour swatches in editor */
.color-picker-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.color-swatch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.color-swatch-btn {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: border-color var(--duration-fast);
}

.color-swatch-btn:hover {
    border-color: var(--ring);
}

.color-swatch-btn.selected {
    border-color: var(--foreground);
    box-shadow: 0 0 0 1px var(--background);
}

.swatch-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: border-color var(--duration-fast);
}
/* [None] (InDesign): the card with the same red slash as the fill / stroke control's none, kept clear of the rounded corners */
.swatch-btn.swatch-none {
    background: linear-gradient(to top right, transparent calc(50% - 1.5px), #ef4444 calc(50% - 1.5px), #ef4444 calc(50% + 1.5px), transparent calc(50% + 1.5px)) center / calc(100% - 8px) calc(100% - 8px) no-repeat, var(--card);
    border: 1px solid var(--border);   /* its edge on the tile's own edge, so it is the size of the colour tiles */
}
.swatch-btn.swatch-none,
[data-theme="dark"] .swatch-btn.swatch-none { box-shadow: none; }

.swatch-btn:hover {
    border-color: var(--ring);
}

/* Color popover — Figma-style, anchored to left toolbar button */
.color-popover {
    position: absolute;
    left: 56px;
    z-index: 100;
    width: max-content;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(26,33,58,0.15);
    padding: var(--sp-3);
    display: none;
}
.color-popover.open { display: block; }

/* Shapes picker popover (anchored to the Shapes tool button) */
.shapes-popover {
    position: absolute;
    left: 56px;
    z-index: 100;
    width: 218px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(26,33,58,0.15);
    padding: var(--sp-3);
    display: none;
}
.shapes-popover.open { display: block; }
.shapes-popover-title {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: var(--sp-2);
}
.shapes-popover-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.shapes-popover .shape-pick {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.shapes-popover .shape-pick:hover {
    background: var(--accent);
    border-color: var(--ring);
}
.shapes-popover .shape-pick svg { width: 22px; height: 22px; }
.shapes-popover-hint {
    margin-top: var(--sp-2);
    font-size: 10px;
    color: var(--muted-foreground);
    text-align: center;
}

.color-popover .color-swatch-grid {
    display: grid;
    grid-template-columns: repeat(6, 28px);
    gap: 6px;
}
/* The colour popover holds only colours (Phil, 6 Oct 2026): the square that opened it is its target. Ring = the current
   colour; the last tile (a rainbow +, Canva's pattern) opens the system picker; the hex field takes a typed colour. */
.color-popover .swatch-btn[aria-pressed="true"] {
    box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.22), 0 0 0 2px var(--card), 0 0 0 4px var(--ring);
}
[data-theme="dark"] .color-popover .swatch-btn[aria-pressed="true"] {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 0 2px var(--card), 0 0 0 4px var(--ring);
}
.color-popover .swatch-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.swatch-btn.swatch-grad { background: linear-gradient(135deg, var(--foreground), var(--card)); border-color: var(--border); }
.swatch-btn.swatch-grad[aria-pressed="true"] { border-color: var(--ring); }
.swatch-btn.swatch-add {
    -webkit-appearance: none; appearance: none; display: block; margin: 0;
    background:
        linear-gradient(var(--foreground), var(--foreground)) center / 10px 2px no-repeat,
        linear-gradient(var(--foreground), var(--foreground)) center / 2px 10px no-repeat,
        radial-gradient(circle, var(--card) 0 8px, transparent 8.5px),
        conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444);
}
.swatch-btn.swatch-add::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-btn.swatch-add::-webkit-color-swatch { border: none; opacity: 0; }
.swatch-btn.swatch-add::-moz-color-swatch { border: none; opacity: 0; }
.pop-value { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-2); }
.pop-value[hidden] { display: none; }
.pop-eye { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--background); color: var(--foreground); cursor: pointer; }
.pop-eye[hidden] { display: none; }
.pop-eye:hover { background: var(--accent); }
.pop-hex select { flex: none; max-width: 76px; height: 100%; padding: 0; border: 0; outline: none; background: none; color: var(--muted-foreground); font: inherit; text-align: right; text-align-last: right; cursor: pointer; appearance: none; -webkit-appearance: none; }
.pop-hex select:hover, .pop-hex select:focus-visible { color: var(--foreground); }
.pop-hex {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 28px; padding: 0 var(--sp-1);
    border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--background);
    color: var(--muted-foreground); font-size: var(--text-xs);
}
.pop-hex:focus-within { border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }
.pop-hex[hidden] { display: none; }
.pop-hex input {
    flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: none;
    color: var(--foreground); font: inherit; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; text-transform: uppercase;
}
.pop-hex input::placeholder { color: var(--muted-foreground); text-transform: none; letter-spacing: 0; }

.toolbar-swatches {
    display: flex;
    gap: 2px;
    align-items: center;
    margin-right: 4px;
}

.toolbar-swatch {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 0;
    transition: border-color var(--duration-fast), transform var(--duration-fast);
}

.toolbar-swatch:hover {
    border-color: var(--ring);
    transform: scale(1.15);
}

/* Illustrator-style fill / stroke control (left tools strip)
   24 PX TARGETS, THE SAME DRAWING (WCAG 2.5.8, Phil 25 Oct 2026): each square is drawn 21 px as before (::before), but its
   button is a 24 x 35 target: the fill's reaches 12.5 px above its square, the stroke's 12.5 px below its own, so whichever
   square lies on top, the one under it keeps a 24 x 24 area of its own (the 21 px squares overlapped and were targets of
   17 and 13 px). --fs-dx / --fs-dy place the square in its button. */
.fs-control { position: relative; width: 34px; height: 34px; margin: 16.5px auto 12.5px; }
.fs-sq {
    position: absolute; width: 24px; height: 35px;
    padding: 0; border: 0; border-radius: 3px; background: transparent; cursor: pointer;
}
.fs-sq::before {
    content: ''; position: absolute; left: var(--fs-dx); top: var(--fs-dy); width: 21px; height: 21px; box-sizing: border-box;
    border-radius: 3px; background: var(--card); border: 1px solid #5b6577;
}
.fs-fill { left: -1.5px; top: -12.5px; z-index: 2; --fs-dx: 1.5px; --fs-dy: 12.5px; }
.fs-stroke { left: 11.5px; top: 11.5px; z-index: 1; --fs-dx: 1.5px; --fs-dy: 1.5px; }
.fs-fill.active, .fs-stroke.active { z-index: 4; }
.fs-fill.active::before, .fs-stroke.active::before { box-shadow: 0 0 0 1.6px var(--ring), 0 1px 2px rgba(26,33,58,0.25); }
.fs-sq:focus-visible { outline: none; }
.fs-sq:focus-visible::before { outline: 2px solid var(--ring); outline-offset: 1px; }
.fs-fillin, .fs-ring { position: absolute; left: calc(var(--fs-dx) + 2px); top: calc(var(--fs-dy) + 2px); width: 17px; height: 17px; border-radius: 2px; }
.fs-fillin { background: var(--foreground); }
.fs-ring { border: 4px solid var(--foreground); background: transparent; box-sizing: border-box; }
.fs-swap {
    position: absolute; top: -4px; right: -5px; width: 13px; height: 13px;
    padding: 0; border: none; background: none; cursor: pointer;
    color: var(--muted-foreground); z-index: 5;
}
.fs-swap svg { width: 13px; height: 13px; }
.fs-swap:hover { color: var(--foreground); }
/* "None" — red diagonal slash */
.fs-sq.is-none .fs-fillin { background: var(--card) !important; }
.fs-sq.is-none .fs-ring { border-color: #cbd2da !important; }
.fs-sq.is-none::after {
    content: ''; position: absolute; left: calc(var(--fs-dx) + 2px); top: calc(var(--fs-dy) + 2px); width: 17px; height: 17px; border-radius: 2px; pointer-events: none;
    background: linear-gradient(to top right, transparent 45%, #ef4444 45%, #ef4444 55%, transparent 55%);
}
/* Formatting affects container / text (J, InDesign): the pair under the control, and while it is Text the squares
   show a T in the text's colour (solid for the fill, outlined for the stroke) instead of a box. Each is a 24 px target
   (WCAG 2.5.8) holding the same 18 x 16 drawing (::before) */
.fs-affects { display: flex; justify-content: center; gap: 0; margin: 0 auto 2px; }
.fs-aff {
    position: relative; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
    border: none; border-radius: 3px; background: none; cursor: pointer; color: var(--muted-foreground);
}
.fs-aff::before { content: ''; position: absolute; left: 3px; top: 4px; width: 18px; height: 16px; border-radius: 3px; }
.fs-aff svg { position: relative; width: 11px; height: 11px; }
.fs-aff:hover { color: var(--foreground); }
.fs-aff:hover::before { background: var(--accent); }
.fs-aff.active { color: var(--foreground); }
.fs-aff.active::before { background: var(--accent); box-shadow: inset 0 0 0 1px var(--border); }
.fs-aff:focus-visible { outline: none; }
.fs-aff:focus-visible::before { outline: 2px solid var(--ring); outline-offset: 1px; }
.fs-control.is-text .fs-fillin { background: var(--card) !important; }
.fs-control.is-text .fs-ring { border-width: 0; background: var(--card); }
.fs-control.is-text .fs-fillin::after,
.fs-control.is-text .fs-ring::after {
    content: 'T'; position: absolute; inset: 0; display: grid; place-items: center;
    font: 700 15px/1 Georgia, 'Times New Roman', serif; pointer-events: none;
}
.fs-control.is-text .fs-fillin::after { color: var(--fs-fill, var(--foreground)); text-shadow: 0 0 1px rgba(26, 33, 58, 0.45); }
.fs-control.is-text .fs-fillin.has-grad::after { color: transparent; background: var(--fs-fill-img); -webkit-background-clip: text; background-clip: text; text-shadow: none; }
.fs-control.is-text .fs-ring::after { color: transparent; -webkit-text-stroke: 1.2px var(--fs-stroke, var(--foreground)); }
.doc-restricted.caps-no-colour .fs-affects { display: none !important; }

/* Colour swatch readability — a solid inner edge so white / light swatches show on the card */
.swatch-btn,
.color-swatch-btn { box-shadow: inset 0 0 0 1px rgba(26, 33, 58, 0.22); }
[data-theme="dark"] .swatch-btn,
[data-theme="dark"] .color-swatch-btn { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }

/* Snap guide lines (drawn programmatically on canvas) */
.canvas-wrapper canvas {
    display: block;
}

/* Editor mode: hide sidebar + header, let main content fill the screen */
body.editor-active .sidebar {
    display: none;
}
body.editor-active .header-bar {
    display: none;
}
body.editor-active .app-main,
body.editor-active .sidebar[data-folded] ~ .app-main {
    margin-left: 0;
}
body.editor-active .content-area {
    padding: 0;
    overflow: hidden;
}
body.editor-active .toast-container {
    z-index: 10001;
}

/* Full screen presentation (View menu, v1.76.0): only the page, on black.
   #editor-root.presenting is set by startPresentation() in editor.js. */
#editor-root.presenting { background: #1a213a; }
#editor-root.presenting .editor-toolbar,
#editor-root.presenting .tools-strip,
#editor-root.presenting .image-library-panel,
#editor-root.presenting .flyout-panel,
#editor-root.presenting .props-strip,
#editor-root.presenting .editor-status,
#editor-root.presenting .ruler-corner,
#editor-root.presenting .ruler-h-container,
#editor-root.presenting .ruler-v-container,
#editor-root.presenting .color-popover,
#editor-root.presenting .shapes-popover { display: none !important; }
#editor-root.presenting .canvas-viewport {
    background: #1a213a;
    grid-template-columns: 0 1fr;
    grid-template-rows: 0 1fr;
}
#editor-root.presenting .canvas-scroll-area { overflow: hidden; scrollbar-width: none; }
#editor-root.presenting .canvas-scroll-area::-webkit-scrollbar { display: none; }
#editor-root.presenting .canvas-wrapper .canvas-container { box-shadow: none; }
#editor-root.presenting .presentation-counter {
    position: absolute; right: 20px; bottom: 16px; z-index: 60;
    font-size: 12px; color: rgba(255, 255, 255, 0.55); letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums; pointer-events: none;
}
#editor-root.presenting .presentation-hint {
    position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
    padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: #fff;
    font-size: 13px; white-space: nowrap; pointer-events: none; opacity: 1; transition: opacity 0.6s ease;
}
#editor-root.presenting .presentation-hint.fade { opacity: 0; }
body.presenting { cursor: default; }


/* Lock overlay badge */
.lock-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: var(--muted);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.lock-badge svg {
    width: 10px;
    height: 10px;
    color: var(--muted-foreground);
}


/* ============================================================
   7. PAGES
   ============================================================ */

/* --- Login (2026 brand: sand card on navy) --- */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--sp-6);
    position: relative;
    overflow: hidden;
    background: #212947;   /* sea body navy under the wave layers */
}

/* Water: the redrawn 2026 sea (pbc-sea-1..6.svg). The source pattern is split
   into six wave layers per vertical cycle (778px at full size), each a whole wave
   group (crest, curl and body) completed underneath the layers in front of it, so
   any layer can slide past its neighbours without tearing. --sea-s scales the whole
   sea. Each layer drifts right one period per cycle at its own pace and, on top of
   that, surges back and forth and rises and falls a little on its own slow rhythm
   (the separate `translate` property, so it never fights the drift transform).
   The rise and fall stays under the 24px (full size) overlap each layer carries. */
.login-waves {
    --sea-s: 0.6;
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.login-waves i {
    position: absolute;
    left: calc(-887px * var(--sea-s) - 60px);
    right: calc(-887px * var(--sea-s) - 60px);
    top: calc((var(--c) * 778px + var(--y)) * var(--sea-s));
    height: calc(var(--h) * var(--sea-s));
    background-repeat: repeat-x;
    background-position: 0 0;
    background-size: calc(887px * var(--sea-s)) calc(var(--h) * var(--sea-s));
    will-change: transform, translate;
    /* --sea-t (index.php head) puts the waves on the wall clock, so the sign-in reload never makes the sea jump */
    animation:
        pbc-wave-drift var(--d) linear calc(0s - var(--sea-t, 0s)) infinite,
        pbc-wave-surge var(--sw) ease-in-out calc(var(--sd) - var(--sea-t, 0s)) infinite alternate;
}
.login-waves .sea-1 { --y:  20px; --h: 305px; --d: 109s; --sw: 16.8s; --sd: -1.2s; background-image: url('../pbc-sea-1.svg?v=6'); }
.login-waves .sea-2 { --y: 203px; --h: 194px; --d: 74s; --sw: 13.2s; --sd: -3.9s; background-image: url('../pbc-sea-2.svg?v=6'); }
.login-waves .sea-3 { --y: 284px; --h: 231px; --d: 141s; --sw: 20.4s; --sd: -0.4s; background-image: url('../pbc-sea-3.svg?v=6'); }
.login-waves .sea-4 { --y: 418px; --h: 207px; --d: 64s; --sw: 14.9s; --sd: -5.1s; background-image: url('../pbc-sea-4.svg?v=6'); }
.login-waves .sea-5 { --y: 521px; --h: 234px; --d: 122s; --sw: 18.5s; --sd: -2.6s; background-image: url('../pbc-sea-5.svg?v=6'); }
.login-waves .sea-6 { --y: 642px; --h: 274px; --d: 86s; --sw: 12.1s; --sd: -3.3s; background-image: url('../pbc-sea-6.svg?v=6'); }
.login-card,
.login-copyright { position: relative; z-index: 1; }
@keyframes pbc-wave-drift {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(887px * var(--sea-s))); }
}
@keyframes pbc-wave-surge {
    from { translate: -32px 3px; }
    to   { translate: 32px -3px; }
}
@media (prefers-reduced-motion: reduce) {
    .login-waves i { animation: none; }
}

.login-card {
    width: 100%;
    max-width: 30.5rem;
    background: var(--signin-surface, #e2e2e3);
    color: var(--brand-navy, #1a213a);
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: none;
    padding: 4.25rem 5.75rem 4rem;
}

.login-card .card-header,
.login-card .card-content { padding: 0; }

/* Terms and conditions to accept before the app opens (index.php + terms.php, 2.0.34): the sign-in card's sand on the sea */
.terms-card {
    position: relative; z-index: 1; width: 100%; max-width: 44rem; max-height: calc(100vh - 6rem);
    display: flex; flex-direction: column; gap: var(--sp-3);
    background: var(--signin-surface, #e2e2e3); color: var(--brand-navy, #1a213a);
    border: none; border-radius: var(--radius-xl); box-shadow: none; padding: 2.5rem 3rem;
}
.terms-kicker { margin: 0; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #4a5069; }
.terms-title { margin: 0; font: 400 1.75rem/1.2 Georgia, 'Times New Roman', serif; }
.terms-meta { margin: 0; font-size: var(--text-sm); color: #4a5069; }
.terms-body {
    flex: 1 1 auto; min-height: 8rem; overflow-y: auto; margin-top: var(--sp-2); padding: var(--sp-4) var(--sp-5);
    background: #ffffff; color: #1a213a; border-radius: var(--radius-md); font-size: var(--text-sm); line-height: 1.6;
}
.terms-body:focus-visible { outline: 2px solid var(--brand-navy, #1a213a); outline-offset: 2px; }
.terms-body h2 { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--text-base); font-weight: 600; }
.terms-body h3 { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--text-sm); font-weight: 600; }
.terms-body h2:first-child, .terms-body h3:first-child { margin-top: 0; }
.terms-body p { margin: 0 0 var(--sp-3); }
.terms-body ul { margin: 0 0 var(--sp-3); padding-left: 1.25rem; }
.terms-agree { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); font-size: var(--text-sm); font-weight: 500; cursor: pointer; }
.terms-error { margin: 0; font-size: var(--text-sm); color: #b42318; }
.terms-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.terms-card .btn { background: var(--brand-navy, #1a213a); color: var(--brand-yellow, #ffec8d); }
.terms-card .btn:disabled { opacity: .45; cursor: not-allowed; }
.terms-card .btn-ghost { background: transparent; color: var(--brand-navy, #1a213a); }
.terms-note { margin: 0; font-size: var(--text-xs); color: #4a5069; }
@media (max-width: 640px) { .terms-card { padding: 1.5rem 1.25rem; max-height: none; } }
/* Admin > Terms */
.terms-admin-card { padding: var(--sp-6); margin-bottom: var(--sp-4); max-width: 52rem; }
.terms-admin-row { display: flex; gap: var(--sp-4); align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.terms-admin-h { margin: 0 0 var(--sp-1); font-size: var(--text-base); font-weight: 600; }
.terms-admin-meta { margin: 0 0 var(--sp-4); font-size: var(--text-sm); }
.terms-admin-text { height: auto; min-height: 18rem; padding: var(--sp-3); line-height: 1.55; resize: vertical; font-family: inherit; }
.terms-admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.terms-admin-status { font-size: var(--text-sm); }
.terms-admin-read { margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5); max-height: 28rem; overflow-y: auto; background: #ffffff; color: #1a213a;
    border: 1px solid var(--border); border-radius: var(--radius-md); font-size: var(--text-sm); line-height: 1.6; }
.terms-admin-read h2 { font-size: var(--text-base); margin: var(--sp-4) 0 var(--sp-2); }
.terms-admin-read h3 { font-size: var(--text-sm); margin: var(--sp-3) 0 var(--sp-1); }
.terms-admin-read h2:first-child, .terms-admin-read h3:first-child { margin-top: 0; }
.terms-admin-read p { margin: 0 0 var(--sp-3); }
.terms-admin-read ul { margin: 0 0 var(--sp-3); padding-left: 1.25rem; }
.login-card .card-header { margin-bottom: var(--sp-6); }

.login-card .label { color: var(--brand-navy, #1a213a); }
.login-card { --muted-foreground: #4a5069; --foreground: #1a213a; }   /* the card is always light: its words keep the light ink (the dark veil and the forgot page read 1.7:1) */

.login-card .input {
    height: 40px;
    background: #fafafb;
    border: 1px solid var(--brand-navy, #1a213a);
    color: var(--brand-navy, #1a213a);
    border-radius: 6px;
}
.login-card .input::placeholder { color: #4a5069; }
.login-card .input:focus { border-color: var(--brand-navy, #1a213a); box-shadow: 0 0 0 2px rgba(26, 33, 58, 0.35); }
.login-card .input-affix-btn { color: var(--brand-navy, #1a213a); }

.login-card .btn {
    background: var(--brand-navy, #1a213a);
    color: var(--brand-yellow, #ffec8d);
    height: 40px;
    border-radius: 6px;
}
.login-card .btn:hover { opacity: 0.92; }

.login-card a { color: var(--brand-navy, #1a213a) !important; }

.login-copyright {
    margin-top: var(--sp-5);
    font-size: var(--text-xs);
    color: var(--signin-surface, #e2e2e3);
    text-align: center;
}

@media (max-width: 560px) {
    .login-card { padding: 2.5rem 1.5rem 2rem; }
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 0;
}

.login-logo-img {
    width: auto;
    height: 282px;
    max-width: 100%;
}

/* Animated login badge (v2.0.4). The sailor scene rebuilt from Phil's separate pieces (day and night skies, sun,
   calm sea, three wave bands, boat split front and back, penguin with the rowing flipper cut out, oar), cut and
   placed by tools/login-badge/scene.py; positions are % of the badge. CSS runs the steady loops: swell, the boat
   rocking and bobbing on its hull, the rower leaning and the oar stroking from the flipper, the compass bezel.
   login-badge.js runs the long cycles (day to dusk to night to dawn; the penguin stays about a minute, rows out
   and comes back) so their lengths can be tuned. Width matches the old 282 px lockup (517.59 of 735.34 units). */
.login-badge {
    position: relative;
    width: calc(282px * 517.59 / 735.34);
    max-width: 100%;
    aspect-ratio: 1;
    --lb-stroke: 2.8s;
}
.login-badge img {
    -webkit-user-select: none; user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}
.login-badge .lb-full { position: absolute; inset: 0; }
.login-badge .lb-p { position: absolute; display: block; height: auto; }
.login-badge .lb-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
    clip-path: circle(44.5% at 49.99% 49.78%);   /* under the ring's opaque band, so no sliver of card shows at its edge */
}
.login-badge .lb-sea-base { position: absolute; left: 0; right: 0; bottom: 0; background: #3f6382; }
.login-badge .lb-night { opacity: 0; }
/* The login story (login-badge.js): the page opens at night with no penguin; html.lb-anim is set by the head script
   before the first paint unless the visitor prefers reduced motion, so the still badge stays day with the penguin home */
html.lb-anim .login-badge .lb-night { opacity: 1; }
html.lb-anim .login-badge .lb-dusk { opacity: 0.35; }
html.lb-anim .login-badge .lb-fore { filter: brightness(0.66) saturate(0.82) sepia(0); }
html.lb-anim .login-badge .lb-craft { translate: -88% 0; }
/* login-badge.js hears the browser's autofill through this no-op animation (autofill fires no event of its own).
   Two rules: an unknown selector in a list would drop the whole rule. */
.login-card input:-webkit-autofill { animation: lb-autofill 1ms; }
.login-card input:autofill { animation: lb-autofill 1ms; }
@keyframes lb-autofill { from { opacity: 1; } to { opacity: 1; } }
/* the horizon (far sea and its colour) bobs a little */
.login-badge .lb-horizon { animation: lb-horizon 6.4s ease-in-out infinite alternate; will-change: translate; }
/* sunset and sunrise glow over the day sky, under the night sky (login-badge.js fades it) */
.login-badge .lb-dusk {
    opacity: 0;
    background: linear-gradient(to bottom, #3b3565 6%, #8d5578 22%, #d8715f 36%, #f2a25e 47%, #f6c06a 50.6%, transparent 50.7%);
}
.login-badge .lb-bezel {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    transform-origin: 49.99% 49.78%;
    animation: lb-bearing 10s ease-in-out infinite;
    will-change: rotate;
}
.login-wordmark {
    display: block;
    width: calc(282px * 517.59 / 735.34);
    max-width: 100%;
    height: auto;
}
.login-badge .lb-ride {
    transform-origin: 50.06% 73.12%;
    animation: lb-rock 4.6s ease-in-out infinite alternate, lb-bob 3s ease-in-out infinite alternate;
    will-change: rotate, translate;
}
.login-badge .lb-lean {
    transform-origin: 51.13% 64.47%;
}
.login-badge .lb-stroke {
    transform-origin: 63.32% 64.39%;
}
.login-badge .lb-reach {
    transform-origin: 38.61% 49.17%;
}
.login-badge .lb-hat {
    transform-origin: 49.69% 29.26%;
}
/* the far sea drifts LEFT in a seamless loop (Phil): the strip is one tile wider than the badge and slides one tile */
.login-badge .lb-sea-loop {
    position: absolute;
    left: 0;
    width: 174.25%;
    background-repeat: repeat-x;
    background-position: 0 0;
    background-size: 42.6112% 100%;
    animation: lb-sea-drift var(--lb-sea, 40s) linear infinite;
    will-change: translate;
}
/* the wave bands drift LEFT in seamless loops, nearer bands faster (parallax, all tied to the far sea's --lb-sea);
   their wrappers only bob up and down */
.login-badge .lb-wback { animation: lb-swell-back 7s ease-in-out infinite alternate; }
.login-badge .lb-wfront { animation: lb-swell 3s ease-in-out infinite alternate; }
.login-badge .lb-wbottom { animation: lb-swell-bottom 5.2s ease-in-out infinite alternate; }
.login-badge .lb-band {
    position: absolute;
    left: 0;
    background-repeat: repeat-x;
    background-position: 0 0;
    animation: linear infinite;
    will-change: translate;
}
.login-badge .lb-band-back { animation-name: lb-drift-back; animation-duration: calc(var(--lb-sea, 40s) * 0.781); }
.login-badge .lb-band-front { animation-name: lb-drift-front; animation-duration: calc(var(--lb-sea, 40s) * 0.306); }
.login-badge .lb-band-bottom { animation-name: lb-drift-bottom; animation-duration: calc(var(--lb-sea, 40s) * 0.251); }
@keyframes lb-rock { from { rotate: -4deg; } to { rotate: 4deg; } }
@keyframes lb-bob { from { translate: 0 -1.5%; } to { translate: 0 1.7%; } }
@keyframes lb-sea-drift { from { translate: 0 0; } to { translate: -42.6112% 0; } }
@keyframes lb-horizon { from { translate: 0 -0.45%; } to { translate: 0 0.45%; } }
@keyframes lb-swell { from { translate: 0 0.5%; } to { translate: 0 -0.55%; } }
@keyframes lb-swell-back { from { translate: 0 0.3%; } to { translate: 0 -0.3%; } }
@keyframes lb-swell-bottom { from { translate: 0 -0.4%; } to { translate: 0 0.4%; } }
@keyframes lb-drift-back { from { translate: 0 0; } to { translate: -46.5241% 0; } }
@keyframes lb-drift-front { from { translate: 0 0; } to { translate: -36.255% 0; } }
@keyframes lb-drift-bottom { from { translate: 0 0; } to { translate: -45.6152% 0; } }
@keyframes lb-bearing { 0% { rotate: 0deg; } 30% { rotate: 10deg; } 62% { rotate: -7.5deg; } 100% { rotate: 0deg; } }
@media (prefers-reduced-motion: reduce) {
    .login-badge * { animation: none !important; }
}

/* Sign-in sequence (v2.0.3, signin-intro.js). The veil is the login sea laid over the app while a fresh sign-in
   settles: shown from the first paint by html.pbc-intro, then faded to reveal the dashboard. A first sign-in gets
   "Welcome aboard, <name>" in Georgia, centred over the sea, one word at a time. */
.signin-veil { display: none; }
html.pbc-intro .signin-veil {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 20000;
    min-height: 0;
}
html.pbc-intro body { overflow: hidden; }
.signin-welcome {
    position: absolute;
    inset: 0;
    z-index: 2;
    margin: 0;
    padding: 0 var(--sp-6);
    display: flex;
    flex-wrap: nowrap;          /* one line, never "Welcome aboard" over a lone name; signin-intro.js shrinks it to fit */
    align-items: center;
    justify-content: center;
    column-gap: 0.28em;
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: clamp(2.75rem, 6.5vw, 5.25rem);
    font-weight: 400;
    line-height: 1.05;
    color: var(--signin-surface, #e2e2e3);
    text-align: center;
    pointer-events: none;
}
.signin-welcome span { display: inline-block; opacity: 0; }

/* Staging demo panel (?signin-demo): timing sliders over the real dashboard */
.sid-panel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 20001;
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
}
.sid-hd { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-3) var(--sp-2) var(--sp-4); }
.sid-hd strong { font-weight: 600; }
.sid-total { margin-left: auto; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.sid-min { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius-md, 6px); background: transparent; color: inherit; cursor: pointer; }
.sid-min:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); }
.sid-panel.is-min .sid-min svg { transform: rotate(180deg); }
.sid-panel.is-min .sid-body { display: none; }
.sid-body { overflow-y: auto; padding: 0 var(--sp-4) var(--sp-2); }
.sid-group { margin: var(--sp-3) 0 2px; font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.04em; }
.sid-row { display: grid; grid-template-columns: 7.5rem 1fr 4rem; align-items: center; gap: var(--sp-2); min-height: 30px; }
.sid-row > span { color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sid-row input[type="range"] { width: 100%; accent-color: var(--brand-navy, #1a213a); }
.sid-row output { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sid-row .input { height: 30px; padding: 0 var(--sp-2); font-size: var(--text-sm); }
.sid-row .sid-name { grid-column: 2 / 4; }
.sid-check { display: flex; align-items: center; gap: var(--sp-2); min-height: 30px; }
.sid-ft { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.sid-ft .btn { flex: 1; }
[data-theme="dark"] .sid-row input[type="range"] { accent-color: var(--brand-yellow, #ffec8d); }
.sid-panel.lb-panel { right: auto; left: 16px; }
.lbp-jumps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-1); }

.login-logo-text {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 400;
}

/* --- Activity feed (v1.99.3): the data table on a full page --- */
.activity-feed .dt { font-size: var(--text-sm); }
.activity-feed .dt-row { min-height: 40px; }
.act-type { font-size: var(--text-xs); color: var(--muted-foreground); margin-left: 4px; }
.act-link { color: inherit; text-decoration: none; }
.act-link:hover { text-decoration: underline; }
.dt-row.act-restore .dt-c-what { color: var(--brand-navy); font-weight: 600; }
[data-theme="dark"] .dt-row.act-restore .dt-c-what { color: var(--brand-yellow); }
.dt-row.act-delete .dt-c-what { color: var(--destructive-text); }
/* friction: where PBC got in someone's way (rage clicks, undo storms, errors; activity-feed.php pbcFrictionRows) */
.dt-row.act-friction .dt-c-what { color: var(--warning-text, #92400e); font-weight: 600; }
[data-theme="dark"] .dt-row.act-friction .dt-c-what { color: var(--brand-yellow); }

/* --- Backups (v1.99.2) --- */
.bk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: var(--grid-gap); }
.bk-card .card-header p { margin-top: var(--sp-1); font-size: var(--text-sm); }
.bk-status { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-8); margin-bottom: var(--sp-4); }
.bk-stat { display: flex; flex-direction: column; gap: 2px; font-size: var(--text-xs); min-width: 7rem; }
.bk-stat b { font-size: var(--text-lg); font-weight: 600; color: var(--foreground); }
.bk-stat-action { justify-content: center; gap: var(--sp-1); }
.bk-table td, .bk-table th { padding: var(--sp-2) var(--sp-3); }
.bk-log { margin-top: var(--sp-3); font-size: var(--text-xs); }
.bk-log pre { margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--muted); border-radius: var(--radius-sm); white-space: pre-wrap; font-size: var(--text-xs); }
.bk-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.bk-row .input[type="file"] { height: auto; padding: var(--sp-2) var(--sp-3); }
.bk-preview { margin-top: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; flex-direction: column; gap: var(--sp-2); }
.bk-names { margin: 0; padding-left: 1.2em; font-size: var(--text-sm); columns: 2; }

/* --- Dashboard --- */
/* Moving between pages: the old page fades quickly, the new one settles in, no overshoot (router.js) */
.pbc-screen.is-leaving { opacity: 0; transition: opacity 90ms var(--ease-default); }
.pbc-screen.is-entering { animation: pbc-screen-in 240ms var(--ease-panel); }
@keyframes pbc-screen-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .pbc-screen.is-leaving { transition: none; } .pbc-screen.is-entering { animation: none; } }

/* Home (v1.99.11): header, compact setup carousel, main column + side column */
.home .page-header { align-items: flex-end; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 22vw, 320px); gap: var(--sp-8); align-items: start; }
.home-sec { margin-bottom: var(--sp-8); }
/* the guide cards sit on the window's bottom edge, level with the sidebar's foot, when the dashboard is shorter than the window
   (Phil 25 Nov 2026); a taller dashboard scrolls as before. Two columns only: in one column the side panels follow them */
@media (min-width: 1101px) {
    .content-area:has(> .pbc-screen > .content-container.home) { display: flex; flex-direction: column; padding-bottom: var(--sidebar-gap); }
    .content-area:has(> .pbc-screen > .content-container.home) > .pbc-screen { flex: 1 0 auto; display: flex; flex-direction: column; }
    .content-container.home { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; }   /* its auto margins would shrink it to its content in a flex column */
    .home .home-grid { flex: 1 0 auto; }
    #home-main { align-self: stretch; display: flex; flex-direction: column; }
    #home-guides { margin-top: auto; }
    #home-main > .home-sec:last-child { margin-bottom: 0; }
    /* the side column never makes the page taller than the window (Phil 26 Nov 2026): it takes the main column's height
       (height 0, min-height 100% of its grid area) and Recent activity, the last panel, fills what is left and scrolls inside */
    .home .home-grid { grid-template-rows: 1fr; }
    #home-side { align-self: stretch; height: 0; min-height: 100%; }
    #home-side > .home-panel:last-child { flex: 1 1 auto; min-height: 10rem; display: flex; flex-direction: column; }
    #home-side > .home-panel:last-child .home-feed { flex: 1 1 0; min-height: 0; max-height: none; }
}
.home-sec-hd { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.home-sec-hd h2 { font-size: var(--text-xl); font-weight: 600; margin: 0; }
.home-sec-hd small { font-size: var(--text-sm); color: var(--muted-foreground); }
.home-sec-hd a { margin-left: auto; font-size: var(--text-sm); color: var(--muted-foreground); text-decoration: none; }
.home-sec-hd a:hover { color: var(--foreground); }
/* Get more from PBC: three cards into the guides, each a link as a whole */
.home-guides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: var(--sp-4); }
.home-guide { display: flex; gap: var(--sp-4); width: 100%; padding: var(--sp-8); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.home-guide:hover { border-color: var(--ring); box-shadow: var(--shadow-md); }
.home-guide:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.home-guide-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--text-sm); line-height: 1.4; color: var(--muted-foreground); }
.home-guide-t strong { font-size: var(--text-base); font-weight: 600; color: var(--foreground); }
.home-guide-go { display: inline-flex; align-items: center; gap: var(--sp-1); margin-top: auto; padding-top: var(--sp-2); font-weight: 500; color: var(--foreground); }
.home-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: var(--sp-4); align-items: start; }
.home-card { display: block; text-decoration: none; color: inherit; text-align: left; padding: 0; font: inherit; }
button.home-card { width: 100%; }
.home-card .library-card-body { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.home-card .library-card-title { font-size: var(--text-sm); }
.home-meta { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); flex-wrap: wrap; }
/* The type / status tag sits on the thumbnail's top-right corner, so every card keeps the same height (Phil,
   2026-09-27: a Template tag wrapped under the meta line and made its card taller than its neighbours) */
.home-card .library-card-thumb { position: relative; }
.home-card .library-card-thumb > .badge {
    position: absolute;
    top: var(--sp-2);
    right: var(--sp-2);
    z-index: 1;
    box-shadow: var(--shadow-xs, 0 1px 2px rgb(0 0 0 / 0.08));
}
.home-card .library-card-thumb > .badge-outline { background: var(--card); }   /* legible on any page image */
.home-av { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--secondary); color: var(--foreground); border: 1px solid var(--border); font-size: 8px; font-weight: 700; letter-spacing: .02em; flex: none; }
.home-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.home-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); font-size: var(--text-sm); }
.home-row:first-child { border-top: 0; }
.home-ic { width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--muted); color: var(--muted-foreground); flex: none; }
.home-row-t { flex: 1; min-width: 0; }
.home-row-t span { display: block; font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-empty { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius-lg); font-size: var(--text-sm); color: var(--muted-foreground); }
.home-empty > svg { flex: none; color: var(--muted-foreground); }
.home-empty b { display: block; color: var(--foreground); }
.home-empty .btn { margin-left: auto; flex: none; }
.home-empty > div:not(.brand-section-actions) { flex: 1 1 auto; min-width: 0; }
.home-empty b { margin-bottom: 2px; }
.home-empty > .brand-section-actions { margin-left: auto; flex: none; flex-wrap: nowrap; }
@media (max-width: 720px) {
    .home-empty { flex-wrap: wrap; }
    .home-empty > .brand-section-actions, .home-empty > .btn { margin-left: calc(20px + var(--sp-4)); }
}
.home-side h2 { font-size: var(--text-base); font-weight: 600; margin: 0 0 var(--sp-3); display: flex; align-items: center; gap: var(--sp-2); }
.home-side h2 svg { color: var(--muted-foreground); }
/* Admin > Users: who is in PBC now (app.js watchUsersOnline, sync.php admin_online; Phil 12 Oct 2026) */
.users-online { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-6); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.users-online:empty { display: none; }
.users-online-head { font-size: var(--text-sm); font-weight: 600; }
.users-online-head span { font-weight: 400; color: var(--muted-foreground); margin-left: var(--sp-1); }
.users-online-row { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); min-width: 0; white-space: nowrap; }
.users-online-row strong { flex: none; font-weight: 600; }
.users-online-row .uo-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted-foreground); }
.uo-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; box-sizing: border-box; }
.uo-dot.is-solid { background: var(--success, #3ec97f); }
.uo-dot.is-ring { border: 2px solid var(--success, #3ec97f); }
.uo-dot.is-idle { border: 2px solid var(--muted-foreground); }
/* 28 Oct 2026: Away (every tab hidden, or untouched 10 min) a dashed ring; Old version (a tab on an earlier build) an amber
   diamond. Each state has its own shape, not only a colour (WCAG 1.4.1). */
.uo-dot.is-away { border: 2px dashed var(--muted-foreground); }
.uo-dot.is-old { width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); background: var(--warning, #d97706); }
.users-online-sub { margin-top: var(--sp-2); }

/* A newer build is live (app-update.js noteServerBuild): one calm bar at the foot of the window, above everything but
   dialogs, with Reload. */
.pbc-update-bar { position: fixed; left: 50%; bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    z-index: 900; display: flex; align-items: center; gap: var(--sp-3); max-width: calc(100vw - 2 * var(--sp-4));
    padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-radius: var(--radius-lg, 10px);
    background: var(--primary); color: var(--primary-foreground); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); font-size: var(--text-sm); }
.pbc-update-bar .pbc-update-text { min-width: 0; }
.pbc-update-bar .btn { flex: none; background: var(--primary-foreground); color: var(--primary); border-color: var(--primary-foreground); }
.badge .uo-dot { margin-right: 6px; }
/* The side column's cards (Phil 2 Nov 2026): the library cards' surface, one row a person and one row an event */
.home-side { --home-rule: color-mix(in srgb, var(--border) 45%, transparent); display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }   /* rules inside the cards are quieter than the cards' edge */
.home-panel { min-width: 0; padding: var(--sp-5); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.home-panel-hd { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.home-panel > h2 { margin-bottom: var(--sp-4); }
.home-panel-hd h2 { margin: 0; }
.home-online-n { display: inline-flex; align-items: center; gap: var(--sp-2); flex: none; font-size: var(--text-xs); color: var(--muted-foreground); }
.home-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--success, #3ec97f); }
.home-dot.is-idle { background: var(--muted-foreground); }
.home-people { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.home-person { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.home-person-av { position: relative; display: inline-flex; flex: none; }
.home-person .home-av { width: 2.25rem; height: 2.25rem; font-size: var(--text-xs); font-weight: 600; letter-spacing: 0; }
.home-person-av .home-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; box-shadow: 0 0 0 2px var(--card); }
.home-person-t { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: var(--text-sm); }
.home-person-t strong, .home-person-t span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.home-person-t strong { font-weight: 600; }
.home-person-t span { font-size: var(--text-xs); color: var(--muted-foreground); }
.home-feed { max-height: 26rem; overflow-y: auto; padding-right: var(--sp-2); }   /* about five rows; the rest scrolls */
.home-act { display: flex; gap: var(--sp-3); padding: var(--sp-4) 0; }
.home-act:first-child { padding-top: 0; }
.home-act:last-child { padding-bottom: 0; }
.home-act + .home-act { border-top: 1px solid var(--home-rule); }
.home-act-t { flex: 1; min-width: 0; font-size: var(--text-sm); line-height: 1.4; overflow-wrap: anywhere; }
.home-act-t i { font-style: normal; }
.home-act-t span { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--muted-foreground); }
.home-panel-more { flex: none; font-size: var(--text-sm); color: var(--muted-foreground); text-decoration: none; }   /* as "All documents" */
.home-panel-more:hover { color: var(--foreground); }
.home-panel-more:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
a.home-act { color: inherit; text-decoration: none; }
a.home-act:hover .home-act-t i { text-decoration: underline; }
a.home-act:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; border-radius: var(--radius-sm); }
/* Editor help (?) in the status bar, and the tips dialog it opens */
/* pinned to the bottom of the tools strip (Phil, 7 Oct 2026): margin-top auto takes the strip's spare height */
.ed-help { flex: none; margin: auto auto var(--sp-1); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--muted-foreground); background: none;
    color: var(--muted-foreground); font: 600 12px/1 var(--font-sans, Inter, sans-serif); display: inline-grid; place-items: center; cursor: pointer; }
.ed-help:hover { color: var(--foreground); border-color: var(--foreground); }
.ed-help:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* The page box, bottom left of the status bar: ‹ Page [n] of N › (page-box.js) */
.ed-pagebox { display: flex; align-items: center; gap: 4px; margin-right: var(--sp-3); padding-right: var(--sp-3); border-right: 1px solid var(--border); }
.ed-pagebox[hidden] { display: none; }
.ed-pg-btn { width: 22px; height: 22px; display: inline-grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none;
    color: var(--muted-foreground); cursor: pointer; padding: 0; }
.ed-pg-btn svg { width: 14px; height: 14px; }
.ed-pg-btn:hover:not(:disabled) { background: var(--accent); color: var(--foreground); }
.ed-pg-btn:disabled { opacity: .35; cursor: default; }
.ed-pg-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ed-pg-word { color: var(--muted-foreground); white-space: nowrap; }
.ed-pg-input { width: 3.2em; height: 20px; padding: 0 4px; text-align: center; font: inherit; font-variant-numeric: tabular-nums; color: var(--foreground);
    background: var(--card); border: 1px solid var(--input); border-radius: var(--radius-sm); }
.ed-pg-input:focus { outline: 2px solid var(--ring); outline-offset: 0; border-color: transparent; }
#ed-status-left { display: flex; align-items: center; }
.tips-dialog { max-width: min(1120px, 94vw); width: 100%; }
.tips-dialog .dialog-header { display: flex; align-items: center; gap: var(--sp-3); flex-direction: row; }
.tips-dialog .dialog-title { margin-right: auto; }
.tips-dialog .dialog-header .tip-find { flex: 0 1 320px; }
.tips-dialog [hidden] { display: none !important; }   /* the grid, detail, back button and find menu all toggle with hidden */
.tips-back { display: inline-flex; align-items: center; gap: var(--sp-1); height: 30px; padding: 0 var(--sp-2); border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card); color: var(--foreground); font: inherit; font-size: var(--text-sm); cursor: pointer; }
.tips-back:hover { border-color: var(--ring); }
/* Next tip in the detail view's header (20 Oct 2026, Phil: "want just next tip actual name"): the next tip's own name and a chevron */
.tips-next { display: inline-flex; align-items: center; gap: var(--sp-1); height: 30px; max-width: 280px; padding: 0 var(--sp-2) 0 var(--sp-3);
    border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card); color: var(--foreground); font: inherit;
    font-size: var(--text-sm); cursor: pointer; }
.tips-next:hover { border-color: var(--ring); }
.tips-next svg { flex: none; }
.tips-next-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Phil 20 Oct 2026: "this needs a next: ... the button actually gets lost": it says Next and is the header's one filled button */
.tips-next { max-width: 340px; background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); font-weight: 500;
    transition: background-color var(--duration-fast), transform var(--duration-fast) var(--ease-default); }
.tips-next:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 88%, var(--primary-foreground)); }
.tips-next:hover svg { transform: translateX(2px); }
.tips-next svg { transition: transform var(--duration-fast) var(--ease-default); }
.tips-next-lead { flex: none; opacity: .72; font-weight: 400; }
.tips-back { max-width: 260px; }
.tips-back { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tips-back svg { flex: none; }
/* Find a tip as a magnifier that opens into the field (Phil 20 Oct 2026): the box grows on the panel ease, the field fades in
   behind the icon; it closes again when left empty. Reduced motion: no growth, it is there at once. */
.tip-find.is-collapse { display: flex; align-items: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--card); transition: width var(--duration-panel) var(--ease-panel), border-color var(--duration-fast), box-shadow var(--duration-fast); }
.tips-dialog .dialog-header .tip-find.is-collapse { flex: none; }
.tip-find.is-collapse.is-open { width: min(300px, 40vw); border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
.tip-find-toggle { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; padding: 0; background: none;
    color: var(--muted-foreground); cursor: pointer; border-radius: var(--radius-sm); }
.tip-find-toggle:hover { color: var(--foreground); }
.tip-find-toggle svg { transition: transform var(--duration-panel) var(--ease-panel); }
.tip-find.is-open .tip-find-toggle { color: var(--foreground); }
.tip-find.is-open .tip-find-toggle svg { transform: scale(.88) rotate(-8deg); }
.tip-find.is-collapse .input { flex: 1; min-width: 0; height: 30px; border: 0; box-shadow: none; background: transparent; padding: 0 var(--sp-2) 0 0;
    opacity: 0; pointer-events: none; transition: opacity var(--duration-fast) var(--ease-default); }
.tip-find.is-collapse .input:focus { outline: none; box-shadow: none; }
.tip-find.is-collapse.is-open .input { opacity: 1; pointer-events: auto; transition-delay: 90ms; }
.tip-find.is-collapse .tip-find-menu { left: auto; right: 0; width: min(300px, 40vw); }
@media (prefers-reduced-motion: reduce) { .tip-find.is-collapse, .tip-find.is-collapse .input, .tip-find-toggle svg { transition: none; } }
/* The larger view of a tip's video (Phil 20 Oct 2026): fills the body at the size it had; group, title, Open the full tip; steps, player; named paging */
.tips-detail-shot .tip-shot { position: relative; }
.tip-expand { position: absolute; top: var(--sp-2); right: var(--sp-2); z-index: 2; width: 30px; height: 30px; display: grid; place-items: center;
    border: 0; border-radius: var(--radius-sm); background: rgba(10, 14, 28, .62); color: #fff; cursor: pointer; opacity: 0;
    transition: opacity var(--duration-fast), transform var(--duration-fast) var(--ease-default), background-color var(--duration-fast); }
.tips-detail-shot .tip-shot:hover .tip-expand, .tip-expand:focus-visible { opacity: 1; }
.tip-expand:hover { background: rgba(10, 14, 28, .82); transform: scale(1.06); }
.tip-expand:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tips-theatre { display: flex; flex-direction: column; gap: var(--sp-3); height: 100%; min-height: 0; }
.tips-theatre[hidden] { display: none; }
.tt-bar { display: flex; align-items: center; gap: var(--sp-4); }
.tt-meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tt-kicker { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.tt-title { margin: 0; font-size: var(--text-lg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-open { flex: none; }
/* steps on the left, the player on the right, as wide as the body's height lets a 4:3 picture be (Phil: "the video needs to fill
   width"; "lets move video's to right column and the text explainers to left column") */
.tt-main { --tt-ctrl: 73px; --tt-rail: 260px; flex: 1; min-height: 0; display: flex; gap: var(--sp-5); container: tt / size; }
.tt-steps { flex: 1 1 var(--tt-rail); min-width: 220px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.tt-steps .tip-steps { gap: 2px; }
.tt-player { flex: none; align-self: flex-start; margin-left: auto;
    width: min(calc(100cqw - var(--tt-rail) - var(--sp-5)), calc((100cqh - var(--tt-ctrl)) * 4 / 3)); }
.tt-main.no-steps { --tt-ctrl: 51px; }
.tt-main.no-steps .tt-steps { display: none; }
.tt-main.no-steps .tt-player { margin: 0 auto; width: min(100cqw, calc((100cqh - var(--tt-ctrl)) * 4 / 3)); }
@container tt (max-width: 640px) {
    .tt-steps { display: none; }
    .tt-player { margin: 0 auto; width: min(100cqw, calc((100cqh - var(--tt-ctrl)) * 4 / 3)); }
}
/* the previous and next videos by name at the foot (Phil: "next tip needs to be named, bottom right and prev tip named too bottom left") */
.tt-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--sp-3);
    padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.tt-count { text-align: center; font-size: var(--text-sm); color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tt-nav { display: inline-flex; align-items: center; gap: var(--sp-2); max-width: 100%; min-width: 0; padding: 6px 10px; border: 0;
    border-radius: var(--radius-md); background: transparent; color: var(--foreground); cursor: pointer; text-align: left; }
.tt-prev { justify-self: start; }
.tt-next { justify-self: end; text-align: right; }
.tt-nav svg { flex: none; color: var(--muted-foreground); }
.tt-nav-txt { display: grid; min-width: 0; line-height: 1.25; }
.tt-nav-k { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.tt-nav-name { font-size: var(--text-sm); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-nav.is-none { visibility: hidden; }
.tt-nav:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tips-dialog .tips-dialog-body:has(> .tips-theatre:not([hidden])) { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .tt-steps .tip-step-t { display: inline; } .tt-steps .tip-step { cursor: pointer; } }

/* The tip player (tip-player.js; Phil 20 Oct 2026: "playhead, scrubbing.. some kind of indication as to what is being done") */
.tp { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--card); }
.tp-screen { position: relative; aspect-ratio: 4 / 3; background: var(--muted); cursor: pointer; overflow: hidden; }
.tp-vid, .tp-still { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: top left; }
.tp-big { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: rgba(10, 14, 28, .72); color: #fff; opacity: 0; pointer-events: none;
    transition: opacity var(--duration-fast, 150ms), transform var(--duration-fast, 150ms); transform: scale(.92); }
.tp[data-state="paused"] .tp-big { opacity: 1; transform: none; pointer-events: auto; }
.tp.is-failed .tp-vid, .tp.is-failed .tp-big, .tp.is-failed .tp-bar { display: none; }
.tp-bar { padding: 0 var(--sp-2); border-top: 1px solid var(--border); }
.tp-ctrl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; column-gap: var(--sp-2); min-height: 48px; }
.tp-ctrl.has-chapters { grid-template-rows: 44px 20px; min-height: 0; padding-bottom: 6px; }
.tp-ctrl.has-full { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
/* full screen (Phil 20 Oct 2026): the picture as large as the screen allows, whole, on black; the controls and step captions under it */
.tp:fullscreen { border: 0; border-radius: 0; background: #000; }
.tp:fullscreen .tp-screen { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; background: #000; }
.tp:fullscreen .tp-vid, .tp:fullscreen .tp-still { object-fit: contain; object-position: center; }
.tp:fullscreen .tp-bar { flex: none; padding: 0 var(--sp-4); background: var(--card); }
/* the steps' times and names under their part of the timeline (Phil: "intergrate the time stamps as captions under the scrubbter
   but not overlaying the video") */
.tp-chapters { grid-column: 2; display: flex; gap: 3px; min-width: 0; height: 20px; }
.tp-ch { display: flex; align-items: baseline; gap: 5px; min-width: 0; padding: 3px 0 0; border: 0; background: none; color: var(--muted-foreground);
    font: inherit; font-size: var(--text-xs); line-height: 1.3; text-align: left; cursor: pointer; overflow: hidden; border-top: 2px solid transparent; }
.tp-ch-t { flex: none; font-variant-numeric: tabular-nums; opacity: .8; }
.tp-ch-x { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-ch:hover { color: var(--foreground); }
.tp-ch.is-on { color: var(--foreground); font-weight: 600; }
.tp-ch:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; border-radius: 3px; }
/* the tip view's clip: the same bar under it; the picture opens the larger view */
.tips-detail-shot:has(.tp-inline) .tip-shot { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tp-inline { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: var(--card); }
.tips-detail-shot .tip-shot:has(.tip-expand) { cursor: zoom-in; }
.tp-btn { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--foreground); cursor: pointer; }
.tp-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tp-rate { width: auto; min-width: 48px; padding: 0 8px; font-size: var(--text-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-track { position: relative; flex: 1; min-width: 60px; height: 28px; display: flex; align-items: center; cursor: pointer; touch-action: none; border-radius: 4px; }
.tp-track:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tp-segs { display: flex; gap: 3px; width: 100%; height: 4px; transition: height var(--duration-fast, 150ms); }
.tp-track:hover .tp-segs, .tp-track.is-scrub .tp-segs, .tp-track:focus-visible .tp-segs { height: 6px; }
.tp-seg { position: relative; min-width: 2px; height: 100%; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--foreground) 16%, transparent); }
.tp-seg.is-on { background: color-mix(in srgb, var(--foreground) 26%, transparent); }
.tp-seg-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ring); }
.tp-head { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--ring);
    box-shadow: 0 0 0 2px var(--card), 0 1px 4px rgba(0, 0, 0, .25); transform: scale(.8); transition: transform var(--duration-fast, 150ms); pointer-events: none; }
.tp-track:hover .tp-head, .tp-track.is-scrub .tp-head, .tp-track:focus-visible .tp-head { transform: scale(1.05); }
.tp-hover { position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; pointer-events: none; z-index: 2;
    padding: var(--tip-pad); border-radius: var(--tip-radius); background: var(--tip-bg); color: var(--tip-fg); font-size: var(--text-xs);
    font-variant-numeric: tabular-nums; box-shadow: 0 0 0 1px var(--tip-ring), 0 4px 14px rgba(0, 0, 0, .18); }
.tp-hover[hidden] { display: none; }
.tp-time { flex: none; min-width: 78px; text-align: right; font-size: var(--text-xs); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .tp-big, .tp-segs, .tp-head, .tip-expand { transition: none; } .tp-inline { display: none; } }
/* Key tables (the Shortcuts tip, Phil 20 Oct 2026: "yikes this is hard to read"): keycaps beside what they do, rules between rows only */
.tip-keys { display: grid; gap: var(--sp-4); }
.tip-keys-grp h4 { margin: 0 0 var(--sp-1); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.tip-keys-grp dl { margin: 0; display: grid; }
.tip-keys-row { display: grid; grid-template-columns: minmax(120px, auto) 1fr; align-items: center; gap: var(--sp-3); padding: 6px 0; }
.tip-keys-row + .tip-keys-row { border-top: 1px solid var(--border); }
.tip-keys-row dt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.tip-keys-row dd { margin: 0; font-size: var(--text-sm); color: var(--foreground); }
.tip-combo { display: inline-flex; gap: 3px; }
.tip-keys kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--border);
    border-bottom-width: 2px; border-radius: 5px; background: var(--card); color: var(--foreground); font: 600 12px/1 var(--font-sans, inherit); }
.tip-key-or, .tip-key-plus { font-size: var(--text-xs); color: var(--muted-foreground); }
.tip-key-word { font-size: var(--text-xs); font-weight: 600; color: var(--foreground); padding: 3px 7px; border-radius: 5px; background: var(--secondary-soft, var(--secondary)); }
/* The fast find: an input with a dropdown of matches */
.tip-find { position: relative; }
.tip-find .input { height: 32px; font-size: var(--text-sm); }
.tip-find-menu[hidden] { display: none; }
.tip-find-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; background: var(--popover); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: var(--sp-1); display: grid; }
.tip-find-item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: var(--sp-2); border: 0; border-radius: var(--radius-sm); background: none; color: var(--foreground); text-align: left; font: inherit; font-size: var(--text-sm); cursor: pointer; }
.tip-find-item svg { width: 18px; height: 18px; color: var(--muted-foreground); flex: none; }
.tip-find-item span { display: grid; min-width: 0; }
.tip-find-item b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-find-item small { font-size: var(--text-xs); color: var(--muted-foreground); }
.tip-find-item:hover, .tip-find-item.is-active { background: var(--accent); }
/* Cards or list */
.tip-view { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tip-view-btn { width: 30px; height: 30px; border: 0; background: var(--card); color: var(--muted-foreground); display: grid; place-items: center; cursor: pointer; }
.tip-view-btn + .tip-view-btn { border-left: 1px solid var(--border); }
.tip-view-btn.is-on { background: var(--accent); color: var(--foreground); }
.tip-list { display: grid; gap: var(--sp-1); }
.tip-group { display: grid; gap: 2px; margin-bottom: var(--sp-3); }
.tip-group-hd { margin: var(--sp-2) 0 var(--sp-1); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.tip-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-2) var(--sp-3); border: 1px solid transparent; border-radius: var(--radius-md); background: none; color: var(--foreground); text-align: left; font: inherit; cursor: pointer; }
.tip-row:hover, .tip-row:focus-visible { background: var(--card); border-color: var(--border); outline: none; }
.tip-row > svg:first-child { width: 20px; height: 20px; color: var(--muted-foreground); flex: none; }
.tip-row-t { min-width: 0; flex: 1; display: grid; }
.tip-row-t b { font-size: var(--text-sm); font-weight: 600; }
.tip-row-t span { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-row-go { flex: none; color: var(--muted-foreground); }
.tip-grid.is-list { display: block; }
.tips-none { margin: var(--sp-6) 0; text-align: center; font-size: var(--text-sm); color: var(--muted-foreground); }
.tips-dialog .tip-list { max-width: none; }
.tip-group { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); column-gap: var(--sp-4); }   /* rows fill the width in columns */
.tip-group-hd { grid-column: 1 / -1; }
/* Cards open the full explanation */
.tip-card { cursor: pointer; transition: border-color var(--duration-fast); }
.tip-card:hover, .tip-card:focus-visible { border-color: var(--ring); outline: none; }
.tip-card[hidden] { display: none; }
.tip-card .tip-kicker { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.tip-shot { position: relative; }
.tip-shot-icon { display: none; position: absolute; inset: 0; place-items: center; color: var(--muted-foreground); }
.tip-shot-icon svg { width: 40px; height: 40px; }
.tip-shot.is-icon .tip-shot-icon { display: grid; }
.tip-shot.is-icon img { display: none; }
/* The full explanation */
.tips-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--sp-6); align-items: start; }   /* words left, video right */
.tips-detail[hidden] { display: none; }
.tips-detail-shot .tip-shot { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--muted); }
.tips-detail-text { display: grid; gap: var(--sp-3); }
.tips-detail-text .tip-kicker { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.tips-detail-text h3 { font-size: var(--text-xl); font-weight: 600; margin: 0; }
.tips-detail-text p { margin: 0; font-size: var(--text-sm); line-height: 1.55; color: var(--muted-foreground); }
.tips-detail-text .tips-detail-lead { color: var(--foreground); font-size: var(--text-base); }
.tips-detail-text .tip-link { font-size: var(--text-base); }
/* A tip's labelled paragraphs fold under their label (20 Oct 2026); "Tip:" stays a paragraph. Rules only between rows. */
.tip-accs { display: grid; }
.tip-acc + .tip-acc { border-top: 1px solid var(--border); }
.tip-acc > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) 0;
    list-style: none; cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--foreground);
    --hover-fill: var(--hover-fill-row); --hover-inset: 2px -8px; }
.tip-acc > summary::-webkit-details-marker { display: none; }
.tip-acc-chev { flex: none; color: var(--muted-foreground); transition: transform var(--duration-fast) var(--ease-default); }
.tip-acc[open] > summary .tip-acc-chev { transform: rotate(180deg); }
.tips-detail-text .tip-acc > p { padding: 0 0 var(--sp-3); }
@media (prefers-reduced-motion: reduce) { .tip-acc-chev { transition: none; } }
@media (max-width: 900px) { .tips-detail { grid-template-columns: 1fr; } .tips-detail-shot { order: -1; } }
.tips-dialog-body { padding: var(--sp-4) var(--sp-5) var(--sp-5); max-height: 72vh; overflow-y: auto; }
.tips-dialog .tip-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.home-sub-link { color: var(--muted-foreground); text-decoration: underline; text-underline-offset: 3px; }
.home-sub-link:hover { color: var(--foreground); }
.home-quiet { font-size: var(--text-sm); color: var(--muted-foreground); margin: 0 0 var(--sp-6); }
.home-side .home-quiet { margin: 0; }
/* Learn the ropes (v1.99.11): three tip cards, each with a screenshot of the real UI in the current theme */
.tip-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.tip-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.tip-shot { aspect-ratio: 4 / 3; background: var(--muted); overflow: hidden; border-bottom: 1px solid var(--border); }
.tip-shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.tip-img-dark { display: none; }
[data-theme="dark"] .tip-img-light { display: none; }
[data-theme="dark"] .tip-img-dark { display: block; }
[data-theme="dark"] .tip-shot.is-icon .tip-img-dark { display: none; }
/* A tip's clip (tips.js `v`): over its still, shown once it plays; reduced motion and the icon tile keep the still */
.tip-shot .tip-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; opacity: 0;
    transition: opacity var(--duration-slow); pointer-events: none; }
.tip-shot .tip-vid.is-playing { opacity: 1; }
.tip-shot.is-icon .tip-vid { display: none !important; }
@media (prefers-reduced-motion: reduce) { .tip-shot .tip-vid { display: none !important; } }
/* A tip's steps (tips.js `c`): the step the clip is on is highlighted with an ink bar; the clip stays in view beside them */
.tip-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tip-step { position: relative; display: flex; align-items: baseline; gap: var(--sp-3); width: 100%; margin: 0; padding: 7px 10px 7px 14px;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); font: inherit; font-size: var(--text-sm);
    line-height: 1.45; text-align: left; cursor: pointer; transition: background-color var(--duration-fast), color var(--duration-fast); }
.tip-step:hover { background: var(--hover-fill-row, var(--hover-fill)); }
.tip-step:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tip-step.is-on { background: var(--accent); color: var(--foreground); }
.tip-step.is-on::before { content: ''; position: absolute; left: 4px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--ring); }
.tip-step-t { flex: none; min-width: 2.4em; font-size: var(--text-xs); font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.tip-step.is-on .tip-step-t { color: var(--foreground); font-weight: 600; }
/* A paragraph's or step's lead-in before its colon (tips.js `_leadIn`): the label reads first */
.tip-lead { font-weight: 600; color: var(--foreground); }
/* Terms of the trade (glossary.js, Phil 20 Oct 2026): a dotted underline says "point at me for what this means" */
.tip-term {
    text-decoration: underline dotted; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
    text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: help; border-radius: 2px;
}
.tip-term:hover { text-decoration-color: currentColor; }
.tip-term:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* The tip view's top row: its group, and Copy link (the tip's own address); "Where:" sits straight under the opening line */
.tips-detail-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 28px; }
.tip-share { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground); font: inherit; font-size: var(--text-xs);
    cursor: pointer; white-space: nowrap; max-width: 60%; overflow: hidden; }
.tip-share span { overflow: hidden; text-overflow: ellipsis; }
.tip-share:hover { color: var(--foreground); border-color: var(--ring); }
.tip-share:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tip-share.is-done { color: var(--foreground); }
.tips-detail-text p.tips-detail-where { color: var(--foreground); }
/* "Where:" with a Where clip (tips.js `w`): a button that plays it over the tip's clip; a magnifier; tinted while it plays */
.tip-shot .tip-wvid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; opacity: 0;
    transition: opacity var(--duration-fast); pointer-events: none; }
.tip-shot .tip-wvid.is-on { opacity: 1; }
.tip-shot.is-icon .tip-wvid { display: none !important; }
.tip-where-play { display: flex; align-items: flex-start; gap: 10px; width: calc(100% + 20px); margin: -6px -10px; padding: 6px 10px;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font: inherit; font-size: var(--text-sm);
    line-height: 1.55; text-align: left; cursor: pointer; transition: background-color var(--duration-fast); }
.tip-where-play:hover { background: var(--hover-fill-row, var(--hover-fill)); }
.tip-where-play:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.tip-where-play.is-playing { background: var(--accent); }
.tip-where-play .tip-where-icon { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--foreground); }
@media (prefers-reduced-motion: reduce) { .tip-where-play, .tip-shot .tip-wvid { transition: none; } }
@media (min-width: 901px) { .tips-detail-shot { position: sticky; top: 0; } }
@media (prefers-reduced-motion: reduce) { .tip-step-t { display: none; } .tip-step { cursor: default; } .tip-step:hover { background: transparent; } }
.tip-body { display: grid; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.tip-title { font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
.tip-text { font-size: var(--text-sm); color: var(--muted-foreground); line-height: 1.45; }
.tip-link { justify-self: start; margin-top: var(--sp-1); padding: 2px 0; border: 0;   /* 2 px top and bottom: a 24 px target (2.5.8) */
    background: none; font: inherit; font-size: var(--text-sm); font-weight: 600;
    color: var(--foreground); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--brand-yellow, #ffec8d); cursor: pointer; }
.tip-link:hover { text-decoration-thickness: 2px; }
/* Needs your attention: ONE card on the muted tone, each row with
   Open (jumps to the thread) and Reply (answer from here) */
.home-panel-att { background: var(--muted); }   /* set apart from the library cards by tone, no accent edge (Phil) */
.home-att-row { padding: var(--sp-4) 0; border-top: 1px solid var(--home-rule); display: grid; gap: var(--sp-2); font-size: var(--text-sm); }
.home-att-row:first-child { border-top: 0; padding-top: 0; }
.home-att-row:last-child { padding-bottom: 0; }
.home-att-t { min-width: 0; display: grid; gap: 1px; }
.home-att-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-att-t span { font-size: var(--text-xs); color: var(--muted-foreground); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home-att-act { display: flex; gap: var(--sp-2); }
.home-att .btn-outline { border-color: color-mix(in srgb, var(--foreground) 28%, transparent); }   /* readable on the tinted card in dark mode */
.home-att-reply { display: grid; gap: var(--sp-2); }
.home-att-reply[hidden] { display: none; }
.home-att-reply textarea { resize: vertical; min-height: 2.5rem; font-size: var(--text-sm); }
/* Brand logo cards: notes clamp to three lines, click to read the rest */
.brand-logo-notes { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.brand-logo-notes.is-open { -webkit-line-clamp: unset; }
@media (max-width: 1100px) {
    .home-grid { grid-template-columns: 1fr; }
    .tip-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: var(--grid-gap);
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin-top: var(--sp-1);
}

.stat-change {
    font-size: var(--text-xs);
    margin-top: var(--sp-2);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

/* --- Admin --- */
.admin-section {
    margin-bottom: var(--sp-8);
}

.admin-section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--sp-4);
}

.storage-bar {
    height: 8px;
    background: var(--muted);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-default);
}

.storage-bar-fill.warning {
    background: var(--warning);
}

.storage-bar-fill.danger {
    background: var(--destructive);
}


/* --- Brand Settings --- */
.brand-section-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: var(--sp-3);
}

.brand-section-desc {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-bottom: var(--sp-4);
}

.brand-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-6) var(--sp-4);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-default),
                background var(--duration-fast) var(--ease-default);
    margin-bottom: var(--sp-4);
}

.brand-upload-zone:hover,
.brand-upload-zone.drag-over {
    border-color: var(--primary);
    background: var(--accent);
}

.brand-upload-zone-text {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
}

.brand-upload-zone-text strong {
    color: var(--foreground);
}

.font-upload-progress {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.font-upload-progress-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    overflow: hidden;
}

.font-upload-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.font-upload-progress-text {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-fonts-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.brand-font-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
}

.brand-font-row:last-child {
    border-bottom: none;
}

.brand-font-preview {
    font-size: var(--text-lg);
    min-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-font-info {
    flex: 1;
    min-width: 0;
}

.brand-font-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-font-meta {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

.brand-font-delete {
    flex-shrink: 0;
    width: 32px;
    height: 32px;   /* the height of the category field beside it */
    background: none;
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    color: var(--muted-foreground);
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--duration-fast), border-color var(--duration-fast);
}

.brand-font-delete:hover {
    color: var(--destructive-text);
    border-color: var(--destructive);
}

.brand-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--sp-6) 0;
}

.brand-swatch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.brand-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-1);
    cursor: pointer;
}

.brand-swatch-color {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    transition: border-color var(--duration-fast), transform var(--duration-fast);
}

.brand-swatch:hover .brand-swatch-color {
    border-color: var(--ring);
    transform: scale(1.05);
}

.brand-swatch-label {
    font-size: 10px;
    color: var(--muted-foreground);
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-swatch-add .brand-swatch-color {
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}

.brand-swatch-add:hover .brand-swatch-color {
    border-color: var(--primary);
    color: var(--primary);
}

.brand-color-editor {
    margin-top: var(--sp-2);
    margin-bottom: var(--sp-4);
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.brand-color-editor-row {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    margin-bottom: var(--sp-3);
    flex-wrap: wrap;
}

.brand-color-editor-row:last-child {
    margin-bottom: 0;
}

.brand-color-preview {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-color-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-color-field label {
    font-size: 10px;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.brand-color-field input {
    height: 32px;
    padding: 0 var(--sp-2);
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--foreground);
    font-size: var(--text-sm);
}

.brand-color-field input:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.brand-color-field .cmyk-input {
    width: 56px;
}

.brand-color-actions {
    display: flex;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}


/* --- Brand Page (style guide) --- */

.brand-tabs { margin-bottom: var(--sp-6); }

.brand-section {
    margin-bottom: var(--sp-2);
}

/* the Templates tab: one line saying what templates are, the actions, then the default for new ones */
.brand-section-lead { margin: 0 0 var(--sp-4); font-size: var(--text-sm); color: var(--muted-foreground); max-width: 60ch; }
.brand-section-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
fieldset.brand-rules-default { max-width: 44rem; margin-bottom: var(--sp-5); }
fieldset.brand-rules-default .kind-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.brand-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-4);
}

.brand-empty {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    padding: var(--sp-4);
    text-align: center;
}

.brand-error {
    font-size: var(--text-sm);
    color: var(--destructive-text);
    padding: var(--sp-4);
    text-align: center;
}

/* Role-based visibility */
.brand-readonly .brand-edit-controls {
    display: none;
}

/* Swatch extras */
.brand-swatch-hex {
    font-size: 9px;
    color: var(--muted-foreground);
    font-family: var(--font-mono, monospace);
    text-transform: uppercase;
}

.brand-swatch-meta {
    font-size: 9px;
    color: var(--muted-foreground);
    text-align: center;
    line-height: 1.3;
}

.brand-swatch-editable {
    cursor: pointer;
}

/* Badges */
.brand-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 9999px;
    background: var(--muted);
    color: var(--muted-foreground);
    white-space: nowrap;
}

.brand-badge-variable {
    background: hsl(258 60% 93%);
    color: hsl(258 60% 45%);
}

.brand-badge-static {
    background: var(--muted);
    color: var(--muted-foreground);
}

.brand-badge-category {
    background: hsl(200 60% 92%);
    color: hsl(200 60% 38%);
}

.brand-badge-italic {
    background: hsl(330 50% 93%);
    color: hsl(330 50% 42%);
    font-style: italic;
}

/* the font check (19 Oct 2026): a brand font whose file cannot set text whole; the upload refusal */
.brand-badge-incomplete { background: hsl(38 92% 90%); color: hsl(30 80% 28%); }
[data-theme="dark"] .brand-badge-incomplete { background: hsl(38 50% 22%); color: hsl(38 92% 72%); }
.brand-font-check { margin: var(--sp-2) 0 var(--sp-3); font-size: var(--text-sm); color: var(--foreground); border-left: 3px solid var(--warning); padding-left: var(--sp-2); }
.brand-font-card.is-incomplete { border-color: hsl(38 70% 70%); }
[data-theme="dark"] .brand-font-card.is-incomplete { border-color: hsl(38 50% 35%); }
.font-check-dialog { max-width: 30rem; }
.font-check-dialog .dialog-body p { margin: 0 0 var(--sp-2); font-size: var(--text-sm); }
.font-check-footer { flex-wrap: wrap; gap: var(--sp-2); }

/* Font cards */
.brand-font-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3);
}

.brand-font-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}

.brand-font-card-title {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--foreground);
}

.brand-font-card-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

.brand-font-preview-area {
    font-size: 28px;
    line-height: 1.3;
    color: var(--foreground);
    margin-bottom: var(--sp-3);
    word-break: break-word;
}

.brand-font-samples {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}

.brand-font-weight-sample {
    font-size: var(--text-lg);
    color: var(--foreground);
    white-space: nowrap;
}

.brand-font-weight-sample small {
    display: block;
    font-size: 10px;
    color: var(--muted-foreground);
    font-weight: 400;
    font-family: var(--font-sans, sans-serif);
    margin-top: 2px;
}

/* Variable font axis controls */
.brand-font-axes {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-3);
    background: var(--muted);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-3);
}

.brand-font-axis {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.brand-font-axis-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--muted-foreground);
    min-width: 100px;
    flex-shrink: 0;
}

.brand-font-axis-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.brand-font-axis-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--foreground);
    cursor: pointer;
}

.brand-font-axis-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--foreground);
    border: none;
    cursor: pointer;
}

.brand-font-axis-value {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--foreground);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Font allowed-range controls */
.brand-font-range {
    margin-bottom: var(--sp-2);
}

.brand-font-range label {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    display: block;
    margin-bottom: var(--sp-1);
}

.brand-range-inputs {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.brand-range-inputs span {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

.brand-range-min,
.brand-range-max {
    height: 28px;
    padding: 0 var(--sp-2);
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--foreground);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.brand-range-min:focus,
.brand-range-max:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

/* Font category + usage */
.brand-font-category-select {
    height: 32px;
    padding: 0 var(--sp-8) 0 var(--sp-2);
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background-color: var(--background);
    color: var(--foreground);
    font-size: var(--text-sm);
}

.brand-font-category-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.brand-font-usage {
    width: 100%;
    padding: var(--sp-2);
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--foreground);
    font-size: var(--text-sm);
    resize: vertical;
    margin-bottom: var(--sp-2);
    font-family: inherit;
}

.brand-font-usage:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.brand-font-usage-text {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-style: italic;
    margin-bottom: var(--sp-2);
}

.brand-font-meta-row {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: var(--sp-2);
}

/* Logo grid */
.brand-logo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sp-4);
}

.brand-logo-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    overflow: hidden;
}

.brand-logo-thumb {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    background: var(--muted);
    overflow: hidden;
}

.brand-logo-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-logo-bg-dark {
    background: hsl(0 0% 15%);
}

.brand-logo-bg-checker {
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.brand-logo-info {
    padding: var(--sp-3);
}

.brand-logo-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: var(--sp-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-logo-meta {
    display: flex;
    gap: var(--sp-1);
    flex-wrap: wrap;
    margin-bottom: var(--sp-1);
}

.brand-logo-notes {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    margin-top: var(--sp-1);
    line-height: 1.4;
}

/* The card's buttons: the shared small icon button (.btn .btn-outline .btn-icon .btn-sm), inside the card's own padding
   (Phil 20 Nov 2026: "tidy up the edit and delete buttons on these cards.. they have zero padding") */
.brand-logo-actions {
    display: flex;
    gap: var(--sp-2);
    padding: 0 var(--sp-3) var(--sp-3);
}

.brand-logo-spec {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

.brand-logo-delete:hover {
    color: var(--destructive-text);
    border-color: var(--destructive);
}

/* Logo picker dialog */
.brand-logo-picker-item {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-2);
    background: var(--muted);
}

.brand-logo-picker-item:hover {
    border-color: var(--ring);
}

.brand-logo-picker-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent);
}

.brand-logo-picker-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Paragraph style cards */
.brand-pstyle-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    padding: var(--sp-4);
    margin-bottom: var(--sp-3);
}

.brand-pstyle-preview {
    margin-bottom: var(--sp-2);
    word-break: break-word;
    line-height: 1.3;
}
/* A style preview follows the theme: the ink brand.jsx allows on this theme's card (--ink-light, --ink-dark), else the theme's own
   (Phil 2 Nov 2026; the paper chips of 24 Oct went, the contrast they fixed is kept by brand.jsx's check) */
.brand-pstyle-preview, .brand-cstyle-preview { color: var(--ink-light, var(--foreground)); }
[data-theme="dark"] :is(.brand-pstyle-preview, .brand-cstyle-preview) { color: var(--ink-dark, var(--foreground)); }

.brand-pstyle-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    font-size: var(--text-xs);
    color: var(--muted-foreground);
}

.brand-pstyle-actions {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* Character style rows */
.brand-cstyle-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    margin-bottom: var(--sp-2);
}

.brand-cstyle-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--foreground);
    min-width: 80px;
    flex-shrink: 0;
}

.brand-cstyle-preview {
    font-size: var(--text-base);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.brand-cstyle-meta {
    flex: 1;
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-cstyle-actions {
    display: flex;
    gap: var(--sp-2);
    flex-shrink: 0;
}

/* Dark mode badge adjustments */
[data-theme="dark"] .brand-badge-variable {
    background: hsl(258 40% 25%);
    color: hsl(258 60% 75%);
}

[data-theme="dark"] .brand-badge-category {
    background: hsl(200 40% 22%);
    color: hsl(200 60% 72%);
}

[data-theme="dark"] .brand-badge-italic {
    background: hsl(330 35% 25%);
    color: hsl(330 50% 75%);
}

/* Responsive */
@media (max-width: 640px) {
    .brand-logo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .brand-cstyle-row {
        flex-wrap: wrap;
    }

    .brand-cstyle-meta {
        white-space: normal;
        flex-basis: 100%;
    }

    .brand-font-axis {
        flex-wrap: wrap;
    }

    .brand-font-axis-label {
        min-width: auto;
        flex-basis: 100%;
    }
}

/* --- Paragraph / Character Style Editor Dialog --- */

.pse-body {
    display: flex;
    gap: var(--sp-4);
    padding: var(--sp-4);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.pse-settings {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.pse-preview-col {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
}

.pse-preview {
    flex: 1;
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    overflow-wrap: break-word;
    min-height: 120px;
}

.pse-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pse-row {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-end;
}

.pse-color-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
}

.pse-toggle-group {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.pse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    background: var(--background);
    border: none;
    border-right: 1px solid var(--border);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background var(--duration-fast), color var(--duration-fast);
}

.pse-toggle:last-child {
    border-right: none;
}

.pse-toggle:hover {
    background: var(--accent);
}

.pse-toggle.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

/* Character style preview box */
.cse-preview-box {
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    font-size: var(--text-lg);
    min-height: 60px;
    display: flex;
    align-items: center;
}

@media (max-width: 640px) {
    .pse-body {
        flex-direction: column;
    }

    .pse-preview-col {
        flex: none;
    }

    .pse-row {
        flex-wrap: wrap;
    }
}

/* --- Style Flyout Items (editor sidebar) --- */

.style-flyout-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* --- Template styles panels (v1.97, js/modules/styles/style-panel.js): header with the
   selection's style, a tree of groups and styles, footer actions (InDesign layout) --- */
.stp { display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--text-xs); flex: 1 1 auto; min-height: 0; }
/* the styles panels fill the panel: only the list scrolls, the tools sit flush with the bottom */
.dock-body:has(> .stp) { overflow: hidden; display: flex; flex-direction: column; }
.stp-head, .stp-empty { flex: none; }
.stp-head {
    display: flex; align-items: center; gap: var(--sp-1);
    padding: 3px 4px 3px 8px; min-height: 30px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--muted, var(--accent));
}
.stp-current { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stp-muted { color: var(--muted-foreground); font-weight: 400; }
.stp-plus { color: var(--primary); font-weight: 700; margin-left: 2px; }
.stp-list { display: flex; flex-direction: column; gap: 1px; flex: 0 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.stp-row {
    display: flex; align-items: center; gap: 4px;
    min-height: 28px; padding: 2px 6px 2px calc(4px + var(--stp-depth, 0) * 16px);
    border: 1px solid transparent; border-radius: var(--radius-sm);
    color: var(--foreground); cursor: pointer; -webkit-user-select: none; user-select: none;
    transition: background 0.1s;
}
.stp-row:hover { background: var(--accent); }
.stp-row.is-current { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.stp-row.is-picked { border-color: var(--ring); }
.stp-row.is-builtin .stp-name { color: var(--muted-foreground); }
.stp-row.is-dragging { opacity: 0.4; }
.stp-row.drop-before { box-shadow: inset 0 2px 0 var(--ring); }
.stp-row.drop-into { background: color-mix(in srgb, var(--ring) 18%, transparent); }
.stp-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stp-spacer { width: 18px; flex-shrink: 0; }
.stp-chev {
    width: 18px; height: 18px; padding: 0; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 3px; background: none; color: var(--muted-foreground); cursor: pointer;
}
.stp-chev svg { width: 14px; height: 14px; transition: transform var(--duration-fast) var(--ease-default); }
.stp-chev.is-open svg { transform: rotate(90deg); }
.stp-folder, .stp-lib { display: inline-flex; color: var(--muted-foreground); flex-shrink: 0; }
.stp-folder svg { width: 15px; height: 15px; }
.stp-lib svg { width: 13px; height: 13px; }
.stp-rename {
    flex: 1; min-width: 0; height: 22px; padding: 0 4px;
    font-size: var(--text-xs); color: var(--foreground); background: var(--background);
    border: 1px solid var(--ring); border-radius: 3px;
}
.stp-foot {
    flex: none; margin-top: auto;
    display: flex; align-items: center; gap: 2px;
    padding-top: var(--sp-2); border-top: 1px solid var(--border); background: var(--background);
}
.stp-foot-gap { flex: 1; }

/* Swatches panel (js/modules/swatches/swatch-panel.js, Phil 18 Oct 2026): the style panels' rows with a chip, the name and
   InDesign's marks (spot or process, CMYK or RGB) at the end; four views; the list fills the panel and scrolls alone. */
.dock-body:has(> .sw) { display: flex; flex-direction: column; }
.sw { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.sw-top { gap: var(--sp-1); }
.sw-tint { grid-template-columns: minmax(0, 1fr); max-width: 50%; }
.sw-list { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.sw-sec { margin: 8px 6px 2px; font-size: var(--text-xs); color: var(--muted-foreground); }
.sw-row { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 2px 6px 2px calc(6px + var(--sw-depth, 0) * 16px);
    border: 1px solid transparent; border-radius: var(--radius-sm); color: var(--foreground); cursor: pointer; -webkit-user-select: none; user-select: none; }
.sw-row:hover { background: var(--hover-fill); }
.sw-row.is-current { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.sw-row.is-picked { border-color: var(--ring); }
.sw-row.drop-before { box-shadow: inset 0 2px 0 var(--ring); }
.sw-row.drop-into { background: color-mix(in srgb, var(--ring) 18%, transparent); }
.sw-chip { flex: none; width: 18px; height: 18px; border-radius: 4px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 22%, transparent); }
.sw-chip.is-none { background: var(--background); display: grid; place-items: center; }
.sw-chip.is-none svg { width: 16px; height: 16px; }
.sw-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.sw-marks { flex: none; display: inline-flex; gap: 3px; color: var(--muted-foreground); }
.sw-marks svg, .sw-lock svg { width: 13px; height: 13px; display: block; }
.sw-lock { flex: none; color: var(--muted-foreground); opacity: 0.7; }
.sw-group .sw-chev { width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--muted-foreground); cursor: pointer; }
.sw-group .sw-chev svg { width: 14px; height: 14px; transition: transform var(--duration-fast, .12s); }
.sw-group .sw-chev.is-open svg { transform: rotate(90deg); }
.sw-folder svg { width: 15px; height: 15px; display: block; color: var(--muted-foreground); }
.sw-rename { flex: 1 1 auto; min-width: 0; height: 22px; padding: 0 4px; border: 1px solid var(--ring); border-radius: 4px; background: var(--background); color: var(--foreground); font: inherit; font-size: var(--text-sm); }
.sw-empty { margin: 6px; font-size: var(--text-xs); color: var(--muted-foreground); }
.sw-foot { display: flex; align-items: center; gap: 2px; flex: none; }
.sw-foot-gap { flex: 1; }
/* views: Small name, Small swatch, Large swatch (InDesign's panel menu) */
.sw[data-sw-view="small"] .sw-row { min-height: 22px; gap: 6px; }
.sw[data-sw-view="small"] .sw-chip { width: 13px; height: 13px; border-radius: 3px; }
.sw[data-sw-view="small"] .sw-name { font-size: var(--text-xs); }
.sw[data-sw-view="grid"] .sw-list, .sw[data-sw-view="big"] .sw-list { flex-direction: row; flex-wrap: wrap; align-content: flex-start; gap: 4px; }
.sw[data-sw-view="grid"] .sw-sec, .sw[data-sw-view="big"] .sw-sec, .sw[data-sw-view="grid"] .sw-empty, .sw[data-sw-view="big"] .sw-empty,
.sw[data-sw-view="grid"] .sw-group, .sw[data-sw-view="big"] .sw-group { flex: 0 0 100%; }
.sw[data-sw-view="grid"] .sw-row[data-sw], .sw[data-sw-view="big"] .sw-row[data-sw] { padding: 2px; min-height: 0; }
.sw[data-sw-view="grid"] .sw-row[data-sw] > :not(.sw-chip), .sw[data-sw-view="big"] .sw-row[data-sw] > :not(.sw-chip) { display: none; }
.sw[data-sw-view="big"] .sw-chip { width: 32px; height: 32px; border-radius: 6px; }
/* Swatch Options */
.sw-opt .dialog-body { display: flex; flex-direction: column; gap: 12px; }
.sw-opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sw-opt-note { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.sw-opt-stops { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; }   /* (a gradient's colours wrap: the second ran off the dialog's edge, 16 Nov 2026) */
.sw-opt-preview { display: flex; height: 36px; border-radius: var(--radius-sm); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.sw-opt-preview span { flex: 1; }
.sw-opt [data-o-vals] { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.stp-icon {
    width: 26px; height: 26px; padding: 0; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: pointer;
}
.stp-icon svg { width: 16px; height: 16px; }
.stp-icon:hover:not(:disabled) { background: var(--accent); color: var(--foreground); }
.stp-icon:disabled { opacity: 0.4; cursor: default; }
.stp-empty { padding: var(--sp-2); color: var(--muted-foreground); text-align: center; }
.stp-empty p { margin: 0 0 var(--sp-2); line-height: 1.45; }
.stp-menu { min-width: 210px; }   /* .view-menu: fixed, above dialogs */
.stp-menu .view-menu-item.is-danger { color: var(--destructive-text); }
/* Style Options */
.stp-options { max-width: 520px; width: calc(100vw - 32px); display: flex; flex-direction: column; overflow: hidden; }
.stp-options-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
.stp-options .dialog-header, .stp-options .dialog-footer { flex-shrink: 0; }
/* drag by the title bar; with Preview on the page shows through, undimmed */
.stp-options .dialog-header { cursor: move; -webkit-user-select: none; user-select: none; touch-action: none; }
.stp-options-overlay.is-live { background: transparent; }
.stp-options-overlay.is-live .stp-options { box-shadow: var(--shadow-lg), 0 0 0 1px var(--border); }
.stp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.stp-options .form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stp-hint { font-size: var(--text-xs); line-height: 1.4; color: var(--muted-foreground); }
/* Space before | Space after | pt mm, one row */
.stp-space { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: end; }
.stp-unit-input { position: relative; display: block; }
.stp-unit-input .input { padding-right: 36px; }
.stp-unit { position: absolute; right: var(--sp-3); top: 50%; transform: translateY(-50%); font-size: var(--text-xs); color: var(--muted-foreground); pointer-events: none; }
.stp-unit-input .input[aria-invalid="true"] { border-color: var(--destructive); }
@media (max-width: 420px) { .stp-space { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* Indents two to a row in InDesign's order (Left | Right, First line | Last line, in the Space fields' unit), and the drop cap */
.stp-indents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); align-items: end; }
/* Keep options: "At least [2] at the start and [2] at the end" */
.stp-keep-ends { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); font-size: var(--text-sm); }
.stp-keep-ends[hidden] { display: none; }
.stp-keep-ends label { display: inline-flex; align-items: center; gap: var(--sp-2); }
.stp-keep-ends .stp-num { width: 64px; }
.stp-options .stp-keepnext .stp-check { align-self: flex-start; min-height: 0; }
.stp-options .stp-keepnext .stp-hint { padding-left: 24px; }
/* Preview (on the page) sits bottom left of the footer */
.stp-options .dialog-footer .stp-live { margin-right: auto; align-self: center; min-height: 0; cursor: pointer; }
.stp-span2 { grid-column: span 2; }
.stp-sec {
    margin: var(--sp-4) 0 var(--sp-2);
    font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground);
}
.stp-note { font-weight: 400; color: var(--muted-foreground); }
.stp-check { display: flex; align-items: center; gap: 6px; align-self: end; min-height: 36px; font-size: var(--text-sm); }
.stp-colour { display: flex; align-items: center; gap: 6px; }
.stp-colour input[type=color] {
    width: 36px; height: 36px; padding: 2px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background);
}
.stp-seg { display: inline-flex; align-self: flex-start; height: 36px; border: 1px solid var(--input); border-radius: var(--radius-md); overflow: hidden; }
.stp-seg-fill { display: flex; align-self: stretch; }
.stp-seg-fill button { flex: 1 1 0; }
.stp-seg button { min-width: 44px; padding: 0 12px; border: none; background: none; color: var(--muted-foreground); font-size: var(--text-sm); cursor: pointer; }
.stp-seg button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.stp-seg button + button { border-left: 1px solid var(--border); }
.stp-seg button.is-on { background: color-mix(in srgb, var(--accent) 90%, black); color: var(--primary); }
[data-theme="dark"] .stp-seg button.is-on { background: color-mix(in srgb, var(--accent) 90%, white); }
.stp-preview {
    margin-top: var(--sp-5); padding: var(--sp-3); min-height: 56px;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    background: #ffffff;   /* the style's ink on paper, as on the page (paper stays white in dark mode) */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Brand library picker */
.stp-lib-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.stp-lib-row { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 8px; border-radius: var(--radius-sm); font-size: var(--text-sm); cursor: pointer; }
.stp-lib-row:hover { background: var(--accent); }
.stp-lib-row.is-linked { opacity: 0.6; cursor: default; }
.stp-lib-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stp-lib-meta { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }

.style-flyout-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    padding: var(--sp-2);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--foreground);
    cursor: pointer;
    text-align: left;
    transition: background var(--duration-fast), border-color var(--duration-fast);
    width: 100%;
}

.style-flyout-item:hover {
    background: var(--accent);
    border-color: var(--border);
}

.style-flyout-item.active {
    background: var(--accent);
    border-color: var(--ring);
}

.style-flyout-name {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.style-flyout-meta {
    font-size: 10px;
    color: var(--muted-foreground);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.style-flyout-preview {
    font-size: var(--text-sm);
    flex-shrink: 0;
}


/* -- Pages Flyout -- */
.pages-thumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;   /* each tile is its own page's shape: a shorter one beside a longer one stays short */
    gap: var(--sp-2);
}
/* no facing pages, so no spreads: one page a row, as InDesign's Pages panel */
.pages-thumb-list.is-stack { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; }
/* The page's own edge is the frame, and its number sits under it, never over the page (Phil 4 Nov 2026, as InDesign) */
.page-thumb-item {
    position: relative;
    cursor: pointer;
    width: calc(50% - var(--sp-1));
    max-width: 165px;
    min-width: 80px;
    flex-shrink: 0;
}
.page-thumb-item:hover .page-thumb-img { border-color: var(--muted-foreground); }
/* the bar's thumbnail size (--pg-w, flyout-panel.js) */
#ed-pages-tiles .page-thumb-item, #ed-pages-tiles .page-thumb-skel { width: min(var(--pg-w), 100%); max-width: none; min-width: 0; }
#ed-pages-tiles .pages-spread-row { max-width: calc(var(--pg-w) * 2); margin-inline: auto; }
.pages-spread-row .page-thumb-label { display: none; }   /* a spread's numbers are the row's own, below it */
/* A spread is one sheet: square at the fold, the two edges one line (Phil 4 Nov 2026) */
.pages-spread-row .page-thumb-item:has(+ .page-thumb-item) .page-thumb-img { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pages-spread-row .page-thumb-item + .page-thumb-item { margin-left: -2px; }
.pages-spread-row .page-thumb-item + .page-thumb-item .page-thumb-img { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.pages-spread-row .page-thumb-item.active, .pages-spread-row .page-thumb-item.selected { z-index: 1; }
.pages-spread-row.is-picked .pages-spread-grab { background: var(--primary); color: var(--primary-foreground); }
/* A picked spread has one outline round both pages: same colour all round, and the shared edge painted out (--seam-h, paintSel) */
.pages-spread-row.is-picked .page-thumb-item .page-thumb-img { border-color: var(--primary); box-shadow: none; }
.pages-spread-row.is-picked .page-thumb-item + .page-thumb-item::before { content: ''; position: absolute; z-index: 2; left: 0; top: 2px; width: 2px; height: calc(var(--seam-h, 100%) - 4px); background: #ffffff; pointer-events: none; }
.page-thumb-action.pages-spread-lock { width: 20px; height: 20px; background: none; color: var(--muted-foreground); }
.page-thumb-action.pages-spread-lock svg { width: 13px; height: 13px; }
.page-thumb-action.pages-spread-lock:hover { background: var(--accent); color: var(--foreground); }
.page-thumb-action.pages-spread-lock.is-on { color: var(--foreground); }
/* The bar along the panel's foot (the style panels' .stp-foot): stays in view while the pages scroll under it */
.dock-body:has(> .pages-foot) { display: flex; flex-direction: column; padding-bottom: 0; }   /* sticky stops at the padding: the bar sits on the panel's foot, with nothing showing under it */
.dock-body:has(> .pages-foot) > .flyout-subsection { flex: none; }
.dock-body.fade-b:has(> .pages-foot) { -webkit-mask-image: none; mask-image: none; }
.pages-foot { position: sticky; bottom: 0; z-index: 3; padding-bottom: var(--sp-2); }
body.editor-active:has(.pages-foot) .toast-container { bottom: 84px; }   /* a toast must not sit on the bar */
.pages-thumb-small svg { width: 11px; height: 11px; }
/* W hides the rulers but keeps their room, so the page does not move */
#ed-viewport.rulers-veiled > :not(#ed-scroll-area):not(#ed-preloader) { visibility: hidden; }
/* Page colour: the chip above the page, and This page / This spread / All pages in the colour popover */
.page-colour-chip { display: block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--foreground) 35%, transparent); }
.page-colour-chip.is-none { background: linear-gradient(to top right, transparent calc(50% - 1px), #e11d48 calc(50% - 1px), #e11d48 calc(50% + 1px), transparent calc(50% + 1px)), #ffffff; }
.pop-scope { display: flex; gap: 2px; margin-bottom: var(--sp-2); padding: 2px; border-radius: var(--radius-sm); background: var(--muted); }
.pop-scope[hidden] { display: none; }
.pop-scope button { flex: 1; padding: 3px 6px; border: none; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); font: inherit; font-size: var(--text-xs); white-space: nowrap; cursor: pointer; }
.pop-scope button[hidden] { display: none; }
.pop-scope button[aria-pressed="true"] { background: var(--card); color: var(--foreground); }
#ed-fs-stroke.is-page-off { opacity: 0.35; cursor: default; }
.pages-size-btn { width: auto; gap: 3px; padding: 0 4px 0 6px; font-size: var(--text-xs); white-space: nowrap; }
.pages-size-btn svg { width: 12px; height: 12px; flex: none; }
.pages-size-menu { position: fixed; min-width: 190px; }
.pages-size-mark { display: inline-flex; width: 16px; flex: none; color: var(--primary); }
.pages-size-mark svg { width: 14px; height: 14px; }
.pages-size-menu .view-menu-hint { margin-left: auto; padding-left: var(--sp-4); }
.doc-restricted .pages-foot-edit { display: none !important; }
/* Pages panel drag (2.0.10, pages-reorder.js): the page lifts and follows the pointer, the others
   slide aside (FLIP transforms set in script) and the landing place shows as a dashed slot. */
.pages-thumb-list { position: relative; }
.page-thumb-item { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.page-thumb-item:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.page-thumb-item.selected .page-thumb-img { border-color: color-mix(in srgb, var(--primary) 70%, var(--border)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 35%, transparent); }
.page-thumb-item.is-slot > * { visibility: hidden; }
.page-thumb-item.is-slot .page-thumb-img { visibility: visible; border-style: dashed; border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--card)); box-shadow: none; object-position: -9999px 0; }
.pages-spread-grab { font-size: var(--text-xs); color: var(--muted-foreground); cursor: grab; padding: 1px 6px; border-radius: var(--radius-sm); touch-action: none; -webkit-user-select: none; user-select: none; }
.pages-spread-grab:hover { background: var(--accent); color: var(--foreground); }
.pages-spread-row.glue-target > div:first-child { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius-sm); }
.page-drag-ghost { position: fixed; left: 0; top: 0; z-index: var(--z-popover); pointer-events: none; will-change: transform; }
.page-drag-ghost .page-thumb-img { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.page-drag-ghost > :first-child { width: 100%; max-width: none; min-width: 0; flex: none; border-radius: var(--radius-sm); transition: transform 140ms cubic-bezier(.2,.8,.2,1); }
.page-drag-ghost > div:first-child:not(.page-thumb-item) { display: flex; }
.page-drag-ghost.is-lifted > :first-child { transform: scale(1.04) rotate(-1.5deg); }
.page-drag-ghost.is-landing > :first-child { transform: none; box-shadow: var(--shadow-sm); }
.page-drag-count, .page-drag-plus { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: var(--primary-foreground); font: 600 11px/20px var(--font-sans, inherit); text-align: center; box-shadow: var(--shadow-sm); }
.page-drag-plus { display: none; right: auto; left: -8px; }
.page-drag-ghost.is-copy .page-drag-plus { display: block; }
body.pages-dragging, body.pages-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
@media (prefers-reduced-motion: reduce) {
    .page-drag-ghost > :first-child, .page-drag-ghost.is-lifted > :first-child { transition: none; transform: none; }
}
/* Move Pages (Pages panel menu, page right-click) */
.move-pages-dialog { max-width: 380px; }
.mp-body { display: grid; gap: var(--sp-4); }
.mp-field { display: grid; gap: 6px; }
.mp-dest { display: flex; gap: var(--sp-2); }
.mp-dest select { flex: 1; min-width: 0; }
.mp-dest input { width: 84px; }
.mp-error { margin: 0; color: var(--destructive-text); font-size: var(--text-sm); }
/* Isolation bar (isolation.js): a drawing component or saved circuit edited on its own, the rest of the sheet dimmed.
   It floats over the top of the canvas area (the grid cell the canvas and the contextual toolbar share), one row that
   wraps only when the window is too narrow for its fields. */
.iso-bar { grid-column: 2; grid-row: 2; align-self: start; position: relative; z-index: calc(var(--z-dropdown) + 1); margin: var(--sp-2); padding: 6px var(--sp-2);
    background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    container-type: inline-size; }
/* one row: the breadcrumb left and Cancel / Save right always stay on it; only the fields wrap, inside their own area */
/* where the selection is, inside groups and frames (sel-crumb.js) */
.sel-crumb { grid-column: 2; grid-row: 2; align-self: start; justify-self: start; position: relative; z-index: calc(var(--z-dropdown) + 1); margin: var(--sp-2); padding: 4px var(--sp-2); display: flex; align-items: center; gap: 4px; max-width: calc(100% - var(--sp-4)); background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; }
.sel-crumb-up { all: unset; cursor: pointer; color: var(--muted-foreground); padding: 2px 4px; border-radius: var(--radius-sm); }
.sel-crumb-up:hover, .sel-crumb-up:focus-visible { background: var(--accent); color: var(--foreground); }
.sel-crumb-up:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.sel-crumb-sep { color: var(--muted-foreground); }
.sel-crumb-now { font-weight: 600; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; }
.iso-main, .iso-ask { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: nowrap; min-width: 0; }
.iso-main > .btn, .iso-ask > .btn, .iso-crumb, .iso-kind { flex: none; }
.iso-main[hidden], .iso-ask[hidden] { display: none; }
.iso-back { gap: 2px; padding-left: 4px; }
.iso-crumb { color: var(--muted-foreground); }
.iso-kind { font-weight: 600; font-size: var(--text-sm); }
.iso-fields { display: flex; align-items: center; gap: 6px var(--sp-2); flex: 1 1 0; min-width: 0; flex-wrap: wrap; }
.iso-fields .input { height: 32px; }
.iso-name { flex: 1 1 180px; min-width: 120px; max-width: 320px; }
.iso-sec { width: auto; min-width: 130px; max-width: 200px; }
.iso-seg { flex: none; }
.iso-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); white-space: nowrap; }
.iso-where { font-size: var(--text-sm); color: var(--muted-foreground); white-space: nowrap; }
.iso-status { flex: 0 1 auto; max-width: 260px; font-size: var(--text-sm); color: var(--muted-foreground); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iso-status:empty { display: none; }
.iso-status.is-error { color: var(--destructive-text); white-space: normal; max-width: 320px; line-height: 1.3; }
.iso-status .iso-status-act { margin-left: var(--sp-1); height: 24px; padding: 0 var(--sp-2); vertical-align: middle; color: var(--foreground); }
@container (max-width: 980px) { .iso-status:not(.is-error) { display: none; } .iso-back span, .iso-crumb { display: none; } }
.iso-status.is-error { color: var(--destructive-text); }
.iso-ask > span { flex: 1 1 auto; font-size: var(--text-sm); font-weight: 600; }
/* Crop mode bar (image-crop.js): the isolation bar's look, one row: what is happening, a hint, Reset / Cancel / Done */
.crop-bar .crop-fill { flex: 1 1 0; min-width: 0; }
.crop-bar .crop-hint { max-width: 420px; }
/* Eyedropper bar (eyedropper.js): the isolation bar's look. What is loaded (swatches, the type), a hint, and the
   categories as toggles that are always in view (InDesign hides them in a dialog people forget). */
.eyedrop-bar .ed-kind { display: inline-flex; align-items: center; gap: 6px; }
.eyedrop-bar .ed-loaded { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.eyedrop-bar .ed-loaded:empty { display: none; }
.eyedrop-bar .ed-hint { max-width: 380px; }
.ed-sw { width: 18px; height: 18px; flex: none; border-radius: 4px; border: 1px solid var(--border); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.ed-sw-ring { background: transparent; border-width: 3px; box-shadow: none; }
.ed-sw-none { background: linear-gradient(to top right, transparent calc(50% - 1px), var(--destructive) calc(50% - 1px), var(--destructive) calc(50% + 1px), transparent calc(50% + 1px)); }
.ed-sw-grad { background: linear-gradient(90deg, #fff, #231f20); }
.ed-type { font-size: var(--text-sm); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.ed-brand { font-size: var(--text-xs); padding: 2px 8px; border-radius: var(--radius-full); background: var(--secondary); color: var(--secondary-foreground); white-space: nowrap; }
.ed-cats { display: inline-flex; flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; gap: 2px; min-width: 0; }
.ed-cats > .ed-cat { height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted-foreground);
    font: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer; white-space: nowrap; }
.ed-cats > .ed-cat[aria-pressed="true"] { background: var(--secondary); color: var(--foreground); border-color: var(--border); }
.ed-cats > .ed-cat[aria-pressed="false"] { text-decoration: line-through; }
.ed-cats > .ed-cat.is-na { opacity: 0.45; }
.ed-cats > .ed-cat:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
@container (max-width: 980px) { .eyedrop-bar .ed-type { display: none; } }
.iso-mod { display: grid; gap: var(--sp-2); padding: var(--sp-2); }
.iso-mod label { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); font-size: var(--text-sm); }
.iso-mod input { width: 72px; }
/* Rotate dialog (Alt-click with the Rotate tool) and the angle beside the pointer while turning */
.rot-dialog { max-width: 320px; }
.rot-body { display: grid; gap: 6px; }
.rot-angle { display: flex; align-items: center; gap: var(--sp-2); }
.rot-angle input { width: 110px; }
.rot-hint { margin: var(--sp-1) 0 0; color: var(--muted-foreground); font-size: var(--text-sm); }
/* 24 Oct 2026: the Scale and Shear dialogs (ref-tools.js): the Rotate dialog's rows, a .dw-seg choice across the dialog */
.ref-dialog .ref-row { display: grid; gap: 6px; }
.ref-dialog .ref-row[hidden] { display: none; }
.ref-dialog .ref-seg { display: flex; align-self: stretch; margin-bottom: var(--sp-1); }
.ref-dialog .ref-seg button { flex: 1 1 0; }
/* 25 Oct 2026: Transform each (ref-tools.js openTransformEach): number fields two to a row, the flips beside the nine-point
   reference point (each a small square, the one chosen filled), Preview on a switch */
.te-dialog { max-width: 360px; }
.te-dialog .num-grid { margin-bottom: var(--sp-1); }
.te-dialog .te-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-1) 0; }
.te-dialog .te-locator { display: grid; grid-template-columns: repeat(3, 14px); grid-template-rows: repeat(3, 14px); gap: 4px; }
.te-dialog .te-locator button { width: 14px; height: 14px; padding: 0; border: 1px solid var(--border); border-radius: 2px; background: var(--card); cursor: pointer; }
.te-dialog .te-locator button.is-on { background: var(--primary); border-color: var(--primary); }
.te-dialog .te-locator button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.te-dialog .te-preview { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--foreground); }
.rot-readout { position: fixed; z-index: var(--z-popover, 60); pointer-events: none; padding: 2px 7px; border-radius: var(--radius-sm); background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); box-shadow: var(--shadow-sm); font: 600 12px/18px var(--font-sans, inherit); font-variant-numeric: tabular-nums; }
.rot-readout[hidden] { display: none; }
/* Loading placeholders (v1.90): tiles for pages still arriving + thumbnails
   still rendering shimmer until the real image replaces them */
.page-thumb-skel {
    position: relative;
    width: calc(50% - var(--sp-1));
    max-width: 165px;
    min-width: 80px;
    flex-shrink: 0;
}
.page-thumb-img.page-thumb-skeleton {
    /* 2026: a whisper over the card, not a block: 7% ink at rest, 3% at the shimmer peak */
    --skel-a: color-mix(in srgb, var(--foreground) 7%, var(--card));
    --skel-b: color-mix(in srgb, var(--foreground) 3%, var(--card));
    background: linear-gradient(100deg, var(--skel-a) 30%, var(--skel-b) 50%, var(--skel-a) 70%);
    background-size: 300% 100%;
    animation: pbc-skeleton 1.4s ease-in-out infinite;
}
@keyframes pbc-skeleton { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .page-thumb-img.page-thumb-skeleton { animation: none; } }
.page-thumb-item.active .page-thumb-img { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.page-thumb-img {
    box-sizing: border-box;
    width: 100%;
    min-height: 16px;   /* a very wide, shallow page can still be seen and pressed */
    display: block;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    object-fit: contain;
    transition: border-color 0.15s;
}
.page-thumb-label {
    padding: 3px 2px 0;
    font-size: var(--text-xs);
    line-height: 1.3;
    color: var(--muted-foreground);
    text-align: center;
}
.page-thumb-item.active .page-thumb-label { color: var(--foreground); font-weight: 600; }
.page-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26,33,58,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 1;
}
.page-thumb-item:hover .page-thumb-overlay { opacity: 1; }
.page-thumb-action {
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s;
}
.page-thumb-action:hover { background: rgba(255,255,255,0.3); }
.page-thumb-action--delete:hover { background: rgba(239,68,68,0.6); }

/* -- Settings Modal Tabs -- */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin: 0 calc(-1 * var(--sp-6)) var(--sp-3);
    padding: 0 var(--sp-6);
}
.settings-tab {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--muted-foreground);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.settings-tab:hover { color: var(--foreground); }
/* the keyboard's ring sits inside the tab, a hair off its label, never over the underline or past the tab row (Phil 22 Nov 2026: "this looks messy") */
.settings-tab:focus-visible { outline: 2px solid var(--ring); outline-offset: -3px; border-radius: var(--radius-sm); }
.settings-tab.active {
    color: var(--foreground);
    border-bottom-color: var(--primary);
}
.settings-tab-panel { display: none !important; }
.settings-tab-panel.active { display: flex !important; flex-direction: column; gap: var(--sp-3); }
.settings-override-note {
    font-size: 11px;
    color: var(--muted-foreground);
    background: var(--muted);
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-sm);
    margin-bottom: var(--sp-2);
    line-height: 1.4;
}
.settings-page-selector {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-xs);
    margin-bottom: var(--sp-3);
}
.settings-page-selector select { width: auto; }

/* --- Layers Panel --- */
.layers-toolbar {
    display: flex;
    margin-bottom: var(--sp-2);
}
.layers-unlock-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    width: 100%;
    justify-content: center;
    padding: var(--sp-1) var(--sp-2);
    height: 28px;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}
.layers-unlock-btn:hover { background: var(--accent); border-color: var(--ring); }

.layers-toolbar.layers-multi {
    justify-content: space-between;
    align-items: center;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--sp-1) var(--sp-2);
}
.layers-sel-head { display: inline-flex; align-items: center; gap: 6px; }
.layers-sel-count { font-size: var(--text-xs); font-weight: 600; color: var(--foreground); }
.layers-clear-pill {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius-full);
    background: var(--secondary); color: var(--muted-foreground);
    cursor: pointer; transition: background 0.1s, color 0.1s;
}
.layers-clear-pill:hover { background: var(--accent); color: var(--foreground); }
.layers-tb-actions { display: inline-flex; gap: 2px; }
.layers-tb-btn {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: none; color: var(--muted-foreground);
    border-radius: var(--radius-sm); cursor: pointer;
    transition: background 0.1s, color 0.1s;
}
.layers-tb-btn:hover { background: var(--accent); color: var(--foreground); }
.layers-tb-btn.layers-tb-danger:hover { background: color-mix(in srgb, var(--destructive) 18%, transparent); color: var(--destructive-text); }

.layers-selrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: var(--sp-2);
}
.layers-selrow-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--muted-foreground);
    margin-right: 2px;
}
.layers-type-chip {
    font-size: 11px;
    line-height: 1;
    padding: 4px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--secondary);
    color: var(--secondary-foreground);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.layers-type-chip b { font-weight: 600; opacity: 0.6; }
.layers-type-chip:hover { background: var(--accent); border-color: var(--ring); color: var(--foreground); }
.layers-type-chip.layers-chip-alt { background: none; border-style: dashed; }
.layers-type-chip.layers-chip-alt:hover { background: var(--accent); }

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.layers-empty {
    padding: var(--sp-4) var(--sp-2);
    text-align: center;
    color: var(--muted-foreground);
    font-size: var(--text-xs);
}

.layer-item {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 4px 4px 4px 2px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-xs);
    color: var(--foreground);
    transition: background 0.1s;
    min-height: 28px;
    -webkit-user-select: none; user-select: none;
}
.layer-item:hover { background: var(--accent); }
.layer-item.layer-selected { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.layer-item.layer-hidden { opacity: 0.45; }
.layer-item.layer-locked-item .layer-name { font-style: italic; }

.layer-drag-handle {
    cursor: grab;
    color: var(--muted-foreground);
    flex-shrink: 0;
    padding: 2px;
    display: flex;
    align-items: center;
}
.layer-drag-handle:active { cursor: grabbing; }
/* THE LAYERS TREE (Phil 14 Oct 2026: "Show group contents as an expandable tree in the Layers panel"): a group's arrow, and the
   rows inside groups indented 14 px a level under the group's icon (12 px stands for the page row's drag handle) */
.layer-disclose, .layer-disclose-space { flex: none; width: 16px; height: 16px; }
.layer-disclose { display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted-foreground); cursor: pointer; }
.layer-disclose svg { transition: transform var(--duration-fast) var(--ease-default); }
.layer-disclose.open svg { transform: rotate(90deg); }
.layer-disclose:hover { color: var(--foreground); background: var(--hover-fill); }
.layer-disclose:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.layer-indent { flex: none; width: calc(12px + var(--depth, 1) * 14px); }
.layer-item.layer-holds-sel { background: color-mix(in srgb, var(--primary) 7%, transparent); }   /* a group holding the selection: a faint tint */
@media (prefers-reduced-motion: reduce) { .layer-disclose svg { transition: none; } }

.layer-type-icon {
    flex-shrink: 0;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
}
/* A fillable PDF form field (right-click > Form field): its kind after the layer's name, in the field blue */
.layer-field {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: var(--form-field-ink);
}

.layer-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
    padding: 1px 2px;
    border-radius: 2px;
}
.layer-name:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); }

.layer-rename-input {
    flex: 1;
    font-size: var(--text-xs);
    padding: 1px 4px;
    border: 1px solid var(--primary);
    border-radius: 2px;
    background: var(--background);
    color: var(--foreground);
    outline: none;
    min-width: 0;
}

.layer-actions {
    display: flex;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
}
.layer-action-btn.layer-hover-only { display: none; }
.layer-item:hover .layer-action-btn.layer-hover-only,
.layer-item.layer-selected .layer-action-btn.layer-hover-only { display: flex; }

.layer-action-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--muted-foreground);
    border-radius: 3px;
    cursor: pointer;
    padding: 0;
    transition: background 0.1s, color 0.1s;
}
.layer-action-btn:hover { background: var(--accent); color: var(--foreground); }
.layer-action-btn.active { color: var(--primary); }

/* Drag drop indicators */
.layer-item.dragging { opacity: 0.3; }
.layer-item.drag-over-above { box-shadow: inset 0 2px 0 var(--primary); }
.layer-item.drag-over-below { box-shadow: inset 0 -2px 0 var(--primary); }

/* --- Raster Export (two-panel Photoshop-style) --- */
.export-raster-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    height: min(680px, 70vh);
    overflow: hidden;
}

/* Override base .dialog max-width for the wide raster export layout */
.export-modal-overlay .dialog {
    max-width: none;
}

.export-preview-area {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    min-width: 0;
    overflow: hidden;
}

.export-preview-container {
    flex: 1;
    background: #1a213a;
    position: relative;
    overflow: hidden;
    min-height: 0;
}
.export-preview-container.dragging { cursor: grabbing; }

.export-preview-container img {
    position: absolute;
    top: 0;
    left: 0;
    image-rendering: auto;
    -webkit-user-select: none; user-select: none;
    -webkit-user-drag: none;
    transform-origin: 0 0;
}
.export-preview-container.transparent img {
    background: repeating-conic-gradient(#333 0% 25%, #555 0% 50%) 0 0 / 16px 16px;
}

.export-preview-zoom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-top: 1px solid var(--border);
    background: var(--card);
    font-size: var(--text-xs);
}
.export-preview-zoom button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    cursor: pointer;
    font-size: 14px;
    color: var(--foreground);
}
.export-preview-zoom button:hover { background: var(--accent); }
.export-preview-zoom-pct {
    min-width: 48px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.export-settings-panel {
    padding: var(--sp-4);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    font-size: var(--text-xs);
}

.export-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    margin-bottom: var(--sp-1);
    color: var(--foreground);
}

.export-field {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.export-field-label {
    min-width: 52px;
    color: var(--muted-foreground);
    text-align: right;
}
.export-field-value {
    flex: 1;
}
.export-px-input {
    width: 72px;
    height: 28px;
    padding: 0 var(--sp-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--foreground);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.export-px-unit {
    color: var(--muted-foreground);
    font-size: 11px;
}
.export-lock-icon {
    color: var(--muted-foreground);
    font-size: 11px;
    margin-left: var(--sp-1);
}
.export-lock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 0;
    margin-left: var(--sp-1);
}
.export-lock-btn:hover {
    background: var(--accent);
    color: var(--foreground);
}

.export-size-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.export-size-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}
.export-size-row:hover { background: var(--accent); }
.export-size-row.active {
    background: var(--accent);
    font-weight: 600;
}
.export-size-row-label { color: var(--foreground); }
.export-size-row-value { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.export-progress {
    height: 4px;
    background: var(--muted);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}
.export-progress > div {
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear;
}
/* The server warming up, under the export's own bar: a real reading once a second, so the bar glides between readings */
.exp-wake {
    margin-top: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
    font-size: var(--text-xs);
}
.exp-wake-row {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-1);
}
.exp-wake-row > :first-child { font-weight: 600; }
.exp-wake-row > :last-child { color: var(--muted-foreground); font-variant-numeric: tabular-nums; text-align: right; }
.exp-wake .export-progress > div { transition: width 1s linear; }
.exp-wake-why { margin-top: var(--sp-1); color: var(--muted-foreground); }
@media (prefers-reduced-motion: reduce) { .exp-wake .export-progress > div { transition: none; } }

/* ============================================================
   8. UTILITIES
   ============================================================ */

/* Skip to content: off screen until the keyboard is on it (index.php, app.js) */
.skip-link { position: fixed; left: var(--sp-3); top: var(--sp-3); z-index: var(--z-tooltip); transform: translateY(-200%);
    padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-foreground);
    font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.skip-link:focus { transform: none; }
#main-content:focus { outline: none; }   /* the skip link's landing place, never a ring round the whole content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-muted {
    color: var(--muted-foreground);
}

.text-sm {
    font-size: var(--text-sm);
}

.text-xs {
    font-size: var(--text-xs);
}

.font-semibold {
    font-weight: 600;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: var(--sp-2);
}

.gap-3 {
    gap: var(--sp-3);
}

.gap-4 {
    gap: var(--sp-4);
}

.w-full {
    width: 100%;
}

.mt-4 {
    margin-top: var(--sp-4);
}

.mb-4 {
    margin-bottom: var(--sp-4);
}


/* ============================================================
   9. ANIMATIONS
   ============================================================ */

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes dialog-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes dialog-out {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.95); }
}

@keyframes sheet-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@keyframes sheet-out {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
}

@keyframes toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes save-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.9; }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}


/* ============================================================
   10. RESPONSIVE
   ============================================================ */

/* Tablet: sidebar collapsed, grids 3-col */
@media (max-width: 1279px) {
    .image-library-panel {
        position: fixed;
        top: 0;
        left: 48px;
        bottom: 0;
        z-index: 50;
        box-shadow: var(--shadow-xl);
    }

    /* the sidebar no longer folds itself at tablet width (a touch tablet has no hover, so a folded rail's tooltips never
       show): it stays open with labels; folding is the person's choice (portal sidebar, 31 Oct 2026) */

    /* Editor: flyout panel as overlay on tablet */
    .flyout-panel {
        position: fixed;
        top: 0;
        right: 40px;
        bottom: 0;
        z-index: var(--z-overlay);
        box-shadow: var(--shadow-xl);
    }

    /* Tools strip stays same width on tablet */

    .dialog {
        max-width: calc(100vw - var(--sp-8));
    }
}

/* Phone (under 768 px): the bottom bar, New document and More instead of the sidebar (portal sidebar, 31 Oct 2026) */
@media (max-width: 47.99rem) {
    .sidebar { display: none; }
    .app-main, .sidebar[data-folded] ~ .app-main { margin-left: 0; }
    .sb-phone { display: block; }
    .sb-phone-lead { display: inline-flex; align-items: center; gap: var(--sp-1); min-width: 0; }
    .header-bar { padding: 0 var(--sp-2); }
    .user-avatar { width: 44px; height: 44px; }   /* a 44px target on a phone, as the prototype's */
    .header-actions { margin-right: 0; }
    .header-actions .btn { font-size: 0; gap: 0; width: 44px; height: 44px; padding: 0; }   /* icons only on a phone; the words stay their names */
    .content-area { padding-bottom: calc(var(--sp-24) + env(safe-area-inset-bottom)); }
    .toast-container { left: var(--sp-4); right: var(--sp-4); bottom: calc(9.5rem + env(safe-area-inset-bottom)); }   /* above New document */
    .toast { min-width: 0; max-width: none; }
}
body.editor-active .sb-phone, body.editor-active .sb-phone-lead, .pbc-guest .sb-phone { display: none; }

/* Library and dashboard grids are auto-fill / auto-fit on fluid tracks (--card-min),
   so no per-breakpoint column counts are needed. */

/* ──────────────────────────────────────────────────────────────────────
   Comment pins — compose/thread popovers (approval workflow, v1.51.x)
   ────────────────────────────────────────────────────────────────────── */
.pbc-comment-popover {
    position: fixed;
    z-index: 10000;
    width: 300px;
    background: var(--popover);
    color: var(--popover-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-3);
}
.pbc-comment-popover .pbc-comment-input {
    width: 100%;
    resize: vertical;
    min-height: 40px;
    font-size: var(--text-sm);
    margin-top: var(--sp-2);
}
.pbc-comment-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
    margin-top: var(--sp-2);
}
.pbc-comment-thread {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}
.pbc-comment-msg {
    background: var(--secondary);
    border-radius: var(--radius);
    padding: var(--sp-2);
}
.pbc-comment-meta {
    font-size: 10px;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}
.pbc-comment-meta .pbc-comment-del {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}
.pbc-comment-meta .pbc-comment-del:hover { color: var(--destructive-text); }
.pbc-comment-body {
    font-size: var(--text-xs);
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 2px;
}
.pbc-comment-row:hover { background: var(--accent); }
/* @mentions in comments (11 Nov 2026, js/modules/mention-picker.js): the name in a thread, the picker under the field */
.pbc-mention { color: var(--primary); font-weight: 600; background: color-mix(in srgb, var(--ring) 14%, transparent); border-radius: 3px; padding: 0 2px; }
.pbc-comment-meta .pbc-comment-edit { background: none; border: none; color: var(--muted-foreground); cursor: pointer; font-size: 10px; padding: 0 2px; text-decoration: underline; }
.pbc-comment-meta .pbc-comment-edit:hover { color: var(--foreground); }
.pbc-comment-meta .pbc-comment-edit + .pbc-comment-del { margin-left: 0; }
.pbc-comment-meta .pbc-comment-edit { margin-left: auto; }
.mention-list {
    position: absolute; z-index: 2; left: var(--sp-3); right: var(--sp-3);
    max-height: 200px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
    background: var(--popover); color: var(--popover-foreground);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.mention-list[hidden] { display: none; }
.mention-opt { display: flex; flex-direction: column; padding: 6px 8px; border-radius: calc(var(--radius) - 4px); cursor: pointer; }
.mention-opt[aria-selected="true"] { background: var(--accent); }
.mention-opt-n { font-size: var(--text-sm); font-weight: 600; }
.mention-opt-e { font-size: var(--text-xs); color: var(--muted-foreground); }
.mention-none { padding: 6px 8px; font-size: var(--text-xs); color: var(--muted-foreground); }

/* Context-action menu additions (registry, v1.52.x) */
.ed-ctx-menu { max-height: calc(100vh - 16px); overflow-y: auto; }
.ed-ctx-sep { height: 1px; background: var(--border); margin: 4px 6px; flex: none; }
.ed-ctx-item:disabled { color: var(--muted-foreground); cursor: default; }
/* ticks (the current choice) and rows that open a submenu (right-click > Permissions, 14 Oct 2026) */
.ed-ctx-item.has-tick, .ed-ctx-parent { display: flex; align-items: center; gap: 8px; }
.ed-ctx-tick { width: 14px; flex: none; display: grid; place-items: center; }
.ed-ctx-label { flex: 1; min-width: 0; text-align: left; }
.ed-ctx-arrow { flex: none; display: grid; place-items: center; margin-right: -4px; color: var(--muted-foreground); }
.ed-ctx-parent[aria-expanded="true"] { background: var(--accent); }
.ed-ctx-sub { z-index: 1001; min-width: 180px; }
.ed-ctx-item:disabled:hover { background: none; }

/* v1.92: tips, notes and hints never end on a lone word. The longhand is
   inherited (and leaves wrap mode alone); the shorthand on note-like
   elements covers engines without the longhand. */
body { text-wrap-style: pretty; }
p, .lg-hint, .settings-override-note, [id$="-note"], .flyout-body > p { text-wrap: pretty; }

/* v1.92: range sliders app-wide are solid (theme foreground: black in light,
   white in dark), never the browser's blue; and panel rows never overflow.
   Inputs default to a ~150px intrinsic minimum, so a row of flex:1 fields
   pushed its last controls past the panel edge (the clipped "100%", the
   missing Y and Soften fields) — form controls may now shrink. */
input[type="range"] { accent-color: var(--foreground); cursor: pointer; }
input[type="range"]:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }   /* a slider shows the keyboard on it (2.4.7) */
input[type="range"].prop-input { padding: 0; border: none; background: none; }
.prop-input, .prop-row input, .prop-row select { min-width: 0; }
.prop-label { flex-shrink: 0; }
.flyout-body, .dock-body { overflow-x: hidden; }

/* --- Info panel (v1.93): InDesign's Info layout. Position | size quadrants,
   a fill | stroke band, then document, image or text details --- */
.info-panel { container-type: inline-size; font-size: var(--text-xs); }
.info-quad, .info-band { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.info-quad > .info-cell:first-child, .info-band > .info-cell:first-child { padding-right: var(--sp-2); }
.info-quad > .info-cell + .info-cell, .info-band > .info-cell + .info-cell { border-left: 1px solid var(--border); padding-left: var(--sp-2); }
.info-quad .info-cell { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: 6px; align-items: start; }
.info-ico { width: 14px; height: 14px; margin-top: 7px; color: var(--muted-foreground); }
.info-fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.info-band { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.info-sw { display: flex; align-items: flex-start; gap: 7px; min-width: 0; }
.info-chip {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    margin-top: 1px;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: transparent;
}
.info-chip.stroke { border-width: 3px; border-color: var(--foreground); }
.info-chip.none {
    border-width: 1px;
    border-color: var(--border);
    background: linear-gradient(to top right, transparent calc(50% - 0.75px), var(--destructive) calc(50% - 0.75px), var(--destructive) calc(50% + 0.75px), transparent calc(50% + 0.75px));
}
.info-chip.mixed { background: repeating-linear-gradient(45deg, var(--muted-foreground) 0 2px, transparent 2px 4px); }
.info-sw-t { min-width: 0; line-height: 1.35; }
.info-sw-t b, .info-sw-t span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-sw-t b { font-weight: 500; }
.info-sw-t span { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.info-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--sp-3);
    row-gap: 6px;
    margin: var(--sp-3) 0 0;
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}
.info-list dt { color: var(--muted-foreground); text-align: right; white-space: nowrap; }
.info-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@container (max-width: 230px) {
    .info-quad, .info-band { grid-template-columns: minmax(0, 1fr); row-gap: var(--sp-3); }
    .info-quad > .info-cell:first-child, .info-band > .info-cell:first-child { padding-right: 0; }
    .info-quad > .info-cell + .info-cell, .info-band > .info-cell + .info-cell { border-left: none; padding-left: 0; }
}

/* --- Stroke caps (v1.93): InDesign's Start/End, Scale, Offset rows --- */
.cap-grid {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 24px minmax(0, 1fr);
    column-gap: 6px;
    row-gap: var(--sp-2);
    align-items: center;
    margin-bottom: var(--sp-2);
}
.cap-grid .prop-label { min-width: 0; white-space: nowrap; }
.cap-grid .prop-input { width: 100%; min-width: 0; }
.cap-grid input:disabled, .cap-check:has(input:disabled) { opacity: 0.45; cursor: default; }
.cap-pick {
    --cap-bg: var(--background);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    min-width: 0;
    height: 28px;
    padding: 0 4px 0 8px;
    color: var(--foreground);
    background: transparent;
    border: 1px solid var(--input);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.cap-pick:hover { border-color: var(--ring); }
.cap-pick[aria-expanded="true"] { border-color: var(--ring); }
.cap-pick-chev { flex: 0 0 14px; color: var(--muted-foreground); opacity: 0.7; }
.cap-g { display: block; flex: 0 1 40px; min-width: 0; }
.cap-g-t { font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-mid {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    color: var(--muted-foreground);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.cap-mid:hover { color: var(--foreground); background: var(--accent); }
.cap-mid.on { color: var(--foreground); }
.cap-check { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: var(--text-xs); color: var(--muted-foreground); cursor: pointer; }
.cap-check input { margin: 0; }
.cap-custom { display: grid; grid-template-columns: 58px minmax(0, 1fr); column-gap: 6px; row-gap: 6px; align-items: center; margin-bottom: var(--sp-2); }
.cap-custom-body { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.cap-custom .btn { height: 24px; padding: 0 8px; font-size: var(--text-xs); }
.cap-thumb { width: 28px; height: 28px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); }
.cap-custom-body > .num-grid { flex: 1 1 100%; }
.cap-picker { grid-column: 1 / -1; }
.cap-menu {
    --cap-bg: var(--popover);
    position: fixed;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding: 4px;
    max-height: min(360px, calc(100vh - 16px));
    overflow-y: auto;
    color: var(--popover-foreground, var(--foreground));
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.cap-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 30px;
    padding: 0 8px;
    font-size: var(--text-xs);
    text-align: left;
    color: inherit;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.cap-opt:hover, .cap-opt:focus-visible { background: var(--accent); outline: none; }
.cap-opt.on { font-weight: 600; }
.cap-opt-g { display: flex; flex: 0 0 40px; align-items: center; }

/* Hyperlinks panel (v1.93): the selection's rows, a note for part-linked
   frames, and no rule under the last row */
.links-row.sel { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.links-row.sel .links-name { font-weight: 600; }
.links-row:last-child { border-bottom: none; }
.links-note { margin: 0 0 var(--sp-2); font-size: 11px; color: var(--muted-foreground); text-wrap: pretty; }

/* Brand guide icon fonts (v1.93): icons instead of a text specimen */
.brand-font-card.brand-font-pending .brand-font-preview-area,
.brand-font-card.brand-font-pending .brand-font-samples { visibility: hidden; }
.brand-badge-icons { background: hsl(35 70% 92%); color: hsl(30 60% 36%); }
.brand-font-preview-area.brand-icon-preview { font-size: var(--text-sm); line-height: normal; word-break: normal; }
.brand-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--sp-2); }
.brand-icon-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 14px 6px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--background);
}
.brand-icon-glyph { font-size: 24px; line-height: 1; color: var(--foreground); font-style: normal; }
.brand-icon-name {
    max-width: 100%;
    overflow: hidden;
    font-family: var(--font-sans, sans-serif);
    font-size: 11px;
    color: var(--muted-foreground);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.brand-icon-more { margin-top: var(--sp-3); }
.brand-icon-count { font-size: var(--text-sm); color: var(--muted-foreground); }
.brand-font-samples:empty { display: none; }

/* Gradient midpoints (v1.93.2): draggable, selectable like InDesign's */
.grad-midpoint.selected { opacity: 1; background: var(--primary); }
.grad-midpoint { width: 9px; height: 9px; }

/* Live shape options in the Shape panel (v1.94) */
.ls-check { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--foreground); cursor: pointer; }
.ls-check input { margin: 0; }

/* Shape size dialog (v1.94.1): width + height with a chain link toggle */
.so-pair { display: flex; align-items: center; gap: var(--sp-2); }
.so-pair-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.so-rest { display: flex; flex-direction: column; gap: var(--sp-3); padding-right: calc(28px + var(--sp-2)); }
.so-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--muted-foreground);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.so-link:hover { color: var(--foreground); background: var(--accent); }
.so-link.on { color: var(--foreground); background: var(--accent); }
/* bracket from the chain to both fields */
.so-link::before, .so-link::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 7px;
    height: var(--so-bracket, 12px);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
}
.so-link::before { bottom: 100%; border-top: 1px solid var(--border); }
.so-link::after { top: 100%; border-bottom: 1px solid var(--border); }

/* Settings margins chain (v1.94.2): same toggle as the shape size dialog */
.margin-link-wrap { display: flex; align-items: center; gap: var(--sp-2); --so-bracket: 6px; }
/* 9 Nov 2026: minmax(0, 1fr), not 1fr. A number field with step="any" asks for a wider box, and a plain 1fr column won't shrink below it, so Margins ran out of the dialog */
.margin-link-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-1); flex: 1; min-width: 0; }

/* Hyperlinks panel (v1.94.2): the editor stays on top while the list scrolls,
   and the address or page picker gets its own full-width line */
.links-sticky {
    position: sticky;
    top: calc(-1 * var(--sp-3));
    z-index: 3;
    margin: calc(-1 * var(--sp-3)) calc(-1 * var(--sp-3)) var(--sp-2);
    padding: var(--sp-3) var(--sp-3) var(--sp-2);
    background: var(--background);
    border-bottom: 1px solid var(--border);
}
.link-editor .prop-row { margin-bottom: var(--sp-2); }
.link-editor .link-target { display: block; width: 100%; margin-bottom: var(--sp-1); }

/* Skeleton placeholders (v1.94.3): one shimmer for anything still loading */
.skel-bar, .skel-dot, .skel-block {
    display: block;
    /* 2026: a whisper over the card, not a block: 7% ink at rest, 3% at the shimmer peak */
    --skel-a: color-mix(in srgb, var(--foreground) 7%, var(--card));
    --skel-b: color-mix(in srgb, var(--foreground) 3%, var(--card));
    background: linear-gradient(100deg, var(--skel-a) 30%, var(--skel-b) 50%, var(--skel-a) 70%);
    background-size: 300% 100%;
    animation: pbc-skeleton 1.4s ease-in-out infinite;
    border-radius: 4px;
}
.skel-bar { height: 10px; max-width: 100%; }
.skel-dot { width: 9px; height: 9px; border-radius: 50%; }
.skel-row { pointer-events: none; cursor: default; }
.skel-row:hover { background: none; }
@media (prefers-reduced-motion: reduce) { .skel-bar, .skel-dot, .skel-block { animation: none; } }
.skel-tile { aspect-ratio: 1; width: 100%; border-radius: var(--radius-sm); }
.skel-card { pointer-events: none; cursor: default; }
.skel-card:hover { border-color: var(--border); box-shadow: none; }
.skel-card .library-card-thumb .skel-block { width: 100%; height: 100%; border-radius: 2px; }
.skel-card .library-card-body { display: flex; flex-direction: column; gap: 8px; }
.skel-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.skel-table-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-4); align-items: center; padding: 16px var(--sp-4); }
.skel-table-row + .skel-table-row { border-top: 1px solid var(--border); }
.dw-skel { display: flex; flex-direction: column; gap: 10px; padding: var(--sp-2) 0; }

/* ── Data table (v1.97, js/modules/ui/data-table.js): the reusable filterable list ──────────────
   NZDSA hub CRM table pattern: optional Find with the ellipsis to its right (columns, details), a status
   line while filtering, a header row that is the filter bar (each column opens a menu: sort both ways,
   Hide column, its filter), rows that open to their details. Rows always stay on one line: the primary
   column takes the "..." when the panel is narrow (never stack them). */
.dock-body:has(> .dt) { overflow: hidden; display: flex; flex-direction: column; }
.dt { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; font-size: var(--text-xs); container-type: inline-size; }
.dt-tools { flex: none; display: flex; align-items: center; gap: 4px; padding-bottom: 8px; }
.dt-tools-gap { flex: 1 1 auto; }
.dt-find {
    flex: 1 1 auto; display: flex; align-items: center; gap: 6px; height: 30px; min-width: 0; padding: 0 5px 0 8px;
    border: 1px solid var(--input); border-radius: var(--radius-sm); color: var(--muted-foreground); cursor: text;
}
.dt-find:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent); }   /* as .input:focus */
.dt-find svg { flex: none; }
.dt-find input {
    flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent;
    color: var(--foreground); font-size: var(--text-xs);
}
.dt-find input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.dt-find-clear {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: -3px; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: pointer;
}
.dt-find-clear:hover { background: var(--secondary); color: var(--foreground); }
.dt-more {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: pointer;
}
.dt-more:hover, .dt-more[aria-expanded='true'] { background: var(--accent); color: var(--foreground); }
.dt-find-clear[hidden], .dt-link[hidden] { display: none; }
.dt-status-slot:empty { display: none; }
.dt-status {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 0 2px 6px; font-size: 11px; color: var(--muted-foreground);
}
.dt-link {
    display: inline-flex; align-items: center; min-height: 24px;   /* WCAG 2.5.8 target */
    padding: 0; border: 0; background: none; color: var(--foreground); font: inherit; cursor: pointer;
    text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--border);
}
.dt-link:hover { text-decoration-color: currentColor; }
/* the header row: every cell is its column's menu button; hover fills the cell */
.dt-head {
    flex: none; display: grid; grid-template-columns: var(--dt-cols); gap: 0 6px; align-items: stretch;
    padding: 0 6px; border-bottom: 1px solid var(--border);
    /* the list's scrollbar narrows the rows: the header keeps the same gutter so the columns line up */
    overflow: hidden; scrollbar-gutter: stable;
}
.dt-th {
    display: inline-flex; align-items: center; gap: 3px; min-width: 24px; height: 28px; margin: 0 -4px; padding: 0 4px;   /* 24px: WCAG 2.5.8 floor */
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground);
    font-size: 11px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.dt-th-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* only the primary header may take the "..."; a short header (Pg, User, Time) shows in full with its
   arrow, reaching into the gap beside its narrow column when it has to */
.dt-th:not(.dt-th-primary) { min-width: max-content; }
.dt-th-ico { display: inline-flex; align-items: center; overflow: visible; }
.dt-th-ico svg { display: block; }
.dt-th.dt-th-icon { position: relative; }
.dt-th.dt-th-icon.has-mark { padding: 0 15px; }
.dt-th-mark { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: inline-flex; }
.dt-th svg { flex: none; }
.dt-th:hover, .dt-th[aria-expanded='true'] { background: var(--accent); color: var(--foreground); }
.dt-th.is-sorted, .dt-th.is-filtered { color: var(--foreground); }
.dt-th.dt-a-center { justify-content: center; justify-self: center; }
.dt-th.dt-a-right { justify-content: flex-end; justify-self: end; }
/* a column with no heading and nothing in its menu (an actions column) has no header button, just its place */
.dt-th-blank { display: block; min-width: 0; }
.dt-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; display: flex; flex-direction: column; padding-top: 2px; }
/* Reflow (WCAG 1.4.10, a11y pass 24 Oct 2026): on a screen narrower than the table's columns (320 px, or 640 px at 200% zoom)
   the table scrolls sideways as a whole (head and rows together) instead of cutting its columns off; rows stay one line.
   Data tables are the 2D content 1.4.10 lets scroll. Dock panels keep fitting their width (the primary column ellipsis). */
.pbc-screen .dt { overflow-x: auto; }
.pbc-screen .dt-head, .pbc-screen .dt-list { min-width: min-content; }
.dt-row { color: var(--foreground); }
.dt-sum {
    display: grid; grid-template-columns: var(--dt-cols); gap: 0 6px; align-items: center;
    padding: 6px; list-style: none; outline: none;
}
details.dt-row > .dt-sum { cursor: pointer; }
.dt-sum::-webkit-details-marker { display: none; }
.dt-sum::marker { content: ''; }
.dt-row + .dt-row { box-shadow: inset 0 1px 0 color-mix(in srgb, var(--border) 70%, transparent); }
.dt-row:hover { background: var(--accent); }
.dt-sum:focus-visible { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--ring) 22%, transparent); border-radius: var(--radius-sm); }
.dt-row.is-current { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.dt-row.is-current .dt-c-primary { font-weight: 600; }
.dt-row.is-muted { opacity: 0.45; }
.dt-c { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted-foreground); font-size: 11px; font-variant-numeric: tabular-nums; }
.dt-c.dt-a-center { text-align: center; }
.dt-c.dt-a-right { text-align: right; }
.dt-c-primary { color: var(--foreground); font-size: var(--text-xs); font-weight: 500; }
.dt-detail {
    padding: 0 6px 8px; font-size: 11px; line-height: 1.45;
    color: var(--muted-foreground); white-space: normal; overflow-wrap: anywhere; cursor: text;
}
.dt-note { margin: 0; padding: 8px 6px; font-size: 11px; color: var(--muted-foreground); }
.dt-chip {
    display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
    background: var(--dt-chip, var(--muted-foreground)); color: #fff; font-size: 8.5px; font-weight: 700; letter-spacing: .02em; line-height: 1;
    vertical-align: middle;
}
.dt-chip-sm { width: 16px; height: 16px; font-size: 7px; }
/* a column's menu: sort both ways, Hide column, then its filter (dates, ticked options) */
.dt-menu { min-width: 232px; max-height: min(72vh, 480px); overflow-y: auto; }
.dt-menu .view-menu-item { gap: 8px; padding: 6px 8px; font-size: var(--text-xs); }
.dt-menu .view-menu-item.is-active { font-weight: 600; }
.dt-mi-ico { flex: none; width: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted-foreground); }
.dt-menu .view-menu-item.is-active .dt-mi-ico { color: inherit; }
.dt-mi-tick { flex: none; width: 14px; display: inline-flex; margin-left: auto; }
.dt-mdates { display: flex; gap: 6px; padding: 2px 8px 6px; }
.dt-mdates label { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted-foreground); }
.dt-mdates .prop-input { width: 100%; min-width: 0; height: 28px; }
.dt-mclear { align-self: flex-start; margin: 0 8px 6px; font-size: 11px; }
/* narrow (the dock goes down to 200px): rows stay on one line, the columns just close up */
@container (max-width: 250px) {
    .dt-head, .dt-sum { gap: 0 4px; }
}

/* History (v1.97, modules/history-panel.js): the audit trail in a data table; markers and row details */
.hist-d-main { color: var(--foreground); }
.hist-d-list { margin: 2px 0 0; padding: 0; list-style: none; }
.hist-d-list li { margin: 2px 0; }
.hist-d-meta { margin-top: 3px; }
.hist-d-now { margin-top: 3px; color: var(--foreground); font-weight: 500; }
.hist-go { margin-top: 6px; }
.hist-restore { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hist-menu { min-width: 260px; }
.hist-menu-head { padding: 6px 10px 4px; font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.hist-menu-note { padding: 4px 10px 6px; font-size: var(--text-xs); color: var(--muted-foreground); max-width: 360px; }
.hist-mark {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0; padding: 7px 6px;
    font-size: 11px; color: var(--muted-foreground); border-top: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
}
/* one line, like the rows: the text takes the "..." and the button keeps its size */
.hist-mark > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* a saved version's bookmark sits in its name's line (the reset makes every svg a block) */
.hist-point-ico { display: inline-block; vertical-align: -1px; margin-right: 5px; color: var(--foreground); }
.hist-mark > .btn { flex: none; }
.hist-mark strong { color: var(--foreground); font-weight: 600; }
.hist-mark.hist-start { cursor: pointer; }
.hist-mark.hist-start:hover { background: var(--accent); }
.hist-mark.is-current { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.hist-older { align-self: center; margin-top: var(--sp-2); }
.hist-skel { padding: 9px 6px; }

/* ── Tables (InDesign model, v1.96 tables branch): Table panel ─────────────────── */
.tbl-panel { display: flex; flex-direction: column; }
.tbl-scope {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2);
    font-size: var(--text-xs); color: var(--foreground); font-weight: 600;
    padding-bottom: var(--sp-2); margin-bottom: var(--sp-3); border-bottom: 1px solid var(--border);
}
.tbl-scope-dims { color: var(--muted-foreground); font-weight: 400; white-space: nowrap; }
.tbl-field {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
    font-size: var(--text-xs); color: var(--foreground); margin-bottom: var(--sp-2); min-width: 0;
}
.tbl-field > span:first-child { color: var(--muted-foreground); white-space: nowrap; }
.tbl-btnrow { display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.tbl-btnrow.tbl-wrap { flex-wrap: wrap; }
.tbl-btnrow .btn { font-size: 11px; height: 26px; padding: 0 8px; }
.tbl-seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tbl-seg-btn {
    width: 28px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--background); color: var(--foreground); border: 0; cursor: pointer;
}
.tbl-seg-btn + .tbl-seg-btn { border-left: 1px solid var(--border); }
.tbl-seg-btn:hover { background: var(--accent); }
.tbl-seg-btn.active { background: var(--foreground); color: var(--background); }
.tbl-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: var(--sp-2); }
.tbl-swatch {
    width: 22px; height: 22px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    padding: 0; cursor: pointer; background: var(--background);
}
.tbl-swatch:hover { border-color: var(--ring); }
.tbl-swatch.selected { outline: 2px solid var(--foreground); outline-offset: 1px; }
.tbl-swatch-none { background: linear-gradient(to top right, transparent calc(50% - 1px), #e11d48 calc(50% - 1px), #e11d48 calc(50% + 1px), transparent calc(50% + 1px)), var(--background); }
.tbl-swatch-custom { width: 26px; height: 24px; padding: 1px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--background); }
.tbl-sub { font-size: 11px; color: var(--muted-foreground); margin: var(--sp-1) 0; }
.tbl-strokes { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-2); }
.tbl-stroke-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.tbl-proxy { flex: 0 0 72px; }
.tbl-proxy-line { stroke: var(--muted-foreground); stroke-width: 5; stroke-linecap: round; opacity: .28; cursor: pointer; }
.tbl-proxy-line:hover { opacity: .55; }
.tbl-proxy-line.on { stroke: var(--primary); opacity: 1; }

/* --- Import PDF dialog (2.0.20-tables.9, Phil 1 Oct 2026: the old one was "super busy, messy and inconsistent").
   What will happen as a short summary list (GOV.UK summary list): key, value, Change; the choice opens under its line
   in a well. Rules only between rows. Picked in a prototype round (~/Sites/_prototypes/pbc/pdf-import-dialog). --- */
.pdf-imp { max-width: 36rem; display: flex; flex-direction: column; overflow: hidden; }
.pdf-imp [hidden] { display: none !important; }   /* the grid and flex parts below would otherwise show */
.pdf-imp .dialog-header { align-items: flex-start; }
.pdf-imp-head { min-width: 0; display: grid; gap: 2px; }
.pdf-imp .dialog-title:focus { outline: none; }
.pdf-imp .dialog-description { overflow-wrap: anywhere; }
.pdf-imp-body { overflow-y: auto; min-height: 0; padding-top: var(--sp-2); display: grid; gap: var(--sp-3); container-type: inline-size; }
.pdf-imp-row { display: grid; grid-template-columns: 8rem minmax(0, 1fr) auto; gap: var(--sp-1) var(--sp-4); align-items: baseline; padding: var(--sp-3) 0; }
.pdf-imp-row + .pdf-imp-row { border-top: 1px solid var(--border); }
.pdf-imp-k { font-size: var(--text-sm); color: var(--muted-foreground); }
.pdf-imp-row[data-attention] > .pdf-imp-k { color: var(--foreground); font-weight: 600; }
.pdf-imp-v { min-width: 0; font-size: var(--text-sm); }
.pdf-imp-v small { display: block; margin-top: var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); }
.pdf-imp-link { min-height: 24px; font-size: var(--text-xs); font-weight: 400; color: var(--foreground); text-decoration: underline; text-underline-offset: 0.15em; }
.pdf-imp-link:hover { text-decoration-thickness: 2px; }
.pdf-imp-link:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.pdf-imp-edit { grid-column: 1 / -1; margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); display: grid; gap: var(--sp-3); min-width: 0; }
.pdf-imp-edit .form-hint, .pdf-imp-edit .form-error { margin: 0; }
/* an error reads in body text with a red marker (PBC's red text alone is 3.5:1 on the well) */
.pdf-imp-edit .form-error { color: var(--foreground); border-left: 3px solid var(--destructive); padding-left: var(--sp-2); }
.pdf-imp-rows[inert] { opacity: 0.6; }
/* the families on the Fonts line: name, then how much of it the PDF carries or what it will use */
.pdf-imp-fonts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); }
.pdf-imp-fonts li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--sp-3); }
.pdf-imp-fonts li > span:last-child { font-size: var(--text-xs); color: var(--muted-foreground); }
.pdf-imp-fonts li[data-attention] > span:last-child { color: var(--foreground); border-left: 3px solid var(--destructive); padding-left: var(--sp-2); }
/* pages: a typed range and the page pictures, kept in step */
.pdf-imp-range { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
.pdf-imp-field { width: min(100%, 12rem); }
.pdf-imp-field .label { font-size: var(--text-xs); }
.pdf-imp-links { display: flex; gap: var(--sp-3); }
.pdf-imp-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr)); gap: var(--sp-2); max-height: 18rem; overflow-y: auto; padding: 3px; }
.pdf-imp-thumb { position: relative; display: grid; gap: var(--sp-1); padding: 0; border: 0; background: none; color: var(--muted-foreground); font-size: var(--text-xs); text-align: center; cursor: pointer; }
.pdf-imp-thumb-img { aspect-ratio: var(--pdf-imp-ratio, 210 / 297); display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); }
.pdf-imp-thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.pdf-imp-thumb-img .spinner { width: 16px; height: 16px; }
.pdf-imp-thumb[aria-pressed="true"] .pdf-imp-thumb-img { outline: 2px solid var(--primary); outline-offset: 1px; }
.pdf-imp-thumb[aria-pressed="false"] .pdf-imp-thumb-img { opacity: 0.45; }
/* focus rings the whole tile (picture and number) with a halo; the selection only outlines the picture */
.pdf-imp-thumb:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: var(--radius-sm); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ring) 22%, transparent); }
.pdf-imp-tick { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: var(--radius-full); display: grid; place-items: center; background: var(--primary); color: var(--primary-foreground); }
.pdf-imp-thumb[aria-pressed="false"] .pdf-imp-tick { background: var(--background); color: transparent; border: 1px solid var(--border); }
.pdf-imp-check { display: flex; align-items: center; gap: var(--sp-2); min-height: 24px; font-size: var(--text-sm); cursor: pointer; }
/* The Check line (the import check, Phil 19 Oct 2026): one row per finding, rules only between rows; words carry the
   meaning, never colour alone (WCAG 1.4.1); a finding's pages link to the Pages well */
.pic-rows { display: grid; }
.pic-rows:empty { display: none; }
.pic-row { display: grid; gap: 2px; padding: var(--sp-2) 0; min-width: 0; }
.pic-rows .pic-row:first-child { padding-top: 0; }
.pic-row + .pic-row, .pic-rows:not(:empty) + .pic-row { border-top: 1px solid var(--border); }
.pic-what { margin: 0; font-size: var(--text-sm); color: var(--foreground); }
.pic-pbc { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.pic-pages { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--sp-2); font-size: var(--text-xs); color: var(--muted-foreground); }
.pic-comments .dw-seg { margin-top: var(--sp-1); justify-self: start; }
.pic-list { list-style: none; margin: var(--sp-1) 0 0; padding: 0; display: grid; gap: var(--sp-2); max-height: 14rem; overflow-y: auto; }
.pic-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--sp-3); font-size: var(--text-xs); }
.pic-by { grid-column: 1; color: var(--muted-foreground); }
.pic-text { grid-column: 1; color: var(--foreground); white-space: pre-line; overflow-wrap: anywhere; }
.pic-list li > .pdf-imp-link { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.pdf-imp-thumb[data-flash] .pdf-imp-thumb-img { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 45%, transparent); transition: box-shadow 0.2s var(--ease-default); }
@media (prefers-reduced-motion: reduce) { .pdf-imp-thumb[data-flash] .pdf-imp-thumb-img { transition: none; } }
.pdf-imp[data-making] .pdf-imp-foot { display: none; }
.pdf-imp[data-making] .dialog-close { visibility: hidden; }
/* "Making your template": four pages laid onto a stack in turn, then the steps tick off */
.pdf-imp-making { display: grid; justify-items: center; gap: var(--sp-5); padding: var(--sp-6) 0 var(--sp-4); }
.pim-stack { position: relative; width: 56px; height: 70px; }
.pim-stack i { position: absolute; inset: 0; border: 1px solid var(--border); border-radius: 3px; background: var(--card); box-shadow: var(--shadow-sm);
    animation: pim-lay 2.4s cubic-bezier(.2, .7, .2, 1) infinite; opacity: 0; }
.pim-stack i::before, .pim-stack i::after { content: ""; position: absolute; left: 9px; right: 9px; height: 3px; border-radius: 2px; background: var(--muted); }
.pim-stack i::before { top: 12px; right: 20px; background: var(--primary); opacity: .55; }
.pim-stack i::after { top: 22px; box-shadow: 0 7px 0 var(--muted), 0 14px 0 var(--muted), 0 21px 0 var(--muted); }
.pim-stack i:nth-child(2) { animation-delay: .6s; }
.pim-stack i:nth-child(3) { animation-delay: 1.2s; }
.pim-stack i:nth-child(4) { animation-delay: 1.8s; }
@keyframes pim-lay {
    0% { opacity: 0; transform: translate(26px, -22px) rotate(10deg); }
    18% { opacity: 1; transform: translate(0, 0) rotate(-2deg); }
    26% { transform: translate(0, 0) rotate(0deg); }
    80% { opacity: 1; transform: translate(0, 0); }
    100% { opacity: 0; transform: translate(-6px, 4px); }
}
.pim-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); font-size: var(--text-sm); color: var(--muted-foreground); min-width: 15rem; }
.pim-steps li { display: flex; align-items: center; gap: var(--sp-2); transition: color .2s; }
.pim-steps li[data-state="now"] { color: var(--foreground); font-weight: 600; }
.pim-steps li[data-state="done"] { color: var(--foreground); }
.pim-mark { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: var(--radius-full); border: 1.5px solid var(--border); }
.pim-mark svg { width: 12px; height: 12px; fill: none; stroke: var(--primary-foreground); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; }
.pim-steps li[data-state="now"] .pim-mark { border-color: var(--primary); border-right-color: transparent; animation: pim-spin .8s linear infinite; }
.pim-steps li[data-state="done"] .pim-mark { border-color: var(--primary); background: var(--primary); animation: pim-pop .25s ease-out; }
.pim-steps li[data-state="done"] .pim-mark svg { stroke-dashoffset: 0; transition: stroke-dashoffset .3s .08s ease-out; }
@keyframes pim-spin { to { transform: rotate(1turn); } }
@keyframes pim-pop { 0% { transform: scale(.7); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .pim-stack i { animation: none; opacity: 1; }
    .pim-stack i:nth-child(1) { transform: translate(-6px, 4px); } .pim-stack i:nth-child(2) { transform: translate(-3px, 2px); }
    .pim-steps li[data-state="now"] .pim-mark { animation: none; border-right-color: var(--primary); }
    .pim-steps li[data-state="done"] .pim-mark, .pim-steps li[data-state="done"] .pim-mark svg { animation: none; transition: none; }
}
.pdf-imp-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--sp-3); }
.pdf-imp-grid2 .label { font-size: var(--text-xs); }

/* ---- Import PDF compare workspace (Phil 19 Oct 2026, version A of ~/Sites/_prototypes/pbc/pdf-import-compare) ----
   Once the PDF is read, Import PDF is a workspace: the pages down the left (PBC's pictures of the parse), the ORIGINAL page
   (drawn by PBC since 25 Oct 2026) beside PBC's picture, the discrepancies in a column on the right, grouped by Type, Layout,
   Pictures and Comments. Nothing moves by itself. Component tokens on .pdf-imp--ws; PBC's own tokens everywhere else.
   js/modules/import-compare/workspace.js builds it. */
.pdf-imp--ws {
    --icw-rail-w: 6.5rem;
    --icw-col-w: 25rem;
    --icw-paper: #ffffff;              /* the page is white paper in both themes, as PBC draws it */
    --icw-mark: #1668b0;               /* the drawing selection blue: lines of a font on PBC's picture */
    --icw-ring: var(--primary);        /* a spot marked on PBC's picture: the ink, with a yellow halo */
    --icw-halo: var(--brand-yellow);
    /* status tokens (audit, 24 Oct 2026): Fixed is finished, so it is PBC's green pill (.badge-success's own pair, navy ink
       6.9:1 light, 6:1 dark). TO CHECK IS AMBER (P1, Phil 25 Oct 2026; his colour rule: green finished, amber needs someone,
       red lost or late): most rows are choices, not errors. PBC's amber in its dark tone on the light sand (amber-700, 3.8:1
       on the page, 4.6:1 on the card: the mark clears 3:1) and --warning on the dark theme. Red only for a refused file. */
    --icw-done: var(--success-badge, var(--success));
    --icw-done-ink: var(--success-foreground);
    --icw-alert: #b45309;
    --icw-refused: var(--destructive-text);
    width: 100%; max-width: 106rem; height: min(94dvh, 66rem); max-height: none; overflow: clip;
}
[data-theme="dark"] .pdf-imp--ws { --icw-alert: var(--warning); }
.pdf-imp--ws[data-making] { max-width: 36rem; height: auto; }
.pdf-imp--ws[data-making] .icw-wrap, .pdf-imp--ws[data-making] .icw-settings-btn { display: none !important; }
.pdf-imp--ws[data-over] { outline: 3px dashed var(--ring); outline-offset: -6px; }
/* clip, never a scroller: bringing a row into view must not slide the whole workspace up */
.pdf-imp-body.icw-body { container: icw / inline-size; display: flex; flex-direction: column; gap: var(--sp-2); padding: 0; overflow: clip; flex: 1 1 auto; }
.icw-body > .pdf-imp-progress, .icw-body > .pdf-imp-alert { margin: var(--sp-3) var(--sp-5) 0; }
.icw-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); }
/* the ask's host takes no row of its own: as a grid item it took half the free height, so the pages shrank and grew with
   what the column held (a short column: pictures half the dialog's height) */
.icw-confirm-host { display: contents; }
.icw { display: grid; grid-template-columns: var(--icw-rail-w) minmax(0, 1fr) var(--icw-col-w); gap: var(--sp-4); padding: var(--sp-3) var(--sp-5); min-height: 0; overflow: clip; }
.icw-foot .icw-settings-btn { margin-right: auto; }

/* the page list: PBC's pictures, the page's number, how many are still to check on it */
.icw-rail { display: grid; align-content: start; gap: var(--sp-2); overflow-y: auto; min-height: 0; padding: 3px var(--sp-1) 3px 3px; }
.icw-railitem { position: relative; display: grid; gap: var(--sp-1); padding: var(--sp-1); border: 2px solid transparent; border-radius: var(--radius-md); background: none; color: var(--muted-foreground); font-size: var(--text-xs); text-align: center; }
.icw-railitem:hover { background: var(--hover-fill-row); }
.icw-railitem[aria-current="true"] { border-color: var(--primary); color: var(--foreground); font-weight: 600; }
.icw-railpic { position: relative; display: block; aspect-ratio: var(--icw-ratio, 210 / 297); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--icw-paper); }
.icw-railpic img { width: 100%; height: 100%; object-fit: cover; }
.icw-railn { position: absolute; top: var(--sp-2); right: var(--sp-2); --icw-pin: 1.25rem; }

/* atom: a number on a disc (a row's number, the same mark as on PBC's picture) */
.icw-pinno { --icw-pin: 1.375rem; display: inline-grid; place-items: center; width: var(--icw-pin); height: var(--icw-pin); flex: none; border-radius: var(--radius-full);
    background: var(--primary); color: var(--primary-foreground); font-size: var(--text-xs); font-weight: 600; line-height: 1; }
/* atom: a key on the keyboard */
.icw-kbd { display: inline-block; min-width: 1.4em; padding: 0 0.35em; border: 1px solid var(--border); border-radius: 3px; background: var(--card);
    font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.5; text-align: center; color: var(--muted-foreground); }
/* a loading picture: a soft block with a sheen (PBC's skeleton, 2.0.22); still under reduced motion */
.icw-skel { display: block; width: 100%; height: 100%; background: linear-gradient(100deg, var(--muted) 30%, var(--card) 50%, var(--muted) 70%) 0 0 / 300% 100%; animation: icw-sheen 1.4s linear infinite; }
@keyframes icw-sheen { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .icw-skel, .icw-pic-busy { animation: none; } }

/* the page: the stepper, the keys, the original beside PBC's picture */
.icw-main { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: var(--sp-2); min-height: 0; min-width: 0; }
.icw-main:focus { outline: none; }
.icw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.icw-stepper { display: inline-flex; align-items: center; gap: var(--sp-1); }
.icw-pageno { font-size: var(--text-sm); min-width: 7rem; text-align: center; }
.icw-keys { margin-left: auto; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-dot { margin: 0 var(--sp-1); }
.icw-flip { display: none; }
.icw-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: var(--sp-1) var(--sp-3); min-height: 0; }
/* both panes share the head row (subgrid), so a head that wraps to two lines never puts one picture lower than the other */
.icw-pane { display: grid; grid-row: span 2; grid-template-rows: subgrid; gap: var(--sp-1); min-height: 0; min-width: 0; }
.icw-panehead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--sp-2); font-size: var(--text-xs); color: var(--muted-foreground); min-height: 1.25rem; }
.icw-panehead strong { color: var(--foreground); font-size: var(--text-sm); font-weight: 600; }
/* the two wells are ONE atom: the original (drawn by PBC, original.js; origview 25 Oct 2026, it was the browser's PDF viewer
   in an iframe) and PBC's picture sit in the same well and the same .icw-pic box, so they are the same size and place */
.icw-orig, .icw-imp-well { display: grid; place-items: center; min-height: 0; padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--muted); container-type: size; }
.icw-hint { color: var(--muted-foreground); }
/* the largest box of the page's shape that fits the well both ways (height: 100% made a narrow well's frame taller than
   the page: white bands above and below the picture, Phil 24 Oct 2026) */
.icw-pic { position: relative; margin: 0; aspect-ratio: var(--icw-ratio, 210 / 297); width: min(100cqw, calc(100cqh * var(--icw-rn, 0.70707))); height: auto; overflow: hidden; border: 1px solid var(--border); border-radius: 2px; background: var(--icw-paper); }
.icw-pic > img, .icw-pic > canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.icw-pic-busy { position: absolute; inset: 0; display: grid; place-content: center; padding: var(--sp-4); font-size: var(--text-xs);
    background: linear-gradient(100deg, var(--muted) 30%, var(--card) 50%, var(--muted) 70%) 0 0 / 300% 100%; animation: icw-sheen 1.4s linear infinite; }
.icw-pic-busy.is-over { inset: auto var(--sp-2) var(--sp-2) auto; padding: 0; background: none; animation: none; }
.icw-pic-busy > span { padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-sm); background: var(--popover); color: var(--foreground); box-shadow: var(--shadow-sm); }
/* the original opening or drawing: PBC's spinner in the picture's chip */
.icw-orig-busy > span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.icw-orig-busy .spinner { display: inline-block; flex: none; width: 14px; height: 14px; border-width: 2px; }
.icw-pic-fail { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--sp-2); padding: var(--sp-4); text-align: center; font-size: var(--text-xs); background: var(--card); color: var(--foreground); }
.icw-pic-fail p { margin: 0; max-width: 28ch; }
/* atoms on PBC's picture: a font's lines, a spot's ring and number, a comment where it will land */
.icw-linemarks { position: absolute; inset: 0; pointer-events: none; }
.icw-linemark, .icw-ring { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); pointer-events: none; }
.icw-linemark { background: color-mix(in srgb, var(--icw-mark) 28%, transparent); outline: 1px solid var(--icw-mark); border-radius: 2px; }
.icw-ring { min-width: 6px; min-height: 6px; border-radius: 3px; outline: 3px solid var(--icw-ring); box-shadow: 0 0 0 4px var(--icw-halo); }
.icw-ring[data-soft] { outline-width: 2px; box-shadow: 0 0 0 2px var(--icw-halo); }
.icw-ringpin { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -110%); padding: 0 0.35em; min-width: 1.5rem; height: 1.5rem; display: grid; place-items: center;
    border-radius: var(--radius-full); background: var(--icw-ring); color: var(--icw-halo); font-size: var(--text-xs); font-weight: 600; pointer-events: none; }
.icw-pic .cmt-pin { position: absolute; left: var(--x); top: var(--y); }

/* atom: THE COMMENT PIN as markup (js/modules/ui/comment-pin.js `pinHTML`; the editor draws the same pin on its canvas from
   the same constants): its tail tip (2, 22 of its 24 box at 1.1) on the point, the canvas's soft shadow. Several comments at
   one spot: one pin with how many, a second pin's edge behind it */
.cmt-pin { position: absolute; display: block; width: 26.4px; height: 26.4px; margin: -24.2px 0 0 -2.2px; pointer-events: none; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.28)); }
.cmt-pin svg { display: block; overflow: visible; }
.cmt-pin-face { position: relative; }
.cmt-pin-back { position: absolute; left: 3.5px; top: -3.5px; }

/* a spread the import splits: a gap at each fold in the well's colour, and each finished page's number (21 Oct 2026) */
.icw-fold { position: absolute; top: 0; bottom: 0; left: var(--x); width: var(--sp-2); transform: translateX(-50%); background: var(--muted); pointer-events: none; }
.icw-railpic .icw-fold { width: 3px; }
.icw-cutno { position: absolute; top: var(--sp-2); left: calc(var(--x) + var(--sp-2)); padding: 0 var(--sp-2); border-radius: var(--radius-full);
    background: var(--popover); color: var(--foreground); box-shadow: var(--shadow-sm); font-size: var(--text-xs); font-weight: 600; line-height: 1.5rem; pointer-events: none; }
.icw-railpic .icw-cutno { display: none; }
.pdf-imp-desc-split { color: var(--foreground); font-weight: 600; }

/* the column of discrepancies */
.icw-col { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--sp-3); min-height: 0; min-width: 0; overflow-y: auto; overflow-wrap: anywhere; padding-right: var(--sp-1); scroll-padding-top: var(--icw-head-h, 10rem); }
.icw-col-head { position: sticky; top: 0; z-index: 1; display: grid; gap: var(--sp-2); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); background: var(--background); }
.icw-col-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.icw-col-title h3 { font-size: var(--text-sm); font-weight: 600; }
.icw-head-acts { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.icw-head-acts .btn-icon { color: var(--foreground); }
.icw-head-acts .btn-icon:disabled { opacity: 0.4; }
.icw-head-acts { align-items: center; justify-content: flex-end; }
.icw-rowstep .icw-pageno { min-width: 5.5rem; }
.icw-count { display: grid; gap: var(--sp-1); }
.icw-count-line { margin: 0; font-size: var(--text-sm); font-weight: 600; }
.icw-count-sub { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-count-bar { display: flex; height: 0.375rem; overflow: hidden; border-radius: var(--radius-full); background: color-mix(in srgb, var(--icw-alert) 28%, var(--muted)); }
.icw-count-bar i { display: block; width: var(--w); }
.icw-count-bar i[data-s="fixed"] { background: var(--icw-done); }
.icw-count-bar i[data-s="understood"] { background: var(--muted-foreground); }
.icw-placing { margin: 0; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-placing .spinner, .icw-file-say .spinner, .icw-status[data-pending] .spinner, .icw-note .spinner { width: 12px; height: 12px; border-width: 1.5px; display: inline-block; vertical-align: -2px; }
.icw-next-check { justify-self: start; }
/* every row checked: said where Next to check was, with Fixed's green tick */
.icw-alldone { margin: 0; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
.icw-alldone svg { flex: none; width: 1.25rem; height: 1.25rem; padding: 3px; border-radius: var(--radius-full); background: var(--icw-done); color: var(--icw-done-ink); }
/* molecule: the batch just done, and its Undo */
.icw-undobar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: var(--primary); color: var(--primary-foreground); font-size: var(--text-xs); }
.icw-undobar .btn { background: transparent; color: var(--primary-foreground); border: 1px solid currentColor; }
.icw-undobar .btn:hover { background: color-mix(in srgb, var(--primary-foreground) 16%, transparent); }
/* a section: Type, Layout, Pictures, Comments */
.icw-sec { display: grid; gap: var(--sp-1); }
.icw-sec > summary { display: flex; align-items: baseline; gap: var(--sp-2); min-height: 1.75rem; padding: var(--sp-1) 0; cursor: pointer; list-style: none; font-size: var(--text-xs); }
.icw-sec > summary::-webkit-details-marker { display: none; }
.icw-sec > summary::before { content: ""; width: 0.4em; height: 0.4em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); align-self: center; transition: transform var(--duration-fast); }
.icw-sec[open] > summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .icw-sec > summary::before { transition: none; } }
.icw-sec-t { font-size: var(--text-sm); font-weight: 600; color: var(--foreground); }
.icw-sec-n { color: var(--muted-foreground); }
.icw-done-line { margin: 0 0 var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); }
/* molecule: a discrepancy row (a font, or every place of one kind on one page) */
.icw-row { display: grid; border-radius: var(--radius-md); container: icwrow / inline-size; }
.icw-row + .icw-row { border-top: 1px solid var(--border); }
.icw-row[data-open] { background: var(--card); box-shadow: inset 3px 0 0 var(--primary); border-top-color: transparent; }
.icw-row[data-open] + .icw-row { border-top-color: transparent; }
.icw-row-btn { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-1) var(--sp-2); align-items: start; min-height: 2.25rem; padding: var(--sp-2); border-radius: var(--radius-md); text-align: left; color: var(--foreground); }
.icw-row-btn:hover { background: var(--hover-fill-row); }
.icw-row-btn:focus-visible, .icw-mem-btn:focus-visible, .icw-railitem:focus-visible { outline-offset: -2px; }
.icw-row-t { font-size: var(--text-sm); min-width: 0; }
.icw-row-p { grid-column: 2; font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-row-body { display: grid; gap: var(--sp-3); padding: 0 var(--sp-3) var(--sp-3); min-width: 0; }
.icw-row-d, .icw-note { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-row-d { color: var(--foreground); }
.icw-pbc { margin: 0; font-size: var(--text-xs); color: var(--foreground); }
.icw-pbc-k { font-weight: 600; }
.icw-sample { margin: 0; font-size: var(--text-lg); line-height: var(--leading-tight); color: var(--foreground); overflow-wrap: anywhere; }
/* while the PDF's face loads: PBC's skeleton line, one line of the sample's height (P7) */
.icw-sample-wait { height: calc(var(--text-lg) * var(--leading-tight)); display: flex; align-items: center; }
.icw-sample-wait .skel-bar { width: 70%; height: 1.1em; border-radius: var(--radius-sm); }
.icw-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.icw-link { min-height: 24px; font-size: var(--text-xs); font-weight: 400; color: var(--foreground); text-decoration: underline; text-underline-offset: 0.15em; justify-self: start; }
.icw-link:hover { text-decoration-thickness: 2px; }
.icw-seeit { display: none; }
@container icwrow (max-width: 20rem) { .icw-acts { flex-direction: column; align-items: stretch; } }
/* atom: To check (body ink beside an amber bar), Understood (quiet), Fixed (green, ink) */
.icw-status { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-2); border-radius: var(--radius-full); font-size: var(--text-xs); line-height: 1.6; white-space: nowrap; flex: none; }
.icw-status[data-status="check"] { color: var(--foreground); border-left: 3px solid var(--icw-alert); border-radius: 0; }
.icw-status[data-status="understood"] { background: var(--secondary); color: var(--foreground); }
.icw-status[data-status="fixed"] { background: var(--icw-done); color: var(--icw-done-ink); }
/* molecule: a way to bring it in, what it gives and what it costs (a radio in a radio group) */
.icw-choices { display: grid; gap: var(--sp-2); }
.icw-choice { display: grid; gap: var(--sp-1); min-width: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); color: var(--foreground); text-align: left; }
.icw-choice:hover { border-color: var(--muted-foreground); }
.icw-choice[aria-checked="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--popover); }
.icw-choice-label { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); font-weight: 600; }
.icw-choice-label::before { content: ""; flex: none; width: 0.875rem; height: 0.875rem; border: 2px solid var(--muted-foreground); border-radius: 50%; }
.icw-choice[aria-checked="true"] .icw-choice-label::before { border: 4px solid var(--primary); }
.icw-choice-gc { font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-choice-gc > span:first-child { color: var(--foreground); }
.icw-choice-cost { color: var(--muted-foreground); }
/* the spot as it will import (from PBC's picture of the page) */
/* as wide as the column or as 7rem tall at the spot's own shape, whichever is smaller (max-height alone squashed the picture
   inside, sized for the full width: Phil 24 Oct 2026, "this is squished") */
.icw-spot { position: relative; display: block; width: min(100%, calc(7rem * var(--icw-sr, 4))); margin-inline: auto; background-repeat: no-repeat; background-color: var(--icw-paper); border: 1px solid var(--border); border-radius: var(--radius-sm); }
/* molecule: drop or choose the full font files, the files and their styles */
.icw-drop { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px dashed var(--input-soft); border-radius: var(--radius-md); background: var(--background); }
.icw-drop-say { flex: 1 1 12rem; font-size: var(--text-xs); color: var(--muted-foreground); }
.icw-files { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-1); font-size: var(--text-xs); }
.icw-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-1) var(--sp-2); }
.icw-files li > .icw-file-say { grid-column: 1 / 3; grid-row: 2; color: var(--muted-foreground); }
.icw-files li > .icw-file-say[data-tone="danger"] { color: var(--foreground); border-left: 3px solid var(--icw-refused); padding-left: var(--sp-2); }
.icw-file-name { overflow-wrap: anywhere; min-width: 0; }
.icw-file-pick { display: block; }
.icw-select-sm { height: 32px; min-width: 10rem; font-size: var(--text-xs); }
.icw-file-x { width: 32px; height: 32px; color: var(--muted-foreground); }
/* molecule: the letters, folded; its one line always in view */
.icw-letters > summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-3); min-height: 1.75rem; font-size: var(--text-xs); cursor: pointer; list-style: none; }
.icw-letters > summary::-webkit-details-marker { display: none; }
.icw-letters-link { text-decoration: underline; text-underline-offset: 0.15em; }
.icw-letters[open] .icw-letters-link::after { content: " (hide)"; }
.icw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(1.25rem, 1fr)); gap: 2px; margin-top: var(--sp-2); font-size: var(--text-xs); }
.icw-grid i { display: grid; place-items: center; height: 1.25rem; font-style: normal; border-radius: 2px; background: var(--background); color: var(--foreground); }
.icw-grid i[data-miss] { color: transparent; background: transparent; outline: 1px dashed var(--icw-alert); outline-offset: -2px; }
/* molecule: one place of a group; it can take its own choice */
.icw-mems { list-style: none; margin: 0; padding: 0; display: grid; }
.icw-mem { display: grid; border-top: 1px solid var(--border); }
.icw-mem-btn { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-2); min-height: 2rem; padding: var(--sp-1) var(--sp-2); border-radius: var(--radius-sm); font-size: var(--text-xs); text-align: left; color: var(--foreground); }
.icw-mem-btn:hover { background: var(--hover-fill-row); }
.icw-mem[data-open] .icw-mem-btn { box-shadow: inset 3px 0 0 var(--icw-mark); }
.icw-mem-n { min-width: 2.5rem; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.icw-mem-t { min-width: 0; overflow-wrap: anywhere; }
.icw-mem-own { color: var(--muted-foreground); }
.icw-mem-body { display: grid; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-3) var(--sp-4); }

/* the panel of the other choices: Pages, Spreads, Bleed, Paragraph styles, Images (the summary list) */
.icw-settings { position: absolute; left: var(--sp-5); bottom: var(--sp-3); z-index: 4; width: min(36rem, calc(100% - 2 * var(--sp-5))); max-height: calc(100% - 2 * var(--sp-3)); display: grid; grid-template-rows: auto minmax(0, 1fr);
    border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--popover); box-shadow: var(--shadow-xl); overflow: hidden; }
.icw-settings-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.icw-settings-title { font-size: var(--text-sm); font-weight: 600; }
.icw-settings-title:focus { outline: none; }
.icw-settings-body { overflow-y: auto; padding: 0 var(--sp-4) var(--sp-2); container-type: inline-size; }
/* Import asks first while a font is only part there */
.icw-confirm { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: var(--sp-5); background: rgb(26 33 58 / 0.45); }
.icw-confirm-box { width: min(30rem, 100%); display: grid; gap: var(--sp-3); padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--background); box-shadow: var(--shadow-xl); }
.icw-confirm-box h3 { font-size: var(--text-lg); font-weight: 600; }
.icw-confirm-box h3:focus { outline: none; }
.icw-confirm-box p { margin: 0; font-size: var(--text-sm); }
.icw-confirm-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }

/* narrower: the column first, the pages along the top, then the page; on a phone one side at a time */
@container icw (max-width: 64rem) {
    .icw { grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; overflow: visible; }
    .icw-wrap { overflow-y: auto; grid-template-rows: auto; }
    .icw > * { min-height: auto; }
    .icw-col { order: -1; overflow: visible; }
    .icw-col-head { position: static; }
    .icw-rail { grid-auto-flow: column; grid-auto-columns: 4.5rem; overflow-x: auto; overflow-y: hidden; }
    .icw-main { grid-template-rows: auto minmax(26rem, 70dvh); }
    .icw-keys { display: none; }
    .icw-seeit { display: inline-flex; }
}
@container icw (max-width: 40rem) {
    .icw { padding: var(--sp-3); }
    .icw-flip { display: inline-flex; }
    /* one side at a time, both in the same place: the head row is as tall as the taller head, so flipping between the
       original and PBC's picture never moves the page (origview, 25 Oct 2026); the side not shown takes no clicks */
    .icw-panes { grid-template-columns: minmax(0, 1fr); }
    .icw-pane { grid-column: 1; grid-row: 1 / span 2; }
    .icw-panes[data-show="imp"] .icw-pane[data-side="orig"], .icw-panes[data-show="orig"] .icw-pane[data-side="imp"] { visibility: hidden; }
    .icw-row-btn, .icw-mem-btn, .icw-sec > summary, .icw-letters > summary, .icw-link { min-height: 44px; }
    .icw .btn-icon.btn-sm, .icw-file-x { width: 44px; height: 44px; }
    .icw .btn-sm { height: 44px; }
    .icw-next-check { justify-self: stretch; }
}
@media (max-width: 47.99rem) {
    .pdf-imp--ws { height: auto; max-height: 94dvh; }
}

/* ---- Split spreads into pages (proto/split-spreads, Phil 7 Oct 2026; prototype round 7) ----
   Stacked over Import PDF (no second dim) or alone from the Pages panel. The preview shows the finished pages: the
   fold-edge bleed carries the artwork past a trim line. One question (At the fold), the rest under More options. */
.split-overlay { background: transparent; }
.split-dlg { width: min(100% - 2 * var(--sp-4), 68rem); max-width: none; height: min(92dvh, 52rem); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
.split-dlg [hidden] { display: none !important; }
.split-dlg .dialog-header { align-items: flex-start; }
.split-head { display: grid; gap: var(--sp-1); justify-items: start; min-width: 0; }
.split-back { margin-left: calc(var(--sp-2) * -1); margin-bottom: var(--sp-1); gap: var(--sp-1); color: var(--muted-foreground); }
.split-back:hover { color: var(--foreground); }
.split-dlg .dialog-title:focus { outline: none; }
.split-body { min-height: 0; padding: var(--sp-3) var(--sp-5) var(--sp-5); container-type: inline-size; overflow: auto; }
.split-well { display: grid; gap: var(--sp-5); align-items: start; }
.split-stage { display: grid; gap: var(--sp-3); justify-items: center; padding: var(--sp-4); border-radius: var(--radius-md); background: var(--muted); min-width: 0; }
.split-side { display: grid; gap: var(--sp-4); align-content: start; min-width: 0; }
@container (min-width: 46rem) {
    .split-body { overflow: hidden; }
    .split-well { grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; height: 100%; }
    .split-stage, .split-side { min-height: 0; overflow-y: auto; align-content: start; }
    .split-side { padding: var(--sp-1) var(--sp-2) var(--sp-2) var(--sp-1); margin-left: calc(var(--sp-1) * -1); }
}
.split-mode { justify-self: center; }
.split-frame { position: relative; width: min(100%, 34rem); }
.split-pg { position: absolute; top: 0; bottom: 6.5%; background-color: #fff; background-repeat: no-repeat; box-shadow: var(--shadow-sm); overflow: hidden; }
.split-pg.is-loading { background: var(--background); }
.split-pg.is-odd { outline: 2px solid var(--destructive); }
.split-bleed { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, #fff 40%, transparent); pointer-events: none; }
.split-trim { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--primary); pointer-events: none; }
.split-num { position: absolute; bottom: 0; transform: translateX(-50%); font-size: var(--text-xs); color: var(--muted-foreground); }
.split-spine { position: absolute; left: 50%; top: 0; bottom: 6.5%; width: 0; border-left: 1px solid var(--border); pointer-events: none; }
.split-fold { position: absolute; top: 0; bottom: 6.5%; width: 0; border-left: 1px dashed var(--primary); }
.split-handle { position: absolute; z-index: 2; top: calc(var(--sp-3) * -1); bottom: 6.5%; width: 24px; transform: translateX(-50%); padding: 0; border: 0; background: none; cursor: ew-resize; touch-action: none; }
.split-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid var(--primary); }
.split-handle::after { content: ""; position: absolute; top: 0; left: 50%; width: 14px; height: 14px; transform: translateX(-50%); border-radius: var(--radius-full); background: var(--primary); box-shadow: 0 0 0 2px var(--background); }
.split-handle:focus-visible { outline: 2px solid var(--ring); }
.split-loading { position: absolute; left: 0; right: 0; top: 40%; display: flex; align-items: center; justify-content: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--muted-foreground); pointer-events: none; }
.split-loading .spinner { width: 16px; height: 16px; }
.split-strip-img.is-loading { background-color: var(--background); }
.split-say { margin: 0; max-width: 40rem; text-align: center; font-size: var(--text-sm); }
.split-nav { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); font-size: var(--text-sm); }
.split-nav output { min-width: 11rem; text-align: center; }
.split-strip { display: flex; gap: var(--sp-2); margin: 0; padding: var(--sp-1); list-style: none; overflow-x: auto; max-width: 100%; justify-self: stretch; }
.split-strip-b { display: grid; gap: var(--sp-1); justify-items: center; padding: var(--sp-1); border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); font: inherit; font-size: var(--text-xs); cursor: pointer; }
.split-strip-b:hover { background: var(--background); }
.split-strip-b[aria-current="true"] { border-color: var(--primary); background: var(--background); color: var(--foreground); }
.split-strip-b:focus-visible { outline: 2px solid var(--ring); }
.split-strip-img { position: relative; display: block; height: 44px; background-color: #fff; background-size: 100% 100%; outline: 1px solid var(--border); }
.split-strip-img.is-odd { outline: 2px solid var(--destructive); }
.split-strip-img i { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--primary); }
.split-strip-k { display: inline-flex; align-items: center; gap: var(--sp-1); white-space: nowrap; }
.split-dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--primary); }
.split-all { width: 100%; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-3); align-items: flex-end; }
.split-all li { display: grid; gap: var(--sp-1); justify-items: center; font-size: var(--text-xs); color: var(--muted-foreground); }
.split-all-pp { display: flex; }
.split-all-p { height: 6rem; background-color: #fff; background-repeat: no-repeat; outline: 1px solid var(--border); }
.split-all.is-facing { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); align-items: start; }
.split-all.is-facing li { justify-items: stretch; text-align: center; }
.split-all.is-facing .split-all-pp { display: grid; grid-template-columns: 1fr 1fr; }
.split-all.is-facing .split-all-p { height: auto; width: 100%; }
.split-all.is-facing .split-all-p[data-col="1"] { grid-column: 1; }
.split-all.is-facing .split-all-p[data-col="2"] { grid-column: 2; }
.split-all-p.is-loading { background: var(--background); }
.split-sec { display: grid; gap: var(--sp-2); }
.split-sec h4, .split-only h4 { font-size: var(--text-sm); font-weight: 600; }
.split-sub { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.split-choices { display: grid; gap: var(--sp-1); }
.split-choice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 var(--sp-2); align-items: start; padding: var(--sp-2); border-radius: var(--radius-md); cursor: pointer; }
.split-choice:hover { background: var(--accent); }
.split-choice input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--primary); }
.split-choice > span { display: grid; gap: var(--sp-1); }
.split-choice b { font-size: var(--text-sm); font-weight: 600; }
.split-choice em { font-style: normal; font-weight: 400; font-size: var(--text-xs); color: var(--muted-foreground); margin-left: var(--sp-1); }
.split-choice small { font-size: var(--text-xs); color: var(--muted-foreground); line-height: 1.45; }
.split-mm { display: inline-flex; align-items: center; gap: var(--sp-1); font-size: var(--text-xs); color: var(--muted-foreground); }
.split-mm .input { width: 5.5rem; height: 32px; }
.split-more > summary { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 24px; cursor: pointer; font-size: var(--text-sm); font-weight: 600; list-style: none; }
.split-more > summary::-webkit-details-marker { display: none; }
.split-more > summary::before { content: ""; width: 0.4em; height: 0.4em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); margin-right: 0.2em; transition: transform 0.15s; }
.split-more[open] > summary::before { transform: rotate(45deg); }
.split-more[open] > summary { margin-bottom: var(--sp-3); }
.split-more-body { display: grid; gap: var(--sp-4); }
.split-only { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); }
.split-only .form-error { margin: 0; color: var(--foreground); border-left: 3px solid var(--destructive); padding-left: var(--sp-2); font-size: var(--text-xs); }
.split-field { display: grid; gap: var(--sp-1); }
.split-field .label { font-size: var(--text-xs); }
.split-folds { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.split-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--sp-2); }
.split-foot-left { margin-right: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.split-foot .dw-seg button, .split-mode button { min-height: 32px; }
.split-resetall { gap: var(--sp-1); }
@media (max-width: 47.99rem) { .split-handle { width: 44px; } .split-strip-b { min-width: 44px; } }
@media (prefers-reduced-motion: reduce) { .split-more > summary::before { transition: none; } }
.pdf-imp-progress { display: grid; gap: var(--sp-1); font-size: var(--text-xs); }
.pdf-imp-bar { height: 4px; border-radius: var(--radius-full); background: var(--muted); overflow: hidden; }
.pdf-imp-bar > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width 0.3s var(--ease-default); }
.pdf-imp-alert { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-left: 3px solid var(--destructive); border-radius: var(--radius-md); font-size: var(--text-sm); }
.pdf-imp-foot { align-items: center; }
.pdf-imp-legacy { margin-right: auto; display: flex; align-items: center; gap: var(--sp-2); min-height: 24px; font-size: var(--text-xs); color: var(--muted-foreground); cursor: pointer; }
.pdf-imp-spin { width: 14px; height: 14px; border-color: color-mix(in srgb, var(--primary-foreground) 35%, transparent); border-top-color: var(--primary-foreground); }
@container (max-width: 26rem) {
    .pdf-imp-row { grid-template-columns: minmax(0, 1fr) auto; }
    .pdf-imp-k { grid-row: 1; grid-column: 1; }
    .pdf-imp-row > .pdf-imp-link { grid-row: 1; grid-column: 2; }
    .pdf-imp-v { grid-row: 2; grid-column: 1 / -1; }
    .pdf-imp-v:empty { display: none; }
}
@media (max-width: 767px) {
    .pdf-imp-link, .pdf-imp-thumb, .pdf-imp-check { min-height: 44px; }
    .pdf-imp-link { min-width: 44px; }
    .pdf-imp .select, .pdf-imp .input, .pdf-imp .btn:not(.btn-link), .pdf-imp .dw-seg button { min-height: 44px; }
    .pdf-imp .dialog-close { width: 44px; height: 44px; }
    .pdf-imp-foot { flex-wrap: wrap; }
    .pdf-imp-legacy { flex: 1 1 100%; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .pdf-imp-bar > i { transition: none; } }

/* --- Import font step (2.0.21): one row per family, rules only between rows. Name and choice share the first
   line; a line of the document's own words in the PDF's face, then what the PDF carries, runs full width below. --- */
.pif-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(9rem, 13rem);
    grid-template-areas: "name choice" "detail detail";
    gap: var(--sp-1) var(--sp-2);
    align-items: center;
    padding: var(--sp-2) 0;
    font-size: var(--text-xs);
}
.pif-row + .pif-row { border-top: 1px solid var(--border); }
.pif-row[data-attention] .pif-name::after { content: "Needs a choice"; margin-left: var(--sp-2); font-weight: 400; color: var(--muted-foreground); }
.pif-name { grid-area: name; font-size: var(--text-sm); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.pif-choice { grid-area: choice; width: 100%; }
.pif-detail { grid-area: detail; min-width: 0; }
.pif-sample { margin: 0 0 2px; font-size: var(--text-lg); line-height: 1.25; color: var(--foreground); overflow-wrap: anywhere; }
.pif-line, .pif-upload { color: var(--muted-foreground); }
.pif-upload { margin-top: 2px; }
.pif-upload.pif-error { color: var(--foreground); border-left: 3px solid var(--destructive); padding-left: var(--sp-2); }
.pif-note { margin-top: var(--sp-1); }
@container (max-width: 26rem) { .pif-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "choice" "detail"; } }

/* ── Keyboard shortcuts list (2.0.25: team Shortcuts page + Document Settings > Shortcuts; js/modules/shortcuts/settings-ui.js) ── */
.sc-editor { display: flex; flex-direction: column; gap: var(--sp-4); }
.sc-kinds { display: flex; flex-direction: column; gap: var(--sp-2); }
.sc-kbd { font-family: inherit; font-size: 12px; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--card); white-space: nowrap; }
.sc-none { color: var(--muted-foreground); font-size: 12px; }
.sc-detail { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-2) 0 var(--sp-3); }
.sc-notes { margin: 0; padding-left: 18px; font-size: var(--text-xs); display: flex; flex-direction: column; gap: 2px; }
.sc-src, .sc-got { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.sc-got { color: var(--foreground); }
.sc-err { margin: 0; font-size: var(--text-xs); color: hsl(0 72% 45%); }
.sc-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.sc-record { max-width: 260px; height: 32px; caret-color: transparent; }
.sc-record:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
.sc-fixed summary { cursor: pointer; font-size: var(--text-sm); }
.sc-fixed ul { list-style: none; padding: 0; margin: var(--sp-2) 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px var(--sp-4); font-size: var(--text-sm); }
.sc-fixed li { display: flex; justify-content: space-between; gap: var(--sp-2); }
/* Settings: a card for something on the way (2.0.25: Spelling language) - greyed, controls disabled */
.settings-soon { background: var(--muted); border-style: dashed; }
.settings-soon .card-title { color: var(--muted-foreground); }

/* FIND/CHANGE (2.0.55-tables.30, Phil 14 Oct 2026: "spell check, find and change, find and go to words"; find/find-panel.js):
   Find what with its count and the Match case / Whole word toggles in ONE box (the number field's box), Change to under it,
   the arrows and Change / Change all on one row, the matches listed by page with the words round them */
.find-box {
    display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 3px 0 var(--sp-2);
    border: 1px solid var(--input); border-radius: var(--radius-sm); background: transparent;
}
.find-box:focus-within { border-color: var(--ring); }
.find-input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: none; font: inherit; font-size: var(--text-sm); color: var(--foreground); }
.find-input::placeholder { color: var(--muted-foreground); opacity: 1; }
.find-count { flex: none; margin: 0 4px; font-size: var(--text-xs); color: var(--muted-foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Glyphs panel (js/modules/glyphs/glyphs-panel.js, Phil 18 Oct 2026): find + size, Recently used, Show, the grid in the
   font, a preview with the name and code, the font at the foot. The grid fills the panel's height and scrolls alone. */
.dock-body:has(> .gly) { display: flex; flex-direction: column; }
.gly { --gly-size: 40px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
.gly-top { display: flex; align-items: center; gap: 6px; }
.gly-find { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border: 1px solid var(--input); border-radius: var(--radius-sm); background: var(--background); color: var(--muted-foreground); }
.gly-find:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
.gly-find svg { width: 14px; height: 14px; flex: none; }
.gly-find input { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: none; background: none; font: inherit; font-size: var(--text-sm); color: var(--foreground); }
.gly-find input::placeholder { color: var(--muted-foreground); opacity: 1; }
.gly-zoom { display: flex; gap: 2px; flex: none; }
.gly-zbtn { position: relative; width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: var(--foreground); border-radius: var(--hover-radius); cursor: pointer; }
.gly-zbtn svg { width: 14px; height: 14px; position: relative; }
.gly-zbtn:disabled { opacity: 0.4; cursor: default; }
.gly-sec { font-size: var(--text-xs); color: var(--muted-foreground); }
.gly-show { display: flex; align-items: center; gap: 8px; }
.gly-show .select-field { flex: 1 1 auto; min-width: 0; }
.gly-show .select-field select { width: 100%; }
.gly-recent, .gly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--gly-size), 1fr)); gap: 2px; }
.gly-recent { max-height: calc(var(--gly-size) * 1 + 2px); overflow: hidden; }
.gly-grid { flex: 1 1 auto; min-height: 120px; overflow-y: auto; align-content: start; padding: 1px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.gly-cell { height: var(--gly-size); min-width: 0; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--foreground);
    font-size: calc(var(--gly-size) * 0.55); line-height: 1; cursor: pointer; overflow: hidden; }
.gly-cell:hover { background: var(--hover-fill); }
.gly-cell:active { background: var(--hover-fill-pressed); }
.gly-cell:focus-visible { outline: none; border-color: var(--ring); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 25%, transparent); }
.gly-empty { grid-column: 1 / -1; margin: 12px 4px; font-size: var(--text-sm); color: var(--muted-foreground); }
.gly-foot { display: flex; flex-direction: column; gap: 8px; flex: none; }
.gly-preview { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.gly-big { flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-size: 32px; line-height: 1; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--background); color: var(--foreground); }
.gly-meta { display: flex; flex-direction: column; min-width: 0; }
.gly-name { font-size: var(--text-sm); color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gly-code { font-size: var(--text-xs); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.gly-font { display: flex; gap: 6px; }
.gly-font .select-field { flex: 1 1 auto; min-width: 0; }
.gly-font .select-field select { width: 100%; }
.gly-hint { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
/* OpenType alternates (Phil 24 Oct 2026, glyphs-panel.js): a glyph with alternates wears a mark in its corner, as InDesign's
   Glyphs panel does; press and hold it (or the mark, or Alt+Down) and they pop out */
.gly-cell { position: relative; }
.gly-cell.has-alts::after { content: ''; position: absolute; right: 2px; bottom: 2px; width: 0; height: 0;
    border-style: solid; border-width: 0 0 6px 6px; border-color: transparent transparent var(--muted-foreground) transparent; pointer-events: none; }
.gly-cell.has-alts:hover::after, .gly-cell.has-alts[aria-expanded="true"]::after { border-bottom-color: var(--foreground); }
.gly-altpop { position: fixed; z-index: 10003; display: flex; flex-wrap: wrap; gap: 2px; max-width: 280px; padding: 4px;
    background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.gly-altpop .gly-cell { width: var(--gly-size, 40px); height: var(--gly-size, 40px); font-size: calc(var(--gly-size, 40px) * 0.55); }
.gly-selalts { max-height: none; }
.gly-selalt.is-on { border-color: var(--ring); }
.gly-setname { display: flex; align-items: center; gap: 8px; }
.gly-setname input { flex: 1 1 auto; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--input); border-radius: var(--radius-sm);
    background: var(--background); color: var(--foreground); font: inherit; font-size: var(--text-sm); }
.gly-setname input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 18%, transparent); }
/* the Character panel's OpenType row (opentype/ot-panel.js): the list one press away and what is on */
.ot-row { gap: 8px; align-items: center; }
.ot-btn { flex: none; }
.ot-summary { flex: 1 1 auto; min-width: 0; font-size: var(--text-xs); color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* panel menus: submenus and rules (flyout-panel.js openPanelMenu) */
.view-menu-chev { margin-left: auto; display: inline-flex; color: var(--muted-foreground); }
.panel-menu .view-menu-item[aria-expanded="true"] { background: var(--hover-fill); }
.panel-submenu { z-index: 10002; }
/* Style Options: the OpenType features button and what is on (style-panel.js) */
.stp-ot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stp-ot .stp-hint { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }
.stp-options .panel-menu, body > .panel-menu { z-index: 10010; }
.find-count:empty { display: none; }
.find-opt {
    position: relative; flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0; border: 0; border-radius: var(--hover-radius); background: none; color: var(--muted-foreground); cursor: pointer;
}
.find-opt svg { position: relative; width: 16px; height: 16px; }
.find-opt[aria-pressed="true"] { color: var(--foreground); background: var(--secondary-soft, var(--secondary)); box-shadow: inset 0 0 0 1px var(--ring); }
.find-row { display: flex; align-items: center; gap: var(--sp-2); }
.find-row > .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.find-list { display: flex; flex-direction: column; gap: 1px; }
.find-page { padding: var(--sp-2) 0 2px; font-size: 11px; font-weight: 600; color: var(--muted-foreground); }
.find-list > .find-page:first-child { padding-top: 0; }
.find-hit {
    display: block; width: 100%; padding: 6px var(--sp-2); border: 0; border-radius: var(--radius-sm); background: none;
    color: var(--foreground); font: inherit; font-size: var(--text-xs); line-height: 1.45; text-align: left; overflow-wrap: anywhere; cursor: pointer;
}
.find-hit:hover { background: var(--hover-fill-row, var(--accent)); }
.find-hit.is-on { background: var(--secondary-soft, var(--secondary)); }   /* the tint only (Phil 14 Oct 2026: "remove the left border on selected here") */
.find-hit mark { padding: 0 1px; border-radius: 2px; background: var(--brand-yellow, #ffec8d); color: var(--brand-navy, #1a213a); font-weight: 600; }
.find-hit[title] mark { background: var(--muted); color: var(--foreground); }   /* locked: found, never changed */

/* Data Merge (Phil 10 Nov 2026; js/modules/datamerge/): the panel and Create merged document. Built from the panel atoms; only
   what they lack is here. Flow documents and drawings have no merge. */
#editor-root.doc-flow .props-strip-btn[data-flyout="datamerge"], #editor-root.doc-drawing .props-strip-btn[data-flyout="datamerge"] { display: none !important; }
.dm-source { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); font-weight: 600; min-width: 0; }
.dm-source svg { flex: none; color: var(--muted-foreground); }
.dm-source-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-problem { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--destructive-text); border-radius: var(--radius-sm); }
.dm-problem-title { margin: 0 0 2px; font-size: var(--text-sm); font-weight: 600; color: var(--destructive-text); }
.dm-notes { margin: 0; padding-left: 1.1em; font-size: var(--text-xs); line-height: 1.45; color: var(--muted-foreground); }
.dm-notes li + li { margin-top: 4px; }
.dm-flag { margin: 0; font-size: var(--text-xs); line-height: 1.45; color: var(--destructive-text); }
.dm-ok { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); }
.dm-fields { display: flex; flex-direction: column; gap: 1px; }
.dm-field { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: 32px; padding: 4px var(--sp-2); border: 0;
    border-radius: var(--radius-sm); background: none; color: var(--foreground); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.dm-field:hover { background: var(--hover-fill-row, var(--accent)); }
.dm-field:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.dm-field-ic { display: flex; color: var(--muted-foreground); }
.dm-field-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-field-n { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.dm-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-1); }
.dm-rec { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }
.dm-rec-input { width: 48px; height: 28px; padding: 0 6px; text-align: center; font-variant-numeric: tabular-nums; }
.dm-help > summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; }
.dm-help[open] > summary { margin-bottom: var(--sp-2); }
.dm-help .flyout-note + .flyout-note, .dm-steps + .flyout-note { margin-top: var(--sp-2); }
.dm-steps { margin: 0; padding-left: 1.3em; font-size: var(--text-xs); line-height: 1.5; color: var(--foreground); }
.dm-steps li + li { margin-top: 6px; }
.dm-steps code { font-size: 11px; padding: 0 3px; border-radius: 3px; background: var(--muted); }
.dm-sample { margin-top: var(--sp-2); padding-left: 0; }
.dm-merge { max-width: 34rem; }
.dm-set { margin: 0 0 var(--sp-4); padding: 0; border: 0; min-width: 0; }
.dm-radio, .dm-check { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 var(--sp-2); font-size: var(--text-sm); cursor: pointer; }
.dm-radio .form-hint, .dm-check .form-hint { flex-basis: 100%; margin: 0 0 0 24px; }
.dm-num { width: 64px; height: 30px; padding: 0 6px; }
.dm-many { margin: var(--sp-2) 0 0 24px; }
.dm-many[hidden] { display: none; }
.dm-many-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: var(--sp-2) 0; }
.dm-field-l { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); font-weight: 600; color: var(--muted-foreground); }
.dm-field-l select.input { height: 30px; padding: 0 28px 0 8px; font-weight: 400; }   /* room for the arrow (A4 / A3 sat under it) */
.dm-unit-in { display: flex; align-items: center; gap: 4px; font-weight: 400; }
.dm-grid-out { display: flex; align-items: center; gap: var(--sp-3); }
.dm-grid-pic { flex: none; }
.dm-grid-pic .dm-page { fill: var(--card); stroke: var(--border); stroke-width: 1; }
.dm-grid-pic .dm-margin { fill: none; stroke: var(--muted-foreground); stroke-width: .75; stroke-dasharray: 2 2; }
.dm-grid-pic .dm-cell { fill: var(--secondary-soft, var(--secondary)); stroke: var(--foreground); stroke-width: .75; }
.dm-count { margin: 0; font-size: var(--text-sm); font-weight: 600; }
.dm-check[hidden], .dm-radio[hidden], .dm-field-l[hidden] { display: none; }
/* Records and Layout as one row of PBC buttons (Phil 16 Nov 2026: "change the radio buttons to be more designed and intentional
   for this modal? like the button component we use in other places", Match Size's btn-secondary): real radios underneath, laid
   over each button, so arrows, Tab and screen readers work as radios; the chosen one takes the primary colours */
.dm-seg { display: flex; gap: var(--sp-2); }
.dm-seg-btn { position: relative; flex: 1 1 0; min-width: 0; white-space: nowrap; cursor: pointer; }
/* the radio is only the hit area: never drawn, in any state (the global disabled-radio style set it to half opacity, and a round
   radio stretched over the button showed as a pill outline) */
.dm-seg-btn > input[type="radio"], .dm-seg-btn > input[type="radio"]:disabled, .dm-seg-btn > input[type="radio"]:checked {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0 !important;
    border: 0; border-radius: inherit; background: none; box-shadow: none; cursor: pointer; }
.dm-seg-btn:has(input:checked), .dm-seg-btn:has(input:checked):hover { background: var(--primary); color: var(--primary-foreground); }
.dm-seg-btn:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.dm-seg-btn:has(input:disabled:not(:checked)), .dm-seg-btn:has(input:disabled:not(:checked)):hover { background: var(--secondary); opacity: .45; cursor: not-allowed; }
/* while the merge runs every control is off: the chosen buttons stay chosen, a little quieter (they vanished at .45 on yellow text) */
.dm-seg-btn:has(input:checked:disabled) { opacity: .7; cursor: default; }
.dm-seg-btn > input:disabled { cursor: not-allowed; }
.dm-rec-fields { align-items: flex-end; margin-top: var(--sp-2); }
.dm-set[hidden], .dm-rec-fields[hidden] { display: none; }
.dm-seg ~ .dm-many { margin-left: 0; }   /* the settings under the buttons start at the edge, not under a radio */
/* On a print sheet (Phil 16 Nov 2026): the real sheet drawn small, with its cards and crop marks, and a way through every sheet */
.dm-sheet-out { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); padding: var(--sp-3);
    border-radius: var(--radius-sm); background: var(--muted); }
.dm-sheet-pic { display: flex; align-items: center; justify-content: center; min-height: 160px; }
.dm-sheet-pic img { display: block; max-width: 100%; height: auto; background: #fff; box-shadow: var(--shadow-sm); outline: 1px solid var(--border); }
.dm-sheet-pic img.is-tall { max-height: 320px; width: auto; }
.dm-sheet-pic[aria-busy="true"] img { opacity: .5; transition: opacity var(--duration-fast, .15s) ease; }
.dm-sheet-drawing { margin: 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.dm-sheet-nav { display: flex; align-items: center; gap: var(--sp-2); }
.dm-sheet-where { min-width: 11em; text-align: center; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.dm-report { padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--muted); }
.dm-report .label { margin-bottom: 4px; }
.dm-report .dm-flag + .dm-flag { margin-top: 6px; }
.dm-progress { margin: var(--sp-3) 0 0; }
.dm-progress[hidden] { display: none; }
.dm-bar { height: 6px; border-radius: 9999px; background: var(--muted); overflow: hidden; }
.dm-bar > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .3s ease-out; }
/* the upload is done and the server is storing it: the bar breathes so it never looks stuck */
.dm-bar.is-waiting > span { animation: dm-bar-wait 1.1s ease-in-out infinite alternate; }
@keyframes dm-bar-wait { from { opacity: 1; } to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .dm-bar > span { transition: none; } .dm-bar.is-waiting > span { animation: none; } }
.dm-progress-text { margin: var(--sp-2) 0 0; font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Check Spelling: the sentence round the word sits on the lightest surface, well apart from the panel and its
   selected rows (Phil, 6 Oct 2026: "much lighter than the card to improve focus and contrast") */
.spell-context { font-size: var(--text-sm); line-height: 1.55; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--card); overflow-wrap: anywhere; }
.spell-panel .input[data-sp-to] { background: var(--card); }   /* the Change to field matches the preview */
[data-theme="dark"] .spell-context, [data-theme="dark"] .spell-panel .input[data-sp-to] { background: var(--muted); }

/* Switch (on / off): <button class="pbc-switch" role="switch" aria-checked="true|false" aria-label="...">. ShadCN's
   switch on PBC tokens; the thumb is the button's own ::after, so no inner markup. First user: Check Spelling marks. */
.pbc-switch { position: relative; flex: none; width: 52px; height: 24px; padding: 0; border: 0; border-radius: 9999px;
    background: var(--input-soft); cursor: pointer; transition: background-color .15s ease; }
.pbc-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
    background: var(--card); box-shadow: var(--shadow-sm); transition: transform .15s ease, background-color .15s ease; }
/* the state in words inside the track, on the side the knob is not (Phil, 6 Oct 2026) */
.pbc-switch::before { content: "OFF"; position: absolute; top: 0; bottom: 0; right: 7px; display: flex; align-items: center;
    font-size: 9px; font-weight: 700; letter-spacing: .04em; line-height: 1; color: var(--muted-foreground); }
/* on: dark blue track, light ON, a lighter blue knob (Phil 6 Oct 2026, after trying yellow); dark mode lifts the
   track off the navy panel */
.pbc-switch { --sw-on-track: var(--brand-navy); --sw-on-knob: #7a8e99; --sw-on-text: var(--card); }
[data-theme="dark"] .pbc-switch { --sw-on-track: #333c57; --sw-on-text: var(--brand-sand); }
.pbc-switch[aria-checked="true"] { background: var(--sw-on-track); }
.pbc-switch[aria-checked="true"]::after { transform: translateX(28px); background: var(--sw-on-knob); }
.pbc-switch[aria-checked="true"]::before { content: "ON"; right: auto; left: 9px; color: var(--sw-on-text); }
[data-theme="dark"] .pbc-switch:not([aria-checked="true"])::after { background: var(--brand-sand); }   /* a navy knob vanishes on dark */
.pbc-switch:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pbc-switch, .pbc-switch::after { transition: none; } }

/* Delete rows in menus: a faint red wash on hover instead of the grey accent, so the red stays readable (Phil, 6 Oct 2026:
   "red is unreadable" on the dark card menu) */
.card-kebab-item.destructive:hover,
.folder-pop .view-menu-item.is-danger:hover,
.master-ctx .view-menu-item.destructive:hover,
.stp-menu .view-menu-item.is-danger:hover { background: color-mix(in srgb, var(--destructive-text) 14%, transparent); }
/* the card menu sits over a card of nearly its own navy: a clear edge and a deeper shadow lift it off (dark only) */
[data-theme="dark"] .card-kebab-menu { border-color: var(--input-soft); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3); }
/* The page list above the page box (page-box.js): the View menu's look, opening upward, scrolling */
.ed-page-list { min-width: 180px; overflow-y: auto; overscroll-behavior: contain; }
.ed-page-list[hidden] { display: none; }
.ed-pl-item { padding: 4px var(--sp-2); }
.ed-pl-item[aria-selected="true"] { font-weight: 600; }
.ed-pl-item.is-active { background: var(--accent); }
.ed-pl-thumb { width: 22px; height: 28px; flex: none; object-fit: contain; background: var(--card); border: 1px solid var(--border); border-radius: 2px; }
.ed-pg-input { cursor: pointer; }
.ed-pg-input:focus { cursor: text; }


/* Numbering & Section Options and Define Text Variables (master pages, Phil 20 Oct 2026) */
.sec-body, .dv-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.sec-fields { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.sec-fields:disabled { opacity: .5; }
.sec-fields .form-field { display: flex; flex-direction: column; gap: 6px; }
.sec-at { width: 96px; margin-top: 6px; }
.sec-note { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); line-height: 1.4; }
/* Justification and Hyphenation (justify-dialog.js): the Paragraph panel menu's dialogs. The spacing ranges are a grid of a label and three
   number fields under Minimum / Ideal / Maximum, as InDesign's Justification dialog lays them out. */
.jd-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.jd-body .form-field { display: flex; flex-direction: column; gap: var(--sp-1); }
.jd-grid { display: grid; grid-template-columns: minmax(96px, 1fr) repeat(3, minmax(0, 76px)); gap: var(--sp-2); align-items: center; }
.jd-col { font-size: var(--text-xs); color: var(--muted-foreground); text-align: left; }
.jd-row-label { font-size: var(--text-sm); }
.jd-num { width: 100%; min-width: 0; }
.jd-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--sp-3); }
.jd-note { margin: 0; font-size: var(--text-xs); color: var(--muted-foreground); line-height: 1.4; }
.jd-kept { color: var(--foreground); }
.jd-pair-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.jd-check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); min-height: 24px; cursor: pointer; }
.jd-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.sec-preview { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); background: var(--secondary-soft, var(--secondary)); font-size: var(--text-sm); color: var(--foreground); }
.dv-fixed { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.dv-fixed .form-field, .dv-form .form-field { display: flex; flex-direction: column; gap: 6px; }
.dv-own { display: flex; flex-direction: column; gap: var(--sp-2); }
.dv-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.dv-list { display: flex; flex-direction: column; max-height: 168px; overflow-y: auto; border-radius: var(--radius-sm); }
.dv-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 7px var(--sp-3); cursor: pointer; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.dv-row + .dv-row { box-shadow: 0 -1px 0 var(--border); }
.dv-row:hover { background: var(--hover-fill-row, var(--accent)); }
.dv-row.is-on { background: var(--accent); box-shadow: inset 3px 0 0 var(--ring); }
.dv-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-type { font-size: var(--text-xs); color: var(--muted-foreground); white-space: nowrap; }
.dv-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.dv-form:empty { display: none; }
.dv-actions { display: flex; justify-content: flex-end; }

/* Share a document by link (share.php, 21 Oct 2026): the guest's way in, the sign-in card's sand on the sea's navy */
.share-gate { max-width: 28rem; gap: var(--sp-4); }
.share-gate-form { display: grid; gap: var(--sp-1); }
.share-gate-form .btn { margin-top: var(--sp-2); }
.share-gate .terms-note { margin: 0; font-size: var(--text-xs); color: #4a5069; }

/* The Sharing panel (share/share-panel.js, 21 Oct 2026): picked in ~/Sites/_prototypes/pbc/share-link (option 4). Links as
   rows (rules between rows only): the name, the facts, then what it allows (a menu), Copy and the three dots; a link that is
   off greyed with Turn on. */
.share-panel .spinner { width: 12px; height: 12px; border-width: 2px; vertical-align: -2px; margin-right: 4px; }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.share-new { gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--background); }
.share-field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.share-label { font-size: var(--text-xs); color: var(--muted-foreground); }
.share-field .select-field { width: 100%; }
.share-check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); cursor: pointer; min-height: 24px; }
.share-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.share-form-acts { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.share-error { font-size: var(--text-xs); color: var(--foreground); border-left: 3px solid var(--destructive); padding-left: var(--sp-2); }
.share-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--border); border-left: 4px solid var(--destructive); border-radius: var(--radius-md); background: var(--background); font-size: var(--text-xs); }
.share-list { gap: 0; }
.share-row { display: grid; gap: var(--sp-1); padding: var(--sp-3) 0; min-width: 0; }
.share-row + .share-row { border-top: 1px solid var(--border); }
.share-row-name { font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.props-strip-btn[data-flyout="share"] + .props-strip-sep { display: none; }   /* its entry stays hidden (Share in the top bar opens it): one rule between the groups */
.share-people { font-size: var(--text-xs); color: var(--muted-foreground); }
.share-people summary { cursor: pointer; min-height: 24px; display: inline-flex; align-items: center; color: var(--foreground); }
.share-people ul { list-style: none; margin: var(--sp-1) 0 0; padding: 0; display: grid; gap: var(--sp-1); }
.share-people li { display: flex; flex-wrap: wrap; gap: 0 var(--sp-2); }
.share-people-name { color: var(--foreground); font-weight: 600; }
.share-row-warn { font-size: var(--text-xs); color: var(--foreground); border-left: 3px solid var(--warning); padding-left: var(--sp-2); }
.share-row[data-off] .share-row-name { color: var(--muted-foreground); text-decoration: line-through; }
.share-row-facts { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); font-size: var(--text-xs); color: var(--muted-foreground); }
.share-badge { display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 999px; background: var(--secondary-soft, var(--secondary)); color: var(--foreground); }
.share-here { display: inline-flex; align-items: center; gap: 5px; color: var(--foreground); }
.share-here i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.share-row-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); margin-top: var(--sp-1); }
.share-row-acts .share-access { flex: 0 1 auto; min-width: 0; }
.share-row-acts .share-access select { width: auto; }
.share-copy { gap: 4px; }
.share-copy.is-done { color: var(--foreground); }
.share-more { width: 28px; height: 28px; }
.share-foot { line-height: 1.5; }
.share-foot .btn-link { font-size: inherit; padding: 0; height: auto; min-height: 24px; display: inline-flex; align-items: center; }
.share-ask { display: grid; gap: var(--sp-2); padding: var(--sp-2); min-width: 15rem; }

/* Share is for documents: hidden on templates. .toolbar-btn's display: flex beats the hidden attribute without this */
#ed-btn-share[hidden] { display: none !important; }

/* A guest on a share link (share/guest-mode.js): no way out to PBC, what the link allows beside the name */
.pbc-guest #ed-btn-back, .pbc-guest #ed-btn-share, .pbc-guest .tools-strip [data-tool="image"] { display: none !important; }
/* a guest never sets up the template or document: header and footer zones and other designer-only chrome */
.pbc-guest [data-role="designer"] { display: none !important; }
/* text only: the words, so no tool that adds or changes an object (select and comment stay) */
.guest-text #ed-tools-strip [data-tool]:not([data-tool="select"]):not([data-tool="comment"]) { display: none !important; }
.pbc-guest .ed-entity-name { pointer-events: none; }
.guest-chip { display: inline-flex; align-items: center; gap: var(--sp-2); flex: none; max-width: 22rem; margin-left: var(--sp-2);
    padding: 2px 10px; border-radius: 999px; background: var(--secondary-soft, var(--secondary)); color: var(--foreground); font-size: var(--text-xs); white-space: nowrap; }
.guest-chip strong { font-weight: 600; }
.guest-chip-who { color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; }
.guest-view #ed-btn-save, .guest-comment #ed-btn-save, .guest-view .tools-strip [data-tool="comment"] { display: none !important; }
.guest-comment.sync-view-only #ed-tools-strip [data-tool="comment"] { pointer-events: auto; opacity: 1; }
/* A Comment link: the rails hold what they can use, Pages, Comments and History, and the cue says how to comment (share/guest-mode.js) */
.guest-comment #ed-props-strip [data-flyout]:not([data-flyout="pages"]):not([data-flyout="comments"]):not([data-flyout="history"]),
.guest-comment #ed-props-strip .props-strip-sep,
.guest-comment #ed-tools-strip [data-tool]:not([data-tool="select"]):not([data-tool="comment"]),
.guest-comment #ed-tools-strip .tools-strip-sep,
.guest-comment #ed-tool-color, .guest-comment #ed-tools-strip .fs-affects,
.guest-comment #ed-btn-undo, .guest-comment #ed-btn-redo, .guest-comment #ed-btn-quick-align { display: none !important; }
.guest-cue { flex: none; gap: var(--sp-1); margin-left: var(--sp-2); white-space: nowrap; }
.guest-cue svg { width: 14px; height: 14px; flex: none; }
.guest-cue[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
/* a narrow window: the chip gives up the name, then the cue gives up its words, keeping them for a screen reader */
@media (max-width: 47.99rem) {
    .guest-chip-who { display: none; }
    .guest-cue span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .guest-cue { width: 36px; padding: 0; justify-content: center; }
}
.pbc-guest-view .pbc-comment-input, .pbc-guest-view [data-c-reply] { display: none !important; }
.guest-text #ed-font-family-field, .guest-text #ed-size-field, .guest-text #ed-font-weight-field, .guest-text .tb-text { display: none !important; }
@media (max-width: 47.99rem) {
    .share-gate { padding: 2rem 1.5rem; }
    .share-gate .input, .share-gate .btn { min-height: 44px; }
}

/* Live collaboration: the others' pointers over the canvas (js/modules/sync/live.js). A DOM layer moved on the canvas's
   own renders, never a render of its own. The name sits on navy so it reads whatever the person's colour. */
.live-cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 4; }
.live-cursor { position: absolute; left: 0; top: 0; display: flex; align-items: flex-start; color: var(--live-c, #475569);
    transition: transform 90ms linear; will-change: transform; }
.live-cursor[hidden] { display: none; }
/* Following another person (sync/follow.js, Phil 22 Nov 2026): a frame round the canvas in their colour and a bar to stop */
.live-follow-frame { position: absolute; inset: 0; pointer-events: none; z-index: 6; box-shadow: inset 0 0 0 2px var(--live-c, #475569);
    opacity: 0; transition: opacity var(--duration-normal, 200ms) ease-out; }
.live-follow-bar { position: absolute; top: 10px; left: 50%; z-index: 7; display: flex; align-items: center; gap: 10px;
    padding: 4px 4px 4px 12px; border-radius: 9999px; background: var(--live-c, #475569); color: #fff; font-size: 13px; font-weight: 600;
    box-shadow: var(--shadow-md); opacity: 0; transform: translate(-50%, -6px);
    transition: opacity var(--duration-normal, 200ms) ease-out, transform var(--duration-normal, 200ms) ease-out; }
.live-follow-frame.is-on { opacity: 1; }
.live-follow-bar.is-on { opacity: 1; transform: translate(-50%, 0); }
.live-follow-stop { border: 0; border-radius: 9999px; padding: 3px 10px; font: inherit; font-weight: 600; cursor: pointer;
    background: rgba(255, 255, 255, 0.92); color: #1a213a; }
.live-follow-stop:hover { background: #fff; }
.live-follow-stop:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.presence-avatar.is-following { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--foreground); }
/* Spotlight (follow.js): the people button beside the avatars, pressed while everyone follows me */
.presence-spot { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-left: 6px;
    border: 1px solid var(--border); border-radius: 9999px; background: transparent; color: var(--foreground); cursor: pointer; }
.presence-spot:hover { background: var(--accent); }
.presence-spot[aria-pressed="true"] { background: var(--foreground); color: var(--background); border-color: var(--foreground); }
.presence-spot:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Edge arrows (live.js): a pointer off screen or on a page not shown, at the view's edge, pointing to it; a press follows */
.live-edge { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 4px; pointer-events: auto;
    padding: 2px 8px 2px 4px; border: 0; border-radius: 9999px; background: var(--live-c, #475569); color: #fff; font: 600 11px/16px inherit;
    font-family: inherit; cursor: pointer; box-shadow: var(--shadow-sm); white-space: nowrap; }
.live-edge svg { fill: #fff; transform: rotate(var(--edge-a, 0deg)); transition: transform var(--duration-normal, 200ms) ease-out; }
.live-edge[hidden] { display: none; }
.live-edge:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .live-follow-frame, .live-follow-bar, .live-edge svg { transition: none; } }
.live-cursor svg { flex: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.live-cursor svg path { fill: currentColor; stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; }
.live-cursor-name { margin: 13px 0 0 -2px; padding: 1px 7px 2px 6px; border-left: 3px solid currentColor; border-radius: 4px;
    background: #1a213a; color: #fff; font: 600 11px/16px var(--font-sans, Inter, sans-serif); white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
@media (prefers-reduced-motion: reduce) { .live-cursor { transition: none; } }

/* ── Overview panel (outline/outline-panel.js): the document's headings as a tree ───────────────────────────── */
.ov-panel { display: flex; flex-direction: column; gap: var(--sp-2); }
.ov-levels { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 0 var(--sp-1) var(--sp-2); }
.ov-levels-label { font-size: var(--text-xs); color: var(--muted-foreground); }
.ov-level-btn { min-width: 28px; font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.ov-level-btn[aria-pressed="true"] { background: var(--secondary-soft, var(--secondary)); color: var(--foreground); }
.ov-tree { display: flex; flex-direction: column; gap: 1px; }
.ov-row {
    --ov-indent: 14px;
    display: flex; align-items: center; gap: 2px; min-height: 28px; padding: 2px var(--sp-1) 2px calc(var(--ov-level, 0) * var(--ov-indent));
    border-radius: var(--radius-sm); color: var(--foreground); font-size: var(--text-xs); line-height: 1.35; cursor: pointer; outline: none;
}
.ov-row:hover { background: var(--hover-fill-row, var(--accent)); }
.ov-row:focus-visible { box-shadow: 0 0 0 2px var(--ring) inset; }
.ov-row.is-here { background: var(--secondary-soft, var(--secondary)); }
.ov-row[aria-level="1"] { font-weight: 600; }
.ov-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-page { flex: none; margin-left: var(--sp-1); color: var(--muted-foreground); font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 400; }
.ov-fold, .ov-fold-space { flex: none; width: 20px; height: 20px; }
.ov-fold { display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: pointer; }
.ov-fold svg { transition: transform var(--duration-fast, 120ms) var(--ease-panel, ease); }
.ov-row[aria-expanded="true"] > .ov-fold svg { transform: rotate(90deg); }
.ov-more { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted-foreground); cursor: pointer; visibility: hidden; }
.ov-row:hover > .ov-more, .ov-row:focus-within > .ov-more, .ov-row:focus > .ov-more, .ov-more[aria-expanded="true"] { visibility: visible; }
/* worked out from how the text looks, not said by a style: a quieter ink and an open ring before the words */
.ov-row.is-guess { font-weight: 400; color: var(--muted-foreground); }
.ov-row.is-guess > .ov-text::before, .ov-guess-dot { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border: 1px solid currentColor; border-radius: 50%; vertical-align: 1px; }
.ov-legend { display: block; margin: var(--sp-2) 0 0; }
.ov-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-2) var(--sp-1); }
.ov-empty-title { margin: 0; font-weight: 600; font-size: var(--text-sm); color: var(--foreground); }
.ov-link { padding: 0; border: 0; background: none; color: var(--foreground); font: inherit; text-decoration: underline; cursor: pointer; }
.ov-stale { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--foreground); font-size: var(--text-xs); line-height: 1.45; }
.ov-foot { display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-2); }
.ov-removed { margin-top: var(--sp-3); }
.ov-row-out { padding-left: var(--sp-1); color: var(--muted-foreground); cursor: default; }
.ov-row-out:hover { background: none; }
.ov-row-out .ov-link { flex: none; margin-left: var(--sp-2); }
/* a heading just gone to: a moment's soft band, on the screen only */
.ov-mark { position: absolute; z-index: 5; pointer-events: none; border-radius: 4px; background: color-mix(in srgb, var(--brand-yellow, #ffec8d) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-navy, #1a213a) 30%, transparent); animation: ov-mark-out 1.6s var(--ease-panel, ease) forwards; }
.ov-mark.is-still { animation: none; }
@media (prefers-reduced-motion: reduce) { .ov-fold svg { transition: none; } }
@keyframes ov-mark-out { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
/* the rail's quiet note: a contents page is out of date */
.props-strip-btn.has-note { position: relative; }
.props-strip-btn.has-note::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--wash-mark, currentColor); pointer-events: none; }

/* A panel's controls while they cannot act (Phil 6 Nov 2026: "I do want panel options to persist please, like indesign"; ui/panel-off.js): the one
   disabled style. In the muted colour, not faded, so what a greyed control says stays readable (4.5:1 on the panel, light and navy). The reason has
   its own keyboard stop, unseen and taking no room until it has the focus, so nothing moves. */
.dock-body [data-panel-off] :is(.num-field:has(input:disabled), .select-field:has(select:disabled), .cp-trigger:disabled, .cap-check:has(input:disabled), button:disabled, input:disabled:not(.num-field *), select:disabled:not(.select-field *)) {
    opacity: 1; color: var(--muted-foreground); cursor: not-allowed; }
.dock-body [data-panel-off] :is(input:disabled, select:disabled, .num-field-k, .num-field-u) { color: var(--muted-foreground); -webkit-text-fill-color: var(--muted-foreground); opacity: 1; }
.dock-body [data-panel-off] :disabled { cursor: not-allowed; }
.dock-body:has(> .panel-off-reason) { position: relative; }
.panel-off-reason { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.panel-off-reason:focus { top: var(--sp-1); left: var(--sp-2); right: var(--sp-2); width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; z-index: 2;
    padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,.15)); font-size: var(--text-xs); line-height: 1.45; outline: 2px solid var(--ring); outline-offset: 1px; }
/* The note that a panel is setting defaults (nothing selected): on the panel's foot, always in view, so nothing above it moves */
.dock-body > .text-defaults-note { position: sticky; bottom: calc(-1 * var(--sp-2, 8px)); margin: var(--sp-3) 0 0; padding: var(--sp-2) 0; white-space: normal; line-height: 1.4; background: var(--background); z-index: 1; }

/* ---- Template linking (round 3, Phil 7 Nov 2026) ---- */
/* a linked document's card: one accent token, the border and a hairline inside it (presence keeps its own outline) */
.library-card.is-linked { border-color: var(--template-link); box-shadow: inset 0 0 0 1px var(--template-link); }
/* Document and template previews, as Canva's "Continue designing" (Phil 27 Nov 2026): no border and no card box; the rounded light
   grey well is the card, the whole page sits inside it on a soft shadow and never touches its sides, and the name and details sit
   under it on the page. The rings (selected, someone editing, linked to its template) go round the well. Images keep their cards. */
.library-card.doc-card, .library-card.doc-card:hover { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.doc-card .library-card-thumb {
    aspect-ratio: 4 / 3; padding: 9%; align-items: center; justify-content: center; overflow: hidden;
    background: var(--muted); border-radius: var(--radius-lg);
    transition: background var(--duration-fast) var(--ease-default), box-shadow var(--duration-fast) var(--ease-default);
}
.doc-card:hover .library-card-thumb, .doc-card:focus-within .library-card-thumb { background: color-mix(in srgb, var(--muted) 90%, var(--foreground)); }
.doc-card .library-card-thumb img:not([src="pbc-favicon.svg"]) {
    width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; padding: 0;
    border-radius: 2px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 12px rgb(0 0 0 / 0.08);
}
.doc-card .library-card-thumb img.is-fit { box-shadow: none; border-radius: 0; }   /* a logo or cut-out has no paper edge */
.doc-card .library-card-body, .home-card.doc-card .library-card-body { padding: var(--sp-3) 0 0; }
.doc-card.is-selected .library-card-thumb { box-shadow: 0 0 0 2px var(--foreground); }
.doc-card.is-being-edited .library-card-thumb { box-shadow: 0 0 0 2px var(--card-editor-color); }
.doc-card.is-being-edited.is-selected .library-card-thumb { box-shadow: 0 0 0 2px var(--card-editor-color), 0 0 0 4px var(--foreground); }
.doc-card.is-linked .library-card-thumb { box-shadow: inset 0 0 0 2px var(--template-link); }
.home-card.doc-card:focus-visible { outline: none; }
.home-card.doc-card:focus-visible .library-card-thumb { outline: 2px solid var(--ring); outline-offset: 2px; }
/* the hold: a modal <dialog> over everything until the update is brought in */
dialog.tpl-hold { border: 0; padding: 0; margin: auto; background: transparent; max-width: min(30rem, calc(100vw - 32px)); }
dialog.tpl-hold::backdrop { background: color-mix(in srgb, var(--background) 72%, transparent); backdrop-filter: blur(6px); }
.tpl-hold-card { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); padding: var(--sp-6); }
.tpl-hold-sub { margin: var(--sp-3) 0 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.tpl-hold-foot { display: flex; justify-content: flex-end; margin-top: var(--sp-5); }
/* Update linked documents: the list, all ticked */
.tpl-push-what { margin: 0 0 var(--sp-3); font-size: var(--text-sm); color: var(--muted-foreground); }
.tpl-push-list { max-height: 16rem; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-1) var(--sp-2); }
.tpl-push-row { display: flex; align-items: center; gap: var(--sp-2); min-height: 32px; font-size: var(--text-sm); }
.tpl-push-row .text-muted { margin-left: auto; font-size: var(--text-xs); }
.tpl-push-all { font-weight: 600; margin-bottom: var(--sp-1); }
.tpl-push-private { margin: var(--sp-2) 0 0; font-size: var(--text-xs); }


/* The tour films' player (js/modules/tour-player.js, Phil 8 Nov 2026): a modal dialog, the film 16:9 with its own controls and
   captions, the films as tabs, the end card's two choices over the last frame, the transcript under it. */
dialog.tour-dlg { border: 0; padding: 0; margin: auto; background: transparent; width: min(68rem, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); }
dialog.tour-dlg::backdrop { background: color-mix(in srgb, var(--background) 72%, transparent); backdrop-filter: blur(6px); }
.tour-card { background: var(--card); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); padding: var(--sp-4) var(--sp-5) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); max-height: calc(100vh - 32px); overflow: auto; }
.tour-hd { display: flex; align-items: center; gap: var(--sp-4); }
.tour-hd .dialog-title { margin: 0; flex: 1 1 auto; min-width: 0; }
.tour-hd .dialog-close { position: static; }
.tour-tabs { display: flex; gap: var(--sp-1); background: var(--muted); border-radius: var(--radius-md); padding: 3px; }
.tour-tab { border: 0; background: transparent; color: var(--muted-foreground); font: 600 var(--text-xs)/1 var(--font-sans); padding: 8px 12px; border-radius: calc(var(--radius-md) - 3px); cursor: pointer; }
.tour-tab[aria-selected="true"] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-xs); }
.tour-tab:focus-visible, .tour-choice:focus-visible, .tour-play:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.tour-stage { position: relative; flex: none; aspect-ratio: 16 / 9; background: var(--muted); border-radius: var(--radius-md); overflow: hidden; }
.tour-stage > .dialog-description, .tour-stage > .form-error { padding: var(--sp-6); }
.tour-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #e0dfdb; }
.tour-video::cue { font: 500 1.05rem/1.35 var(--font-sans); background: rgba(26, 33, 58, .88); color: #fff; }
.tour-play { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; display: inline-flex; align-items: center; gap: var(--sp-2);
    border: 0; border-radius: var(--radius-full); padding: 14px 26px 14px 20px; background: var(--primary); color: var(--primary-foreground, #fff); font: 600 var(--text-base)/1 var(--font-sans); cursor: pointer; box-shadow: var(--shadow-lg); }
.tour-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-5);
    background: color-mix(in srgb, var(--background) 86%, transparent); backdrop-filter: blur(4px); padding: var(--sp-6); }
.tour-end-title { margin: 0; font: 600 var(--text-2xl)/1.2 var(--font-sans); }
.tour-end-choices { display: flex; gap: var(--sp-4); flex-wrap: wrap; justify-content: center; }
.tour-choice { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); width: 16rem; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--card); color: var(--foreground); padding: var(--sp-4) var(--sp-5); cursor: pointer; box-shadow: var(--shadow-sm); font-family: var(--font-sans); }
.tour-choice b { font-size: var(--text-lg); font-weight: 600; }
.tour-choice span { font-size: var(--text-sm); color: var(--muted-foreground); }
.tour-choice:hover { border-color: var(--foreground); }
.tour-ft { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.tour-info { margin: 0; font-size: var(--text-sm); color: var(--muted-foreground); }
.tour-transcript { border-top: 1px solid var(--border); padding-top: var(--sp-3); font-size: var(--text-sm); }
.tour-transcript section + section { margin-top: var(--sp-3); }
.tour-transcript h4 { margin: 0 0 var(--sp-1); font-size: var(--text-sm); font-weight: 600; }
.tour-transcript h4 span { color: var(--muted-foreground); font-weight: 400; margin-left: var(--sp-2); }
.tour-transcript p { margin: 0 0 var(--sp-1); }
.tour-transcript .tour-cap { color: var(--muted-foreground); }
@media (max-width: 47.99rem) { .tour-hd { flex-wrap: wrap; } .tour-tabs { order: 3; width: 100%; } .tour-choice { width: 100%; } .tour-end { overflow: auto; justify-content: flex-start; } }
