/*
 * Flux design tokens: every colour, size, depth and timing used by the office and the factory screens.
 * docs/DESIGN.md says what each one means. Use these names; never write a raw colour, radius, shadow,
 * duration or z-index in a component.
 *
 * Load order (office, from resources/views/filament/head.blade.php): fx-tokens.css, office.css, fx-nav.css,
 * fx-motion.css, fx-inputs.css, fx-pricing.css, fx-sales.css, fx-dashboard.css. The factory screens load
 * fonts.css, fx-tokens.css, fx-motion.css, fx-floor.css.
 *
 * The factory's colour: --fx-brand, --fx-on-brand (text on it) and --fx-brand-text (the colour as text on
 * white, 4.5:1 guaranteed on white only) are printed per factory in a <style> right after the stylesheets.
 * The fallback below has zero specificity, so that <style> always wins. Never put Comfortex red here.
 *
 * Breakpoints (Filament's bands; test at the four target widths):
 *   phone              < 640px   (390)   one column, floating bottom dock, tables as cards
 *   large phone     640-767px            treated like a phone
 *   tablet portrait 768-1023px  (820)   floating bottom dock, two columns where it helps
 *   tablet landscape 1024-1279px (1180) full header navigation, no dock, list and detail side by side
 *   computer          >= 1280px  (1440) full header navigation with icons, content max 86rem
 *   Write them as: (max-width: 639.98px), (min-width: 640px), (max-width: 1023.98px), (min-width: 1024px),
 *   (min-width: 1280px). The dock exists below 1024px. Low landscape phones: (max-height: 480px).
 *   Hover effects only inside (hover: hover) and (pointer: fine); bigger targets inside (pointer: coarse).
 */

:where(:root) {
    --fx-brand: #231f20;
    --fx-on-brand: #ffffff;
    --fx-brand-text: #231f20;
}

:root {
    /* ---------- Surfaces ---------- */
    --fx-canvas: #eceef1;             /* the page */
    --fx-canvas-deep: #e3e6ea;        /* wells on the canvas, empty tracks */
    --fx-surface: #ffffff;            /* panels, cards, inputs */
    --fx-sunk: #f5f6f8;               /* table heads, quiet boxes inside a panel */
    --fx-hover: #f7f8fa;              /* row and tile hover on white */
    --fx-line: #dfe3e8;               /* hairlines between rows */
    --fx-line-2: #c9cfd6;             /* input borders, stronger dividers */
    --fx-line-soft: rgb(31 35 40 / 0.06);

    /* ---------- Ink (text and icons) ---------- */
    --fx-ink: #1f2328;                /* body text: 15.8:1 on white */
    --fx-ink-2: #4b535c;              /* secondary text: 7.8:1 on white */
    --fx-ink-3: #5f6873;              /* hints, labels: 5.65:1 on white, 4.86:1 on canvas; not on glass under .90 */
    --fx-ink-disabled: #8a929c;       /* disabled controls only (3.15:1), never for text that must be read */
    --fx-graphite: #231f20;           /* headings, the header, strong selected states */
    --fx-graphite-2: #2f2a2b;         /* a raised surface on graphite */
    --fx-graphite-3: #3d3738;         /* lines on graphite */

    /* On dark surfaces (the header, the TV, dark chips) */
    --fx-on-dark: #ffffff;
    --fx-on-dark-2: rgb(255 255 255 / 0.85);   /* 9.2:1 on the dark glass over white */
    --fx-on-dark-3: rgb(255 255 255 / 0.72);   /* the lowest for text on dark: 7.1:1 on the glass, 5.1:1 on a .78 tint */
    --fx-on-dark-line: rgb(255 255 255 / 0.14);
    --fx-on-dark-hover: rgb(255 255 255 / 0.10);
    --fx-on-dark-active: rgb(255 255 255 / 0.16);

    /* ---------- The factory's colour, derived (main action, current place, errors only) ---------- */
    --fx-brand-hover: color-mix(in oklab, var(--fx-brand) 88%, black);
    --fx-brand-press: color-mix(in oklab, var(--fx-brand) 76%, black);
    --fx-brand-tint: color-mix(in oklab, var(--fx-brand) 8%, white);     /* error box, current tile */
    --fx-brand-tint-2: color-mix(in oklab, var(--fx-brand) 14%, white);  /* dock pill, pressed current */
    --fx-brand-line: color-mix(in oklab, var(--fx-brand) 45%, white);    /* error field border */
    --fx-brand-glow: color-mix(in oklab, var(--fx-brand) 30%, transparent);

    /* ---------- Status: fixed, never the brand; always with an icon and a word ----------
       -text: words on white, canvas, sunk or the -bg tint (all >= 4.5:1)
       fill: dots, bars, rings, icons beside a word (some are under 3:1 alone: never the only cue)
       -bg: the quiet tint behind a pill or a highlighted row */
    --fx-st-added: #8a929c;     --fx-st-added-text: #4b535c;   --fx-st-added-bg: #eef0f3;    /* Adăugată */
    --fx-st-work: #e5a50a;      --fx-st-work-text: #8a5300;    --fx-st-work-bg: #fdf3d6;     /* În lucru */
    --fx-st-ready: #14b8a6;     --fx-st-ready-text: #0f6b63;   --fx-st-ready-bg: #dff4f1;    /* Gata */
    --fx-st-road: #3b82f6;      --fx-st-road-text: #1d4ed8;    --fx-st-road-bg: #e7effd;     /* Pe drum */
    --fx-st-partly: #84cc16;    --fx-st-partly-text: #4a7012;  --fx-st-partly-bg: #edf6dc;   /* Livrată parțial */
    --fx-st-done: #1f9d55;      --fx-st-done-text: #177245;    --fx-st-done-bg: #e3f3e9;     /* Livrată, predat */
    --fx-st-urgent: #d92d20;    --fx-st-urgent-text: #b42318;  --fx-st-urgent-bg: #fdeceb;   /* Urgent: red, bolt icon, breathes 3 times */
    --fx-st-remark: #ea580c;    --fx-st-remark-text: #a03f0b;  --fx-st-remark-bg: #ffead6;   /* Observație / Problemă: amber-orange, note icon
                                   (text 5.6:1 on its tint, 5.6:1 on canvas; the fill is 3.1:1 on the tint: icons and edges only) */
    --fx-st-cancel: #b3b8bf;    --fx-st-cancel-text: #5f6873;  --fx-st-cancel-bg: #f0f1f3;   /* Anulată: struck through */

    /* Plain meaning, for messages and results */
    --fx-ok: var(--fx-st-done-text);     --fx-ok-fill: var(--fx-st-done);     --fx-ok-bg: var(--fx-st-done-bg);
    --fx-warn: var(--fx-st-work-text);   --fx-warn-fill: var(--fx-st-work);   --fx-warn-bg: var(--fx-st-work-bg);
    --fx-bad: var(--fx-st-urgent-text);  --fx-bad-fill: var(--fx-st-urgent);  --fx-bad-bg: var(--fx-st-urgent-bg);
    --fx-info: var(--fx-st-road-text);   --fx-info-fill: var(--fx-st-road);   --fx-info-bg: var(--fx-st-road-bg);

    /* The same meanings on dark surfaces (TV, dark toasts): softer, all >= 5.7:1 on graphite */
    --fx-ok-on-dark: #4ade80;
    --fx-warn-on-dark: #fbbf24;
    --fx-bad-on-dark: #ff7a6b;
    --fx-info-on-dark: #93c5fd;
    --fx-ready-on-dark: #5eead4;
    --fx-partly-on-dark: #bef264;
    --fx-muted-on-dark: #a7aeb6;

    /* ---------- Type: Instrument Sans, one family; its width axis gives the narrow figures ---------- */
    --fx-font: 'Instrument Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
    /* Office text, named by what it is for: six sizes, each clearly apart from the next (DESIGN 3). What matters
       more is shown by weight and by the three greys, not by one pixel. In the office the numbered names below
       point at these (public/css/fx-calm.css); the factory screens keep their own bigger numbered sizes. */
    --fx-text-micro: 0.75rem;         /* 12: badges and pills, chart axes, the small dates under a stage */
    --fx-text-small: 0.875rem;        /* 14: everything secondary: hints, second lines, table cells, labels */
    --fx-text-body: 1rem;             /* 16: body, fields, panel titles, buttons, the side menu */
    --fx-text-title-phone: 1.375rem;  /* 22: the page title on a phone */
    --fx-text-title: 1.625rem;        /* 26: the page title and the key figures */
    --fx-text-total: 2rem;            /* 32: totals */
    --fx-fs-12: 0.75rem;    /* micro: badges, chart axes (never smaller) */
    --fx-fs-13: 0.8125rem;  /* small: hints, secondary lines */
    --fx-fs-14: 0.875rem;   /* UI: table cells, labels, buttons */
    --fx-fs-16: 1rem;       /* body, inputs (16 on phones so iOS does not zoom) */
    --fx-fs-18: 1.125rem;   /* lead, panel titles on phone */
    --fx-fs-20: 1.25rem;    /* panel titles */
    --fx-fs-24: 1.5rem;     /* page title on phone, section figures */
    --fx-fs-30: 1.875rem;   /* page title */
    --fx-fs-38: 2.375rem;   /* key figures */
    --fx-fs-48: 3rem;       /* hero figures (dashboard, totals) */
    --fx-fs-60: 3.75rem;    /* factory-screen figures */
    --fx-fs-hero: clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem);   /* the dashboard's main numbers */
    --fx-lh-tight: 1.08;    /* figures */
    --fx-lh-snug: 1.25;     /* headings */
    --fx-lh-body: 1.5;      /* text */
    --fx-fw-regular: 400;
    --fx-fw-medium: 500;
    --fx-fw-semibold: 600;
    --fx-fw-strong: 650;    /* headings, figures */
    --fx-fw-bold: 700;
    --fx-wdth-head: 88%;    /* headings: font-stretch */
    --fx-wdth-num: 86%;     /* figures: font-stretch, with tabular-nums */
    --fx-track-head: -0.02em;
    --fx-track-num: -0.015em;

    /* ---------- Space: a 4px grid ---------- */
    --fx-s-1: 0.25rem;   /* 4 */
    --fx-s-2: 0.5rem;    /* 8 */
    --fx-s-3: 0.75rem;   /* 12 */
    --fx-s-4: 1rem;      /* 16 */
    --fx-s-5: 1.25rem;   /* 20 */
    --fx-s-6: 1.5rem;    /* 24 */
    --fx-s-7: 2rem;      /* 32 */
    --fx-s-8: 2.5rem;    /* 40 */
    --fx-s-9: 3rem;      /* 48 */
    --fx-s-10: 4rem;     /* 64 */
    /* Gaps that group: closer means together (DESIGN 4). */
    --fx-gap-in: 8px;        /* between the parts of one row: an icon and its word, a name and its second fact */
    --fx-gap-row: 12px;      /* between rows of one group */
    --fx-gap-group: 24px;    /* between groups: panels side by side or one under the other (16 on a phone) */
    --fx-gap-section: 32px;  /* between sections: the page's title and what follows it (24 on a phone) */
    --fx-gutter: 32px;           /* page side margin (changes per band, below) */
    --fx-gap: 20px;              /* between panels */
    --fx-pad-panel: 24px;        /* inside a panel */
    --fx-content-max: 86rem;     /* the header and the page content share this width and these gutters */

    /* ---------- Corners: bigger as things float higher; inner radius = outer radius - padding ---------- */
    --fx-r-xs: 6px;          /* tiny marks inside controls */
    --fx-r-ctl: 10px;        /* buttons, inputs, chips that are not pills */
    --fx-r-card: 14px;       /* cards and tiles inside a panel */
    --fx-r-panel: 18px;      /* panels on the canvas (16 on phones) */
    --fx-r-float: 22px;      /* header, dock, popovers, toasts, floating bars */
    --fx-r-sheet: 26px;      /* the top corners of a bottom sheet; modals */
    --fx-r-pill: 999px;      /* status pills, the dock's pill, badges */

    /* ---------- Depth: one light from straight above, cool-tinted layered shadows ---------- */
    --fx-shadow-0: 0 0 0 1px var(--fx-line);                                                   /* flat: hairline only */
    --fx-shadow-1: 0 0 0 1px rgb(31 35 40 / 0.06), 0 1px 2px rgb(31 35 40 / 0.05),
                   0 4px 10px -2px rgb(31 35 40 / 0.05), 0 14px 28px -14px rgb(31 35 40 / 0.12);       /* resting panel */
    --fx-shadow-2: 0 0 0 1px rgb(31 35 40 / 0.06), 0 2px 4px rgb(31 35 40 / 0.05),
                   0 10px 20px -6px rgb(31 35 40 / 0.09), 0 24px 44px -18px rgb(31 35 40 / 0.20);      /* raised: hover, selected card */
    --fx-shadow-3: 0 0 0 1px rgb(31 35 40 / 0.07), 0 2px 6px rgb(31 35 40 / 0.06),
                   0 14px 28px -8px rgb(31 35 40 / 0.14), 0 36px 64px -24px rgb(31 35 40 / 0.26);      /* floating: dock, popover, toast, bars */
    --fx-shadow-4: 0 0 0 1px rgb(31 35 40 / 0.07), 0 4px 12px rgb(31 35 40 / 0.08),
                   0 28px 56px -14px rgb(31 35 40 / 0.26), 0 56px 110px -28px rgb(31 35 40 / 0.34);    /* sheets, modals */
    --fx-shadow-dark: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 10px 24px -8px rgb(20 16 17 / 0.40),
                      0 28px 56px -24px rgb(20 16 17 / 0.40);                                            /* the graphite header */
    --fx-shadow-brand: 0 1px 2px color-mix(in oklab, var(--fx-brand) 40%, transparent),
                       0 8px 18px -8px color-mix(in oklab, var(--fx-brand) 70%, transparent);           /* the main button */
    --fx-shadow-inset: inset 0 0 0 1px var(--fx-line);
    --fx-shadow-press: inset 0 1px 3px rgb(31 35 40 / 0.14);
    --fx-shadow: var(--fx-shadow-1);        /* old name */
    --fx-shadow-lift: var(--fx-shadow-2);   /* old name */

    /* ---------- Glass: only the header, dock, sheets, floating bars, popovers and toasts ---------- */
    --fx-glass: rgb(255 255 255 / 0.82);           /* ink and ink-2 only on it */
    --fx-glass-strong: rgb(255 255 255 / 0.92);    /* when small grey (ink-3) text sits on it */
    --fx-glass-solid: #fbfbfc;                     /* what glass becomes when blur is off */
    --fx-glass-filter: saturate(180%) blur(20px);
    --fx-glass-dark: rgb(35 31 32 / 0.9);          /* still reads as graphite; white text 12:1 even over pure white */
    --fx-glass-dark-solid: rgb(35 31 32 / 0.97);
    --fx-glass-dark-filter: saturate(150%) blur(16px);
    --fx-glass-edge: inset 0 1px 0 rgb(255 255 255 / 0.7), inset 0 0 0 1px rgb(255 255 255 / 0.35);
    --fx-glass-edge-dark: inset 0 1px 0 rgb(255 255 255 / 0.08), inset 0 0 0 1px rgb(255 255 255 / 0.05);
    --fx-glass-sheen: linear-gradient(180deg, rgb(255 255 255 / 0.07), rgb(255 255 255 / 0) 60%); /* top light on dark glass */
    --fx-blur-1: 8px;
    --fx-blur-2: 16px;
    --fx-blur-3: 24px;
    --fx-scrim: rgb(20 18 19 / 0.42);              /* behind sheets and modals; never blurred */

    /* The factory's wing: the page motif, drawn from the factory's own icon (see the end of this file) */
    --fx-wing-light: rgb(255 255 255 / 0.78);  /* on the canvas: lighter than the page, so text only gains contrast */
    --fx-wing-ink: rgb(35 31 32 / 0.045);      /* on white panels and around floating cards: grey hint text keeps 5.2:1 */

    /* The slat: the shutter's louvre, for belts and the dashboard's opening (no longer a page texture) */
    --fx-slat: 24px;
    --fx-slats: repeating-linear-gradient(180deg, transparent 0 23px, rgb(35 31 32 / 0.055) 23px 24px);
    --fx-slats-dark: repeating-linear-gradient(180deg, transparent 0 23px, rgb(255 255 255 / 0.035) 23px 24px);

    /* ---------- Motion ---------- */
    --fx-dur-1: 100ms;      /* press, toggle, colour change */
    --fx-dur-2: 160ms;      /* hover, focus, tooltip, small popover */
    --fx-dur-3: 240ms;      /* dropdown, toast in, dock pill slide, accordion */
    --fx-dur-4: 320ms;      /* sheet, drawer, modal in, page content in, a moved row */
    --fx-dur-5: 500ms;      /* a large surface, a chart re-layout */
    --fx-dur-exit-3: 180ms; /* exits are about 30% shorter */
    --fx-dur-exit-4: 220ms;
    --fx-dur-show: 800ms;   /* first-show only: count-up, chart draw, belt run-in */
    --fx-dur-count: 380ms;  /* a live value counting from old to new */
    --fx-dur-pulse: 700ms;  /* the tint that fades after a live change */
    --fx-dur-breathe: 1600ms; /* one breath of an urgent item: 3 breaths stay under 5s (no pause control needed) */
    --fx-dur-belt: 1400ms;  /* one slat period of a running belt */
    --fx-ease: cubic-bezier(0.2, 0.7, 0.2, 1);        /* the house ease-out */
    --fx-ease-out: cubic-bezier(0.23, 1, 0.32, 1);    /* strong ease-out for presses and small things */
    --fx-ease-enter: cubic-bezier(0.05, 0.7, 0.1, 1); /* things arriving */
    --fx-ease-exit: cubic-bezier(0.3, 0, 0.8, 0.15);  /* things leaving */
    --fx-ease-move: cubic-bezier(0.2, 0, 0, 1);       /* things moving on screen: pills, rows, chips */
    --fx-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* breathing */
    --fx-ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1); /* a small overshoot: dock pill, success tick; never on data */
    --fx-stagger: 50ms;     /* between items arriving; at most 8 steps (400ms) */

    /* ---------- Layers (Filament: dropdowns 20, modals 40/50, notifications 50) ---------- */
    --fx-z-raised: 1;
    --fx-z-sticky: 10;      /* sticky table heads, sticky side panes inside the page */
    --fx-z-dropdown: 20;    /* menus inside the page (Filament's own) */
    --fx-z-bar: 25;         /* floating bottom bars: price bar, form actions, "Mașina pleacă" */
    --fx-z-header: 30;      /* the header and its own menus */
    --fx-z-dock: 32;        /* the phone and tablet dock */
    --fx-z-scrim: 36;       /* behind a sheet or the side menu */
    --fx-z-sheet: 37;       /* "Mai mult", the side menu, any bottom sheet */
    --fx-z-modal: 40;       /* modal backdrop (Filament's own) */
    --fx-z-modal-window: 50;/* modal window (Filament's own) */
    --fx-z-toast: 55;       /* toasts and notifications, above modals */
    --fx-z-top: 70;         /* skip link, offline badge, page progress */

    /* ---------- Touch and focus ---------- */
    --fx-tap: 44px;          /* the smallest target on phone and tablet */
    --fx-tap-lg: 48px;       /* dock items, sheet tiles */
    --fx-tap-main: 48px;     /* the main action of a page on phone */
    --fx-focus-color: var(--fx-graphite);
    --fx-focus-color-dark: #ffffff;
    --fx-focus-width: 2px;
    --fx-focus-offset: 2px;
    --fx-focus-ring: 0 0 0 2px var(--fx-surface), 0 0 0 4px var(--fx-focus-color); /* for clipped elements */

    /* ---------- Frame: safe areas, header, dock and everything that floats at the bottom ---------- */
    --fx-safe-t: env(safe-area-inset-top, 0px);
    --fx-safe-r: env(safe-area-inset-right, 0px);
    --fx-safe-b: env(safe-area-inset-bottom, 0px);
    --fx-safe-l: env(safe-area-inset-left, 0px);
    --fx-hdr-gap: 12px;      /* space above the floating header */
    --fx-hdr-h: 64px;        /* the header's height */
    --fx-top-stack: calc(var(--fx-safe-t) + var(--fx-hdr-gap) + var(--fx-hdr-h) + 8px); /* what the header covers */
    --fx-dock-h: 0px;        /* 64px while a dock exists (below 1024px); see below */
    --fx-dock-gap: 10px;     /* space under the dock and under floating bars */
    --fx-bar-h: 0px;         /* height of a floating bottom bar; fx-motion.js measures [data-fx-bottom-bar] */
    --fx-bottom-gap: calc(var(--fx-dock-gap) + var(--fx-safe-b));
    --fx-bottom-stack: calc(var(--fx-bottom-gap) + var(--fx-dock-h) + var(--fx-bar-h)); /* what floats at the bottom */
}

/* ---------- Per band (the gutters are Filament's own: 16 / 24 / 32) ---------- */
@media (max-width: 1279.98px) {
    :root { --fx-gap: 16px; --fx-pad-panel: 20px; }
}
@media (max-width: 1023.98px) {
    :root { --fx-gutter: 24px; --fx-hdr-h: 56px; --fx-hdr-gap: 10px; }
    :root:has(.fx-dock) { --fx-dock-h: 64px; }
}
@media (max-width: 767.98px) {
    :root { --fx-gutter: 16px; }
}
@media (max-width: 639.98px) {
    :root { --fx-gap: 12px; --fx-pad-panel: 16px; --fx-r-panel: 16px; --fx-hdr-gap: 8px; --fx-tap-main: 52px; }
}
@media (max-height: 480px) and (max-width: 1023.98px) {
    :root:has(.fx-dock) { --fx-dock-h: 52px; }   /* landscape phone: the dock shows icons only */
}

/* ---------- A spring with real overshoot where the browser can draw it ---------- */
@supports (transition-timing-function: linear(0, 1)) {
    :root {
        --fx-ease-spring: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%,
            1.105 25.8%, 1.098 27.5%, 1.056 31.6%, 1.007 36.4%, 0.988 40.2%, 0.981 43.5%, 0.993 52.1%, 1.002 61.5%, 1);
    }
}

/* ---------- Glass falls back to solid where blur is missing or unwanted ---------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
        --fx-glass: var(--fx-glass-solid);
        --fx-glass-strong: var(--fx-glass-solid);
        --fx-glass-dark: var(--fx-glass-dark-solid);
        --fx-glass-filter: none;
        --fx-glass-dark-filter: none;
    }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    :root {
        --fx-glass: var(--fx-glass-solid);
        --fx-glass-strong: var(--fx-glass-solid);
        --fx-glass-dark: var(--fx-glass-dark-solid);
        --fx-glass-filter: none;
        --fx-glass-dark-filter: none;
        --fx-ink-3: #4b535c;
    }
}

/* ---------- No motion for people who asked their system for less ---------- */
@media (prefers-reduced-motion: reduce) {
    :root {
        --fx-dur-1: 0ms; --fx-dur-2: 0ms; --fx-dur-3: 0ms; --fx-dur-4: 0ms; --fx-dur-5: 0ms;
        --fx-dur-exit-3: 0ms; --fx-dur-exit-4: 0ms; --fx-dur-show: 0ms; --fx-dur-count: 0ms;
        --fx-dur-pulse: 0ms; --fx-stagger: 0ms;
    }
}

/* ---------- Factory screens (tablet, delivery, print station): solid, bigger, no blur ----------
   The factory layout puts class="fx-factory" on <html> (html.… so it wins over :root and the brand <style>). */
html.fx-factory {
    --fx-glass: var(--fx-surface);
    --fx-glass-strong: var(--fx-surface);
    --fx-glass-dark: var(--fx-graphite);
    --fx-glass-filter: none;
    --fx-glass-dark-filter: none;
    /* in rem, so they grow with the device's size switch (account menu › Mărime) */
    --fx-tap: 3.5rem;        /* every button (56 at normal size) */
    --fx-tap-lg: 4rem;       /* tabs, secondary actions (64) */
    --fx-tap-main: 5.5rem;   /* the action of the row or the screen, for gloves (88) */
    --fx-gap: 16px;          /* never closer than this between two targets */
}
/* The size switch of a factory device: the root grows, text and buttons together (remembered on that device). */
html.fx-factory[data-fx-size="l"] { font-size: 120%; }
html.fx-factory[data-fx-size="xl"] { font-size: 140%; }

/* ---------- The TV board: dark, no blur, colours for a dark room ----------
   The TV layout puts class="fx-tv" on <html> (html.… so it wins over :root and the brand <style>).
   On the TV, text is --fx-ink / -2 / -3 (light); --fx-graphite stays dark: use it for surfaces, never as text. */
html.fx-tv {
    --fx-canvas: #231f20;
    --fx-canvas-deep: #1b1718;
    --fx-surface: #2c2728;
    --fx-sunk: #262122;
    --fx-hover: #332d2e;
    --fx-line: var(--fx-graphite-3);
    --fx-line-2: #4a4344;
    --fx-line-soft: rgb(255 255 255 / 0.06);
    --fx-ink: #f4f5f7;
    --fx-ink-2: #d5d9de;
    --fx-ink-3: var(--fx-muted-on-dark);
    --fx-ink-disabled: #6f6869;
    --fx-brand-text: var(--fx-ink);            /* the factory's colour is never text on the dark board */
    --fx-brand-tint: color-mix(in oklab, var(--fx-brand) 22%, #2c2728);
    --fx-brand-tint-2: color-mix(in oklab, var(--fx-brand) 32%, #2c2728);
    --fx-brand-line: color-mix(in oklab, var(--fx-brand) 70%, #2c2728);
    --fx-ok: var(--fx-ok-on-dark);
    --fx-warn: var(--fx-warn-on-dark);
    --fx-bad: var(--fx-bad-on-dark);
    --fx-info: var(--fx-info-on-dark);
    --fx-st-added-text: #d5d9de;    --fx-st-added-bg: color-mix(in oklab, var(--fx-st-added) 22%, #2c2728);
    --fx-st-work-text: var(--fx-warn-on-dark);     --fx-st-work-bg: color-mix(in oklab, var(--fx-st-work) 22%, #2c2728);
    --fx-st-ready-text: var(--fx-ready-on-dark);   --fx-st-ready-bg: color-mix(in oklab, var(--fx-st-ready) 22%, #2c2728);
    --fx-st-road-text: var(--fx-info-on-dark);     --fx-st-road-bg: color-mix(in oklab, var(--fx-st-road) 22%, #2c2728);
    --fx-st-partly-text: var(--fx-partly-on-dark); --fx-st-partly-bg: color-mix(in oklab, var(--fx-st-partly) 22%, #2c2728);
    --fx-st-done-text: var(--fx-ok-on-dark);       --fx-st-done-bg: color-mix(in oklab, var(--fx-st-done) 22%, #2c2728);
    --fx-st-urgent-text: var(--fx-bad-on-dark);    --fx-st-urgent-bg: color-mix(in oklab, var(--fx-st-urgent) 18%, #2c2728);
    --fx-st-remark-text: #fdba74;                  --fx-st-remark-bg: color-mix(in oklab, var(--fx-st-remark) 18%, #2c2728); /* 7:1 */
    --fx-st-cancel-text: var(--fx-muted-on-dark);  --fx-st-cancel-bg: color-mix(in oklab, var(--fx-st-cancel) 14%, #2c2728);
    --fx-slats: var(--fx-slats-dark);
    --fx-glass: var(--fx-surface);
    --fx-glass-strong: var(--fx-surface);
    --fx-glass-solid: var(--fx-surface);
    --fx-glass-dark: var(--fx-surface);
    --fx-glass-filter: none;
    --fx-glass-dark-filter: none;
    --fx-focus-color: #ffffff;
    --fx-tv-safe: 5vh 5vw;   /* keep everything inside the inner 90% */
    --fx-tv-fs-key: 10vh;    /* key numbers: readable from 6 m on a 55" screen */
    --fx-tv-fs-text: 5vh;    /* names and secondary text: readable from 3 m */
    --fx-tv-fs-small: 3vh;   /* only for what nobody needs to read from afar (time of update) */
}

/* ---------- Base: shared by every screen ---------- */
[x-cloak] { display: none !important; }
.fx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html {
    scroll-padding-top: var(--fx-top-stack);
    scroll-padding-bottom: calc(var(--fx-bottom-stack) + var(--fx-s-2));
    -webkit-tap-highlight-color: transparent;
}
::selection { background: rgb(35 31 32 / 0.14); }
/* ---------- The factory's wing: its own mark as a large, very faint motif ----------
   Used sparingly: behind the login card (and the error pages' panel), at the top of the dashboard behind the
   greeting, and in empty states. The page prints --fx-wing (the mark, App\Support\Branding::mark()) and
   --fx-wing-on ('') inside @media screen, only when the factory has an icon: with no icon, or on paper, content
   stays none and nothing is drawn. A host gets the shared layer below and places it with --fx-wing-x / -y (its
   centre), --fx-wing-size and --fx-wing-tone (--fx-wing-light on the canvas, --fx-wing-ink on white). It sits
   behind the host's content (never over text, never in the way of a tap) and settles in with one slow drift when
   it appears, then stays still. */
.fx-wing-host { position: relative; isolation: isolate; }
:is(.fx-wing-host, .fi-simple-main-ctn, .fi-ta-empty-state)::before {
    content: var(--fx-wing-on, none);
    position: absolute;
    z-index: -1;
    top: var(--fx-wing-y, 50%);
    left: var(--fx-wing-x, 50%);
    width: var(--fx-wing-size, 22rem);
    aspect-ratio: 1;
    translate: -50% -50%;
    pointer-events: none;
    background: var(--fx-wing-tone, var(--fx-wing-ink));
    -webkit-mask: var(--fx-wing) center / contain no-repeat;
    mask: var(--fx-wing) center / contain no-repeat;
}
@keyframes fx-wing-in { from { opacity: 0; transform: translate(-3%, 5%) rotate(-5deg) scale(0.92); } }
html.fx-motion :is(.fx-wing-host, .fi-simple-main-ctn, .fi-ta-empty-state)::before {
    animation: fx-wing-in 2400ms var(--fx-ease-enter) 120ms backwards;   /* once: a slow settle, then still */
}

/* The office page: the same width and side margins as the header, and room for whatever floats at the bottom
   (dock, price bar, form actions). */
.fi-main {
    max-width: calc(var(--fx-content-max) + 2 * var(--fx-gutter));
    padding-inline: max(var(--fx-gutter), var(--fx-safe-l)) max(var(--fx-gutter), var(--fx-safe-r));
    padding-bottom: calc(var(--fx-bottom-stack) + var(--fx-s-6));
}
