/* Design tokens do ChatNOC ERP (redesign, etapa 1).
 *
 * Fonte unica de cor, raio e fonte. Os componentes leem SO estes nomes; hex solto
 * fora deste arquivo e' regressao.
 *
 * Temas: data-theme="black" (escuro, padrao) e data-theme="white" (claro), os
 * valores que o toggle do topo ja' grava. Os nomes do bloco "apelidos" sao os
 * tokens antigos do app.css, apontados para os novos: telas ainda nao
 * redesenhadas herdam a paleta nova sem mudar uma linha.
 */

:root,
html[data-theme="black"] {
  color-scheme: dark;

  /* superficies */
  --bg: #0a0c10;
  --sidebar: #0d1015;
  --surface: #11151c;
  --surface-2: #161b24;
  --surface-hover: #141922;
  --input: #0e1218;
  --border: #1e2430;
  --border-strong: #2a3140;
  --divider: #171c25;

  /* texto */
  --text-strong: #e7eaf0;
  --text: #c9cfda;
  --text-muted: #8790a0;
  --text-faint: #7d8696;

  /* acento */
  --accent: #6e9bff;
  --accent-hover: #86acff;
  --accent-soft: #172033;
  --accent-ring: #26365a;
  --accent-contrast: #0a0c10;
  --link: #8db0ff;

  /* status: cor solida / fundo do chip / texto do chip */
  --ok: #3ddc97;
  --ok-bg: rgb(61 220 151 / 12%);
  --ok-fg: #5be3a8;
  --warn: #f2b04a;
  --warn-bg: rgb(242 176 74 / 13%);
  --warn-fg: #f4be66;
  --bad: #f2777a;
  --bad-bg: rgb(242 119 122 / 13%);
  --bad-fg: #f59597;
  --bad-border: #3a2328;
  --info-bg: rgb(110 155 255 / 14%);
  --info-fg: #9dbbff;
  --pilot: #b39dff;
  --pilot-bg: rgb(179 157 255 / 14%);
  --pilot-fg: #c6b6ff;
  --neutral: #6b7484;
  --neutral-bg: #1a2029;
  --neutral-fg: #a3abba;

  --overlay: rgb(5 7 10 / 62%);
  --shadow: 0 18px 45px rgb(0 0 0 / 34%);
  --shadow-soft: 0 8px 22px rgb(0 0 0 / 22%);
}

html[data-theme="white"] {
  color-scheme: light;

  --bg: #f6f7f9;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-hover: #f3f5f8;
  --input: #ffffff;
  --border: #e3e6ec;
  --border-strong: #cdd3dc;
  --divider: #eceef2;

  /* contraste >= 4.5:1 sobre #fff e #f6f7f9 em todos os textos */
  --text-strong: #121620;
  --text: #2a313d;
  --text-muted: #5b6475;
  --text-faint: #5f6878;

  --accent: #3d6fe8;
  --accent-hover: #2f5fd4;
  --accent-soft: #e9effd;
  --accent-ring: #b9cdf7;
  --accent-contrast: #ffffff;
  --link: #2d5fd6;

  --ok: #14965a;
  --ok-bg: rgb(20 150 90 / 11%);
  --ok-fg: #0d7146;
  --warn: #c98510;
  --warn-bg: rgb(201 133 16 / 13%);
  --warn-fg: #8a5a06;
  --bad: #d64545;
  --bad-bg: rgb(214 69 69 / 10%);
  --bad-fg: #b02f33;
  --bad-border: #f1c9c9;
  --info-bg: rgb(61 111 232 / 11%);
  --info-fg: #2d5fd6;
  --pilot: #7c5ce0;
  --pilot-bg: rgb(124 92 224 / 11%);
  --pilot-fg: #5d3fc0;
  --neutral: #8a93a3;
  --neutral-bg: #eef0f4;
  --neutral-fg: #4c5565;

  --overlay: rgb(18 22 32 / 38%);
  --shadow: 0 18px 45px rgb(15 23 42 / 10%);
  --shadow-soft: 0 8px 20px rgb(15 23 42 / 7%);
}

:root {
  /* forma */
  --r-card: 14px;
  --r-ctl: 9px;
  --r-chip: 999px;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* escala antiga de raio/espaco/tempo (continua valendo) */
  --r-sm: 6px;
  --r-md: var(--r-ctl);
  --r-lg: var(--r-card);
  --r-xl: 20px;
  --r-full: var(--r-chip);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --t-fast: 120ms cubic-bezier(0.2, 0.7, 0.3, 1);
  --t-med: 220ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* apelidos: nomes antigos do app.css -> tokens novos (valem nos dois temas) */
html {
  --font-mono: var(--mono);
  --surface-muted: var(--surface-2);
  --surface-strong: var(--surface-2);
  --surface-solid: var(--surface);
  --surface-muted-solid: var(--surface-2);
  --muted: var(--text-muted);
  --muted-strong: var(--neutral-fg);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --primary: var(--accent);
  --primary-strong: var(--accent-hover);
  --primary-soft: var(--accent-soft);
  --info: var(--accent);
  --info-soft: var(--info-bg);
  --danger: var(--bad-fg);
  --danger-soft: var(--bad-bg);
  --warning: var(--warn-fg);
  --warning-soft: var(--warn-bg);
  --ok-soft: var(--ok-bg);
  --idle: var(--text-muted);
  --idle-soft: var(--neutral-bg);
  --input-bg: var(--input);
  --input-text: var(--text-strong);
  --input-placeholder: var(--text-faint);
  --button-primary-text: var(--accent-contrast);
  --button-secondary-bg: var(--surface-2);
  --topbar-bg: var(--bg);
  --app-frame-bg: var(--bg);
  --sidebar-link-active-bg: var(--accent-soft);
}
