/* Platform — shared design tokens (admin + client)
   Theme v2 «آبی‌راگا» — modern data-dense palette: indigo primary, cool neutrals,
   layered soft shadows, tinted dark mode, chart color scale.
   Var names are stable API — every component/page inherits automatically. */
:root,
[data-theme='dark'] {
  color-scheme: dark;

  --font: 'Vazirmatn', system-ui, sans-serif;

  /* cool navy-tinted dark neutrals */
  --bg: oklch(0.15 0.014 264);
  --bg-elevated: oklch(0.205 0.016 264);
  --surface: oklch(0.205 0.016 264);
  --surface-2: oklch(0.262 0.018 264);
  --surface-3: oklch(0.315 0.02 264);
  --border: oklch(0.92 0.02 264 / 11%);
  --border-strong: oklch(0.92 0.02 264 / 19%);

  --text: oklch(0.975 0.005 264);
  --text-secondary: oklch(0.79 0.012 264);
  --muted: oklch(0.705 0.015 264);

  /* indigo primary */
  --accent: oklch(0.585 0.21 277);
  --accent-hover: oklch(0.64 0.19 277);
  --accent-muted: oklch(0.585 0.21 277 / 0.16);
  --accent-glow: 0 0 24px oklch(0.585 0.21 277 / 0.22);
  --btn-on-accent: oklch(0.985 0.005 264);

  --ring: oklch(0.585 0.21 277);

  --sidebar-bg: oklch(0.182 0.015 264);

  --cyan: #22d3ee;
  --success: oklch(0.72 0.17 162);
  --success-muted: oklch(0.72 0.17 162 / 0.15);
  --danger: oklch(0.7 0.19 22);
  --danger-muted: oklch(0.7 0.19 22 / 0.15);
  --warning: oklch(0.78 0.15 75);
  --warning-muted: oklch(0.78 0.15 75 / 0.15);
  --info: oklch(0.68 0.16 240);

  /* chart scale (categorical) */
  --chart-1: oklch(0.64 0.2 277);
  --chart-2: oklch(0.74 0.13 215);
  --chart-3: oklch(0.72 0.17 162);
  --chart-4: oklch(0.8 0.15 80);
  --chart-5: oklch(0.68 0.19 15);
  --chart-6: oklch(0.66 0.19 320);

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-2xs: 0 1px 2px 0 oklch(0 0 0 / 0.22);
  --shadow-sm: 0 1px 2px 0 oklch(0 0 0 / 0.28), 0 2px 8px -2px oklch(0 0 0 / 0.22);
  --shadow: 0 6px 20px -6px oklch(0 0 0 / 0.45);
  --shadow-lg: 0 16px 48px -12px oklch(0 0 0 / 0.55);
  --shadow-glow: var(--accent-glow);

  --grad-accent: linear-gradient(135deg, oklch(0.585 0.21 277), oklch(0.62 0.2 300));

  --sidebar-w: 16rem;
  --transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  --focus-ring: 0 0 0 3px oklch(0.585 0.21 277 / 0.35);

  /* auth brand panel (always dark) */
  --auth-aside-from: oklch(0.24 0.05 277);
  --auth-aside-to: oklch(0.15 0.03 277);
  --auth-gradient-1: oklch(0.62 0.2 277 / 0.14);
  --auth-gradient-2: oklch(0.66 0.19 320 / 0.08);
  --glass-bg: oklch(0.205 0.016 264 / 0.82);
  --row-hover: oklch(0.62 0.2 277 / 0.07);
  --row-divider: oklch(1 0 0 / 0.06);
}

[data-theme='light'] {
  color-scheme: light;

  /* cool near-white neutrals */
  --bg: oklch(0.977 0.004 264);
  --bg-elevated: oklch(1 0 0);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.962 0.006 264);
  --surface-3: oklch(0.934 0.009 264);
  --border: oklch(0.905 0.009 264);
  --border-strong: oklch(0.855 0.012 264);

  --text: oklch(0.215 0.03 266);
  --text-secondary: oklch(0.42 0.024 266);
  --muted: oklch(0.545 0.02 266);

  /* indigo primary */
  --accent: oklch(0.5 0.21 277);
  --accent-hover: oklch(0.44 0.21 277);
  --accent-muted: oklch(0.5 0.21 277 / 0.1);
  --accent-glow: 0 4px 16px -4px oklch(0.5 0.21 277 / 0.35);
  --btn-on-accent: oklch(0.99 0 0);

  --ring: oklch(0.5 0.21 277);

  --sidebar-bg: oklch(0.965 0.006 264);

  --cyan: #0891b2;
  --success: oklch(0.6 0.15 162);
  --success-muted: oklch(0.6 0.15 162 / 0.11);
  --danger: oklch(0.577 0.225 27);
  --danger-muted: oklch(0.577 0.225 27 / 0.09);
  --warning: oklch(0.66 0.15 65);
  --warning-muted: oklch(0.66 0.15 65 / 0.12);
  --info: oklch(0.55 0.18 245);

  --chart-1: oklch(0.5 0.21 277);
  --chart-2: oklch(0.62 0.13 215);
  --chart-3: oklch(0.6 0.15 162);
  --chart-4: oklch(0.72 0.15 75);
  --chart-5: oklch(0.6 0.2 15);
  --chart-6: oklch(0.55 0.2 320);

  --shadow-2xs: 0 1px 2px 0 oklch(0.2 0.03 266 / 0.05);
  --shadow-sm: 0 1px 2px 0 oklch(0.2 0.03 266 / 0.05), 0 2px 10px -2px oklch(0.2 0.03 266 / 0.07);
  --shadow: 0 6px 22px -6px oklch(0.2 0.03 266 / 0.13);
  --shadow-lg: 0 16px 48px -12px oklch(0.2 0.03 266 / 0.18);
  --shadow-glow: var(--accent-glow);

  --grad-accent: linear-gradient(135deg, oklch(0.5 0.21 277), oklch(0.55 0.2 300));

  --focus-ring: 0 0 0 3px oklch(0.5 0.21 277 / 0.22);

  --auth-aside-from: oklch(0.24 0.05 277);
  --auth-aside-to: oklch(0.15 0.03 277);
  --auth-gradient-1: oklch(0.62 0.2 277 / 0.16);
  --auth-gradient-2: oklch(0.66 0.19 320 / 0.1);
  --glass-bg: oklch(1 0 0 / 0.85);
  --row-hover: oklch(0.5 0.21 277 / 0.045);
  --row-divider: oklch(0 0 0 / 0.05);
}

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

html {
  font-family: var(--font);
  font-feature-settings: 'ss01' 1;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  text-align: right;
  transition: background-color var(--transition), color var(--transition);
}

#root {
  direction: rtl;
  text-align: right;
}

[dir='ltr'],
.input-ltr {
  direction: ltr;
  text-align: left;
}

a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  text-underline-offset: 3px;
  transition: color var(--transition), text-decoration-color var(--transition);
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

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