/* Central INSIGHTS: a noite da capa, como a página de vendas. Dourado só onde há ação ou destaque. */
:root {
  --noite: #000;
  --painel: #0d0b08;
  --painel-2: #15120d;
  --linha: rgb(226 178 82 / .2);
  --linha-forte: rgb(226 178 82 / .45);
  --claro: #f4ecdc;
  --claro-2: #b5ab98;
  --ouro: #e2b252;
  --verde: #8fcf9a;
  --vermelho: #f0a497;
  --azul: #9cc2ec;
  --serif: "Literata", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--noite); color: var(--claro); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--ouro); }
:focus-visible { outline: 2px solid var(--ouro); outline-offset: 2px; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Entrada ---------- */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(60% 50% at 50% 30%, rgb(226 178 82 / .12), transparent 70%), var(--noite); }
.entrada-caixa { width: min(100%, 26rem); display: grid; gap: 1rem; justify-items: center; text-align: center;
  border: 1px solid var(--linha-forte); border-radius: 14px; background: var(--painel); padding: 2.4rem 1.6rem; }
.entrada h1 { font-size: 1.9rem; }
.entrada-texto { color: var(--claro-2); }
.entrada-erro { color: var(--vermelho); }
.marca { font-family: var(--serif); font-weight: 800; letter-spacing: .18em; color: var(--ouro); font-size: .95rem; }
.marca span { display: block; letter-spacing: .04em; font-weight: 400; font-style: italic; color: var(--claro-2); font-size: .9rem; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
.lateral { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--linha); padding: 1.6rem 1rem; display: flex; flex-direction: column; gap: 1.6rem; background: var(--painel); }
.lateral ul, .abas-baixo ul { list-style: none; margin: 0; padding: 0; }
.lateral ul { display: grid; gap: .2rem; }
.lateral a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 8px; text-decoration: none; color: var(--claro-2); }
.lateral a:hover { background: var(--painel-2); color: var(--claro); }
.lateral a[aria-current="page"] { background: rgb(226 178 82 / .12); color: var(--ouro); }
.lateral-pe { margin-top: auto; display: grid; gap: .3rem; color: var(--claro-2); font-size: .9rem; }
main { padding: 1.6rem clamp(16px, 3vw, 2.6rem) 4rem; min-width: 0; outline: none; }
.topo { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.topo h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.subtitulo { color: var(--claro-2); font-size: .92rem; margin-top: .2rem; }
.abas-baixo { display: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { display: none; }
  main { padding: 1.1rem 16px calc(6rem + env(safe-area-inset-bottom)); }
  .abas-baixo { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgb(0 0 0 / .94);
    border-top: 1px solid var(--linha-forte); padding-bottom: env(safe-area-inset-bottom); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .abas-baixo ul { display: grid; grid-template-columns: repeat(5, 1fr); }
  .abas-baixo a, .abas-baixo button { display: grid; justify-items: center; gap: .15rem; padding: .55rem 0 .5rem; font-size: .72rem; color: var(--claro-2);
    text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; }
  .abas-baixo svg { width: 1.45rem; height: 1.45rem; }
  .abas-baixo [aria-current="page"] { color: var(--ouro); }
}

/* ---------- Peças ---------- */
.botao { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: .55rem 1.1rem; border-radius: 8px;
  border: 1px solid var(--linha-forte); background: transparent; cursor: pointer; text-decoration: none; color: var(--claro); font-weight: 600; }
.botao:hover { border-color: var(--ouro); }
.botao-ouro { background: var(--ouro); color: #000; border-color: var(--ouro); }
.botao-ouro:hover { background: var(--claro); border-color: var(--claro); }
.botao[disabled] { opacity: .55; cursor: wait; }
.botao-icone { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--linha); background: none; cursor: pointer; color: var(--claro-2); }
.botao-icone:hover { color: var(--ouro); border-color: var(--linha-forte); }
.botao-icone.girando svg { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.link { background: none; border: 0; padding: 0; color: var(--ouro); cursor: pointer; text-decoration: underline; justify-self: start; }

.cartao { border: 1px solid var(--linha); border-radius: 12px; background: var(--painel); padding: 1.1rem 1.2rem; }
.cartao h2 { font-size: 1.15rem; margin-bottom: .7rem; }
.grade { display: grid; gap: 1rem; }
.grade-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: start; }
.secao-titulo { font-family: var(--serif); font-size: 1.05rem; color: var(--ouro); margin: 1.6rem 0 .6rem; }

/* Números do painel */
.numeros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 560px) { .numeros { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.numero { border: 1px solid var(--linha); border-radius: 12px; background: var(--painel); padding: .9rem 1rem; display: grid; gap: .15rem; }
.numero b { font-size: 1.45rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.numero span { color: var(--claro-2); font-size: .85rem; }
.progresso-100 { display: grid; gap: .6rem; }
.progresso-100 .grande { font-family: var(--serif); font-size: 2.6rem; font-weight: 800; line-height: 1; }
.progresso-100 .grande small { font-size: 1rem; font-weight: 400; color: var(--claro-2); font-family: var(--sans); margin-left: .4rem; }
.trilho { height: 8px; border-radius: 4px; background: rgb(226 178 82 / .15); overflow: hidden; }
.trilho div { height: 100%; background: var(--ouro); border-radius: 4px; }

/* Listas */
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.item { display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; border: 1px solid var(--linha); border-radius: 10px; background: var(--painel);
  padding: .75rem .9rem; cursor: pointer; color: var(--claro); min-height: 3.2rem; }
.item:hover { border-color: var(--linha-forte); }
.item-texto { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.item-titulo { font-weight: 600; overflow-wrap: anywhere; }
.item-sub { color: var(--claro-2); font-size: .88rem; overflow-wrap: anywhere; }
.item-sub.corta { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .lado { display: grid; justify-items: end; gap: .25rem; flex: none; }
.vazio { color: var(--claro-2); padding: 1rem 0; }

/* Marcas de situação */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap;
  border: 1px solid currentColor; color: var(--claro-2); }
.chip.ouro { color: var(--ouro); }
.chip.verde { color: var(--verde); }
.chip.vermelho { color: var(--vermelho); }
.chip.azul { color: var(--azul); }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.filtro { border: 1px solid var(--linha-forte); border-radius: 999px; padding: .4rem .9rem; background: none; cursor: pointer; color: var(--claro-2); min-height: 2.4rem; }
.filtro[aria-pressed="true"] { background: var(--ouro); color: #000; border-color: var(--ouro); font-weight: 600; }
.busca { flex: 1 1 14rem; min-height: 2.6rem; border-radius: 999px; border: 1px solid var(--linha-forte); background: var(--painel); padding: .45rem 1rem; }
.segmentos { display: inline-flex; border: 1px solid var(--linha-forte); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; flex-wrap: wrap; }
.segmentos button { border: 0; background: none; padding: .55rem 1rem; cursor: pointer; color: var(--claro-2); min-height: 2.6rem; }
.segmentos button[aria-pressed="true"] { background: rgb(226 178 82 / .16); color: var(--ouro); font-weight: 600; }

/* Caixa de marcar das tarefas */
.marcar { width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 2px solid var(--linha-forte); background: none; cursor: pointer; display: grid; place-items: center; flex: none; color: #000; }
.marcar:hover { border-color: var(--ouro); }
.marcar.feita { background: var(--ouro); border-color: var(--ouro); }
.marcar svg { width: 1rem; height: 1rem; stroke-width: 2.6; }
.item.feita .item-titulo { text-decoration: line-through; color: var(--claro-2); }

/* Agenda: seleção para liberar lote */
.selecionar { width: 1.4rem; height: 1.4rem; accent-color: var(--ouro); flex: none; }
.barra-lote { position: sticky; bottom: 1rem; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem;
  border: 1px solid var(--ouro); background: #110e09; border-radius: 12px; padding: .7rem .9rem; box-shadow: 0 10px 30px -10px #000; }
@media (max-width: 820px) { .barra-lote { bottom: calc(5rem + env(safe-area-inset-bottom)); } }

/* Gatilhos */
.gatilho { display: grid; gap: .8rem; }
.gatilho p { color: var(--claro-2); }
.campos { display: grid; gap: .8rem; }
label.campo { display: grid; gap: .3rem; font-size: .9rem; color: var(--claro-2); }
.campo input, .campo select, .campo textarea { width: 100%; min-height: 2.75rem; padding: .55rem .75rem; border-radius: 8px; border: 1px solid #4a4133; background: var(--noite); color: var(--claro); font-size: 1rem; }
.campo textarea { min-height: 6rem; resize: vertical; line-height: 1.45; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--ouro); outline-offset: 0; border-color: var(--ouro); }
.campo-linha { display: flex; align-items: center; gap: .6rem; font-size: 1rem; color: var(--claro); }

/* Ficha e confirmação */
dialog { border: 1px solid var(--linha-forte); background: var(--painel); color: var(--claro); padding: 0; border-radius: 14px; }
dialog::backdrop { background: rgb(0 0 0 / .6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.ficha { width: min(36rem, calc(100% - 24px)); max-height: calc(100% - 24px); }
.ficha-corpo { display: grid; gap: 1rem; padding: 1.2rem 1.2rem 1rem; }
.ficha-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.ficha-topo h2 { font-size: 1.3rem; padding-top: .4rem; overflow-wrap: anywhere; }
.ficha-info { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; font-size: .9rem; }
.ficha-info dt { color: var(--claro-2); }
.ficha-info dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.ficha-acoes { display: flex; flex-wrap: wrap; gap: .5rem; }
.ficha-acoes:empty, .ficha-info:empty { display: none; }
.ficha-campos { display: grid; gap: .8rem; }
.ficha-pe { display: flex; justify-content: flex-end; gap: .6rem; position: sticky; bottom: 0; background: var(--painel); padding-top: .4rem; }
@media (max-width: 820px) {
  .ficha { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; border-bottom: 0; }
  .ficha-corpo { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
}
.confirma { width: min(28rem, calc(100% - 32px)); }
.confirma-corpo { display: grid; gap: 1rem; padding: 1.4rem; }
.confirma-corpo h2 { font-size: 1.25rem; }
#confirma-texto { color: var(--claro-2); display: grid; gap: .5rem; }
#confirma-texto b { color: var(--claro); }

/* Aviso rápido */
.aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.4rem; z-index: 60; max-width: calc(100% - 32px); padding: .75rem 1.1rem; border-radius: 10px;
  background: var(--claro); color: #000; font-weight: 600; box-shadow: 0 10px 30px -8px #000; }
.aviso.erro { background: #5c1d14; color: #fff; }
@media (max-width: 820px) { .aviso { bottom: calc(5.4rem + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) { .botao-icone.girando svg { animation: none; } }
