/**
 * UnfoldPDF - Stylesheet
 * Responsive, modern, clean aesthetic with full dark/light theme support.
 *
 * Design tokens live in :root below (colour, type, spacing, radius,
 * shadow, z-index). Product screens use them; only marketing selectors
 * (landing hero, sections, pricing cards, CTA band, guides, prose pages)
 * keep fluid clamp() or in-between sizes.
 *
 * Type roles: page title 1.75rem/600 (--type-page-title), section title
 * 1.125rem/600, state title 1.25rem/600, body 1rem, helper 0.875rem,
 * button 0.875rem/500 (small 0.8125rem), labels 500.
 *
 * Brand (2026-10-25): ink #14162B, cream #F5F2EA, bright teal #00C2B2 (logo
 * arrow, bars), deep teal #00796F (buttons, links), from the logo files.
 *
 * Breakpoints (max-width unless noted), the only ones in app.css and
 * account.css:
 *   340px  narrowest phones (smaller logo, step words only)
 *   380px  very narrow phones (header squeeze for long workspace names)
 *   480px  phones (one-column forms, compact public nav, dialogs)
 *   600px  the app header's tools take their own row; summaries stack
 *   640px  phones/small tablets: tables become cards, touch targets
 *   760px  tablets: app/public nav folds behind "Menu", stacked grids
 *   min-width 641px  the complement of 640 (desktop-only rules)
 *   min-width 1100px wide desktops
 *
 * Dark tokens are defined TWICE (the OS media query guarded by
 * :root:not([data-theme="light"]), and :root[data-theme="dark"] for the
 * theme switch): change both together.
 */

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Light Theme Palette */
    --bg-page: #F8F7F3;
    --bg-card: #ffffff;
    --bg-card-subtle: #F2F0EA;
    --border-color: #E6E3DA;
    --border-strong: #8A8679;
    --border-focus: #00796F;

    --text-primary: #14162B;
    --text-secondary: #474A5E;
    --text-muted: #646779;

    --brand-primary: #00796F;
    --brand-primary-hover: #005F57;
    --brand-primary-glow: rgba(0, 121, 111, 0.16);

    --accent-teal: #00C2B2;
    --accent-teal-bg: #E0F4F1;

    --color-error: #ef4444;
    --color-error-bg: #fef2f2;
    --color-error-border: #fecaca;

    --color-warning: #f59e0b;
    --color-warning-bg: #FFF8E6;
    --color-warning-border: #fde68a;

    --color-success: #10b981;
    --color-success-bg: #E6F4EA;
    --color-success-border: #a7f3d0;

    /* Text versions of the accent colours. The plain tokens above are for
       fills and borders; as text on their tinted backgrounds they fall
       below WCAG AA (4.5:1), so text uses these instead. */
    --brand-text: #00665D;
    --success-text: #1C6B35;
    --warning-text: #8A4B00;
    --error-text: #b91c1c;
    --teal-text: #00665D;

    /* Brand tints (fills/borders only) and the brand gradient. */
    --brand-tint-faint: rgba(0, 121, 111, 0.04);
    --brand-tint-subtle: #E0F4F1;
    --brand-tint-border: rgba(0, 121, 111, 0.28);
    --brand-gradient: linear-gradient(135deg, #14162B, #22264A);

    /* Content on a brand fill or gradient (same in both themes: the fills
       don't change with the theme). White on #00796F is 5.3:1; the
       gradient is the logo's ink (#14162B -> #22264A). */
    --on-brand: #ffffff;
    --on-brand-button-bg: #ffffff;
    --on-brand-button-bg-hover: #E0F4F1;
    --on-brand-button-text: #005F57;

    /* Logo palette (2026-10-25): ink, cream and the bright teal of the
       logo's arrow. Bright teal is a fill only (bars, dots), never text. */
    --brand-ink: #14162B;
    --brand-cream: #F5F2EA;
    --brand-bright: #00C2B2;
    --avatar-bg: #14162B;
    --avatar-text: #F5F2EA;

    /* Destructive fill: fixed red in both themes; white text on it meets
       WCAG AA (6.5:1). */
    --danger-fill: #b91c1c;
    --danger-fill-hover: #991b1b;

    /* Things that are white whatever the theme: rendered PDF pages, sample
       images, switch knobs, QR codes. */
    --surface-paper: #ffffff;

    --teal-tint-subtle: rgba(0, 194, 178, 0.08);
    --highlight-bg: rgba(245, 158, 11, 0.25);
    --highlight-bg-hover: rgba(245, 158, 11, 0.4);
    --highlight-glow: rgba(245, 158, 11, 0.3);
    --backdrop: rgba(20, 22, 43, 0.55);

    color-scheme: light;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 8px 10px -6px rgba(15, 23, 42, 0.02);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;

    /* Type scale (rem, 16px root) and the roles product screens use. */
    --text-xs: 0.75rem;     /* 12px: overlines, counts */
    --text-sm: 0.8125rem;   /* 13px: meta, small buttons, pills */
    --text-md: 0.875rem;    /* 14px: helper text, labels, buttons, tables */
    --text-base: 1rem;      /* 16px: body, inputs */
    --text-lg: 1.125rem;    /* 18px: section titles */
    --text-xl: 1.25rem;     /* 20px: state titles */
    --text-2xl: 1.5rem;     /* 24px: figures in stat cards */
    --text-3xl: 1.75rem;    /* 28px: page titles */

    --type-page-title: var(--text-3xl);
    --type-section-title: var(--text-lg);
    --type-state-title: var(--text-xl);
    --type-body: var(--text-base);
    --type-helper: var(--text-md);
    --type-label: var(--text-md);
    --type-button: var(--text-md);
    --type-button-sm: var(--text-sm);
    --type-stat: var(--text-2xl);

    /* Spacing: a 4px grid. */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */

    /* Control heights: compact controls and touch-sized targets. */
    --control-h-sm: 2.25rem;  /* 36px */
    --control-h: 2.5rem;      /* 40px */
    --control-h-touch: 2.75rem; /* 44px */

    /* Stacking order, lowest first. */
    --z-raised: 1;     /* above a stretched row link */
    --z-sticky: 5;     /* sticky bars inside the page (selection bar) */
    --z-popover: 20;   /* inline popover forms (New project) */
    --z-header: 50;    /* the sticky site header */
    --z-dropdown: 70;  /* menus */
    --z-dialog: 900;   /* non-native overlays (native <dialog> uses the top layer) */
    --z-toast: 999;
    --z-skip: 1000;    /* the skip link, above everything */
}

/* Dark theme: follows the OS unless the visitor chose a theme in the
   footer (data-theme on <html>, set by js/theme.js before first paint). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-page: #0E1020;
        --bg-card: #16182E;
        --bg-card-subtle: #1D2038;
        --border-color: #2E3150;
        --border-strong: #6E7194;
        --border-focus: #00C2B2;

        --text-primary: #F5F2EA;
        --text-secondary: #CFCCD9;
        --text-muted: #9A98AF;

        --brand-primary: #00796F;
        --brand-primary-hover: #006B62;
        --brand-primary-glow: rgba(0, 194, 178, 0.22);

        --accent-teal: #00C2B2;
        --accent-teal-bg: rgba(0, 194, 178, 0.12);

        --color-error: #f87171;
        --color-error-bg: rgba(239, 68, 68, 0.12);
        --color-error-border: rgba(239, 68, 68, 0.3);

        --color-warning: #fbbf24;
        --color-warning-bg: rgba(245, 158, 11, 0.12);
        --color-warning-border: rgba(245, 158, 11, 0.3);

        --color-success: #34d399;
        --color-success-bg: rgba(16, 185, 129, 0.12);
        --color-success-border: rgba(16, 185, 129, 0.3);

        --brand-tint-faint: rgba(0, 194, 178, 0.06);
        --brand-tint-subtle: rgba(0, 194, 178, 0.13);
        --brand-tint-border: rgba(0, 194, 178, 0.38);

        /* Shadows need more opacity to show on dark surfaces. */
        --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
        --backdrop: rgba(0, 0, 0, 0.65);

        --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

        --brand-text: #3FD6C8;
        --success-text: #34d399;
        --warning-text: #fbbf24;
        --error-text: #f87171;
        --teal-text: #3FD6C8;


        /* The avatar inverts like the logo: cream with ink initials. */
        --avatar-bg: #F5F2EA;
        --avatar-text: #14162B;

        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg-page: #0E1020;
    --bg-card: #16182E;
    --bg-card-subtle: #1D2038;
    --border-color: #2E3150;
    --border-strong: #6E7194;
    --border-focus: #00C2B2;

    --text-primary: #F5F2EA;
    --text-secondary: #CFCCD9;
    --text-muted: #9A98AF;

    --brand-primary: #00796F;
    --brand-primary-hover: #006B62;
    --brand-primary-glow: rgba(0, 194, 178, 0.22);

    --accent-teal: #00C2B2;
    --accent-teal-bg: rgba(0, 194, 178, 0.12);

    --color-error: #f87171;
    --color-error-bg: rgba(239, 68, 68, 0.12);
    --color-error-border: rgba(239, 68, 68, 0.3);

    --color-warning: #fbbf24;
    --color-warning-bg: rgba(245, 158, 11, 0.12);
    --color-warning-border: rgba(245, 158, 11, 0.3);

    --color-success: #34d399;
    --color-success-bg: rgba(16, 185, 129, 0.12);
    --color-success-border: rgba(16, 185, 129, 0.3);

    --brand-tint-faint: rgba(0, 194, 178, 0.06);
    --brand-tint-subtle: rgba(0, 194, 178, 0.13);
    --brand-tint-border: rgba(0, 194, 178, 0.38);

    /* Shadows need more opacity to show on dark surfaces. */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
    --backdrop: rgba(0, 0, 0, 0.65);

    --shadow-card: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

    --brand-text: #3FD6C8;
    --success-text: #34d399;
    --warning-text: #fbbf24;
    --error-text: #f87171;
    --teal-text: #3FD6C8;


    /* The avatar inverts like the logo: cream with ink initials. */
    --avatar-bg: #F5F2EA;
    --avatar-text: #14162B;

    color-scheme: dark;
}

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

/* Keep the scrollbar's room reserved on every page (2026-10-23): without it a
   short page (no scrollbar) and a long one centred the header and the content
   7-15 px apart, so moving between pages shifted everything sideways. */
html {
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout Container */
.app-container {
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-8) var(--space-4) var(--space-12);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    flex: 1;
}

/* Cards. One elevated card (.card; the converter's .main-card and the
   sign-in pages' .account-card are the same surface), one flat section
   card (.card-flat; Dashboard-style sections and stat cards), and an inset
   variant on the subtle background (.card-subtle; option boxes, file
   cards, summaries inside a card). Each component keeps its own padding
   or layout where it needs a different one. */
.card,
.main-card,
.account-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-8);
}

.card-flat,
.dashboard-section,
.dashboard-stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.card-subtle,
.file-card,
.file-list-card,
.proofread-option-card,
.conversion-summary,
.advanced-options,
.table-card {
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.card-subtle {
    padding: var(--space-4);
}

.main-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    position: relative;
    overflow: hidden;
}

/* Flow Step Transitions */
.flow-step {
    transition: opacity var(--transition-normal);
}

.flow-step.hidden {
    display: none !important;
}

/* Generic toggle used by app.js on every show/hide-able element. Only a
   few components had their own `.x.hidden` rule, so e.g. the file card,
   the result warning and the simplifications badge stayed visible (and
   focusable) while "hidden". */
.hidden {
    display: none !important;
}

/* Drag and Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem var(--space-5);
    text-align: center;
    cursor: pointer;
    background-color: var(--bg-card-subtle);
    transition: border-color var(--transition-normal), background-color var(--transition-normal), transform var(--transition-normal), opacity var(--transition-normal);
    outline: none;
    user-select: none;
}

.drop-zone:hover {
    border-color: var(--brand-primary);
    background-color: var(--brand-tint-faint);
}

.drop-zone.drag-over {
    border-color: var(--brand-primary);
    background-color: var(--brand-tint-subtle);
    transform: scale(1.008);
}

.drop-zone .drop-choose-btn {
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
}

.drop-zone .drop-choose-btn svg {
    flex-shrink: 0;
}

/* Once a file is chosen, "Continue: choose pages" is the one primary
   action; choosing a different file steps back to a secondary style. */
.drop-zone.has-file {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.drop-zone.has-file .drop-choose-btn {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: none;
    font-size: var(--text-md);
    padding: 0.55rem 1.1rem;
}

.drop-zone.has-file .drop-choose-btn:hover:not(:disabled) {
    background-color: var(--bg-card-subtle);
    box-shadow: none;
    transform: none;
}

.drop-subheading {
    font-size: var(--text-md);
    color: var(--text-secondary);
    margin-top: 0.625rem;
}

.drop-limit-hint {
    margin-top: 0.375rem;
    font-size: var(--text-sm);
    color: var(--text-secondary); /* --text-muted fails WCAG AA contrast at this size */
}

/* The rest of the upload step appears once a file is chosen. */
.drop-zone:not(.has-file) ~ .upload-after-file {
    display: none;
}

.upload-privacy-note {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
}

.advanced-options-note {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Upload -> Choose pages -> Convert, above the converter. */
.flow-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-6);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-secondary);
}

.flow-steps li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.flow-step-number {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
}

.flow-steps li[aria-current="step"] {
    color: var(--brand-text);
}

.flow-steps li[aria-current="step"] .flow-step-number {
    border-color: var(--brand-primary);
    background-color: var(--brand-primary);
    color: var(--on-brand);
}

.flow-steps li.is-done .flow-step-number {
    border-color: var(--success-text);
    color: var(--success-text);
}

/* A finished step that isn't the current one shows a check instead of its
   number: steps can be finished out of order (Translate's languages). */
.flow-steps li.is-done:not([aria-current="step"]) .flow-step-number {
    font-size: 0;
}

.flow-steps li.is-done:not([aria-current="step"]) .flow-step-number::after {
    content: '\2713';
    font-size: var(--text-xs);
}

/* The last step once finished is both current and done: keep its number
   readable (green text on the blue fill disappeared). */
.flow-steps li.is-done[aria-current="step"] .flow-step-number {
    border-color: var(--brand-primary);
    color: var(--on-brand);
}

@media (max-width: 480px) {
    .flow-steps {
        gap: var(--space-1) 0.625rem;
        font-size: var(--text-sm);
    }

    .flow-steps li {
        gap: 0.3rem;
    }

    .flow-step-number {
        width: 1.25rem;
        height: 1.25rem;
        font-size: var(--text-xs);
    }
}

/* Narrowest phones: words only, joined by arrows; the current step keeps
   its colour and weight. */
@media (max-width: 340px) {
    .flow-step-number {
        display: none;
    }

    .flow-steps li + li::before {
        content: '\203A';
        margin-right: 0.35rem;
        color: var(--text-secondary);
    }

    .flow-steps li[aria-current="step"] {
        text-decoration: underline;
        text-underline-offset: 0.2em;
    }
}

/* Selected File Card */
.file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem var(--space-5);
    margin-top: var(--space-5);
}

.file-card-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    overflow: hidden;
}

/* File type label (PDF, JPG...): a neutral tag, not an error colour.
   --text-secondary on --bg-card-subtle: 6.9:1 light, 9.6:1 dark. */
.file-badge {
    background-color: var(--bg-card-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: var(--text-sm);
    font-weight: 700;
    padding: 0.125rem var(--space-2);
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.file-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 480px;
}

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

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-icon:hover:not(:disabled) {
    color: var(--error-text);
    background-color: var(--color-error-bg);
}

/* Action Bar & Buttons */
.action-bar {
    margin-top: var(--space-6);
    display: flex;
    justify-content: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-size: var(--type-button);
    font-weight: 500;
    padding: 0.65rem var(--space-5);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: var(--on-brand);
    box-shadow: 0 2px 4px var(--brand-primary-glow);
}

.btn-primary:hover:not(:disabled):not([aria-disabled="true"]) {
    background-color: var(--brand-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--brand-primary-glow);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled):not([aria-disabled="true"]) {
    background-color: var(--bg-card-subtle);
    border-color: var(--border-focus);
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: var(--text-base);
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 0.45rem 0.875rem;
    font-size: var(--type-button-sm);
    gap: 0.4rem;
}

/* One disabled look for every button variant (a disabled control must look
   unavailable, not just say so). Hover rules are guarded with
   :not(:disabled), so nothing lights up on hover either. */
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Processing State */
.processing-card {
    padding: var(--space-10) var(--space-6);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
}

.spinner-wrapper {
    margin-bottom: var(--space-2);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3.5px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

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

/* Page Selection (Logged-In, Credit-Metered Flow) */
.page-select-card {
    padding: 0;
    text-align: left;
    align-items: stretch;
}

.page-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: var(--space-2);
    max-height: 280px;
    overflow-y: auto;
    padding: var(--space-3);
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.page-checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-md);
    cursor: pointer;
    /* Comfortable touch target (the bare 13px checkbox was the only
       tappable area on phones). */
    min-height: 2.5rem;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
}

.page-checkbox-item:hover {
    background-color: var(--bg-card);
}

.page-checkbox-item input {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.page-select-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}

.page-select-bulk {
    display: flex;
    gap: 0.375rem;
}

.page-range-label {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

/* Text inputs and selects: one base. .account-input is the form control
   everywhere; the page picker's range field (.page-range-input) is the same
   control, a little shorter. */
.account-input,
.page-range-input {
    padding: 0.625rem var(--space-3);
    font-family: var(--font-sans);
    font-size: var(--type-body);
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.account-input:focus,
.page-range-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

.page-range-input {
    flex: 1 1 10rem;
    max-width: 16rem;
    padding: 0.45rem var(--space-3);
}

.page-range-input[aria-invalid="true"] {
    border-color: var(--color-warning-border);
}

.page-range-hint {
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.page-select-notice {
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-md);
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.page-select-notice a,
.page-select-notice button.link-like {
    color: var(--brand-text);
    font-weight: 600;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.page-select-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-top: var(--space-4);
}

.page-select-cost-label {
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.page-select-actions {
    display: flex;
    gap: var(--space-2);
    /* Stays on the right when the "Cost:" label is hidden (signed in: the
       summary above shows the cost), like the upload step's .action-bar. */
    margin-left: auto;
}

.processing-title {
    font-size: var(--type-state-title);
    font-weight: 600;
    color: var(--text-primary);
}

.processing-desc {
    font-size: var(--text-base);
    color: var(--text-secondary);
    max-width: 420px;
}

.processing-timer {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    color: var(--text-muted);
    background-color: var(--bg-card-subtle);
    padding: 0.3rem var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

/* Error State */
.error-card {
    padding: var(--space-12) var(--space-6);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    background-color: var(--color-error-bg);
    border: 1px solid var(--color-error-border);
    border-radius: var(--radius-md);
}

.error-icon-wrapper {
    color: var(--error-text);
}

.error-title {
    font-size: var(--type-state-title);
    font-weight: 600;
    color: var(--error-text);
}

.error-message {
    font-size: var(--text-base);
    color: var(--text-primary);
    max-width: 520px;
    line-height: 1.5;
}

.error-actions {
    margin-top: var(--space-2);
}

.result-meta-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.stat-badge {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    padding: 0.4rem var(--space-3);
    border-radius: var(--radius-md);
    min-width: 76px;
}

.stat-label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-value {
    font-size: var(--text-base);
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.result-warning {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background-color: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-md);
    color: var(--warning-text);
}

.sample-result-banner {
    background-color: var(--accent-teal-bg);
    border: 1px solid var(--accent-teal);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-md);
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.sample-result-banner.hidden {
    display: none;
}

.sample-result-banner a {
    color: var(--brand-text);
    font-weight: 600;
}

.text-display-container {
    margin-top: var(--space-4);
}

.text-result-area {
    width: 100%;
    min-height: 380px;
    height: 55vh;
    max-height: 700px;
    padding: var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    white-space: pre-wrap;
    outline: none;
    transition: border-color var(--transition-fast);
}

.text-result-area:focus {
    border-color: var(--border-focus);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--text-primary);
    color: var(--bg-page);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    pointer-events: none;
    z-index: var(--z-toast);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 640px) {
    /* Full-width bar on phones, clear of the home indicator. */
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
        text-align: center;
    }
}

/* Utility classes */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Proofread Toggle Card */
.proofread-option-card {
    margin-top: var(--space-5);
    padding: 0.875rem var(--space-5);
}

.toggle-control {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    cursor: pointer;
    user-select: none;
}

.toggle-control input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch {
    width: 42px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: var(--radius-full);
    position: relative;
    flex-shrink: 0;
    transition: background-color var(--transition-fast);
    margin-top: 2px;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--surface-paper);
    top: 3px;
    left: 3px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle-control input:checked ~ .toggle-switch {
    background-color: var(--brand-primary);
}

.toggle-control input:checked ~ .toggle-switch::after {
    transform: translateX(18px);
}

.toggle-text-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.toggle-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-description {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Word Export Setting Pill in Result Actions */
.export-setting-pill {
    display: flex;
    align-items: center;
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.35rem var(--space-3);
    transition: border-color var(--transition-fast);
}

.export-setting-pill:hover {
    border-color: var(--border-strong);
}

.toggle-control-sm {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch-sm {
    width: 32px;
    height: 18px;
    background-color: var(--border-color);
    border-radius: var(--radius-full);
    position: relative;
    flex-shrink: 0;
    transition: background-color var(--transition-fast);
}

.toggle-switch-sm::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--surface-paper);
    top: 2px;
    left: 2px;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.toggle-control input:checked ~ .toggle-switch-sm {
    background-color: var(--brand-primary);
}

.toggle-control input:checked ~ .toggle-switch-sm::after {
    transform: translateX(14px);
}

.toggle-text-block-sm {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.toggle-title-sm {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.toggle-desc-sm {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    display: none;
}

@media (min-width: 1100px) {
    .toggle-desc-sm {
        display: block;
    }
}

/* Proofread Banner */
.proofread-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    background: linear-gradient(135deg, var(--brand-tint-subtle), var(--teal-tint-subtle));
    border: 1px solid var(--brand-tint-border);
    border-radius: var(--radius-md);
    padding: 0.875rem var(--space-5);
    margin-top: var(--space-4);
}

.proofread-banner-icon {
    color: var(--brand-text);
    flex-shrink: 0;
    margin-top: 2px;
}

.proofread-banner-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.proofread-banner-desc {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Structure & Review Report Banner */
.structure-report-banner {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.875rem var(--space-5);
    margin-top: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.structure-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.structure-report-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
}

.structure-icon {
    color: var(--brand-text);
    flex-shrink: 0;
}

.structure-report-heading {
    font-weight: 600;
    color: var(--text-primary);
}

.structure-report-summary {
    color: var(--text-secondary);
    font-weight: 500;
}

.structure-report-tags {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Pills: the one status/label family. .pill + a tone modifier
   (--neutral, --success, --warning, --error, --brand); every colour is a
   theme token, so pills follow the theme. Older names are aliases of the
   same declarations: .badge/.badge-success/.badge-neutral (result screen),
   .feature-soon-badge ("Soon") and .project-tab-count (tab counts). Text
   contrast on the tinted fills is at least 4.8:1 in both themes. */
.pill,
.badge,
.feature-soon-badge,
.project-tab-count {
    display: inline-block;
    white-space: nowrap;
    padding: 0.125rem var(--space-2);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
}

.pill-neutral,
.badge-neutral,
.feature-soon-badge,
.project-tab-count {
    background-color: var(--bg-card-subtle);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.pill-success,
.badge-success {
    background-color: var(--color-success-bg);
    border-color: var(--color-success-border);
    color: var(--success-text);
}

.pill-warning {
    background-color: var(--color-warning-bg);
    border-color: var(--color-warning-border);
    color: var(--warning-text);
}

.pill-error {
    background-color: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: var(--error-text);
}

.pill-brand {
    background-color: var(--brand-tint-subtle);
    border-color: var(--brand-tint-border);
    color: var(--brand-text);
}

/* The normal, finished state ("Ready", "Uploaded"): plain text, no pill,
   so only states that need attention carry colour (2026-10-27). */
.status-plain {
    white-space: nowrap;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

/* Compact pills: counts and "Soon". */
.pill-sm,
.feature-soon-badge,
.project-tab-count {
    padding: 0 0.375rem;
    font-size: var(--text-xs);
}

.feature-soon-badge {
    margin-left: var(--space-2);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
    line-height: 1.4;
}

/* Stat Badge Accent */
.stat-badge-accent {
    border-color: var(--brand-tint-border);
    background-color: var(--brand-tint-subtle);
}

.stat-badge-accent .stat-value {
    color: var(--brand-text);
}

/* Underline tabs: one look for the result preview's views (.view-tabs,
   buttons with role=tab) and the project/projects lists (.project-tabs,
   links with aria-current). The Convert | Translate control is a
   segmented .work-switch and pricing's Packs | Plans a pill switch
   (.pricing-tabs): different controls, different looks. */
.view-tabs,
.project-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.view-tab-btn,
.project-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: var(--space-2) 0.875rem;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--type-button);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.view-tab-btn:hover,
.project-tabs a:hover {
    color: var(--text-primary);
}

.view-tab-btn.active,
.view-tab-btn[aria-selected="true"],
.project-tabs a[aria-current] {
    color: var(--text-primary);
    font-weight: 600;
    border-bottom-color: var(--brand-primary);
}

.view-tab-btn:focus-visible,
.project-tabs a:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: -2px;
}

/* The result preview's tab row: tabs sit on the rule, the highlight
   switch on the right. */
.view-tabs-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.view-tabs-bar .highlight-checkbox-label {
    padding-bottom: var(--space-2);
}

.highlight-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

/* View Panes */
.view-pane {
    margin-top: var(--space-3);
}

.view-pane.hidden {
    display: none !important;
}

/* Highlighted Text Box */
.highlighted-text-box {
    width: 100%;
    min-height: 380px;
    height: 55vh;
    max-height: 700px;
    overflow-y: auto;
    padding: var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    outline: none;
}

/* Highlighted OCR Correction */
mark.ocr-correction {
    background-color: var(--highlight-bg);
    color: inherit;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
    border-bottom: 2px solid var(--color-warning);
    cursor: help;
    position: relative;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}

mark.ocr-correction:hover {
    background-color: var(--highlight-bg-hover);
    box-shadow: 0 0 8px var(--highlight-glow);
}

/* Text in a picture or stamp (scanning-error flags): marked, but apart. */
mark.ocr-correction.is-picture {
    background-color: transparent;
    border-bottom-style: dashed;
    font-weight: inherit;
}

.no-highlights mark.ocr-correction {
    background-color: transparent !important;
    border-bottom-color: transparent !important;
    font-weight: inherit !important;
}

/* The suggested correction after a highlighted token (js/app.js,
   renderSuggestionPreview()); hidden with the highlights. */
.ocr-suggestion {
    font-size: 0.8125em;
    font-weight: 600;
    color: var(--warning-text);
    margin-left: 0.15rem;
}

.no-highlights .ocr-suggestion {
    display: none;
}

/* Tables Container & Cards */
.tables-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--space-2) var(--space-1);
}

.table-card {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.table-card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.table-card-actions {
    display: flex;
    gap: 0.4rem;
}

.table-responsive-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Data tables: one look for every table of records -- the converter's
   table preview (.styled-table, built by js/app.js), the Dashboard-style
   tables (.dashboard-table: billing, team, usage, documents, activity,
   translation quote) and the plan comparison (.compare-table). A neutral
   header row on --bg-card-subtle in label type, 1px row rules. Each table
   keeps its own cell padding (density). */
.styled-table,
.dashboard-table,
.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-md);
    text-align: left;
}

.styled-table th,
.dashboard-table thead th,
.compare-table thead th,
.compare-table thead td {
    background-color: var(--bg-card-subtle);
    color: var(--text-secondary);
    font-size: var(--type-label);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.styled-table {
    background-color: var(--bg-card);
}

/* The preview's header cells are the document's own first row: content,
   so they keep the primary text colour. */
.styled-table th {
    color: var(--text-primary);
    padding: 0.65rem 0.875rem;
    white-space: nowrap;
}

.styled-table td {
    padding: 0.6rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: top;
}

.styled-table tr:last-child td {
    border-bottom: none;
}

.styled-table tr:hover td {
    background-color: var(--brand-tint-faint);
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .app-container {
        padding: var(--space-5) var(--space-3) var(--space-8);
    }

    .main-card {
        padding: var(--space-5);
    }

    .drop-zone {
        padding: var(--space-5) 0.875rem;
    }

    .flow-steps {
        gap: var(--space-1) 0.875rem;
        font-size: var(--text-sm);
    }

}

/* Post-demo sign-up prompt */
.demo-upsell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-4) var(--space-5);
    background-color: var(--accent-teal-bg);
    border: 1px solid var(--accent-teal);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: var(--text-primary);
}

.demo-upsell-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 16rem;
}

.demo-upsell-text span {
    color: var(--text-secondary);
}

/* Page picker thumbnails (rendered by pdf.js when available). Without the
   .with-thumbs class the picker stays the plain numbered list. */
.page-checkbox-caption {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.page-thumb {
    display: none;
}

.page-select-card .processing-desc {
    max-width: none;
}

.page-checkbox-list.with-thumbs {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    max-height: 560px;
}

.page-checkbox-list.with-thumbs .page-checkbox-item {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-2);
    border: 1px solid transparent;
    position: relative;
}

/* Magnifier on each thumbnail: opens the large preview (#page-preview). */
.page-zoom-btn {
    display: none;
}

.page-checkbox-list.with-thumbs .page-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background-color: var(--bg-card);
    color: var(--text-primary);
    cursor: zoom-in;
    box-shadow: var(--shadow-md);
}

.page-zoom-btn:hover {
    border-color: var(--brand-primary);
}

.page-preview {
    /* The global reset zeroes margins; a modal <dialog> centres by margin: auto. */
    margin: auto;
    width: min(920px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.page-preview::backdrop {
    background-color: var(--backdrop);
}

.page-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.page-preview-title {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0;
}

.page-preview-nav {
    display: flex;
    gap: var(--space-2);
}

.page-preview-body {
    display: flex;
    justify-content: center;
    padding: var(--space-4);
    overflow: auto;
    max-height: calc(100vh - 7rem);
    background-color: var(--bg-card-subtle);
}

.page-preview-body canvas {
    display: block;
    max-width: 100%;
    height: auto;
    background-color: var(--surface-paper);
    box-shadow: var(--shadow-lg);
}

.page-checkbox-list.with-thumbs .page-checkbox-item:has(input:checked) {
    border-color: var(--brand-primary);
    background-color: var(--bg-card);
}

.page-checkbox-list.with-thumbs .page-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 150px;
    min-height: 194px;
    margin: 0 auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.page-thumb canvas {
    display: block;
    width: 150px;
    height: auto;
}

.page-checkbox-list.with-thumbs .page-checkbox-caption {
    justify-content: center;
}

/* =========================================================================
   Shared site chrome (includes/PageChrome.php)
   ========================================================================= */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

/* The real checkbox is hidden behind the switch, so show focus on the switch. */
.toggle-control input:focus-visible ~ .toggle-switch,
.toggle-control input:focus-visible ~ .toggle-switch-sm {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    z-index: var(--z-skip);
    padding: var(--space-2) var(--space-4);
    background-color: var(--brand-primary);
    color: var(--on-brand);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 0.75rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background-color: color-mix(in srgb, var(--bg-page) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
}

.site-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

/* The wordmark (img/logo-light.svg / logo-dark.svg, PageChrome::logoMark()):
   one of the two shows, by the same theme selectors as the colour tokens. */
.site-logo {
    display: block;
    height: 28px;
    width: auto;
}

.site-logo-dark {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .site-logo-light {
        display: none;
    }

    :root:not([data-theme="light"]) .site-logo-dark {
        display: block;
    }
}

:root[data-theme="dark"] .site-logo-light {
    display: none;
}

:root[data-theme="dark"] .site-logo-dark {
    display: block;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1) var(--space-5);
    flex: 1;
    flex-wrap: wrap;
}

.site-nav-spacer {
    flex: 1;
}

.site-nav-link {
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.35rem 0;
}

.site-nav-link:hover,
.site-nav-link[aria-current="page"] {
    color: var(--text-primary);
}

.site-nav-link[aria-current="page"] {
    font-weight: 600;
}

/* Tablets and small laptops (the complement of min-width 1100px, above the
   760px fold): tighter gaps so the section links, Sign in and the sign-up
   button stay on one row. */
@media (min-width: 761px) and (max-width: 1099px) {
    .site-nav,
    .site-nav-sections {
        column-gap: var(--space-4);
    }
}

@media (max-width: 760px) {
    .site-header-inner {
        gap: var(--space-3);
        padding: 0.625rem var(--space-4);
    }

    .site-nav {
        gap: var(--space-1) 0.875rem;
        justify-content: flex-end;
    }

    .site-nav-spacer {
        display: none;
    }

    /* The section links fold behind "Menu" (js/nav.js) into a panel
       under the header. */
    .site-nav .site-nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        min-height: 44px;
        font: inherit;
        font-size: var(--text-md);
        font-weight: 600;
        color: var(--text-primary);
        background: none;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-full);
        padding: 0.3rem 0.8rem;
        cursor: pointer;
    }

    /* The header's sign-up button: touch height on phones (2026-10-27). */
    .site-nav > .btn {
        min-height: 44px;
    }

    .site-nav .site-nav-toggle[aria-expanded="true"] {
        background-color: var(--bg-card-subtle);
    }

    .site-nav .site-nav-sections {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0.15rem;
        padding: var(--space-2) var(--space-4) 0.875rem;
        background-color: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }

    .site-nav .site-nav-sections.is-open {
        display: flex;
    }

    .site-nav .site-nav-sections .site-nav-link {
        display: block;
        padding: var(--space-3) var(--space-2);
        border-radius: var(--radius-sm);
    }

    .site-nav .site-nav-sections .site-nav-link:hover {
        background-color: var(--bg-card-subtle);
    }
}

.site-nav-short {
    display: none;
}

/* Public header: section links inline on wide screens; the Menu toggle
   and the copy of "Sign in" inside the panel only appear on phones. */
.site-nav-toggle,
.site-nav-sections-signin {
    display: none;
}

.site-nav-sections {
    display: flex;
    align-items: center;
    gap: var(--space-1) var(--space-5);
}

/* The "Convert" menu in the public header (2026-10-29): a js/nav.js menu whose
   button looks like the other section links. Two-class selectors so they win
   over .app-menu-button, which comes later in this file. */
.site-nav .site-nav-menu-button {
    min-height: 0;
    padding: 0.35rem 0;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 0;
    border-radius: 0;
}

.site-nav .site-nav-menu-button:hover,
.site-nav .site-nav-menu-button[aria-expanded="true"],
.site-nav .site-nav-menu-button[data-current="true"] {
    color: var(--text-primary);
    background: none;
}

.site-nav .site-nav-menu-button[data-current="true"] {
    font-weight: 600;
}

.site-nav .site-nav-menu .app-menu-item[aria-current="page"] {
    font-weight: 600;
}

/* Inside the phone "Menu" panel the list opens in place, indented under
   its button, instead of floating over the page. */
@media (max-width: 760px) {
    .site-nav .site-nav-sections .site-nav-menu-button {
        display: flex;
        width: 100%;
        justify-content: center;
        padding: var(--space-3) var(--space-2);
        border-radius: var(--radius-sm);
    }

    .site-nav .site-nav-sections .site-nav-menu-button:hover {
        background-color: var(--bg-card-subtle);
    }

    /* The open list sits in its own tinted box with smaller type, so the
       links after it (Translate, Examples ...) don't read as more Convert
       items (2026-10-29). */
    .site-nav .site-nav-menu .app-menu-panel {
        position: static;
        min-width: 0;
        max-width: none;
        margin: var(--space-1) 0 var(--space-2);
        padding: var(--space-1) 0;
        border: 0;
        border-radius: var(--radius-md);
        box-shadow: none;
        background-color: var(--bg-card-subtle);
    }

    .site-nav .site-nav-menu .app-menu-item {
        justify-content: center;
        transform: none;
        font-size: var(--text-md);
    }
}

@media (max-width: 480px) {
    .site-nav-long {
        display: none;
    }

    .site-nav-short {
        display: inline;
    }

    /* Menu keeps its name for screen readers; the word itself hides. */
    .site-nav .site-nav-toggle {
        padding: 0.3rem 0.65rem;
    }

    .site-nav .site-nav-toggle span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* Room for Menu + Sign up at 320 px: Sign in moves into the panel. */
    .site-nav .site-nav-signin {
        display: none;
    }

    .site-nav .site-nav-sections .site-nav-sections-signin {
        display: block;
    }
}

@media (max-width: 340px) {
    .site-header .site-logo {
        height: 22px;
    }
}

/* Touch-sized tap targets on small screens (at least ~40px tall). */
@media (max-width: 640px) {
    .site-nav-link {
        display: inline-block;
        padding: 0.6rem 0;
    }

    .site-footer-links {
        gap: 0;
    }

    .site-footer-links a {
        display: inline-block;
        padding: 0.55rem 0;
    }

    .theme-switch button {
        min-height: 2.5rem;
        padding: 0.4rem 0.85rem;
    }
}

.site-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    padding: var(--space-10) var(--space-5) var(--space-6);
    margin-top: auto;
}

.site-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-8);
}

/* With the "Convert" column (signed out, 2026-10-29): four columns. */
.site-footer-inner:has(> :nth-child(4)) {
    grid-template-columns: 2fr 1fr 1fr 1fr;
}

.site-footer-brand p {
    margin-top: var(--space-3);
    font-size: var(--text-md);
    color: var(--text-secondary);
    max-width: 22rem;
}

.site-footer-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.site-footer-heading {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.site-footer-links a {
    font-size: var(--text-md);
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer-links a:hover {
    color: var(--brand-text);
    text-decoration: underline;
}

.site-footer-bottom {
    max-width: 1120px;
    margin: var(--space-8) auto 0;
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-6);
}

.site-footer-copy {
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.theme-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0.2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background-color: var(--bg-page);
}

.theme-switch[hidden] {
    display: none;
}

.theme-switch-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: 0 0.4rem 0 0.6rem;
}

.theme-switch button {
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: 0;
    border-radius: var(--radius-full);
    padding: 0.3rem var(--space-3);
    cursor: pointer;
}

.theme-switch button:hover {
    color: var(--text-primary);
}

.theme-switch button[aria-pressed="true"] {
    background-color: var(--bg-card-subtle);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
    .site-footer-inner,
    .site-footer-inner:has(> :nth-child(4)) {
        grid-template-columns: 1fr 1fr;
    }

    .site-footer-brand {
        grid-column: 1 / -1;
    }
}

/* =========================================================================
   Converter page
   ========================================================================= */

.converter-heading {
    font-size: var(--type-page-title);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Hidden while a conversion runs (js/app.js setFlowStep()); display:flex
   on .flow-steps would otherwise override the hidden attribute. */
.flow-steps[hidden] {
    display: none;
}

/* Signed in (an internal screen): the step indicator is left-aligned; the
   drop zone itself stays centred. The signed-out landing keeps its centred
   hero layout. */
.app-container:not(.is-landing) .flow-steps {
    justify-content: flex-start;
}

/* Under the upload area (signed in): one privacy line and a small Help
   disclosure with the troubleshooting, folded so the first screen stays
   about choosing a file. */
.upload-footnote {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.upload-footnote .upload-privacy-note {
    margin: 0;
    text-align: left;
}

.upload-help > summary {
    cursor: pointer;
    color: var(--brand-text);
    text-decoration: underline;
}

.upload-help[open] {
    flex-basis: 100%;
}

.upload-help-list {
    margin: 0.6rem 0 0;
    padding: var(--space-3) var(--space-4) var(--space-3) var(--space-8);
    font-size: var(--text-md);
    text-align: left;
    line-height: 1.55;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card-subtle);
}

.upload-help-list li + li {
    margin-top: 0.35rem;
}

/* Before converting: file, selection, pages needed, balance after. */
.conversion-summary {
    margin-top: var(--space-4);
    padding: 0.85rem var(--space-4);
    text-align: left;
}

.conversion-summary-file {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
}

.conversion-summary-name {
    min-width: 0;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.conversion-summary-meta {
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.conversion-summary-file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-left: 0;
    flex-basis: 100%;
}

.conversion-summary-figures {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    margin: var(--space-3) 0 0;
}

.conversion-summary-figures dt {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
}

.conversion-summary-figures dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.conversion-summary-figures dd.is-short {
    color: var(--error-text);
}

@media (max-width: 600px) {
    .conversion-summary-figures {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .conversion-summary-file-actions {
        margin-left: 0;
    }
}

.converter-card {
    scroll-margin-top: 5rem;
}

/* Settings folded under "Advanced options" so a first visit is just
   "choose a file, convert". */
.advanced-options {
    margin-top: var(--space-5);
}

.advanced-options > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: 0.875rem var(--space-5);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

.advanced-options > summary::-webkit-details-marker {
    display: none;
}

.advanced-options > summary::after {
    content: '';
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.advanced-options[open] > summary::after {
    transform: rotate(-135deg);
}

.advanced-options-summary-hint {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: var(--text-md);
    margin-left: auto;
}

.advanced-options-body {
    padding: 0 var(--space-5) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.advanced-options-body .proofread-option-card {
    margin-top: 0;
    background-color: var(--bg-card);
}

/* Progress steps */
.processing-steps {
    list-style: none;
    display: flex;
    gap: var(--space-2);
    margin: var(--space-1) 0;
    flex-wrap: wrap;
    justify-content: center;
}

.processing-steps li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--text-md);
    color: var(--text-muted);
    padding: 0.3rem var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.processing-steps li::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: var(--border-strong);
}

.processing-steps li.is-active {
    color: var(--text-primary);
    border-color: var(--brand-primary);
    font-weight: 600;
}

.processing-steps li.is-active::before {
    background-color: var(--brand-primary);
}

.processing-steps li.is-done {
    color: var(--text-secondary);
}

.processing-steps li.is-done::before {
    background-color: var(--color-success);
}

.processing-estimate {
    font-size: var(--text-md);
    color: var(--text-secondary);
}

/* Result header: one obvious download, everything else secondary */
.result-summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.result-ready-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.result-ready-title {
    font-size: var(--type-state-title);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.result-ready-sub {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.result-secondary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.btn-ghost {
    background: none;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled):not([aria-disabled="true"]) {
    color: var(--text-primary);
    background-color: var(--bg-card-subtle);
    border-color: var(--border-color);
}

.result-layout-options {
    margin-top: 0;
}

.result-layout-options .advanced-options-body {
    flex-direction: row;
    flex-wrap: wrap;
}

.result-layout-options .export-setting-pill {
    flex: 1 1 18rem;
    padding: 0.625rem 0.875rem;
    background-color: var(--bg-card);
}

.result-layout-options .toggle-desc-sm {
    display: block;
}

.result-layout-options .toggle-title-sm {
    white-space: normal;
}

.result-layout-note {
    flex-basis: 100%;
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.result-accuracy-note {
    font-size: var(--text-md);
    color: var(--text-secondary);
    margin-top: var(--space-4);
}

@media (max-width: 640px) {
    .result-ready-row .btn-lg {
        width: 100%;
    }

    .result-secondary-actions .btn {
        flex: 1 1 auto;
    }

    .action-bar .btn-lg {
        width: 100%;
    }
}

/* =========================================================================
   Landing page (anonymous visitors)
   ========================================================================= */

.hero {
    text-align: center;
    padding: var(--space-1) 0 0;
}

.hero-title {
    font-size: clamp(1.75rem, 4.2vw, 2.625rem);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.03em;
    max-width: 24ch;
    margin: 0 auto;
}

.hero-sub {
    font-size: clamp(1rem, 1.8vw, 1.1875rem);
    color: var(--text-secondary);
    max-width: 40rem;
    margin: 0.625rem auto 0;
    line-height: 1.5;
}

.landing-section {
    padding: var(--space-12) 0 0;
    scroll-margin-top: 4.5rem;
}

.section-title {
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    text-align: center;
}

.section-sub {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    text-align: center;
    max-width: 40rem;
    margin: 0.625rem auto 0;
}

/* A real conversion (index.php #example): the scan and Word's rendering of
   the result, side by side, then the table close up. The images are white
   pages, so they keep a border in both themes. */
.example-pair {
    margin-top: 1.75rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

.example-figure {
    margin: 0;
}

.example-figure img {
    display: block;
    width: 100%;
    height: auto;
    background-color: var(--surface-paper);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.example-figure figcaption {
    margin-top: var(--space-2);
    font-size: var(--text-base);
    color: var(--text-secondary);
    text-align: center;
}

.example-subtitle {
    font-size: var(--text-lg);
    font-weight: 700;
    text-align: center;
    margin-top: var(--space-8);
}

.example-closeups {
    max-width: 760px;
    margin: var(--space-4) auto 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.example-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
    max-width: 880px;
    margin: var(--space-8) auto 0;
}

.example-notes-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: 700;
}

.example-notes-title svg {
    flex-shrink: 0;
    color: var(--success-text);
}

.example-notes-title-muted svg {
    color: var(--text-secondary);
}

.example-notes ul {
    margin: 0.625rem 0 0;
    padding-left: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text-secondary);
}

.example-downloads {
    margin-top: var(--space-6);
    text-align: center;
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.example-downloads-note {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-md);
}

/* Home page pricing teaser (2026-10-29): the cards are on pricing.php. */
.pricing-teaser {
    text-align: center;
}

.pricing-teaser > .btn {
    margin-top: var(--space-5);
}

/* Translate page (translate.php) and the pricing page's translation rates
   (2026-10-29). */
.translate-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin: var(--space-6) 0 0;
}

.translate-rates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--space-4);
    max-width: 44rem;
    margin: var(--space-6) auto 0;
}

.translate-rate {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    text-align: center;
    color: var(--text-secondary);
}

.translate-rate-amount {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.translate-languages .language-list {
    display: block;
    columns: 4 11rem;
    column-gap: var(--space-6);
    list-style: none;
    padding-left: 0;
}

.translate-languages .language-list li {
    margin-bottom: 0.35rem;
    break-inside: avoid;
}

/* Link to compare.php under the example (2026-10-29). */
.example-compare {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-3) var(--space-5);
    max-width: 52rem;
    margin: var(--space-8) auto 0;
    padding: var(--space-5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    text-align: center;
}

.example-compare p {
    margin: 0;
    color: var(--text-secondary);
    font-size: var(--text-base);
}

.example-compare p strong {
    color: var(--text-primary);
}

/* How it works: three numbered steps in a row, no cards. */
.steps-list {
    list-style: none;
    margin: var(--space-6) 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
}

.steps-list li {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.steps-list h3 {
    font-size: var(--text-lg);
    font-weight: 700;
}

.steps-list p {
    margin-top: var(--space-1);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text-secondary);
}

.step-number {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: var(--brand-primary-glow);
    color: var(--brand-text);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 760px) {
    .steps-list,
    .example-notes,
    .guide-pair {
        grid-template-columns: 1fr;
    }

    .steps-list {
        gap: var(--space-4);
    }
}

@media (max-width: 480px) {
    .example-pair {
        gap: var(--space-3);
    }

    .example-figure figcaption {
        font-size: var(--text-md);
    }

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

.pricing-grid {
    display: grid;
    gap: var(--space-4);
    margin-top: var(--space-5);
}

/* Pricing */
.pricing-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 238px));
    justify-content: center;
}

/* Pricing is split into "Pay as you go" and "Monthly plans" groups. */
.pricing-group-title {
    font-size: var(--text-lg);
    font-weight: 700;
    text-align: center;
    margin: var(--space-10) 0 0;
}

.pricing-group-sub {
    font-size: var(--text-base);
    color: var(--text-secondary);
    text-align: center;
    max-width: 38rem;
    margin: 0.35rem auto 0;
}

.pricing-group-sub + .pricing-grid {
    margin-top: var(--space-5);
}

.price-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}

.price-card-featured {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary), var(--shadow-lg);
}

.price-badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--on-brand);
    background-color: var(--brand-primary);
    padding: 0.2rem var(--space-3);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.price-name {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--text-secondary);
}

.price-amount {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.price-detail {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.price-per-page {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--success-text);
}

.price-spacer {
    flex: 1;
    min-height: 0.75rem;
}

.pricing-footnote {
    text-align: center;
    font-size: var(--text-md);
    color: var(--text-secondary);
    margin-top: var(--space-5);
}

/* Complicated layouts (index.php #complex-layouts): one card per topic.
   A published guide's card is clickable as a whole through its heading
   link; an unpublished one is plain information. */
.topic-grid {
    list-style: none;
    margin: 1.75rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.topic-card {
    position: relative;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.125rem var(--space-5);
}

.topic-card h3 {
    font-size: var(--text-lg);
    font-weight: 700;
}

.topic-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
}

.topic-card h3 a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
}

.topic-card h3 a:focus-visible {
    outline: none;
}

.topic-card h3 a:focus-visible::after {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.topic-card-linked:hover {
    border-color: var(--brand-primary);
}

.topic-card p {
    margin-top: 0.35rem;
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text-secondary);
}

.topic-card-more {
    display: inline-block;
    margin-top: var(--space-2);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--brand-text);
}

/* An unpublished guide's card: plain text, so it doesn't look like a link. */
.topic-card-soon {
    display: inline-block;
    margin-top: var(--space-2);
    font-size: var(--text-md);
    color: var(--text-muted);
}

/* Three cards in a row (index.php benefits and use cases, 2026-10-29). */
.topic-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
    .topic-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Under the converter on the home page (2026-10-29, homepage audit): the
   proof line and the hero's second link, both quiet next to the main button. */
.hero-follow {
    max-width: 44rem;
    margin: var(--space-4) auto 0;
    text-align: center;
    font-size: var(--text-md);
    line-height: 1.5;
    color: var(--text-secondary);
}

.hero-team {
    margin-top: var(--space-2);
    font-weight: 600;
}

.hero-team-note {
    font-weight: 400;
    color: var(--text-muted);
}

/* Published guides under the use-case cards (index.php #complex-layouts). */
.usecase-guides {
    margin-top: var(--space-4);
    text-align: center;
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.good-to-know {
    max-width: 880px;
    margin: 1.75rem auto 0;
}

.good-to-know-title {
    font-size: var(--text-base);
    font-weight: 700;
}

.good-to-know ul {
    margin: var(--space-2) 0 0;
    padding-left: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text-secondary);
}

.good-to-know strong {
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .topic-grid {
        grid-template-columns: 1fr;
    }
}

/* Guides (public/guides/index.php): an article column with figures. */
.guide-page {
    max-width: 52rem;
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem var(--space-5) 3.5rem;
}

/* Breadcrumbs (PageChrome::breadcrumbs(); were guide-only until 2026-10-29). */
.breadcrumb {
    margin-bottom: var(--space-4);
}

.breadcrumb ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.breadcrumb li + li::before {
    content: '\203A';
    margin-right: 0.35rem;
}

.breadcrumb a,
.guide-article a:not(.btn),
.guide-list a {
    color: var(--brand-text);
    text-underline-offset: 0.15em;
}

.guide-list h2 a {
    text-decoration: none;
}

.guide-list h2 a:hover {
    text-decoration: underline;
}

.guide-header {
    margin-top: var(--space-4);
}

.guide-title {
    font-size: clamp(1.75rem, 4vw, 2.375rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.guide-dates {
    margin-top: var(--space-2);
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.guide-lead {
    margin-top: var(--space-5);
    font-size: var(--text-lg);
    line-height: 1.6;
    color: var(--text-secondary);
}

.guide-article h2,
.guide-list h2 {
    font-size: 1.375rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    margin-top: 2.25rem;
}

.guide-article h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-top: 1.75rem;
}

.guide-article p,
.guide-article li {
    font-size: var(--text-base);
    line-height: 1.65;
}

.guide-article > p,
.guide-article ul {
    margin-top: var(--space-3);
}

.guide-article ul {
    padding-left: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.guide-checklist li::marker {
    color: var(--success-text);
}

.guide-checklist-fix li::marker {
    color: var(--warning-text);
}

.guide-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.guide-figure {
    margin: var(--space-4) 0 0;
}

.guide-figure img {
    display: block;
    width: 100%;
    height: auto;
    background-color: var(--surface-paper);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.guide-pair .guide-figure {
    margin-top: 0;
}

.guide-figure figcaption {
    margin-top: var(--space-2);
    font-size: var(--text-md);
    color: var(--text-secondary);
    text-align: center;
}

.guide-downloads {
    margin-top: var(--space-8);
    padding: var(--space-4) var(--space-5);
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
}

.guide-downloads-note {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-md);
    color: var(--text-secondary);
}

/* How public pages end (PageChrome::pageEnding(), 2026-10-29): two related
   links, then the call-to-action band. */
.page-related {
    margin-top: 3.5rem;
}

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

.page-related .topic-grid {
    margin-top: var(--space-4);
}

.page-related + .cta-band {
    margin-top: var(--space-8);
}

.guide-list {
    list-style: none;
    margin: var(--space-4) 0 0;
    padding: 0;
}

.guide-list li {
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--border-color);
}

.guide-list h2 {
    margin-top: 0;
    font-size: var(--text-xl);
}

.guide-list p {
    margin-top: 0.35rem;
    color: var(--text-secondary);
}

.guide-draft-banner {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 2px dashed var(--color-warning);
    border-radius: var(--radius-md);
    color: var(--warning-text);
    font-size: var(--text-md);
}

@media (max-width: 480px) {
    .guide-pair {
        gap: 0.625rem;
    }

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

/* The free trial, apart from the paid choices. */
.free-trial-band {
    margin: 1.75rem auto 0;
    max-width: 880px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4) var(--space-6);
    flex-wrap: wrap;
    padding: 1.125rem var(--space-6);
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.free-trial-band > div {
    flex: 1 1 22rem;
}

.free-trial-title {
    font-size: var(--text-lg);
    font-weight: 700;
}

.free-trial-band p {
    margin-top: var(--space-1);
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* Page packs / Monthly plans switch (js/landing.js). Without JavaScript
   the tab bar stays hidden and both groups show with their headings. */
.pricing-switch {
    margin-top: var(--space-8);
}

.pricing-tabs {
    display: flex;
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
    padding: var(--space-1);
    gap: var(--space-1);
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
}

.pricing-tabs[hidden] {
    display: none;
}

.pricing-tabs button {
    font: inherit;
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: 0;
    border-radius: var(--radius-full);
    padding: var(--space-2) 1.125rem;
    min-height: 2.5rem;
    cursor: pointer;
}

.pricing-tabs button:hover {
    color: var(--text-primary);
}

.pricing-tabs button[aria-selected="true"] {
    color: var(--text-primary);
    background-color: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.pricing-tabs button:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.pricing-panel[hidden] {
    display: none;
}

/* With the tabs showing, each group's heading would repeat the tab name. */
.pricing-switch.is-switchable .pricing-group-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.pricing-switch.is-switchable .pricing-group-sub {
    margin-top: var(--space-4);
}

.compare-details {
    max-width: 880px;
    margin: 1.75rem auto 0;
}

.compare-details > summary {
    width: fit-content;
    margin: 0 auto;
    cursor: pointer;
    font-weight: 600;
    color: var(--brand-text);
    padding: var(--space-2) var(--space-1);
}

.compare-details[open] > summary {
    margin-bottom: var(--space-3);
}

/* FAQ */
.faq-list {
    max-width: 46rem;
    margin: var(--space-8) auto 0;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.faq-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.faq-item summary {
    cursor: pointer;
    list-style: none;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-base);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: var(--text-xl);
    line-height: 1;
    color: var(--text-secondary);
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item p {
    padding: 0 var(--space-5) 1.1rem;
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: 1.6;
}

.cta-band {
    margin-top: 3.5rem;
    padding: var(--space-10) var(--space-6);
    border-radius: var(--radius-lg);
    text-align: center;
    background: var(--brand-gradient);
    color: var(--on-brand);
}

.cta-band h2 {
    font-size: clamp(1.375rem, 3vw, 1.875rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.cta-band p {
    margin-top: var(--space-2);
    font-size: var(--text-lg);
    opacity: 0.92;
}

.cta-band .btn {
    margin-top: var(--space-5);
    background-color: var(--on-brand-button-bg);
    color: var(--on-brand-button-text);
}

.cta-band .btn:hover {
    background-color: var(--on-brand-button-bg-hover);
}

/* Wider container on the landing page so sections can breathe; the
   converter card itself stays at its own comfortable width. */
.app-container.is-landing {
    max-width: 1040px;
}

.app-container.is-landing .converter-card {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
}

/* =========================================================================
   Legal / content pages
   ========================================================================= */

.prose-page {
    max-width: 46rem;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-10) var(--space-5) 3.5rem;
}

.prose-page h1 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.prose-updated {
    margin-top: var(--space-2);
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.prose-page h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-top: var(--space-8);
}

.prose-page p,
.prose-page li {
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-secondary);
}

.prose-page p {
    margin-top: var(--space-3);
}

.prose-page ul {
    margin: var(--space-3) 0 0 var(--space-5);
}

.prose-page li + li {
    margin-top: 0.35rem;
}

.prose-page strong {
    color: var(--text-primary);
}

.prose-page a {
    color: var(--brand-text);
    font-weight: 600;
}

/* Headings receive focus programmatically when a step appears (app.js
   showSection); the focus move is for screen readers, not a visible ring. */
h2[tabindex="-1"]:focus,
[role="heading"][tabindex="-1"]:focus {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .spinner {
        animation-duration: 2.5s;
    }

    .btn-primary:hover:not(:disabled),
    .drop-zone.drag-over {
        transform: none;
    }
}

/* ---- SaaS UX pass (2026-10-18) ---- */

/* Plan comparison table (Pricing::comparisonTable()). Scrolls inside its
   own box on narrow screens, so the page itself never scrolls sideways. */
.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
}

.table-scroll:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.compare-table {
    min-width: 560px;
}

.compare-table th,
.compare-table td {
    padding: 0.65rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.compare-table tbody th {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td {
    border-bottom: 0;
}

/* First-visit tip on the page picker */
.page-select-hint {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-3) 0;
    padding: 0.65rem 0.9rem;
    font-size: var(--text-md);
    color: var(--text-primary);
    background-color: var(--accent-teal-bg);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-teal);
    border-radius: var(--radius-md);
    text-align: left;
}

.page-select-hint p {
    margin: 0;
}

.page-select-hint .btn {
    flex-shrink: 0;
}

/* "Did this come out right?" under a result */
.result-feedback {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-color);
}

.result-feedback-ask {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.result-feedback-question {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: var(--space-1);
}

.result-feedback-more {
    display: grid;
    gap: var(--space-2);
    max-width: 36rem;
}

.result-feedback-more .btn {
    justify-self: start;
}

.result-feedback-note {
    width: 100%;
    resize: vertical;
    font: inherit;
}

.result-feedback-status {
    margin: 0 0 var(--space-2);
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.result-feedback-status:empty {
    display: none;
}

/* Phone-width check (2026-10-18). */
.page-select-hint {
    flex-wrap: wrap;
}

.page-select-hint p {
    flex: 1 1 14rem;
}

@media (max-width: 640px) {
    /* The picker sits inside the converter card, which already has its
       own padding: don't pad it twice on a phone. */
    .page-select-card {
        padding: var(--space-5) 0;
    }

    /* "Did this come out right?" on its own line, Yes / No together below. */
    .result-feedback-question {
        flex-basis: 100%;
    }

    .advanced-options-summary-hint {
        display: none;
    }

    /* A button holding an email address may need to wrap on small phones. */
    .prose-page .btn {
        white-space: normal;
        overflow-wrap: anywhere;
        max-width: 100%;
    }
}

/* ===================================================================
   Signed-in app header and compact footer (2026-10-19,
   includes/PageChrome.php, js/nav.js):
   Logo | Convert | Dashboard ........ Workspace v | N pages left | Avatar v
   =================================================================== */

.site-header-app .site-header-inner {
    gap: var(--space-4);
}

.app-nav-toggle {
    display: none;
}

.app-primary-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.app-nav-link {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.45rem var(--space-3);
    border-radius: var(--radius-sm);
}

.app-nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-subtle);
}

/* Active destination: a tinted background (not colour alone: also bold). */
.app-nav-link[aria-current="page"] {
    color: var(--brand-text);
    font-weight: 600;
    background-color: color-mix(in srgb, var(--brand-primary) 12%, transparent);
}

.app-header-tools {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.app-menu {
    position: relative;
    min-width: 0;
}

.app-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
    min-height: 2.25rem;
    font: inherit;
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.3rem var(--space-3);
    cursor: pointer;
}

.app-menu-button:hover,
.app-menu-button[aria-expanded="true"] {
    background-color: var(--bg-card-subtle);
}

.app-menu-button[data-current="true"] {
    border-color: var(--brand-primary);
}

.app-icon {
    flex-shrink: 0;
}

.app-icon-chevron {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.app-menu-button[aria-expanded="true"] .app-icon-chevron {
    transform: rotate(180deg);
}

.app-workspace-button {
    /* Never wider than its menu, which shrinks when the header is
       crowded (a plain 16rem overrode .app-menu-button's 100% and let a
       long workspace name spill past the edge at ~780 px). */
    max-width: min(16rem, 100%);
    font-weight: 500;
    border-color: transparent;
}

.app-workspace-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The page balance (PageChrome::balanceStatus()): plain text, not a
   control. When it is low, buyers get a small "Add pages" link beside it. */
.app-balance-status {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-2);
    white-space: nowrap;
}

.app-balance-text {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.app-balance-add {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--brand-text);
    text-decoration: underline;
}

.app-balance-add[hidden] {
    display: none;
}

.app-avatar-button {
    padding: 0.15rem var(--space-2) 0.15rem 0.15rem;
    border-color: transparent;
}

.app-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: var(--avatar-bg);
    color: var(--avatar-text);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-avatar-lg {
    width: 2.5rem;
    height: 2.5rem;
    font-size: var(--text-md);
}

/* Dropdown panels */
.app-menu-panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    z-index: var(--z-dropdown);
    min-width: 15rem;
    max-width: min(20rem, calc(100vw - 2rem));
    padding: 0.35rem;
    text-align: left;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.app-menu-panel[hidden] {
    display: none;
}

.app-menu-panel-start {
    left: 0;
}

.app-menu-panel-end {
    right: 0;
}

.app-menu-up .app-menu-panel {
    top: auto;
    bottom: calc(100% + 0.4rem);
}

.app-menu-heading {
    margin: 0;
    padding: 0.45rem 0.7rem 0.2rem;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
}

.app-menu-form {
    margin: 0;
}

.app-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: 2.5rem;
    padding: var(--space-2) 0.7rem;
    font: inherit;
    font-size: var(--text-md);
    color: var(--text-primary);
    text-align: left;
    text-decoration: none;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.app-menu-item:hover:not(:disabled),
.app-menu-item:focus-visible {
    background-color: var(--bg-card-subtle);
}

.app-menu-item:disabled,
.app-menu-item[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
}

.app-menu-item-current {
    cursor: default;
}

.app-menu-item-current:hover {
    background: none;
}

.app-menu-item-current .app-icon-check {
    color: var(--brand-text);
}

.app-menu-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-menu-item-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.app-menu-item-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.app-menu-separator {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 0.35rem 0;
}

.app-menu-note {
    margin: 0;
    padding: 0.45rem 0.7rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.app-menu-identity {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.7rem;
}

.app-menu-identity-email {
    min-width: 0;
    font-size: var(--text-md);
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.app-menu-theme {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem var(--space-2);
}

.app-menu-theme-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.theme-switch-compact {
    display: flex;
}

.theme-switch-compact[hidden] {
    display: none;
}

.theme-switch-compact button {
    flex: 1;
}

/* Sign out: a neutral item, kept apart at the bottom by its separator
   (was red, which read as a warning). */
.app-menu-signout {
    color: var(--text-secondary);
}

.app-menu-signout:hover,
.app-menu-signout:focus-visible {
    color: var(--text-primary);
}

/* Compact footer on signed-in pages: after the content (body is a flex
   column and the footer has margin-top: auto, so on short pages it sits
   at the bottom of the window without covering anything). */
.site-footer-compact {
    padding: 0.9rem var(--space-5);
    background-color: transparent;
}

.site-footer-compact-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1) var(--space-6);
}

.site-footer-compact-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) 0.6rem;
}

.site-footer-compact-links > :not(:first-child)::before {
    content: "\00B7";
    margin-right: 0.6rem;
    color: var(--text-muted);
}

.site-footer-compact-link,
.site-footer-compact .app-menu-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 2.25rem;
    padding: var(--space-1) 0.15rem;
    font: inherit;
    font-size: var(--text-md);
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: 0;
    border-radius: var(--radius-sm);
}

.site-footer-compact-link:hover,
.site-footer-compact .app-menu-button:hover,
.site-footer-compact .app-menu-button[aria-expanded="true"] {
    color: var(--text-primary);
    background: none;
    text-decoration: underline;
}

.site-footer-compact .app-menu {
    display: inline-flex;
    align-items: center;
}

/* Tablets and phones: the two destinations fold behind "Menu"; the
   workspace, balance and account controls stay visible. Not sticky here,
   so the header never covers the page. */
@media (max-width: 760px) {
    .site-header-app {
        position: relative;
    }

    .site-header-app .site-header-inner {
        flex-wrap: wrap;
        row-gap: var(--space-2);
    }

    .site-header-app .site-brand {
        order: 1;
    }

    .app-nav-toggle {
        order: 2;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        min-height: 2.5rem;
        font: inherit;
        font-size: var(--text-md);
        font-weight: 600;
        color: var(--text-primary);
        background: none;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-full);
        padding: 0.3rem 0.8rem;
        cursor: pointer;
    }

    .app-nav-toggle[aria-expanded="true"] {
        background-color: var(--bg-card-subtle);
    }

    .app-header-tools {
        order: 3;
    }

    .app-primary-nav {
        order: 4;
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: var(--space-1) 0 0.35rem;
        border-top: 1px solid var(--border-color);
    }

    .app-primary-nav.is-open {
        display: flex;
    }

    .app-nav-link {
        padding: 0.7rem var(--space-3);
    }

    .app-menu-button {
        min-height: 2.5rem;
    }

    /* Touch-sized target for the contextual Add pages link. */
    .app-balance-add {
        display: inline-flex;
        align-items: center;
        min-height: 2.5rem;
    }
}

/* Phones: balance, workspace and account on their own row. */
@media (max-width: 600px) {
    .app-nav-toggle {
        margin-left: auto;
    }

    .app-header-tools {
        flex-basis: 100%;
        margin-left: 0;
    }

    /* Shrinks (and truncates a long name) but no longer grows to fill the
       row, which made it the largest thing in the header. */
    .app-header-tools > .app-workspace-menu {
        flex: 0 1 auto;
        /* It now sits mid-row (after the balance), so its panel spans the
           row instead of hanging off the button past the right edge. */
        position: static;
    }

    .app-workspace-menu .app-menu-panel {
        left: 0;
        right: 0;
        max-width: none;
    }

    .app-workspace-button {
        max-width: 100%;
    }

    .app-header-tools > .app-menu:last-child {
        flex-shrink: 0;
    }

    .app-menu-panel {
        min-width: min(15rem, calc(100vw - 2rem));
    }

    /* The balance never shrinks under its text: the workspace name
       truncates instead. */
    .app-header-tools > .app-balance-status {
        flex-shrink: 0;
    }
}

/* Very narrow phones: give the workspace name more room. */
@media (max-width: 380px) {
    .app-header-tools {
        gap: var(--space-1);
    }

    .app-avatar-button .app-icon-chevron {
        display: none;
    }

    .app-avatar-button {
        padding-right: 0.15rem;
    }

    .app-balance-status {
        gap: 0.35rem;
    }

    .app-workspace-button {
        min-width: 5.5rem;
        padding-left: 0.6rem;
        padding-right: var(--space-2);
    }
}

/* ===== Several files (2026-10-20): the upload step's list and the queue
   step (index.php #file-list-card, #queue-section; js/app.js). ===== */
.file-list-card {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-4);
}

.file-list-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.file-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.375rem 0;
    border-top: 1px solid var(--border-color);
}

.file-list-item:first-child {
    border-top: 0;
}

.file-list-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.file-list-name,
.queue-item-name {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-card {
    padding: var(--space-6) var(--space-1) var(--space-2);
}

.queue-head {
    margin-bottom: var(--space-4);
}

.queue-desc {
    margin-top: 0.375rem;
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.queue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* File | Pages | Status | Actions */
.queue-item {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.1fr) auto;
    align-items: center;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-color);
}

.queue-item:first-child {
    border-top: 0;
}

.queue-item-file {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.queue-item-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.queue-item-detail,
.queue-item-hint,
.queue-status-note {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.queue-item-pages {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-1) var(--space-2);
    min-width: 0;
}

.queue-item-pages .page-range-input {
    max-width: none;
    width: 100%;
    min-width: 0;
    font-size: var(--text-md);
    padding: 0.375rem 0.625rem;
}

.queue-item-pages .page-range-input:disabled {
    background-color: var(--bg-card-subtle);
    color: var(--text-secondary);
}

.queue-item-hint {
    grid-column: 2;
}

.queue-item-status {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.queue-status-text {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.queue-item[data-state="done"] .queue-status-text {
    color: var(--success-text);
}

.queue-item[data-state="invalid"] .queue-status-text,
.queue-item[data-state="failed"] .queue-status-text {
    color: var(--error-text);
}

.queue-item[data-state="stalled"] .queue-status-text {
    color: var(--warning-text);
}

.queue-item[data-state="skipped"] .queue-status-text,
.queue-item[data-state="waiting"] .queue-status-text,
.queue-item[data-state="queued"] .queue-status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.queue-item[data-state="converting"],
.queue-item[data-state="sending"] {
    background-color: var(--bg-card-subtle);
}

.queue-item-actions {
    display: flex;
    gap: var(--space-1);
    justify-content: flex-end;
    white-space: nowrap;
}

.queue-totals {
    margin-top: var(--space-4);
}

.queue-progress {
    margin-top: var(--space-3);
    font-size: var(--text-md);
    color: var(--text-primary);
}

#queue-section .page-select-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* A refused file has no pages to choose. */
.queue-item[data-state="invalid"] .queue-item-pages {
    visibility: hidden;
}

/* Phones and narrow cards: each file becomes a small card, stacked so
   the file name keeps the full width: file, pages, status, buttons. */
@media (max-width: 760px) {
    .queue-item {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-2);
    }

    .queue-item[data-state="invalid"] .queue-item-pages {
        display: none;
    }

    .queue-item-actions {
        justify-content: flex-start;
    }

    .queue-item-actions:not(:has(.btn:not(.hidden))) {
        display: none;
    }
}

/* Crowded desktop header (three links + a long workspace name, ~760-1000
   px): links and the avatar keep their size; the workspace name is the
   part that shrinks (and truncates). */
.app-primary-nav {
    flex-shrink: 0;
}

.app-nav-link {
    white-space: nowrap;
}

.app-header-tools > .app-workspace-menu {
    flex: 0 1 auto;
    min-width: 2.5rem;
}

.app-header-tools > .app-balance-status,
.app-header-tools > .app-menu:last-child {
    flex-shrink: 0;
}

/* Wider signed-in pages on desktop (user request 2026-10-20). The
   Dashboard-style pages (account.css .dashboard-page) now line up with the
   header's content (1120 px, 1.25rem sides); the converter grows by the
   same 160 px. Reading pages (.prose-page) keep their narrower measure.
   2026-10-23: the converter (signed in, and the landing page) now uses the
   header's own box too -- 1120 px with 1.25rem sides -- so every page's
   content edge lines up with the logo and the avatar (it was 1040 px with
   1rem sides, 36 px inside the header on each side). */
.app-container:not(.is-landing),
.app-container.is-landing {
    max-width: 1120px;
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

@media (max-width: 760px) {
    .app-container:not(.is-landing),
    .app-container.is-landing {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
}

/* Enterprise (Pricing::enterpriseCard()): priced by sales, so a quieter
   card next to the self-serve plans. */
.price-card-enterprise {
    background-color: var(--bg-card-subtle);
}

.price-amount-custom {
    font-size: var(--text-2xl);
}

/* Convert: the required project picker (2026-10-20, index.php #project-picker). */
.project-picker {
    margin: 0 0 var(--space-4);
    display: grid;
    gap: 0.375rem;
}

.project-picker[hidden] {
    display: none;
}

.project-picker-label {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.project-picker-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.project-select {
    flex: 1 1 16rem;
    max-width: 28rem;
    min-width: 0;
}

.project-new {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

.project-new[hidden] {
    display: none;
}

.project-new .account-input {
    flex: 1 1 14rem;
    max-width: 28rem;
    min-width: 0;
}

.project-picker-hint,
.queue-project,
.conversion-summary-project {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.queue-project {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

/* Converting without a project (the global converter): the compact picker
   comes first and the upload waits for it. */
.project-picker .project-picker-row .project-picker-label {
    flex: 0 0 auto;
}

.drop-zone.is-waiting-project {
    opacity: 0.6;
    cursor: not-allowed;
}

.drop-zone.is-waiting-project .drop-choose-btn:disabled {
    cursor: not-allowed;
}

.processing-leave {
    margin-top: var(--space-3);
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.processing-leave.hidden,
#result-project-link.hidden {
    display: none;
}

.result-ready-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

@media (max-width: 640px) {
    .result-ready-actions {
        width: 100%;
    }

    .result-ready-actions > .btn {
        flex: 1 1 auto;
    }
}

/* The converter embedded in a project page (2026-10-21). */
.project-work {
    margin-bottom: var(--space-8);
}

.project-work .converter-card {
    margin: 0;
}

.project-work .flow-steps {
    justify-content: flex-start;
}

/* Tab panels (Convert | Translate, js/translate.js). */
[role="tabpanel"][hidden] {
    display: none;
}

/* Translate mode (2026-10-21 redesign): upload progress and files that need converting first. */
.translate-uploads {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-1);
    font-size: var(--text-md);
}

.translate-uploads:empty {
    display: none;
}

.translate-upload-ok { color: var(--success-text); }
.translate-upload-error { color: var(--error-text); }

/* What the Translate tab is doing now (js/translate.js setStatus()). */
.translate-status {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--brand-tint-subtle, var(--bg-card-subtle));
    font-size: var(--text-md);
    color: var(--text-primary);
}

.translate-status[hidden] {
    display: none;
}

.translate-status[data-kind="error"] {
    background-color: var(--bg-card-subtle);
    color: var(--error-text);
}

.translate-status-spinner {
    display: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

.translate-status.is-busy .translate-status-spinner {
    display: block;
}

.translate-status-body {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: var(--space-2);
}

.translate-status-text {
    margin: 0;
    overflow-wrap: anywhere;
}

.translate-status-text .link-like {
    margin-left: var(--space-1);
}

.translate-status-progress {
    width: 100%;
    max-width: 28rem;
    height: 6px;
    border: 0;
    border-radius: var(--radius-full);
    background-color: var(--border-color);
    accent-color: var(--brand-primary);
    appearance: none;
}

.translate-status-progress[hidden] {
    display: none;
}

.translate-status-progress::-webkit-progress-bar {
    background-color: var(--border-color);
    border-radius: var(--radius-full);
}

.translate-status-progress::-webkit-progress-value {
    background-color: var(--brand-primary);
    border-radius: var(--radius-full);
}

.translate-status-progress::-moz-progress-bar {
    background-color: var(--brand-primary);
    border-radius: var(--radius-full);
}

@media (prefers-reduced-motion: reduce) {
    .translate-status-spinner {
        animation-duration: 2.5s;
    }
}

/* Conversion settings (2026-10-21): one container, three compact rows with
   subtle dividers; title and description on the left, the switch on the
   right. Descriptions wrap on narrow screens; the switch never shrinks. */
.conversion-settings-list {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
}

.toggle-control.setting-row {
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
}

.setting-row + .setting-row {
    border-top: 1px solid var(--border-color);
}

.setting-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1 1 auto;
    min-width: 0;
}

.setting-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.setting-desc {
    font-size: var(--text-sm);
    line-height: 1.45;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

/* The settings list (.conversion-settings-list) is the one container: the disclosure around it has no
   frame of its own (the result screen's layout options keep theirs). */
#conversion-settings {
    border: 0;
    background: none;
}

#conversion-settings > summary {
    padding: var(--space-2) 0;
}

#conversion-settings .advanced-options-body {
    padding: 0;
}

.setting-row .toggle-switch {
    margin-top: 0;
}

/* A sub-setting (2026-10-26): no divider from its parent, indented with a
   short guide line, greyed out while unavailable (same text either way). */
.setting-row + .setting-row.setting-row-sub {
    border-top: 0;
    padding-top: 0;
}

.setting-row-sub .setting-text {
    padding-left: var(--space-4);
    border-left: 2px solid var(--border-color);
}

.setting-row-sub:has(input:disabled) .setting-title,
.setting-row-sub:has(input:disabled) .setting-desc {
    color: var(--text-muted);
}

/* Project page: the settings in a pop-up (2026-10-26), wider than a
   confirmation so the descriptions don't wrap word by word. */
.confirm-dialog.settings-dialog {
    width: min(34rem, calc(100vw - 2rem));
}

.settings-dialog .confirm-dialog-message {
    margin-bottom: var(--space-4);
}

.settings-dialog .conversion-settings-list {
    margin-bottom: var(--space-5);
}

.setting-row input:disabled ~ .toggle-switch {
    opacity: 0.55;
}

.setting-row:has(input:disabled) {
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .toggle-control.setting-row {
        gap: var(--space-3);
        padding: var(--space-3);
        min-height: var(--control-h-touch);
    }
}

/* Google Analytics cookie choice (js/analytics.js; only where analytics is on). */
.site-footer-link-button {
    padding: 0;
    font: inherit;
    font-size: var(--text-md);
    color: var(--text-secondary);
    text-align: left;
    background: none;
    border: 0;
    cursor: pointer;
}

.site-footer-link-button:hover {
    color: var(--brand-text);
    text-decoration: underline;
}

.analytics-settings-button {
    cursor: pointer;
}

.analytics-banner {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    z-index: var(--z-dialog);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-4);
    align-items: center;
    justify-content: space-between;
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-4);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-lg);
}

.analytics-banner-text {
    flex: 1 1 22rem;
    margin: 0;
    font-size: var(--text-md);
    line-height: 1.5;
}

.analytics-banner-text a {
    color: var(--brand-text);
}

.analytics-banner-actions {
    display: flex;
    gap: var(--space-2);
}

@media (max-width: 640px) {
    .analytics-banner {
        right: 16px;
        bottom: 16px;
        left: 16px;
    }

    .site-footer-link-button {
        padding: 0.55rem 0;
    }

    .analytics-banner-actions,
    .analytics-banner-actions .btn {
        flex: 1 1 0;
    }

    .analytics-banner-actions .btn {
        min-height: 44px;
    }
}


/* Landing page on phones (2026-10-27): the example's close-ups and notes and
   "Good to know" fold (details[data-open-wide], open on wider screens by
   js/landing.js); pricing cards become compact rows; sections sit closer. */
/* One fold-out marker everywhere on the public pages: "+" closed, "−" open,
   as in the FAQ (2026-10-27; "Compare all features" had the browser's arrow). */
.example-more-summary,
.good-to-know > summary,
.compare-details > summary {
    cursor: pointer;
    list-style: none;
}

.example-more-summary::-webkit-details-marker,
.good-to-know > summary::-webkit-details-marker,
.compare-details > summary::-webkit-details-marker {
    display: none;
}

.compare-details > summary::after {
    content: ' +';
}

.compare-details[open] > summary::after {
    content: ' \2212';
}

/* Touch-sized fold-out lines on phones (44 px). */
@media (max-width: 760px) {
    .example-more > .example-more-summary,
    .good-to-know > summary {
        display: flex;
        align-items: center;
        min-height: 44px;
        gap: 0.3em;
    }

    .compare-details > summary {
        min-height: 44px;
        display: flex;
        align-items: center;
        gap: 0.3em;
    }
}

.example-more-summary {
    display: block;
    width: fit-content;
    margin: var(--space-6) auto 0;
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--brand-text);
}

.example-more-summary::after,
.good-to-know > summary::after {
    content: ' +';
}

.example-more[open] > .example-more-summary::after,
.good-to-know[open] > summary::after {
    content: ' \2212';
}

/* Wider screens: open, so the summary line isn't needed. */
@media (min-width: 761px) {
    .example-more > .example-more-summary {
        display: none;
    }
}

@media (max-width: 760px) {
    .landing-section {
        padding-top: var(--space-10);
    }

    .example-subtitle {
        margin-top: var(--space-5);
    }

    .example-notes {
        margin-top: var(--space-5);
        gap: var(--space-4);
    }

    .good-to-know {
        padding: var(--space-3) var(--space-4);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-lg);
        background-color: var(--bg-card);
    }

    .topic-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .topic-card {
        padding: var(--space-4);
    }

    .topic-card p {
        font-size: var(--text-md);
    }

    .steps-list p {
        font-size: var(--text-md);
    }
}

@media (max-width: 480px) {
    /* A price card as one row: what you get on the left, the button on the right. */
    .price-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: var(--space-3);
        row-gap: 0.15rem;
        padding: var(--space-4);
    }

    .price-card > * {
        grid-column: 1;
    }

    .price-card > .btn {
        grid-column: 2;
        grid-row: 1 / span 6;
        align-self: center;
    }

    .price-card > .price-spacer {
        display: none;
    }

    .price-amount {
        font-size: var(--text-2xl);
    }

    .price-badge {
        position: static;
        transform: none;
        justify-self: start;
        margin-bottom: var(--space-1);
        font-size: var(--text-xs);
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    .pricing-group-title {
        margin-top: var(--space-6);
    }
}

@media (max-width: 760px) {
    /* FAQ: one joined list instead of separate cards. */
    .faq-list {
        gap: 0;
    }

    .faq-item {
        border-radius: 0;
    }

    .faq-item + .faq-item {
        border-top: 0;
    }

    .faq-item:first-child {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .faq-item:last-child {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }

    .faq-item summary {
        min-height: var(--control-h-touch);
        align-items: center;
        padding: var(--space-3) var(--space-4);
    }
}

@media (max-width: 760px) {
    .section-sub {
        font-size: var(--text-base);
    }
}

/* ------------------------------------------------------------------------
   Shared with account.css (2026-10-27). The public pages (landing, guides,
   legal pages) skip account.css while signed out (PageChrome::headLinks
   'account_styles' => false), so the few account.css rules they use are
   repeated here, last, where they cascade exactly as when account.css came
   after app.css. Signed-in pages load both copies; keep them identical.
   ------------------------------------------------------------------------ */
body {
    margin: 0;
}

.account-link {
    color: var(--brand-text);
    text-decoration: none;
    font-weight: 600;
}

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

.compare-details {
    margin-top: var(--space-4);
}

.compare-details > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand-text);
    font-size: var(--text-base);
}

.compare-details .table-scroll {
    margin-top: var(--space-3);
}

@media (max-width: 640px) {
    .compare-details > summary {
        padding: var(--space-2) 0;
    }
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
}

@media print {
    .site-header,
    .site-footer,
    .skip-link,
    .no-print {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border: none !important;
        min-height: 0 !important;
        padding: 0 !important;
    }
}

/* "Highlight handwritten text" setting (2026-10-28, includes/HandwritingSetting.php,
   js/handwriting.js): text left, then the colour swatch (only while on) and the
   switch; the swatch opens the colour list underneath. Swatches are Word's
   highlight colours (turquoise is kept for flagged words). */
.handwriting-setting.setting-row {
    padding: var(--space-3) var(--space-4);
}

.handwriting-main {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.handwriting-text {
    cursor: pointer;
}

.handwriting-switch {
    flex: none;
}

.hl-swatch-button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex: none;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
}

.hl-swatch-button:hover {
    border-color: var(--text-muted);
}

.hl-swatch-button:focus-visible,
.hl-option:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.hl-swatch-button[hidden] {
    display: none;
}

.is-palette-open .hl-swatch-chevron {
    transform: rotate(180deg);
}

.hl-swatch {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
}

.hl-picker {
    position: relative;
    flex: none;
}

.hl-picker[hidden] {
    display: none;
}

/* Floats under the swatch (never pushes the rows below). */
.hl-palette {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    z-index: var(--z-dropdown);
    display: flex;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.hl-palette[hidden] {
    display: none;
}

.hl-option {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    cursor: pointer;
}

.hl-option[aria-checked="true"] {
    box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--text-primary);
}

.hl-swatch[data-color="yellow"] { background-color: #FFFF00; }
.hl-swatch[data-color="green"] { background-color: #00FF00; }
.hl-swatch[data-color="magenta"] { background-color: #FF00FF; }
.hl-swatch[data-color="red"] { background-color: #FF0000; }
.hl-swatch[data-color="lightGray"] { background-color: #C0C0C0; }

/* The result screen's smaller option pills: switch first, like the others. */
.handwriting-setting-sm .handwriting-main {
    gap: 0.6rem;
}

.handwriting-setting-sm .handwriting-switch {
    order: -1;
}

.handwriting-setting-sm .hl-palette {
    right: auto;
    left: 0;
}

@media (max-width: 640px) {
    .hl-swatch-button {
        min-height: var(--control-h-touch);
        padding-inline: 0.6rem;
    }

    .hl-option {
        width: 2.25rem;
        height: 2.25rem;
    }
}

/* "Redacted areas" setting (2026-10-28, includes/RedactionSetting.php): three
   radio buttons as a segmented control -- "[Redacted]", Black box, Leave out. */
.redaction-setting.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-4);
    padding: var(--space-3) var(--space-4);
}

.seg-control {
    display: inline-flex;
    flex: none;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-card-subtle);
}

.seg-option {
    position: relative;
    display: flex;
}

.seg-option input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.seg-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
}

.seg-option input:hover + span {
    color: var(--text-primary);
}

.seg-option input:checked + span {
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.seg-option input:focus-visible + span {
    outline: 2px solid var(--brand-primary);
    outline-offset: 1px;
}

/* The result screen's smaller option pills: the choices under the text. */
.redaction-setting-sm {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
}

@media (max-width: 640px) {
    .redaction-setting.setting-row {
        flex-wrap: wrap;
    }

    .seg-control {
        width: 100%;
    }

    .seg-option {
        flex: 1 1 0;
    }

    .seg-option span {
        min-height: var(--control-h-touch);
        padding-inline: 0.4rem;
    }
}
