/* ==========================================================================
   Business Intelligence Solutions — Design System
   Tokens · Reset · Tipografia · Layout base
   ========================================================================== */

:root {
  color-scheme: light;

  /* Marca (extraída do logo) */
  --brand-950: #06132b;
  --brand-900: #0a1f44;
  --brand-800: #0f2c59;
  --brand-700: #143a73;
  --brand-600: #1d5fbf;
  --brand-500: #1f78d1;
  --brand-400: #3b9be8;
  --cyan-500: #0091d5;
  --cyan-400: #22b0f0;
  --green-500: #32b957;
  --lime-400: #8cc63f;

  --gradient-brand: linear-gradient(120deg, #0f2c59 0%, #1d5fbf 38%, #0091d5 68%, #32b957 100%);
  --gradient-primary: linear-gradient(135deg, #1d5fbf 0%, #0a8ad6 60%, #0aa6c9 100%);
  --gradient-arrow: linear-gradient(90deg, #1d5fbf, #0091d5 55%, #32b957 85%, #8cc63f);

  /* Superfícies — tema claro */
  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --border: #e3e8f1;
  --border-strong: #d1d9e6;
  --ring: rgba(31, 120, 209, 0.35);

  --text: #0b1b36;
  --text-2: #43526b;
  --muted: #7d889d;
  --faint: #a8b1c2;

  --primary: #1f6fd6;
  --primary-hover: #185fbb;
  --primary-soft: rgba(31, 111, 214, 0.09);
  --primary-soft-2: rgba(31, 111, 214, 0.16);

  /* Tons semânticos (texto / fundo suave / borda) */
  --blue: #1f6fd6;    --blue-bg: #eaf2fe;   --blue-bd: #cfe0fb;
  --cyan: #0284a8;    --cyan-bg: #e5f7fc;   --cyan-bd: #c3ecf7;
  --green: #15803d;   --green-bg: #e8f7ee;  --green-bd: #c6ebd3;
  --amber: #b45309;   --amber-bg: #fff4e0;  --amber-bd: #fbe0b2;
  --red: #c42828;     --red-bg: #fdecec;    --red-bd: #f8cfcf;
  --violet: #6d3fd6;  --violet-bg: #f1ebfe; --violet-bd: #e0d4fc;
  --pink: #be2e76;    --pink-bg: #fdebf4;   --pink-bd: #f9d0e4;
  --slate: #475569;   --slate-bg: #eef2f7;  --slate-bd: #dde3ec;

  /* Gráficos (paleta validada p/ daltonismo) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --chart-grid: #e9edf4;
  --chart-axis: #c9d1de;

  /* Sidebar (sempre escura) */
  --side-bg: linear-gradient(180deg, #0b1d42 0%, #081634 55%, #06112a 100%);
  --side-text: #aebbd3;
  --side-text-strong: #ffffff;
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(59, 155, 232, 0.14);
  --side-border: rgba(255, 255, 255, 0.07);

  /* Forma */
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.05), 0 10px 28px -14px rgba(16, 34, 70, 0.18);
  --shadow-lg: 0 2px 6px rgba(16, 24, 40, 0.05), 0 28px 60px -20px rgba(10, 31, 68, 0.32);
  --shadow-glow: 0 10px 30px -10px rgba(29, 95, 191, 0.55);

  /* Tipografia */
  --font-sans: "Instrument Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Outfit", "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-fast: 140ms;
  --t: 220ms;
  --t-slow: 420ms;

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
}

/* --------- Tema escuro --------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060b17;
  --surface: #0c1427;
  --surface-2: #101a31;
  --surface-3: #16223d;
  --surface-glass: rgba(10, 18, 36, 0.72);
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.22);
  --ring: rgba(59, 155, 232, 0.45);

  --text: #e7edf8;
  --text-2: #aab5ca;
  --muted: #74819a;
  --faint: #4f5b73;

  --primary: #4a97f0;
  --primary-hover: #66a9f5;
  --primary-soft: rgba(74, 151, 240, 0.12);
  --primary-soft-2: rgba(74, 151, 240, 0.22);

  --blue: #7cb4f7;    --blue-bg: rgba(59, 130, 246, 0.14);  --blue-bd: rgba(59, 130, 246, 0.28);
  --cyan: #5fd0ef;    --cyan-bg: rgba(6, 182, 212, 0.13);   --cyan-bd: rgba(6, 182, 212, 0.28);
  --green: #5dd68a;   --green-bg: rgba(34, 197, 94, 0.12);  --green-bd: rgba(34, 197, 94, 0.26);
  --amber: #f5b454;   --amber-bg: rgba(245, 158, 11, 0.13); --amber-bd: rgba(245, 158, 11, 0.28);
  --red: #f68383;     --red-bg: rgba(239, 68, 68, 0.13);    --red-bd: rgba(239, 68, 68, 0.28);
  --violet: #b59cfa;  --violet-bg: rgba(139, 92, 246, 0.15); --violet-bd: rgba(139, 92, 246, 0.3);
  --pink: #f38bbf;    --pink-bg: rgba(236, 72, 153, 0.13);  --pink-bd: rgba(236, 72, 153, 0.28);
  --slate: #a9b5c9;   --slate-bg: rgba(148, 163, 184, 0.1); --slate-bd: rgba(148, 163, 184, 0.2);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --chart-grid: rgba(148, 163, 184, 0.1);
  --chart-axis: rgba(148, 163, 184, 0.22);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px -2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 34px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.4), 0 30px 70px -20px rgba(0, 0, 0, 0.75);
  --shadow-glow: 0 10px 34px -10px rgba(34, 176, 240, 0.45);
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.015em; font-weight: 600; line-height: 1.2; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
::selection { background: var(--primary-soft-2); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* Scrollbars discretos */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Ícones */
.i { display: inline-block; vertical-align: -0.18em; width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.9; }
.i-xs { width: 13px; height: 13px; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 28px; height: 28px; }

/* Utilitários */
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.strong { font-weight: 600; color: var(--text); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.upper { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start; }
.w-full { width: 100%; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pos-green { color: var(--green); }
.pos-red { color: var(--red); }
.pos-amber { color: var(--amber); }
.pos-blue { color: var(--blue); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }

@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 > .span-3, .grid-3 > .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3 { grid-column: auto; }
}
@media (max-width: 400px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   Animações
   ========================================================================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: none; } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(50, 185, 87, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(50, 185, 87, 0); } 100% { box-shadow: 0 0 0 0 rgba(50, 185, 87, 0); } }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes drawLine { from { stroke-dashoffset: var(--len, 1000); } to { stroke-dashoffset: 0; } }
@keyframes growBar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bellShake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-5deg); } }
@keyframes shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }
@keyframes blink { 50% { opacity: 0; } }

.view-enter { animation: fadeUp var(--t-slow) var(--ease) both; }
.stagger > * { animation: fadeUp 520ms var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 20ms; }
.stagger > *:nth-child(2) { animation-delay: 70ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 170ms; }
.stagger > *:nth-child(5) { animation-delay: 220ms; }
.stagger > *:nth-child(6) { animation-delay: 270ms; }
.stagger > *:nth-child(7) { animation-delay: 320ms; }
.stagger > *:nth-child(8) { animation-delay: 370ms; }
.stagger > *:nth-child(n+9) { animation-delay: 400ms; }
.no-anim .stagger > *, .no-anim .view-enter { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ==========================================================================
   Boot / Splash
   ========================================================================== */
#boot {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(29, 95, 191, 0.35), transparent 60%), #06112a;
  transition: opacity 400ms var(--ease), visibility 400ms;
}
#boot.hide { opacity: 0; visibility: hidden; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.boot-mark { width: 96px; animation: floatY 2.4s var(--ease) infinite; filter: drop-shadow(0 12px 30px rgba(34, 176, 240, 0.35)); }
.boot-bar { width: 160px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; position: relative; }
.boot-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--gradient-arrow); border-radius: 3px; animation: bootSlide 1.1s var(--ease) infinite; }
@keyframes bootSlide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
.boot-text { font-family: var(--font-display); color: #cfe0ff; letter-spacing: 0.32em; font-size: 11px; text-transform: uppercase; opacity: 0.8; }
