/* motion.css — transições de tela, host/fallback da cena 3D e utilitários de movimento.
   Tokens vêm do styles.css (--ease-out, --dur-1..3); aqui só há fallbacks. */

/* ── View Transitions (Motion.swap) ───────────────────────────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--dur-2, 240ms);
  animation-timing-function: var(--ease-out, cubic-bezier(.2,.8,.2,1));
}
::view-transition-old(root) { animation-name: motion-vt-out; }
::view-transition-new(root) { animation-name: motion-vt-in; }

@keyframes motion-vt-out { to   { opacity: 0; transform: translateY(-6px); } }
@keyframes motion-vt-in  { from { opacity: 0; transform: translateY(8px); } }

/* ── Cena 3D (scene3d.js) ─────────────────────────────────────── */
/* :where() = especificidade zero → qualquer regra de layout do próprio componente vence */
:where(.scene3d-host, .scene3d-fallback) { position: relative; isolation: isolate; overflow: hidden; }
/* conteúdo do host fica acima do canvas (z-index 0) */
:where(.scene3d-host, .scene3d-fallback) > :where(:not(.scene3d-canvas)) { position: relative; z-index: 1; }
.scene3d-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 0; }

/* Fallback estático: gradiente da marca com deriva lenta (parado em reduced motion).
   Fica num pseudo-elemento para não brigar com o background do host. */
.scene3d-fallback::before {
  content: ""; position: absolute; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 42% at 22% 28%, rgba(0,194,245,.20), transparent 70%),
    radial-gradient(46% 50% at 78% 72%, rgba(27,13,174,.22), transparent 72%),
    radial-gradient(30% 34% at 70% 18%, rgba(61,47,212,.14), transparent 70%);
  animation: motion-drift 28s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes motion-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.06); }
}
/* No painel de parede o fallback é ainda mais discreto */
.scene3d-fallback[data-scene3d-preset="wall"]::before { opacity: .5; animation-duration: 60s; }

/* ── three-system: presets de window.Scene3D (scene3d-loader.js) ──────────────
   O host ganha .scene3d-host + .s3-<preset>. Enquanto o 3D não chega (ou quando
   é barrado → .scene3d-fallback) aparece o desenho estático abaixo; quando a cena
   entra (.scene3d-live) o estático some e o canvas faz fade-in por cima.
   Os pseudo-elementos ::before/::after do host são usados por estes presets. */
:where(.s3-hero, .s3-empty, .s3-orb, .s3-network, .s3-success) {
  --s3-blue: #1B0DAE; --s3-blue-2: #5B4DF5; --s3-cyan: #00C2F5;
  --s3-track: rgba(27, 13, 174, .14);
  --s3-ok: var(--tile-ok, #17804D); --s3-pend: var(--tile-pend, #F0B323);
  --s3-stop: var(--tile-stop, #C62A1F); --s3-none: var(--tile-idle, #C9D1DF);
}
:where([data-theme="dark"], .theme-dark) :where(.s3-hero, .s3-empty, .s3-orb, .s3-network, .s3-success) {
  --s3-blue: #4436E0; --s3-blue-2: #8C85FF; --s3-track: rgba(140, 133, 255, .16);
}
:where(.s3-empty) { width: 120px; height: 120px; margin-inline: auto; }
:where(.s3-orb) { width: 72px; height: 72px; flex: 0 0 auto; }
:where(.s3-network) { min-height: 240px; }
/* celular: a cena vira vertical (estações empilhadas) → precisa de altura */
@media (max-width: 560px) { :where(.s3-network.scene3d-live) { min-height: calc(var(--s3-n, 6) * 54px + 48px); } }

/* o estático genérico (.scene3d-fallback::before) é substituído pelo de cada preset */
.scene3d-fallback:is(.s3-hero, .s3-empty, .s3-orb, .s3-network, .s3-success)::before { animation: none; inset: auto; background: none; }

/* hero — faixa de fita pontilhada azul→ciano, mais densa à direita */
.s3-hero:not(.scene3d-live)::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(42% 130% at 86% 30%, rgba(0, 194, 245, .20), transparent 62%),
    radial-gradient(40% 150% at 64% 110%, rgba(27, 13, 174, .16), transparent 66%),
    repeating-linear-gradient(104deg, transparent 0 22px, rgba(27, 13, 174, .05) 22px 23px);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 50%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 50%);
}
.s3-hero:not(.scene3d-live)::after {
  content: ""; position: absolute; inset: -30% -5%; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 194, 245, .55) 1.1px, transparent 1.8px),
                    radial-gradient(circle, rgba(27, 13, 174, .35) 1px, transparent 1.6px);
  background-size: 14px 14px, 22px 22px; background-position: 0 0, 7px 5px;
  -webkit-mask-image: radial-gradient(48% 22% at 72% 50%, #000 0%, transparent 100%);
          mask-image: radial-gradient(48% 22% at 72% 50%, #000 0%, transparent 100%);
  transform: rotate(-7deg);
  animation: s3-ribbon 26s ease-in-out infinite alternate;
}
:where([data-theme="dark"], .theme-dark) .s3-hero:not(.scene3d-live)::after { opacity: 1.0; filter: brightness(1.3); }
@keyframes s3-ribbon { from { transform: rotate(-7deg) translate3d(-2%, 0, 0); } to { transform: rotate(-4deg) translate3d(2%, 3%, 0); } }

/* empty — "peça" flutuante com volume (gradiente + brilho + aresta ciano) e sombra */
.s3-empty:not(.scene3d-live)::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; top: 44%; width: 46%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 22%;
  background:
    radial-gradient(60% 50% at 30% 22%, rgba(255, 255, 255, .55), transparent 60%),
    linear-gradient(145deg, var(--s3-blue-2), var(--s3-blue) 58%, #120880);
  box-shadow: inset 0 0 0 2px rgba(0, 194, 245, .55), inset -6px -10px 18px rgba(0, 0, 0, .25),
              0 10px 24px -8px rgba(27, 13, 174, .45);
  transform: perspective(320px) rotateX(16deg) rotateY(-22deg);
  animation: s3-float 4.2s ease-in-out infinite;
}
.s3-empty[data-s3-icon="check"]:not(.scene3d-live)::before,
.s3-empty[data-s3-icon="search"]:not(.scene3d-live)::before { border-radius: 50%; }
.s3-empty[data-s3-icon="search"]:not(.scene3d-live)::before {
  background: radial-gradient(circle, rgba(0, 194, 245, .18) 0 55%, transparent 56%), transparent;
  box-shadow: inset 0 0 0 8px var(--s3-blue), inset 0 0 0 10px rgba(0, 194, 245, .6), 0 10px 24px -10px rgba(27, 13, 174, .5);
}
.s3-empty[data-s3-icon="calendar"]:not(.scene3d-live)::before {
  border-radius: 14%;
  background:
    linear-gradient(var(--s3-blue) 0 26%, transparent 26%),
    radial-gradient(circle at 62% 62%, var(--s3-cyan) 0 7%, transparent 8%),
    radial-gradient(circle, rgba(27, 13, 174, .35) 0 6%, transparent 7%) 0 30% / 25% 22%,
    #EEF0FF;
}
.s3-empty:not(.scene3d-live)::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; bottom: 10%; width: 44%; height: 9%; translate: -50% 0; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(27, 13, 174, .22), transparent);
  animation: s3-shadow 4.2s ease-in-out infinite;
}
:where([data-theme="dark"], .theme-dark) .s3-empty:not(.scene3d-live)::after { background: radial-gradient(closest-side, rgba(0, 0, 0, .6), transparent); }
@keyframes s3-float { 50% { translate: -50% calc(-50% - 6px); } }
@keyframes s3-shadow { 50% { transform: scaleX(.86); opacity: .7; } }

/* orb — anel de KPI em conic-gradient (--s3-value 0..1) */
.s3-orb:not(.scene3d-live)::before {
  content: ""; position: absolute; inset: 9%; z-index: 0; pointer-events: none; border-radius: 50%;
  --s3-a: var(--s3-blue-2); --s3-b: var(--s3-cyan);
  background: conic-gradient(var(--s3-a), var(--s3-b) calc(var(--s3-value, 0) * 360deg), var(--s3-track) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  filter: drop-shadow(0 0 6px rgba(0, 194, 245, .35));
}
.s3-orb[data-s3-status="ok"]:not(.scene3d-live)::before   { --s3-a: var(--s3-ok);   --s3-b: var(--s3-ok); }
.s3-orb[data-s3-status="pend"]:not(.scene3d-live)::before { --s3-a: var(--s3-pend); --s3-b: var(--s3-pend); }
.s3-orb[data-s3-status="stop"]:not(.scene3d-live)::before { --s3-a: var(--s3-stop); --s3-b: var(--s3-stop); }

/* success — disco "ok" com mola + check desenhado (fallback do 3D, ≤1 s) */
.s3-success.scene3d-fallback::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; top: 50%; width: min(96px, 60%); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: var(--s3-ok);
  box-shadow: 0 0 0 0 rgba(0, 194, 245, .5), 0 12px 30px -10px rgba(23, 128, 77, .6);
  animation: s3-pop .42s cubic-bezier(.34, 1.56, .64, 1) both, s3-ring .8s .1s ease-out both;
}
.s3-success.scene3d-fallback::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: 50%; top: 50%; width: min(22px, 14%); aspect-ratio: 1 / 2;
  border: solid #fff; border-width: 0 5px 5px 0; border-radius: 2px;
  translate: -50% -62%; rotate: 45deg;
  animation: s3-check .3s .22s ease-out both;
}
@keyframes s3-pop { from { transform: scale(.2); opacity: 0; } }
@keyframes s3-ring { to { box-shadow: 0 0 0 26px rgba(0, 194, 245, 0), 0 12px 30px -10px rgba(23, 128, 77, .6); } }
@keyframes s3-check { from { clip-path: inset(100% 0 0 0); opacity: 0; } to { clip-path: inset(0 0 0 0); opacity: 1; } }

/* network — lista acessível de estações: diagrama de linha (fallback) e rótulos da cena 3D */
.s3-network { container-type: inline-size; }
.s3-net { position: relative; z-index: 1; }
.s3-network:not(.scene3d-live) > .s3-net { min-height: inherit; display: grid; align-content: center; }
.s3-net-list { list-style: none; margin: 0; padding: 10px 4px 6px; display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(76px, 1fr); overflow-x: auto; scrollbar-width: thin; }
.s3-net-item { position: relative; display: flex; justify-content: center; }
.s3-net-item::before { /* trecho do trilho até os vizinhos */
  content: ""; position: absolute; top: 20px; left: 0; right: 0; height: 4px; border-radius: 2px;
  background: var(--s3-blue-2);
  opacity: .45;
}
.s3-net-item:first-child::before { left: 50%; }
.s3-net-item:last-child::before { right: 50%; }
.s3-net-item:only-child::before { display: none; }
.s3-net-node {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 0 4px 4px; border: 0; background: none; cursor: pointer;
  color: var(--ink, #0F1433); font: inherit; text-align: center; border-radius: 12px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.s3-net-dot {
  width: 22px; height: 22px; margin-top: 11px; border-radius: 50%; flex: 0 0 auto;
  background: var(--s3-c, var(--s3-none));
  box-shadow: 0 0 0 4px var(--surface, #fff), 0 0 0 5px rgba(0, 0, 0, .06);
  transition: transform var(--dur-1, 150ms) var(--ease-out, ease-out);
}
.s3-net-node[data-status="ok"]   { --s3-c: var(--s3-ok); }
.s3-net-node[data-status="pend"] { --s3-c: var(--s3-pend); }
.s3-net-node[data-status="stop"] { --s3-c: var(--s3-stop); }
.s3-net-node[data-status="stop"] .s3-net-dot { animation: s3-alarm 1.6s ease-out infinite; }
@keyframes s3-alarm { 0% { box-shadow: 0 0 0 4px var(--surface, #fff), 0 0 0 4px rgba(198, 42, 31, .55); }
                      100% { box-shadow: 0 0 0 4px var(--surface, #fff), 0 0 0 14px rgba(198, 42, 31, 0); } }
.s3-net-node:hover .s3-net-dot { transform: scale(1.15); }
.s3-net-node:focus-visible { outline: 3px solid var(--focus, #00C2F5); outline-offset: 2px; }
.s3-net-label { font-size: 12px; font-weight: 600; line-height: 1.2; max-width: 11ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.s3-net-val { font: 500 11px/1.2 var(--mono, 'IBM Plex Mono', ui-monospace, monospace); color: var(--muted, #5B6483); }
@container (max-width: 520px) {
  .s3-network:not(.scene3d-live) .s3-net-list { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; padding: 4px 0; }
  .s3-network:not(.scene3d-live) .s3-net-item { justify-content: flex-start; }
  .s3-network:not(.scene3d-live) .s3-net-item::before { top: 0; bottom: 0; left: 31px; right: auto; width: 4px; height: auto;
    background: var(--s3-blue-2); }
  .s3-network:not(.scene3d-live) .s3-net-item:first-child::before { top: 50%; left: 31px; }
  .s3-network:not(.scene3d-live) .s3-net-item:last-child::before { bottom: 50%; right: auto; }
  .s3-network:not(.scene3d-live) .s3-net-node { flex-direction: row; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px 0 22px; text-align: left; }
  .s3-network:not(.scene3d-live) .s3-net-dot { margin: 0; }
  .s3-network:not(.scene3d-live) .s3-net-label { max-width: none; flex: 1; font-size: 14px; }
}
/* modo 3D: a lista vira camada de rótulos sobre os nós (posição via transform no JS) */
.s3-net-live { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.s3-net-live .s3-net-list { display: block; padding: 0; height: 100%; overflow: visible; }
.s3-net-live .s3-net-item::before { display: none; }
.s3-net-live .s3-net-node {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  border-radius: 50%; pointer-events: auto; will-change: transform;
}
.s3-net-live .s3-net-dot { position: absolute; inset: 0; width: auto; height: auto; margin: 0; background: transparent; box-shadow: none; animation: none; }
.s3-net-live .s3-net-label, .s3-net-live .s3-net-val {
  position: absolute; left: 50%; top: calc(100% - 2px); translate: -50% 0; max-width: none; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  background: color-mix(in srgb, var(--surface, #fff) 86%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 1px 2px rgba(15, 20, 51, .08), 0 0 0 1px var(--line, rgba(15, 20, 51, .08));
  transition: opacity var(--dur-1, 150ms) var(--ease-out, ease-out);
}
.s3-net-live .s3-net-node[data-status="stop"] .s3-net-label { color: var(--crit, #B42318); box-shadow: 0 0 0 1px currentColor; }
.s3-net-live .s3-net-val { top: auto; bottom: calc(100% - 2px); opacity: 0; padding: 1px 7px; }
.s3-net-live .s3-net-node[data-side="up"] .s3-net-label { top: auto; bottom: calc(100% - 2px); }
.s3-net-live .s3-net-node[data-side="up"] .s3-net-val { bottom: auto; top: calc(100% - 2px); }
.s3-net-live .s3-net-node[data-side="right"] .s3-net-label { left: calc(100% - 2px); top: 50%; translate: 0 -50%; font-size: 13px; }
.s3-net-live .s3-net-node[data-side="right"] .s3-net-val { opacity: 1; left: auto; right: calc(100% - 2px); top: 50%; bottom: auto; translate: 0 -50%; background: none; box-shadow: none; }
.s3-net-live .s3-net-node:is(:hover, :focus-visible) .s3-net-val { opacity: 1; }
.s3-net-dense .s3-net-node:not([data-status="stop"], [data-status="pend"]):not(:hover, :focus-visible) .s3-net-label { opacity: 0; }

/* ── Entrada de elementos ─────────────────────────────────────── */
/* [data-anim] NÃO tem estado inicial escondido: Motion.enter usa fill:'backwards',
   então nada fica invisível se o JS faltar. Valores: rise (padrão) | fade | scale | left. */
[data-anim] { backface-visibility: hidden; }

/* Utilitários só-CSS (sem JS): stagger via --i (0,1,2…) */
.anim-rise, .anim-fade, .anim-scale {
  animation: var(--dur-2, 240ms) var(--ease-out, cubic-bezier(.2,.8,.2,1)) both;
  animation-delay: calc(min(var(--i, 0), 11) * 30ms);
}
.anim-rise  { animation-name: motion-rise; }
.anim-fade  { animation-name: motion-fade; }
.anim-scale { animation-name: motion-scale; }
@keyframes motion-rise  { from { opacity: 0; transform: translateY(8px); } }
@keyframes motion-fade  { from { opacity: 0; } }
@keyframes motion-scale { from { opacity: 0; transform: scale(.96); } }

/* Pulso de atenção (ex.: status que mudou) */
.anim-pop { animation: motion-pop var(--dur-3, 400ms) var(--ease-out, cubic-bezier(.2,.8,.2,1)); }
@keyframes motion-pop { 40% { transform: scale(1.06); } }

/* ── Skeleton / shimmer genérico (complementa .skeleton do styles.css) ── */
.shimmer { position: relative; overflow: hidden; background: var(--surface-2, #EDF1F7); border-radius: var(--r-xs, 8px); }
.shimmer::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: motion-shimmer 1.3s infinite;
}
[data-theme="dark"] .shimmer::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
@keyframes motion-shimmer { to { transform: translateX(100%); } }

/* ── Kill-switch global: reduzir movimento ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .scene3d-fallback::before, .shimmer::after { animation: none !important; }
  .scene3d-canvas { display: none; }
}

/* ═══════════════════════════ motion-everywhere ═══════════════════════════
   Fase 3 (gestor): transição de rota direcional com título "compartilhado",
   modal/folha e paleta com mola, pilha de toasts, pílula deslizante nos
   segmentados, hover/press/foco, recolher a barra lateral e os hosts 3D
   (faixa hero, objeto do vazio, anel do KPI, linha de estações).
   Só transform/opacity nas animações; tudo cai no kill-switch de reduced motion. */
:root {
  --spring: cubic-bezier(.2, .9, .25, 1.05);
  --spring-soft: cubic-bezier(.16, 1, .3, 1);
  --exit: cubic-bezier(.4, 0, 1, 1);
}
@supports (animation-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0392, 0.1357, 0.2633, 0.4022, 0.5384, 0.6628, 0.7703, 0.8586, 0.9277, 0.979, 1.0146, 1.0372, 1.0495, 1.0541, 1.0531, 1.0486, 1.042, 1.0346, 1.0271, 1.0201, 1.014, 1.0089, 1.0049, 1.0018, 0.9997, 0.9983, 0.9975, 1);
    --spring-soft: linear(0, 0.0383, 0.1302, 0.2488, 0.3755, 0.4982, 0.6097, 0.7064, 0.7871, 0.8521, 0.9028, 0.9411, 0.969, 0.9884, 1.0013, 1.0091, 1.0134, 1.015, 1.015, 1.0139, 1.0122, 1.0103, 1.0084, 1.0067, 1);
  }
}

/* ── Rotas: o conteúdo desliza na direção do menu; o título fica "ancorado" ── */
#content { view-transition-name: content; }
/* (sem view-transition-name fixo no título: com o cabeçalho sticky ele virava camada própria
   e o resto do cabeçalho deixava rastro ao rolar) */
#sb { view-transition-name: sidebar; }
html[data-vt="route"]::view-transition-old(root),
html[data-vt="route"]::view-transition-new(root) { animation: none; }
html[data-vt="route"]::view-transition-group(content) { animation: none; }
html[data-vt="route"]::view-transition-old(content) { animation: me-vt-out 150ms var(--exit) both; }
html[data-vt="route"]::view-transition-new(content) { animation: me-vt-in 360ms var(--spring-soft) both; }
html[data-vt="route"][data-nav-dir="back"]::view-transition-old(content) { animation-name: me-vt-out-back; }
html[data-vt="route"][data-nav-dir="back"]::view-transition-new(content) { animation-name: me-vt-in-back; }
html[data-vt="route"][data-nav-dir="same"]::view-transition-new(content) { animation-name: me-vt-in-same; }
/* título: o grupo migra de posição/tamanho; o texto troca num crossfade curto */
html[data-vt="route"]::view-transition-group(page-title) { animation-duration: 300ms; animation-timing-function: var(--spring-soft); }
html[data-vt="route"]::view-transition-old(page-title) { animation: me-vt-fade-out 120ms ease-out both; }
html[data-vt="route"]::view-transition-new(page-title) { animation: me-vt-title-in 300ms var(--ease-out, ease-out) both; }
@keyframes me-vt-out       { to   { opacity: 0; transform: translateX(-14px); } }
@keyframes me-vt-out-back  { to   { opacity: 0; transform: translateX(14px); } }
@keyframes me-vt-in        { from { opacity: 0; transform: translateX(28px); } }
@keyframes me-vt-in-back   { from { opacity: 0; transform: translateX(-28px); } }
@keyframes me-vt-in-same   { from { opacity: 0; transform: translateY(10px); } }
@keyframes me-vt-fade-out  { to   { opacity: 0; } }
@keyframes me-vt-title-in  { from { opacity: 0; transform: translateY(6px); } }

/* ── Recolher a barra lateral: cortina (sem esticar texto) ── */
html[data-vt] .shell { transition: none !important; }
html[data-vt="sb"]::view-transition-group(sidebar),
html[data-vt="sb"]::view-transition-group(content) { animation-duration: 320ms; animation-timing-function: var(--spring-soft); overflow: hidden; }
html[data-vt="sb"]::view-transition-old(sidebar), html[data-vt="sb"]::view-transition-new(sidebar),
html[data-vt="sb"]::view-transition-old(content), html[data-vt="sb"]::view-transition-new(content) {
  height: 100%; width: auto; object-fit: none; object-position: left top; animation-duration: 220ms; }
html[data-vt="sb"]::view-transition-old(page-title), html[data-vt="sb"]::view-transition-new(page-title) { animation-duration: 200ms; }

/* ── Modal: fundo com desfoque que acende; caixa/folha com mola ── */
.modal-bg { animation: me-scrim-in 260ms ease-out both; }
.modal { animation: me-modal-in 440ms var(--spring-soft) both; transform-origin: 50% 60%; }
@keyframes me-scrim-in { from { opacity: 0; -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); } }
@keyframes me-modal-in { from { opacity: 0; transform: translateY(14px) scale(.965); } 40% { opacity: 1; } }
@media (max-width: 600px) {
  .modal { animation: me-sheet-in 460ms var(--spring-soft) both; }
}
@keyframes me-sheet-in { from { transform: translateY(100%); } }

/* ── Paleta de comandos ── */
body > .cmdk-bg { animation: me-scrim-in 200ms ease-out both; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.cmdk-bg > .cmdk { animation: me-cmdk-in 380ms var(--spring-soft) both; transform-origin: 50% 0; }
@keyframes me-cmdk-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } 45% { opacity: 1; } }
.cmdk-o { transition: background-color 120ms ease-out, color 120ms ease-out; }
.cmdk-o .co-ic { transition: transform 200ms var(--spring-soft), background-color 120ms; }
.cmdk-o[aria-selected="true"] .co-ic { transform: scale(1.08); }

/* ── Pilha de toasts (o mais novo embaixo) ── */
.toast-stack { position: fixed; z-index: 120; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast-stack:empty { display: none; }
.toast-stack .toast { position: relative; left: auto; bottom: auto; transform: none; max-width: 100%;
  pointer-events: auto; cursor: pointer; animation: me-toast-in 460ms var(--spring) both; }
@keyframes me-toast-in { from { opacity: 0; transform: translateY(18px) scale(.92); } 35% { opacity: 1; } }
@media (max-width: 820px) {
  body:has(.bottom-nav) .toast-stack { bottom: calc(var(--sh-bnav, 64px) + 14px + env(safe-area-inset-bottom)); }
}
/* celular com folha aberta: o aviso vai para o topo (não cobre os botões da folha) */
@media (max-width: 600px) {
  body:has(.modal-bg) .toast-stack { bottom: auto; top: calc(12px + env(safe-area-inset-top)); flex-direction: column-reverse; }
}

/* ── Segmentados: pílula que desliza entre as opções ── */
.seg.has-pill { position: relative; isolation: isolate; }
.seg.has-pill > button { position: relative; z-index: 1; transition: color 160ms ease-out; }
.seg.has-pill > button.active, .seg.has-pill > button[aria-pressed="true"] { background: transparent; box-shadow: none; }
.seg-pill { position: absolute; top: 0; left: 0; z-index: 0; width: 0; height: 0; opacity: 0; pointer-events: none;
  border-radius: 9px; background: var(--white, #fff); box-shadow: var(--shadow-xs), 0 0 0 1px var(--gray-200, #E5E7EB);
  transition: opacity 160ms ease-out; will-change: transform; }

/* ── Botões: elevação sutil no hover (só mouse) e brilho no foco por teclado ── */
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):not(.ghost):not([aria-busy="true"]):hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 6px 16px -6px rgba(27, 13, 174, .45); }
  .btn.secondary:not(:disabled):hover { box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,.08)); }
  .btn.danger:not(:disabled):hover { box-shadow: 0 6px 16px -6px rgba(176, 32, 32, .45); }
  .icon-btn { transition: transform 160ms var(--ease-out, ease-out), background-color 150ms, color 150ms, border-color 150ms; }
  .icon-btn:hover { transform: translateY(-1px); }
  .dash .stat[role="button"] { transition: transform 200ms var(--spring-soft), box-shadow 200ms ease-out; }
  .dash .stat[role="button"]:hover { transform: translateY(-2px); box-shadow: var(--shadow-md, 0 8px 24px -10px rgba(0,0,0,.18)); }
}
.btn:active:not(:disabled), .icon-btn:active { transition-duration: 60ms; }
:where(.btn, .icon-btn, .seg button, .nav a, .bottom-nav a, .net-chip, .stat[role="button"], .linklike):focus-visible {
  outline: 2px solid var(--focus, #1B0DAE); outline-offset: 2px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--focus, #1B0DAE) 18%, transparent);
  transition: box-shadow 180ms ease-out, outline-offset 180ms var(--spring-soft);
}

/* ── Esqueleto aparece suave (o conteúdo que o substitui entra por JS, em crossfade) ── */
.skeleton { animation: me-sk-in 200ms ease-out both; }
@keyframes me-sk-in { from { opacity: 0; } }

/* ═════════ Hosts 3D do gestor (o visual do fallback é da cena; aqui só layout) ═════════ */
#content { position: relative; isolation: isolate; }
.ph-hero { position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: clamp(150px, 18vw, 210px); pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 35%, transparent), linear-gradient(to right, transparent 4%, #000 46%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to bottom, #000 35%, transparent), linear-gradient(to right, transparent 4%, #000 46%);
  mask-composite: intersect; animation: me-fade-in 900ms ease-out both; }
@keyframes me-fade-in { from { opacity: 0; } }
@media (max-width: 820px) { .ph-hero { height: calc(var(--sh-topbar, 56px) + 140px); opacity: .85; } }
@media print { .ph-hero, .empty-3d, .cov-orb, .net-stage { display: none !important; } }

/* Objeto 3D do estado vazio: por cima do ícone (sem deslocar o layout); o desenho
   estático do preset (enquanto carrega / quando barrado) também cobre o ícone. */
div.empty[data-s3-on] { position: relative; }
/* O objeto 3D OCUPA o lugar do ícone (no fluxo, acima do texto) — antes era absoluto,
   com 96px num espaço de 48px, e cobria a mensagem. */
.empty-3d { position: relative; display: block; flex: 0 0 auto; width: 96px !important; height: 96px !important; margin: -12px 0 -6px; pointer-events: none; }
div.empty:has(> .empty-3d) > svg { display: none; }

/* Anel 3D no KPI de cobertura do dashboard */
.coverage .ico-tile { position: relative; }
.cov-orb { position: absolute; inset: -16px; pointer-events: none; }
.coverage .ico-tile:has(> .cov-orb.scene3d-host) { background: transparent; box-shadow: none; }
.coverage .ico-tile:has(> .cov-orb.scene3d-host) > svg { opacity: 0; }

/* Linha de estações (dashboard de clientes com estações) */
.net-panel .net-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.net-panel .net-head h3 { margin: 0; }
.net-stage { position: relative; }
.net-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.net-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border-radius: var(--r-pill, 999px);
  border: 1px solid var(--gray-200, #E5E7EB); background: var(--white, #fff); color: var(--gray-800, #1F2937); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: border-color 150ms, background-color 150ms, transform 200ms var(--spring-soft);
  animation: motion-rise 320ms var(--ease-out, ease-out) both; animation-delay: calc(min(var(--i, 0), 14) * 24ms); }
.net-chip .nc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gray-300, #CBD5E1); }
.net-chip.st-ok .nc-dot { background: var(--success, #2F7A3E); }
.net-chip.st-pend .nc-dot { background: var(--warning, #B7791F); }
.net-chip.st-stop .nc-dot { background: var(--danger, #B42318); }
.net-chip .nc-v { font-family: var(--mono); font-size: 12px; color: var(--gray-500, #6B7280); font-weight: 600; }
.net-chip.on, .net-chip[aria-pressed="true"] { border-color: var(--blue, #1B0DAE); background: var(--blue-50, #ECEAF7); color: var(--blue, #1B0DAE); }
.net-head .net-chip.all { animation: none; }
@media (hover: hover) and (pointer: fine) { .net-chip:hover { border-color: var(--blue-200, #B7AFE3); transform: translateY(-1px); } }
@media (prefers-reduced-motion: reduce) {
  .seg-pill { will-change: auto; }
  .ph-hero { animation: none; }
}
/* ═════════════════════════ fim motion-everywhere ═════════════════════════ */

/* Celular: nome da estação não vaza da borda do painel. */
@media (max-width: 600px) {
  .s3-net-live .s3-net-label { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
}
