/* Tokens da identidade Léguas Franzinas. Única fonte de cores do sistema. */
:root {
  /* Marca */
  --brand-purple: #2E0A3E;
  --brand-purple-night: #1C0627;
  --brand-purple-wing: #6B3D7D;
  --brand-orange: #F7941D;
  --brand-orange-dark: #D97A0B;
  --brand-lilac: #EFE7F6;
  --brand-cream: #FFF1DD;
  --ink: #241433;
  --muted: #6E5A82;
  --line: #E6DCF0;
  --success: #1E8E4E;
  --danger: #D6453F;
  --warning: #E0A100;
  --neutral: #8A8296;

  /* Papéis, tema claro */
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-alt: var(--brand-lilac);
  --color-text: var(--ink);
  --color-text-muted: var(--muted);
  --color-border: var(--line);
  --color-primary: var(--brand-purple);
  --color-on-primary: #FFFFFF;
  --color-primary-hover: var(--brand-purple-wing);
  --color-accent: var(--brand-orange);
  --color-on-accent: var(--brand-purple);
  --color-accent-text: #A65A05;
  --color-focus: var(--brand-orange-dark);
  --color-highlight: var(--brand-cream);
  --color-sidebar: var(--brand-lilac);
  --color-on-sidebar: var(--ink);
  --color-on-sidebar-muted: var(--muted);
  --color-sidebar-hover: rgb(46 10 62 / 8%);
  --color-sidebar-active: rgb(46 10 62 / 12%);
  --color-sidebar-border: var(--line);
  --color-overlay: rgb(28 6 39 / 60%);
  --tone-success-bg: #E3F4EA;
  --tone-success-fg: #176E3C;
  --tone-danger-bg: #FBE7E6;
  --tone-danger-fg: #B3302B;
  --tone-warning-bg: #FBF0CC;
  --tone-warning-fg: #6F5000;
  --tone-neutral-bg: #EFEDF2;
  --tone-neutral-fg: #575063;
  --tone-brand-bg: var(--brand-lilac);
  --tone-brand-fg: var(--brand-purple);

  /* Tipografia */
  --font-sans: "Poppins", system-ui, sans-serif;
  --weight-body: 300;
  --weight-text: 400;
  --weight-subtitle: 600;
  --weight-title: 700;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-kpi: 2.25rem;

  /* Espaçamento, escala de 4 px */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Raios */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgb(36 20 51 / 8%);
  --shadow-md: 0 4px 12px rgb(36 20 51 / 10%);
  --shadow-lg: 0 12px 32px rgb(36 20 51 / 18%);

  /* Camadas */
  --z-sticky: 10;
  --z-sidebar: 30;
  --z-overlay: 40;
  --z-modal: 50;
  --z-toast: 60;

  /* Transições */
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* Medidas */
  --sidebar-width: 248px;
  --sidebar-width-collapsed: 72px;
  --touch-target: 40px;
}

/* Tema escuro: opcional, guardado por utilizador */
.dark {
  --color-bg: var(--brand-purple-night);
  --color-surface: #2A1138;
  --color-surface-alt: #351B45;
  --color-text: #F3EDF8;
  --color-text-muted: #BBAACB;
  --color-border: #4A2A5C;
  --color-primary: var(--brand-orange);
  --color-on-primary: var(--brand-purple);
  --color-primary-hover: #FFAB45;
  --color-accent: var(--brand-orange);
  --color-on-accent: var(--brand-purple);
  --color-accent-text: var(--brand-orange);
  --color-focus: var(--brand-orange);
  --color-highlight: #3D2230;
  --color-sidebar: #240A32;
  --color-on-sidebar: #FFFFFF;
  --color-on-sidebar-muted: rgb(255 255 255 / 70%);
  --color-sidebar-hover: rgb(255 255 255 / 10%);
  --color-sidebar-active: rgb(255 255 255 / 12%);
  --color-sidebar-border: transparent;
  --tone-success-bg: #123A25;
  --tone-success-fg: #7ADBA6;
  --tone-danger-bg: #4A1A1E;
  --tone-danger-fg: #F7A5A1;
  --tone-warning-bg: #40330A;
  --tone-warning-fg: #F2CF63;
  --tone-neutral-bg: #3A3145;
  --tone-neutral-fg: #CFC8D8;
  --tone-brand-bg: #41235A;
  --tone-brand-fg: #E8DAF5;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 45%);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 55%);
}

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