/* ============================================================
   RowScribe – Global Stylesheet (Mobile Responsive)
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────────
   Inter — UI font (sidebar, body, forms, modals, etc.). Standard for SaaS tooling.
   Syne remains loaded as a one-click typeface option in the PDF editor.
   JetBrains Mono is the code font and a PDF picker option.

   Self-hosted from ../lib/fonts/ui instead of @import'ing Google Fonts. The import
   handed every visitor's IP address to Google before anything on the page had
   been consented to, and it blocked first paint on a third-party round trip.
   Files are the latin subset from Fontsource; all three families are OFL, and the
   licences are recorded in THIRD-PARTY-NOTICES.md.

   font-display: swap keeps the old behaviour — text paints in the fallback face
   immediately rather than waiting on the font, so a slow load never blanks the
   splash. Adding a weight here means adding the matching .woff2 to lib/fonts/ui. */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../lib/fonts/ui/inter-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../lib/fonts/ui/inter-latin-500-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../lib/fonts/ui/inter-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../lib/fonts/ui/inter-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../lib/fonts/ui/inter-latin-800-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../lib/fonts/ui/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../lib/fonts/ui/jetbrains-mono-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Syne';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../lib/fonts/ui/syne-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Syne';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../lib/fonts/ui/syne-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Syne';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../lib/fonts/ui/syne-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Syne';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../lib/fonts/ui/syne-latin-800-normal.woff2') format('woff2');
}

/* ── PDF document fonts ────────────────────────────────────────
   The PDF picker's fonts (PdfFonts.Families) are declared by the PdfFontStyles
   component, generated from the same registry the renderer embeds from, so the
   editor canvas always draws with the files the PDF prints in. Only Syne and
   JetBrains Mono are declared here, as the app's own UI faces. */

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

html, body {
    height: 100%;
    background: #f0f0f0;
    color: #1a1a2e;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #4A6B2E;
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

code, pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

/* ── App Shell ─────────────────────────────────────────────── */

/* The non-Production EnvironmentBanner takes ~30px of vertical space at the
   top of the document. .app-shell uses height: 100vh so without compensation
   the shell overflows the viewport by exactly that amount, hiding the
   sidebar footer (Sign out button) below the fold. The custom property
   defaults to 0; when the banner is in the DOM we bump it via :has(). */
:root {
    --env-banner-height: 0px;
}

body:has(.env-banner) {
    --env-banner-height: 30px;
}

.app-shell {
    display: flex;
    height: calc(100vh - var(--env-banner-height));
    overflow: hidden;
}

/* ── Impersonation Banner ──────────────────────────────────── */
/* Sticky inside its scroll container (`.main-content`) so it stays pinned
   while the user scrolls within a page. Editor pages bump the
   `--impersonation-banner-height` custom property below so their sticky
   topbar can offset itself by the banner height and the two stack instead
   of overlapping. */
.impersonation-banner {
    position: sticky;
    top: 0;
    z-index: 60;
    background: #f59e0b;
    color: #1a1a2e;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

/* When the impersonation banner is rendered, expose its height as a custom
   property so sticky elements lower in the page (editor topbars, side
   drawers) can offset themselves and avoid overlapping the banner. */
:root { --impersonation-banner-height: 0px; }
.main-content:has(> .impersonation-banner) { --impersonation-banner-height: 36px; }

.impersonation-end-btn {
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

    .impersonation-end-btn:hover {
        background: #333;
    }

/* ── System Message Banners ────────────────────────────────── */
.system-banner {
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.system-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.system-banner-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

    .system-banner-text p { display: inline; margin: 0; }
    .system-banner-text ul,
    .system-banner-text ol { margin: 0; padding-left: 18px; }
    .system-banner-text a { color: inherit; text-decoration: underline; }

.system-banner-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    opacity: 0.7;
    color: inherit;
}

    .system-banner-close:hover { opacity: 1; }

.system-banner-info {
    background: #eff6ff;
    color: #1e40af;
    border-bottom: 1px solid #bfdbfe;
}

.system-banner-warning {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
}

.system-banner-maintenance {
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fecaca;
}

/* ── App Splash ────────────────────────────────────────────────
   Full-screen loading state used during the initial WASM boot
   (index.html), the MainLayout pre-init phase, and any transition
   driven by UiTransitionService.ShowSplash(). All three render the
   same RowScribe logo + spinner so the user sees one consistent
   loading visual instead of jumping between text/logo/text.
   ─────────────────────────────────────────────────────────────── */
.app-splash {
    /* Pin to the visible viewport instead of relying on min-height:100vh —
       100vh on mobile includes the area under the URL bar, which would push
       the spinner above true visible center. position:fixed also removes
       the splash from document flow so any parent padding/margin can't
       offset the centerline.

       top:0 (full viewport) so the boot splash centers on the TRUE viewport
       center on every screen. It's a z-index:9999 overlay that paints over
       the staging env-banner anyway, so there's no need to start below it.
       A previous version offset by --env-banner-height to clear the banner,
       but that shifted the centerline ~15px down on desktop ("a little
       pushed down"); mobile was unaffected since --env-banner-height is 0 at
       ≤768px (env-banner is display:none). Centering on the full viewport
       fixes desktop and leaves mobile byte-for-byte identical. */
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: #f0f0f0;
    font-family: 'Inter', sans-serif;
    z-index: 9999;
}

.app-splash-logo {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Reset for the <a> wrapper inside <RowScribeLogo /> — inherits the parent's
   font sizing/weight and stays visually identical to the old <span>-only
   markup, while making the wordmark a real link so middle-click / cmd-click
   open in a new tab as the user expects. */
.rowscribe-logo-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    display: inline;
}

    .rowscribe-logo-link:hover {
        text-decoration: none;
    }

    .rowscribe-logo-link:focus-visible {
        outline: 2px solid #4A6B2E;
        outline-offset: 2px;
        border-radius: 2px;
    }

/* Stays an in-flow flex child so the logo + spinner centre as ONE group on the
   viewport centreline — that pairing is the intended visual, not the wordmark
   centred alone. A previous attempt pulled the spinner out of flow with
   position:absolute to centre the wordmark itself; that pushed the spinner
   further down and made the whole splash read as sitting low. Keep it in flow. */
.app-splash-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(74, 107, 46,0.2);
    border-top-color: #4A6B2E;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Maintenance Page ──────────────────────────────────────── */
.maintenance-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    padding: 24px;
}

.maintenance-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 48px 40px;
    max-width: 560px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.maintenance-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.maintenance-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 16px;
}

.maintenance-body {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 24px;
}

    .maintenance-body p { margin: 0 0 8px; }
    .maintenance-body a { color: #4A6B2E; text-decoration: underline; }

.maintenance-eta {
    font-size: 13px;
    color: #6b6b6b;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 24px;
}

.maintenance-logout {
    margin-bottom: 20px;
}

.maintenance-footer {
    font-size: 18px;
    font-weight: 800;
    color: #6b6b6b;
    margin-top: 8px;
}

@media (max-width: 480px) {
    .maintenance-card {
        padding: 32px 24px;
    }
}

/* ── Mobile Top Bar (hidden on desktop) ────────────────────── */
.mobile-topbar {
    display: none;
    position: fixed;
    /* Clear the EnvironmentBanner on non-Production envs so the warning
       stays visible above the topbar instead of being overlaid by it. */
    top: var(--env-banner-height);
    left: 0;
    right: 0;
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 200;
}

.mobile-menu-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #1a1a2e;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

    .mobile-menu-btn:hover,
    .mobile-menu-btn:focus-visible {
        background: #f0f0f0;
        border-color: #e0e0e0;
        color: #1a1a2e;
        outline: none;
    }

    .mobile-menu-btn:active {
        background: #e8e8e8;
    }

    .mobile-menu-btn svg {
        width: 22px;
        height: 22px;
        display: block;
    }

.mobile-topbar-logo {
    font-size: 18px;
    font-weight: 800;
}

/* ── Sidebar Overlay ───────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 150;
}

    @media (max-width: 768px) {
        .sidebar-overlay.open {
            display: block;
        }
    }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    transition: transform 0.25s ease;
    z-index: 160;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Wordmark. The one fixed device in the identity: the root sits in ink and
   the "Scribe" tail carries the brand green, at every size and in every
   lockup. Kept flat on purpose — the mark beside it does the visual work,
   so a gradient here would compete with it. */
.logo-row {
    color: #1a1a2e;
}

.logo-scribe {
    color: #4A6B2E;
}

/* Generate mark, opt-in via <RowScribeLogo ShowMark="true" />. Sized in em
   so it tracks whatever font-size the parent lockup sets rather than needing a
   variant per placement. The viewBox is the ink's exact bbox (67x44), so this IS
   the mark's optical height, not a box it floats inside: 1.1em against Inter's
   0.727em cap height — the mark overshoots the cap line and drops below the
   baseline, which is what gives the lockup its weight. The nudge sets how far
   below the baseline it drops; the 0.34em margin is the reference gap. */
.rowscribe-logo-mark {
    height: 1.1em;
    width: auto;
    vertical-align: -0.11em;
    margin-right: 0.34em;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #6b6b6b;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px 9px 9px;
    border-radius: 4px;
    color: #555;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    min-height: 44px;
}

    .nav-item:hover {
        background: #f8f8f8;
        color: #1a1a2e;
        text-decoration: none;
    }

    /* Active state uses the app's primary blue (matches buttons, links, focus
       rings, and the rest of the accent surface — see #4A6B2E usage across the
       app). Earlier attempt used the purple from CLAUDE.md's "design system"
       comment, but the codebase reality is blue. The font-weight bump + slightly
       deeper background keeps it visible at a glance without competing with the
       primary action button. */
    .nav-item.active {
        background: #E5EDD8;
        color: #4A6B2E;
        border-left-color: #4A6B2E;
        font-weight: 700;
    }
    .nav-item.active:hover {
        background: #D8E4C6;
        color: #4A6B2E;
    }

/* Holds an inline 18px Lucide SVG (see Shared/Icons/NavIcons.cs), not a glyph —
   so this is a flex box that centres its child rather than a text cell.
   font-size / text-align would do nothing here.

   The SVG is stroked with currentColor, so it inherits .nav-item's colour and
   picks up the hover and .active states for free. Don't give .nav-icon its own
   colour or the active state stops tracking. */
.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
}

.nav-item-logout {
    color: #6b6b6b;
}

    .nav-item-logout:hover {
        color: #B33C32;
        background: rgba(240,85,96,0.08);
    }

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: #f0f0f0;

    /* Column flex so .app-footer can claim the leftover space with `margin-top: auto`
       and sit at the bottom of the viewport on short pages (an empty admin list, a
       one-card settings page) instead of floating halfway up under the content. */
    display: flex;
    flex-direction: column;
}

/* Flex items shrink by default, which in a scrolling column container compresses tall
   page content instead of letting it overflow — the page would get shorter rather than
   scrollable. Pinning every direct child at its natural height restores normal scroll
   behaviour, and leaves `margin-top: auto` on the footer as the only thing consuming
   free space. */
.main-content > * {
    flex-shrink: 0;
}

/* ── Skip Link ─────────────────────────────────────────────── */

/* Off-screen until focused rather than display:none, because a hidden element is not
   focusable and the link would never be reachable. First tab stop on every page. */
.skip-link {
    position: fixed;
    top: -60px;
    left: 12px;
    z-index: 2000;
    padding: 10px 18px;
    background: #4A6B2E;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0;
    outline: 2px solid #1a1a2e;
    outline-offset: 2px;
}

/* ── Focus Visibility ──────────────────────────────────────── */

/* A global, consistent focus ring. Several components set `outline: none` and replace it
   with a border-colour change that measures ~1.3:1 — invisible in practice. :focus-visible
   only fires for keyboard interaction, so this never puts a ring on a mouse click. */
:focus-visible {
    outline: 2px solid #4A6B2E;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Programmatic focus targets — the skip-link destination and the page heading focused
   after navigation. These are focused by script, never by keyboard, so a ring on them is
   noise rather than a signal. Keyboard focus rings above are untouched. This is what makes
   post-navigation focus management viable at all: <FocusOnNavigate> was removed from
   App.razor precisely because it drew a ring around every page title. */
[tabindex="-1"]:focus {
    outline: none;
}

/* ── App Footer ────────────────────────────────────────────── */

/* Quiet legal strip under the page body. Scrolls with the content rather than
   sticking, so it never competes with the page's own actions. */
.app-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    padding: 16px 24px 24px;
    font-size: 12px;
    color: #6b6b6b;

    /* Absorbs the leftover height of .main-content, so on a short page the footer lands
       at the bottom of the viewport rather than immediately under the content. When the
       page is tall enough to scroll there is no leftover height, so this resolves to 0
       and the footer simply follows the content as before. */
    margin-top: auto;
}

.app-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.app-footer a {
    color: #6b6b6b;
    text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus-visible {
    color: #4A6B2E;
    text-decoration: underline;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.5px;
}

.page-sub {
    color: #6b6b6b;
    margin-top: 4px;
    font-size: 14px;
}

.page-narrow {
    max-width: 720px;
    margin: 0 auto;
}

/* ── Page tabs ──────────── */
/* The tab bar under a settings page's header (Account, Workspace settings, Developers). One set
   of rules so the pages look and behave alike; the URL's ?tab= picks the tab on each. */
.page-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.page-tabs::-webkit-scrollbar {
    display: none;
}

.page-tab {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.page-tab:hover {
    color: #1a1a2e;
}

.page-tab.active {
    color: #4A6B2E;
    border-bottom-color: #4A6B2E;
}

.page-content {
    padding: 16px;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Default layout for the action button group on every list-page row and the
   bulk-action toolbar above admin tables. Originally only set flex-wrap +
   align-items here and relied on every per-page .razor.css to declare
   `display: flex; gap: 6px;` themselves. That worked until a page (Quartz,
   Datasets, RecipientLists, Schedules, Jobs, Workspace) was added without a
   scoped CSS file at all — then the row buttons fell back to inline-block
   with zero gap and rendered touching edge-to-edge. Setting the full default
   here fixes every such page in one shot. Pages that want a custom gap (e.g.
   Schedules' 8px) override in their scoped CSS, which still wins via the
   higher-specificity `[b-xxxxxx]` attribute selector Blazor adds. */
.table-actions,
.bulk-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* …except on the <td> itself. display:flex takes a cell out of table layout: the browser
   wraps it in an anonymous cell that ignores vertical-align: middle, so wherever the row is
   taller than one line (a name with a description under it, which the mobile max-content
   tables make the norm) the buttons sat at the top while every other column was centred.
   The cell stays a cell; its buttons are inline-flex already and get the gap as margins. */
td.table-actions {
    display: table-cell;
    vertical-align: middle;
}

    td.table-actions > * {
        vertical-align: middle;
        margin-top: 3px;
        margin-bottom: 3px;
    }

    /* The gap trails each button rather than leading it: a button that wraps to a second line
       (Delete, on a schedule's five actions) then starts flush with the first instead of 6px in. */
    td.table-actions > * {
        margin-right: 6px;
    }

    td.table-actions > *:last-child {
        margin-right: 0;
    }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
}

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

.btn-primary {
    background: #4A6B2E;
    color: #fff;
    border-color: #4A6B2E;
}

    .btn-primary:hover:not(:disabled) {
        background: #3B5525;
        border-color: #3B5525;
        text-decoration: none;
    }

.btn-ghost {
    background: transparent;
    color: #555;
    border-color: transparent;
}

    .btn-ghost:hover:not(:disabled) {
        background: #f8f8f8;
        color: #1a1a2e;
        text-decoration: none;
    }

.btn-outline {
    background: #fff;
    color: #555;
    border: 1px solid #d1d1d1;
}

    .btn-outline:hover:not(:disabled) {
        background: #f8f8f8;
        color: #1a1a2e;
        border-color: #b0b0b0;
    }

.btn-outline.text-danger {
    color: #B33C32;
    border-color: #B33C3240;
}

    .btn-outline.text-danger:hover:not(:disabled) {
        background: rgba(240,85,96,0.08);
        border-color: #B33C32;
    }

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
    min-height: 36px;
}

.btn-full {
    width: 100%;
}

.btn-danger, .text-danger {
    color: #B33C32;
}

.btn-ghost.text-danger:hover {
    background: rgba(240,85,96,0.08);
}

.ml-2 {
    margin-left: 8px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

    /* Field captions in ink, as written. Grey small capitals over a grey field
       left caption, hint, placeholder and value all one tone, and hard to tell
       apart. The caption names the field; it's what the eye looks for first. */
    .form-group label, .form-label {
        font-size: 13px;
        font-weight: 600;
        color: #1a1a2e;
    }

    /* Trailing qualifier on a label — "(optional)", "(leave blank to keep saved
       value)". Quieter weight and colour than the label it hangs off, so an
       unmarked field doesn't read as ambiguously required. */
    .form-label-optional {
        font-weight: 400;
        color: #6b6b6b;
        margin-left: 4px;
    }

.form-control {
    box-sizing: border-box; /* keep padding inside width:100% so inputs
                                don't overflow narrow modal columns */
    /* White with a firm edge, so the field reads as a box to type in. A grey fill on
       a white card blended into the card and the disabled state. */
    background: #ffffff;
    border: 1px solid #c4c4c4;
    border-radius: 4px;
    color: #1a1a2e;
    font-family: 'Inter', sans-serif;
    font-size: 16px; /* prevents iOS auto-zoom */
    padding: 9px 12px;
    width: 100%;
    transition: border-color 0.15s;
    outline: none;
    min-height: 44px;
}

    .form-control:focus {
        border-color: #4A6B2E;
    }

    /* Upright and grey, as in most apps: the lighter tone alone marks an example */
    .form-control::placeholder {
        color: #6b6b6b;
    }

    .form-control:disabled,
    .form-control-sm:disabled {
        background: #f0f0f0;
        color: #6b6b6b;
        cursor: not-allowed;
    }

.form-control-sm {
    padding: 6px 10px;
    font-size: 14px;
    min-height: 36px;
}

/* Brand the native controls. Without accent-color every checkbox and radio in
   the app paints in the browser's own blue — the one colour that isn't in the
   palette, so it reads as a foreign widget dropped into the form. */
input[type="checkbox"],
input[type="radio"] {
    accent-color: #4A6B2E;
}

/* Checkbox / radio rows. `.form-group label` uppercases and tracks out every
   label, which is right for a field caption ("RUN AT") and wrong for a sentence
   the user is toggling — "SCHEDULE THIS JOB TO RUN LATER" shouts, and sets the
   toggle in a smaller, wider face than the body copy explaining it. This resets
   casing, tracking and size back to body copy so the row reads as one line of
   text with a control in front of it. */
/* ".form-group .form-check" too: inside a form group, ".form-group label" is the more
   specific rule and put every tick-box label back in small capitals. */
.form-check,
.form-group .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a2e;
    text-transform: none;
    letter-spacing: normal;
}

    /* For a checkbox sharing a grid row with a .form-control — matches the
       input's 44px so the two sit on the same baseline instead of the label
       hanging at the bottom edge of the field beside it. */
    .form-check-aligned {
        min-height: 44px;
    }

    /* When the label carries its own description underneath, the box belongs on
       the first line rather than centred against a two-line block. Doubled class so
       it outranks ".form-group .form-check" above and the "margin: 0" on the box
       below, which otherwise put the box back in the middle. */
    .form-check.form-check-top {
        align-items: flex-start;
    }

        .form-check.form-check-top input[type="checkbox"],
        .form-check.form-check-top input[type="radio"] {
            margin-top: 3px;
        }

    .form-check input[type="checkbox"],
    .form-check input[type="radio"] {
        width: 16px;
        height: 16px;
        margin: 0;
        flex: 0 0 auto;
        cursor: pointer;
    }

/* Helper line under a control. One size and one spacing everywhere, instead of
   a per-call-site margin-top that lands on 2px here and 4px there — .form-group
   is a 6px-gap flex column, so the spacing comes from the parent. Following a
   .form-check it indents past the box so the explanation hangs under the label
   rather than under the checkbox. */
.form-hint {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #555;
}

    .form-check + .form-hint {
        padding-left: 24px;
    }

    /* A note under a card grid (the editors' "Email jobs are available on Starter" line) sits in
       a step with no gap of its own, so it needs its own space or it touches the cards. */
    .delivery-cards + .form-hint {
        margin-top: 10px;
    }

/* Native date / time pickers. iOS Safari gives them an intrinsic minimum width that
   ignores width:100% (so they ran past the right edge of narrow forms, the schedule
   editor's Date / Time / Starts on / Ends on most visibly), centres the value, and
   collapses an empty one's value line. Left-aligned and shrinkable. Native appearance is
   kept: appearance:none hides the calendar button in desktop Firefox. */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
    display: block;
    min-width: 0;
    max-width: 100%;
    text-align: left;
}

    input.form-control::-webkit-date-and-time-value {
        text-align: left;
        min-height: 1.5em;
    }

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    font-size: 14px;
}

/* Unified <select> styling so dropdowns render the same chevron everywhere
   regardless of OS/browser. The native chevron is hidden via -webkit-appearance
   and replaced with an inline SVG so it lines up with the .form-control
   padding. .form-control-sm and .filter-input get smaller chevron padding. */
select.form-control,
select.form-control-sm,
select.filter-input {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

    select.form-control-sm,
    select.filter-input {
        background-position: right 10px center;
        padding-right: 28px;
    }

/* ── Filter bar ────────────────────────────────────────────
   Wraps the row of filter inputs above admin tables. Pages no longer need
   their own copy — earlier this was duplicated across every list page. */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
}

/* ── Filter input ──────────────────────────────────────────
   Compact input variant used across admin filter bars (Workspaces, Users,
   Jobs, Schedules, etc.). 36px tall to match .btn-sm so a filter row of
   inputs / selects / buttons lines up without intrinsic-height drift —
   `<input>` and `<select>` render at slightly different heights without an
   explicit min-height set. Lives in global CSS so all admin pages share
   one definition. */
.filter-input {
    box-sizing: border-box;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #1a1a2e;
    min-width: 140px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    line-height: 1.2;
}

    .filter-input:focus {
        border-color: #4A6B2E;
        box-shadow: 0 0 0 2px rgba(74, 107, 46, 0.12);
    }

    .filter-input::placeholder { color: #6b6b6b; }

.filter-search { min-width: 240px; }

/* Labelled wrapper for filter date inputs.
   iOS Safari hides any placeholder/format hint inside an empty <input type="date">,
   which made the From/To filters render as empty boxes on mobile. The label
   makes the purpose explicit on every viewport. */
.filter-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    color: #555;
    font-weight: 600;
}

.filter-date-label {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.filter-input-date {
    border: none;
    padding: 0;
    height: auto;
    min-width: 110px;
    background: transparent;
    font-size: 13px;
    font-weight: 400;
    color: #1a1a2e;
}

    .filter-input-date:focus {
        box-shadow: none;
    }

.code-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.card-section {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

    .card-section:last-child {
        border-bottom: none;
    }

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
}

.section-heading {
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    /* A pill is one line. Wrapped, a longer label ("Waiting for approval" in a narrow table
       column) turned into a rounded blob; the column widens to fit it instead. */
    white-space: nowrap;
}

.badge-pdf {
    background: rgba(79,158,255,0.15);
    color: #4A6B2E;
}

.badge-email {
    background: rgba(13,148,136,0.15);
    color: #0f6f66;
}

.badge-plan {
    background: #E5EDD8;
    color: #555;
}

.badge-owner {
    background: rgba(240,192,64,0.15);
    color: #8a5d00;
}

.badge-active {
    background: rgba(40,200,64,0.15);
    color: #157a30;
}

.badge-invited {
    background: rgba(74, 107, 46,0.15);
    color: #4A6B2E;
}

.badge-editor {
    background: rgba(56,152,236,0.15);
    color: #1a6aa8;
}

.badge-viewer {
    background: rgba(136,136,136,0.15);
    color: #666;
}

.row-muted {
    opacity: 0.7;
}

.confirm-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-sm {
    font-size: 10px;
    padding: 2px 6px;
}

/* ── Selection Cards ───────────────────────────────────────────
   Reusable click-to-select cards used by JobEditor and ScheduleEditor
   for delivery method and template picking. Replaces the old
   <select class="form-control"> dropdowns with a radio-card grid that
   shows all options at a glance. Each variant (delivery, template)
   uses the same selected/hover/focus treatment. */

.delivery-cards {
    display: grid;
    /* min(…, 100%) so a phone narrower than the minimum gets one full-width column
       instead of a card running past the panel's edge. */
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 10px;
}

.delivery-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color .12s, background .12s, box-shadow .12s;
    font-family: inherit;
    color: inherit;
}

    .delivery-card:hover {
        border-color: #b8c5d6;
        background: #fafcfe;
    }

    .delivery-card:focus-visible {
        outline: none;
        border-color: #4A6B2E;
        box-shadow: 0 0 0 3px rgba(74, 107, 46,0.15);
    }

    .delivery-card.selected {
        border-color: #4A6B2E;
        background: #E5EDD8;
        box-shadow: 0 0 0 1px #4A6B2E;
    }

.delivery-card-icon {
    width: 22px;
    height: 22px;
    color: #4A6B2E;
    margin-bottom: 2px;
}

.delivery-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.25;
}

.delivery-card-sub {
    font-size: 12px;
    color: #6b6b6b;
    line-height: 1.35;
}

/* ── Locked delivery method (tier-gated) ─────────────────────
   Shown, not hidden: a Free user needs to see that email delivery exists and
   which plan unlocks it. Dimmed rather than disabled so the card keeps its
   keyboard focus ring and a screen reader still reaches the badge — the button
   carries aria-disabled and SetDelivery refuses the selection. */
.delivery-card.locked {
    cursor: not-allowed;
    background: #fafafa;
    border-style: dashed;
}

    .delivery-card.locked:hover {
        border-color: #e0e0e0;
        background: #fafafa;
    }

    .delivery-card.locked .delivery-card-icon,
    .delivery-card.locked .delivery-card-title,
    .delivery-card.locked .delivery-card-sub {
        opacity: .55;
    }

.delivery-card-lock {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    color: #3B5525;
    background: #E5EDD8;
    border-radius: 4px;
    padding: 3px 8px;
}

@media (max-width: 480px) {
    .delivery-cards {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Template-PICKER cards — horizontal layout (icon left, name+meta right)
   used inside JobEditor / ScheduleEditor. Class names use the `tpl-pick-*`
   prefix to avoid colliding with the older `.template-card` grid card on
   the /templates page (defined further down in this file). */
.tpl-pick-grid {
    display: grid;
    /* min(240px, 100%): on a narrow phone the panel is under 240px wide, and a fixed
       240px minimum pushed the cards past its right edge. */
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 1px; /* keeps focus rings/borders from being clipped on edges */
}

.tpl-pick-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color .12s, background .12s, box-shadow .12s;
    font-family: inherit;
    color: inherit;
    min-width: 0;
    width: 100%;
}

    .tpl-pick-card:hover {
        border-color: #b8c5d6;
        background: #fafcfe;
    }

    .tpl-pick-card:focus-visible {
        outline: none;
        border-color: #4A6B2E;
        box-shadow: 0 0 0 3px rgba(74, 107, 46,0.15);
    }

    .tpl-pick-card.selected {
        border-color: #4A6B2E;
        background: #E5EDD8;
        box-shadow: 0 0 0 1px #4A6B2E;
    }

.tpl-pick-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #E5EDD8;
    color: #4A6B2E;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .tpl-pick-icon.email {
        background: rgba(13,148,136,0.12);
        color: #0d9488;
    }

    .tpl-pick-icon svg {
        width: 18px;
        height: 18px;
    }

.tpl-pick-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tpl-pick-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tpl-pick-desc {
    font-size: 12px;
    color: #6b6b6b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tpl-pick-meta {
    font-size: 11px;
    color: #6b6b6b;
    margin-top: 4px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tpl-pick-badge {
    background: rgba(74, 107, 46,0.12);
    color: #3B5525;
    padding: 1px 6px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 600;
}

.tpl-pick-empty {
    background: #fafafa;
    border: 1px dashed #e0e0e0;
    border-radius: 8px;
    padding: 24px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

    .tpl-pick-empty p {
        font-size: 13px;
        color: #6b6b6b;
        margin: 0;
    }

/* ── Recipients Card ─────────────────────────────────────────
   Groups To + CC + Subject (+ Message) as a small card so the delivery section
   reads as "where does this email go" rather than loose inputs sharing the page
   with the rest of the form: "One email per row", "Where to send the ZIP" and
   "Where to send the documents". Here rather than in a scoped .razor.css because
   JobEditor and ScheduleEditor both use it. */
.recipients-card {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.recipients-card-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e8e8;
}
/* Same level in the hierarchy as a .form-details summary — a heading for a
   block nested inside a .form-step — so it takes the same 14px/600 rather than
   a bolder-but-smaller 13px/700, which reads as a third heading rank that
   doesn't exist. */
.recipients-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}
.recipients-card-hint {
    font-size: 12px;
    color: #6b6b6b;
    line-height: 1.5;
}
.recipients-card .form-group:last-child {
    margin-bottom: 0;
}

/* ── Status Badges ─────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pending {
    background: rgba(240,192,64,0.15);
    color: #8a5d00;
}

.status-processing {
    background: rgba(79,158,255,0.12);
    color: #4A6B2E;
}

.status-completed {
    background: rgba(61,214,140,0.12);
    color: #157a30;
}

/* "Completed with errors" — Completed status with at least one row in
   JobRowFailures. Amber/warning palette so it stands out from the green clean-
   completion badge but still reads as "the job ran" rather than "the job blew up". */
.status-completedwitherrors {
    background: rgba(240,192,64,0.14);
    color: #7a4f00;
}

.status-failed {
    background: rgba(240,85,96,0.10);
    color: #B33C32;
}

.status-cancelled {
    background: rgba(122,132,153,0.10);
    color: #6b6b6b;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

    .data-table th {
        padding: 10px 14px;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        color: #6b6b6b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 1px solid #e0e0e0;
        background: #f8f8f8;
        white-space: nowrap;
    }

    .data-table td {
        padding: 12px 14px;
        color: #1a1a2e;
        vertical-align: middle;
    }

    /* Row separator lives on the <tr>, not each <td>. The actions column is a
       flex container (`.table-actions`), which strips its table-cell stretching
       so a per-cell border-bottom would sit higher than the other cells in the
       row. A border on the row spans the full width at the row's bottom edge,
       so every column's bottom border lines up. */
    .data-table tbody tr {
        border-bottom: 1px solid #e0e0e0;
    }

    .data-table tbody tr:last-child {
        border-bottom: none;
    }

.table-row {
    transition: background 0.15s;
}

.table-row-clickable {
    cursor: pointer;
}

    .table-row:hover {
        background: #f8f8f8;
    }

/* ── Job progress cell (inline mini progress bar in table) ── */
.job-progress-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.job-progress-track {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.job-progress-fill {
    height: 100%;
    background: #4A6B2E;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Chip on the Jobs list marking jobs that came from a recurring schedule */
.scheduled-source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 8px;
    background: #E5EDD8;
    color: #4A6B2E;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    vertical-align: middle;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Block, so the icon centres in the flex row instead of sitting on a text baseline. */
.scheduled-source-link svg {
    display: block;
    flex-shrink: 0;
}

.scheduled-source-link:hover {
    background: #4A6B2E;
    color: #ffffff;
}

/* Compact chips that show "what was selected" on the Jobs list — merged PDF, flatten,
   password. Stacks under the Delivery cell so the user can spot at a glance which
   options were applied without opening the job detail. Wraps on narrow screens. */
.job-export-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.job-export-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    background: #E5EDD8;
    color: #5b4fe5;
    border: 1px solid #d8d0ff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

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

.text-muted {
    color: #6b6b6b;
}

.text-sm {
    font-size: 12px;
}

.ml-auto {
    margin-left: auto;
}

/* ── Template Grid ─────────────────────────────────────────── */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.template-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    min-width: 0;
    overflow: hidden;
}

    .template-card .card-title {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .template-card .card-desc {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .template-card:hover {
        border-color: #3B5525;
        transform: translateY(-2px);
        box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    }

    .template-card.selected {
        border-color: #4A6B2E;
        background: #faf9ff;
    }

.bulk-action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

.card-type-badge {
    margin-bottom: 12px;
    padding: 10px;
}

.card-type-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6b6b6b;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 13px;
    color: #6b6b6b;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6b6b6b;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 4px;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid #e0e0e0;
    padding-top: 14px;
}

/* ── Search / Pagination ───────────────────────────────────── */
.search-bar {
    margin-bottom: 20px;
    max-width: 360px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
    font-size: 13px;
    color: #6b6b6b;
}

/* ── Approval Callout ──────────── */
/* A schedule run waiting for its owner, on the dashboard above the stats: one line per run */
.approval-callout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #4A6B2E;
    border-radius: 0;
    font-size: 14px;
    color: #1a1a2e;
}

.approval-callout-icon {
    display: inline-flex;
    color: #4A6B2E;
    flex-shrink: 0;
}

.approval-callout-text {
    flex: 1;
    min-width: 0;
}

.approval-callout .btn {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .approval-callout {
        flex-wrap: wrap;
    }

    .approval-callout-text {
        flex: 1 1 calc(100% - 30px);
    }
}

/* ── Approver List (schedule editor) ──────────── */
/* One tick box per workspace member; scrolls inside its box past a dozen or so */
.approver-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #ffffff;
}

.approver-list.has-error {
    border-color: #B33C32;
}

.approver-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 4px 0;
}

/* Name, then the address quieter on the same line; wraps under it when narrow */
.approver-who {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 8px;
    min-width: 0;
}

/* ── Approvals needed (schedule editor) ──────────── */
/* Two choice cards side by side; the picked one takes the active tint */
.approval-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-group .approval-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #1a1a2e;
    text-transform: none;
    letter-spacing: normal;
    transition: border-color 0.15s, background 0.15s;
}

    .form-group .approval-mode-option:hover {
        border-color: #d1d1d1;
    }

    .form-group .approval-mode-option.is-selected {
        border-color: #4A6B2E;
        background: #E5EDD8;
    }

    .form-group .approval-mode-option:has(input:focus-visible) {
        outline: 2px solid #4A6B2E;
        outline-offset: 2px;
    }

    .approval-mode-option input {
        width: 16px;
        height: 16px;
        margin: 2px 0 0;
        flex: 0 0 auto;
        accent-color: #4A6B2E;
        cursor: pointer;
    }

.approval-mode-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.approval-mode-title {
    font-weight: 600;
}

.approval-mode-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #555;
}

@media (max-width: 768px) {
    .approval-mode {
        grid-template-columns: 1fr;
    }
}

/* ── Stats Grid ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.stat-icon-purple { background: #E5EDD8; color: #4A6B2E; }
.stat-icon-blue   { background: #e8f0fe; color: #4285f4; }
.stat-icon-green  { background: #e6f7ed; color: #1a9d56; }
.stat-icon-red    { background: #fde8e8; color: #B33C32; }
.stat-icon-orange { background: #fff3e0; color: #e8871e; }

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -1px;
}

.stat-value-danger {
    color: #B33C32;
}

/* ── Dashboard Grid ────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-panel {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-heading {
    font-size: 15px;
    font-weight: 700;
}

.text-link {
    font-size: 12px;
    color: #4A6B2E;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

    .list-item:last-child {
        border-bottom: none;
    }

.list-item-name {
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── PDF Editor Layout ─────────────────────────────────────── */
.editor-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
}

.editor-sidebar {
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-heading {
    font-size: 11px;
    font-weight: 700;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar-hint {
    font-size: 12px;
    color: #6b6b6b;
    margin-bottom: 12px;
}

    .sidebar-hint code {
        background: #E5EDD8;
        padding: 1px 5px;
        border-radius: 3px;
        color: #4A6B2E;
    }

.field-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-chip {
    display: flex;
    align-items: center;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #4A6B2E;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    width: 100%;
    text-align: left;
    min-height: 44px;
}

    .field-chip:hover {
        background: #E5EDD8;
        border-color: #3B5525;
    }

.editor-main {
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
}

.toolbar-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.field-count-badge {
    font-size: 11px;
    font-weight: 600;
    color: #4A6B2E;
    background: rgba(74, 107, 46,0.1);
    padding: 3px 8px;
    border-radius: 100px;
}

/* ── Email Editor Layout ───────────────────────────────────── */
.email-editor-layout {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    height: 100vh;
}

.block-palette {
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.palette-heading {
    font-size: 11px;
    font-weight: 700;
    color: #6b6b6b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.palette-hint {
    font-size: 11px;
    color: #6b6b6b;
    margin-bottom: 10px;
}

.palette-block {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: 4px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    color: #555;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.15s;
    width: 100%;
    text-align: left;
    min-height: 44px;
}

    .palette-block:hover {
        background: #E5EDD8;
        border-color: #3B5525;
        color: #1a1a2e;
    }

.palette-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

/* ── Block chips ──────────── */
/* The tinted icon square in the PDF and email editors' Add Block palettes. One tone per
   category so a block can be found by colour before its label is read; the icon fills solid
   when its palette button is hovered. Shared here because both editors use it. */
.block-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    transition: background 0.15s, color 0.15s;
}

.block-chip svg {
    display: block;
}

.block-chip-green { background: #E5EDD8; color: #3B5525; }
.block-chip-slate { background: #E2E8EE; color: #3E5872; }
.block-chip-ochre { background: #F5EAD3; color: #7F5A12; }
.block-chip-clay  { background: #F6E2DC; color: #9A3F2C; }
.block-chip-teal  { background: #DCECE9; color: #2C6660; }

.pbd-palette-btn:hover .block-chip,
.etb-palette-item:hover .block-chip { color: #fff; }
.pbd-palette-btn:hover .block-chip-green,
.etb-palette-item:hover .block-chip-green { background: #4A6B2E; }
.pbd-palette-btn:hover .block-chip-slate,
.etb-palette-item:hover .block-chip-slate { background: #3E5872; }
.pbd-palette-btn:hover .block-chip-ochre,
.etb-palette-item:hover .block-chip-ochre { background: #7F5A12; }
.pbd-palette-btn:hover .block-chip-clay,
.etb-palette-item:hover .block-chip-clay  { background: #9A3F2C; }
.pbd-palette-btn:hover .block-chip-teal,
.etb-palette-item:hover .block-chip-teal  { background: #2C6660; }

.sidebar-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 14px 0;
}

.email-canvas-wrapper {
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    overflow: hidden;
}

.canvas-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    gap: 8px;
    flex-wrap: wrap;
}

.preview-tabs {
    display: flex;
    gap: 4px;
}

.preview-tab {
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #6b6b6b;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 36px;
}

    .preview-tab:hover {
        color: #1a1a2e;
        background: #f8f8f8;
    }

.preview-tab-active {
    background: #E5EDD8;
    color: #1a1a2e;
    border-color: #e0e0e0;
}

.email-canvas {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.canvas-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6b6b;
    font-size: 14px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.canvas-block {
    position: relative;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s;
}

    .canvas-block:hover {
        border-color: #d1d1d1;
    }

.block-selected {
    border-color: #4A6B2E !important;
}

.block-controls {
    position: absolute;
    top: 6px;
    right: 6px;
    display: none;
    gap: 4px;
    z-index: 10;
}

.canvas-block:hover .block-controls, .block-selected .block-controls {
    display: flex;
}

.block-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #E5EDD8;
    border: 1px solid #e0e0e0;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

    .block-btn:hover {
        background: #f8f8f8;
        color: #1a1a2e;
    }

    .block-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.block-btn-danger:hover {
    background: rgba(240,85,96,0.15);
    color: #B33C32;
}

.block-preview-inner {
    padding: 4px;
}

    /* Quill emits <p>…</p> per line; default browser margins make every line
       look double-spaced inside the canvas, but the Quill editor itself zeroes
       p margins so what the user composes is single-spaced. Match that here. */
    .block-preview-inner p {
        margin: 0;
    }

/* A block on the email editor's canvas, drawn by the same renderer as the preview and the sent email.
   The preview is a blank document — Arial at the browser's 16px, normal line height, black text,
   content-box sizing, default link styling — while the canvas sits inside this app, which would lend
   the block Inter at 14px, a 1.6 line height, green links with no underline and border-box sizing
   wherever the email sets nothing itself. This puts the canvas back on the preview's footing, so the
   two show the same block. */
.email-surface {
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: normal;
    color: #000;
    text-align: left;
}

    .email-surface *,
    .email-surface *::before,
    .email-surface *::after {
        box-sizing: content-box;
    }

    .email-surface a,
    .email-surface a:hover {
        color: revert;
        text-decoration: revert;
    }

/* Canvas-only notes under a block: its display condition, a line-item table's repeating row. */
.block-preview-note {
    font-size: 10px;
    color: #4A6B2E;
    background: #E5EDD8;
    padding: 2px 8px;
    border-radius: 0 0 4px 4px;
    border-top: 1px dashed #4A6B2E;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

/* The condition label sits above its block, so it opens downward instead. */
.block-preview-note-top {
    border-radius: 4px 4px 0 0;
    border-top: 0;
    border-bottom: 1px dashed #4A6B2E;
}

.preview-frame-wrapper {
    flex: 1;
    overflow: hidden;
    padding: 20px;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    background: #fff;
}

.preview-desktop {
    max-width: 100%;
}

.preview-mobile {
    max-width: 375px;
    margin: 0 auto;
}

/* ── Block Editor Panel ────────────────────────────────────── */
.block-editor-panel {
    background: #ffffff;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
}

.editor-panel-heading {
    font-size: 13px;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.panel-empty {
    padding: 24px 16px;
    text-align: center;
    color: #6b6b6b;
    font-size: 13px;
}

/* ── Color Picker / Align ──────────────────────────────────── */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 2px;
    background: #f8f8f8;
    cursor: pointer;
    flex-shrink: 0;
}

.align-select {
    display: flex;
    gap: 4px;
}

/* A segmented micro-control (L / C / R), not a form button — it sits inline beside field labels in
   the inspector and the document sidebar, so it is deliberately below the 40px button height the
   design system sets for real actions. min-height moves with the padding: left at 36px it would
   have kept the buttons tall no matter how much padding came off. */
.align-btn {
    flex: 1;
    padding: 3px 6px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #6b6b6b;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: capitalize;
    min-height: 22px;
}

    .align-btn:hover {
        background: #E5EDD8;
        color: #1a1a2e;
    }

.align-btn-active {
    background: #E5EDD8;
    border-color: #4A6B2E;
    color: #4A6B2E;
}

/* ── Table block inspector ──────────────────────────────── */
/* Shared by the email and PDF inspectors, both 320px wide, which is why it lives here rather than in
   either editor's scoped CSS. Everything is laid out on a grid so labels and controls line up down
   the panel, and nothing scrolls sideways: the old layout drew each table row as a strip of 120px
   inputs that ran off the panel after two columns. Inputs are compact (32px) because a five-column,
   three-row table is fifteen cells; at the editors' usual 44px they filled two screens. The selectors
   carry an element type so they outrank the editors' scoped `[b-…] .form-control` rules. */
.tbl-ed input.form-control,
.tbl-ed select.form-control {
    min-height: 32px;
    padding: 5px 8px;
    font-size: 12px;
}
.tbl-ed input.form-control.has-error {
    border-color: #B33C32;
}
.tbl-ed .align-btn {
    min-height: 32px;
}
/* A rule under each section so Columns / Rows / Line items / style read as separate blocks. */
.tbl-ed > .field-group {
    padding-bottom: 14px;
    border-bottom: 1px solid #e0e0e0;
}

.tbl-ed-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px 54px 20px;
    gap: 6px;
    align-items: center;
}
.tbl-ed-cols-head {
    font-size: 11px;
    color: #6b6b6b;
}

.tbl-ed-row {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 10px 4px;
    margin-bottom: 8px;
    background: #ffffff;
}
.tbl-ed-row-repeat {
    border-color: #4A6B2E;
    background: #f7faf3;
}
.tbl-ed-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a2e;
}
.tbl-ed-row-remove {
    margin-left: auto;
}
.tbl-ed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #4A6B2E;
    background: #E5EDD8;
    border-radius: 4px;
    padding: 2px 6px;
}
.tbl-ed-cell {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}
.tbl-ed-cell-label {
    font-size: 11px;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbl-ed-add {
    width: 100%;
    margin-top: 8px;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px dashed #d1d1d1;
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.tbl-ed-add:hover:not(:disabled) {
    border-color: #4A6B2E;
    color: #4A6B2E;
    background: #f7faf3;
}
.tbl-ed-add:disabled {
    opacity: 0.45;
    cursor: default;
}

.tbl-ed-hint {
    font-size: 11px;
    line-height: 1.45;
    color: #6b6b6b;
    margin-top: 6px;
}

.tbl-ed-sub {
    margin-top: 12px;
}
.tbl-ed-sub-first {
    margin-top: 0;
}
.tbl-ed-sublabel {
    display: block;
    font-size: 12px;
    color: #1a1a2e;
    margin-bottom: 4px;
}

/* Segmented control: the options share the row equally instead of wrapping onto a second line. */
.tbl-ed .tbl-ed-seg {
    flex-wrap: nowrap;
}
.tbl-ed .tbl-ed-seg .option-item {
    flex: 1;
    min-width: 0;
    padding: 6px 4px;
}

.tbl-ed-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #1a1a2e;
    cursor: pointer;
}

/* Label on the left, control on the right — every colour picker starts at the same x. */
.tbl-ed-prop {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-height: 32px;
    margin-top: 8px;
}
.tbl-ed-prop-label {
    font-size: 12px;
    color: #1a1a2e;
}
.tbl-ed .color-picker-row {
    gap: 6px;
}
.tbl-ed input.color-swatch {
    width: 32px;
    height: 32px;
}
.tbl-ed .color-picker-row input.form-control {
    max-width: 96px;
}

/* ── Workspace Settings ────────────────────────────────────── */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.invite-form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* ── Modal ─────────────────────────────────────────────────── */
/* Centering uses the `margin: auto` pattern instead of `align-items: center`
   because `align-items: center` + `overflow-y: auto` is broken in most
   browsers (modal's top can be clipped above the scroll start when it
   overflows). With `align-items: flex-start` + `margin: auto` on the modal:
     • Modal smaller than backdrop → `margin: auto` absorbs free space,
       centering vertically.
     • Modal taller than backdrop → `margin: auto` collapses to 0, modal
       top-pins, and `overflow-y: auto` scrolls correctly. */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    /* Above the mobile-topbar (200), env-banner (210), and the sidebar drawer
       (160) on mobile so dialogs always render in front of the navbar. Aligned
       with the legacy .modal-overlay / .checkout-overlay patterns elsewhere in
       the app (also 1000). Stays below CookieBanner (2000) and the
       LegalReacceptanceGate (3000), which are intentionally always-on-top. */
    z-index: 1000;
    backdrop-filter: blur(2px);
    overflow-y: auto;
    /* max() with env(safe-area-inset-*) keeps the modal clear of the iOS notch
       and home indicator without shrinking padding on devices that don't have them. */
    padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

.modal {
    background: #ffffff;
    border: 1px solid #d1d1d1;
    border-radius: 12px;
    width: 440px;
    max-width: 100%;
    /* dvh tracks the live viewport (excludes the dynamic URL bar on mobile) so the
       modal never extends past the visible area; falls back to vh on browsers that
       don't support dvh. */
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    box-shadow: 0 24px 80px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    /* margin: auto centers vertically when free space exists, falls back to 0
       (top-pinned) when modal overflows. See the centering note on
       `.modal-backdrop` above. */
    margin: auto;
    /* min-height:0 lets the body shrink to fit max-height. Without it the body's
       intrinsic content height (e.g. a Quill editor + several fields in the
       Create Message modal) pushes the modal past max-height and clips off the
       header at the top of the viewport. */
    min-height: 0;
    flex-shrink: 0;
}

/* Legal re-acceptance gate. These two live here rather than in
   LegalReacceptanceGate.razor.css because the gate passes them into ModalShell
   as BackdropClass / ModalClass — the elements that carry them are rendered by
   ModalShell, so a scoped rule would compile to `.reaccept-backdrop[b-<gate>]`
   and match nothing, dropping the overlay into normal page flow. The gate's own
   inner styles stay scoped. */
.reaccept-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 3000; /* above EnvironmentBanner (2100) and CookieBanner (2000) */
    overflow-y: auto;
    /* max() with env(safe-area-inset-*) clears the iOS notch and home indicator. */
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

.reaccept-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.18);
    padding: 28px 32px;
    max-width: 520px;
    width: 100%;
    /* dvh tracks the live mobile viewport (excludes dynamic browser chrome).
       vh fallback for older browsers. */
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    /* See `.modal { margin: auto }` above — centres when free space exists,
       top-pins (margin collapses to 0) when the modal exceeds the backdrop. */
    margin: auto;
    flex-shrink: 0;
    overflow-y: auto;
}

@media (max-width: 480px) {
    .reaccept-modal {
        padding: 20px;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    flex-shrink: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #6b6b6b;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.12s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #1a1a2e;
}

.modal-body {
    padding: 18px;
    flex: 1 1 auto;
    /* Required for overflow-y:auto to actually clip in a flex column — without
       it the body refuses to shrink below its intrinsic content height. */
    min-height: 0;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.modal-md { width: 520px; }
.modal-lg { width: 640px; }

.modal-footer-split {
    padding: 12px 18px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* ── Merge field chips ────────────────────────────────────── */
.et-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.et-field-chip {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #4A6B2E;
    background: #E5EDD8;
    border: 1px solid #c4b5fd;
    border-radius: 4px;
    padding: 3px 9px;
    user-select: all;
}

/* ── Auth Shell ────────────────────────────────────────────── */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
}

.auth-background {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 20% 40%, rgba(74, 107, 46,0.10) 0%, transparent 70%), radial-gradient(ellipse 50% 40% at 80% 60%, rgba(74, 107, 46,0.07) 0%, transparent 70%);
    pointer-events: none;
}

/* 440px card (488 minus the 24px gutters) — the width Google's and Microsoft's own sign-in
   cards use. At the old 400px the card left ~288px for content, and with the Google /
   Microsoft buttons, the "or" divider and a four-document agreement sentence the forms read
   as a long narrow column. Much wider than ~480px and a single-column form gets harder to
   scan. Phones are unaffected: the card is full-width below 768px either way. */
.auth-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 488px;
    padding: 24px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.auth-logo {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 24px;
}

.auth-heading {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.auth-sub {
    font-size: 14px;
    color: #6b6b6b;
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    font-size: 13px;
    color: #6b6b6b;
    margin-top: 20px;
}

.auth-legal-links {
    text-align: center;
    font-size: 12px;
    color: #6b6b6b;
    margin-top: 8px;
}

    .auth-legal-links a {
        color: #6b6b6b;
    }

        .auth-legal-links a:hover {
            color: #4A6B2E;
        }

.auth-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #6b6b6b;
}

/* ── Alerts / Toasts ───────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(240,85,96,0.1);
    border: 1px solid rgba(240,85,96,0.3);
    color: #B33C32;
}

.alert-success {
    background: rgba(46,184,92,0.1);
    border: 1px solid rgba(46,184,92,0.3);
    color: #1a8a4a;
}

/* Something to know before going on, not a failure. Ink on the tint: the warning yellow itself
   is far too light to read as text. */
.alert-warning {
    background: rgba(240,192,64,0.16);
    border: 1px solid rgba(240,192,64,0.6);
    color: #1a1a2e;
}

/* ── Gate Notice ───────────────────────────────────────────── */
/* A feature the plan or the permission set doesn't include (Webhooks panel, API keys card): an
   icon, a bold line saying what's missing, a muted line saying what it would do, and — for a plan
   gate — a See plans button. Not an alert tone: nothing is wrong, it just isn't available here. */
.gate-notice {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin: 12px 0 16px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #1a1a2e;
}

.gate-notice-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #E5EDD8;
    color: #4A6B2E;
}

.gate-notice-text {
    flex: 1;
    min-width: 0;
    line-height: 1.45;
}

.gate-notice-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.gate-notice-sub {
    display: block;
    color: #555;
}

.gate-notice .btn {
    flex-shrink: 0;
}

/* For a narrow spot (an editor's side rail, a dialog): the button drops under the text, lined
   up with it past the icon, instead of squeezing it into a sliver. */
.gate-notice-compact {
    flex-wrap: wrap;
    row-gap: 10px;
}

    .gate-notice-compact .btn {
        margin-left: 50px;   /* the icon's 36px plus the 14px gap */
    }

@media (max-width: 480px) {
    .gate-notice {
        flex-wrap: wrap;
    }

    .gate-notice .btn {
        margin-left: 50px;
    }
}

/* Sending from someone else's connected mailbox (schedule editor, re-run confirm). Warning tone,
   not an error: it's allowed, the person just needs to know whose name the email goes out in. */
.send-as-notice {
    background: rgba(240,192,64,0.12);
    border: 1px solid rgba(240,192,64,0.6);
    border-radius: 4px;
    color: #1a1a2e;
    font-size: 13px;
    padding: 10px 14px;
    margin-top: 8px;
}

.validation-message {
    color: #B33C32;
    font-size: 12px;
    margin-top: 4px;
}

.required-mark {
    color: #B33C32;
    font-weight: 600;
    margin-left: 2px;
}

/* Applied to .form-control / .form-control-sm / .filter-input when the field has a validation error.
   `.invalid` is the class Blazor's InputBase puts on a field with validation messages, so
   EditForm (Pattern A) forms — Login, Register, Forgot/Reset Password, Accept Invite — get the
   same red border as the `_fieldErrors` (Pattern B) forms' `.has-error`. */
.form-control.has-error,
.form-control-sm.has-error,
.filter-input.has-error,
.form-control.invalid,
.form-control-sm.invalid {
    border-color: #B33C32;
}

.form-control.has-error:focus,
.form-control-sm.has-error:focus,
.filter-input.has-error:focus,
.form-control.invalid:focus,
.form-control-sm.invalid:focus {
    border-color: #B33C32;
    outline: none;
    box-shadow: 0 0 0 2px rgba(240, 85, 96, 0.12);
}

/* Toast styles live in Components/ToastContainer.razor.css — the global
   .toast / .toast-error rules previously here were leftovers from the
   page-scoped toast pattern that the IToastService replaced. They pinned
   every .toast to position:fixed bottom:24px right:24px, causing every
   toast in the stack to overlap at the same coordinate. */

/* ── Loading / Empty States ────────────────────────────────── */
/* Empty states sit on the page background, so they carry the same surface as
   .card — otherwise a list page with no rows renders bare grey while every
   sibling panel on the same page is a white card. Markup is unchanged: every
   .empty-state picks this up without a wrapper. */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #6b6b6b;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
}

.empty-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    color: #6b6b6b;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* Every page that's still fetching its initial data renders
   <div class="loading-state">Loading X...</div>. Instead of showing the
   "Loading X..." text, this renders a single spinner centered vertically
   inside ~60vh of space — consistent loading affordance across every
   admin and user page without touching 30+ call sites.

   How:
     • font-size: 0 + color: transparent collapses the literal text node.
       Children with their own font-size (e.g. .text-sm) are unaffected,
       which keeps the GenerateJob-style nested markup readable if it
       ever needs to come back. The bare-text case (the other ~29 call
       sites) goes blank.
     • ::before is the spinner — same border-spin trick as .spinner but
       larger (32px) so it reads as a page-level loader, not an inline one.
     • min-height: 60vh + flex centering vertically centers the spinner
       in the visible area without needing per-page sizing. */
.loading-state {
    padding: 40px 24px;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0;
}

.loading-state::before {
    content: '';
    display: block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(74, 107, 46, 0.15);
    border-top-color: #4A6B2E;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* The 60vh above is sized for a page body. Inside a modal it inflated the
   dialog to near-full-height for as long as the fetch took, then snapped back
   to the content's natural size the moment it landed — read as the modal
   opening huge and immediately shrinking. Modals that load their body
   asynchronously (Share, and the Dataset / Recipient List / Schedule editors)
   all hit this. Keep the spinner, drop the page-sized reservation, and use a
   smaller one so the dialog barely moves when the content arrives. */
.modal-body .loading-state {
    min-height: 96px;
    padding: 24px;
}

    .modal-body .loading-state::before {
        width: 24px;
        height: 24px;
        border-width: 2px;
    }

/* Same reasoning for a spinner in one section of a page that has others below it: the 60vh
   reservation pushed the next section to the bottom of the screen until the data arrived,
   then everything jumped back up. Use with .loading-state on any in-page section. */
.loading-state.loading-state-inline {
    min-height: 96px;
    padding: 24px;
}

    .loading-state.loading-state-inline::before {
        width: 24px;
        height: 24px;
        border-width: 2px;
    }

.loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.skeleton-card {
    height: 160px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    border-radius: 12px;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(74, 107, 46,0.3);
    border-top-color: #4A6B2E;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    /* Sits inline with adjacent text on busy buttons (e.g. "Signing in…"). */
    vertical-align: -2px;
    margin-right: 8px;
}

/* For use on filled-purple buttons (.btn-primary) where the default spinner
   blends into the background — gives a white ring + white tip that reads
   clearly against the #4A6B2E fill. */
.spinner-on-primary {
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #ffffff;
}

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

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #E5EDD8;
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #d1d1d1;
    }

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

/* ── Tablet ≤1024px ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .email-editor-layout {
        grid-template-columns: 200px 1fr 220px;
    }
}

/* ── Mobile ≤768px ─────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Show topbar */
    .mobile-topbar {
        display: flex;
    }

    /* Hide the entire in-drawer logo row on mobile — the fixed mobile-topbar
       already renders the RowScribe wordmark above the drawer, so the row's
       contents (wordmark + ✕ button + bottom divider) are pure duplication.
       The drawer is still dismissable by tapping the backdrop overlay or any
       nav link (each NavLink calls CloseSidebar). */
    .sidebar-logo {
        display: none;
    }

    /* Mobile: collapse the env-banner onto the top of the mobile-topbar
       instead of stacking it above. EnvironmentBanner.razor.css promotes the
       banner to position:fixed at top:0 within this same breakpoint and
       shrinks its height to ~18px so it overlays the topbar's top edge
       without obscuring the centered menu button / logo. By zeroing
       --env-banner-height here we stop pushing the topbar + sidebar drawer
       down by the banner's old desktop height. */
    body:has(.env-banner) {
        --env-banner-height: 0px;
    }

    /* Sidebar becomes slide-in drawer */
    .sidebar {
        position: fixed;
        /* Same banner-clear treatment as the mobile topbar — without it
           the drawer's top edge would slide in over the env banner. */
        top: var(--env-banner-height);
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 0 4px 24px rgba(0,0,0,0.08);
        /* Clear the fixed 52px mobile-topbar so the first nav item
           (Dashboard) isn't hidden underneath it. The previous in-drawer
           .sidebar-logo row acted as an implicit spacer here; now that it's
           hidden on mobile, the drawer needs explicit top padding. */
        padding-top: 52px;
        /* translateX alone only moves the drawer out of sight — its ~20 links stay in the
           tab order, so on mobile a keyboard user tabs through an invisible menu before
           reaching anything. `visibility: hidden` removes them from the tab order and from
           the accessibility tree, and it still animates because it is transitioned
           alongside transform rather than toggled instantly. */
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0s linear 0.2s;
    }

        .sidebar.open {
            transform: translateX(0);
            visibility: visible;
            transition: transform 0.2s ease, visibility 0s;
        }

    /* Push content below topbar */
    .app-shell {
        flex-direction: column;
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }

    .main-content {
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    /* Only push content below the fixed mobile-topbar when the topbar is
       actually rendered (authenticated users). Unauthenticated visitors see
       LandingPage with no topbar — no offset needed.
       The env-banner is `position: sticky` and lives in-flow above .app-shell,
       so .app-shell already starts var(--env-banner-height) below the viewport
       top — adding the banner height to padding-top here would double-count
       it and leave a noticeable empty strip at the top of every page. The
       padding only needs to clear the 52px mobile-topbar. */
    .mobile-topbar ~ .app-shell .main-content {
        padding-top: 52px;
        min-height: calc(100dvh - 52px - var(--env-banner-height));
    }


    /* Page layout */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        /* Roomy on purpose: stacked on a narrow screen the subtitle wraps to
           two or three lines, and at 20px the first block of page content sat
           close enough to read as crowding it. */
        margin-bottom: 30px;
    }

    .page-title {
        font-size: 20px;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .page-narrow {
        max-width: 100%;
    }

    .search-bar {
        max-width: 100%;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 26px;
    }

    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .dashboard-panel {
        padding: 16px;
    }

    /* Grids */
    .template-grid {
        grid-template-columns: 1fr;
    }

    .loading-grid {
        grid-template-columns: 1fr;
    }

    /* Cards */
    .card-section {
        padding: 14px 16px;
    }

    .card-header-row {
        padding: 14px 16px;
    }

    /* Inside a .table-wrapper on mobile, let the table grow to its
       natural content width so cells don't get squashed/cut off, and
       the wrapper's overflow-x: auto turns the overflow into a swipe.
       min-width: 100% keeps narrow tables full-width when they fit.
       Earlier strategy hid .col-hide-mobile columns to make tables fit
       the viewport — replaced by horizontal scroll so every column is
       reachable. The .col-hide-mobile class is now a no-op tag in markup. */
    .table-wrapper > .data-table {
        width: max-content;
        min-width: 100%;
    }

    /* PDF Editor stacks vertically */
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: calc(100dvh - 52px);
        margin: -52px 0 0;
    }

    .editor-sidebar {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: 260px;
        overflow-y: auto;
    }

    /* Email editor stacks */
    .email-editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: calc(100dvh - 52px);
        margin: -52px 0 0;
    }

    /* Block palette becomes horizontal scroll strip */
    .block-palette {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 8px 12px;
        gap: 6px;
        max-height: 60px;
        align-items: center;
    }

    .palette-heading, .palette-hint, .sidebar-divider {
        display: none;
    }

    .palette-block {
        flex-shrink: 0;
        width: auto;
        margin-bottom: 0;
        padding: 6px 10px;
        font-size: 12px;
        min-height: 38px;
    }

    /* Block editor panel: bottom sheet */
    .block-editor-panel {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        max-height: 250px;
    }

    /* Auth */
    .auth-content {
        padding: 16px;
    }

    .auth-card {
        padding: 24px 20px;
    }

    /* Workspace invite form */
    .invite-form {
        flex-direction: column;
        align-items: stretch;
    }

    /* Toast mobile styles live in Components/ToastContainer.razor.css */

    /* ── Modals on mobile ───────────────────────────────────────
       Tighter horizontal backdrop padding so wider modals (md/lg) actually
       fill the viewport, force-collapse modal-md / modal-lg to 100% width
       (their 640px/520px desktop widths exceed every phone), and let footer
       rows wrap when buttons can't fit on one line. dvh on the body keeps
       content scrollable inside a viewport-bounded shell.

       Top padding clears the fixed 52px .mobile-topbar — the backdrop
       z-indexes (1000) above it (200) so the navbar is visually covered,
       but pinning the modal flush to y=0 reads as "cut off by navbar".
       64px = topbar height + a small breathing gap.

       Centering is handled by `margin: auto` on `.modal` (see the default
       `.modal-backdrop` rule's comment for why) — this rule only needs to
       adjust the padding for mobile chrome. */
    .modal-backdrop {
        /* Padding is symmetric so `margin: auto` lands the modal at the true viewport
           midpoint — an asymmetric pair (e.g. 64/16) shifts the centered modal down
           by half the difference, which reads visually as "pushed below center".
           64px on top still clears the fixed 52px mobile-topbar position when a tall
           modal falls back to top-pinned alignment. */
        padding: max(64px, calc(env(safe-area-inset-top) + 64px)) 12px max(64px, calc(env(safe-area-inset-bottom) + 64px));
    }

    .modal,
    .modal-md,
    .modal-lg {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 128px);
        border-radius: 10px;
    }

    .modal-header { padding: 12px 14px; }
    .modal-body { padding: 14px; }
    .modal-footer,
    .modal-footer-split {
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Footer-split usually has a left section (e.g. Clear override) and a
       right section (Cancel/Save). On wrap, the right section drops below
       the left and we want both to span the row so the buttons stay
       reachable instead of crammed into a half-width column.
       Scoped to `> div` (not `> *`) so a direct <button> child doesn't
       inherit `flex: 1 1 100%` and stretch to full width — the close button
       on admin Tickets / a few other modals reads as a banner instead of
       a button when that happens. */
    .modal-footer-split > div {
        flex: 1 1 100%;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .modal-footer-split > div:empty { display: none; }
}

/* ── Small mobile ≤480px ───────────────────────────────────── */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-value {
        font-size: 22px;
    }

    .auth-card {
        padding: 20px 16px;
    }

    .auth-heading {
        font-size: 20px;
    }

    .template-card {
        padding: 14px;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ── Schedule / Dataset editor step sections ─────────────────────────── */
/* Numbered sections inside JobEditor / ScheduleEditor.
   Each .form-step renders as its own white card so adjacent steps don't
   visually flow into each other. The numbered circle in .form-step-title
   acts as the section marker. */
.form-step {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.form-step:last-child {
    margin-bottom: 0;
}
.form-step-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}
.form-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #4A6B2E;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Full-page create / edit forms ───────────────────────────────────────
   Editors that outgrew a 640px modal (New Job, and the schedule / dataset
   editors) render as their own route instead. Shared here rather than in
   scoped CSS because every one of those pages needs the identical frame.

   Note `.form-page` does NOT touch overflow. An earlier revision overrode
   `.page-content`'s `overflow-x: hidden` to hand the scrollport back to
   `.main-content` for a sticky rail. The split layout below scrolls its own
   column instead, so that override is gone — along with the horizontal-scroll
   and clipping problems it caused. Leave it alone. */
.form-page {
    /* Left-aligned, like every other page in the app — a centred column makes
       the title jump horizontally as you move between the list and the form.
       Wide enough for the form column plus the 300px rail and still capped, so
       the label-over-input rows don't stretch the full width of a large
       monitor: 1280 leaves the steps a ~920px measure. */
    max-width: 1280px;
}

/* The split editors (jobs, schedules, datasets, recipient lists, the fill-in page) use the full
   width: their tables and grids are what need the room, and the summary rail keeps the form
   column from running the width of the screen. */
.form-page.form-page-split {
    max-width: none;
}

/* The picker caps itself at 320px so it couldn't eat a 640px modal whole. On a
   page that leaves a stunted, permanently-scrolling box with acres of room
   underneath it, so give it room to breathe while still capping it — a
   workspace with 50 templates shouldn't push the rest of the form off-screen. */
.form-page .tpl-pick-grid {
    max-height: min(60vh, 520px);
}

/* ── Flat step sections ──────────────────────────────────────────────────
   Inside a modal each `.form-step` needed its own white card to keep adjacent
   steps from running together. On a page that reads as six stacked panels,
   all ranked identically, with three near-white surfaces nested inside each
   other (grey page → white card → white input). Flattened to one surface with
   a rule between steps, so the form reads as one continuous task and the type
   does the ranking instead of the borders.

   Scoped to `.form-page` on purpose: the schedule editor still renders inside
   a modal until it moves to its own route, and there it still needs the card. */
/* Separation comes from three things together, because a heavier line on its
   own just looks like a dated 2px rule: the divider sits on the design
   system's Border2 (#d1d1d1) rather than the lighter Border, the gap either
   side of it is roughly doubled, and the step title carries a bit more weight.
   Whitespace does most of the work — a rule with 12px around it reads as a
   hairline no matter how dark it is. */
.form-page .form-step {
    background: transparent;
    border: 0;
    border-radius: 0;
    border-top: 1px solid #d1d1d1;
    padding: 36px 0 20px;
    margin-bottom: 0;
}

/* The first step sits directly under the page header, which already provides
   the separation — a rule there would read as an orphaned line. */
.form-page .form-step:first-child {
    border-top: 0;
    padding-top: 4px;
}

/* Without a card around it the title carries the whole weight of marking a new
   section, so it loses its own underline and gains size and weight. */
.form-page .form-step-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: 18px;
}

/* The numbered badge is the clearest "this is a new step" marker on the page,
   so it scales with the title rather than staying at the modal-era 26px. */
.form-page .form-step-number {
    width: 28px;
    height: 28px;
    font-size: 13px;
}

/* ── Editor layout: steps + summary rail ─────────────────────────────────
   The rail carries a running summary of the choices made so far and the
   primary action, which is what fills the width a capped single column left
   empty.

   The breakpoint is sized against the CONTENT box, not the window: the sidebar
   takes 240px and the page 32px of padding, so a 1280px window only leaves
   1008px here. Splitting that gives the steps ~680px, which is the floor for a
   two-up template grid. Below it the rail stops being a rail and stacks under
   the form. Anything lower and the steps get crushed — the form is the point,
   the rail is the garnish.

   Three children, placed by area so the summary and the submit button can be
   split apart on a narrow screen without duplicating markup: the steps span
   both rows of the left column, the summary sits top-right, the actions under
   it. */
.form-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
        "main rail"
        "main actions";
    grid-template-rows: auto 1fr;
    column-gap: 28px;
    row-gap: 12px;
}

/* min-width:0 stops a wide child (a long file name, the template grid) from
   forcing the 1fr track wider than its share and pushing the rail off-screen —
   grid items default to min-width:auto, which refuses to shrink below content. */
/* One white surface holding all the steps. This is the "flat sections on a
   single surface" pattern — the thing that was wrong before was six separate
   cards, not the colour. As a split-scroll pane it also needs a visible edge,
   or the region that scrolls has no boundary and the steps look like they are
   sliding under the page header. Its own padding, since .form-step lost the
   horizontal padding it had as a card. */
.form-split-main {
    grid-area: main;
    min-width: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px 24px 24px;
}

.form-split-rail {
    grid-area: rail;
}

.form-split-actions {
    grid-area: actions;
}

/* ── Split page with its rail hidden ──────────── */
/* The summary hidden (the dataset editor's toggle): the form takes the full width and the
   actions become a bar under it, the button at its own width on the right. */
.form-split.form-split-no-rail {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "main"
        "actions";
    grid-template-rows: 1fr auto;
}

.form-split-no-rail .form-split-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

/* Messages keep a line of their own above the buttons. */
.form-split-no-rail .form-split-actions > .alert,
.form-split-no-rail .form-split-actions > p {
    flex-basis: 100%;
    margin: 0 !important;
}

.form-split-no-rail .form-split-actions .btn-full {
    width: auto;
    order: 1;
}

.form-split-no-rail .form-split-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Title and the hide button share the summary card's top line. */
.summary-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.summary-title-row .summary-title {
    margin: 0;
}

.summary-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6b6b6b;
    cursor: pointer;
}

.summary-toggle:hover,
.summary-toggle:focus-visible {
    background: #f0f0f0;
    color: #1a1a2e;
}

.summary-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px;
}

.summary-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    margin: 0 0 14px;
}

.summary-list {
    margin: 0 0 14px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid #f0f0f0;
}

.summary-row:last-child {
    border-bottom: 0;
}

.summary-row dt {
    font-size: 12px;
    color: #6b6b6b;
    flex-shrink: 0;
}

/* Values wrap and break rather than widening the rail — a template called
   "Consulting Statement of Work (Revised)" must not push the grid column out. */
.summary-row dd {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

.summary-row dd.is-empty {
    font-weight: 400;
    color: #6b6b6b;
}

.summary-note {
    font-size: 12px;
    line-height: 1.5;
    color: #6b6b6b;
    margin: 0 0 14px;
}

/* Sub-heading for a secondary block in the rail — the schedule editor's
   "Next runs" under the summary rows. */
.summary-sub {
    margin-top: 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b6b6b;
}

.summary-runs {
    margin: 6px 0 14px;
    padding-left: 16px;
    font-size: 12px;
    line-height: 1.7;
    color: #1a1a2e;
}

/* ── Split scroll (wide screens only) ────────────────────────────────────
   The page fills the viewport and does not scroll as a whole; the steps column
   scrolls inside it, so the summary and the submit button never move. This
   replaces an earlier sticky rail, which had to fight `.page-content`'s
   overflow for a scrollport and overhung the footer whenever it grew taller
   than the screen. Owning the height outright avoids both.

   Gated on BOTH dimensions. Width: below 1281px the layout is a single column
   and the page scrolls normally. Height: the right-hand column needs roughly
   345px for the summary and button, plus the header, page padding and footer —
   under about 700px of viewport there isn't room, and the pane would compress
   the summary into a stub the same way the single-column layout did before
   `flex: 0 0 auto` was pinned on. When either test fails the page falls back to
   the plain two-column grid above, which has no height constraints at all and
   simply scrolls. Nothing in this block may set a height a child can be
   squeezed by without that child being able to scroll itself. */
@media (min-width: 1281px) and (min-height: 700px) {
    /* The shell normally scrolls; on this page its children do instead. */
    .main-content:has(> .form-page-split) {
        overflow: hidden;
    }

    /* Beats `.main-content > *`'s flex-shrink:0, which would otherwise keep
       this at its full content height and push the footer off the screen. */
    .main-content > .form-page-split {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .form-page-split .form-split {
        flex: 1 1 auto;
        /* Without min-height:0 a flex item refuses to shrink below its content
           height, so the grid would grow past the viewport and take the page
           scrollbar back. */
        min-height: 0;
    }

    /* The one scrolling region on the page. */
    /* The one scrolling region on the page. The scrollbar sits inside the
       panel's own padding, so no extra gutter is needed. */
    .form-page-split .form-split-main {
        overflow-y: auto;
        min-height: 0;
    }

    /* Only scrolls if the summary itself outgrows the column. min-height:0 is
       what lets the grid row shrink to make that possible — it belongs here and
       NOT in the base rule, because in the single-column flex layout below it
       lets the summary be compressed below its own content instead. */
    .form-page-split .form-split-rail {
        min-height: 0;
        overflow-y: auto;
    }

    /* Sits directly under the summary rather than stretching down the remaining
       `1fr` row. Cross-axis only, so it must not leak into the flex layout
       below, where `start` would shrink-wrap the full-width submit button. */
    .form-page-split .form-split-actions {
        align-self: start;
    }
}

@media (max-width: 1280px) {
    /* Single column, and the PAGE scrolls.

       This block touches ONLY the editor's own elements. An earlier revision
       also "defensively" reset `.main-content` and `.page-content` here, which
       was a mistake twice over: the wide-screen block above simply does not
       match at this width, so there is nothing to undo — and the resets
       clobbered shell rules that do apply. Forcing `overflow-y: auto` back onto
       `.main-content` overrode the ≤768px rule that deliberately sets it to
       `visible`, turning the shell into a nested viewport-height scroller with
       the page content overflowing it, which is what painted the footer across
       the template cards. Never reach outside `.form-split-*` from here. */
    .form-split {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* A column flex item is shrinkable by default, so without this the summary
       can be compressed below its content height and its lower rows cut off
       mid-line. align-self keeps the full-width submit button full width. */
    .form-split-main,
    .form-split-rail,
    .form-split-actions {
        flex: 0 0 auto;
        align-self: stretch;
    }

    .form-split-rail {
        order: -1;
    }

    .form-split-actions {
        order: 1;
    }
}

/* ── Quill rich-text editor ──────────────────────────────────────────────
   Shared by both the email block editor (Text / Footer / Two-Column blocks)
   AND the PDF block editor (Text block).

   Strategy: keep Quill's natural border on both the toolbar (sibling above)
   AND the container (sibling below). We only override color, radius, and
   sizing — earlier attempt zeroed the borders and tried to wrap the pair
   in a single .quill-container border, but Quill applies .ql-container.ql-snow
   to the SAME element as .quill-container after init, so the higher-specificity
   .ql-container.ql-snow rule wins and the wrapper border vanished. */
.quill-container {
    min-height: 120px;
    background: #fff;
}
.ql-toolbar.ql-snow {
    border-color: #d1d1d1 !important;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    padding: 6px 8px !important;
    background: #fafafa;
}
.ql-container.ql-snow {
    border-color: #d1d1d1 !important;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-family: Arial, sans-serif;
    font-size: 14px;
}
.ql-editor {
    min-height: 100px;
    padding: 12px !important;
}
.ql-editor.ql-blank::before {
    font-style: normal;
    color: #6b6b6b;
}

/* ── Quill Size / Font pickers ──────────────────────────────────────────
   Both pickers run on a custom whitelist (px sizes, our five faces) registered in
   pdfDesigner.js, so Quill's own ::before label rules — which only know 'small/large/huge'
   and 'serif/monospace' — leave every entry blank. Label each item from its own data-value.
   quill.snow.css loads AFTER app.css, so these need the extra .ql-toolbar class to outrank
   Quill's `.ql-snow .ql-picker.ql-size .ql-picker-label::before` (one class less specific). */
.ql-toolbar.ql-snow .ql-picker.ql-size {
    width: 68px;
}
.ql-toolbar.ql-snow .ql-picker.ql-font {
    width: 122px;
}
.ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-item::before,
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item::before {
    content: attr(data-value);
}
/* Nothing selected (mixed selection, or text at the block's own size) — name the control
   instead of showing an empty box. */
.ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-label:not([data-value])::before,
.ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=""]::before {
    content: 'Size';
}
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-label:not([data-value])::before,
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=""]::before {
    content: 'Font';
}
/* The reset entry (Quill's `false` option) — picks the block's own font back up. */
.ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-item:not([data-value])::before,
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item:not([data-value])::before {
    content: 'Block default';
    color: #6b6b6b;
}
/* Each PDF face previews in its own font: PdfFontStyles writes those rules from
   PdfFonts.Families. With 28 faces the list scrolls rather than run off the panel. */
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-options {
    max-height: 320px;
    overflow-y: auto;
    /* Wider than the 122px box, so "Liberation Serif (Times New Roman-compatible)" reads whole. */
    min-width: 280px;
    white-space: nowrap;
}
/* Email editor faces (EmailFonts.Supported) — websafe stacks the reader's own device provides. */
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Arial"]::before { font-family: Arial, Helvetica, sans-serif; }
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Verdana"]::before { font-family: Verdana, Geneva, sans-serif; }
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Tahoma"]::before { font-family: Tahoma, Verdana, sans-serif; }
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Trebuchet MS"]::before { font-family: 'Trebuchet MS', Tahoma, sans-serif; }
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Georgia"]::before { font-family: Georgia, 'Times New Roman', serif; }
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Times New Roman"]::before { font-family: 'Times New Roman', Times, serif; }
.ql-toolbar.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="Courier New"]::before { font-family: 'Courier New', Courier, monospace; }
/* The size list is long — let it scroll rather than run off the panel. */
.ql-toolbar.ql-snow .ql-picker.ql-size .ql-picker-options {
    max-height: 260px;
    overflow-y: auto;
}

/* ── Schedule timing (ScheduleEditor + AdminScheduleEditor) ──────────── */

/* Starts on / Ends on side by side; stacked on a phone. Each half is an ordinary
   .form-group, so the spacing below them matches every other field. */
.schedule-window {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 16px;
}

/* "Detected from your browser … [Use detected]". The button is a 36px control and the hint
   a 12px line: inline, a wrapped button landed flush against the text above it. As a
   wrapping flex row each keeps its own height, with space between the two. */
.tz-detected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

/* The plain-English timetable and next runs, closing the "When it runs" step. */
.schedule-when-summary {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    margin: 4px 0 0;
}

/* Flex, not an inline icon beside the text: inline, the clock sat on the text's baseline
   and rode above the line. */
.schedule-when-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

    .schedule-when-title svg { flex-shrink: 0; }

@media (max-width: 480px) {
    /* 24px a side left a 375px phone about 280px for every field in the long editors. */
    .form-split-main {
        padding: 16px 14px 20px;
    }

    .schedule-window {
        /* minmax(0, …), not 1fr: a bare 1fr track won't shrink below its date input's
           intrinsic width, which on iOS is wider than a phone's column. */
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Collapsible "Advanced options" block inside a form. The bottom margin matches
   .form-group spacing so the next form section doesn't visually butt up against
   the collapsed disclosure — without it the boundary between this and whatever
   follows reads as one continuous block instead of two. */
.form-details {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0;
    margin-top: 8px;
    margin-bottom: 16px;
    background: #fafafa;
}
.form-details > summary {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    user-select: none;
    list-style: none;
}

    /* The parenthetical in a summary previews what's inside — it's a hint, not
       part of the heading, so it takes the same quiet treatment as "(optional)"
       beside a label instead of competing with the section name. */
    .form-details > summary .summary-hint {
        font-weight: 400;
        color: #6b6b6b;
    }
.form-details > summary::-webkit-details-marker { display: none; }
.form-details > summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.15s ease;
    color: #6b6b6b;
}
.form-details[open] > summary::before {
    transform: rotate(90deg);
}
.form-details > summary:hover { color: #1a1a2e; }
.form-details[open] > summary {
    border-bottom: 1px solid #e0e0e0;
}
.form-details-body {
    padding: 14px 12px;
}

    /* Every .form-group in here carries the standard 16px bottom margin, so the
       panel spaces itself — call sites must not add their own margin-top on top
       of it, or consecutive options drift apart at different rates. */
    .form-details-body > .form-group:last-child {
        margin-bottom: 0;
    }

/* ── Origin badges — match .status-badge sizing (padding 3px 8px, 100px radius) ─── */
.origin-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.origin-immediate {
    background: rgba(136,136,136,0.15);
    color: #666;
}

.origin-scheduledonce {
    background: rgba(79,158,255,0.12);
    color: #2a8ad4;
}

.origin-fromschedule {
    background: rgba(74, 107, 46,0.15);
    color: #4A6B2E;
}

.origin-api {
    background: rgba(26, 26, 46, 0.08);
    color: #1a1a2e;
}

/* ── Admin support panels (account / workspace / job tools) ──────────── */
.admin-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.admin-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
}

/* A panel title with an action beside it: both centred on one line, the divider under the
   pair — the button used to hang down onto the line below a top-aligned title. */
.admin-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 16px;
}

.admin-panel-title-row .admin-panel-title {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* One fact per row, label in a fixed column and its value (badges, text, a button) beside
   it — a run-on line of facts was hard to read once it wrapped. */
.admin-panel-facts {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.admin-panel-facts > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

.admin-panel-facts > div:last-child {
    border-bottom: none;
}

.admin-panel-facts > div > :first-child {
    flex: 0 0 180px;
}

.admin-panel-facts > div > .ml-2 {
    margin-left: 0;
}

@media (max-width: 768px) {
    .admin-panel { padding: 16px; }
    .admin-panel-title-row { flex-direction: column; align-items: flex-start; }
    .admin-panel-facts > div > :first-child { flex-basis: 100%; }
}

/* ── Admin editor banner (support viewing a customer's template) ──────────── */
/* A fixed 36px, one line: the PDF editor sizes its layout to the viewport and subtracts it
   (.ped-layout-admin). The full text is in the title for when it's cut short. */
.admin-editor-banner {
    display: flex;
    gap: 12px;
    align-items: center;
    height: 36px;
    box-sizing: border-box;
    padding: 0 16px;
    white-space: nowrap;
    overflow: hidden;
    background: #E5EDD8;
    border-bottom: 1px solid #d1d1d1;
    color: #1a1a2e;
    font-size: 13px;
}

.admin-editor-banner > span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-editor-banner-editing {
    background: #fff3cd;
    border-bottom-color: #f0c040;
}

/* ── Merge-field popup (mergeTagAssist.js) ────────────────────────────── */
/* Lives on <body>, outside any component, so it can't take scoped styles. Kept small so it
   doesn't cover the text being typed; the list scrolls, with its heading pinned on top. */
.merge-assist {
    position: fixed;
    z-index: 3000;
    width: 220px;
    max-height: min(260px, calc(100vh - 16px));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    color: #1a1a2e;
}

.merge-assist-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 6px 10px;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.merge-assist-section {
    padding: 2px 4px;
}

.merge-assist-section + .merge-assist-section {
    border-top: 1px solid #e0e0e0;
}

.merge-assist-group {
    padding: 4px 6px 1px 26px;
    font-size: 10px;
    font-weight: 700;
    color: #4A6B2E;
}

.merge-assist-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    /* Keeps a row the arrow keys scroll to clear of the pinned heading. */
    scroll-margin-top: 28px;
}

.merge-assist-item-active {
    background: #E5EDD8;
}

.merge-assist-check {
    width: 16px;
    flex-shrink: 0;
    font-weight: 700;
    color: #4A6B2E;
}

.merge-assist-label {
    flex: 1;
    min-width: 0;
}

.merge-assist-item-current .merge-assist-label {
    font-weight: 600;
}

.merge-assist-note {
    font-size: 10px;
    color: #6b6b6b;
    white-space: nowrap;
}

.merge-assist-hint {
    padding: 8px 12px;
    font-size: 12px;
    color: #6b6b6b;
}

