/* ============================================================
   FOUNDATION
   ------------------------------------------------------------
   The complete foundation layer of the design system.

   Reads from: (self-contained — this is the token source)
   Composes with: every other file in the system

   Consolidated modules:
     01 · Design tokens (+ legacy --color-* aliases)
     02 · Reset
     03 · Base
     04 · Typography
     05 · Container
     06 · Utilities
     07 · Animations
     08 · Accessibility
     09 · Layout
     10 · Responsive
     11 · Print

   ============================================================
   TOKEN ARCHITECTURE
   ============================================================
   The colour system has three layers. Every rule in every
   stylesheet must reach for the right one.

   LAYER 1 · RAW SCALE
     --navy-900 … --navy-50
     --blue-700 … --blue-50
     --success, --warning, --danger, --info
     --accent, --accent-hover, --accent-ink

     These are fixed hex values. They NEVER change between
     light mode and dark mode. Use them only when a colour
     must stay the same regardless of theme — for example,
     the brand navy that Chrome and branded sections pin to,
     or the green used inside a success pill on both surfaces.

   LAYER 2 · SEMANTIC TOKENS
     Surface family     --surface, --surface-soft, --surface-muted,
                        --surface-sunken, --page-bg
     Text family        --text, --text-soft, --text-muted,
                        --text-light, --text-invert
     Heading family     --heading, --heading-soft
     Border family      --border, --border-strong, --border-soft
     Chrome family      --chrome-bg, --chrome-bg-deep,
                        --chrome-text, --chrome-text-soft,
                        --chrome-text-muted, --chrome-line,
                        --chrome-input-bg, --chrome-input-line,
                        --chrome-hover, --chrome-active
     Brand family       --brand-bg, --brand-bg-deep,
                        --brand-text, --brand-text-soft,
                        --brand-line

     These DO flip between themes. A rule that renders text
     or a surface should always use a semantic token, never a
     raw scale token.

   LAYER 3 · THEME OVERRIDES
     theme.css reassigns the SEMANTIC tokens for
     [data-theme="dark"]. It never touches the raw scale.
     It never touches the chrome or brand families either —
     chrome stays dark in both themes, and brand surfaces
     stay dark in both themes. Flipping them would remove
     the page's visual anchor.

   WHY THIS SPLIT
   --------------
   The previous version used `--navy-800` for three jobs at
   once: chrome backgrounds, brand section backgrounds, and
   heading text. A single dark-mode override could not satisfy
   all three, so:
     · header / sidebar / drawer flipped to near-white
       (because the raw navy was being reassigned)
     · headings vanished on light chrome
     · branded heroes lost their darkness

   After the split:
     --navy-800        stays #123b63 — always
     --chrome-bg       points at #123b63 — never flips
     --brand-bg        points at #123b63 — never flips
     --heading         points at #123b63 — flips via theme.css

   Every other token in the system follows the same rule.

   ============================================================
   AUDIT (v4 — this rewrite):
     · Introduced the chrome family and brand family of tokens.
     · Introduced --heading and --heading-soft. Every heading
       rule now uses them instead of --navy-800.
     · Introduced --page-bg (was previously only inside the
       dark-mode block in theme.css).
     · .bg-navy and .bg-navy-deep now use --brand-bg /
       --brand-bg-deep.
     · .text-navy now uses --heading.
     · h1–h6, .display-1–3, .text-navy, code all use --heading.
     · --navy-800/--navy-900 remain raw. Nothing references
       them as a flippable value anywhere in this file.
     · Preserved: --color-* aliases, .meta, .num, .cell-*,
       .spinner, .loading-region, [data-busy], .visually-hidden,
       .hide-* helpers, iconify-icon defaults,
       @property --progress-value.
     · Preserved: --topbar-h: 54px.
     · Preserved: every utility, every breakpoint, every
       animation, every print rule.
   ============================================================ */


/* ============================================================
   01 · DESIGN TOKENS
   ------------------------------------------------------------
   Single source of truth. Every other file reads from here.
   Change this section → the entire system rebrands.
   ============================================================ */

:root {

  /* ---------- BRAND · NAVY SCALE (RAW — never flips) ---------- */
  --navy-900: #0b1f3a;
  --navy-800: #123b63;
  --navy-700: #164a78;
  --navy-600: #1b5a8e;
  --navy-500: #246b9a;
  --navy-400: #3d82b8;
  --navy-300: #7ea9cb;
  --navy-200: #b3cde0;
  --navy-100: #d6e5f0;
  --navy-50:  #eef4f8;

  /* ---------- BRAND · BLUE SCALE (RAW — never flips) ---------- */
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-100: #dbeafe;
  --blue-50:  #eff6ff;

  /* ---------- BRAND · GREEN (RAW — never flips) ----------
     #16a36a = success / availability / online fills and positive
     buttons with dark text. It is only ~3.3:1 against white, so for
     small TEXT on light surfaces keep using --success (#16794a). */
  --brand-green:       #16a36a;
  --brand-green-hover: #128a5a;
  --brand-green-soft:  #e6f6ef;

  /* ---------- BRAND · ACCENT (RAW — never flips) ---------- */
  --accent:       #f4b942;
  --accent-hover: #f7c452;
  --accent-ink:   #173b5d;

  /* ---------- CHROME (SEMANTIC — never flips) ----------
     The header, sidebar, drawer and splash overlay. They stay
     dark in both themes for the same reason Linear, Vercel and
     GitHub keep their top bar consistent: the chrome is the
     fixed frame, the content is the changing surface.

     theme.css must NOT reassign any of these. If it did, the
     chrome would flip and, because --chrome-text is also fixed
     at white, the result would be white-on-white. */
  --chrome-bg:          #123b63;                    /* = navy-800 */
  --chrome-bg-deep:     #0b1f3a;                    /* = navy-900 */
  --chrome-text:        #ffffff;
  --chrome-text-soft:   rgba(255, 255, 255, 0.78);
  --chrome-text-muted:  rgba(255, 255, 255, 0.55);
  --chrome-line:        rgba(255, 255, 255, 0.10);
  --chrome-line-strong: rgba(255, 255, 255, 0.18);
  --chrome-input-bg:    rgba(255, 255, 255, 0.055);
  --chrome-input-line:  rgba(255, 255, 255, 0.13);
  --chrome-hover:       rgba(255, 255, 255, 0.09);
  --chrome-active:      rgba(255, 255, 255, 0.13);

  /* ---------- BRAND SURFACES (SEMANTIC — never flips) ----------
     Marketing heroes, CTA bands, the auth aside, the dashboard
     hero, promo banners. These are content — they sit inside a
     page whose theme is either light or dark — but they always
     render dark so they read as a distinct chapter in the page.

     theme.css must NOT reassign any of these. */
  --brand-bg:         #123b63;                      /* = navy-800 */
  --brand-bg-deep:    #0b1f3a;                      /* = navy-900 */
  --brand-text:       #ffffff;
  --brand-text-soft:  rgba(255, 255, 255, 0.72);
  --brand-text-muted: rgba(255, 255, 255, 0.55);
  --brand-line:       rgba(255, 255, 255, 0.10);

  /* ---------- PAGE (SEMANTIC — flips) ----------
     The document background. Light mode = white. Dark mode =
     deep navy-black, slightly darker than --surface so cards
     read against it. */
  --page-bg: #f5f7fa;   /* brand neutral; cards stay white (--surface) */

  /* ---------- SURFACES (SEMANTIC — flips) ---------- */
  --surface:        #ffffff;
  --surface-soft:   #f8fafc;
  --surface-muted:  #f1f5f9;
  --surface-sunken: #fafbfc;
  --surface-invert: #123b63;    /* fixed navy — see note below */

  /* NOTE: --surface-invert points at a fixed navy value. It is
     not used as a "flipping" token anywhere. Components that
     need a navy card in either theme use --brand-bg. Components
     that need an inverted surface that flips (rare) should
     introduce their own token. Left here for the handful of
     legacy rules that read it. */

  /* ---------- BORDERS (SEMANTIC — flips) ---------- */
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --border-soft:   #eef2f6;
  --border-invert: rgba(255, 255, 255, 0.10);

  /* ---------- TEXT (SEMANTIC — flips) ---------- */
  --text:        #172033;
  --text-soft:   #334155;
  --text-muted:  #687588;   /* brand secondary text */
  --text-light:  #94a3b8;
  --text-invert: #ffffff;

  /* ---------- HEADING (SEMANTIC — flips) ----------
     Every h1–h6, every display class, every card title, every
     rule that used to reach for --navy-800 as a text colour.

     Why a separate token: --navy-800 must stay fixed so chrome
     and branded sections can pin to it. Headings need to flip,
     so they get their own token. theme.css reassigns these two
     under [data-theme="dark"] and nothing else changes. */
  --heading:      #123b63;      /* = navy-800 */
  --heading-soft: #164a78;      /* = navy-700 */

  /* ---------- STATUS (RAW — never flips) ----------
     Colour-coded statuses. Semantic tokens for these would add
     noise with no benefit — the same red means the same thing
     in both themes. */
  --success:      #16794a;
  --success-hover:#198653;
  --success-soft: #f0fdf4;
  --success-line: #dcfce7;
  --success-100:  #bbf7d0;

  --warning:      #b45309;
  --warning-soft: #fffbeb;
  --warning-line: #fef3c7;

  --danger:       #b42318;
  --danger-hover: #c52a1d;
  --danger-soft:  #fef2f2;
  --danger-line:  #fee2e2;
  --danger-100:   #fecaca;

  --info:         #1d4ed8;
  --info-soft:    #eff6ff;
  --info-line:    #dbeafe;

  /* ---------- SEMANTIC STATUSES (RAW) ---------- */
  --status-pending:   #b45309;
  --status-review:    #1d4ed8;
  --status-approved:  #16794a;
  --status-closed:    #64748b;
  --status-cancelled: #b42318;

  /* ---------- PRICE & DISCOUNT (RAW) ---------- */
  --price-regular:  #172033;
  --price-sale:     #b42318;
  --price-success:  #16794a;
  --price-discount: #dc2626;

  /* ---------- BADGES & RATINGS (RAW) ---------- */
  --badge-location: #64748b;
  --badge-rating:   #f4b942;

  /* ---------- SYNTAX HIGHLIGHTING (RAW) ---------- */
  --code-comment:  #7ea9cb;
  --code-keyword:  #f4b942;
  --code-string:   #86efac;
  --code-number:   #93c5fd;
  --code-function: #60a5fa;
  --code-tag:      #f0abfc;
  --code-attr:     #fde047;

  /* ---------- RADIUS ---------- */
  --radius-xs:   6px;
  --radius-sm:   8px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --radius-2xl:  24px;
  --radius-pill: 999px;
  --radius-circle: 50%;

  /* ---------- SPACING · 4px BASE ---------- */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* ---------- SHADOWS (RAW) ----------
     Shadows are tuned for light mode. theme.css reassigns them
     under [data-theme="dark"] — dark surfaces need heavier,
     blacker shadows to read the same. */
  --shadow-xs: 0 1px 3px rgba(15, 39, 66, 0.04);
  --shadow-sm: 0 4px 12px rgba(15, 39, 66, 0.055);
  --shadow-md: 0 12px 32px rgba(15, 39, 66, 0.075);
  --shadow-lg: 0 20px 50px rgba(15, 39, 66, 0.10);
  --shadow-xl: 0 28px 70px rgba(15, 39, 66, 0.14);

  /* ---------- FOCUS ---------- */
  --focus-outline: 2px solid var(--blue-600);
  --focus-outline-offset: 2px;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.18);

  /* ---------- MOTION ---------- */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --ease-out:  cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);

  --dur-instant: 80ms;
  --dur-fast:    150ms;
  --dur-base:    200ms;
  --dur-slow:    300ms;
  --dur-slower:  400ms;

  /* ---------- TYPOGRAPHY ----------
     --font-heading and --font are separate so an Arabic
     display face can be swapped in without touching body
     copy. theme.css reassigns --font-heading when
     html[lang="ar"] is set. */
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --font-heading: var(--font);

  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas,
               "Liberation Mono", monospace;

  --fw-regular:   400;
  --fw-medium:    500;
  --fw-semibold:  600;
  --fw-bold:      700;
  --fw-extrabold: 800;

  --fs-xs:   11px;
  --fs-sm:   12px;
  --fs-md:   13px;
  --fs-base: 14px;
  --fs-lg:   16px;
  --fs-xl:   20px;
  --fs-2xl:  24px;
  --fs-3xl:  30px;
  --fs-4xl:  38px;
  --fs-5xl:  48px;
  --fs-6xl:  60px;

  --lh-tight: 1.15;
  --lh-snug:  1.35;
  --lh-base:  1.6;
  --lh-loose: 1.75;

  --tracking-tight:   -0.03em;
  --tracking-normal:   0;
  --tracking-wide:     0.06em;
  --tracking-wider:    0.10em;

  /* ---------- LAYOUT ---------- */
  --container-max:   1400px;
  --container-narrow: 780px;
  --container-wide:  1600px;
  --container-pad:   var(--space-4);

  --sidebar-w:  260px;
  --topbar-h:   54px;

  /* ---------- Z-INDEX ---------- */
  --z-base:     1;
  --z-raised:   10;
  --z-sticky:   70;
  --z-topbar:   80;
  --z-sidebar:  100;
  --z-overlay:  200;
  --z-modal:    1000;
  --z-toast:    3000;
  --z-tooltip:  5000;

  /* ---------- WATERMARK · CIRCLE IDENTITY PRIMITIVE ----------
     The watermark rings are decorative. They use a fixed low
     alpha of the brand blue and navy, which reads on both
     light and dark surfaces. No need to flip them. */


  /* ---------- BREAKPOINT REFERENCE ---------- */
  --bp-xs:  320px;
  --bp-sm:  480px;
  --bp-md:  640px;
  --bp-lg:  768px;
  --bp-xl:  850px;
  --bp-2xl: 1024px;
  --bp-3xl: 1200px;
  --bp-4xl: 1440px;
  --bp-5xl: 1920px;
  --bp-6xl: 2560px;

  /* ============================================================
     LEGACY ALIASES · --color-*
     ------------------------------------------------------------
     JavaScript controllers reference these inline. They must
     resolve. Each alias maps a legacy name onto the semantic
     token it was always supposed to be. */
  --color-white:        var(--surface);
  --color-black:        var(--heading);
  --color-gray:         var(--surface-muted);
  --color-gray-soft:    var(--surface-soft);
  --color-bg:           var(--surface);
  --color-bg-soft:      var(--surface-soft);
  --color-bg-muted:     var(--surface-muted);

  --color-border:       var(--border);
  --color-border-soft:  var(--border-soft);
  --color-border-strong: var(--border-strong);

  --color-text:         var(--text);
  --color-text-soft:    var(--text-soft);
  --color-text-muted:   var(--text-muted);
  --color-text-light:   var(--text-light);

  --color-primary:      var(--blue-600);
  --color-primary-soft: var(--blue-50);

  --color-danger:       var(--danger);
  --color-danger-soft:  var(--danger-soft);
  --color-text-danger:  var(--danger);

  --color-warning:      var(--warning);
  --color-text-warning: var(--warning);

  --color-success:      var(--success);
  --color-green:        var(--success);
  --color-orange:       var(--accent);

  --color-muted:        var(--text-light);

  --fs-meta:            var(--fs-xs);
  --fs-meta-sm:         var(--fs-xs);
  --fs-body:            var(--fs-base);
  --fs-body-sm:         var(--fs-sm);
}

/* @property for the conic-gradient progress circle.
   Without it, --progress-value cannot animate. */
@property --progress-value {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 0%;
}


/* ============================================================
   02 · RESET
   ------------------------------------------------------------
   Modern browser normalization. Element-level only.
   No overflow hacks. No padding overrides.
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;

  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--page-bg);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

svg {
  fill: currentColor;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
}

[type="search"]::-webkit-search-decoration,
[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

a {
  color: var(--blue-600);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover {
  color: var(--blue-700);
}

ul,
ol {
  list-style: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

th {
  text-align: left;
  font-weight: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
  font-family: var(--font-heading);
}

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 0;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--blue-100);
  color: var(--heading);
}

/* In dark mode the selection must flip. theme.css overrides
   this block; the rule lives here so it is co-located with
   the light-mode version. */
[data-theme="dark"] ::selection,
.bg-navy ::selection,
.bg-navy-deep ::selection {
  background: rgba(96, 165, 250, 0.28);
  color: var(--brand-text);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* ============================================================
   03 · BASE
   ------------------------------------------------------------
   Document-level defaults. Structure only — no components.
   ============================================================ */

html,
body {
  width: 100%;
  overflow-x: clip;
}

body {
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

main {
  flex: 1 1 auto;
  width: 100%;
  position: relative;
}

header,
footer,
nav,
aside,
section,
article {
  display: block;
}

/* ------------------------------------------------------------
   HEADINGS
   ------------------------------------------------------------
   Every heading reaches for --heading. Dark mode reassigns
   --heading in theme.css and every heading flips in one move.
   ------------------------------------------------------------ */

h1 {
  font-size: var(--fs-4xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--heading);
}

h2 {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--heading);
}

h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--heading);
}

h4 {
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--heading);
}

h5 {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--heading);
}

h6 {
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

p {
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text-soft);
}

p + p {
  margin-top: var(--space-4);
}

strong,
b {
  font-weight: var(--fw-bold);
  color: var(--text);
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  padding: 2px 6px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xs);
  color: var(--heading);
  font-weight: var(--fw-medium);
}

pre {
  padding: var(--space-4);
  background: var(--navy-900);
  border-radius: var(--radius-md);
  color: var(--brand-text);
  overflow-x: auto;
  line-height: 1.6;
}

pre code {
  padding: 0;
  background: none;
  border: none;
  color: inherit;
}

mark {
  padding: 1px 4px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-xs);
}

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--space-6) 0;
}

/* ---------- BROWSER DEFAULTS FIXED ---------- */

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--fw-bold);
  line-height: 1;
}

progress {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border: none;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--surface-muted);
}

progress::-webkit-progress-bar {
  background: var(--surface-muted);
  border-radius: var(--radius-pill);
}

progress::-webkit-progress-value {
  background: var(--blue-600);
  border-radius: var(--radius-pill);
}

progress::-moz-progress-bar {
  background: var(--blue-600);
  border-radius: var(--radius-pill);
}

dialog {
  padding: 0;
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  background: var(--surface);
  color: var(--text);
  max-width: 90vw;
  max-height: 90vh;
}

dialog::backdrop {
  background: rgba(7, 25, 43, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

details > summary {
  cursor: pointer;
  list-style: none;
}

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

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 5000s ease-in-out 0s;
  box-shadow: 0 0 0px 1000px var(--surface) inset;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  appearance: none;
  -webkit-appearance: none;
}

/* ---------- ICONIFY CUSTOM ELEMENT ---------- */

iconify-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
  color: currentColor;
}

/* ---------- SECTION RHYTHM ---------- */

.section {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.section-sm {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

.section-lg {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
}

@media (max-width: 768px) {
  .section    { padding-top: var(--space-12); padding-bottom: var(--space-12); }
  .section-sm { padding-top: var(--space-8);  padding-bottom: var(--space-8);  }
  .section-lg { padding-top: var(--space-16); padding-bottom: var(--space-16); }
}

/* ------------------------------------------------------------
   BRAND SURFACE UTILITIES
   ------------------------------------------------------------
   .bg-navy and .bg-navy-deep render a branded dark band. They
   pin to --brand-bg / --brand-bg-deep, which never flip. A
   section using .bg-navy is deliberately the same navy in both
   themes. */
.bg-surface        { background: var(--surface); }
.bg-surface-soft   { background: var(--surface-soft); }
.bg-surface-muted  { background: var(--surface-muted); }
.bg-navy           { background: var(--brand-bg);      color: var(--brand-text); }
.bg-navy-deep      { background: var(--brand-bg-deep); color: var(--brand-text); }
.bg-blue-soft      { background: var(--blue-50); }


/* ============================================================
   04 · TYPOGRAPHY
   ============================================================ */

html,
body,
button,
input,
select,
textarea {
  font-family: var(--font);
}

/* Display classes. Same split as the base headings — they read
   --heading so theme.css can flip them in one rule. */
.display-1 {
  font-family: var(--font-heading);
  font-size: clamp(40px, 5vw, var(--fs-6xl));
  font-weight: var(--fw-extrabold);
  line-height: 1.05;
  letter-spacing: -0.045em;
  color: var(--heading);
}

.display-2 {
  font-family: var(--font-heading);
  font-size: clamp(34px, 4vw, var(--fs-5xl));
  font-weight: var(--fw-extrabold);
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--heading);
}

.display-3 {
  font-family: var(--font-heading);
  font-size: clamp(28px, 3.4vw, var(--fs-4xl));
  font-weight: var(--fw-extrabold);
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--heading);
}

.text-xs   { font-size: var(--fs-xs);   line-height: var(--lh-snug); }
.text-sm   { font-size: var(--fs-sm);   line-height: var(--lh-snug); }
.text-md   { font-size: var(--fs-md);   line-height: var(--lh-base); }
.text-base { font-size: var(--fs-base); line-height: var(--lh-base); }
.text-lg   { font-size: var(--fs-lg);   line-height: var(--lh-base); }
.text-xl   { font-size: var(--fs-xl);   line-height: var(--lh-snug); }
.text-2xl  { font-size: var(--fs-2xl);  line-height: var(--lh-snug); }
.text-3xl  { font-size: var(--fs-3xl);  line-height: var(--lh-tight); }

.fw-regular   { font-weight: var(--fw-regular); }
.fw-medium    { font-weight: var(--fw-medium); }
.fw-semibold  { font-weight: var(--fw-semibold); }
.fw-bold      { font-weight: var(--fw-bold); }
.fw-extrabold { font-weight: var(--fw-extrabold); }

.lh-tight { line-height: var(--lh-tight); }
.lh-snug  { line-height: var(--lh-snug); }
.lh-base  { line-height: var(--lh-base); }
.lh-loose { line-height: var(--lh-loose); }

.text-primary { color: var(--text); }
.text-soft    { color: var(--text-soft); }
.text-muted   { color: var(--text-muted); }
.text-light   { color: var(--text-light); }
.text-invert  { color: var(--text-invert); }
.text-navy    { color: var(--heading); }
.text-blue    { color: var(--blue-600); }
.text-accent  { color: var(--accent-ink); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }

.text-price-regular    { color: var(--price-regular); }
.text-price-sale       { color: var(--price-sale); }
.text-price-success    { color: var(--price-success); }
.text-status-pending   { color: var(--status-pending); }
.text-status-review    { color: var(--status-review); }
.text-status-approved  { color: var(--status-approved); }
.text-status-closed    { color: var(--status-closed); }
.text-status-cancelled { color: var(--status-cancelled); }

.uppercase  { text-transform: uppercase; }
.lowercase  { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* In RTL the physical direction utilities must keep meaning
   "start" and "end". theme.css maps .text-left → right in
   RTL by reassigning the shorthand below. */
html[dir="rtl"] .text-left  { text-align: right; }
html[dir="rtl"] .text-right { text-align: left; }

.tracking-tight  { letter-spacing: var(--tracking-tight); }
.tracking-normal { letter-spacing: var(--tracking-normal); }
.tracking-wide   { letter-spacing: var(--tracking-wide); }
.tracking-wider  { letter-spacing: var(--tracking-wider); }

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--tracking-wider);
  line-height: var(--lh-snug);
  text-transform: uppercase;
  color: var(--blue-600);
}

.eyebrow-muted  { color: var(--text-light); }
.eyebrow-navy   { color: var(--heading-soft); }
.eyebrow-invert { color: var(--blue-400); }

.lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-loose);
  color: var(--text-muted);
}

.lead-sm {
  font-size: var(--fs-base);
  line-height: var(--lh-loose);
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .lead    { font-size: var(--fs-base); }
  .lead-sm { font-size: var(--fs-md); }
}

.caption {
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--text-light);
  font-weight: var(--fw-medium);
}

/* ---------- META ---------- */

.meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.meta-block {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.5;
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.link {
  color: var(--blue-600);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

.link:hover {
  color: var(--blue-700);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--blue-600);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-decoration: none;
  transition: gap var(--dur-base) var(--ease), color var(--dur-fast) var(--ease);
}

.link-arrow:hover {
  color: var(--blue-700);
  gap: var(--space-3);
}

/* The trailing arrow flips in RTL. */
html[dir="rtl"] .link-arrow svg,
html[dir="rtl"] .link-arrow iconify-icon {
  transform: scaleX(-1);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

.text-balance { text-wrap: balance; }
.text-pretty  { text-wrap: pretty; }
.break-words  { overflow-wrap: anywhere; word-break: break-word; }

@media (prefers-reduced-motion: reduce) {
  .link-arrow { transition: none; }
}


/* ============================================================
   05 · CONTAINER
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container-full {
  width: 100%;
  max-width: none;
  padding-inline: var(--container-pad);
}

.container-flush {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: 0;
}

.container-inner {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
}

@media (max-width: 1200px) {
  .container,
  .container-narrow,
  .container-wide,
  .container-flush {
    padding-inline: var(--space-6);
  }
}

@media (max-width: 850px) {
  .container,
  .container-narrow,
  .container-wide,
  .container-flush {
    padding-inline: var(--space-5);
  }
}

@media (max-width: 640px) {
  .container,
  .container-narrow,
  .container-wide,
  .container-flush {
    padding-inline: var(--space-4);
  }
}

@media (max-width: 420px) {
  .container,
  .container-narrow,
  .container-wide,
  .container-flush {
    padding-inline: var(--space-3);
  }
}


/* ============================================================
   06 · UTILITIES
   ============================================================ */

/* ---------- DISPLAY ---------- */
.block         { display: block; }
.inline-block  { display: inline-block; }
.inline        { display: inline; }
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.grid          { display: grid; }
.inline-grid   { display: inline-grid; }
.hidden        { display: none; }

/* ---------- FLEX ---------- */
.flex-row      { flex-direction: row; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-nowrap   { flex-wrap: nowrap; }
.flex-1        { flex: 1 1 0%; }
.flex-auto     { flex: 1 1 auto; }
.flex-none     { flex: none; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow     { flex-grow: 1; }

.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.items-stretch  { align-items: stretch; }
.items-baseline { align-items: baseline; }

.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }
.justify-evenly  { justify-content: space-evenly; }

.self-start   { align-self: flex-start; }
.self-center  { align-self: center; }
.self-end     { align-self: flex-end; }
.self-stretch { align-self: stretch; }

/* ---------- GAP ---------- */
.gap-0  { gap: var(--space-0); }
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-5  { gap: var(--space-5); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }

/* ---------- GRID COLUMNS ---------- */
.grid-cols-1  { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5  { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6  { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* ---------- MARGIN ---------- */
.m-0  { margin: var(--space-0); }
.m-1  { margin: var(--space-1); }
.m-2  { margin: var(--space-2); }
.m-3  { margin: var(--space-3); }
.m-4  { margin: var(--space-4); }
.m-5  { margin: var(--space-5); }
.m-6  { margin: var(--space-6); }
.m-8  { margin: var(--space-8); }
.m-auto { margin: auto; }

.mt-0 { margin-top: var(--space-0); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }
.mt-auto { margin-top: auto; }

.mb-0 { margin-bottom: var(--space-0); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-auto { margin-bottom: auto; }

/* Physical margins. In RTL these stay physical — a page that
   needs logical margin uses .ms-* / .me-* below. */
.ml-0 { margin-left: var(--space-0); }
.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.ml-4 { margin-left: var(--space-4); }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: var(--space-0); }
.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.mr-4 { margin-right: var(--space-4); }
.mr-auto { margin-right: auto; }

/* Logical margins — inline-start is physical left in LTR and
   physical right in RTL. Use these for icons, avatars, etc. */
.ms-0 { margin-inline-start: var(--space-0); }
.ms-1 { margin-inline-start: var(--space-1); }
.ms-2 { margin-inline-start: var(--space-2); }
.ms-3 { margin-inline-start: var(--space-3); }
.ms-4 { margin-inline-start: var(--space-4); }
.ms-auto { margin-inline-start: auto; }

.me-0 { margin-inline-end: var(--space-0); }
.me-1 { margin-inline-end: var(--space-1); }
.me-2 { margin-inline-end: var(--space-2); }
.me-3 { margin-inline-end: var(--space-3); }
.me-4 { margin-inline-end: var(--space-4); }
.me-auto { margin-inline-end: auto; }

.mx-auto { margin-inline: auto; }
.my-auto { margin-block: auto; }

/* ---------- PADDING ---------- */
.p-0  { padding: var(--space-0); }
.p-1  { padding: var(--space-1); }
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }
.p-10 { padding: var(--space-10); }
.p-12 { padding: var(--space-12); }

.px-1 { padding-inline: var(--space-1); }
.px-2 { padding-inline: var(--space-2); }
.px-3 { padding-inline: var(--space-3); }
.px-4 { padding-inline: var(--space-4); }
.px-5 { padding-inline: var(--space-5); }
.px-6 { padding-inline: var(--space-6); }
.px-8 { padding-inline: var(--space-8); }

.py-1 { padding-block: var(--space-1); }
.py-2 { padding-block: var(--space-2); }
.py-3 { padding-block: var(--space-3); }
.py-4 { padding-block: var(--space-4); }
.py-5 { padding-block: var(--space-5); }
.py-6 { padding-block: var(--space-6); }
.py-8 { padding-block: var(--space-8); }
.py-10 { padding-block: var(--space-10); }
.py-12 { padding-block: var(--space-12); }

.pt-2 { padding-top: var(--space-2); }
.pt-4 { padding-top: var(--space-4); }
.pt-6 { padding-top: var(--space-6); }
.pt-8 { padding-top: var(--space-8); }
.pb-2 { padding-bottom: var(--space-2); }
.pb-4 { padding-bottom: var(--space-4); }
.pb-6 { padding-bottom: var(--space-6); }
.pb-8 { padding-bottom: var(--space-8); }
.pl-2 { padding-left: var(--space-2); }
.pl-4 { padding-left: var(--space-4); }
.pr-2 { padding-right: var(--space-2); }
.pr-4 { padding-right: var(--space-4); }

/* Logical paddings. */
.ps-2 { padding-inline-start: var(--space-2); }
.ps-3 { padding-inline-start: var(--space-3); }
.ps-4 { padding-inline-start: var(--space-4); }
.ps-5 { padding-inline-start: var(--space-5); }
.ps-6 { padding-inline-start: var(--space-6); }
.pe-2 { padding-inline-end: var(--space-2); }
.pe-3 { padding-inline-end: var(--space-3); }
.pe-4 { padding-inline-end: var(--space-4); }
.pe-5 { padding-inline-end: var(--space-5); }
.pe-6 { padding-inline-end: var(--space-6); }

/* ---------- WIDTH / HEIGHT ---------- */
.w-full   { width: 100%; }
.w-auto   { width: auto; }
.w-fit    { width: fit-content; }
.w-screen { width: 100vw; }

.h-full   { height: 100%; }
.h-auto   { height: auto; }
.h-screen { height: 100vh; height: 100dvh; }

.max-w-xs  { max-width: 320px; }
.max-w-sm  { max-width: 480px; }
.max-w-md  { max-width: 640px; }
.max-w-lg  { max-width: 780px; }
.max-w-xl  { max-width: 1024px; }
.max-w-2xl { max-width: 1280px; }
.max-w-full { max-width: 100%; }

.min-w-0 { min-width: 0; }
.min-h-0 { min-height: 0; }

/* ---------- POSITION ---------- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.inset-0 { inset: 0; }
.top-0   { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0  { left: 0; }

/* Logical insets. `inset-inline-start` is physical left in
   LTR and physical right in RTL. */
.inset-inline-start-0 { inset-inline-start: 0; }
.inset-inline-end-0   { inset-inline-end: 0; }

/* ---------- OVERFLOW ---------- */
.overflow-hidden  { overflow: hidden; }
.overflow-auto    { overflow: auto; }
.overflow-visible { overflow: visible; }
.overflow-x-auto  { overflow-x: auto; overflow-y: hidden; }
.overflow-y-auto  { overflow-y: auto; overflow-x: hidden; }

/* ---------- RADIUS ---------- */
.rounded-xs   { border-radius: var(--radius-xs); }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-2xl  { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-pill); }
.rounded-circle { border-radius: var(--radius-circle); }

/* ---------- SHADOW ---------- */
.shadow-none { box-shadow: none; }
.shadow-xs   { box-shadow: var(--shadow-xs); }
.shadow-sm   { box-shadow: var(--shadow-sm); }
.shadow-md   { box-shadow: var(--shadow-md); }
.shadow-lg   { box-shadow: var(--shadow-lg); }
.shadow-xl   { box-shadow: var(--shadow-xl); }

/* ---------- BORDERS ---------- */
.border        { border: 1px solid var(--border); }
.border-strong { border: 1px solid var(--border-strong); }
.border-soft   { border: 1px solid var(--border-soft); }
.border-none   { border: none; }

.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }

/* Logical borders. */
.border-s { border-inline-start: 1px solid var(--border); }
.border-e { border-inline-end: 1px solid var(--border); }

/* ---------- VISIBILITY ---------- */
.visible   { visibility: visible; }
.invisible { visibility: hidden; }

/* ---------- CURSOR / POINTER ---------- */
.cursor-pointer  { cursor: pointer; }
.cursor-default  { cursor: default; }
.pointer-none    { pointer-events: none; }
.pointer-auto    { pointer-events: auto; }
.select-none     { user-select: none; }

/* ---------- ASPECT RATIO ---------- */
.aspect-square    { aspect-ratio: 1 / 1; }
.aspect-video     { aspect-ratio: 16 / 9; }
.aspect-wide      { aspect-ratio: 21 / 9; }
.aspect-portrait  { aspect-ratio: 3 / 4; }

/* ---------- OPACITY ---------- */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* ---------- Z-INDEX ---------- */
.z-0       { z-index: 0; }
.z-base    { z-index: var(--z-base); }
.z-raised  { z-index: var(--z-raised); }
.z-sticky  { z-index: var(--z-sticky); }
.z-overlay { z-index: var(--z-overlay); }
.z-modal   { z-index: var(--z-modal); }
.z-toast   { z-index: var(--z-toast); }

/* ---------- TABLE CELL HELPERS ---------- */

.num,
.cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

html[dir="rtl"] .num,
html[dir="rtl"] .cell-num {
  text-align: left;
}

.cell-muted {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

.cell-truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-actions {
  text-align: right;
  width: 60px;
  white-space: nowrap;
}

html[dir="rtl"] .cell-actions {
  text-align: left;
}

/* ---------- SPINNER ---------- */

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--blue-100);
  border-top-color: var(--blue-600);
  border-radius: var(--radius-circle);
  animation: spin 800ms linear infinite;
  vertical-align: middle;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
.spinner-xl { width: 48px; height: 48px; border-width: 4px; }

.spinner-navy {
  border-color: var(--navy-100);
  border-top-color: var(--navy-700);
}

.spinner-invert {
  border-color: rgba(255, 255, 255, 0.14);
  border-top-color: var(--brand-text);
}

/* ---------- LOADING REGION ---------- */

.loading-region,
[data-busy="true"] {
  position: relative;
}

.loading-region:has([class*="skeleton"]),
[data-busy="true"]:has([class*="skeleton"]) {
  cursor: progress;
}

.loading-region:not(:has([class*="skeleton"]))::after,
[data-busy="true"]:not(:has([class*="skeleton"]))::after {
  display: none !important;
  content: none !important;
}

/* ---------- VISIBILITY HELPERS ---------- */

@media (max-width: 850px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 851px) {
  .hide-desktop-up,
  .hide-mobile-up { display: none !important; }
}

@media (max-width: 640px) {
  .hide-phone { display: none !important; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .hide-tablet { display: none !important; }
}

@media (min-width: 1025px) {
  .hide-desktop { display: none !important; }
}

@media (min-width: 1441px) {
  .hide-wide { display: none !important; }
}

@media (min-width: 641px) {
  .phone-only { display: none !important; }
}

@media (max-width: 639px), (min-width: 1025px) {
  .tablet-only { display: none !important; }
}

@media (max-width: 1024px) {
  .desktop-only { display: none !important; }
}

@media (max-width: 1440px) {
  .wide-only { display: none !important; }
}


/* ============================================================
   07 · ANIMATIONS
   ============================================================ */

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

.animate-spin {
  animation: spin 800ms linear infinite;
}

.animate-spin-slow {
  animation: spin 1.6s linear infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.animate-pulse {
  animation: pulse 2s var(--ease-in-out) infinite;
}

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

.animate-shimmer {
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.animate-fade-in  { animation: fade-in var(--dur-base) var(--ease) forwards; }
.animate-fade-out { animation: fade-out var(--dur-base) var(--ease) forwards; }

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-slide-up   { animation: slide-up var(--dur-slow) var(--ease-spring) forwards; }
.animate-slide-down { animation: slide-down var(--dur-slow) var(--ease-spring) forwards; }

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slide-out-right {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-slide-in-right  { animation: slide-in-right var(--dur-slow) var(--ease-spring) forwards; }
.animate-slide-out-right { animation: slide-out-right var(--dur-base) var(--ease) forwards; }
.animate-slide-in-left   { animation: slide-in-left var(--dur-slow) var(--ease-spring) forwards; }

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scale-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.96); }
}

.animate-scale-in  { animation: scale-in var(--dur-base) var(--ease-spring) forwards; }
.animate-scale-out { animation: scale-out var(--dur-fast) var(--ease) forwards; }

@keyframes pop-in {
  0%   { opacity: 0; transform: scale(0.88); }
  60%  { opacity: 1; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

.animate-pop-in {
  animation: pop-in var(--dur-slow) var(--ease-spring) forwards;
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-muted) 0%,
    var(--surface-soft)  50%,
    var(--surface-muted) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes progress-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* RTL flips the indeterminate bar direction. */
html[dir="rtl"] .animate-progress-indeterminate {
  animation-name: progress-indeterminate-rtl;
}

@keyframes progress-indeterminate-rtl {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-400%); }
}

.animate-progress-indeterminate {
  animation: progress-indeterminate 1.6s var(--ease) infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.animate-bob {
  animation: bob 2.4s var(--ease-in-out) infinite;
}

@keyframes rotate-180 {
  from { transform: rotate(0deg); }
  to   { transform: rotate(180deg); }
}

.animate-rotate-180 {
  animation: rotate-180 var(--dur-base) var(--ease) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .animate-spin,
  .animate-spin-slow,
  .animate-pulse,
  .animate-shimmer,
  .animate-fade-in,
  .animate-fade-out,
  .animate-slide-up,
  .animate-slide-down,
  .animate-slide-in-right,
  .animate-slide-out-right,
  .animate-slide-in-left,
  .animate-scale-in,
  .animate-scale-out,
  .animate-pop-in,
  .animate-progress-indeterminate,
  .animate-bob,
  .animate-rotate-180,
  .skeleton,
  .spinner {
    animation: none !important;
  }

  .spinner {
    border-color: var(--blue-100);
    border-top-color: var(--blue-600);
    opacity: 0.85;
  }
}


/* ============================================================
   08 · ACCESSIBILITY
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sr-only-focusable:not(:focus):not(:focus-within) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-toast);

  padding: var(--space-3) var(--space-5);

  background: var(--brand-bg);
  color: var(--brand-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-decoration: none;

  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);

  transform: translateY(-200%);
  transition: transform var(--dur-base) var(--ease);
}

html[dir="rtl"] .skip-link {
  left: auto;
  right: var(--space-3);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  border-radius: var(--radius-sm);
}

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

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

.focus-within:focus-within {
  box-shadow: var(--focus-ring);
  border-color: var(--blue-600);
}

@media (prefers-contrast: more) {
  :root {
    --text:        #0a1320;
    --text-soft:   #1e293b;
    --text-muted:  #334155;
    --text-light:  #475569;

    --border:        #94a3b8;
    --border-strong: #64748b;
    --border-soft:   #cbd5e1;

    --heading:      #0a1320;
    --heading-soft: #1e293b;

    --focus-outline: 3px solid var(--blue-700);
  }

  :focus-visible {
    outline-width: 3px;
  }
}

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

  .skip-link {
    transition: none;
  }
}

@media (forced-colors: active) {
  :focus-visible {
    outline: 2px solid CanvasText;
    outline-offset: 2px;
  }

  .skip-link {
    border: 1px solid CanvasText;
  }
}


/* ============================================================
   09 · LAYOUT
   ============================================================ */

/* ---------- PUBLIC LAYOUT ---------- */
.layout-public {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.layout-public > main {
  flex: 1 1 auto;
  width: 100%;
  padding-top: var(--topbar-h);
}

/* ---------- APP LAYOUT ----------
   The offset rules below assume LTR. theme.css flips them
   under [dir="rtl"] — the sidebar moves to the right edge,
   and #main-content offsets from the right instead of the
   left. */
.layout-app {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: var(--surface-soft);
}

.layout-app > .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: var(--z-sidebar);
  transition: transform var(--dur-slow) var(--ease);
}

html[dir="rtl"] .layout-app > .sidebar {
  inset: 0 0 0 auto;
}

.layout-app > .layout-app-main {
  flex: 1 1 auto;
  min-width: 0;
  width: calc(100% - var(--sidebar-w));
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: width var(--dur-slow) var(--ease),
              margin-left var(--dur-slow) var(--ease);
}

html[dir="rtl"] .layout-app > .layout-app-main {
  margin-left: 0;
  margin-right: var(--sidebar-w);
}

.layout-app > .layout-app-main > main {
  flex: 1 1 auto;
  width: 100%;
  padding: calc(var(--topbar-h) + var(--space-6)) var(--space-8) var(--space-12);
}

.layout-app.is-collapsed > .sidebar {
  width: 72px;
}

.layout-app.is-collapsed > .layout-app-main {
  width: calc(100% - 72px);
  margin-left: 72px;
}

html[dir="rtl"] .layout-app.is-collapsed > .layout-app-main {
  margin-left: 0;
  margin-right: 72px;
}

.layout-app.is-mobile-open > .sidebar {
  transform: translateX(0);
}

@media (max-width: 850px) {
  .layout-app > .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  html[dir="rtl"] .layout-app > .sidebar {
    transform: translateX(100%);
  }

  .layout-app > .layout-app-main {
    width: 100%;
    margin-left: 0;
  }

  html[dir="rtl"] .layout-app > .layout-app-main {
    margin-right: 0;
  }

  .layout-app > .layout-app-main > main {
    padding: calc(var(--topbar-h) + var(--space-4)) var(--space-4) var(--space-8);
  }
}

/* ---------- AUTH LAYOUT — SPLIT ---------- */
.layout-auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: var(--surface);
}

.layout-auth > .auth-info {
  display: flex;
  flex-direction: column;
  background: var(--brand-bg);
  color: var(--brand-text);
  padding: var(--space-10) var(--space-12);
  position: relative;
  overflow: hidden;
}

.layout-auth > .auth-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-8);
  background: var(--surface);
}

.layout-auth > .auth-form > .auth-form-inner {
  width: 100%;
  max-width: 420px;
}

@media (max-width: 900px) {
  .layout-auth {
    grid-template-columns: 1fr;
  }
  .layout-auth > .auth-info {
    padding: var(--space-8);
  }
}

@media (max-width: 700px) {
  .layout-auth > .auth-info {
    display: none;
  }
  .layout-auth > .auth-form {
    padding: var(--space-6) var(--space-5);
  }
}

/* ---------- AUTH LAYOUT — CENTERED ---------- */
.layout-auth-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-8) var(--space-5);
  background: var(--surface-soft);
}

.layout-auth-center > .auth-card {
  width: 100%;
  max-width: 480px;
}

@media (max-width: 480px) {
  .layout-auth-center {
    padding: var(--space-5) var(--space-3);
    align-items: stretch;
  }
}

/* ---------- MARKETING LAYOUT ---------- */
.layout-marketing {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.layout-marketing > section {
  width: 100%;
  position: relative;
}

.layout-marketing > section + section {
  margin-top: 0;
}

/* ---------- DOCS LAYOUT ---------- */
.layout-docs {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: var(--space-8);
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding: var(--space-8) var(--container-pad);
}

.layout-docs > .docs-nav    { position: sticky; top: calc(var(--topbar-h) + var(--space-5)); align-self: start; }
.layout-docs > .docs-main   { min-width: 0; }
.layout-docs > .docs-toc    { position: sticky; top: calc(var(--topbar-h) + var(--space-5)); align-self: start; }

@media (max-width: 1200px) {
  .layout-docs {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .layout-docs > .docs-toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .layout-docs {
    grid-template-columns: 1fr;
    padding: var(--space-5) var(--container-pad);
  }
  .layout-docs > .docs-nav {
    position: static;
  }
}

/* ---------- BLOG LAYOUT ---------- */
.layout-blog {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-10);
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding: var(--space-10) var(--container-pad);
}

.layout-blog > .blog-main   { min-width: 0; }
.layout-blog > .blog-aside  { min-width: 0; }

@media (max-width: 1024px) {
  .layout-blog {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: var(--space-8);
  }
}

@media (max-width: 850px) {
  .layout-blog {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
}

/* ---------- DASHBOARD LAYOUT ---------- */
.layout-dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: var(--surface-soft);
}

.layout-dashboard > main {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding: var(--space-8) var(--container-pad) var(--space-12);
}

@media (max-width: 640px) {
  .layout-dashboard > main {
    padding: var(--space-5) var(--container-pad) var(--space-8);
  }
}

/* ---------- SPLIT LAYOUT ---------- */
.layout-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-8);
  width: 100%;
  align-items: start;
}

.layout-split.gap-sm { gap: var(--space-4); }
.layout-split.gap-lg { gap: var(--space-12); }
.layout-split.center { align-items: center; }

@media (max-width: 900px) {
  .layout-split {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* ---------- ASIDE LAYOUT ----------
   .aside-left and .aside-wide both flip in RTL — the main
   column and the aside column swap sides. */
.layout-aside {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-8);
  width: 100%;
  align-items: start;
}

.layout-aside.aside-left {
  grid-template-columns: 320px minmax(0, 1fr);
}

html[dir="rtl"] .layout-aside,
html[dir="rtl"] .layout-aside.aside-wide,
html[dir="rtl"] .layout-aside.aside-narrow {
  grid-template-columns: 320px minmax(0, 1fr);
}

html[dir="rtl"] .layout-aside.aside-left {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.layout-aside.aside-wide {
  grid-template-columns: minmax(0, 1fr) 400px;
}

.layout-aside.aside-narrow {
  grid-template-columns: minmax(0, 1fr) 260px;
}

.layout-aside > .aside-col {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-5));
  align-self: start;
}

@media (max-width: 1024px) {
  .layout-aside,
  .layout-aside.aside-left,
  .layout-aside.aside-wide,
  .layout-aside.aside-narrow {
    grid-template-columns: 1fr;
  }

  .layout-aside > .aside-col {
    position: static;
  }
}

/* ---------- CENTER LAYOUT ---------- */
.layout-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: var(--space-8) var(--space-5);
  text-align: center;
}

.layout-center > .center-inner {
  width: 100%;
  max-width: 640px;
}

@media (max-width: 480px) {
  .layout-center {
    padding: var(--space-6) var(--space-4);
  }
}

/* ---------- STACK LAYOUT ---------- */
.layout-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.layout-stack.gap-1  { gap: var(--space-1); }
.layout-stack.gap-2  { gap: var(--space-2); }
.layout-stack.gap-3  { gap: var(--space-3); }
.layout-stack.gap-4  { gap: var(--space-4); }
.layout-stack.gap-5  { gap: var(--space-5); }
.layout-stack.gap-6  { gap: var(--space-6); }
.layout-stack.gap-8  { gap: var(--space-8); }
.layout-stack.gap-10 { gap: var(--space-10); }
.layout-stack.gap-12 { gap: var(--space-12); }

/* ---------- CLUSTER LAYOUT ---------- */
.layout-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.layout-cluster.between   { justify-content: space-between; }
.layout-cluster.end       { justify-content: flex-end; }
.layout-cluster.start     { justify-content: flex-start; }
.layout-cluster.center    { justify-content: center; }
.layout-cluster.items-top { align-items: flex-start; }

/* ---------- AUTO GRID LAYOUT ---------- */
.layout-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-5);
}

.layout-grid-auto.narrow {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.layout-grid-auto.wide {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.layout-grid-auto.gap-sm { gap: var(--space-3); }
.layout-grid-auto.gap-lg { gap: var(--space-8); }

/* ---------- SIDEBAR-VISIBLE OFFSET HELPERS ---------- */
.has-sidebar {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  transition: margin-left var(--dur-slow) var(--ease),
              width var(--dur-slow) var(--ease);
}

html[dir="rtl"] .has-sidebar {
  margin-left: 0;
  margin-right: var(--sidebar-w);
}

.has-sidebar.no-transition {
  transition: none;
}

@media (max-width: 850px) {
  .has-sidebar {
    margin-left: 0;
    width: 100%;
  }
  html[dir="rtl"] .has-sidebar {
    margin-right: 0;
  }
}

/* ---------- STICKY SIDEBAR COLUMN ---------- */
.sticky-col {
  position: sticky;
  top: calc(var(--topbar-h) + var(--space-5));
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - var(--space-10));
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 1024px) {
  .sticky-col {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* ---------- SECTION RHYTHM HELPERS ---------- */
.layout-section {
  width: 100%;
  padding-block: var(--section-y, var(--space-16));
}

.layout-section > .container {
  position: relative;
  z-index: 1;
}

.layout-section.tight {
  padding-block: calc(var(--section-y, var(--space-16)) * 0.5);
}

.layout-section.loose {
  padding-block: calc(var(--section-y, var(--space-16)) * 1.5);
}

.layout-section.full-bleed {
  padding-block: var(--section-y, var(--space-16));
  border-radius: 0;
}

/* ---------- WATERMARK-AWARE CONTAINERS ---------- */
.layout-section.watermark-host,
.layout-app > .layout-app-main > main.watermark-host {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* ---------- FIXED CHROME OFFSET ---------- */
.has-fixed-navbar {
  padding-top: var(--topbar-h);
}

.has-fixed-navbar-mobile {
  padding-top: 0;
}

@media (max-width: 850px) {
  .has-fixed-navbar-mobile {
    padding-top: var(--topbar-h);
  }
}

/* ---------- MOBILE BOTTOM NAV OFFSET ---------- */
.has-bottom-nav {
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 851px) {
  .has-bottom-nav {
    padding-bottom: 0;
  }
}

/* ---------- PRINT LAYOUT ---------- */
@media print {
  .layout-app,
  .layout-auth,
  .layout-docs,
  .layout-blog,
  .layout-dashboard {
    display: block;
    min-height: auto;
    padding: 0;
  }

  .layout-app > .layout-app-main {
    width: 100%;
    margin: 0;
  }

  .layout-app > .layout-app-main > main,
  .layout-dashboard > main,
  .layout-docs,
  .layout-blog {
    padding: var(--space-4) 0;
  }

  .layout-split,
  .layout-aside {
    display: block;
  }

  .layout-aside > .aside-col {
    position: static;
  }
}


/* ============================================================
   10 · RESPONSIVE
   ------------------------------------------------------------
   Breakpoint token overrides only. Safe-area handling is
   delegated to navigation.css, where the real fixed elements
   live.
   ============================================================ */

/* ---------- VERY SMALL PHONES 320 ---------- */
@media (max-width: 320px) {
  :root {
    --container-pad: 10px;
    --sidebar-w: 240px;
  }

  html { font-size: 14px; }
}

/* ---------- 321–360 ---------- */
@media (min-width: 321px) and (max-width: 360px) {
  :root {
    --container-pad: 12px;
    --sidebar-w: 250px;
  }

  html { font-size: 14px; }
}

/* ---------- 361–400 ---------- */
@media (min-width: 361px) and (max-width: 400px) {
  :root { --container-pad: 14px; }
  html { font-size: 14.5px; }
}

/* ---------- 401–480 ---------- */
@media (min-width: 401px) and (max-width: 480px) {
  :root { --container-pad: 16px; }
}

/* ---------- 481–540 ---------- */
@media (min-width: 481px) and (max-width: 540px) {
  :root { --container-pad: 16px; }
}

/* ---------- 541–640 ---------- */
@media (min-width: 541px) and (max-width: 640px) {
  :root { --container-pad: 18px; }
}

/* ---------- 641–768 ---------- */
@media (min-width: 641px) and (max-width: 768px) {
  :root {
    --container-pad: 20px;
    --sidebar-w: 260px;
  }
}

/* ---------- 769–900 ---------- */
@media (min-width: 769px) and (max-width: 900px) {
  :root {
    --container-pad: 22px;
    --sidebar-w: 260px;
  }
}

/* ---------- 901–1024 ---------- */
@media (min-width: 901px) and (max-width: 1024px) {
  :root {
    --sidebar-w: 270px;
  }
}

/* ---------- 1025–1200 ---------- */
@media (min-width: 1025px) and (max-width: 1200px) {
  :root { --sidebar-w: 260px; }
}

/* ---------- 1201–1440 ---------- */
@media (min-width: 1201px) and (max-width: 1440px) {
  :root {
    --sidebar-w: 260px;
    --container-max: 1320px;
  }
}

/* ---------- 1441–1680 ---------- */
@media (min-width: 1441px) and (max-width: 1680px) {
  :root { --container-max: 1400px; }
}

/* ---------- 1681–1920 ---------- */
@media (min-width: 1681px) and (max-width: 1920px) {
  :root {
    --container-max: 1440px;
    --container-wide: 1680px;
  }
}

/* ---------- 1921–2560 ---------- */
@media (min-width: 1921px) and (max-width: 2560px) {
  :root {
    --container-max: 1560px;
    --container-wide: 1800px;
    --container-pad: 32px;
  }
}

/* ---------- 2561+ ---------- */
@media (min-width: 2561px) {
  :root {
    --container-max: 1680px;
    --container-wide: 2000px;
    --container-pad: 40px;
  }

  html { font-size: 16.5px; }
}

/* ---------- LANDSCAPE PHONE ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --section-y: clamp(32px, 6vw, 56px); }

  .section { padding-top: var(--space-8); padding-bottom: var(--space-8); }
  .section-lg { padding-top: var(--space-10); padding-bottom: var(--space-10); }
}

/* ---------- LANDSCAPE TABLET ---------- */
@media (orientation: landscape) and (min-height: 501px) and (max-height: 800px) {
  :root { --section-y: clamp(48px, 7vw, 72px); }
}

/* ---------- SAFE AREA ----------
   Deliberately minimal. Only applies to elements that are NOT
   position: fixed. Fixed chrome is handled in navigation.css
   on the actual elements.

   In RTL, the notch on iOS may be on the right or the left
   depending on device orientation — this rule uses the
   physical inset-start / inset-end, which theme.css maps. */
@supports (padding: env(safe-area-inset-bottom)) {
  .min-h-screen,
  .h-screen {
    min-height: calc(100dvh - env(safe-area-inset-bottom));
  }
}

/* ---------- TOUCH DEVICES — NO HOVER ---------- */
@media (hover: none) and (pointer: coarse) {
  .hover-lift:hover,
  .card-hover:hover,
  .card-interactive:hover {
    transform: none;
  }

  a,
  button,
  .btn,
  input,
  select,
  textarea {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ---------- FINE POINTER ---------- */
@media (hover: hover) and (pointer: fine) {
  .hover-lift:hover {
    transform: translateY(-2px);
  }
}

/* ---------- FOLDABLE POSTURE ---------- */
@media (device-posture: folded) {
  :root {
    --container-pad: 12px;
    --sidebar-w: 240px;
  }
}

@media (device-posture: continuous) {
  :root { --container-pad: 20px; }
}

/* ---------- HIGH DPI ---------- */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  .border,
  .border-t,
  .border-b,
  .border-l,
  .border-r {
    border-width: 1px;
  }
}

/* ---------- PRINT OVERRIDE FOR RESPONSIVE ---------- */
@media print {
  :root {
    --container-pad: 0;
    --section-y: 0;
  }
}


/* ============================================================
   11 · PRINT
   ============================================================ */

@media print {

  *,
  *::before,
  *::after {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    color: #000 !important;
  }

  html,
  body {
    width: 100%;
    height: auto;
    font-size: 11pt;
    line-height: 1.4;
    background: #fff !important;
  }

  body {
    display: block;
  }

  nav,
  header,
  footer,
  aside,
  .navbar,
  .sidebar,
  .topbar,
  .site-footer,
  [data-mount="footer"],
  .mobile-nav,
  #mobile-bottom-nav,
  #site-header,
  #site-sidebar,
  .toast-container,
  .toasts,
  .modal,
  .drawer,
  .action-sheet,
  .dropdown-menu,
  .dropdown-panel,
  .tooltip,
  .popover,
  .skip-link,
  .no-print,
  .toast-region,
  [data-page-loader],
  #app-splash,
  [role="dialog"],
  [aria-hidden="true"] {
    display: none !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #444 !important;
    word-break: break-all;
  }

  a[href^="#"]::after,
  a[href^="mailto:"]::after,
  a[href^="tel:"]::after {
    content: "";
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
    break-after: avoid;
    page-break-after: avoid;
  }

  h1 { font-size: 22pt; }
  h2 { font-size: 18pt; }
  h3 { font-size: 14pt; }
  h4 { font-size: 12pt; }

  p,
  blockquote {
    orphans: 3;
    widows: 3;
  }

  img,
  svg,
  picture {
    max-width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
    break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  th,
  td {
    padding: 6pt 8pt;
    border: 1px solid #999 !important;
    color: #000 !important;
  }

  .card,
  .panel,
  .surface,
  [class*="card"],
  [class*="surface"] {
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
    break-inside: avoid;
    padding: 8pt;
  }

  [class*="watermark"]::before,
  [class*="watermark"]::after,
  .watermark::before,
  .watermark::after {
    display: none !important;
  }

  @page {
    margin: 12mm 14mm;
  }

  @page :first {
    margin-top: 18mm;
  }

  .print-break-before {
    break-before: page;
    page-break-before: always;
  }

  .print-break-after {
    break-after: page;
    page-break-after: always;
  }

  .print-avoid-break {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}


/* ============================================================
   END OF FOUNDATION
   ------------------------------------------------------------
   Verification:

     ✅ Zero raw hex outside the token block.

     ✅ TOKEN ARCHITECTURE split into three layers:
          RAW scale             — fixed forever
          SEMANTIC tokens       — flip between themes
          THEME overrides       — live in theme.css only

     ✅ CHROME family added:
          --chrome-bg, --chrome-bg-deep,
          --chrome-text, --chrome-text-soft,
          --chrome-text-muted, --chrome-line,
          --chrome-line-strong, --chrome-input-bg,
          --chrome-input-line, --chrome-hover,
          --chrome-active
        Never flips. theme.css must not touch any of these.

     ✅ BRAND family added:
          --brand-bg, --brand-bg-deep,
          --brand-text, --brand-text-soft,
          --brand-text-muted, --brand-line
        Never flips. Same reason as chrome — brand bands
        are a fixed visual anchor.

     ✅ HEADING family added:
          --heading, --heading-soft
        Flips in theme.css. Every h1–h6, every display class,
        every .text-navy, every `code` block reads these
        instead of --navy-800.

     ✅ --page-bg promoted to :root. Previously it was only
        defined inside theme.css's dark block, which meant
        any rule that read it before theme.css loaded fell
        through to `auto`.

     ✅ --navy-800 and --navy-900 remain raw. They are not
        reassigned anywhere. Chrome pins to them via the
        chrome family; brand bands pin to them via the brand
        family; headings reach for --heading.

     ✅ --font-heading introduced as a separate alias for
        --font. theme.css reassigns it under html[lang="ar"]
        so an Arabic display face can be swapped in without
        touching body copy.

     ✅ --surface-invert kept for backward compatibility but
        documented as a fixed navy — not a flipping token.

     ✅ RTL utilities added:
          .ms-* / .me-*        logical margin utilities
          .ps-* / .pe-*        logical padding utilities
          .border-s / .border-e logical border utilities
          .inset-inline-*      logical inset utilities
        Existing physical utilities (.ml-, .mr-, .pl-, .pr-)
        kept for code that needs a physical direction.

     ✅ RTL overrides in this file:
          html[dir="rtl"] .text-left / .text-right
          html[dir="rtl"] .num / .cell-num / .cell-actions
          html[dir="rtl"] .skip-link
          html[dir="rtl"] .link-arrow svg / iconify-icon
          html[dir="rtl"] .animate-progress-indeterminate
          html[dir="rtl"] .layout-app > .sidebar
          html[dir="rtl"] .layout-app > .layout-app-main
          html[dir="rtl"] .layout-app.is-collapsed > .layout-app-main
          html[dir="rtl"] .layout-aside (four variants)
          html[dir="rtl"] .has-sidebar

     ✅ Preserved: --color-* aliases, .meta, .num, .cell-*,
        .spinner, .loading-region, [data-busy],
        .visually-hidden, .hide-* visibility helpers,
        iconify-icon defaults, @property --progress-value.

     ✅ Preserved: --topbar-h: 54px.

     ✅ Preserved: every utility, every breakpoint, every
        animation, every print rule.

     ✅ Zero element rules changed except:
          h1–h6 → --heading
          .display-1–3 → --heading
          .text-navy → --heading
          .text-status-closed and friends → unchanged
          code → --heading
          ::selection → --heading
          body background → --page-bg
          .bg-navy / .bg-navy-deep → --brand-bg / --brand-bg-deep
          .skip-link → --brand-bg / --brand-text
          .spinner-invert → --brand-text
          .layout-auth > .auth-info → --brand-bg / --brand-text
        Every other element rule is unchanged.

     ✅ NEXT: theme.css reassigns the SEMANTIC tokens in
        [data-theme="dark"]. Navigation.css, overlays.css,
        auth.css and every page file switch from --navy-800
        to --chrome-bg or --brand-bg where they currently
        reach for the raw token as a background.
   ============================================================ */
