/* ===== APP TOKENS — copied from App/wwwroot/css/app.css by scripts/check-token-parity.js --write; do not edit ===== */
/* =====================================================================================================
   FORK BRAND VALUES
   Operans: orange primary, cobalt attention (I-045). A fork sets its own values here.
   The only block a fork edits to re-brand the App. Every colour VALUE that is a brand choice lives here
   and nowhere else; structural tokens and every rule refer to these by name and assume no hue.
   Also mirror --color-primary in App/Components/ChartPalette.cs (canvas charts cannot read CSS tokens).
   data-theme on <html> selects the token set: the first rule is the dark default (no data-theme, or "dark"), the
   :root[data-theme="light"] rule re-declares only what changes on light. A fork sets its light brand values there too.
   .theme-dark-island (the sidebar) takes the dark values in both themes; derived tokens re-resolve on it.
   ===================================================================================================== */
:root, .theme-dark-island {
    /* Primary: primary actions, links, selection, focus rings */
    --color-primary: #e67a2e;
    --color-primary-light: #f0944d;
    --color-primary-dark: #c9631f;
    --color-primary-rgb: 230, 122, 46;
    --color-primary-light-rgb: 240, 148, 77;
    --color-primary-glow: rgba(var(--color-primary-rgb), 0.4);
    --color-primary-bg: rgba(var(--color-primary-rgb), 0.1);
    /* Text and icons on a primary fill */
    --color-on-primary: #1a0d03;
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);

    /* Attention: unread markers, notification badges, counts and notices that need action */
    --color-attention: #4f8cff;
    --color-attention-light: #7aa9ff;
    --color-attention-rgb: 79, 140, 255;
    /* Text on an attention fill (count badges) */
    --color-on-attention: #06142e;

    /* Favourite and rating stars */
    --color-star: #e67a2e;

    /* Enterprise subscription tier: tag text and the channel of its tints */
    --color-tier-enterprise: #f0944d;
    --color-tier-enterprise-rgb: 240, 148, 77;

    /* Sidebar: the selected navigation item — prototype F --sider-active / --sider-active-bg (I-051): the light primary
       on a 16 % primary tint */
    --color-nav-active: #f0944d;
    --color-nav-active-bg: rgba(var(--color-primary-rgb), 0.16);

    /* Neutral informational tags: the hue; text, fill and border derive from it */
    --color-neutral: #8c93a3;
    --color-neutral-rgb: 140, 147, 163;

    /* Page background glow (layered over the page background by --gradient-bg) */
    --gradient-page-glow: radial-gradient(ellipse at 20% 0%, rgba(var(--color-primary-rgb), 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(var(--color-primary-rgb), 0.1) 0%, transparent 50%);
}
/* Light theme: only the brand values that change. Text roles reach 4.5 : 1 on the ground and raised surfaces. */
:root[data-theme="light"] {
    --color-primary: #b1520f;
    --color-primary-light: #bc5812;
    --color-primary-dark: #9a460b;
    --color-primary-rgb: 177, 82, 15;
    --color-primary-light-rgb: 188, 88, 18;
    --color-on-primary: #ffffff;

    /* The attention fill darkens to the prototype's light cobalt with white ink (Operans prototype decision 1, F
       --badge-bg / --badge-fg on light; I-051 AD-5); the text variant is the same cobalt. The sidebar is a dark island,
       so its count pills keep the dark pair */
    --color-attention: #1d4fd7;
    --color-attention-rgb: 29, 79, 215;
    --color-on-attention: #ffffff;
    --color-attention-light: #1d4fd7;

    --color-star: #b77409;

    --color-tier-enterprise: #9a4a0e;
    --color-tier-enterprise-rgb: 154, 74, 14;

    --color-neutral: #6b7385;
    --color-neutral-rgb: 107, 115, 133;

    --gradient-page-glow: radial-gradient(ellipse at 20% 0%, rgba(var(--color-primary-rgb), 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(var(--color-primary-rgb), 0.05) 0%, transparent 50%);
}
/* ===== END FORK BRAND VALUES ===== */

/* STRUCTURAL TOKENS — identical in every fork; values that are brand choices live in the block above.
   Dark default on :root and on .theme-dark-island (the sidebar stays dark in both themes); the light values follow
   in :root[data-theme="light"] below. */
:root, .theme-dark-island {
    /* Native controls (scrollbars, form widgets) follow the theme */
    --color-scheme: dark;

    /* Shadows */
    --shadow-inset-dark: rgba(0, 0, 0, 0.1);

    /* Dark Theme */
    --color-bg-dark: #0d0f14;
    --color-bg-dark-secondary: #141821;
    --color-bg-dark-tertiary: #1a1f2e;
    /* Elevated surface for floating menus / dropdown panels (Select, Dropdown menu, etc.) */
    --color-bg-elevated: #1c1f27;
    /* Pinned (Fixed) table cells: opaque, or the columns that scroll under them show through (B-054). */
    --table-pinned-bg: var(--color-bg-elevated);
    /* Edge shadow of the first right-pinned cell while the table overflows to the right (table pattern, I-028) */
    --table-pin-shadow: rgba(var(--color-shadow-rgb), 0.55);
    /* Quiet zone behind a QR code: white in both themes, so a scanner always reads it */
    --color-qr-plate: #ffffff;
    /* Ink on the gold Max-tier fill: dark in both themes, so it is not redefined on light */
    --color-on-gold: #1a1f2e;
    /* Ink on a solid --color-success fill (checkout success disc): white in both themes */
    --color-on-success: #ffffff;
    /* Text on a solid --color-error fill (primary danger button): dark ink on the bright dark-theme red, white on the light one */
    --color-on-error: #1f0608;
    /* Text on a solid --color-error-mark fill (the overdue status chip — F --on-err on --err-solid; CF-099 TASK_13) */
    --color-on-error-mark: #2a0706;

    /* Scrims: behind a Modal / Drawer, and the softer veil over a loading (Spin) container */
    /* F --mask (I-041 TASK_12; was rgba(0, 0, 0, .7) with a 4px blur) */
    --overlay-mask: rgba(4, 5, 8, 0.62);
    --overlay-mask-soft: rgba(var(--color-shadow-rgb), 0.45);
    /* Plate under a control or status icon laid over an image or thumbnail; its content follows --color-fg-NN */
    --surface-overlay-strong-rgb: var(--color-bg-dark-secondary-rgb);
    --surface-overlay-strong: rgba(var(--surface-overlay-strong-rgb), 0.9);

    /* Floating panels: menus (Select, Dropdown), other panels (picker, message, notification, modal, popover), tooltip */
    --shadow-panel: 0 8px 32px rgba(var(--color-shadow-rgb), 0.5);
    --shadow-panel-soft: 0 8px 32px rgba(var(--color-shadow-rgb), 0.4);
    --shadow-tooltip: 0 4px 16px rgba(var(--color-shadow-rgb), 0.3);

    /* Glass Effects */
    --glass-bg-subtle: rgba(255, 255, 255, 0.03);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-light: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-light: rgba(255, 255, 255, 0.15);
    /* The boundary of a control that is identified by its outline (the header command field): 3 : 1 against the
       surface around it (WCAG 1.4.11) — the glass borders above are decoration and stay below that */
    --control-border: rgba(255, 255, 255, 0.4);
    /* The fill of a form control (input, select, picker, number field): the glass tier on dark, white on light
       (prototype F --glass-2), so a field is not a grey wash on a white card */
    --control-bg: var(--glass-bg-light);
    /* Opaque raised surfaces (prototype F --solid / --solid-2): where a tile must hide what is under it */
    --color-solid: #191b20;
    --color-solid-2: #202226;
    /* Track of a Switch that is off: visible on the ground in both themes (AntD's black 0.25 vanishes on dark) */
    --switch-off: rgba(255, 255, 255, 0.28);
    --glass-shadow: rgba(0, 0, 0, 0.25);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.78);
    --text-muted: rgba(255, 255, 255, 0.55);
    /* Decorative only (dividers, watermark glyphs): below text contrast on purpose */
    --text-faint: rgba(255, 255, 255, 0.4);

    /* Foreground tint scale: the foreground colour at a fixed alpha, fifteen steps. Overlays and hairlines
       03-15, borders 10-25, text 25-85. A theme swaps --color-fg-rgb (and may tune a step); rules never change.
       Do not add a step: use the nearest one. */
    --color-fg-rgb: 255, 255, 255;
    --color-fg-03: rgba(var(--color-fg-rgb), 0.03);
    --color-fg-04: rgba(var(--color-fg-rgb), 0.04);
    --color-fg-05: rgba(var(--color-fg-rgb), 0.05);
    --color-fg-06: rgba(var(--color-fg-rgb), 0.06);
    --color-fg-08: rgba(var(--color-fg-rgb), 0.08);
    --color-fg-10: rgba(var(--color-fg-rgb), 0.1);
    --color-fg-12: rgba(var(--color-fg-rgb), 0.12);
    --color-fg-15: rgba(var(--color-fg-rgb), 0.15);
    --color-fg-25: rgba(var(--color-fg-rgb), 0.25);
    --color-fg-35: rgba(var(--color-fg-rgb), 0.35);
    --color-fg-45: rgba(var(--color-fg-rgb), 0.45);
    --color-fg-50: rgba(var(--color-fg-rgb), 0.5);
    --color-fg-65: rgba(var(--color-fg-rgb), 0.65);
    --color-fg-70: rgba(var(--color-fg-rgb), 0.7);
    --color-fg-85: rgba(var(--color-fg-rgb), 0.85);

    /* Channel triplets for rgba() composition: rgba(var(--color-x-rgb), <alpha>). The status, tier, amber,
       indigo and greyscale triplets are declared with their colours below. */
    --color-shadow-rgb: 0, 0, 0;
    --color-bg-dark-secondary-rgb: 20, 24, 33;
    --color-error-light-rgb: 255, 120, 117;
    /* --color-info (#aab4c8). The older --color-info-rgb holds the hover shade #bbc3d3 and keeps its name. */
    --color-info-base-rgb: 170, 180, 200;
    --color-blue-rgb: 59, 130, 246;
    --color-cyan: #22d3ee;
    --color-cyan-rgb: 34, 211, 238;

    /* AntD preset tag hues that have no semantic token (overrides.css § Tag Overrides) */
    --color-tag-cyan-rgb: 19, 194, 194;
    --color-tag-cyan-text: #36cfc9;
    --color-tag-magenta-rgb: 235, 47, 150;
    /* AntD magenta-4: magenta-5 (#f759ab) reached only 4.37 : 1 on its own tint over a dark card (I-060, Evidens I-044
       Decision 34 (e)) */
    --color-tag-magenta-text: #ff85c0;
    --color-tag-lime-rgb: 160, 217, 17;
    --color-tag-lime-text: #bae637;
    --color-tag-volcano-rgb: 250, 84, 28;
    --color-tag-volcano-text: #ff7a45;
    --color-tag-geekblue-rgb: 47, 84, 235;
    /* AntD geekblue-4: geekblue-5 (#597ef7) reached only 4.2 : 1 on its own tint over a dark card (I-036) */
    --color-tag-geekblue-text: #85a5ff;

    /* Gold (the Max subscription tier) and the Blazor error boundary */
    --color-gold: #d4af37;
    --color-gold-bright: #ffd700;
    --color-gold-deep: #b8860b;
    --color-gold-rgb: 212, 175, 55;
    --color-gold-bright-rgb: 255, 215, 0;
    --color-error-boundary: #b32121;
    /* Ink on the error-boundary fill, which is the same dark red in both themes */
    --color-on-error-boundary: #ffffff;
    /* The Blazor error bar (#blazor-error-ui) is a light strip in both themes */
    --color-error-ui-bg: #ffffe0;
    /* ...so its text is a fixed ink, not the page theme's --text-primary (white on dark) */
    --color-on-error-ui: #10131a;

    /* Derived from the brand values above */
    /* The primary used as text (active tab, selected option / menu item, pagination, breadcrumb hover) */
    --color-primary-text: var(--color-primary-light);
    /* An inline text link (F .lnk, --accent-text): on dark the lighter accent ink the sidebar's active item also uses */
    --color-link-text: var(--color-nav-active);
    /* The link ink on a subtle (3 %) ground — the context bar's Izmeni (CF-099 F-b3-04): on dark the link ink itself */
    --color-link-text-on-subtle: var(--color-link-text);
    /* The primary as text on a veiled surface (the selected page number sits on --glass-bg-light): on light the plain
       primary falls short of 4.5 : 1 there */
    --color-primary-text-strong: var(--color-primary);
    --color-attention-bg: rgba(var(--color-attention-rgb), 0.1);
    /* The attention hue used as text (code-expiry notice): on light its darker -light shade */
    --color-attention-text: var(--color-attention);
    --color-neutral-text: color-mix(in srgb, var(--color-neutral) 50%, var(--text-primary));
    --color-neutral-bg: rgba(var(--color-neutral-rgb), 0.15);
    --color-neutral-border: rgba(var(--color-neutral-rgb), 0.38);

    /* Gradients */
    --gradient-bg: var(--gradient-page-glow), linear-gradient(180deg, var(--color-bg-dark) 0%, var(--color-bg-dark-secondary) 100%);

    /* Semantic Status Colors */
    --color-success: #52c41a;
    --color-success-light: #95de64;
    --color-success-hover: #73d13d;
    /* The header's "all systems operational" dot (I-051 AD-5, from Evidens I-041; F --ok): a mark, not text, so it keeps
       F's brighter green */
    --color-status-operational: var(--color-success-hover);
    --color-warning: #faad14;
    --color-warning-light: #ffc53d;
    /* A warning mark, not text (an icon and its tint — the notification row's .q-ic): F --warn (I-039 TASK_08) */
    --color-warning-mark: var(--color-warning-light);
    --color-error: #ff4d4f;
    --color-error-light: #ff7875;
    /* The error hue of a mark (F --err): the work queue's overdue / critical icon tiles and the critical status chip.
       Not text on its own tint like --color-error-light, so on light it keeps F's brighter red (CF-086 TASK_06) */
    --color-error-mark: var(--color-error-light);
    /* Info is neutral, not blue (I-036): information that needs no action (processing tags, info alerts, timeline
       heads) reads grey — prototype F --info */
    --color-info: #aab4c8;
    --color-info-light: #ccd2de;
    --color-info-hover: #bbc3d3;
    --color-info-rgb: 187, 195, 211;
    --color-info-bg: rgba(187, 195, 211, 0.15);
    --color-error-bg: rgba(var(--color-error-rgb), 0.15);
    --color-success-bg: rgba(var(--color-success-rgb), 0.15);
    --color-warning-bg: rgba(var(--color-warning-rgb), 0.15);
    --color-accent-purple: #722ed1;
    --color-accent-purple-light: #b37feb;
    --color-accent-purple-hover: #9254de;

    /* Subscription Tier Colors */
    --color-tier-starter: #60a5fa;
    --color-tier-starter-rgb: 96, 165, 250;
    --color-tier-pro: #a78bfa;
    --color-tier-pro-rgb: 167, 139, 250;
    --color-tier-starter-bg: rgba(96, 165, 250, 0.15);
    --color-tier-pro-bg: rgba(167, 139, 250, 0.15);

    /* Decorative Accents */
    --color-amber: #f5a623;
    --color-amber-rgb: 245, 166, 35;

    /* Indigo (Journal entry highlights) */
    --color-indigo: #6366f1;
    --color-indigo-rgb: 99, 102, 241;

    /* Accounting Semantics (financial ledger debit/credit) */
    --color-accounting-credit: #52c41a;
    --color-accounting-credit-rgb: 82, 196, 26;
    --color-accounting-debit: #ff4d4f;
    --color-accounting-debit-rgb: 255, 77, 79;

    /* Greyscale RGB triplets (used for rgba() translucent overlays) */
    --color-black-rgb: 0, 0, 0;
    --color-white-rgb: 255, 255, 255;
    --color-gray-rgb: 140, 140, 140;

    /* Semantic Status RGB triplets (translucent backgrounds, borders, glows) */
    --color-success-rgb: 82, 196, 26;
    --color-warning-rgb: 250, 173, 20;
    --color-error-rgb: 255, 77, 79;
    --color-info-hover-rgb: 187, 195, 211;
    --color-accent-purple-rgb: 114, 46, 209;

    /* Social Brand Colors */
    --color-social-twitter: #1da1f2;
    --color-social-linkedin: #0a66c2;
    --color-social-facebook: #4267b2;
    --color-social-whatsapp: #25d366;

    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;

    /* Typography — size scale (B-076: restored as it stood before 908d37673; titles keep the
       design.md type-scale tiers) */
    --font-size-xs:   0.75rem;      /* 12px — badge, tag, footnote */
    --font-size-xs2:  0.8125rem;    /* 13px — caption, small metadata */
    --font-size-sm:   0.875rem;     /* 14px — label, secondary body */
    --font-size-base: 0.9375rem;    /* 15px — primary body text */
    --font-size-md:   1rem;         /* 16px — medium emphasis */
    --font-size-lg:   1.125rem;     /* 18px — sub-heading, large label */
    --font-size-xl:   1.25rem;      /* 20px — section heading */
    --font-size-2xl:  1.5rem;       /* 24px — page sub-heading */
    /* Prototype F's caption tier (I-051, from Evidens I-041): table headers and the updated line, 12.5px */
    --font-size-caption: 0.78125rem;
    /* Body text and the caption tier — prototype F (Evidens I-041 Decision 9, ported by I-051 / I-048): body 15px / 1.5,
       set on body explicitly (the 16px root is unchanged; overrides.css); caption 12.5px (above) for the updated line
       and table headers. --font-size-body is the 15px --font-size-base step under its role name */
    --font-size-body: var(--font-size-base);
    --line-height-body: 1.5;

    /* Font weights: the shared pattern blocks (I-029 … I-036) read these */
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-md-sm: 0.75rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Borders */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Hover tint of a primary-tinted row (I-024 context chooser, I-025 command palette): one step above
       --color-primary-bg. Derived from the primary channel, so there is no light value. */
    --color-primary-bg-hover: rgba(var(--color-primary-rgb), 0.2);
    /* A selected record row (I-060, Evidens I-044 Decision 26 (e)): half of --color-primary-bg, so a translucent tag on
       the row keeps its contrast. Derived from the primary channel, so there is no light value. */
    --color-primary-bg-subtle: rgba(var(--color-primary-rgb), 0.07);

    /* Shell sizes (I-024): the labelled sidebar, its icon rail, and the labelled sidebar drawn over the content on
       narrow screens. Sizes, so there is no light value.
       --sider-width / --sider-rail-width MUST match MainLayout.SiderWidth / SiderRailWidth: AntDesign emits the
       sider width as an INLINE style, so these tokens only keep .content-layout's margin in step. Change both. */
    --sider-width: 248px;
    --sider-rail-width: 68px;
    --sider-overlay-width: min(280px, 88vw);
    /* The sidebar's muted labels — group headings, toggles, the back link (I-051 / I-048, from Evidens I-041; F
       --sider-muted .45): half-way between the .45 and .50 steps, the nearest value that keeps 11px text at 4.5 : 1 on
       the darkest sidebar ground */
    --color-nav-muted: color-mix(in srgb, var(--color-fg-45), var(--color-fg-50));

    /* Wizard and settings patterns (I-033): the wizard column, the settings tab nav and the capped settings content
       column. Sizes, so there is no light value. The wizard column is the Operans prototype's wizard screen: F's
       standard 1200px page (o.html .page), not F's 720px onboarding column (.wz), which no App wizard page uses
       (I-051 TASK_05, AD-1). */
    --wizard-column-width: var(--page-width-standard);
    --settings-nav-width: 208px;
    --settings-content-max: 720px;
    --settings-field-max: 360px;
}

/* Light theme structural values: only the tokens that change. Derived tokens (--gradient-bg, --color-fg-NN, the
   shadow scale) re-resolve from these. Every value used as text reaches 4.5 : 1 on the ground (#f3f4f7) and on
   raised surfaces (#eef0f4); measured values are in App/docs/infrastructure/design.md § Themes. */
:root[data-theme="light"] {
    --color-scheme: light;

    --shadow-inset-dark: rgba(16, 19, 26, 0.06);

    /* Ground, surfaces and raised surfaces */
    --color-bg-dark: #f3f4f7;
    --color-bg-dark-secondary: #ffffff;
    --color-bg-dark-tertiary: #eef0f4;
    --color-bg-elevated: #ffffff;
    /* Tables sit on white cards: the pinned cells take that surface, opaque */
    --table-pinned-bg: #ffffff;
    /* A black 0.55 shadow is a smear on white: the light edge shadow is the ink at 0.22 */
    --table-pin-shadow: rgba(16, 19, 26, 0.22);
    --color-on-error: #ffffff;
    --color-on-error-mark: #ffffff;

    /* A lighter scrim keeps the page legible behind a Modal / Drawer; a loading container is veiled in white */
    --overlay-mask: rgba(16, 19, 26, 0.42); /* F --mask (I-041 TASK_12; was .35) */
    --overlay-mask-soft: rgba(255, 255, 255, 0.6);
    /* White plate with the dark-alpha border and ink of the light foreground (a dark plate would need its own ink) */
    --surface-overlay-strong-rgb: 255, 255, 255;

    /* White panels on a white page: separated by their --glass-border / --color-fg-10 border plus a soft shadow */
    --shadow-panel: 0 8px 24px rgba(16, 19, 26, 0.12);
    --shadow-panel-soft: 0 8px 24px rgba(16, 19, 26, 0.12);
    --shadow-tooltip: 0 4px 12px rgba(16, 19, 26, 0.12);

    /* The primary itself is the text shade on light; its -light shade is the hover fill */
    --color-primary-text: var(--color-primary);
    --color-link-text: var(--color-primary-text);
    /* On light the primary reads 4.4 : 1 on a subtle ground (the context bar); halfway to its dark step it reads 4.9 : 1
       and sits at F's --accent-text (ΔE 0.9) — CF-099 F-b3-04 */
    --color-link-text-on-subtle: color-mix(in srgb, var(--color-primary) 50%, var(--color-primary-dark));
    --color-primary-text-strong: var(--color-primary-dark);
    --color-attention-text: var(--color-attention-light);

    --glass-bg-subtle: rgba(16, 19, 26, 0.03);
    --glass-bg: #ffffff;
    --glass-bg-light: rgba(16, 19, 26, 0.05);
    --glass-border: rgba(16, 19, 26, 0.1);
    --glass-border-light: rgba(16, 19, 26, 0.2);
    --control-border: rgba(16, 19, 26, 0.5);
    --control-bg: #ffffff;
    --color-solid: #ffffff;
    --color-solid-2: #f7f8fa;
    --switch-off: rgba(16, 19, 26, 0.3);
    --glass-shadow: rgba(16, 19, 26, 0.08);

    --text-primary: #10131a;
    --text-secondary: rgba(16, 19, 26, 0.76);
    /* F's .60 reads 4.49 : 1 on an unread notification card; .62 keeps 4.79 there and is within ΔE 2 of F (I-041) */
    --text-muted: rgba(16, 19, 26, 0.62);
    /* Decorative only (dividers, watermark glyphs): below text contrast on purpose */
    --text-faint: rgba(16, 19, 26, 0.4);

    --color-fg-rgb: 16, 19, 26;
    /* Tuned steps: 45 and 50 carry text (Steps / Empty descriptions, picker header and weekdays); at their dark alphas
       they read 3.2-3.5 : 1 on white, at these 4.7 : 1 on the ground */
    --color-fg-45: rgba(var(--color-fg-rgb), 0.6);
    --color-fg-50: rgba(var(--color-fg-rgb), 0.62);

    --color-bg-dark-secondary-rgb: 255, 255, 255;
    --color-success-rgb: 30, 110, 20;
    --color-warning-rgb: 134, 85, 0;
    --color-error-rgb: 184, 29, 40;
    /* Deliberately darker than --color-error-light: its only use is text at 0.8 alpha on the error tint (app.css alert description) */
    --color-error-light-rgb: 138, 26, 34;
    --color-info-base-rgb: 85, 96, 122;
    --color-info-hover-rgb: 76, 86, 110;
    --color-cyan: #0b6a80;
    --color-cyan-rgb: 11, 106, 128;
    --color-amber-rgb: 143, 91, 0;
    --color-tier-starter-rgb: 29, 78, 216;
    --color-tier-pro-rgb: 109, 40, 217;

    /* AntD preset tag text on its own 15 % tint */
    --color-tag-cyan-text: #00676e;
    --color-tag-magenta-text: #9e1068;
    --color-tag-lime-text: #456200;
    --color-tag-volcano-text: #a8350a;
    --color-tag-geekblue-text: #1d39c4;

    /* Status colours: on light the -light / -hover variants are dark shades, readable as text. The base values reach
       4.5 : 1 on their own 15 % tint over the ground, which is the tightest place a status tag puts them. */
    --color-success: #1e6e14;
    --color-success-light: #1a6312;
    --color-success-hover: #1c6614;
    /* A mark, not text: F's light --ok, 3 : 1 on the light header */
    --color-status-operational: #2b8a1c;
    --color-warning: #865500;
    --color-warning-light: #7a4e00;
    /* A mark, not text: F's light --warn, kept for icons (I-023 Decision 6 — the fill hues may keep the prototype
       values for icons and large text) */
    --color-warning-mark: #a66a00;
    --color-error: #b81d28;
    --color-error-light: #a8202a;
    /* A mark, not text: F's light --err — 4.3 : 1 as an icon on its 14 % tile, the critical chip's ink (68 % of it into
       the text colour) 5.8 : 1 on its tint */
    --color-error-mark: #cf222e;
    --color-info: #55607a;
    --color-info-light: #474f66;
    --color-info-hover: #4c566e;
    --color-info-rgb: 76, 86, 110;
    --color-info-bg: rgba(76, 86, 110, 0.15);
    --color-accent-purple-light: #5b21b6;
    --color-accent-purple-hover: #6425c0;

    --color-tier-starter: #1d4ed8;
    --color-tier-pro: #6d28d9;
    --color-tier-starter-bg: rgba(29, 78, 216, 0.15);
    --color-tier-pro-bg: rgba(109, 40, 217, 0.15);

    --color-amber: #8f5b00;

    /* Ledger credit / debit follow the success / error values they equal on dark */
    --color-accounting-credit: #1e6e14;
    --color-accounting-credit-rgb: 30, 110, 20;
    --color-accounting-debit: #b81d28;
    --color-accounting-debit-rgb: 184, 29, 40;
}

/* Page Width Variables (structural, derived only: the light theme needs no second rule here) */
:root, .theme-dark-island {
    --page-width-narrow: 800px;
    /* Page caps (F .page / .page--wide, Evidens I-041 Decision 10): the content column is capped, and centred only
       beyond the cap. Evidens' rule is "1200px unless F's screen draws the page in .page--wide (1360px)" — its tokens
       are default 1200 / wide 1360 because F draws most Evidens pages in .page. The Operans prototype draws home, the
       lists, the overviews, stock, the documents and the workbenches in .page--wide (o.html 3866–3911, 4518–6362) and
       only the settings pages and the wizard in .page, so the same rule yields Operans' mapping: the default and the
       wide container are one width (1360px), --page-width-standard is the 1200px .page (I-051 AD-1 / AD-1a, I-048
       PLAN Overlap 4); a narrow page type keeps --page-width-narrow */
    --page-width-default: 1360px;
    --page-width-wide: 1360px;
    --page-width-standard: 1200px;
    --page-width-portal: var(--page-width-standard); /* I-039 Decision 7: F's `clients` list model is the 1200 page (I-049 Overlap 1) */

    /* The MainLayout content's gutters, prototype F .content (I-051 AD-1, Evidens I-041 Decision 10): 24px inline,
       28 / 40px block (16 / 20 / 32 at 640px and narrower, below). A sticky element in the content scroller sticks
       inside this padding, so a bar pinned to the scroller's edge offsets by it (.main-content .form-actions-footer,
       .main-content .detail-page-grid__side — scoped, so modals and drawers keep their own offsets) */
    --content-padding-inline: 24px;
    --content-padding-block-start: 28px;
    --content-padding-block-end: 40px;

    /* Shadow scale — replaces inline box-shadow values across the project.
       *-primary-* use the brand glow; non-primary use the neutral glass shadow. */
    --shadow-sm: 0 2px 4px var(--glass-shadow);
    --shadow-md: 0 4px 12px var(--glass-shadow);
    --shadow-lg: 0 8px 24px var(--glass-shadow);
    --shadow-xl: 0 16px 48px var(--glass-shadow);
    --shadow-primary-md: 0 4px 14px var(--color-primary-glow);
    --shadow-primary-lg: 0 8px 24px var(--color-primary-glow);
    --shadow-inset-subtle: inset 0 1px 0 var(--color-fg-06);

    /* Form-drawer widths — consumed by EntityFormDrawer (TASK_06). */
    --form-drawer-width: 480px;
    --form-drawer-width-wide: 640px;
}

/* Prototype F ≤ 640: 16px gutters, 20 / 32px above and below the page */
@media (max-width: 640px) {
    :root, .theme-dark-island {
        --content-padding-inline: 16px;
        --content-padding-block-start: 20px;
        --content-padding-block-end: 32px;
    }
}

/* F --pop-shadow: the raised bar's shadow (new token; light: the ink at 0.18, as F) */
:root, .theme-dark-island {
    --shadow-pop: 0 16px 48px rgba(var(--color-shadow-rgb), 0.4);
}

:root[data-theme="light"] {
    --shadow-pop: 0 16px 48px rgba(16, 19, 26, 0.18);
}
/* ===== END APP TOKENS ===== */

/* ===== SITE TOKENS (not in the App) ===== */
/* Layout measures of the docs shell, no colour. Every colour this site uses is an App token (--color-info is the App's
   own since I-043 Decision 11). A site-only token never reuses an App token name (scripts/check-token-parity.js fails
   on that). --docs-header-height is the App's .main-header height (56px); docs.js reads it for its scroll offsets. */
:root {
    --docs-header-height: 56px;
    --docs-sidebar-width: 280px;
    --docs-toc-width: 240px;
    /* Code and heading tokens: not in Operans' App; remove here if the App ever declares it — the parity check then
       fails on the duplicate */
    --surface-code: var(--color-bg-dark-secondary);
    --text-code: var(--text-secondary);
    --line-height-tight: 1.3;
}

/* Fonts loaded via <link> in App.razor — do not duplicate with @import */

html {
    height: 100%;
    color-scheme: var(--color-scheme);
    background: var(--color-bg-dark);
}

body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--color-bg-dark);
    height: 100%;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Fixed gradient background via pseudo-element (avoids mobile Safari scroll jank) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--gradient-bg);
    pointer-events: none;
}

/* ========================================
   Scrollbar Styling
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-fg-rgb), 0.15);
    border-radius: var(--radius-xs);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-fg-rgb), 0.25);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--color-fg-rgb), 0.15) transparent;
}

/* ========================================
   Base Element Styles
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-primary);
    margin: 0;
}

h1:focus:not(:focus-visible) {
    outline: none;
}

a {
    color: var(--color-link-text);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-text);
}

/* Inline code: the App's code surface and ink (--surface-code / --text-code), --font-mono */
code {
    font-family: var(--font-mono);
    background: var(--surface-code);
    border: 1px solid var(--glass-border);
    padding: 0.0625em 0.375em;
    border-radius: var(--radius-xs);
    font-size: 0.875em;
    color: var(--text-code);
}

pre {
    background: var(--surface-code);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow-x: auto;
    margin: var(--space-md) 0;
}

pre code {
    background: transparent;
    border: 0;
    padding: 0;
    border-radius: 0;
    color: var(--text-code);
}

/* ========================================
   Blazor Error UI
   ======================================== */

#blazor-error-ui {
    background: var(--color-bg-elevated);
    border-top: 2px solid var(--color-error);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(var(--color-shadow-rgb), 0.2);
    color: var(--text-primary);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--color-error-boundary);
    padding: 1rem 1rem 1rem 3.7rem;
    color: var(--text-primary);
}

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

/* ========================================
   Page Animations
   ======================================== */

@keyframes pageSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   Focus Styles
   ======================================== */

/* a:focus-visible: ant-design-blazor.css's `a:focus { outline: 0 }` (0,1,1) outranks a bare :focus-visible, which left
   the logo, sidebar, breadcrumb and in-article links with no keyboard ring (I-043 TASK_07, as StatusPage TASK_06) */
:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ========================================
   Selection Styles
   ======================================== */

::selection {
    background: rgba(var(--color-primary-rgb), 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(var(--color-primary-rgb), 0.3);
    color: var(--text-primary);
}
