/* =============================================================================
   Pehnorra web — design system (tokens + components). No build step.
   Load order on every page:  ui.css → shell.css (dashboards) → page CSS.
   Guide: /assets/UI-GUIDE.md · Live reference: /styleguide.html
   Rules: logical properties only (margin-inline-start, inset-inline-end, text-align: start)
   so Urdu (dir=rtl) mirrors for free; colours only through the tokens below so dark mode works.
   ============================================================================= */

/* ---------- 1. Tokens: light (default) ---------- */
:root {
  color-scheme: light;

  /* brand palette (raw) */
  --c-espresso: #1F1612;
  --c-espresso-2: #2A201A;
  --c-brown: #704F38;
  --c-brown-dark: #5A3F2C;
  --c-brown-light: #9D7A6B;
  --c-champagne: #E9D5BF;
  --c-champagne-soft: #F3E9DD;
  --c-cream: #F5F1EB;
  --c-paper: #FBF8F3;

  /* surfaces */
  --bg: #F5F1EB;                 /* page canvas */
  --surface: #FFFFFF;            /* cards, inputs, sheets */
  --surface-2: #FBF8F3;          /* nested panels, table heads */
  --surface-muted: #EFE9E1;      /* placeholders, skeletons, quiet fills */
  --surface-hover: rgba(112, 79, 56, 0.06);
  --surface-pressed: rgba(112, 79, 56, 0.11);
  --overlay: rgba(21, 16, 12, 0.48);

  /* text (contrast on white: 17:1 · 6.2:1 · 3.8:1 — subtle is for placeholders/decoration only) */
  --text: #211A15;
  --text-muted: #6B5F57;
  --text-subtle: #8C8079;
  --text-inverse: #FFFFFF;
  --link: #704F38;

  /* lines */
  --border: #E5DDD3;
  --border-strong: #D3C7BA;
  --divider: #EEE7DE;

  /* brand roles */
  --primary: #704F38;
  --primary-hover: #5A3F2C;
  --primary-pressed: #4A3323;
  --primary-soft: #EFE4DA;
  --primary-soft-text: #5A3F2C;
  --on-primary: #FFFFFF;
  --accent: #E9D5BF;             /* champagne */
  --accent-soft: #F3E9DD;
  --on-accent: #3D2C1E;
  --focus: #704F38;

  /* hero / editorial areas stay espresso in both themes */
  --hero-bg: #1F1612;
  --hero-surface: #2A201A;
  --hero-text: #F5F1EB;
  --hero-muted: #CDBFB0;
  --hero-accent: #E9D5BF;

  /* semantic tones: fg passes 4.5:1 on white; *-soft is the matching tint; *-line for borders */
  --success: #2E7D4F;  --success-soft: #E3F1E8;  --success-line: #C7E3D1;
  --warning: #8F5400;  --warning-soft: #FBEFD9;  --warning-line: #F1D9AE;
  --danger:  #B3261E;  --danger-soft:  #FBE6E4;  --danger-line:  #F2C9C5;
  --info:    #2F5F8A;  --info-soft:    #E3EDF6;  --info-line:    #C8DAEB;
  --neutral: #6B5F57;  --neutral-soft: #EFE9E1;  --neutral-line: #E2D9CE;
  --brand:   #704F38;  --brand-soft:   #EFE4DA;  --brand-line:   #E0D0C2;
  --sale:    #A9532D;  --sale-soft:    #F6E3D8;  --sale-line:    #EDC9B6;
  --star: #D99A1E;

  /* type */
  --font-display: 'Lora', 'Noto Nastaliq Urdu', Georgia, serif;
  --font-sans: 'Manrope', 'Noto Nastaliq Urdu', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-2xs: 0.6875rem;  /* 11 */
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-md: 1rem;        /* 16 — body */
  --fs-lg: 1.125rem;    /* 18 */
  --fs-xl: 1.375rem;    /* 22 */
  --fs-2xl: 1.75rem;    /* 28 */
  --fs-3xl: 2.25rem;    /* 36 */
  --fs-4xl: 3rem;       /* 48 */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-body: 1.55;
  --tracking-caps: 0.14em;

  /* space (4px grid) */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;  --sp-3: 0.75rem;  --sp-4: 1rem;   --sp-5: 1.25rem;
  --sp-6: 1.5rem;   --sp-7: 2rem;    --sp-8: 2.5rem;   --sp-9: 3rem;   --sp-10: 4rem;

  /* radii */
  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

  /* elevation (warm-tinted) */
  --sh-1: 0 1px 2px rgba(61, 44, 30, 0.06), 0 1px 1px rgba(61, 44, 30, 0.04);
  --sh-2: 0 4px 14px rgba(61, 44, 30, 0.08), 0 1px 3px rgba(61, 44, 30, 0.05);
  --sh-3: 0 14px 36px rgba(61, 44, 30, 0.14), 0 4px 10px rgba(61, 44, 30, 0.06);
  --sh-4: 0 24px 60px rgba(31, 22, 18, 0.24);

  /* motion */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* sizing */
  --tap: 44px;               /* minimum touch target */
  --control-h: 48px;         /* inputs, default buttons on touch */
  --control-h-sm: 36px;
  --control-h-lg: 56px;
  --container: 1240px;

  /* layers */
  --z-sticky: 20; --z-nav: 40; --z-popover: 60; --z-toast: 90; --z-banner: 95;
}

/* ---------- 2. Tokens: dark (system preference unless the user picked light; or explicit) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15100C; --surface: #1E1713; --surface-2: #241C17; --surface-muted: #2E241E;
    --surface-hover: rgba(233, 213, 191, 0.06); --surface-pressed: rgba(233, 213, 191, 0.11);
    --overlay: rgba(0, 0, 0, 0.62);
    --text: #F4EDE5; --text-muted: #C4B6A8; --text-subtle: #978878; --text-inverse: #1F1612; --link: #DDB991;
    --border: #3A2E26; --border-strong: #54453A; --divider: #2C231D;
    --primary: #D2AE8A; --primary-hover: #E0C2A3; --primary-pressed: #C49B74;
    --primary-soft: rgba(210, 174, 138, 0.15); --primary-soft-text: #E8CDB0; --on-primary: #1F1612;
    --accent: #E9D5BF; --accent-soft: rgba(233, 213, 191, 0.12); --on-accent: #1F1612; --focus: #E0C2A3;
    --hero-bg: #0F0B08; --hero-surface: #1E1713;
    --success: #7DCB9C; --success-soft: rgba(125, 203, 156, 0.14); --success-line: rgba(125, 203, 156, 0.32);
    --warning: #E8B45F; --warning-soft: rgba(232, 180, 95, 0.14); --warning-line: rgba(232, 180, 95, 0.32);
    --danger: #F2958C;  --danger-soft: rgba(242, 149, 140, 0.14);  --danger-line: rgba(242, 149, 140, 0.32);
    --info: #8FBBE6;    --info-soft: rgba(143, 187, 230, 0.14);    --info-line: rgba(143, 187, 230, 0.32);
    --neutral: #C4B6A8; --neutral-soft: rgba(196, 182, 168, 0.12); --neutral-line: rgba(196, 182, 168, 0.28);
    --brand: #DDB991;   --brand-soft: rgba(210, 174, 138, 0.15);   --brand-line: rgba(210, 174, 138, 0.34);
    --sale: #EE9A73;    --sale-soft: rgba(238, 154, 115, 0.14);    --sale-line: rgba(238, 154, 115, 0.32);
    --star: #F0BE4A;
    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --sh-2: 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
    --sh-3: 0 14px 36px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.3);
    --sh-4: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15100C; --surface: #1E1713; --surface-2: #241C17; --surface-muted: #2E241E;
  --surface-hover: rgba(233, 213, 191, 0.06); --surface-pressed: rgba(233, 213, 191, 0.11);
  --overlay: rgba(0, 0, 0, 0.62);
  --text: #F4EDE5; --text-muted: #C4B6A8; --text-subtle: #978878; --text-inverse: #1F1612; --link: #DDB991;
  --border: #3A2E26; --border-strong: #54453A; --divider: #2C231D;
  --primary: #D2AE8A; --primary-hover: #E0C2A3; --primary-pressed: #C49B74;
  --primary-soft: rgba(210, 174, 138, 0.15); --primary-soft-text: #E8CDB0; --on-primary: #1F1612;
  --accent: #E9D5BF; --accent-soft: rgba(233, 213, 191, 0.12); --on-accent: #1F1612; --focus: #E0C2A3;
  --hero-bg: #0F0B08; --hero-surface: #1E1713;
  --success: #7DCB9C; --success-soft: rgba(125, 203, 156, 0.14); --success-line: rgba(125, 203, 156, 0.32);
  --warning: #E8B45F; --warning-soft: rgba(232, 180, 95, 0.14); --warning-line: rgba(232, 180, 95, 0.32);
  --danger: #F2958C;  --danger-soft: rgba(242, 149, 140, 0.14);  --danger-line: rgba(242, 149, 140, 0.32);
  --info: #8FBBE6;    --info-soft: rgba(143, 187, 230, 0.14);    --info-line: rgba(143, 187, 230, 0.32);
  --neutral: #C4B6A8; --neutral-soft: rgba(196, 182, 168, 0.12); --neutral-line: rgba(196, 182, 168, 0.28);
  --brand: #DDB991;   --brand-soft: rgba(210, 174, 138, 0.15);   --brand-line: rgba(210, 174, 138, 0.34);
  --sale: #EE9A73;    --sale-soft: rgba(238, 154, 115, 0.14);    --sale-line: rgba(238, 154, 115, 0.32);
  --star: #F0BE4A;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-2: 0 4px 14px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
  --sh-3: 0 14px 36px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.3);
  --sh-4: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* ---------- 3. Urdu (lang=ur, dir=rtl): Nastaliq needs room to breathe; never letter-space Arabic script ---------- */
:root[lang="ur"] {
  --lh-tight: 1.7;
  --lh-snug: 1.85;
  --lh-body: 2.05;
  --tracking-caps: 0;
}
:root[lang="ur"] body { font-size: 1.0625rem; }
:root[lang="ur"] .caps, :root[lang="ur"] .eyebrow { text-transform: none; letter-spacing: 0; }

/* ---------- 4. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 1ms; --dur-2: 1ms; --dur-3: 1ms; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* ---------- 5. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { margin: 0; line-height: var(--lh-tight); color: var(--text); font-weight: var(--fw-semibold); }
p { margin: 0; }
img, svg, video { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }
[hidden] { display: none !important; }
html.ui-modal-open { overflow: hidden; }

/* one focus ring everywhere — visible, offset, brand-coloured */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
:focus:not(:focus-visible) { outline: none; }

.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; vertical-align: -0.25em; stroke: currentColor; fill: none; }
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }
[dir="rtl"] .icon-dir { transform: scaleX(-1); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; inset-inline-start: var(--sp-3); inset-block-start: -100px; z-index: 100;
  background: var(--primary); color: var(--on-primary); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); text-decoration: none; font-weight: var(--fw-semibold);
}
.skip-link:focus { inset-block-start: var(--sp-3); }

/* ---------- 6. Typography ---------- */
.display, .h-display { font-family: var(--font-display); font-weight: var(--fw-medium); letter-spacing: -0.01em; line-height: var(--lh-tight); }
:root[lang="ur"] .display, :root[lang="ur"] .h-display { letter-spacing: 0; }
.h1 { font-family: var(--font-display); font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); font-weight: var(--fw-medium); line-height: var(--lh-tight); }
.h2 { font-family: var(--font-display); font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.875rem); font-weight: var(--fw-medium); line-height: var(--lh-tight); }
.h3 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.h4 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.eyebrow { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-muted); }
.lead { font-size: var(--fs-lg); color: var(--text-muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-lg { font-size: var(--fs-lg); }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-brand { color: var(--primary); }
.text-start { text-align: start; }
.text-end { text-align: end; }
.text-center { text-align: center; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ltr { direction: ltr; unicode-bidi: isolate; } /* phone numbers, emails, codes inside Urdu text */

/* ---------- 7. Layout helpers ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--sp-4); }
.stack { display: flex; flex-direction: column; gap: var(--gap, var(--sp-4)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, var(--sp-3)); }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--gap, var(--sp-3)); }
.grid-auto { display: grid; gap: var(--gap, var(--sp-4)); grid-template-columns: repeat(auto-fill, minmax(var(--min, 240px), 1fr)); }
.grid-2 { display: grid; gap: var(--gap, var(--sp-4)); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: var(--gap, var(--sp-4)); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: var(--gap, var(--sp-4)); grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023.98px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639.98px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 479.98px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-0 { margin-block-start: 0; } .mt-2 { margin-block-start: var(--sp-2); } .mt-4 { margin-block-start: var(--sp-4); } .mt-6 { margin-block-start: var(--sp-6); }
.mb-0 { margin-block-end: 0; } .mb-2 { margin-block-end: var(--sp-2); } .mb-4 { margin-block-end: var(--sp-4); } .mb-6 { margin-block-end: var(--sp-6); }
.divider { border: 0; border-block-start: 1px solid var(--divider); margin-block: var(--sp-5); }
@media (max-width: 767.98px) { .hide-phone { display: none !important; } }
@media (min-width: 768px) { .only-phone { display: none !important; } }

/* ---------- 8. Buttons ---------- */
.btn {
  --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: transparent; --btn-hover: var(--primary-hover);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0.55rem 1.15rem;
  border: 1.5px solid var(--btn-bd); border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--font-sans); font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background-color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline-offset: 3px; border-radius: var(--r-pill); }
.btn .icon { width: 1.2em; height: 1.2em; }
.btn-primary { /* default look */ }
.btn-secondary { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong); --btn-hover: var(--surface-2); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--primary); --btn-bd: transparent; --btn-hover: var(--surface-hover); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-hover: #93201A; }
:root[data-theme="dark"] .btn-danger { --btn-fg: #1F1612; --btn-hover: #F7B2AB; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { --btn-fg: #1F1612; --btn-hover: #F7B2AB; } }
.btn-danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: transparent; --btn-hover: var(--danger-soft); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-hover: #DFC6AB; }
.btn-on-dark { --btn-bg: var(--hero-accent); --btn-fg: var(--c-espresso); --btn-hover: #F3E5D3; }
.btn-outline-on-dark { --btn-bg: transparent; --btn-fg: var(--hero-text); --btn-bd: rgba(245, 241, 235, 0.45); --btn-hover: rgba(245, 241, 235, 0.08); }
.btn-sm { min-height: var(--control-h-sm); padding: 0.35rem 0.85rem; font-size: var(--fs-sm); }
.btn-lg { min-height: var(--control-h-lg); padding: 0.75rem 1.6rem; font-size: var(--fs-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 0; width: var(--tap); min-width: var(--tap); border-radius: var(--r-pill); }
.btn-icon.btn-sm { width: var(--control-h-sm); min-width: var(--control-h-sm); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 1.15em; height: 1.15em;
  border: 2px solid var(--btn-fg); border-inline-end-color: transparent; border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
}
@media (pointer: coarse) { .btn-sm { min-height: var(--tap); } .btn-icon.btn-sm { width: var(--tap); min-width: var(--tap); } }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.btn-row-end { justify-content: flex-end; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font-weight: var(--fw-semibold); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; min-height: auto; }

@keyframes ui-spin { to { transform: rotate(360deg); } }
.spinner { display: inline-block; width: 1.5rem; height: 1.5rem; border: 2.5px solid var(--border-strong); border-inline-end-color: var(--primary); border-radius: 50%; animation: ui-spin 0.8s linear infinite; }

/* ---------- 9. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-block-end: var(--sp-5); min-width: 0; }
.field > label, .field-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text); }
.field-label .opt, .field > label .opt { font-weight: var(--fw-regular); color: var(--text-muted); }
.field-help { font-size: var(--fs-sm); color: var(--text-muted); }
.field-error { display: flex; gap: 0.35rem; align-items: flex-start; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--danger); }
.field-error:empty { display: none; }
.field-error .icon { margin-block-start: 0.15em; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 var(--sp-4); }

.input, .select, .textarea {
  display: block; width: 100%;
  min-height: var(--control-h); padding: 0.7rem 0.95rem;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border-strong); border-radius: var(--r-md);
  font-family: var(--font-sans); font-size: var(--fs-md); /* 16px: no iOS zoom */ line-height: 1.35;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
:root[lang="ur"] .input, :root[lang="ur"] .select, :root[lang="ur"] .textarea { line-height: 1.9; padding-block: 0.45rem; }
.input::placeholder, .textarea::placeholder { color: var(--text-subtle); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-subtle); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-muted); color: var(--text-muted); cursor: not-allowed; }
.input[readonly] { background: var(--surface-2); }
.textarea { min-height: 120px; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-inline-end: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8079' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: right 0.85rem center;
}
[dir="rtl"] .select { background-position: left 0.85rem center; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea,
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.field.has-error .input:focus, .input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }

/* input with icon / addon (e.g. search, "Rs" prefix, show-password button) */
.input-group { position: relative; display: flex; align-items: stretch; }
.input-group > .input { flex: 1 1 auto; }
.input-group .input-icon { position: absolute; inset-block: 0; inset-inline-start: 0.9rem; display: flex; align-items: center; color: var(--text-muted); pointer-events: none; }
.input-group .input-icon ~ .input { padding-inline-start: 2.7rem; }
.input-group .input-addon {
  display: flex; align-items: center; padding-inline: 0.9rem; background: var(--surface-2); color: var(--text-muted);
  border: 1.5px solid var(--border-strong); font-weight: var(--fw-semibold);
}
.input-group .input-addon:first-child { border-inline-end: 0; border-start-start-radius: var(--r-md); border-end-start-radius: var(--r-md); }
.input-group .input-addon:first-child + .input { border-start-start-radius: 0; border-end-start-radius: 0; }
.input-group .input-addon:last-child { border-inline-start: 0; border-start-end-radius: var(--r-md); border-end-end-radius: var(--r-md); }
.input-group .input:has(+ .input-addon) { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .input-action { position: absolute; inset-block: 0; inset-inline-end: 0.25rem; margin-block: auto; height: var(--tap); }
.input-group .input-action ~ .input, .input-group .input:has(~ .input-action) { padding-inline-end: 3.2rem; }

/* checkbox & radio */
.check, .radio { display: flex; align-items: flex-start; gap: 0.7rem; min-height: var(--tap); padding-block: 0.6rem; cursor: pointer; font-size: var(--fs-md); line-height: 1.4; }
.check input, .radio input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0;
  width: 1.375rem; height: 1.375rem; border: 2px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; cursor: pointer;
  transition: background-color var(--dur-1), border-color var(--dur-1);
}
.check input { border-radius: var(--r-xs); }
.radio input { border-radius: 50%; }
.check input::after { content: ''; width: 0.4rem; height: 0.75rem; border: solid var(--on-primary); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); margin-block-start: -0.15rem; transition: transform var(--dur-1) var(--ease); }
.radio input::after { content: ''; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--on-primary); transform: scale(0); transition: transform var(--dur-1) var(--ease); }
.check input:checked, .radio input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { transform: rotate(45deg) scale(1); }
.radio input:checked::after { transform: scale(1); }
.check input:focus-visible, .radio input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.check .check-text small, .radio .check-text small { display: block; color: var(--text-muted); font-size: var(--fs-sm); }

/* choice cards: big radio/checkbox tiles (shipping speed, payment method) */
.choice { position: relative; display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1.5px solid var(--border); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; transition: border-color var(--dur-1), background-color var(--dur-1); }
.choice:hover { border-color: var(--border-strong); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input { appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0.15rem 0 0; width: 1.375rem; height: 1.375rem; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; }
.choice input[type="checkbox"] { border-radius: var(--r-xs); }
.choice input:checked { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.choice input:focus-visible { outline: none; }
.choice-title { display: block; font-weight: var(--fw-semibold); }
.choice-desc { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.choice-aside { margin-inline-start: auto; font-weight: var(--fw-semibold); white-space: nowrap; }
.choice-group { display: grid; gap: var(--sp-3); }

/* switch (toggle) — <label class="switch"><input type="checkbox" role="switch"><span>Label</span></label> */
.switch { display: inline-flex; align-items: center; gap: 0.75rem; min-height: var(--tap); cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0; position: relative;
  width: 3rem; height: 1.75rem; border-radius: var(--r-pill); background: var(--border-strong); cursor: pointer;
  transition: background-color var(--dur-2) var(--ease);
}
.switch input::after {
  content: ''; position: absolute; inset-block-start: 0.1875rem; inset-inline-start: 0.1875rem;
  width: 1.375rem; height: 1.375rem; border-radius: 50%; background: #fff; box-shadow: var(--sh-1);
  transition: transform var(--dur-2) var(--ease);
}
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(1.25rem); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-1.25rem); }
.switch input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* fieldset / form sections */
.form-section { border: 0; padding: 0; margin: 0 0 var(--sp-6); min-width: 0; }
.form-section > legend, .form-section-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); margin-block-end: var(--sp-1); padding: 0; }
.form-section-help { color: var(--text-muted); font-size: var(--fs-sm); margin-block-end: var(--sp-4); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; padding-block-start: var(--sp-4); border-block-start: 1px solid var(--divider); margin-block-start: var(--sp-2); }
.form-actions .btn:first-child { min-width: 9rem; }

/* photo upload dropzone + thumbnails with preview */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2); text-align: center;
  padding: var(--sp-7) var(--sp-5); border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-2); color: var(--text-muted); cursor: pointer;
  transition: border-color var(--dur-1), background-color var(--dur-1);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.dropzone .icon { width: 2.25rem; height: 2.25rem; color: var(--primary); }
.dropzone strong { color: var(--text); font-size: var(--fs-lg); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--sp-3); margin-block-start: var(--sp-3); }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface-muted); border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .thumb-remove { position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 32px; height: 32px; min-width: 32px; min-height: 32px; border-radius: 50%; border: 0; background: rgba(31, 22, 18, 0.72); color: #fff; display: grid; place-items: center; cursor: pointer; }
.thumb .thumb-badge { position: absolute; inset-block-end: 4px; inset-inline-start: 4px; font-size: var(--fs-2xs); font-weight: var(--fw-bold); background: rgba(31, 22, 18, 0.72); color: #fff; padding: 2px 8px; border-radius: var(--r-pill); }

/* ---------- 10. Cards ---------- */
.card {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: var(--sp-6);
}
.card-flush { padding: 0; overflow: hidden; }
.card-quiet { background: var(--surface-2); box-shadow: none; }
.card-link { display: block; color: inherit; text-decoration: none; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), border-color var(--dur-2); }
.card-link:hover { box-shadow: var(--sh-2); border-color: var(--border-strong); text-decoration: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-block-end: var(--sp-4); }
.card-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.card-sub { font-size: var(--fs-sm); color: var(--text-muted); }
.card-foot { margin-block-start: var(--sp-5); padding-block-start: var(--sp-4); border-block-start: 1px solid var(--divider); display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.card-hero { background: var(--hero-bg); color: var(--hero-text); border-color: transparent; }
.card-hero .card-sub, .card-hero .text-muted { color: var(--hero-muted); }
@media (max-width: 639.98px) { .card { padding: var(--sp-4); border-radius: var(--r-md); } }

/* definition list for "label: value" details */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--sp-2) var(--sp-5); margin: 0; }
.kv dt { color: var(--text-muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; font-weight: var(--fw-medium); min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 479.98px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-block-end: var(--sp-3); } }

/* list rows (settings lists, notifications, order items) */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-block-end: 1px solid var(--divider); min-height: 56px; }
.list-row:last-child { border-block-end: 0; }
.list-row-main { flex: 1 1 auto; min-width: 0; }
.list-row-title { font-weight: var(--fw-semibold); }
.list-row-sub { font-size: var(--fs-sm); color: var(--text-muted); }
a.list-row, button.list-row { width: 100%; background: none; border-inline: 0; border-block-start: 0; text-align: start; color: inherit; text-decoration: none; cursor: pointer; border-radius: 0; }
a.list-row:hover, button.list-row:hover { background: var(--surface-hover); }

/* ---------- 11. Badges & status pills ---------- */
.badge {
  --b-fg: var(--neutral); --b-bg: var(--neutral-soft); --b-bd: var(--neutral-line);
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.6rem; min-height: 1.5rem;
  border-radius: var(--r-pill); border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.3; white-space: nowrap; vertical-align: middle;
}
.badge .icon { width: 0.95rem; height: 0.95rem; stroke-width: 2.2; }
.badge-success { --b-fg: var(--success); --b-bg: var(--success-soft); --b-bd: var(--success-line); }
.badge-warning { --b-fg: var(--warning); --b-bg: var(--warning-soft); --b-bd: var(--warning-line); }
.badge-danger, .badge-error { --b-fg: var(--danger); --b-bg: var(--danger-soft); --b-bd: var(--danger-line); }
.badge-info { --b-fg: var(--info); --b-bg: var(--info-soft); --b-bd: var(--info-line); }
.badge-brand { --b-fg: var(--brand); --b-bg: var(--brand-soft); --b-bd: var(--brand-line); }
.badge-sale { --b-fg: #fff; --b-bg: var(--sale); --b-bd: var(--sale); }
:root[data-theme="dark"] .badge-sale { --b-fg: #1F1612; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-sale { --b-fg: #1F1612; } }
.badge-solid { --b-fg: var(--on-primary); --b-bg: var(--primary); --b-bd: var(--primary); }
.status { font-size: var(--fs-sm); padding: 0.2rem 0.7rem 0.2rem 0.55rem; min-height: 1.75rem; }
.status .icon { width: 1rem; height: 1rem; }
.count {
  display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem;
  border-radius: var(--r-pill); background: var(--danger); color: #fff;
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); line-height: 1; font-variant-numeric: tabular-nums;
}
:root[data-theme="dark"] .count { color: #1F1612; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .count { color: #1F1612; } }
.count-quiet { background: var(--surface-muted); color: var(--text-muted); }
.dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--danger); }

/* ---------- 12. Tabs · segmented control · chips ---------- */
.tabs { display: flex; gap: var(--sp-1); border-block-end: 1px solid var(--border); margin-block-end: var(--sp-5); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0.5rem 1rem; margin-block-end: -1px;
  background: none; border: 0; border-block-end: 3px solid transparent;
  color: var(--text-muted); font-weight: var(--fw-semibold); font-size: var(--fs-md); white-space: nowrap; cursor: pointer;
  transition: color var(--dur-1), border-color var(--dur-1);
}
.tab:hover { color: var(--text); }
.tab.active, .tab[aria-selected="true"] { color: var(--primary); border-block-end-color: var(--primary); }
.tab .count { background: var(--surface-muted); color: var(--text-muted); }
.tab.active .count, .tab[aria-selected="true"] .count { background: var(--primary); color: var(--on-primary); }

.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-muted); border-radius: var(--r-pill); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented button, .segmented a {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 38px; padding: 0.35rem 1rem; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text-muted); font-weight: var(--fw-semibold); font-size: var(--fs-sm);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1);
}
.segmented button:hover { color: var(--text); }
.segmented [aria-pressed="true"], .segmented [aria-selected="true"], .segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.segmented-block { display: flex; }
.segmented-block > * { flex: 1 1 0; }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block-end: 2px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 40px; padding: 0.35rem 0.95rem;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.chip:hover { border-color: var(--primary); text-decoration: none; }
.chip[aria-pressed="true"], .chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip .chip-x { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin-inline-end: -0.35rem; border-radius: 50%; }
.chip .chip-x:hover { background: var(--surface-pressed); }
@media (pointer: coarse) { .chip { min-height: var(--tap); } .segmented button, .segmented a { min-height: 40px; } .segmented { padding: 2px; } }

/* ---------- 13. Steps (progress) · quantity stepper ---------- */
.steps { display: flex; list-style: none; margin: 0 0 var(--sp-6); padding: 0; counter-reset: step; gap: var(--sp-2); }
.steps li { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; position: relative; color: var(--text-muted); font-size: var(--fs-sm); font-weight: var(--fw-medium); min-width: 0; }
.steps li::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-muted);
  font-weight: var(--fw-bold); position: relative; z-index: 1; font-variant-numeric: tabular-nums;
}
.steps li::after { content: ''; position: absolute; inset-block-start: 1.075rem; inset-inline-start: calc(50% + 1.4rem); width: calc(100% - 2.8rem + var(--sp-2)); height: 2px; background: var(--border-strong); }
.steps li:last-child::after { display: none; }
.steps li.is-done::before { content: '✓'; background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.steps li.is-done::after { background: var(--primary); }
.steps li.is-current { color: var(--text); font-weight: var(--fw-bold); }
.steps li.is-current::before { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
@media (max-width: 479.98px) { .steps li .step-label { display: none; } .steps li.is-current .step-label { display: block; position: absolute; inset-block-start: 2.6rem; white-space: nowrap; } .steps { margin-block-end: var(--sp-8); } }

.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border-strong); border-radius: var(--r-pill); background: var(--surface); }
.stepper button { width: var(--tap); height: var(--tap); border: 0; background: none; color: var(--primary); cursor: pointer; display: grid; place-items: center; border-radius: 50%; }
.stepper button:hover { background: var(--surface-hover); }
.stepper button:disabled { color: var(--text-subtle); cursor: not-allowed; background: none; }
.stepper input, .stepper output { width: 2.75rem; border: 0; background: none; text-align: center; font-weight: var(--fw-bold); font-size: var(--fs-md); font-variant-numeric: tabular-nums; -moz-appearance: textfield; padding: 0; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }

/* ---------- 14. Dialogs: modal · drawer · sheet (native <dialog>, built by UI.modal) ---------- */
.dialog {
  padding: 0; border: 0; background: transparent; color: var(--text);
  max-width: none; max-height: none; overflow: visible;
}
.dialog::backdrop { background: var(--overlay); animation: ui-fade var(--dur-2) var(--ease); }
.dialog-panel {
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border-radius: var(--r-xl); box-shadow: var(--sh-4);
  width: min(560px, calc(100vw - 2rem)); max-height: min(88vh, 860px); max-height: min(88dvh, 860px);
  animation: ui-pop var(--dur-3) var(--ease);
  overflow: hidden;
}
.dialog-sm .dialog-panel { width: min(420px, calc(100vw - 2rem)); }
.dialog-lg .dialog-panel { width: min(860px, calc(100vw - 2rem)); }
.dialog-xl .dialog-panel { width: min(1100px, calc(100vw - 2rem)); }
.dialog-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6) var(--sp-3); }
.dialog-title { flex: 1 1 auto; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-medium); line-height: var(--lh-snug); margin-block-start: 0.35rem; }
.dialog-head .btn-icon { margin-inline-end: -0.5rem; margin-block-start: -0.15rem; color: var(--text-muted); }
.dialog-body { padding: var(--sp-2) var(--sp-6) var(--sp-5); overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.dialog-body > p + p { margin-block-start: var(--sp-3); }
.dialog-foot { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-6) var(--sp-5); border-block-start: 1px solid var(--divider); background: var(--surface); }
.dialog-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); margin-block-end: var(--sp-3); }
.dialog-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.dialog-confirm .dialog-head { flex-direction: column; align-items: center; text-align: center; padding-block-start: var(--sp-7); position: relative; }
.dialog-confirm .dialog-head .dialog-icon { margin: 0; }
.dialog-confirm .dialog-head .btn-icon { position: absolute; inset-block-start: var(--sp-3); inset-inline-end: var(--sp-3); margin: 0; }
.dialog-confirm .dialog-title { margin-block-start: var(--sp-2); }
.dialog-confirm .dialog-body { text-align: center; padding-block-end: var(--sp-4); }
.dialog-confirm .dialog-body:empty { display: none; }
.dialog-confirm .dialog-foot { border-block-start: 0; justify-content: center; padding-block-start: var(--sp-2); }
.dialog-confirm .dialog-foot .btn { flex: 1 1 0; }
.dialog.is-closing .dialog-panel { animation: ui-pop-out var(--dur-2) var(--ease-in) forwards; }
.dialog.is-closing::backdrop { animation: ui-fade-out var(--dur-2) var(--ease-in) forwards; }

/* drawer: slides from the inline-end edge */
.dialog-drawer { margin: 0; margin-inline-start: auto; height: 100%; max-height: 100%; }
.dialog-drawer .dialog-panel { width: min(460px, 100vw); height: 100vh; height: 100dvh; max-height: none; border-radius: 0; border-start-start-radius: var(--r-xl); border-end-start-radius: var(--r-xl); animation-name: ui-drawer-in; }
[dir="rtl"] .dialog-drawer .dialog-panel { animation-name: ui-drawer-in-rtl; }
.dialog-drawer.is-closing .dialog-panel { animation: ui-drawer-out var(--dur-2) var(--ease-in) forwards; }
[dir="rtl"] .dialog-drawer.is-closing .dialog-panel { animation-name: ui-drawer-out-rtl; }

/* sheet: from the bottom (also what every modal becomes on phones) */
.dialog-sheet { margin: auto 0 0; width: 100%; max-width: 100%; }
.dialog-sheet .dialog-panel, .dialog-sheet.dialog-sm .dialog-panel, .dialog-sheet.dialog-lg .dialog-panel { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation-name: ui-sheet-in; padding-block-end: env(safe-area-inset-bottom); }
.dialog-sheet .dialog-panel::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 10px auto 0; flex-shrink: 0; }
.dialog-sheet.is-closing .dialog-panel { animation: ui-sheet-out var(--dur-2) var(--ease-in) forwards; }
@media (max-width: 639.98px) {
  .dialog:not(.dialog-drawer):not(.dialog-center) { margin: auto 0 0; width: 100%; max-width: 100%; }
  .dialog:not(.dialog-drawer):not(.dialog-center) .dialog-panel { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation-name: ui-sheet-in; padding-block-end: env(safe-area-inset-bottom); }
  .dialog:not(.dialog-drawer):not(.dialog-center).is-closing .dialog-panel { animation-name: ui-sheet-out; }
  .dialog-head { padding: var(--sp-4) var(--sp-4) var(--sp-2); }
  .dialog-body { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
  .dialog-foot { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
  .dialog-foot .btn { flex: 1 1 auto; }
}
@keyframes ui-fade { from { opacity: 0; } }
@keyframes ui-fade-out { to { opacity: 0; } }
@keyframes ui-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes ui-pop-out { to { opacity: 0; transform: translateY(6px) scale(0.98); } }
@keyframes ui-sheet-in { from { transform: translateY(100%); } }
@keyframes ui-sheet-out { to { transform: translateY(100%); } }
@keyframes ui-drawer-in { from { transform: translateX(100%); } }
@keyframes ui-drawer-out { to { transform: translateX(100%); } }
@keyframes ui-drawer-in-rtl { from { transform: translateX(-100%); } }
@keyframes ui-drawer-out-rtl { to { transform: translateX(-100%); } }

/* popover / dropdown menu (anchored with .pop-anchor { position: relative }) */
.pop-anchor { position: relative; }
.popover {
  position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0; z-index: var(--z-popover);
  min-width: 240px; max-width: min(380px, calc(100vw - 1rem));
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-3);
  padding: var(--sp-2); animation: ui-pop var(--dur-2) var(--ease);
}
.popover-start { inset-inline-end: auto; inset-inline-start: 0; }
.menu-item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  min-height: var(--tap); padding: 0.5rem 0.75rem; border: 0; border-radius: var(--r-md);
  background: none; color: var(--text); font-size: var(--fs-md); font-weight: var(--fw-medium); text-align: start; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); text-decoration: none; }
.menu-item .icon { color: var(--text-muted); }
.menu-item.is-danger, .menu-item.is-danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--divider); margin: var(--sp-2) calc(-1 * var(--sp-2)); }
.menu-label { padding: var(--sp-2) 0.75rem var(--sp-1); font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }

/* tooltip (CSS only): <span class="tip" data-tip="…"> */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; inset-block-end: calc(100% + 6px); inset-inline-start: 50%; transform: translateX(-50%);
  background: var(--c-espresso); color: var(--c-cream); font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: 1.4;
  padding: 0.35rem 0.6rem; border-radius: var(--r-sm); white-space: nowrap; z-index: var(--z-popover); pointer-events: none;
}
[dir="rtl"] [data-tip]:hover::after, [dir="rtl"] [data-tip]:focus-visible::after { transform: translateX(50%); }

/* ---------- 15. Toasts (UI.toast) ---------- */
.toast-region {
  position: fixed; z-index: var(--z-toast);
  inset-block-start: var(--sp-4); inset-inline-end: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-end;
  width: min(420px, calc(100vw - 2rem)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: var(--sp-3); width: 100%;
  padding: 0.85rem 0.9rem 0.85rem 1rem; border-radius: var(--r-lg);
  background: var(--c-espresso); color: #F5F1EB; box-shadow: var(--sh-3);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.45;
  animation: ui-toast-in var(--dur-3) var(--ease);
}
:root[data-theme="dark"] .toast { background: #3A2E26; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #3A2E26; } }
.toast-icon { flex-shrink: 0; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.toast-icon .icon { width: 1rem; height: 1rem; stroke-width: 2.4; }
.toast-success .toast-icon { background: #2E7D4F; color: #fff; }
.toast-error .toast-icon { background: #C4392F; color: #fff; }
.toast-warning .toast-icon { background: #B87412; color: #fff; }
.toast-info .toast-icon { background: #3C6E9C; color: #fff; }
.toast-body { flex: 1 1 auto; min-width: 0; padding-block-start: 0.15rem; }
.toast-title { font-weight: var(--fw-bold); }
.toast-action { background: none; border: 0; color: #E9D5BF; font-weight: var(--fw-bold); cursor: pointer; padding: 0.25rem 0.5rem; min-height: 32px; border-radius: var(--r-sm); text-decoration: underline; }
.toast-close { flex-shrink: 0; background: none; border: 0; color: rgba(245, 241, 235, 0.7); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; margin: -0.2rem -0.2rem 0 0; }
.toast-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.toast.is-leaving { animation: ui-toast-out var(--dur-2) var(--ease-in) forwards; }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
@keyframes ui-toast-out { to { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 767.98px) {
  .toast-region { inset-block-start: auto; inset-block-end: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom) + var(--sp-3)); inset-inline: var(--sp-3); width: auto; align-items: stretch; }
  @keyframes ui-toast-in { from { opacity: 0; transform: translateY(10px); } }
}

/* ---------- 16. Empty · error · loading states ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-2);
  padding: var(--sp-9) var(--sp-5); max-width: 460px; margin-inline: auto;
}
.empty-state-icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); margin-block-end: var(--sp-2); }
.empty-state-icon .icon { width: 2rem; height: 2rem; stroke-width: 1.5; }
.empty-state.is-error .empty-state-icon { background: var(--danger-soft); color: var(--danger); }
.empty-state-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: var(--fw-medium); }
.empty-state-body { color: var(--text-muted); }
.empty-state .btn { margin-block-start: var(--sp-3); }
.empty-state-compact { padding: var(--sp-6) var(--sp-4); }
.empty-state-compact .empty-state-icon { width: 3rem; height: 3rem; }
.empty-state-compact .empty-state-icon .icon { width: 1.4rem; height: 1.4rem; }
.empty-state-compact .empty-state-title { font-family: var(--font-sans); font-size: var(--fs-md); font-weight: var(--fw-semibold); }

/* skeletons (UI.skeleton) — shimmer is disabled by reduced motion */
.skel { position: relative; overflow: hidden; background: var(--surface-muted); border-radius: var(--r-sm); }
.skel::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: ui-shimmer 1.4s ease-in-out infinite;
}
:root[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent); } }
[dir="rtl"] .skel::after { animation-name: ui-shimmer-rtl; }
@keyframes ui-shimmer { to { transform: translateX(100%); } }
@keyframes ui-shimmer-rtl { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
.skel-text { height: 0.9rem; margin-block: 0.45rem; }
.skel-text.w-40 { width: 40%; } .skel-text.w-60 { width: 60%; } .skel-text.w-80 { width: 80%; }
.skel-title { height: 1.4rem; width: 45%; margin-block-end: var(--sp-3); }
.skel-circle { border-radius: 50%; }
.skel-block { height: 120px; border-radius: var(--r-md); }
.skel-img { aspect-ratio: 3 / 4; border-radius: var(--r-md); }
.skel-row { display: flex; gap: var(--sp-3); align-items: center; padding-block: var(--sp-3); border-block-end: 1px solid var(--divider); }
.skel-row .skel-circle { width: 44px; height: 44px; flex-shrink: 0; }
.skel-row .grow { display: flex; flex-direction: column; }
.loading-inline { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text-muted); }
.loading-inline .spinner { width: 1rem; height: 1rem; border-width: 2px; }
.is-busy { opacity: 0.6; pointer-events: none; transition: opacity var(--dur-2); }

/* ---------- 17. Avatar ---------- */
.avatar {
  --av: 40px;
  display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden;
  width: var(--av); height: var(--av); border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-weight: var(--fw-bold); font-size: calc(var(--av) * 0.4); line-height: 1; text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --av: 32px; } .avatar-lg { --av: 56px; } .avatar-xl { --av: 80px; }
.avatar-square { border-radius: var(--r-md); }

/* ---------- 18. Data table → stacked cards on phones (UI.table) ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
.table th {
  text-align: start; font-weight: var(--fw-semibold); color: var(--text-muted); font-size: var(--fs-xs);
  padding: 0.75rem 1rem; background: var(--surface-2); border-block-end: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 0.85rem 1rem; border-block-end: 1px solid var(--divider); vertical-align: middle; }
.table tbody tr:last-child td { border-block-end: 0; }
.table tbody tr { transition: background-color var(--dur-1); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tr.is-clickable { cursor: pointer; }
.table .col-num, .table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table .col-actions { text-align: end; white-space: nowrap; }
.table .cell-main { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.table .cell-main img { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-muted); flex-shrink: 0; }
.table .cell-title { font-weight: var(--fw-semibold); font-size: var(--fs-md); color: var(--text); }
.table .cell-sub { color: var(--text-muted); font-size: var(--fs-xs); }
@media (max-width: 767.98px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tbody { display: grid; gap: var(--sp-3); }
  .table-stack tr { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: var(--sp-2) var(--sp-4); box-shadow: var(--sh-1); }
  .table-stack tbody tr:hover { background: var(--surface); }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); padding: 0.55rem 0; border-block-end: 1px solid var(--divider); text-align: end; min-height: 44px; }
  .table-stack td:last-child { border-block-end: 0; }
  .table-stack td::before { content: attr(data-label); color: var(--text-muted); font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-align: start; flex-shrink: 0; }
  .table-stack td.cell-primary { display: block; text-align: start; padding-block: var(--sp-2); }
  .table-stack td.cell-primary::before { display: none; }
  .table-stack td.col-actions { justify-content: flex-end; flex-wrap: wrap; }
  .table-stack td.col-actions::before { display: none; }
  .table-stack td.hide-stacked { display: none; }
  .table-wrap:has(.table-stack) { overflow: visible; }
}

/* ---------- 19. Pagination (UI.pagination) ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); margin-block-start: var(--sp-5); }
.pagination-info { font-size: var(--fs-sm); color: var(--text-muted); }
.pagination-pages { display: flex; align-items: center; gap: var(--sp-1); }
.pagination-pages button {
  min-width: var(--tap); height: var(--tap); padding: 0 0.6rem; border-radius: var(--r-pill);
  border: 1px solid transparent; background: none; color: var(--text); font-weight: var(--fw-semibold); cursor: pointer; font-variant-numeric: tabular-nums;
  display: inline-grid; place-items: center;
}
.pagination-pages button:hover:not(:disabled) { background: var(--surface-hover); }
.pagination-pages button[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.pagination-pages button:disabled { color: var(--text-subtle); cursor: not-allowed; }
.pagination-gap { padding-inline: var(--sp-1); color: var(--text-subtle); }
@media (max-width: 479.98px) { .pagination { justify-content: center; } .pagination-pages .pg-num:not([aria-current="page"]) { display: none; } .pagination-gap { display: none; } }

/* ---------- 20. Stat card + sparkline (UI.statCard) ---------- */
.stat-card {
  display: flex; flex-direction: column; gap: var(--sp-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  padding: var(--sp-5); color: var(--text); text-decoration: none; min-width: 0; position: relative;
  transition: box-shadow var(--dur-2) var(--ease), border-color var(--dur-2);
}
a.stat-card:hover { box-shadow: var(--sh-2); border-color: var(--border-strong); text-decoration: none; }
.stat-card-top { display: flex; align-items: center; gap: var(--sp-3); }
.stat-card-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--r-md); background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.stat-card-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-muted); line-height: 1.3; }
.stat-card-value-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.stat-card-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.stat-card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); margin-block-start: auto; }
.stat-card-caption { font-size: var(--fs-sm); color: var(--text-muted); }
.stat-card-spark { flex-shrink: 0; color: var(--primary); }
a.stat-card .stat-card-top { padding-inline-end: 1.25rem; }
.stat-card .chev { position: absolute; inset-block-start: var(--sp-5); inset-inline-end: var(--sp-4); color: var(--text-subtle); }
.delta { display: inline-flex; align-items: center; gap: 0.2rem; font-size: var(--fs-xs); font-weight: var(--fw-bold); padding: 0.1rem 0.45rem; border-radius: var(--r-pill); }
.delta-up { color: var(--success); background: var(--success-soft); }
.delta-down { color: var(--danger); background: var(--danger-soft); }
.sparkline { display: block; overflow: visible; }
.sparkline polyline { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sparkline .spark-area { fill: currentColor; opacity: 0.1; stroke: none; }
[dir="rtl"] .sparkline { transform: scaleX(-1); }
.stat-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-block-end: var(--sp-6); }
@media (max-width: 479.98px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); } .stat-card { padding: var(--sp-4); } .stat-card-value { font-size: var(--fs-xl); } .stat-card-spark { display: none; } }

/* ---------- 21. Product card (UI.productCard) ---------- */
.product-grid { display: grid; gap: var(--sp-5) var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
@media (max-width: 639.98px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-3); } }
.product-card { position: relative; display: flex; flex-direction: column; min-width: 0; color: var(--text); text-decoration: none; }
.product-card:hover { text-decoration: none; }
.pc-media { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-muted); }
.pc-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--dur-3) var(--ease); }
.product-card:hover .pc-media img { transform: scale(1.03); }
.pc-badges { position: absolute; inset-block-start: var(--sp-2); inset-inline-start: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-1); align-items: flex-start; }
.pc-fav {
  position: absolute; inset-block-start: var(--sp-2); inset-inline-end: var(--sp-2);
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.92); color: #3D2C1E; display: grid; place-items: center; box-shadow: var(--sh-1);
  transition: transform var(--dur-1) var(--ease);
}
.pc-fav:hover { transform: scale(1.06); }
.pc-fav[aria-pressed="true"] { color: #B3261E; }
.pc-fav[aria-pressed="true"] .icon { fill: currentColor; }
.pc-body { padding: var(--sp-3) var(--sp-1) 0; display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.pc-store { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); }
.pc-name { font-size: var(--fs-md); font-weight: var(--fw-medium); line-height: 1.35; color: var(--text); }
.pc-name a { color: inherit; text-decoration: none; }
.pc-name a::after { content: ''; position: absolute; inset: 0; border-radius: var(--r-lg); } /* whole card is the link */
.pc-name a:focus-visible { outline: none; }
.product-card:has(.pc-name a:focus-visible) .pc-media { outline: 3px solid var(--focus); outline-offset: 2px; }
.pc-fav, .pc-badges { z-index: 1; }
.price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--sp-2); font-variant-numeric: tabular-nums; }
.price-now { font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--text); }
.price-now.is-sale { color: var(--sale); }
.price-was { font-size: var(--fs-sm); color: var(--text-muted); text-decoration: line-through; }
.price-lg .price-now { font-size: var(--fs-2xl); }
.pc-meta { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }
.pc-oos .pc-media img { filter: grayscale(0.6); opacity: 0.7; }
img.is-broken { opacity: 0; }
.img-fallback { background: var(--surface-muted) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238C8079' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-5-5L5 21'/%3E%3C/svg%3E") center / 32px no-repeat; }

/* ---------- 22. Image gallery (UI.gallery) ---------- */
.gallery { display: grid; gap: var(--sp-3); }
.gallery-main { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-muted); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-nav { position: absolute; inset-block: 0; margin-block: auto; width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.9); color: #3D2C1E; display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh-2); }
.gallery-prev { inset-inline-start: var(--sp-3); }
.gallery-next { inset-inline-end: var(--sp-3); }
.gallery-count { position: absolute; inset-block-end: var(--sp-3); inset-inline-end: var(--sp-3); background: rgba(31, 22, 18, 0.7); color: #fff; font-size: var(--fs-xs); font-weight: var(--fw-semibold); padding: 0.2rem 0.6rem; border-radius: var(--r-pill); font-variant-numeric: tabular-nums; }
.gallery-thumbs { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; padding: 3px; }
.gallery-thumbs button { flex: 0 0 64px; height: 80px; padding: 0; border: 2px solid transparent; border-radius: var(--r-md); overflow: hidden; background: var(--surface-muted); cursor: pointer; opacity: 0.7; }
.gallery-thumbs button[aria-current="true"] { border-color: var(--primary); opacity: 1; }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 23. Rating stars (UI.stars) ---------- */
.stars { --rating: 0; --star-size: 1.05rem; display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.stars-track { position: relative; display: inline-block; width: calc(var(--star-size) * 5); height: var(--star-size); flex-shrink: 0;
  background: var(--border-strong);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") 0 0 / var(--star-size) var(--star-size) repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m12 2.5 2.9 6 6.6.9-4.8 4.6 1.2 6.5L12 17.4l-5.9 3.1 1.2-6.5L2.5 9.4l6.6-.9z'/%3E%3C/svg%3E") 0 0 / var(--star-size) var(--star-size) repeat-x;
}
.stars-track::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: calc(var(--rating) / 5 * 100%); background: var(--star); }
.stars-lg { --star-size: 1.4rem; font-size: var(--fs-md); }
.stars-value { font-weight: var(--fw-bold); color: var(--text); }
/* star input: <fieldset class="star-input"> radios 5..1 (UI.starInput) */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; border: 0; padding: 0; margin: 0; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { cursor: pointer; width: var(--tap); height: var(--tap); display: grid; place-items: center; color: var(--border-strong); }
.star-input label .icon { width: 2rem; height: 2rem; fill: currentColor; stroke: none; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--star); }
.star-input input:focus-visible + label { outline: 3px solid var(--focus); border-radius: var(--r-sm); }

/* ---------- 24. Timeline (order tracking — UI.timeline) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; display: flex; gap: var(--sp-4); padding-block-end: var(--sp-5); }
.timeline-item:last-child { padding-block-end: 0; }
.timeline-item::before { content: ''; position: absolute; inset-inline-start: 1.125rem; inset-block-start: 2.5rem; inset-block-end: 0.25rem; width: 2px; background: var(--border-strong); transform: translateX(-50%); }
[dir="rtl"] .timeline-item::before { transform: translateX(50%); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; flex-shrink: 0; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-subtle); }
.timeline-dot .icon { width: 1.05rem; height: 1.05rem; stroke-width: 2; }
.timeline-item.is-done .timeline-dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.timeline-item.is-done::before { background: var(--primary); }
.timeline-item.is-current .timeline-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); }
.timeline-item.is-problem .timeline-dot { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.timeline-content { padding-block-start: 0.35rem; min-width: 0; }
.timeline-title { font-weight: var(--fw-semibold); }
.timeline-item:not(.is-done):not(.is-current):not(.is-problem) .timeline-title { color: var(--text-muted); font-weight: var(--fw-medium); }
.timeline-meta { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- 25. Alerts / banners ---------- */
.alert {
  --a-fg: var(--info); --a-bg: var(--info-soft); --a-bd: var(--info-line);
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4); border-radius: var(--r-lg); border: 1px solid var(--a-bd);
  background: var(--a-bg); color: var(--text); font-size: var(--fs-sm); line-height: 1.5;
}
.alert > .icon { color: var(--a-fg); width: 1.4rem; height: 1.4rem; margin-block-start: 0.05rem; }
.alert-body { flex: 1 1 auto; min-width: 0; }
.alert-title { font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--text); margin-block-end: 0.15rem; }
.alert-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-block-start: var(--sp-3); }
.alert-success { --a-fg: var(--success); --a-bg: var(--success-soft); --a-bd: var(--success-line); }
.alert-warning { --a-fg: var(--warning); --a-bg: var(--warning-soft); --a-bd: var(--warning-line); }
.alert-danger, .alert-error { --a-fg: var(--danger); --a-bg: var(--danger-soft); --a-bd: var(--danger-line); }
.alert-brand { --a-fg: var(--brand); --a-bg: var(--brand-soft); --a-bd: var(--brand-line); }
.alert + .alert { margin-block-start: var(--sp-3); }
.banner-offline {
  position: fixed; inset-inline: 0; inset-block-start: 0; z-index: var(--z-banner);
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0.6rem var(--sp-4); background: var(--c-espresso); color: #F5F1EB; font-size: var(--fs-sm); font-weight: var(--fw-semibold); text-align: center;
  animation: ui-fade var(--dur-2);
}
.banner-offline .icon { color: #E8B45F; }

/* ---------- 26. Page header & section header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-4) var(--sp-6); margin-block-end: var(--sp-6); }
.page-header-text { min-width: 0; flex: 1 1 320px; }
.page-header .eyebrow { margin-block-end: var(--sp-2); }
.page-title { font-family: var(--font-display); font-size: clamp(1.75rem, 1.35rem + 1.5vw, 2.5rem); font-weight: var(--fw-medium); line-height: var(--lh-tight); letter-spacing: -0.01em; }
:root[lang="ur"] .page-title { letter-spacing: 0; }
.page-subtitle { margin-block-start: var(--sp-2); color: var(--text-muted); font-size: var(--fs-md); max-width: 62ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.page-back { display: inline-flex; align-items: center; gap: var(--sp-1); margin-block-end: var(--sp-3); font-weight: var(--fw-semibold); text-decoration: none; min-height: var(--tap); }
@media (max-width: 639.98px) { .page-header { margin-block-end: var(--sp-5); } .page-actions { width: 100%; } .page-actions .btn { flex: 1 1 auto; } }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-block: var(--sp-7) var(--sp-4); }
.section-head:first-child { margin-block-start: 0; }
.section-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); }
.section-head a { font-weight: var(--fw-semibold); text-decoration: none; display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); }

/* editorial hero block (espresso) used by greetings, landing, onboarding */
.hero-block { position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--hero-bg); color: var(--hero-text); padding: var(--sp-8) var(--sp-7); }
.hero-block .eyebrow { color: var(--hero-accent); }
.hero-block .h1, .hero-block .page-title { color: var(--hero-text); }
.hero-block p { color: var(--hero-muted); }
@media (max-width: 639.98px) { .hero-block { padding: var(--sp-6) var(--sp-5); border-radius: var(--r-lg); } }

/* progress bar */
.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-muted); overflow: hidden; }
.progress > span { display: block; height: 100%; width: var(--value, 0%); background: var(--primary); border-radius: inherit; transition: width var(--dur-3) var(--ease); }

/* scrollbars */
* { scrollbar-color: var(--border-strong) transparent; }

/* ---------- Policy links (UI.policyLinks / data-policy-links) ---------- */
.policy-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 var(--sp-2); }
.policy-links li { display: inline-flex; align-items: center; }
.policy-links li + li::before { content: "·"; margin-inline-end: var(--sp-2); color: var(--text-muted); opacity: 0.7; }
.policy-links a { display: inline-flex; align-items: center; min-height: 32px; color: inherit; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.policy-links a:hover { text-decoration-color: currentColor; }
.policy-note { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.6; }
.policy-note a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
:root[lang="ur"] .policy-note { line-height: 1.9; }
