/* ============================================================
   ERPoint — Padrão visual (design tokens + base)
   Tema claro e escuro. Acento configurável via --accent.
   ============================================================ */

:root {
  /* Acento (sobrescrito por JS via data-accent) */
  --accent:        #3b82f6;
  --accent-600:    #2f6fe0;
  --accent-soft:   rgba(59, 130, 246, 0.14);
  --accent-ring:   rgba(59, 130, 246, 0.35);

  /* Cores semânticas (estáveis entre temas) */
  --success:       #2bb673;
  --success-soft:  rgba(43, 182, 115, 0.14);
  --danger:        #ef5350;
  --danger-soft:   rgba(239, 83, 80, 0.13);
  --today:         #fb7185;
  --today-soft:    rgba(251, 113, 133, 0.14);
  --warn:          #f5a623;
  --warn-soft:     rgba(245, 166, 35, 0.14);

  /* Raios */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Tipografia */
  --font: "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* Densidade (sobrescrita por JS) */
  --row-pad: 14px;
  --rail-w: 248px;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(8, 15, 26, 0.18);
  --shadow-md: 0 6px 20px -6px rgba(8, 15, 26, 0.35);
  --shadow-lg: 0 18px 48px -12px rgba(8, 15, 26, 0.55);

  --tr: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- TEMA ESCURO (padrão) ---------- */
[data-theme="dark"] {
  --bg:            #0b1320;
  --bg-grad:       radial-gradient(1200px 600px at 78% -10%, #122036 0%, #0b1320 55%);
  --elev:          #0f1a29;
  --surface:       #13202f;
  --surface-2:     #182838;
  --surface-hover: #1c2c3f;
  --border:        #21344a;
  --border-soft:   #182636;
  --border-strong: #2c405a;
  --text:          #e9eff7;
  --text-2:        #9db0c6;
  --text-3:        #66798f;
  --chip:          #1a2a3c;
  --logo-bg:       linear-gradient(135deg, #f97316, #fb923c);
  --scrim:         rgba(4, 9, 16, 0.6);

  /* --- Aliases de compat. para CSS legado --- */
  --text-soft:        var(--text-2);
  --text-muted:       var(--text-3);
  --text-faint:       var(--text-3);
  --surface-soft:     var(--surface-2);
  --surface-elevated: var(--surface-2);
  --accent-bg:        var(--accent-soft);
  --accent-dark:      var(--accent-600);
  --accent-hover:     var(--accent-600);
  --success-bg:       var(--success-soft);
  --danger-bg:        var(--danger-soft);
  --warn-bg:          var(--warn-soft);
  --menu-text:        var(--text);
  --menu-text-muted:  var(--text-3);
  --menu-bg:          var(--elev);
  --menu-border:      var(--border);
}

/* ---------- TEMA CLARO ---------- */
[data-theme="light"] {
  --bg:            #eef1f6;
  --bg-grad:       radial-gradient(1200px 600px at 80% -10%, #ffffff 0%, #eef1f6 60%);
  --elev:          #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f5f7fb;
  --surface-hover: #eef2f8;
  --border:        #e2e8f1;
  --border-soft:   #edf1f6;
  --border-strong: #d3dbe6;
  --text:          #101b29;
  --text-2:        #54657a;
  --text-3:        #8696a9;
  --chip:          #eef2f8;
  --logo-bg:       linear-gradient(135deg, #f97316, #fb923c);
  --scrim:         rgba(20, 32, 48, 0.32);
  --shadow-sm: 0 1px 2px rgba(16, 27, 41, 0.06);
  --shadow-md: 0 8px 24px -10px rgba(16, 27, 41, 0.18);
  --shadow-lg: 0 24px 56px -16px rgba(16, 27, 41, 0.22);

  /* --- Aliases de compat. para CSS legado --- */
  --text-soft:        var(--text-2);
  --text-muted:       var(--text-3);
  --text-faint:       var(--text-3);
  --surface-soft:     var(--surface-2);
  --surface-elevated: var(--surface-2);
  --accent-bg:        var(--accent-soft);
  --accent-dark:      var(--accent-600);
  --accent-hover:     var(--accent-600);
  --success-bg:       var(--success-soft);
  --danger-bg:        var(--danger-soft);
  --warn-bg:          var(--warn-soft);
  --menu-text:        var(--text);
  --menu-text-muted:  var(--text-3);
  --menu-bg:          var(--elev);
  --menu-border:      var(--border);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.4;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); }

.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

/* ---- Logo switching ---- */
.logo-wordmark, .logo-glyph { display: flex; align-items: center; }

/* default dark: wordmark dark visible, light hidden; glyphs always hidden when expanded */
.app:not(.collapsed) .logo-glyph    { display: none; }
.app.collapsed      .logo-wordmark  { display: none; }

.logo-wm-light, .logo-gl-light { display: none; }
.logo-wm-dark,  .logo-gl-dark  { display: block; }

[data-theme="light"] .logo-wm-dark  { display: none; }
[data-theme="light"] .logo-wm-light { display: block; }
[data-theme="light"] .logo-gl-dark  { display: none; }
[data-theme="light"] .logo-gl-light { display: block; }
