/* Camada de acabamento (22/11/2026): profundidade, brilho de acento e microinterações. Só CSS e só propriedades baratas
   (transform, opacity, clip-path), sem bibliotecas. Respeita "reduzir movimento". Vem depois de design.css. */
@layer components {
  /* superfícies com profundidade */
  .card {
    background: linear-gradient(180deg, color-mix(in oklch, var(--surface-1) 93%, var(--text)) 0%, var(--surface-1) 42%);
    border-color: color-mix(in oklch, var(--border) 78%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in oklch, var(--text) 7%, transparent), var(--shadow-1);
    transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
  }
  .page-head h1 { background: linear-gradient(90deg, var(--text), color-mix(in oklch, var(--text) 52%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }

  /* indicadores do painel: brilho de cor, ícone em ficha e leve elevação ao passar o mouse */
  .kpi { position: relative; overflow: hidden; --cor: var(--accent); }
  .kpi::after { content: ""; position: absolute; right: -22%; bottom: -55%; width: 75%; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
    background: radial-gradient(closest-side, color-mix(in oklch, var(--cor) 30%, transparent), transparent); transition: transform 0.45s var(--ease); }
  .kpi:hover { transform: translateY(-3px); border-color: color-mix(in oklch, var(--cor) 50%, var(--border)); box-shadow: var(--shadow-2); }
  .kpi:hover::after { transform: scale(1.3); }
  .kpi .rotulo svg { width: 26px; height: 26px; padding: 5px; border-radius: 8px; color: var(--cor); background: color-mix(in oklch, var(--cor) 16%, transparent); }
  .bento > .kpi:nth-child(2) { --cor: var(--accent-2); }
  .bento > .kpi:nth-child(3) { --cor: var(--warning); }
  .bento > .kpi:nth-child(4) { --cor: var(--success); }
  .kpi .valor { text-shadow: 0 0 28px color-mix(in oklch, var(--cor) 35%, transparent); }

  /* entrada escalonada das telas */
  .content > * { animation: entrar 0.38s var(--ease) both; }
  .content > *:nth-child(2) { animation-delay: 0.05s; }
  .content > *:nth-child(3) { animation-delay: 0.1s; }
  .bento > * { animation: entrar 0.45s var(--ease) both; }
  .bento > *:nth-child(2) { animation-delay: 0.05s; } .bento > *:nth-child(3) { animation-delay: 0.1s; } .bento > *:nth-child(4) { animation-delay: 0.15s; }
  .bento > *:nth-child(5) { animation-delay: 0.2s; } .bento > *:nth-child(6) { animation-delay: 0.25s; } .bento > *:nth-child(n + 7) { animation-delay: 0.3s; }
  @keyframes entrar { from { opacity: 0; transform: translateY(10px); } }
  .content:focus, .content:focus-visible { outline: none; }

  /* menu lateral */
  .nav a.item { transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease); }
  .nav a.item svg { transition: transform 0.2s var(--ease), color 0.16s var(--ease); }
  .nav a.item:hover { transform: translateX(2px); }
  .nav a.item:hover svg { transform: scale(1.12); color: var(--accent); }
  .nav a.item[aria-current="page"] { background: linear-gradient(90deg, color-mix(in oklch, var(--accent) 26%, transparent), color-mix(in oklch, var(--accent) 5%, transparent)); }
  .nav a.item[aria-current="page"] svg { color: var(--accent); }
  .tabbar a, .tabbar button { position: relative; transition: color 0.15s, transform 0.12s; }
  .tabbar a:active, .tabbar button:active { transform: scale(0.94); }
  .tabbar [aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px; border-radius: 0 0 4px 4px; background: var(--accent); }

  /* botões */
  .btn { transition: background 0.16s var(--ease), transform 0.12s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease), filter 0.16s; }
  .btn:hover { transform: translateY(-1px); border-color: color-mix(in oklch, var(--accent) 40%, var(--border)); }
  .btn:active { transform: translateY(1px) scale(0.985); }
  .btn.primario { background: linear-gradient(135deg, var(--accent), color-mix(in oklch, var(--accent) 55%, var(--accent-2))); box-shadow: 0 6px 18px color-mix(in oklch, var(--accent) 34%, transparent); }
  .btn.primario:hover { filter: brightness(1.07); box-shadow: 0 10px 26px color-mix(in oklch, var(--accent) 46%, transparent); }
  .btn.perigo:hover { filter: brightness(1.08); }
  .btn.fantasma:hover { transform: none; }
  .chip { transition: background 0.15s, border-color 0.15s, transform 0.12s; }
  .chip:active { transform: scale(0.96); }

  /* tabelas e listas */
  tbody tr { transition: background 0.12s; }
  tbody tr:hover { background: color-mix(in oklch, var(--accent) 7%, transparent); }
  .lista > * { transition: padding-left 0.16s var(--ease); }
  .lista > a:hover, .lista > div:hover { padding-left: var(--s-2); }
  .badge { letter-spacing: 0.01em; }

  /* barras e gráfico animados */
  .barra > span { width: 100%; transform-origin: left center; transform: scaleX(calc(var(--p, 0) / 100)); transition: transform 0.7s var(--ease);
    background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: crescer 0.9s var(--ease) both; }
  @keyframes crescer { from { transform: scaleX(0); } }
  .spark { animation: revelar 0.9s var(--ease) 0.15s both; }
  @keyframes revelar { from { clip-path: inset(0 100% 0 0); } }

  /* avisos */
  .toast { animation: avisoEntra 0.28s var(--ease) both; }
  @keyframes avisoEntra { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
  .modal { animation: modalEntra 0.22s var(--ease) both; }
  @keyframes modalEntra { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

  /* cabeçalho da página Empresa: a logo do cliente sobre o azul-marinho do uniforme */
  .empresa-cab { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5); color: #fff; border-color: color-mix(in oklch, var(--accent) 35%, var(--border));
    background: radial-gradient(500px 220px at 12% 50%, color-mix(in oklch, var(--accent) 22%, transparent), transparent 70%), linear-gradient(135deg, #0b1430, #142a6b 70%, #0a1226); }
  /* gerador de códigos de barras */
  .copias { width: 76px; min-height: 36px; text-align: center; }
  .previa-wrap { display: grid; place-items: center; gap: var(--s-2); min-height: 150px; background: #fff; color: #334155; }
  .previa-wrap .muted { color: #475569; }
  .previa-codigo { max-width: min(100%, 420px); height: auto; }

  .empresa-grade { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
  .empresa-cab img { width: min(230px, 60%); height: auto; filter: drop-shadow(0 8px 24px rgb(46 168 250 / 0.3)); }
  .empresa-cab h2 { color: #fff; margin-bottom: var(--s-1); }
  .empresa-cab .muted { color: #cfe0ff; }

  * { scrollbar-width: thin; scrollbar-color: color-mix(in oklch, var(--muted) 45%, transparent) transparent; }
}

@layer utilities {
  @media (prefers-reduced-motion: reduce) {
    .content > *, .bento > *, .toast, .modal, .spark, .barra > span { animation: none; }
    .card, .btn, .nav a.item, .nav a.item svg, .kpi::after { transition: none; }
    .kpi:hover, .btn:hover, .nav a.item:hover { transform: none; }
  }
}
