/* ==========================================================================
   Cosecurity Design System — Foundation
   --------------------------------------------------------------------------
   Fonte da verdade: estilo_cosecurity/ui.md (marca oficial Cosecurity)
   Estrutura/componentes inspirados em static/placas/placa.css (padrão validado)

   Objetivo: um único CSS canônico, com cores em OKLCH, tokens semânticos
   (background / foreground / border / ring / primary / secondary / hover /
   active ...). Suporte apenas a modo claro — tema escuro removido de
   propósito, inclusive o automático via preferência do sistema.

   Uso: <link rel="stylesheet" href="/static/css/cosecurity.css">
   Coexiste com o Bootstrap — os tokens e componentes daqui têm prioridade.
   ========================================================================== */

/* ==========================================================================
   0. FONTE DA MARCA — AmpleSoft Pro (uso exclusivo do logotipo/título-marca)
   --------------------------------------------------------------------------
   Arquivos em static/assets/font/. Só o peso Bold é embutido aqui porque é o
   único usado por --font-logo (.cos-header-title); os demais pesos já
   existem em static/assets/font/stylesheet.css para quem precisar deles.
   Headings normais (h1–h6 fora do logo) usam Montserrat via --font-display,
   nunca AmpleSoft Pro — ver seção 4.
   ========================================================================== */
@font-face {
  font-family: 'AmpleSoft Pro';
  src: url('../assets/font/AmpleSoftPro-Bold.woff2') format('woff2'),
       url('../assets/font/AmpleSoftPro-Bold.woff') format('woff'),
       url('../assets/font/AmpleSoftPro-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   1. PRIMITIVAS — escalas de cor em OKLCH ancoradas na marca Cosecurity
   --------------------------------------------------------------------------
   Âncoras oficiais (ui.md):
     Navy   PANTONE 281        oklch(25.98% 0.076 255.4)  #001F45
     Cyan   Process Cyan C     oklch(71.08% 0.159 230.6)  #00AEEF
     Gray   PANTONE 424        oklch(52.68% 0.005 264.8)  #6D6E71
     Pink   PANTONE 214        oklch(57.49% 0.225 10.4)   #EC1651
     Gold   PANTONE 116        oklch(84.95% 0.171 86.3)   #FFCA05
   ========================================================================== */
:root {
  /* Navy — cor institucional primária (hue ~255) */
  --navy-50:  oklch(0.970 0.012 255);
  --navy-100: oklch(0.930 0.025 255);
  --navy-200: oklch(0.850 0.050 255);
  --navy-300: oklch(0.720 0.090 255);
  --navy-400: oklch(0.620 0.120 255);
  --navy-500: oklch(0.520 0.130 255);
  --navy-600: oklch(0.420 0.110 255);
  --navy-700: oklch(0.330 0.090 255);
  --navy-800: oklch(0.260 0.076 255); /* âncora oficial #001F45 */
  --navy-900: oklch(0.210 0.060 255);
  --navy-950: oklch(0.160 0.045 255);

  /* Cyan — acento institucional vivo (hue ~231) */
  --cyan-50:  oklch(0.970 0.020 231);
  --cyan-100: oklch(0.940 0.040 231);
  --cyan-200: oklch(0.900 0.070 231);
  --cyan-300: oklch(0.840 0.100 231);
  --cyan-400: oklch(0.780 0.135 231);
  --cyan-500: oklch(0.711 0.159 231); /* âncora oficial #00AEEF */
  --cyan-600: oklch(0.620 0.150 231);
  --cyan-700: oklch(0.520 0.125 231);
  --cyan-800: oklch(0.430 0.100 231);
  --cyan-900: oklch(0.350 0.078 231);

  /* Neutros — cinza institucional com leve viés navy para coesão (hue ~255) */
  --neutral-0:   oklch(1.000 0     0);       /* branco puro */
  --neutral-50:  oklch(0.985 0.003 255);
  --neutral-100: oklch(0.968 0.005 255);
  --neutral-200: oklch(0.930 0.008 255);
  --neutral-300: oklch(0.880 0.010 255);
  --neutral-400: oklch(0.740 0.012 255);
  --neutral-500: oklch(0.600 0.012 255);     /* ~ #6D6E71 institucional */
  --neutral-600: oklch(0.500 0.013 255);
  --neutral-700: oklch(0.400 0.014 255);
  --neutral-800: oklch(0.300 0.020 255);
  --neutral-900: oklch(0.220 0.025 255);
  --neutral-950: oklch(0.160 0.020 255);

  /* Pink — secundária de alerta/destaque (hue ~10) */
  --pink-100: oklch(0.930 0.050 10.4);
  --pink-300: oklch(0.780 0.130 10.4);
  --pink-500: oklch(0.575 0.225 10.4);       /* âncora oficial #EC1651 */
  --pink-600: oklch(0.510 0.210 10.4);
  --pink-700: oklch(0.450 0.185 10.4);

  /* Gold — secundária de sinalização (hue ~86) */
  --gold-100: oklch(0.965 0.055 86.3);
  --gold-300: oklch(0.910 0.120 86.3);
  --gold-500: oklch(0.850 0.171 86.3);       /* âncora oficial #FFCA05 */
  --gold-600: oklch(0.760 0.155 86.3);
  --gold-700: oklch(0.660 0.135 86.3);

  /* Verde — apenas para estado de sucesso (hue ~150) */
  --green-100: oklch(0.940 0.045 150);
  --green-500: oklch(0.680 0.150 150);
  --green-600: oklch(0.600 0.145 150);
  --green-700: oklch(0.520 0.125 150);
  --green-800: oklch(0.430 0.110 150);

  /* Vermelho — apenas para estado de erro/perigo (hue ~25) */
  --red-100: oklch(0.940 0.040 25);
  --red-500: oklch(0.600 0.205 25);
  --red-600: oklch(0.535 0.200 25);
  --red-700: oklch(0.470 0.180 25);
  --red-800: oklch(0.420 0.170 25);

  /* Passo 800 de gold — só existe para TEXTO sobre --warning-surface; ver §2.1 */
  --gold-800: oklch(0.450 0.110 86.3);
}

/* ==========================================================================
   2. TOKENS SEMÂNTICOS — modo claro (padrão)
   --------------------------------------------------------------------------
   Referencie SEMPRE estes tokens nos componentes/telas, nunca as primitivas
   diretamente. Trocar de tema = trocar apenas este mapeamento.
   ========================================================================== */
:root {
  /* Superfícies e texto base */
  --background:            var(--neutral-50);   /* fundo da página */
  --foreground:            var(--navy-900);     /* texto principal */
  --surface:               var(--neutral-100);  /* fundo rebaixado/sunken */
  --card:                  var(--neutral-0);    /* fundo de cartões/painéis */
  --card-foreground:       var(--navy-900);
  --popover:               var(--neutral-0);
  --popover-foreground:    var(--navy-900);

  /* Texto por ênfase */
  --foreground-strong:     var(--navy-900);
  --foreground-muted:      var(--neutral-700);  /* neutral-500 tinha contraste insuficiente sobre --background */
  /* ATENÇÃO: --foreground-subtle mede 2.31:1 sobre branco — abaixo do mínimo de
     4.5:1 do WCAG 2.1 §1.4.3. Use SÓ em elemento decorativo, nunca em texto que
     precise ser lido (rótulo de eixo, hora de matriz, placeholder, legenda).
     Para esses casos existem --foreground-muted (9.22:1) e
     --foreground-placeholder (5.98:1). */
  --foreground-subtle:     var(--neutral-400);
  --foreground-placeholder: var(--neutral-600); /* placeholder de campo — 5.98:1 sobre branco */
  --foreground-on-brand:   oklch(0.94 0.01 255); /* texto sobre navy/cyan — branco suavizado, menos agressivo que #fff puro */

  /* Muted (áreas secundárias, chips) */
  --muted:                 var(--neutral-100);
  --muted-foreground:      var(--neutral-700);  /* mesmo ajuste de contraste de --foreground-muted */

  /* Primária — identidade institucional (navy) */
  --primary:               var(--navy-800);
  --primary-foreground:    var(--neutral-0);
  --primary-hover:         var(--navy-700);
  --primary-active:        var(--navy-900);

  /* Secundária — botão/área discreta */
  --secondary:            var(--neutral-100);
  --secondary-foreground: var(--navy-800);
  --secondary-hover:      var(--neutral-200);
  --secondary-active:     var(--neutral-300);

  /* Acento — cyan vivo (CTA, links ativos, realces) */
  --accent:               var(--cyan-500);
  --accent-foreground:    var(--navy-950);
  --accent-hover:         var(--cyan-600);
  --accent-active:        var(--cyan-700);

  /* Bordas, campos e foco */
  --border:               var(--neutral-200);
  --border-strong:        var(--neutral-300);
  --input:                var(--neutral-300);
  --ring:                 var(--cyan-700);      /* anel de foco (contraste WCAG 2.1 §1.4.11 ≥ 3:1) */

  /* Estados semânticos (cor + fundo de apoio)
     --*        : cor do estado sobre fundo BRANCO ou como preenchimento sólido.
     --*-strong : cor de TEXTO sobre o respectivo --*-surface. Os passos médios
                  (cyan-600, green-600, gold-700) medem 2.8–3.2:1 sobre suas
                  superfícies claras — reprovam os 4.5:1 do WCAG 2.1 §1.4.3 para
                  texto pequeno, que é o caso de badge, banner e chip. Os passos
                  800 medem 6.5–7.6:1. Números conferidos, não estimados. */
  --success:              var(--green-600);
  --success-strong:       var(--green-800);      /* 6.54:1 sobre --success-surface */
  --success-foreground:   var(--neutral-0);
  --success-surface:      var(--green-100);
  --warning:              var(--gold-700);
  --warning-strong:       var(--gold-800);       /* 6.70:1 sobre --warning-surface */
  --warning-foreground:   var(--navy-950);
  --warning-surface:      var(--gold-100);
  --danger:               var(--red-600);
  --danger-strong:        var(--red-800);        /* 7.57:1 sobre --danger-surface */
  --danger-foreground:    var(--neutral-0);
  --danger-surface:       var(--red-100);
  --info:                 var(--cyan-600);
  --info-strong:          var(--cyan-800);       /* 6.60:1 sobre --info-surface */
  --info-foreground:      var(--neutral-0);
  --info-surface:         var(--cyan-100);

  /* ---- Rampa sequencial para mapa de calor (magnitude) ----
     UMA matiz, claro→escuro, conforme a regra de escala sequencial: rampa
     multi-matiz (cyan→pink) é rainbow e reprova monotonicidade, ΔL adjacente e
     matiz única. Esta rampa passa os quatro checks: ΔL >= 0.06 em todos os
     passos, extremidade clara em 2.45:1 e amplitude de matiz de 3°. */
  --heat-0: var(--neutral-200);   /* sem dado — cinza, nunca um tom da rampa */
  --heat-1: var(--cyan-500);
  --heat-2: var(--cyan-600);
  --heat-3: var(--cyan-700);
  --heat-4: var(--cyan-800);
  --heat-5: var(--cyan-900);

  /* Arco-íris do campo/aba de IA. É o único gradiente multi-matiz permitido no
     chrome do produto: não comunica marca nem valor, comunica "isto responde
     com IA" (componente "Campo com IA" do documento de Design System). */
  --ai-rainbow: #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #007aff, #af52de, #ff2d78, #ff3b30;

  /* Overlays */
  --overlay:              oklch(0.16 0.02 255 / 0.55);
  --overlay-strong:       oklch(0.16 0.02 255 / 0.82);

  /* ---- Escala tipográfica ---- */
  --font-display: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-body:    'Montserrat', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
  --font-logo:    'AmpleSoft Pro', 'AmplesoftPro', 'Montserrat', sans-serif; /* uso exclusivo: .cos-header-title (logo/marca) */

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  --text-3xs: 0.625rem;  /* 10px */
  --text-2xs: 0.6875rem; /* 11px */
  --text-xs:  0.75rem;   /* 12px */
  --text-sm:  0.875rem;  /* 14px */
  --text-base:1rem;      /* 16px */
  --text-lg:  1.125rem;  /* 18px */
  --text-xl:  1.25rem;   /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 2rem;      /* 32px */

  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-caps: 0.14em;

  /* ---- Espaçamento (base 4px) ---- */
  --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;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ---- Raios ---- */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* ---- Sombras (ancoradas no navy) ---- */
  --shadow-xs: 0 1px 2px oklch(0.26 0.076 255 / 0.06);
  --shadow-sm: 0 1px 3px oklch(0.26 0.076 255 / 0.10), 0 1px 2px oklch(0.26 0.076 255 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.26 0.076 255 / 0.10), 0 2px 4px oklch(0.26 0.076 255 / 0.06);
  --shadow-lg: 0 12px 28px oklch(0.26 0.076 255 / 0.14), 0 4px 8px oklch(0.26 0.076 255 / 0.08);
  --shadow-xl: 0 24px 56px oklch(0.26 0.076 255 / 0.20);
  --shadow-focus: 0 0 0 3px oklch(0.711 0.159 231 / 0.45);

  /* ---- Movimento ---- */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;

  color-scheme: light;
}

/* ==========================================================================
   3. Somente modo claro — suporte a tema escuro removido intencionalmente
   (nem preferência do sistema, nem data-theme/classe explícita alteram os
   tokens acima; --background/--foreground etc. permanecem sempre os do
   modo claro definidos na seção 2).
   ========================================================================== */

/* ==========================================================================
   4. RESET / BASE — escopado em .cos-scope para não brigar com o Bootstrap
   --------------------------------------------------------------------------
   Aplique a classe `cos-scope` no <body> (ou num contêiner raiz) das telas
   novas. Assim os estilos base só valem onde você quer o novo padrão, sem
   afetar telas legadas que ainda dependem do Bootstrap/style.css antigo.
   ========================================================================== */
.cos-scope {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.cos-scope *,
.cos-scope *::before,
.cos-scope *::after {
  box-sizing: border-box;
}
/* :where() zera a especificidade do seletor de tags — assim qualquer classe de
   componente (ex.: .cos-header-title) sempre pode sobrescrever a cor padrão do
   heading sem depender de ordem no arquivo ou de !important. */
.cos-scope :where(h2, h3, h4, h5, h6) {
  margin: 0;
}
/* :where() zera a especificidade aqui também — sem isso, este seletor
   (classe + tag) vence qualquer botão/link de componente de classe única
   (ex.: .cos-btn--accent, .card-link), fazendo o texto herdar a cor de link
   genérica em vez da cor do próprio componente. */
:where(.cos-scope a) {
  color: var(--accent);
  text-decoration: none;
}
:where(.cos-scope a):hover { color: var(--accent-hover); text-decoration: underline; }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--muted); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--foreground-subtle); }

/* Suporte para Firefox e navegadores modernos */
html, body {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--muted);
  overflow-x: hidden;
}

/* Container utilitário */
.cos-container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Movimento reduzido (ui.md §12.3) */
@media (prefers-reduced-motion: reduce) {
  .cos-scope *,
  .cos-scope *::before,
  .cos-scope *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   5. TIPOGRAFIA UTILITÁRIA
   ========================================================================== */
.cos-kicker {
  font: var(--fw-bold) var(--text-3xs)/1 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--accent);
}
.cos-title {
  font: var(--fw-extrabold) var(--text-2xl)/var(--leading-tight) var(--font-display);
  letter-spacing: var(--tracking-tight);
  color: var(--foreground-strong);
}
.cos-subtitle {
  font: var(--fw-bold) var(--text-lg)/var(--leading-tight) var(--font-display);
  color: var(--foreground-strong);
}
.cos-text-muted { color: var(--foreground-muted); }
.cos-mono { font-family: var(--font-mono); }

/* ==========================================================================
   6. BOTÕES
   ========================================================================== */
.cos-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-5);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
  user-select: none;
}
.cos-btn:hover { text-decoration: none; }
.cos-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.cos-btn:disabled,
.cos-btn.is-loading { opacity: 0.6; pointer-events: none; }
.cos-btn.is-loading { cursor: progress; }
.cos-btn--sm { height: 36px; font-size: var(--text-xs); padding: 0 var(--space-4); }
.cos-btn--block { width: 100%; }

/* Primária (navy) */
.cos-btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.cos-btn--primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cos-btn--primary:active { background: var(--primary-active); transform: translateY(0) scale(0.98); box-shadow: none; }

/* Acento (cyan — CTA vivo) */
.cos-btn--accent {
  background: var(--accent);
  color: var(--accent-foreground);
}
.cos-btn--accent:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.cos-btn--accent:active { background: var(--accent-active); transform: translateY(0) scale(0.98); }

/* Secundária (outline) */
.cos-btn--secondary {
  background: transparent;
  color: var(--secondary-foreground);
  border-color: var(--primary);
}
.cos-btn--secondary:hover { background: var(--primary); color: var(--primary-foreground); }

/* Ghost */
.cos-btn--ghost {
  background: transparent;
  color: var(--foreground-muted);
}
.cos-btn--ghost:hover { background: var(--muted); color: var(--foreground-strong); }

/* Perigo */
.cos-btn--danger {
  background: var(--danger);
  color: var(--danger-foreground);
}
.cos-btn--danger:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ==========================================================================
   7. CAMPOS DE FORMULÁRIO
   ========================================================================== */
.cos-field { display: flex; flex-direction: column; gap: var(--space-2); }
.cos-label {
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: var(--text-xs);
  color: var(--foreground-strong);
}
.cos-input,
.cos-select,
.cos-textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--foreground-strong);
  background: var(--card);
  border: 2px solid var(--input);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.cos-textarea { min-height: 96px; resize: vertical; }
.cos-input::placeholder,
.cos-textarea::placeholder { color: var(--foreground-placeholder); }
.cos-input:focus,
.cos-select:focus,
.cos-textarea:focus {
  border-color: var(--ring);
  box-shadow: var(--shadow-focus);
}
.cos-input[aria-invalid="true"],
.cos-field.is-invalid .cos-input { border-color: var(--danger); }
.cos-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236D6E71' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
.cos-hint { font-size: var(--text-2xs); color: var(--foreground-muted); }
.cos-error-text { font-size: var(--text-2xs); color: var(--danger-strong); }

/* ==========================================================================
   8. CARTÕES E PAINÉIS
   ========================================================================== */
.cos-card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.cos-card--interactive {
  transition: transform var(--dur-base) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard),
              border-color var(--dur-base) var(--ease-standard);
}
.cos-card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.cos-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Cabeçalho de seção com barra de acento */
.cos-section-header {
  border-left: 4px solid var(--accent);
  padding-left: var(--space-4);
  margin-bottom: var(--space-1);
}
.cos-section-title {
  font: var(--fw-extrabold) var(--text-xl)/1.2 var(--font-display);
  font-size: var(--text-2xl);
  text-transform: uppercase;
}
.cos-section-desc { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--foreground-muted); }

/* ==========================================================================
   9. CABEÇALHO INSTITUCIONAL (hero navy)
   ========================================================================== */
.cos-header {
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 55%, var(--navy-700) 100%);
  color: var(--foreground-on-brand);
  padding: var(--space-10) var(--space-6) var(--space-16);
}
.cos-header .cos-kicker { color: var(--cyan-300); }
.cos-header-title {
  /* fw-bold (700) porque é o único peso de AmpleSoft Pro embutido — ver seção 0 */
  font: var(--fw-bold) var(--text-3xl)/var(--leading-tight) var(--font-logo);
  text-transform: uppercase;
  letter-spacing: var(--tracking-tight);
  color: var(--foreground-on-brand);
}
.cos-header-desc {
  margin-top: var(--space-3);
  max-width: 640px;
  color: oklch(0.85 0.05 255);
  font-size: var(--text-base);
}

/* ==========================================================================
   10. BADGES E PILLS
   ========================================================================== */
.cos-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font: var(--fw-bold) var(--text-3xs)/1.4 var(--font-display);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  background: var(--muted);
  color: var(--muted-foreground);
}
/* Texto de badge é pequeno (10px) e em caixa-alta: exige 4.5:1, daí os tokens
   --*-strong em vez dos passos médios. */
.cos-badge--success { background: var(--success-surface); color: var(--success-strong); }
.cos-badge--warning { background: var(--warning-surface); color: var(--warning-strong); }
.cos-badge--danger  { background: var(--danger-surface);  color: var(--danger-strong); }
.cos-badge--info    { background: var(--info-surface);    color: var(--info-strong); }

/* Placa (componente-assinatura, herdado do padrão validado) */
.cos-plate {
  display: inline-flex;
  flex-direction: column;
  border: 2px solid var(--navy-900);
  border-radius: 5px;
  overflow: hidden;
  background: var(--neutral-0);
  box-shadow: var(--shadow-sm);
}
.cos-plate-top {
  background: var(--navy-600);
  color: var(--neutral-0);
  font: var(--fw-bold) 7px/1 var(--font-display);
  letter-spacing: 0.22em;
  text-align: center;
  padding: 3px 0;
  text-transform: uppercase;
}
.cos-plate-value {
  font: var(--fw-bold) 18px/1 var(--font-mono);
  letter-spacing: 0.08em;
  padding: 5px 10px;
  text-align: center;
  color: var(--navy-950);
}

/* ==========================================================================
   11. TABS
   ========================================================================== */
.cos-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); background: var(--muted); }
.cos-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  font: var(--fw-bold) var(--text-sm)/1 var(--font-display);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--foreground-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.cos-tab:hover { color: var(--foreground-strong); }
.cos-tab.active {
  color: var(--foreground-strong);
  background: var(--card);
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   12. TABELAS
   ========================================================================== */
.cos-table-wrap { overflow-x: auto; }
.cos-table { width: 100%; border-collapse: collapse; }
.cos-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font: var(--fw-bold) var(--text-3xs)/1 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--foreground-muted);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.cos-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
}
.cos-table tbody tr { transition: background var(--dur-fast); }
.cos-table tbody tr:hover { background: var(--muted); }
.cos-table td.cos-mono { font-family: var(--font-mono); font-weight: var(--fw-bold); color: var(--foreground-strong); }

/* ==========================================================================
   13. KPIs
   ========================================================================== */
.cos-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}
.cos-kpi {
  background: var(--card);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.cos-kpi-label {
  font: var(--fw-bold) var(--text-3xs)/1.35 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--foreground-muted);
}
.cos-kpi-value {
  font: var(--fw-extrabold) var(--text-2xl)/1 var(--font-display);
  color: var(--foreground-strong);
}

/* ==========================================================================
   14. MODAL / OVERLAY (inclui mutex visual — ui.md §9.2)
   ========================================================================== */
.cos-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-standard);
}
.cos-overlay.is-visible { opacity: 1; }
.cos-overlay[hidden] { display: none; }

.cos-modal {
  position: fixed;
  z-index: 201;
  top: 50%;
  left: 50%;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  transform: translate(-50%, calc(-50% + 12px)) scale(0.985);
  opacity: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  transition: opacity var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-out);
}
.cos-modal.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cos-modal[hidden] { display: none; }
.cos-modal-header {
  padding: var(--space-5) var(--space-6);
  color: var(--foreground-on-brand);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  border-bottom: 3px solid var(--accent);
}
.cos-modal-body { overflow-y: auto; padding: var(--space-6); }

/* ==========================================================================
   15. FEEDBACK / LOADING (implementa o guia do ui.md)
   ========================================================================== */

/* 15.1 Spinner (ui.md §2.3) — use dentro do botão para ações curtas */
.cos-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: cos-spin 0.7s linear infinite;
}
.cos-spinner--lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes cos-spin { to { transform: rotate(360deg); } }

/* 15.2 Skeleton (ui.md §2.2 / §13) — pulso suave, preserva altura */
.cos-skeleton {
  background: var(--muted);
  border-radius: var(--radius-md);
  animation: cos-pulse 1.5s var(--ease-standard) infinite;
}
.cos-skeleton--text { height: 0.9em; margin: 0.25em 0; }
.cos-skeleton--line { height: 1rem; }
.cos-skeleton--block { min-height: 120px; } /* evita layout shift */
@keyframes cos-pulse { 0%,100% { opacity: 0.55; } 50% { opacity: 1; } }

/* 15.3 Barra de progresso (ui.md §2.5) */
.cos-progress {
  width: 100%;
  height: 8px;
  background: var(--muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cos-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--dur-slow) var(--ease-out);
}
.cos-progress.is-indeterminate .cos-progress-bar {
  width: 40%;
  animation: cos-indeterminate 1.2s var(--ease-standard) infinite;
}
.cos-progress.is-error .cos-progress-bar { background: var(--danger); }
@keyframes cos-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

/* 15.4 Ponto pulsante (status "ao vivo") */
.cos-pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: cos-pulse 2s var(--ease-standard) infinite;
}

/* 15.5 Banner de estado (erro/aviso/info/sucesso — ui.md §3 e §5.2) */
.cos-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--info-strong);
  background: var(--info-surface);
  color: var(--info-strong);
}
.cos-banner--success { border-left-color: var(--success-strong); background: var(--success-surface); color: var(--success-strong); }
.cos-banner--warning { border-left-color: var(--warning-strong); background: var(--warning-surface); color: var(--warning-strong); }
.cos-banner--danger  { border-left-color: var(--danger-strong);  background: var(--danger-surface);  color: var(--danger-strong); }

/* 15.6 Toast (ui.md §3.1 / §10) */
.cos-toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.cos-toast--success { border-left-color: var(--success); }
.cos-toast--danger  { border-left-color: var(--danger); }

/* 15.7 Estado vazio (ui.md §4) — sempre com ação de saída */
.cos-empty {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--foreground-muted);
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

/* 15.8 Realce de item novo (ui.md §10.2) */
.cos-highlight-new { animation: cos-highlight 1s var(--ease-out); }
@keyframes cos-highlight {
  0% { background: var(--info-surface); }
  100% { background: transparent; }
}

/* ==========================================================================
   16. HERO INSTITUCIONAL COM STATUS (variação do §9 com faixa de status)
   --------------------------------------------------------------------------
   Mesmo gradiente institucional do .cos-header, mas em cartão arredondado e
   com espaço para um selo de status "ao vivo" à direita. O título usa
   --font-display (Montserrat), NUNCA --font-logo: AmpleSoft Pro é exclusiva
   do logotipo (ui.md §4).
   ========================================================================== */
.cos-hero {
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 55%, var(--navy-700) 100%);
  color: var(--foreground-on-brand);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  box-shadow: var(--shadow-md);
}
.cos-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.cos-hero .cos-kicker { color: var(--cyan-300); }
.cos-hero-title {
  margin-top: var(--space-2);
  font: var(--fw-extrabold) var(--text-2xl)/1.15 var(--font-display);
  letter-spacing: var(--tracking-tight);
  text-transform: uppercase;
  color: var(--foreground-on-brand);
}
.cos-hero-desc {
  margin: var(--space-3) 0 0;
  max-width: 62ch;
  font-size: var(--text-sm);
  color: oklch(0.85 0.05 255);
}
.cos-hero-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid oklch(1 0 0 / 0.18);
  border-radius: var(--radius-pill);
  background: oklch(1 0 0 / 0.08);
  font: var(--fw-bold) var(--text-3xs)/1 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--cyan-300);
  white-space: nowrap;
}

/* ==========================================================================
   17. TABS EM PÍLULA (+ variante de IA)
   --------------------------------------------------------------------------
   Diferente do .cos-tabs (§11, abas de conteúdo em faixa): estas são abas de
   modo dentro de um painel de busca. A variante --ai recebe a borda em
   gradiente girando, assinatura de "isto responde com IA" (ui.md).
   ========================================================================== */
.cos-tabs--pill {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--muted);
  border-bottom: 2px solid var(--border-strong);
  flex-wrap: wrap;
}
.cos-tabs--pill .cos-tab {
  flex: 1 1 200px;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-md);
  background: transparent;
}
.cos-tabs--pill .cos-tab.active {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--foreground-strong);
  box-shadow: var(--shadow-sm);
}
.cos-tabs--pill .cos-tab.active::after {
  content: '';
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: 4px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}
.cos-tabs--pill .cos-tab { position: relative; }

/* Aba de IA — arco-íris girando na borda */
.cos-tab--ai {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.cos-tab--ai::before {
  content: '';
  position: absolute;
  inset: -60%;
  z-index: -1;
  background: conic-gradient(from 0deg, var(--ai-rainbow));
  animation: cos-ai-spin 3.2s linear infinite;
}
.cos-tab--ai::after {
  content: '';
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: calc(var(--radius-md) - 1px);
  background: var(--muted);
}
.cos-tab--ai.active::after { background: var(--card); }
@keyframes cos-ai-spin { to { transform: rotate(360deg); } }

/* 17.1 Borda de IA em arco-íris girando, para superfícies grandes
   --------------------------------------------------------------------------
   Técnica de duas camadas de background (padding-box + border-box) em vez de
   pseudo-elemento: funciona dentro de container com overflow: hidden e não
   disputa z-index com o conteúdo. O ângulo é uma custom property registrada,
   porque conic-gradient só é animável assim. Onde @property não existe, a
   borda fica com o arco-íris estático — degradação aceitável. */
@property --cos-ai-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.cos-ai-border {
  border-color: transparent !important;
  background-image:
    linear-gradient(var(--card), var(--card)),
    conic-gradient(from var(--cos-ai-angle), var(--ai-rainbow));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  animation: cos-ai-rotate 4s linear infinite;
}
@keyframes cos-ai-rotate { to { --cos-ai-angle: 360deg; } }

@media (prefers-reduced-motion: reduce) {
  .cos-tab--ai::before,
  .cos-ai-border { animation: none; }
}

/* Contador ao lado do rótulo da aba (ex.: "Correlações 12") */
.cos-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--info-surface);
  color: var(--info-strong);
  font-size: var(--text-3xs);
  font-weight: var(--fw-bold);
}

/* Painéis de conteúdo controlados por aba */
.cos-tabpanel[hidden] { display: none; }

/* ==========================================================================
   18. ACORDEÃO
   ========================================================================== */
.cos-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  overflow: hidden;
}
.cos-accordion-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--muted);
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--foreground-strong);
  transition: background var(--dur-fast) var(--ease-standard);
}
.cos-accordion-trigger:hover { background: var(--secondary-hover); }
.cos-accordion-trigger:focus-visible { outline: 3px solid var(--ring); outline-offset: -3px; }
.cos-accordion-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font: var(--fw-bold) var(--text-xs)/1 var(--font-display);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.cos-accordion-side {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  color: var(--foreground-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.cos-accordion-chevron {
  transition: transform var(--dur-base) var(--ease-out);
  color: var(--foreground-subtle);
  flex: 0 0 auto;
}
.cos-accordion-trigger[aria-expanded="true"] .cos-accordion-chevron { transform: rotate(180deg); }
.cos-accordion-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
}
.cos-accordion-panel.is-open { opacity: 1; }
.cos-accordion-body { padding: var(--space-5); border-top: 1px solid var(--border); }

/* ==========================================================================
   19. MATRIZ DE CALOR (dia da semana × hora)
   --------------------------------------------------------------------------
   Células quadradas de largura idêntica: as 24 colunas vêm de
   grid-template-columns, nunca do conteúdo. A intensidade é definida por
   data-level (0 = sem leitura, 1..5 = faixas de % sobre o total).
   ========================================================================== */
.cos-matrix-wrap { overflow-x: auto; }
.cos-matrix {
  min-width: 620px;
  display: grid;
  grid-template-columns: 42px repeat(24, 1fr);
  gap: 3px;
  align-items: center;
}
.cos-matrix-corner { min-height: 16px; }
.cos-matrix-hour,
.cos-matrix-day {
  /* 9px em --foreground-muted (9.22:1). Antes eram 8px em --foreground-subtle,
     que mede 2.31:1 sobre branco — rótulo de eixo tem de ser legível. */
  font: var(--fw-semibold) 9px/1 var(--font-mono);
  color: var(--foreground-muted);
  text-align: center;
  user-select: none;
}
.cos-matrix-day {
  font-family: var(--font-display);
  font-size: var(--text-3xs);
  font-weight: var(--fw-bold);
  color: var(--foreground-strong);
  text-align: right;
  padding-right: var(--space-2);
}
.cos-matrix-cell {
  aspect-ratio: 1 / 1;
  min-height: 16px;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--heat-0);
  cursor: default;
  font: var(--fw-bold) 8px/1 var(--font-display);
  color: var(--foreground-on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Escala sequencial de matiz única (--heat-*): magnitude se lê pela luminosidade,
   não pela matiz. O nível 0 é cinza, para "sem leitura" nunca ser confundido com
   "pouca leitura". */
.cos-matrix-cell[data-level="1"] { background: var(--heat-1); }
.cos-matrix-cell[data-level="2"] { background: var(--heat-2); }
.cos-matrix-cell[data-level="3"] { background: var(--heat-3); }
.cos-matrix-cell[data-level="4"] { background: var(--heat-4); }
.cos-matrix-cell[data-level="5"] { background: var(--heat-5); }
.cos-matrix-cell--interactive {
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-standard), box-shadow var(--dur-fast) var(--ease-standard);
}
.cos-matrix-cell--interactive:hover { transform: scale(1.22); box-shadow: var(--shadow-md); z-index: 2; }
.cos-matrix-cell--interactive:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; z-index: 3; }
.cos-matrix-cell.is-active {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  transform: scale(1.18);
  z-index: 2;
}
.cos-matrix-legend {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--text-3xs);
  color: var(--foreground-muted);
  flex-wrap: wrap;
}
.cos-matrix-legend-scale {
  display: flex;
  gap: 2px;
}
/* A legenda reaproveita as cores de .cos-matrix-cell via data-level, mas não a
   geometria quadrada dela — daí os resets abaixo. */
.cos-matrix-legend-step {
  width: 18px;
  height: 10px;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 2px;
}

/* ==========================================================================
   20. GRÁFICO DE BARRAS (distribuições por hora / dia da semana)
   ========================================================================== */
.cos-bar-chart {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--space-2);
  align-items: stretch;
}
.cos-bar-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  height: 96px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: var(--foreground-muted);
  user-select: none;
}
.cos-bar-plot {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 132px;
  padding-top: 18px;
  border-bottom: 1px solid var(--border);
}
.cos-bar-grid {
  position: absolute;
  inset: 18px 0 0 0;
  height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
/* Fio contínuo, não tracejado: tracejado vira ruído e é lido como "projeção"
   ou "limite" quando é só grade. */
.cos-bar-grid span { border-top: 1px solid var(--border); }
.cos-bar-col {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  height: 100%;
}
/* Rótulo direto é SELETIVO (só o pico), nunca um número em cada barra: 24 números
   numa linha viram ruído e ninguém lê. O resto sai no eixo e no hover. */
.cos-bar-count {
  font-size: 9px;
  font-weight: var(--fw-bold);
  color: var(--foreground-muted);
  font-variant-numeric: tabular-nums;
}
.cos-bar {
  width: 100%;
  /* Extremidade arredondada de 4px ancorada na base. */
  border-radius: 4px 4px 0 0;
  background: var(--border-strong);
  transition: height var(--dur-slow) var(--ease-out), background var(--dur-fast);
}
/* --accent (cyan-500) mede 2.45:1 sobre branco e reprovaria o mínimo de 3:1 para
   marca de gráfico; --accent-active (cyan-700) mede 5.21:1. */
.cos-bar.is-filled { background: var(--accent-active); }
.cos-bar-col:hover .cos-bar.is-filled { background: var(--cyan-800); }
.cos-bar-label { font-size: 9px; color: var(--foreground-muted); }

/* ==========================================================================
   21. RANKING — lista numerada e barras comparativas
   ========================================================================== */
.cos-rank-list { display: flex; flex-direction: column; }
.cos-rank-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.cos-rank-item:last-child { border-bottom: none; }
.cos-rank-item:hover { background: var(--muted); }
.cos-rank-item:focus-visible { outline: 3px solid var(--ring); outline-offset: -3px; }
.cos-rank-num {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-foreground);
  font: var(--fw-extrabold) 10px/1 var(--font-display);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* display explícito em todos os filhos: estes componentes são montados dentro
   de <button>, cujo conteúdo tem de ser phrasing content (<span>) — spans são
   inline por padrão e sem isso altura, overflow e ellipsis não se aplicam. */
.cos-rank-body { display: block; flex: 1; min-width: 0; }
.cos-rank-title {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--foreground-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cos-rank-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: 2px;
  font-size: var(--text-3xs);
  color: var(--foreground-muted);
}
.cos-rank-bar-track {
  display: block;
  height: 8px;
  margin-top: var(--space-2);
  background: var(--muted);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cos-rank-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-active);
  transition: width var(--dur-slow) var(--ease-out);
}
/* Passos que limpam 3:1 sobre a superfície branca do cartão. A cor aqui é estado
   (nível de força), não identidade — e vem sempre acompanhada do rótulo do nível,
   nunca sozinha. */
.cos-rank-bar-fill--danger  { background: var(--danger-strong); }
.cos-rank-bar-fill--warning { background: var(--warning-strong); }
.cos-rank-bar-fill--info    { background: var(--info-strong); }

/* ==========================================================================
   22. LINHA DO TEMPO (uma faixa por entidade, um ponto por evento)
   ========================================================================== */
.cos-timeline { display: flex; flex-direction: column; gap: var(--space-3); }
.cos-timeline-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: var(--space-4);
  align-items: center;
}
.cos-timeline-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
  color: var(--foreground-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cos-timeline-track {
  position: relative;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--muted);
}
.cos-timeline-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  padding: 0;
  /* Anel de 2px na cor da superfície separa pontos que se sobrepõem, em vez de
     uma borda desenhada em volta da marca. */
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--accent-active);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.cos-timeline-dot:hover { transform: scale(1.5); z-index: 2; }
.cos-timeline-dot:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; z-index: 3; }
.cos-timeline-dot--danger  { background: var(--danger-strong); }
.cos-timeline-dot--warning { background: var(--warning-strong); }
.cos-timeline-ruler {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: var(--space-4);
  margin-top: var(--space-2);
}
.cos-timeline-ruler-scale {
  display: flex;
  justify-content: space-between;
  font: var(--fw-bold) var(--text-3xs)/1 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--foreground-muted);
}

/* ==========================================================================
   23. SIDE-SHEET (gaveta lateral)
   ========================================================================== */
.cos-sidesheet {
  position: fixed;
  z-index: 201;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(560px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--card);
  color: var(--card-foreground);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  transform: translateX(16px);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-standard),
              transform var(--dur-slow) var(--ease-out);
}
.cos-sidesheet.is-visible { transform: translateX(0); opacity: 1; }
.cos-sidesheet[hidden] { display: none; }
.cos-sidesheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  color: var(--foreground-on-brand);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  border-bottom: 3px solid var(--accent);
}
.cos-sidesheet-body { flex: 1; overflow-y: auto; padding: var(--space-6); }
.cos-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: currentColor;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.cos-icon-btn:hover { background: oklch(1 0 0 / 0.12); }
.cos-icon-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
@media (max-width: 640px) {
  .cos-sidesheet { width: 100vw; border-left: none; }
}

/* ==========================================================================
   24. LIGHTBOX DE IMAGEM
   ========================================================================== */
.cos-lightbox {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background: var(--overlay-strong);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-standard);
}
.cos-lightbox.is-visible { opacity: 1; }
.cos-lightbox[hidden] { display: none; }
.cos-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}
.cos-lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  color: var(--foreground-on-brand);
}

/* ==========================================================================
   25. TOOLTIP INFORMATIVO (explica conceito não óbvio — ui.md / Nielsen #10)
   ========================================================================== */
.cos-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
}
.cos-tooltip-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 9px;
  font-weight: var(--fw-bold);
  line-height: 1;
}
.cos-tooltip-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  z-index: 60;
  width: max-content;
  max-width: 260px;
  padding: var(--space-2) var(--space-3);
  background: var(--navy-900);
  color: var(--foreground-on-brand);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font: var(--fw-medium) var(--text-2xs)/1.45 var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-standard), transform var(--dur-fast) var(--ease-out);
}
.cos-tooltip-wrap:hover .cos-tooltip-bubble,
.cos-tooltip-wrap:focus-visible .cos-tooltip-bubble {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   26. CHIP DE METADADO / FILTRO
   ========================================================================== */
.cos-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  color: var(--foreground);
  white-space: nowrap;
}
.cos-chip strong {
  font-size: var(--text-3xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--foreground-muted);
}
.cos-chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ==========================================================================
   27. FITA DE ASSINATURA (24 colunas de intensidade)
   ========================================================================== */
.cos-stat-strip {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  align-items: end;
  height: 44px;
}
.cos-stat-strip-col {
  background: var(--accent-active);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height var(--dur-slow) var(--ease-out);
}
.cos-stat-strip-col[data-empty="1"] { background: var(--heat-0); }
.cos-stat-strip-scale {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--foreground-muted);
}
.cos-day-pills { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.cos-day-pill {
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--muted);
  color: var(--foreground-muted);
  font: var(--fw-bold) var(--text-3xs)/1.5 var(--font-display);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.cos-day-pill.is-on { background: var(--info-surface); color: var(--info-strong); }

/* Linhas rótulo/valor (usado no cartão de DNA e em resumos densos) */
.cos-deflist { display: flex; flex-direction: column; }
.cos-deflist-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}
.cos-deflist-row:last-child { border-bottom: none; }
.cos-deflist-key {
  display: block;
  font: var(--fw-bold) var(--text-3xs)/1.4 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--foreground-muted);
  white-space: nowrap;
}
.cos-deflist-val {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--foreground-strong);
  text-align: right;
}

/* ==========================================================================
   28. PAGINAÇÃO
   ========================================================================== */
.cos-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  background: var(--muted);
}
.cos-pagination-info { font-size: var(--text-xs); color: var(--foreground-muted); }
.cos-pagination-nav { display: flex; gap: var(--space-1); align-items: center; }
.cos-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--foreground-strong);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.cos-page-btn:hover:not(:disabled) { background: var(--secondary-hover); border-color: var(--border-strong); }
.cos-page-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.cos-page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.cos-page-btn.is-current {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

/* ==========================================================================
   29. UTILITÁRIOS DE ACESSIBILIDADE
   ========================================================================== */
.cos-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
[aria-busy="true"] { cursor: progress; }
