/* =====================================================================
   Design system do CMMS (docs/DESIGN_SYSTEM.md, seções 2 e 3): tokens.
   Carregado DEPOIS do Aurea UDS e ANTES de app.css. Os tokens do guia têm nome próprio (--bg, --surface, --fg..., --danger...);
   onde o Aurea já tem o mesmo conceito (--background, --card, --border, --radius-*, --success...), o valor do Aurea é substituído
   pelo do guia, de modo que os componentes do Aurea e do app passem a usar a paleta nova sem mudar de classe.
   Fica de fora (preservado): o alto contraste da empresa (data-contrast="high") e a cor de marca escolhida (data-brand).
   ===================================================================== */

/* ---------- tokens do guia (nomes novos; claro e escuro) ---------- */
:root {
  --bg: #fafafa; --surface: #ffffff; --surface-muted: #f4f4f5;
  --fg: #18181b; --fg-muted: #52525b; --fg-subtle: #6b6b75;
  --primary-soft: #eff6ff; --primary-fg: #ffffff;

  --danger: #dc2626;  --danger-soft: #fef2f2;  --danger-text: #b91c1c;
  --warning: #d97706; --warning-soft: #fffbeb; --warning-text: #b45309;
  --success: #16a34a; --success-soft: #f0fdf4; --success-text: #15803d;
  --info: #2563eb;    --info-soft: #eff6ff;    --info-text: #1d4ed8;
  --neutral: #71717a; --neutral-soft: #f4f4f5; --neutral-text: #3f3f46;
  /* tons neutros para dados (gráficos, trilhas): derivados do neutro e da superfície, valem nos dois temas */
  --neutral-3: color-mix(in srgb, var(--neutral) 60%, var(--surface));
  --neutral-4: color-mix(in srgb, var(--neutral) 35%, var(--surface));
  --neutral-5: color-mix(in srgb, var(--neutral) 18%, var(--surface));

  --radius-xl: 16px;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .04);
  --font-sans: "Geist Variable", "Geist", Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono Variable", "Geist Mono", ui-monospace, "IBM Plex Mono", Consolas, monospace;
  --duration-slow: 280ms; --ease-out: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] {
  --bg: #09090b; --surface: #18181b; --surface-muted: #27272a;
  --fg: #fafafa; --fg-muted: #a1a1aa; --fg-subtle: #8f8f99;
  --primary-soft: rgb(59 130 246 / .14); --primary-fg: #09090b;
  --danger-soft: rgb(220 38 38 / .14);   --danger-text: #fca5a5;
  --warning-soft: rgb(217 119 6 / .14);  --warning-text: #fcd34d;
  --success-soft: rgb(22 163 74 / .14);  --success-text: #86efac;
  --info-soft: rgb(37 99 235 / .14);     --info-text: #93c5fd;
  --neutral-soft: rgb(113 113 122 / .18); --neutral-text: #d4d4d8;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .3);
}

/* ---------- tokens do Aurea trocados pelos do guia (tema claro) ---------- */
:root:not([data-contrast="high"]) {
  --background: #fafafa; --foreground: #18181b; --muted-foreground: #52525b; --subtle-foreground: #6b6b75;
  --card: #ffffff; --card-foreground: #18181b; --border: #e4e4e7; --border-strong: #d4d4d8; --surface-hover: #f4f4f5;
  --success: #16a34a; --success-bg: #f0fdf4; --warning: #d97706; --warning-bg: #fffbeb;
  --info: #2563eb; --info-bg: #eff6ff; --destructive: #dc2626; --danger-bg: #fef2f2;
}
/* marca padrão (sem data-brand): azul do guia; as demais marcas escolhidas pela empresa continuam valendo */
:root:not([data-contrast="high"]):not([data-brand]) {
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-active: #1e40af; --primary-foreground: #ffffff; --primary-mark: #eff6ff; --ring: #2563eb;
}
/* ---------- tema escuro ---------- */
:root[data-theme="dark"]:not([data-contrast="high"]) {
  --background: #09090b; --foreground: #fafafa; --muted-foreground: #a1a1aa; --subtle-foreground: #8f8f99;
  --card: #18181b; --card-foreground: #fafafa; --border: #27272a; --border-strong: #3f3f46; --surface-hover: #27272a;
  --success-bg: rgb(22 163 74 / .14); --warning-bg: rgb(217 119 6 / .14); --info-bg: rgb(37 99 235 / .14); --danger-bg: rgb(220 38 38 / .14);
  --success: #22c55e; --warning: #f59e0b; --info: #3b82f6; --destructive: #ef4444;
}
:root[data-theme="dark"]:not([data-contrast="high"]):not([data-brand]) {
  --primary: #3b82f6; --primary-hover: #60a5fa; --primary-active: #2563eb; --primary-foreground: #09090b; --primary-mark: rgb(59 130 246 / .14); --ring: #3b82f6;
}

/* ---------- raios, sombras, alturas e fontes (valem nos dois temas) ---------- */
:root {
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --radius-card: 12px;
  --radius-control: 8px;             /* botões e campos: sem formato pílula */
  --radius-full: 9999px;             /* avatar, ponto de status, contador */
  --shadow-sm: var(--shadow-xs); --shadow-md: 0 4px 12px rgb(0 0 0 / .08); --shadow-lg: 0 16px 48px rgb(0 0 0 / .16);
  --control-h-sm: 2rem; --control-h-md: 2.25rem; --control-h-lg: 2.75rem; --control-h-xl: 3.5rem;
  --font-ui: var(--font-sans); --font-heading: var(--font-sans); --font-code: var(--font-mono);
}

body { font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
/* números tabulares em tabelas, indicadores e identificadores */
.tabular, table, .table, .kpi, .kpi-v, [data-kpi], .costbar, .at-clock { font-variant-numeric: tabular-nums; }
.mono, code { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
