/* VENUS WT — Design tokens (light / dark) */

:root {
  color-scheme: light dark;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --line-height: 1.5;
  --line-height-tight: 1.35;

  /* Controls */
  --touch: 44px;
  --control-sm: 36px;
  --control-md: 36px;
  --control-lg: 40px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;

  /* Z-index */
  --z-nav: 1000;
  --z-dropdown: 1001;
  --z-drawer: 9999;
  --z-overlay: 9998;
  --z-modal: 2000;
  --z-toast: 3000;
  --z-tooltip: 10050;

  /* Role accent — badge ruolo only (overridden by body.theme-*) */
  --role-accent: #94a3b8;
  --role-accent-rgb: 148, 163, 184;
  --secondary: var(--role-accent);
  --secondary-rgb: var(--role-accent-rgb);

  /* Semantic colors (shared) */
  --color-success: #16a34a;
  --color-success-rgb: 22, 163, 74;
  --color-warning: #d97706;
  --color-warning-rgb: 217, 119, 6;
  --color-error: #dc2626;
  --color-error-rgb: 220, 38, 38;
  --color-info: #2563eb;
  --color-info-rgb: 37, 99, 235;

  --danger: var(--color-error);
  --accent-error: var(--color-error);

  /* Legacy alias */
  --accent-brand: var(--accent-interactive, #171717);
  --accent-brand-rgb: var(--accent-interactive-rgb, 23, 23, 23);
}

/* Dark theme (default) */
:root,
[data-color-scheme="dark"] {
  --bg: #0f0f0f;
  --bg-elevated: #171717;
  --bg-card: #141414;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-active: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text: #e5e5e5;
  --text-muted: rgba(255, 255, 255, 0.55);
  --text-subtle: rgba(255, 255, 255, 0.38);
  --accent: rgba(255, 255, 255, 0.08);
  --accent-hover: rgba(255, 255, 255, 0.12);
  --link-hover: #ffffff;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow-sm: none;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --scrollbar-track: rgba(255, 255, 255, 0.04);
  --scrollbar-thumb: rgba(255, 255, 255, 0.15);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.25);
  --nav-bg: var(--bg);
  --input-scheme: dark;
  --theme-color-meta: #0f0f0f;

  --accent-interactive: #fafafa;
  --accent-interactive-rgb: 250, 250, 250;
  --accent-interactive-hover: #e4e4e7;
  --on-accent: #0f0f0f;

  --color-success-bg: rgba(22, 163, 74, 0.14);
  --color-success-border: rgba(22, 163, 74, 0.28);
  --color-warning-bg: rgba(217, 119, 6, 0.14);
  --color-warning-border: rgba(217, 119, 6, 0.28);
  --color-error-bg: rgba(220, 38, 38, 0.12);
  --color-error-border: rgba(220, 38, 38, 0.28);
  --color-info-bg: rgba(37, 99, 235, 0.14);
  --color-info-border: rgba(37, 99, 235, 0.28);
}

/* Light theme */
[data-color-scheme="light"] {
  --bg: #f4f4f5;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.04);
  --bg-active: rgba(0, 0, 0, 0.07);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.14);
  --text: #18181b;
  --text-muted: #71717a;
  --text-subtle: #a1a1aa;
  --accent: rgba(0, 0, 0, 0.04);
  --accent-hover: rgba(0, 0, 0, 0.07);
  --link-hover: #09090b;
  --overlay: rgba(0, 0, 0, 0.4);
  --shadow-sm: none;
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --scrollbar-track: rgba(0, 0, 0, 0.04);
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);
  --nav-bg: var(--bg-elevated);
  --input-scheme: light;
  --theme-color-meta: #f4f4f5;

  --accent-interactive: #18181b;
  --accent-interactive-rgb: 24, 24, 27;
  --accent-interactive-hover: #27272a;
  --on-accent: #fafafa;

  --color-success: #15803d;
  --color-success-rgb: 21, 128, 61;
  --color-warning: #b45309;
  --color-warning-rgb: 180, 83, 9;
  --color-error: #b91c1c;
  --color-error-rgb: 185, 28, 28;
  --color-info: #1d4ed8;
  --color-info-rgb: 29, 78, 216;

  --color-success-bg: rgba(21, 128, 61, 0.1);
  --color-success-border: rgba(21, 128, 61, 0.25);
  --color-warning-bg: rgba(180, 83, 9, 0.1);
  --color-warning-border: rgba(180, 83, 9, 0.25);
  --color-error-bg: rgba(185, 28, 28, 0.08);
  --color-error-border: rgba(185, 28, 28, 0.25);
  --color-info-bg: rgba(29, 78, 216, 0.08);
  --color-info-border: rgba(29, 78, 216, 0.25);
}

/* Role accents — dark (luminous, for badges only) */
body.theme-admin { --role-accent: #fcd34d; --role-accent-rgb: 252, 211, 77; }
body.theme-contabile { --role-accent: #22d3ee; --role-accent-rgb: 34, 211, 238; }
body.theme-responsabile { --role-accent: #a78bfa; --role-accent-rgb: 167, 139, 250; }
body.theme-commesso { --role-accent: #4ade80; --role-accent-rgb: 74, 222, 128; }
body.theme-ufficio { --role-accent: #60a5fa; --role-accent-rgb: 96, 165, 250; }
body.theme-magazzino { --role-accent: #fb923c; --role-accent-rgb: 251, 146, 60; }
body.theme-negozio { --role-accent: #e879f9; --role-accent-rgb: 232, 121, 249; }
body.theme-dipendente { --role-accent: #94a3b8; --role-accent-rgb: 148, 163, 184; }

body.theme-admin,
body.theme-contabile,
body.theme-responsabile,
body.theme-commesso,
body.theme-ufficio,
body.theme-magazzino,
body.theme-negozio,
body.theme-dipendente {
  --secondary: var(--role-accent);
  --secondary-rgb: var(--role-accent-rgb);
}

/* Role accents — light (darker, WCAG AA on white) */
[data-color-scheme="light"] body.theme-admin { --role-accent: #a16207; --role-accent-rgb: 161, 98, 7; }
[data-color-scheme="light"] body.theme-contabile { --role-accent: #0e7490; --role-accent-rgb: 14, 116, 144; }
[data-color-scheme="light"] body.theme-responsabile { --role-accent: #6d28d9; --role-accent-rgb: 109, 40, 217; }
[data-color-scheme="light"] body.theme-commesso { --role-accent: #15803d; --role-accent-rgb: 21, 128, 61; }
[data-color-scheme="light"] body.theme-ufficio { --role-accent: #1d4ed8; --role-accent-rgb: 29, 78, 216; }
[data-color-scheme="light"] body.theme-magazzino { --role-accent: #c2410c; --role-accent-rgb: 194, 65, 12; }
[data-color-scheme="light"] body.theme-negozio { --role-accent: #a21caf; --role-accent-rgb: 162, 28, 175; }
[data-color-scheme="light"] body.theme-dipendente { --role-accent: #52525b; --role-accent-rgb: 82, 82, 91; }

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