/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: var(--bg); overflow: hidden; }
.login-fundo span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.login-fundo span:nth-child(1) { width: 520px; height: 520px; background: var(--accent); top: -160px; left: -120px; }
.login-fundo span:nth-child(2) { width: 460px; height: 460px; background: var(--azul); bottom: -180px; right: -100px; }
.login-fundo span:nth-child(3) { width: 300px; height: 300px; background: var(--amarelo); top: 40%; left: 55%; }
.login-card {
  position: relative; width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 16px;
  padding: 36px 32px 28px; border-radius: 28px;
  background: color-mix(in oklab, var(--painel) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--linha); box-shadow: var(--sombra-alta);
}
.login-card h1 { font-size: 30px; text-align: center; margin-top: 8px; }
.login-sub { text-align: center; color: var(--suave); margin-top: -8px; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.campo input, .campo select, .campo textarea {
  height: 50px; padding: 0 16px; border-radius: 14px;
  background: var(--painel-2); border: 2px solid var(--linha); outline: none;
  font-size: 15px; font-weight: 500;
  transition-property: border-color, box-shadow, transform; transition-duration: calc(.3s * var(--t));
  transition-timing-function: cubic-bezier(.34, 1.8, .64, 1);
}
.campo input:focus, .campo select:focus { border-color: var(--accent); box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 18%, transparent); transform: scale(1.03); }
.btn-login { height: 54px; margin-top: 6px; font-size: 16px; align-self: center; width: 100%; }
.login-rodape { text-align: center; font-size: 12px; color: var(--suave); }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .35); border-top-color: #fff; animation-name: girar; animation-duration: calc(.7s * var(--t)); animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- cartões ---------- */
.cartao {
  position: relative;
  background: var(--painel); border: 1px solid var(--linha);
  border-radius: var(--raio); padding: 22px;
  box-shadow: var(--sombra);
}
.cartao-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cartao-cab h3 { font-size: 18px; font-weight: 700; }
.cartao-cab p { color: var(--suave); font-size: 13px; }
.grade-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; perspective: 1200px; }
.grade-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.grade-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }

.kpi { transform-style: preserve-3d; transition-property: transform, box-shadow; transition-duration: calc(.25s * var(--t)); transition-timing-function: ease-out; overflow: hidden; }
.kpi:hover { box-shadow: var(--sombra-alta); }
.kpi-topo { display: flex; align-items: center; gap: 10px; color: var(--suave); font-weight: 600; font-size: 14px; }
.kpi-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in oklab, var(--cor) 14%, transparent); color: var(--cor); }
.kpi-valor { font-family: var(--display); font-size: 34px; font-weight: 800; letter-spacing: -0.03em; margin-top: 14px; font-variant-numeric: tabular-nums; }
.kpi-rodape { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.delta.sobe { background: color-mix(in oklab, var(--verde) 16%, transparent); color: var(--verde); }
.delta.desce { background: color-mix(in oklab, var(--vermelho) 16%, transparent); color: var(--vermelho); }
.delta svg.ic { width: 14px; height: 14px; stroke-width: 2.6; }
.sparkline { width: 96px; height: 36px; }
.sparkline path { fill: none; stroke: var(--cor); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brilho { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition-property: opacity; transition-duration: calc(.3s * var(--t)); background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / .55), transparent 55%); mix-blend-mode: soft-light; }
.kpi:hover .brilho { opacity: 1; }

/* ---------- gráficos ---------- */
.barras { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; gap: 10px; height: 240px; padding-top: 24px; }
.barra { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.barra-corpo {
  width: 100%; max-width: 38px; border-radius: 12px 12px 6px 6px;
  background: color-mix(in oklab, var(--accent) 22%, var(--painel-2));
  transform-origin: bottom;
  transition-property: background-color, transform; transition-duration: calc(.3s * var(--t));
  transition-timing-function: cubic-bezier(.34, 1.8, .64, 1);
}
.barra.destaque .barra-corpo { background: var(--accent); }
.barra:hover .barra-corpo { background: var(--accent); transform: scaleX(1.15); }
.barra small { color: var(--suave); font-size: 12px; font-weight: 600; }
.dica {
  position: absolute; bottom: calc(var(--h) + 34px); left: 50%;
  translate: -50% 0; padding: 6px 10px; border-radius: 10px;
  background: var(--tinta); color: var(--bg); font-size: 12px; font-weight: 700; white-space: nowrap;
  opacity: 0; scale: .3; transform-origin: bottom center; pointer-events: none;
  transition-property: opacity, scale; transition-duration: calc(.35s * var(--t));
  transition-timing-function: cubic-bezier(.34, 2, .64, 1);
}
.barra:hover .dica { opacity: 1; scale: 1; }

.rosca { position: relative; width: 190px; height: 190px; margin: 4px auto 18px; }
.rosca svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.rosca circle { fill: none; stroke-width: 26; }
.rosca-centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.rosca-centro strong { font-family: var(--display); font-size: 30px; font-weight: 800; }
.rosca-centro small { color: var(--suave); font-size: 12px; }
.legenda { display: grid; gap: 10px; }
.legenda li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legenda li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legenda i { width: 12px; height: 12px; border-radius: 4px; background: var(--cor); }
ul { list-style: none; margin: 0; padding: 0; }

.linha-graf { width: 100%; height: 220px; overflow: visible; }
.linha-graf .area { fill: url(#grad-area); }
.linha-graf .traco { fill: none; stroke: var(--azul); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.linha-graf .grade line { stroke: var(--linha); stroke-dasharray: 4 6; }
.linha-graf .ponto { fill: var(--azul); stroke: var(--painel); stroke-width: 4; }
.linha-graf .pulso { fill: var(--azul); opacity: .35; transform-box: fill-box; transform-origin: center; animation-name: pulsar; animation-duration: calc(1.6s * var(--t)); animation-iteration-count: infinite; animation-timing-function: ease-out; }
@keyframes pulsar { from { transform: scale(1); opacity: .5; } to { transform: scale(4); opacity: 0; } }

.segmentos { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--painel-2); border: 1px solid var(--linha); position: relative; }
.segmentos button { position: relative; z-index: 1; height: 34px; padding: 0 14px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--suave); transition-property: color; transition-duration: calc(.3s * var(--t)); }
.segmentos button.ativo { color: var(--tinta); }
.segmentos .seg-fundo { position: absolute; top: 4px; left: 0; height: 34px; border-radius: 10px; background: var(--painel); box-shadow: var(--sombra); }

/* ---------- ao vivo / meta ---------- */
.ao-vivo { display: flex; align-items: center; gap: 10px; color: var(--suave); font-weight: 600; font-size: 13px; }
.ao-vivo i { width: 10px; height: 10px; border-radius: 50%; background: var(--verde); box-shadow: 0 0 0 0 var(--verde); animation-name: vivo; animation-duration: calc(1.4s * var(--t)); animation-iteration-count: infinite; }
@keyframes vivo { 70% { box-shadow: 0 0 0 12px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.odometro { display: flex; font-family: var(--display); font-size: 52px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; height: 1em; overflow: hidden; margin: 14px 0 6px; }
.odometro .col { display: flex; flex-direction: column; align-items: center; transition-property: transform; transition-duration: calc(.9s * var(--t)); transition-timing-function: cubic-bezier(.34, 1.6, .64, 1); }
.odometro .col span { height: 1em; }
.odometro .sep { width: .3em; }
.meta-barra { position: relative; height: 18px; border-radius: 99px; background: var(--painel-2); border: 1px solid var(--linha); overflow: hidden; margin-top: 14px; }
.meta-barra i { position: absolute; inset: 0; width: var(--p); border-radius: inherit; background: repeating-linear-gradient(-45deg, var(--accent) 0 12px, color-mix(in oklab, var(--accent) 75%, #fff) 12px 24px); background-size: 34px 34px; transform-origin: left; animation-name: listras; animation-duration: calc(1s * var(--t)); animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes listras { to { background-position: 34px 0; } }
.equipe { display: flex; margin-top: 16px; }
.equipe .avatar { width: 38px; height: 38px; font-size: 12px; border: 3px solid var(--painel); margin-left: -10px; }
.equipe .avatar:first-child { margin-left: 0; }

/* ---------- tabela ---------- */
.tabela-wrap { overflow-x: auto; margin: 0 -22px -22px; }
.tabela { width: 100%; border-collapse: collapse; min-width: 680px; }
.tabela th { text-align: left; font-size: 12px; font-weight: 700; color: var(--suave); padding: 10px 22px; border-bottom: 1px solid var(--linha); }
.tabela td { white-space: nowrap; padding: 14px 22px; border-bottom: 1px solid var(--linha); font-size: 14px; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela tbody tr { transition-property: background-color, transform; transition-duration: calc(.25s * var(--t)); transition-timing-function: cubic-bezier(.34, 1.8, .64, 1); }
.tabela tbody tr:hover { background: var(--painel-2); transform: scale(1.012); }
.cliente-cel { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cliente-cel .avatar { width: 34px; height: 34px; font-size: 12px; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.status { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; font-size: 12px; font-weight: 800; background: color-mix(in oklab, var(--cor) 15%, transparent); color: var(--cor); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
button.status { cursor: pointer; }
button.status:hover { outline: 2px solid var(--cor); outline-offset: 2px; }
.acoes { display: flex; gap: 6px; justify-content: flex-end; }
.acoes button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--suave); transition-property: background-color, color, transform; transition-duration: calc(.25s * var(--t)); transition-timing-function: cubic-bezier(.34, 2, .64, 1); }
.acoes button:hover { background: color-mix(in oklab, var(--vermelho) 14%, transparent); color: var(--vermelho); transform: scale(1.25) rotate(-10deg); }
.acoes svg.ic { width: 18px; height: 18px; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { height: 38px; padding: 0 16px; border-radius: 99px; font-weight: 700; font-size: 13px; background: var(--painel); border: 1px solid var(--linha); transition-property: background-color, color, transform, border-color; transition-duration: calc(.3s * var(--t)); transition-timing-function: cubic-bezier(.34, 2, .64, 1); }
.chip:hover { transform: translateY(-3px); }
.chip.ativo { background: var(--tinta); color: var(--bg); border-color: var(--tinta); transform: scale(1.08); }

/* ---------- clientes ---------- */
.busca-clientes { display: flex; gap: 12px; margin-bottom: 20px; }
.busca-clientes .campo { flex: 1; max-width: 420px; }
.grade-clientes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; perspective: 1400px; }
.cli { height: 250px; cursor: pointer; transform-style: preserve-3d; transition-property: transform; transition-duration: calc(.8s * var(--t)); transition-timing-function: cubic-bezier(.34, 1.5, .64, 1); }
.cli.virado { transform: rotateY(180deg); }
.cli-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 20px; border-radius: var(--raio); background: var(--painel); border: 1px solid var(--linha); box-shadow: var(--sombra); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cli-face.verso { transform: rotateY(180deg); background: var(--tinta); color: var(--bg); border-color: var(--tinta); align-items: stretch; text-align: left; }
.cli .avatar { width: 72px; height: 72px; font-size: 24px; margin-bottom: 6px; }
.cli h4 { font-size: 18px; }
.cli small { color: var(--suave); }
.cli .tag { margin-top: 6px; }
.verso h4 { margin-bottom: 8px; }
.verso p { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-bottom: 1px solid rgb(127 127 127 / .25); }
.verso p span { opacity: .65; }

/* ---------- relatórios ---------- */
.ranking li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.ranking li b { font-variant-numeric: tabular-nums; }
.ranking .trilho { grid-column: 1 / -1; height: 12px; border-radius: 99px; background: var(--painel-2); overflow: hidden; }
.ranking .trilho i { display: block; height: 100%; width: var(--p); border-radius: inherit; background: var(--cor); transform-origin: left; }
.mapa-calor { display: grid; grid-template-columns: 40px repeat(24, 1fr); gap: 4px; align-items: center; }
.mapa-calor small { font-size: 11px; color: var(--suave); font-weight: 600; }
.mapa-calor i { aspect-ratio: 1; border-radius: 5px; background: color-mix(in oklab, var(--accent) var(--v), var(--painel-2)); transition-property: transform; transition-duration: calc(.25s * var(--t)); transition-timing-function: cubic-bezier(.34, 2.2, .64, 1); }
.mapa-calor i:hover { transform: scale(1.9); position: relative; z-index: 2; border-radius: 4px; box-shadow: var(--sombra-alta); }

/* ---------- configurações ---------- */
.ajuste { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 16px 0; border-bottom: 1px solid var(--linha); }
.ajuste:last-child { border-bottom: 0; }
.ajuste > div:first-child { flex: 1 1 180px; }
.ajuste strong { display: block; }
.ajuste small { color: var(--suave); font-size: 13px; }
.chave { position: relative; width: 64px; height: 36px; border-radius: 99px; background: var(--linha); flex: none; transition-property: background-color; transition-duration: calc(.35s * var(--t)); }
.chave i { position: absolute; top: 4px; left: 4px; width: 28px; height: 28px; border-radius: 99px; background: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .2); }
.chave[aria-checked="true"] { background: var(--verde); }
.chave[aria-checked="true"] i { left: 32px; }
.cores { display: flex; gap: 10px; }
.cores button { width: 38px; height: 38px; border-radius: 50%; background: var(--c); border: 3px solid var(--painel); box-shadow: 0 0 0 2px var(--linha); transition-property: transform, box-shadow; transition-duration: calc(.3s * var(--t)); transition-timing-function: cubic-bezier(.34, 2.2, .64, 1); }
.cores button:hover { transform: scale(1.2); }
.cores button.ativo { box-shadow: 0 0 0 3px var(--c); transform: scale(1.15); }
.deslizante { position: relative; width: 240px; }
.deslizante input { width: 100%; accent-color: var(--accent); }
.deslizante output { position: absolute; top: -34px; left: var(--x); translate: -50% 0; padding: 4px 9px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; font-size: 12px; scale: var(--s, 1); transition-property: scale; transition-duration: calc(.3s * var(--t)); transition-timing-function: cubic-bezier(.34, 2.2, .64, 1); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column-reverse; gap: 12px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { position: relative; overflow: hidden; display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px 18px; border-radius: 18px; background: var(--painel); border: 1px solid var(--linha); box-shadow: var(--sombra-alta); pointer-events: auto; }
.toast-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: color-mix(in oklab, var(--cor) 16%, transparent); color: var(--cor); }
.toast strong { display: block; font-size: 15px; }
.toast p { color: var(--suave); font-size: 13px; }
.toast-barra { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--cor); transform-origin: left; }

/* ---------- dropdown ---------- */
.sino { position: relative; }
.dropdown { position: absolute; right: 0; top: calc(100% + 12px); width: 340px; padding: 10px; border-radius: 20px; background: var(--painel); border: 1px solid var(--linha); box-shadow: var(--sombra-alta); transform-origin: top right; }
.dropdown h4 { font-size: 15px; padding: 8px 10px 10px; }
.notif { display: flex; gap: 12px; padding: 10px; border-radius: 14px; transition-property: background-color, transform; transition-duration: calc(.25s * var(--t)); transition-timing-function: cubic-bezier(.34, 1.8, .64, 1); }
.notif:hover { background: var(--painel-2); transform: translateX(6px); }
.notif p { font-size: 14px; }
.notif small { color: var(--suave); font-size: 12px; }

/* ---------- camada: modal e paleta ---------- */
.camada { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.camada.aberta { pointer-events: auto; }
.fundo-escuro { position: absolute; inset: 0; background: rgb(10 10 16 / .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal { position: absolute; left: 50%; top: 50%; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; translate: -50% -50%; padding: 28px; border-radius: 28px; background: var(--painel); box-shadow: var(--sombra-alta); display: flex; flex-direction: column; gap: 16px; }
.modal h3 { font-size: 26px; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.lado-a-lado { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.paleta { position: absolute; left: 50%; top: 14vh; width: min(600px, calc(100vw - 32px)); translate: -50% 0; border-radius: 22px; background: var(--painel); box-shadow: var(--sombra-alta); overflow: hidden; }
.paleta input { width: 100%; height: 64px; padding: 0 22px; border: 0; border-bottom: 1px solid var(--linha); background: transparent; outline: none; font-size: 18px; }
.paleta ul { padding: 8px; max-height: 50vh; overflow: auto; }
.paleta li button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 12px; font-weight: 600; text-align: left; }
.paleta li button small { margin-left: auto; color: var(--suave); font-weight: 500; }
.paleta li.sel button { background: var(--accent); color: #fff; }
.paleta li.sel small { color: rgb(255 255 255 / .8); }
.atalhos { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: min(460px, calc(100vw - 32px)); padding: 26px; border-radius: 24px; background: var(--painel); box-shadow: var(--sombra-alta); }
.atalhos h3 { margin-bottom: 12px; }
.atalhos p { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--linha); font-size: 14px; }
.atalhos kbd { font: 700 12px var(--fonte); padding: 3px 8px; border-radius: 7px; background: var(--painel-2); border: 1px solid var(--linha); }

/* ---------- confete e hud ---------- */
.confete { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }
.hud { position: fixed; left: 50%; bottom: 24px; z-index: 110; translate: -50% 0; padding: 10px 18px; border-radius: 99px; background: var(--tinta); color: var(--bg); font-weight: 800; font-size: 14px; opacity: 0; pointer-events: none; }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

@media (max-width: 1180px) {
  .grade-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .grade-kpi, .grade-2, .grade-3 { grid-template-columns: minmax(0, 1fr); }
  .busca-clientes { flex-direction: column; }
  .barras { gap: 4px; }
  .barra small { font-size: 9px; }
  .mapa-calor { grid-template-columns: 30px repeat(24, 1fr); gap: 2px; }
}
