/* Pamir AI R54-A — canonical UI foundation, no visual redesign.
   Values are copied from the approved R53 CSS. Existing component-specific
   tokens stay scoped to their current surfaces. All lengths are CSS px.
   --ds-* is the API for new code; legacy --ink, --p-* and --admin-* remain
   compatibility contracts. Do not set these tokens in unrelated packages. */
:root {
  /* Typography — Latin uses the same locally bundled family as RTL scripts. */
  --ds-font-ui: "Vazirmatn", Tahoma, sans-serif;
  --ds-font-size-base: 14px;

  /* 4px primitive scale / 8px spacing rhythm. Existing non-grid exceptions
     in R53 remain intentional and are not normalized by this patch. */
  --ds-space-0: 0px;
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-8: 32px;
  --ds-space-10: 40px;
  --ds-space-12: 48px;

  --ds-radius-sm: 8px;
  --ds-radius-md: 12px;
  --ds-radius-lg: 16px;
  --ds-radius-xl: 20px;
  --ds-radius-pill: 999px;

  --ds-motion-fast: 150ms;
  --ds-motion-medium: 180ms;
  --ds-motion-ease: ease;
  --ds-focus-width: 3px;
  --ds-focus-offset: 4px;
  --ds-control-min: 44px;
  --ds-control-prominent: 52px;

  /* Previously approved navigation geometry, not a new responsive breakpoint. */
  --ds-nav-width-open: 276px;
  --ds-nav-width-closed: 72px;
  --ds-nav-width-mobile: min(310px, 88vw);

  /* Authenticated UI: R53 light palette, with R57-B1 muted-text contrast adjustment. */
  --ds-color-deep: #01585b;
  --ds-color-core: #027b78;
  --ds-color-bright: #05a296;
  --ds-color-mint: #3ac9a7;
  --ds-color-soft: #96e1ca;
  --ds-color-ink: #172b29;
  --ds-color-muted: #566a62;
  --ds-color-bg: #fcfdfb;
  --ds-color-sidebar: #f1f5f2;
  --ds-color-panel: #fff;
  --ds-color-subtle: #f6f8f5;
  --ds-color-border: #e2e9e3;
  --ds-color-hover: #e6efea;
  --ds-color-selected: #dcebe3;
  --ds-color-danger: #ab4038;
  --ds-color-accent-ink: #01585b;
  --ds-shadow-panel: 0 16px 50px #1b49300b;

  /* Guest + ordinary user recovery: their separate approved palette.
     Explicit light/dark names preserve .auth-dark / .pr-dark independence
     from the root data-theme attribute and from administrator scopes. */
  --ds-guest-light-bg: #fbfdfa;
  --ds-guest-light-panel: #fff;
  --ds-guest-light-text: #16312c;
  --ds-guest-light-muted: #596d65;
  --ds-guest-light-border: #dfe8e2;
  --ds-guest-light-soft: #f0f6f1;
  --ds-guest-light-accent: #087f78;
  --ds-guest-dark-bg: #181a1f;
  --ds-guest-dark-panel: #262930;
  --ds-guest-dark-text: #f2f4f5;
  --ds-guest-dark-muted: #b8bec8;
  --ds-guest-dark-border: #3c424b;
  --ds-guest-dark-soft: #202329;
  --ds-guest-dark-accent: #63d3c5;
}

/* Works when the theme marker is on html or an isolated subtree. */
[data-theme="dark"] {
  --ds-color-ink: #f2f4f5;
  --ds-color-muted: #b8bec8;
  --ds-color-bg: #181a1f;
  --ds-color-sidebar: #202329;
  --ds-color-panel: #262930;
  --ds-color-subtle: #292d33;
  --ds-color-border: #3c424b;
  --ds-color-hover: #303640;
  --ds-color-selected: #2c3c3e;
  --ds-color-deep: #63d3c5;
  --ds-color-core: #63d3c5;
  --ds-color-danger: #ffaaa4;
  --ds-color-accent-ink: #63d3c5;
  --ds-shadow-panel: 0 16px 50px #00000028;
}
