:root {
  --roxo: #3d2c74; --roxo-2: #5a43a8; --roxo-claro: #efeaff;
  --ouro: #c9952e; --ouro-claro: #fff4dc;
  --fundo: #f6f4fa; --cartao: #fff; --texto: #1f1a2e; --suave: #6b6580; --linha: #e4e0ee;
  --verde: #1f8a5b; --verde-claro: #e3f6ec; --vermelho: #c0392b; --vermelho-claro: #fdeaea;
  --raio: 14px; --sombra: 0 1px 3px rgba(40, 20, 90, .08), 0 4px 14px rgba(40, 20, 90, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); background: var(--fundo); -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--roxo-2); }
.suave { color: var(--suave); font-size: .92rem; }
.oculto { display: none !important; }

/* estrutura */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topo { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: var(--roxo); color: #fff; }
.topo img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #fff; }
.topo .nome { font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); padding: .35rem .7rem; border-radius: 999px; font-size: .85rem; cursor: pointer; }
.corpo { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.menu { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: #fff; border-top: 1px solid var(--linha); padding-bottom: env(safe-area-inset-bottom); }
.menu a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .5rem 0 .55rem; font-size: .72rem; color: var(--suave); text-decoration: none; }
.menu a .ic { font-size: 1.3rem; line-height: 1; }
.menu a.ativo { color: var(--roxo); font-weight: 700; }
@media (min-width: 900px) {
  #app { flex-direction: row; flex-wrap: wrap; }
  .topo { width: 100%; }
  .menu { position: sticky; top: 56px; flex-direction: column; width: 220px; height: calc(100vh - 56px); border-top: 0; border-right: 1px solid var(--linha); padding: 1rem .5rem; gap: .2rem; }
  .menu a { flex: 0; flex-direction: row; gap: .7rem; padding: .7rem 1rem; font-size: .95rem; border-radius: 10px; }
  .menu a.ativo { background: var(--roxo-claro); }
  .corpo { width: auto; flex: 1; padding: 1.5rem 2rem 3rem; }
}

/* blocos */
.cartao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem; margin-bottom: 1rem; }
.cartao.destaque { border-left: 5px solid var(--ouro); }
.grade { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 1rem; }
.atalho { display: flex; flex-direction: column; gap: .3rem; padding: 1rem; background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); text-decoration: none; color: var(--texto); border: 0; font: inherit; text-align: left; cursor: pointer; }
.atalho .ic { font-size: 1.6rem; }
.atalho b { font-size: .98rem; }
.atalho small { color: var(--suave); }
.linha { display: flex; align-items: center; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--linha); }
.linha:last-child { border-bottom: 0; }
.linha .meio { flex: 1; min-width: 0; }
.linha .meio b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foto { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--roxo-claro); display: inline-flex; align-items: center; justify-content: center; color: var(--roxo); font-weight: 700; flex-shrink: 0; }
.selo { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--roxo-claro); color: var(--roxo); white-space: nowrap; }
.selo.ok { background: var(--verde-claro); color: var(--verde); }
.selo.alerta { background: var(--ouro-claro); color: #8a6214; }
.selo.erro { background: var(--vermelho-claro); color: var(--vermelho); }
.aviso { padding: .8rem 1rem; border-radius: 10px; background: var(--ouro-claro); color: #6b4b0d; margin-bottom: 1rem; }
.aviso.erro { background: var(--vermelho-claro); color: var(--vermelho); }
.aviso.ok { background: var(--verde-claro); color: var(--verde); }
.abas { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1rem; }
.abas button { border: 1px solid var(--linha); background: #fff; padding: .45rem .9rem; border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.abas button.ativo { background: var(--roxo); color: #fff; border-color: var(--roxo); }
.vazio { text-align: center; color: var(--suave); padding: 2rem 1rem; }

/* formulários */
label { display: block; font-weight: 600; font-size: .9rem; margin: .8rem 0 .3rem; }
input, select, textarea { width: 100%; font: inherit; padding: .7rem .8rem; border: 1px solid var(--linha); border-radius: 10px; background: #fff; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--roxo-2); outline-offset: 0; border-color: transparent; }
textarea { min-height: 110px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: .6rem; font-weight: 500; margin: .8rem 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.dupla { display: grid; gap: 0 .8rem; grid-template-columns: 1fr 1fr; }
.opcoes { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; margin: .5rem 0; }
.opcao { padding: 1rem .6rem; border: 2px solid var(--linha); border-radius: 12px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.opcao.ativo { border-color: var(--roxo); background: var(--roxo-claro); color: var(--roxo); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; padding: .75rem 1.1rem; border-radius: 10px; border: 0; cursor: pointer; background: var(--roxo); color: #fff; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.claro { background: var(--roxo-claro); color: var(--roxo); }
.btn.ouro { background: var(--ouro); color: #fff; }
.btn.verde { background: var(--verde); }
.btn.perigo { background: var(--vermelho-claro); color: var(--vermelho); }
.btn.pequeno { padding: .4rem .75rem; font-size: .85rem; }
.btn.cheio { width: 100%; }
.botoes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.img-prev { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--roxo-claro); display: block; margin-bottom: .5rem; }

/* entrada */
.tela-entrada { flex: 1; width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(160deg, var(--roxo), #1d1440); }
.tela-entrada .cartao { width: 100%; max-width: 420px; }
.marca { text-align: center; color: var(--roxo); margin-bottom: 1rem; }
.marca .logo { font-size: 2.4rem; }
.marca b { display: block; font-size: 1.4rem; letter-spacing: .5px; }

/* etapas */
.etapas { display: flex; gap: .3rem; margin-bottom: 1rem; }
.etapas span { flex: 1; height: 6px; border-radius: 3px; background: var(--linha); }
.etapas span.feito { background: var(--ouro); }

/* fila */
.filas { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.fila-col { background: #fff; border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; border-top: 6px solid var(--cor, var(--roxo)); }
.fila-col header { padding: .7rem .9rem; border-bottom: 1px solid var(--linha); }
.fila-col header small { display: block; color: var(--suave); }
.ficha { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-bottom: 1px solid var(--linha); cursor: pointer; background: #fff; width: 100%; border-left: 0; border-right: 0; border-top: 0; font: inherit; text-align: left; }
.ficha .num { min-width: 2.2rem; height: 2.2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; background: var(--cor, var(--roxo)); color: #fff; }
.ficha.atendido { color: #a8a3b8; cursor: default; }
.ficha.atendido .num { background: #d9d6e2; }
.ficha.proximo { background: var(--roxo-claro); }
.ficha .meio { flex: 1; }
.ficha .meio b, .ficha .meio small { display: block; }
.status-gira { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.status-gira .totais { flex: 1; color: var(--suave); font-size: .9rem; }

/* consulente */
.vez { text-align: center; padding: 2rem 1rem; border-radius: var(--raio); background: var(--verde); color: #fff; }
.vez b { font-size: 1.6rem; display: block; margin-bottom: .3rem; }
.grande { font-size: 2.6rem; font-weight: 800; color: var(--roxo); }
.qr { width: 100%; max-width: 280px; margin: .5rem auto; display: block; }
.capa { width: 100%; height: 140px; object-fit: cover; border-radius: var(--raio) var(--raio) 0 0; margin: -1rem -1rem 1rem; width: calc(100% + 2rem); display: block; }

/* janela */
.janela-fundo { position: fixed; inset: 0; z-index: 20; background: rgba(20, 10, 40, .45); display: flex; align-items: flex-end; justify-content: center; }
.janela { background: #fff; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 1.2rem; }
@media (min-width: 600px) { .janela-fundo { align-items: center; } .janela { border-radius: 18px; } }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 30; background: var(--texto); color: #fff; padding: .7rem 1.1rem; border-radius: 10px; max-width: 90vw; box-shadow: var(--sombra); }
.toast.erro { background: var(--vermelho); }

/* impressão do QR da porta */
@media print {
  .topo, .menu, .nao-imprimir { display: none !important; }
  .corpo { padding: 0; }
  .cartao { box-shadow: none; }
}
