/*
 * ds tokens — the ONE source of design values for the ds design system (login, app shell, page
 * content). Components use var(--ds-*) only; a raw colour / px value that a token covers is a bug.
 *
 * Brand colours come from settings: <x-ds.theme> (unlayered <style> on :root) overrides the
 * fallbacks marked "theme" below on every request. Everything else is fixed here.
 *
 * Cascade layers are declared once, by layouts/ds/assets.blade.php, before any stylesheet:
 *   @layer ds-override, legacy, ds.tokens, ds.base, ds.layout, ds.components, ds.shell, ds.vendors, ds.utilities;
 *
 * Breakpoints (CSS variables cannot be used in @media; these are the only widths allowed there,
 * written in rem — 1rem = 16px in media queries whatever the root font size). They match Bootstrap
 * so the page grid (.col-md-*, .col-lg-*) and ds agree.
 *   @custom-media --ds-phone   (max-width: 47.99rem)   <  768px   one column, sheets, 16px inputs
 *   @custom-media --ds-tablet  (min-width: 48rem)      ≥  768px
 *   @custom-media --ds-desktop (min-width: 62rem)      ≥  992px   docked sidebar, draggable modals
 *   @custom-media --ds-wide    (min-width: 75rem)      ≥ 1200px
 *   @custom-media --ds-touch   (pointer: coarse)       touch: 44px targets
 * ds.js mirrors them as ds.media.{phone,tablet,desktop,wide,touch}.
 */

@layer ds.tokens {
    :root {
        /* ── brand (theme) ─────────────────────────────────────────────── */
        --ds-primary: #2f6fed;          /* brand colour: primary buttons, focus halo */
        --ds-primary-ink: #ffffff;      /* text on --ds-primary (≥ 4.5:1) */
        --ds-primary-edge: var(--ds-primary);   /* border of a --ds-primary fill: the strong border when primary is white-ish (< 1.1:1 on white) */
        --ds-dark: #1b2321;             /* brand dark (sidebar colour) */
        --ds-dark-ink: #ffffff;
        --ds-accent: #2f6fed;           /* marks / active states on white (≥ 3:1) */
        --ds-solid: #2f6fed;            /* brand fill under WHITE text (≥ 4.5:1) — legacy bridge */
        --ds-solid-rgb: 47, 111, 237;
        --ds-side: #1b2321;             /* app shell sidebar: background / ink / accent */
        --ds-side-ink: #ffffff;
        --ds-side-accent: #ffffff;
        --ds-bar: #ffffff;              /* app shell top bar: background / ink / accent */
        --ds-bar-ink: #141a19;
        --ds-bar-accent: #2f6fed;

        /* ── neutral ramp (slightly green-grey, sits beside the dark brand colour) ── */
        --ds-gray-0: #ffffff;
        --ds-gray-25: #fafbfa;
        --ds-gray-50: #f6f7f6;
        --ds-gray-100: #eef0ef;
        --ds-gray-200: #dde2e1;
        --ds-gray-300: #c4cbca;
        --ds-gray-400: #8a9492;         /* 3.1:1 on white: the lightest colour allowed for control outlines */
        --ds-gray-500: #66716f;         /* 5.0:1 on white, 4.7:1 on the canvas: small muted text (was #6f7a78 = 4.43:1, axe QA 11-Nov) */
        --ds-gray-600: #5b6664;         /* 5.9:1 on white */
        --ds-gray-700: #3d4745;
        --ds-gray-800: #252e2c;
        --ds-gray-900: #141a19;

        /* ── colour roles ───────────────────────────────────────────────── */
        --ds-canvas: var(--ds-gray-50);         /* page background */
        --ds-surface: var(--ds-gray-0);         /* cards, controls, overlays */
        --ds-surface-2: var(--ds-gray-25);      /* subtle fill inside a surface (table head, card footer) */
        --ds-hover: var(--ds-gray-100);         /* hover / pressed fill of rows and quiet buttons */
        --ds-border: var(--ds-gray-200);        /* dividers, card outlines */
        --ds-border-strong: var(--ds-gray-400); /* control outlines */
        --ds-text: var(--ds-gray-900);
        --ds-text-muted: var(--ds-gray-600);    /* help text, subtitles, meta */
        --ds-placeholder: var(--ds-gray-500);   /* 5.0:1 on white */
        --ds-disabled-bg: var(--ds-gray-50);
        --ds-disabled-text: var(--ds-gray-500);

        /* status: X = strong colour (fill, and text on white when ≥ 4.5:1), X-ink = text on X,
           X-text = text on white / on X-bg, X-bg = subtle fill, X-border = subtle outline */
        --ds-danger: #b42318;   --ds-danger-rgb: 180, 35, 24;   --ds-danger-ink: #ffffff;  --ds-danger-text: #b42318;  --ds-danger-bg: #fef3f2;  --ds-danger-border: #f5c2bd;
        --ds-success: #067647;  --ds-success-rgb: 6, 118, 71;   --ds-success-ink: #ffffff; --ds-success-text: #067647; --ds-success-bg: #ecfdf3; --ds-success-border: #abefc6;
        --ds-info: #175cd3;     --ds-info-rgb: 23, 92, 211;     --ds-info-ink: #ffffff;    --ds-info-text: #175cd3;    --ds-info-bg: #eff8ff;    --ds-info-border: #b2ddff;
        --ds-warning: #f5a524;  --ds-warning-rgb: 245, 165, 36; --ds-warning-ink: #141a19; --ds-warning-text: #93370d; --ds-warning-bg: #fffaeb; --ds-warning-border: #fedf89;
        --ds-neutral: var(--ds-gray-600); --ds-neutral-rgb: 91, 102, 100; --ds-neutral-ink: #ffffff; --ds-neutral-text: var(--ds-gray-700); --ds-neutral-bg: var(--ds-gray-100); --ds-neutral-border: var(--ds-gray-200);

        /* focus: dark outline + primary halo — visible on light surfaces whatever the primary is */
        --ds-focus: var(--ds-primary-edge);   /* focused field border = brand colour, no dark line (user 23-Oct) */
        --ds-focus-halo: color-mix(in srgb, var(--ds-primary) 45%, transparent);
        --ds-focus-ring: 0 0 0 3px var(--ds-focus-halo);          /* box-shadow of focused controls */
        --ds-focus-ring-danger: 0 0 0 1px var(--ds-danger), 0 0 0 4px color-mix(in srgb, var(--ds-danger) 18%, transparent);
        --ds-focus-width: 2px;
        --ds-focus-outline: var(--ds-focus-width) solid var(--ds-focus);                       /* outline of focused buttons / links */
        --ds-focus-offset: 2px;
        /* login (48px controls): the same ring with a wider halo */
        --ds-focus-halo-lg: 0 0 0 5px var(--ds-focus-halo);
        --ds-focus-ring-lg: var(--ds-focus-halo-lg);
        --ds-focus-ring-lg-danger: 0 0 0 1px var(--ds-danger), 0 0 0 5px color-mix(in srgb, var(--ds-danger) 18%, transparent);

        /* ── type ───────────────────────────────────────────────────────── */
        /* 27-Nov-2026 (Dede: the old font was not user friendly): Inter, self-hosted (assets/fonts/inter/inter.css) */
        --ds-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
        --ds-font-mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
        --ds-text-3xs: 0.6875rem;   /* 11  counters on icons, module tags in the menu */
        --ds-text-2xs: 0.75rem;     /* 12  badges, table meta */
        --ds-text-xs: 0.8125rem;    /* 13  help / error text, captions */
        --ds-text-sm: 0.875rem;     /* 14  content body, controls (desktop), table cells */
        --ds-text-md: 1rem;         /* 16  controls on phones (no iOS zoom), login body */
        --ds-text-lg: 1.125rem;     /* 18  card / section headings */
        --ds-text-xl: 1.25rem;      /* 20  modal titles, page title on phones */
        --ds-text-2xl: 1.5rem;      /* 24  page title */
        --ds-text-3xl: 1.75rem;     /* 28  login heading */
        --ds-text-floor: var(--ds-text-2xs);   /* 12  the smallest text on a phone: small, code, KPI amounts (base.css, feedback.css) */
        --ds-leading: 1.5;
        --ds-leading-tight: 1.25;   /* headings, labels, buttons, menu rows */
        --ds-leading-snug: 1.4;     /* alerts, strips, error text */
        --ds-leading-relaxed: 1.6;  /* long-form lines (login tagline) */
        --ds-leading-none: 1;       /* icon glyphs */
        --ds-weight-regular: 400;
        --ds-weight-medium: 500;
        --ds-weight-semibold: 600;
        --ds-weight-bold: 700;
        --ds-tracking-tight: -0.015em;
        /* icon glyphs (icon fonts, inline SVG) */
        --ds-glyph-xs: 0.875rem;    /* 14 */
        --ds-glyph-sm: 1rem;        /* 16 */
        --ds-glyph-md: 1.125rem;    /* 18 */
        --ds-glyph-lg: 1.25rem;     /* 20 */
        --ds-glyph-xl: 1.375rem;    /* 22 */
        --ds-underline-offset: 3px;

        /* ── space (4px grid) ───────────────────────────────────────────── */
        --ds-space-0: 0;
        --ds-space-px: 1px;
        --ds-space-1: 0.25rem;
        --ds-space-2: 0.5rem;
        --ds-space-3: 0.75rem;
        --ds-space-4: 1rem;
        --ds-space-5: 1.25rem;
        --ds-space-6: 1.5rem;
        --ds-space-8: 2rem;
        --ds-space-10: 2.5rem;
        --ds-space-12: 3rem;
        --ds-space-16: 4rem;

        /* page rhythm: content padding and the gap between blocks (cards, header, filters) */
        --ds-page-pad-x: var(--ds-space-4);
        --ds-page-pad-y: var(--ds-space-4);
        --ds-page-gap: var(--ds-space-4);
        --ds-card-pad: var(--ds-space-4);
        --ds-card-header-h: calc(var(--ds-control-h-sm) + 2 * var(--ds-space-3) + var(--ds-border-width));   /* fits a small button */

        /* ── shape ──────────────────────────────────────────────────────── */
        --ds-border-width: 1px;
        --ds-rule-strong: 2px;      /* accent rules (top bar underline, login tagline), spinner ring, counter halo */
        --ds-radius-2xs: 2px;       /* hairline marks (active nav marker), focus outline corners */
        --ds-radius-xs: 4px;        /* badges, checkboxes */
        --ds-radius-sm: 6px;        /* small buttons, menu items */
        --ds-radius-md: 8px;        /* controls, buttons */
        --ds-radius: 10px;          /* cards, login controls */
        --ds-radius-lg: 14px;       /* modals, sheets */
        --ds-radius-pill: 999px;
        --ds-radius-control: var(--ds-radius-md);
        --ds-radius-card: var(--ds-radius);

        /* scrollbars (base.css): a rounded thumb inset inside the track, tinted with the brand colour */
        --ds-scroll-size: 0.75rem;
        --ds-scroll-inset: 3px;
        --ds-scroll-thumb-min: var(--ds-control-h);
        --ds-scroll-thumb: color-mix(in srgb, var(--ds-primary) 45%, var(--ds-border-strong));
        --ds-scroll-thumb-hover: color-mix(in srgb, var(--ds-primary) 75%, var(--ds-border-strong));
        --ds-scroll-thumb-active: var(--ds-primary);

        /* one elevation level, for things that float over the page only (menus, popups, modals,
           drawer). Cards and controls are flat (border, no shadow). */
        --ds-shadow: 0 12px 32px -8px rgb(20 26 25 / .22), 0 2px 6px rgb(20 26 25 / .08);
        --ds-scrim: rgb(9 14 13 / .45);   /* behind modals, the drawer and sheets */

        /* ── controls ───────────────────────────────────────────────────── */
        --ds-control-h: 2.5rem;     /* 40  default (desktop) */
        --ds-control-h-sm: 2rem;    /* 32  Bootstrap -sm (dense tables, filters) */
        --ds-control-h-lg: 3rem;    /* 48  login, -lg */
        --ds-control-pad-x: var(--ds-space-3);
        --ds-control-font: var(--ds-text-sm);
        --ds-target: 2.75rem;       /* 44  minimum touch target */
        --ds-tour-width: 22rem;     /* 352  onboarding tour card */
        --ds-tour-width-wide: 26rem; /* 416  a detailed tour step (What this changes / Depends on) */
        --ds-help-width: 18rem;     /* 288  help balloon */

        /* ── z-index (Bootstrap's scale, named; the shell drawer sits under modals) ── */
        --ds-z-raised: 1;
        --ds-z-dropdown: 1000;
        --ds-z-sticky: 1020;
        --ds-z-bar: 1030;
        --ds-z-drawer-backdrop: 1044;
        --ds-z-drawer: 1045;
        --ds-z-modal-backdrop: 1050;
        --ds-z-modal: 1055;
        --ds-z-popup: 1070;         /* select2 dropdown, date picker, popover: above modals */
        --ds-z-tooltip: 1080;
        --ds-z-viewer: 1085;        /* file viewer (js/navigation.js): over modals, popups and tooltips */
        --ds-z-toast: 1090;
        --ds-z-tour: 1095;          /* onboarding tour: spotlight + card above modals, the drawer and toasts (js/tour.js) */
        --ds-z-skip: 2000;

        /* ── motion ─────────────────────────────────────────────────────── */
        --ds-ease: cubic-bezier(.2, .7, .2, 1);
        --ds-dur-fast: 100ms;
        --ds-dur: 140ms;
        --ds-dur-slow: 220ms;
        --ds-hover-intent: 120ms;   /* delay before a hover opens something (rail); not motion */

        /* ── shell metrics (layouts/ds) ─────────────────────────────────── */
        --ds-side-w: 16.5rem;
        --ds-rail-w: 4.5rem;
        --ds-bar-h: 3.75rem;
        --ds-shell-target: 2.5rem;      /* 40  nav rows, menu items, icon buttons (44 on touch) */
        --ds-shell-target-sm: 2.25rem;  /* 36  sub-nav rows, sidebar filter, strip buttons (44 on touch) */
        --ds-nav-icon-w: 1.375rem;      /* the icon column of a nav row; sub levels hang off its centre */
        --ds-nav-mark-w: 3px;           /* the active-page marker */
        --ds-nav-mark-h: 1.25rem;
        --ds-nav-mark-h-sub: 1.125rem;
        --ds-side-logo-h: 2.25rem;
        --ds-side-logo-max: 10rem;
        --ds-bar-logo-h: 2rem;
        --ds-bar-logo-max: 7.5rem;
        --ds-bar-label-max: 11rem;
        --ds-user-name-max: 10rem;
        --ds-avatar: 2rem;
        --ds-avatar-lg: 2.75rem;
        --ds-counter-h: 1.125rem;       /* the unread counter on an icon button */
        --ds-menu-w: 15rem;
        --ds-menu-w-user: 18rem;
        --ds-menu-w-wide: 22rem;
        --ds-menu-max-h: 24rem;
        --ds-viewer-max-w: 72rem;       /* the file viewer's title bar row on a wide screen */
        --ds-strip-text-min: 16rem;     /* a strip's message wraps its buttons under it below this */

        /* ── login metrics (components/ds/auth-layout) ──────────────────── */
        --ds-auth-panel-w: 24rem;
        --ds-auth-tagline-w: 26rem;
        --ds-auth-brand-min: 22rem;     /* the brand column of the split layout */
        --ds-auth-logo-h: 2rem;
        --ds-auth-logo-h-tablet: 2.5rem;
        --ds-auth-logo-h-split: 4rem;
        --ds-auth-logo-max: 11rem;
        --ds-auth-logo-max-split: 16rem;
        --ds-auth-mark: 1.125rem;       /* the printer's crop marks */
        --ds-auth-check: 1.25rem;       /* the login checkbox */
        /* phone sign-in hero (22-Nov-2026) */
        --ds-auth-hero-min: clamp(10.5rem, 30vh, 15rem);
        --ds-auth-sheet-lap: 1.5rem;    /* how far the form sheet slides over the hero */
        --ds-auth-sheet-radius: 1.5rem;
        --ds-auth-sheet-shadow: 0 -.5rem 1.5rem rgb(0 0 0 / .14);
        --ds-auth-logo-h-phone: 2.75rem;
        --ds-auth-logo-max-phone: 13rem;
        --ds-auth-mark-phone: .875rem;
        --ds-auth-dot: 1.1px;           /* halftone dot radius … */
        --ds-auth-dot-edge: 1.6px;      /* … its soft edge … */
        --ds-auth-dot-gap: .875rem;     /* … and the screen pitch */
        --ds-auth-dot-fade: radial-gradient(120% 90% at 100% 0%, #000 0%, transparent 62%);   /* mask: dense corner → none */
    }

    @media (min-width: 48rem) {
        :root {
            --ds-page-pad-x: var(--ds-space-6);
            --ds-page-pad-y: var(--ds-space-6);
            --ds-page-gap: var(--ds-space-5);
            --ds-card-pad: var(--ds-space-5);
        }
    }

    @media (min-width: 75rem) {
        :root { --ds-page-pad-x: var(--ds-space-8); }
    }

    /* phones: 16px in every text control so iOS never zooms on focus */
    @media (max-width: 47.99rem) {
        :root { --ds-control-font: var(--ds-text-md); }
    }

    /* touch: every control and small button is a 44px target */
    @media (pointer: coarse) {
        :root {
            --ds-control-h: var(--ds-target);
            --ds-control-h-sm: var(--ds-target);
            --ds-control-font: var(--ds-text-md);
            --ds-shell-target: var(--ds-target);
            --ds-shell-target-sm: var(--ds-target);
        }
    }

    @media (prefers-reduced-motion: reduce) {
        :root { --ds-dur-fast: 0ms; --ds-dur: 0ms; --ds-dur-slow: 0ms; }
    }

    /* ── forms (builder FORMS: forms.css, buttons.css, vendors/select2.css, vendors/datepicker.css,
       js/forms.js) ──
       Control icons are SVG data URIs, and a data URI cannot read a custom property. Where the icon's
       colour shows (background-image) the colour is written into it and named in the comment; masks
       (mask-image) use only the shape and take their colour from a token. */
    :root {
        --ds-icon-size: 1rem;                       /* 16  chevrons and field icons */
        --ds-check-size: 1.125rem;                  /* 18  checkbox / radio box; a switch is two boxes wide */
        --ds-chip-h: 1.5rem;                        /* 24  choice chip of a multiple select2 */
        --ds-disabled-opacity: 0.5;                 /* disabled buttons and checks: dimmed, state colours kept */
        --ds-sheet-w: 30rem;                        /* 480 a bottom sheet: full width on phones, this wide on tablets */
        --ds-call-panel-w: 30rem;                   /* 480 the WhatsApp voice call panel (chat.css .wa-call) */
        --ds-size-cell-min-w: 4.25rem;              /* 68  size grid (forms.css .mv-size-grid): narrowest size cell */
        --ds-size-grid-max-w: 48rem;                /* 768 size grid: at most this wide */
        --ds-size-label-h: 1.25rem;                 /* 20  size cell label row */
        --ds-size-label-h-adj: 2.5rem;              /* 40  …two rows when a chart has price adjustments */
        --ds-check-hit: var(--ds-target);           /* 44  touch: the hit area around a checkbox / radio / switch (forms.css) */
        /* select arrow: stroke #5b6664 = --ds-gray-600 (--ds-text-muted) */
        --ds-icon-chevron: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%235b6664' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='m4 6 4 4 4-4'/%3e%3c/svg%3e");
        /* checked box / indeterminate box / checked radio / switch knob: white, drawn on --ds-solid
           (white reaches 4.5:1 on it, ds_theme) or, for the switch when off, on --ds-border-strong (3.1:1) */
        --ds-icon-check: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.25' d='m3.5 8.5 3 3 6-7'/%3e%3c/svg%3e");
        --ds-icon-dash: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-width='2.25' d='M4 8h8'/%3e%3c/svg%3e");
        --ds-icon-dot: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='1.75' fill='%23fff'/%3e%3c/svg%3e");
        --ds-icon-knob: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
        /* masks (shape only) */
        --ds-icon-calendar: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3.5' y='5' width='17' height='15.5' rx='2'/%3e%3cpath d='M3.5 10h17M8 3v4M16 3v4'/%3e%3c/svg%3e");
        --ds-icon-alert: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill-rule='evenodd' d='M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm0-12a1 1 0 0 1 1 1v3.5a1 1 0 1 1-2 0V7a1 1 0 0 1 1-1Zm0 9a1.1 1.1 0 1 0 0-2.2 1.1 1.1 0 0 0 0 2.2Z'/%3e%3c/svg%3e");
    }

    /* ── tables (builder TABLES: tables.css, navigation.css, vendors/datatables.css, js/tables.js) ──
       Fills are see-through, so a table takes the colour of the surface it sits on and the edge
       hint of a horizontal scroller (an inset shadow on the scroller) shows under the rows. */
    :root {
        --ds-table-pad-y: var(--ds-space-2);        /* 8   cell padding */
        --ds-table-pad-x: var(--ds-space-3);        /* 12 */
        --ds-table-pad-y-sm: var(--ds-space-1);     /* 4   .table-sm */
        --ds-table-pad-x-sm: var(--ds-space-2);     /* 8 */
        --ds-table-head-h: var(--ds-control-h);     /* head row height (44px on touch) */
        --ds-cards-label-w: 6.5rem;                 /* phone card mode (table.ds-cards): the label column */
        --ds-table-head-h-sm: var(--ds-control-h-sm);
        --ds-table-head-bg: color-mix(in srgb, var(--ds-gray-900) 3%, transparent);
        --ds-table-head-text: var(--ds-text-muted);
        --ds-table-head-rule: var(--ds-gray-300);   /* line under the head row, over the foot row */
        --ds-table-rule: var(--ds-border);          /* line between rows */
        --ds-table-stripe: color-mix(in srgb, var(--ds-gray-900) 2%, transparent);
        --ds-table-hover: color-mix(in srgb, var(--ds-gray-900) 4%, transparent);
        --ds-table-selected: color-mix(in srgb, var(--ds-accent) 12%, transparent);
        --ds-table-search-w: 16rem;                 /* DataTables search field from 48rem */
        --ds-scroll-shadow: color-mix(in srgb, var(--ds-gray-900) 22%, transparent);
        --ds-scroll-shadow-size: var(--ds-space-4); /* 16  depth of the edge hint */
        --ds-sticky-col-w: min(13rem, 40vw);        /* 208 frozen first column (.sticky-col), at most 40% of a phone */
        --ds-cell-control-min: 7.5rem;              /* 120 a field inside a table cell, below 62rem */
        --ds-cell-text-min: 7.5rem;                 /* 120 a wrapping name / remark cell of a statement on a phone */
    }

    /* touch (after the forms and tables blocks, which set the defaults): a check box a little larger
       (22px, its hit area is --ds-check-hit) and select2 choice chips / inline search 32px tall */
    @media (pointer: coarse) {
        :root {
            --ds-check-size: 1.375rem;
            --ds-chip-h: 2rem;
        }
    }

    /* ── overlays and feedback (builder OVERLAYS: overlays.css, feedback.css, vendors/sweetalert.css,
       js/overlays.js) ──
       Dialog widths are caps: from 62rem a dialog is never wider than the viewport minus
       --ds-modal-gap on each side; below 62rem every dialog is a full-width sheet instead. */
    :root {
        --ds-modal-w-sm: 25rem;                     /* 400  .modal-sm */
        --ds-modal-w: 35rem;                        /* 560  default */
        --ds-modal-w-lg: 50rem;                     /* 800  .modal-lg */
        --ds-modal-w-xl: 71.25rem;                  /* 1140 .modal-xl */
        --ds-modal-gap: var(--ds-space-6);          /* 24   viewport edge to dialog (desktop) */
        --ds-modal-pad: var(--ds-card-pad);         /* header / body / footer inset, the same as cards */
        --ds-sheet-top: var(--ds-space-6);          /* 24   scrim kept above a sheet as tall as the screen */
        --ds-modal-z-step: 2;                       /* z-index slots per stacked modal: its backdrop, itself */
        --ds-menu-min-w: 12rem;                     /* 192  dropdown menu */
        --ds-tooltip-max-w: 17.5rem;                /* 280 */
        --ds-popover-max-w: 20rem;                  /* 320 */
        --ds-offcanvas-w: 25rem;                    /* 400 */
        --ds-toast-w: 22.5rem;                      /* 360 */
        --ds-alert-dialog-w: 28rem;                 /* 448  SweetAlert dialog */
        --ds-feature-icon: 3rem;                    /* 48   status icon of a SweetAlert dialog */
        --ds-toast-icon: 1.5rem;                    /* 24   status icon of a toast */
        --ds-badge-h: 1.25rem;                      /* 20   status badge */
        --ds-progress-h: 0.5rem;                    /* 8    progress bar */
        /* dismiss (×): a mask, shape only; the colour is currentColor */
        --ds-icon-close: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round'%3e%3cpath d='M4 4l8 8M12 4 4 12'/%3e%3c/svg%3e");
    }

    /* ── chat (WhatsApp Chats: chat.css, resources/views/wa/chat/index) ──
       A messaging surface: a halftone-dot "paper" wallpaper (the print shop's own trade), white
       customer bubbles with a hairline edge, our replies in a light tint of the brand colour, the
       brand fill (--ds-solid, white text) for unread counts and the ready Send button. */
    :root {
        /* metrics */
        --ds-chat-list-w: 20rem;                    /* 320  list column, tablet */
        --ds-chat-list-w-desktop: 21.25rem;         /* 340  from 62rem */
        --ds-chat-list-w-wide: 22.5rem;             /* 360  from 75rem */
        --ds-chat-shell-offset: 5.5rem;             /* first-paint height guess: window minus top bar + inset (js/fit() replaces it) */
        --ds-chat-shell-min: 26rem;                 /* 416 */
        --ds-chat-autoquote-min: 12rem;             /* 192  the WhatsApp auto-quotation card's text column before it wraps */
        --ds-chat-avatar: 3rem;                     /* 48   chat list */
        --ds-chat-avatar-sm: 2.5rem;                /* 40   conversation header */
        --ds-chat-row-h: 4.5rem;                    /* 72   chat row */
        --ds-chat-head-h: 3.5rem;                   /* 56   conversation header (28-Nov: was 60) */
        --ds-chat-dot: 0.625rem;                    /* 10   reply-window dot */
        --ds-chat-dot-ring: 2px;
        --ds-chat-bubble-max: 78%;
        --ds-chat-bubble-max-w: 34rem;              /* 544 */
        --ds-chat-bubble-radius: 0.875rem;          /* 14 */
        --ds-chat-bubble-radius-join: 0.3125rem;    /* 5    the corner where grouped bubbles meet */
        --ds-chat-bubble-pad-y: 0.375rem;           /* 6 */
        --ds-chat-bubble-pad-x: 0.625rem;           /* 10 */
        --ds-chat-tail-w: 0.5rem;                   /* 8    speech tail of a group's first bubble */
        --ds-chat-tail-h: 0.8125rem;                /* 13 */
        --ds-chat-hairline: 0.5px;
        --ds-chat-meta-w-in: 2.75rem;               /* room kept on the last line for "14:30" */
        --ds-chat-meta-w-edited: 2.75rem;           /* extra room for "Edited" in front of the time */
        --ds-chat-meta-w-out: 4.25rem;              /* …and for "14:30 ✓✓" */
        --ds-chat-media-w: 17.5rem;                 /* 280  image thumbnail */
        --ds-chat-media-max-h: 20rem;               /* 320 */
        --ds-chat-sticker: 9.375rem;                /* 150  a sticker, shown without a bubble (27-Nov-2026) */
        --ds-chat-pop-max-h: 16rem;                 /* 256  quick replies / pay links over the message box */
        --ds-chat-doc-icon: 2.5rem;                 /* 40   file chip icon */
        --ds-chat-composer-max-h: 8.75rem;          /* 140  the message field grows up to this */
        --ds-chat-pattern: 1.125rem;                /* 18   halftone grid */
        --ds-chat-pattern-dot: 1.2px;               /*      halftone dot radius */
        --ds-chat-rise: 0.375rem;                   /* 6    a new message rises this far as it appears */
        --ds-chat-skeleton-line: 0.625rem;          /* 10 */
        --ds-chat-skeleton-w-1: 45%;
        --ds-chat-skeleton-w-2: 75%;
        --ds-chat-text: 0.9375rem;                  /* 15   message and contact name */
        --ds-chat-meta-text: 0.6875rem;             /* 11   time inside a bubble */
        --ds-chat-tail-in: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3e%3cpath d='M8 0v13C6.6 8.6 3.8 3.9.7 1.3.2.9 0 .5 0 0z'/%3e%3c/svg%3e");
        --ds-chat-tail-out: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3e%3cpath d='M0 0v13C1.4 8.6 4.2 3.9 7.3 1.3 7.8.9 8 .5 8 0z'/%3e%3c/svg%3e");
        --ds-chat-z: 1018;                          /* full-screen conversation (phone): under the top bar (1020) and its menus */
        --ds-chat-z-keyboard: 1025;                 /* …over the top bar while the on-screen keyboard is up, under the drawer (1044) */

        /* colours */
        --ds-chat-wall: color-mix(in srgb, var(--ds-dark) 5%, var(--ds-gray-50));
        --ds-chat-wall-dot: color-mix(in srgb, var(--ds-dark) 10%, transparent);
        --ds-chat-in: var(--ds-surface);
        --ds-chat-in-edge: color-mix(in srgb, var(--ds-dark) 14%, transparent);
        --ds-chat-out: color-mix(in srgb, var(--ds-primary) 20%, var(--ds-surface));
        --ds-chat-out-edge: color-mix(in srgb, var(--ds-primary) 38%, var(--ds-gray-300));
        --ds-chat-ink: var(--ds-gray-900);
        --ds-chat-meta: var(--ds-gray-500);
        --ds-chat-tick-read: #1f7fc4;               /* read receipts: the blue people know from WhatsApp, 4.4:1 on white */
        --ds-chat-fail: var(--ds-danger);
        --ds-chat-badge: var(--ds-solid);           /* unread count, ready Send button: brand fill under white text */
        --ds-chat-badge-ink: #ffffff;
        --ds-chat-active: color-mix(in srgb, var(--ds-accent) 9%, var(--ds-surface));
        --ds-chat-active-mark: var(--ds-accent);
        --ds-chat-open: var(--ds-success);
        --ds-chat-closed: var(--ds-warning);
        --ds-chat-sys: color-mix(in srgb, var(--ds-surface) 88%, transparent);
        --ds-chat-media-scrim: color-mix(in srgb, var(--ds-gray-900) 55%, transparent);
        --ds-chat-skeleton: var(--ds-gray-100);
        --ds-chat-skeleton-shine: var(--ds-gray-50);
        --ds-chat-bar: var(--ds-surface-2);         /* composer bar */
        --ds-chat-lift: 0 1px 0.5px rgb(20 26 25 / .10);   /* bubbles: a paper edge, not a card shadow */
        --ds-chat-float: 0 6px 18px -6px rgb(20 26 25 / .30);   /* the "jump to latest" button */
        /* contact avatars: six soft tints, picked per contact (stable), each ink ≥ 4.5:1 on its tint */
        --ds-chat-tint-1: #dcebdf; --ds-chat-tint-1-ink: #1f5133;   /* sage */
        --ds-chat-tint-2: #e8f4c4; --ds-chat-tint-2-ink: #46600a;   /* lime */
        --ds-chat-tint-3: #d3ece8; --ds-chat-tint-3-ink: #0e5a52;   /* teal */
        --ds-chat-tint-4: #dbe8f5; --ds-chat-tint-4-ink: #1d4a73;   /* sky */
        --ds-chat-tint-5: #f2e8d2; --ds-chat-tint-5-ink: #66480c;   /* sand */
        --ds-chat-tint-6: #ebe1ef; --ds-chat-tint-6-ink: #56326a;   /* plum */
    }

    /* ── mail (Email inbox: email.css, resources/views/email/*) ──
       A mail client in the ERP's own look: folders, the message list and the reading pane side by side on a wide
       screen (three panes from 75rem), list + message on a tablet, one pane at a time on a phone. Colours are roles
       of the tokens above (accent marks, solid fill for unread counts, status tones for the assignment states). */
    :root {
        --ds-mail-folders-w: 15rem;                 /* 240  folder pane, wide */
        --ds-mail-folders-drawer-w: 18rem;          /* 288  folder pane as a drawer over the list (tablet) */
        --ds-mail-list-w: 21.25rem;                 /* 340  message list, tablet */
        --ds-mail-list-w-wide: 23.75rem;            /* 380  message list, wide */
        --ds-mail-shell-offset: 10rem;              /* first-paint height guess: window minus page header (js fit() replaces it) */
        --ds-mail-shell-min: 28rem;                 /* 448 */
        --ds-mail-avatar: 2.5rem;                   /* 40   sender initials */
        --ds-mail-avatar-lg: 2.75rem;               /* 44   sender in the reading pane */
        --ds-mail-chip: 1.5rem;                     /* 24   assignee initials on a row */
        --ds-mail-dot: 0.5rem;                      /* 8    unread dot */
        --ds-mail-reading-max: 50rem;               /* 800  reading column */
        --ds-mail-frame-h: 60vh;                    /*      message body frame, first height (the user can drag it) */
        --ds-mail-frame-min: 18rem;                 /* 288 */
        --ds-mail-editor-min: 14rem;                /* 224  composer text area */
        --ds-mail-suggest-max-h: 16rem;             /* 256  recipient suggestions */
        --ds-mail-thumb: 2.5rem;                    /* 40   attachment chip icon */
        --ds-mail-chip-max-w: 16rem;                /* 256  attachment chip */
        --ds-mail-rise: 0.375rem;                   /* 6    a new row rises this far as it appears */
        --ds-mail-skeleton-line: 0.625rem;          /* 10 */
        --ds-mail-z: 1018;                          /* full-screen reading pane / composer (phone): under the top bar (1020) */
        --ds-mail-z-drawer: 30;                     /* folder drawer over the list inside the mail frame */
        --ds-mail-unread: color-mix(in srgb, var(--ds-accent) 5%, var(--ds-surface));
        --ds-mail-active: color-mix(in srgb, var(--ds-accent) 10%, var(--ds-surface));
        --ds-mail-mark: var(--ds-accent);
        --ds-mail-count: var(--ds-solid);           /* unread count pill: brand fill under white text */
        --ds-mail-count-ink: #ffffff;
        --ds-mail-star: var(--ds-warning);
        --ds-mail-skeleton: var(--ds-gray-100);
        --ds-mail-skeleton-shine: var(--ds-gray-50);
    }

    /* ── feedback desk (Feedback & Issues: issues.css, resources/views/umum/feedback/*) ──
       The staff's report list, form and report page. Type tiles and type icons take the status tones (bug = danger,
       data mismatch = warning, document = info, suggestion = success, question = neutral); the thread reuses the
       chat bubble colours and avatar tints so a conversation reads the same as WhatsApp Chats. */
    :root {
        --ds-fb-form-max: 45rem;                    /* 720  the report form, centred on a desktop */
        --ds-fb-side-w: 22.5rem;                    /* 360  right column of the report page (desktop) */
        --ds-fb-icon: 2.25rem;                      /* 36   type icon on a row and a tile */
        --ds-fb-step: 1.5rem;                       /* 24   step number of the form */
        --ds-fb-tile-min: 4.5rem;                   /* 72   type tile */
        --ds-fb-drop-min: 8.5rem;                   /* 136  photo drop zone */
        --ds-fb-thumb: 5.5rem;                      /* 88   image tile */
        --ds-fb-thumb-sm: 4.5rem;                   /* 72   image tile inside a reply */
        --ds-fb-avatar: 2rem;                       /* 32   initials beside a reply */
        --ds-fb-avatar-lg: 2.5rem;                  /* 40   reporter on the info card */
        --ds-fb-dot: 0.5rem;                        /* 8    status dot of a count chip */
        --ds-fb-bubble-max: 85%;
        --ds-fb-row-side-w: 8.5rem;                 /* 136  status + time column of a row (tablet up) */
        --ds-fb-pick: color-mix(in srgb, var(--ds-accent) 7%, var(--ds-surface));   /* chosen tile / active chip */
        --ds-fb-pick-edge: var(--ds-accent);
        --ds-fb-drop: var(--ds-surface-2);
        --ds-fb-drop-over: color-mix(in srgb, var(--ds-accent) 8%, var(--ds-surface));
        --ds-fb-mine: var(--ds-chat-out);
        --ds-fb-mine-edge: var(--ds-chat-out-edge);
        --ds-fb-theirs: var(--ds-surface-2);
        --ds-fb-theirs-edge: var(--ds-border);
        --ds-fb-zoom-scrim: var(--ds-chat-media-scrim);
    }

    /*
     * Bridge: the legacy theme (Bootstrap 5.3 in style.css, movera-ui.css --mv-*) reads these
     * variables, so mapping them to ds roles re-colours everything not yet restyled by a ds file
     * with the settings colours. Same layer as the ds tokens, which beats @layer legacy.
     * Primary maps to --ds-solid (not --ds-primary): the legacy CSS hard-codes white text on it.
     */
    :root {
        --bs-primary: var(--ds-solid);
        --bs-primary-rgb: var(--ds-solid-rgb);
        --bs-primary-text-emphasis: color-mix(in srgb, var(--ds-solid) 80%, var(--ds-gray-900));
        --bs-primary-bg-subtle: color-mix(in srgb, var(--ds-solid) 10%, var(--ds-surface));
        --bs-primary-border-subtle: color-mix(in srgb, var(--ds-solid) 30%, var(--ds-surface));
        --bs-secondary: var(--ds-neutral);
        --bs-secondary-rgb: var(--ds-neutral-rgb);
        --bs-success: var(--ds-success);
        --bs-success-rgb: var(--ds-success-rgb);
        --bs-success-text-emphasis: var(--ds-success-text);
        --bs-success-bg-subtle: var(--ds-success-bg);
        --bs-success-border-subtle: var(--ds-success-border);
        --bs-danger: var(--ds-danger);
        --bs-danger-rgb: var(--ds-danger-rgb);
        --bs-danger-text-emphasis: var(--ds-danger-text);
        --bs-danger-bg-subtle: var(--ds-danger-bg);
        --bs-danger-border-subtle: var(--ds-danger-border);
        --bs-info: var(--ds-info);
        --bs-info-rgb: var(--ds-info-rgb);
        --bs-info-text-emphasis: var(--ds-info-text);
        --bs-info-bg-subtle: var(--ds-info-bg);
        --bs-info-border-subtle: var(--ds-info-border);
        --bs-warning: var(--ds-warning);
        --bs-warning-rgb: var(--ds-warning-rgb);
        --bs-warning-text-emphasis: var(--ds-warning-text);
        --bs-warning-bg-subtle: var(--ds-warning-bg);
        --bs-warning-border-subtle: var(--ds-warning-border);

        --bs-font-sans-serif: var(--ds-font);
        --bs-font-monospace: var(--ds-font-mono);
        --bs-body-font-family: var(--ds-font);
        --bs-body-font-size: var(--ds-text-sm);
        --bs-body-line-height: var(--ds-leading);
        --bs-body-color: var(--ds-text);
        --bs-body-bg: var(--ds-canvas);
        --bs-emphasis-color: var(--ds-text);
        --bs-secondary-color: var(--ds-text-muted);
        --bs-secondary-bg: var(--ds-hover);
        --bs-tertiary-color: var(--ds-placeholder);
        --bs-tertiary-bg: var(--ds-surface-2);
        --bs-heading-color: var(--ds-text);
        --bs-link-color: var(--ds-text);
        --bs-link-hover-color: var(--ds-gray-700);
        --bs-border-width: var(--ds-border-width);
        --bs-border-color: var(--ds-border);
        --bs-border-color-translucent: var(--ds-border);
        --bs-border-radius: var(--ds-radius-md);
        --bs-border-radius-sm: var(--ds-radius-sm);
        --bs-border-radius-lg: var(--ds-radius);
        --bs-border-radius-xl: var(--ds-radius-lg);
        --bs-border-radius-xxl: var(--ds-radius-lg);
        --bs-border-radius-pill: var(--ds-radius-pill);
        --bs-box-shadow: var(--ds-shadow);
        --bs-box-shadow-sm: none;
        --bs-box-shadow-lg: var(--ds-shadow);
        --bs-focus-ring-color: var(--ds-focus-halo);
        --bs-form-valid-color: var(--ds-success-text);
        --bs-form-valid-border-color: var(--ds-success);
        --bs-form-invalid-color: var(--ds-danger-text);
        --bs-form-invalid-border-color: var(--ds-danger);

        --mv-primary: var(--ds-solid);
        --mv-primary-hover: color-mix(in srgb, var(--ds-solid) 85%, var(--ds-gray-900));
        --mv-primary-light: color-mix(in srgb, var(--ds-solid) 10%, var(--ds-surface));
        --mv-primary-rgb: var(--ds-solid-rgb);
        --mv-primary-contrast: #ffffff;   /* --ds-solid is chosen to carry white text */
        --mv-success: var(--ds-success);
        --mv-success-text: var(--ds-success-text);
        --mv-success-light: var(--ds-success-bg);
        --mv-warning: var(--ds-warning);
        --mv-warning-text: var(--ds-warning-text);
        --mv-warning-light: var(--ds-warning-bg);
        --mv-danger: var(--ds-danger);
        --mv-danger-text: var(--ds-danger-text);
        --mv-danger-light: var(--ds-danger-bg);
        --mv-info: var(--ds-info);
        --mv-info-text: var(--ds-info-text);
        --mv-info-light: var(--ds-info-bg);
        --mv-secondary: var(--ds-neutral);
        --mv-slate-50: var(--ds-gray-50);
        --mv-slate-100: var(--ds-gray-100);
        --mv-slate-200: var(--ds-gray-200);
        --mv-slate-300: var(--ds-gray-300);
        --mv-slate-400: var(--ds-gray-400);
        --mv-slate-500: var(--ds-gray-500);
        --mv-slate-600: var(--ds-gray-600);
        --mv-slate-700: var(--ds-gray-700);
        --mv-slate-800: var(--ds-gray-800);
        --mv-slate-900: var(--ds-gray-900);
        --mv-radius: var(--ds-radius);
        --mv-radius-lg: var(--ds-radius);
        --mv-radius-sm: var(--ds-radius-sm);
        --mv-shadow-sm: none;
        --mv-shadow: none;
        --mv-shadow-md: none;
        --mv-shadow-lg: var(--ds-shadow);
        --mv-shadow-xl: var(--ds-shadow);
        --mv-font: var(--ds-font);
        --mv-font-mono: var(--ds-font-mono);
        --mv-content-padding: var(--ds-page-pad-y) var(--ds-page-pad-x);
    }
}
