:root {
  --fundo: #f6f7f9;
  --cartao: #ffffff;
  --texto: #1f2937;
  --suave: #6b7280;
  --borda: #e5e7eb;
  --primaria: #ea580c;
  --primaria-forte: #c2410c;
  --primaria-escura: #9a3412;
  --primaria-clara: #ffedd5;
  --especial: #2563eb;
  --aprovada: #16a34a;
  --aprovada-fundo: #dcfce7;
  --pendente: #b45309;
  --pendente-fundo: #fef3c7;
  --recusada: #dc2626;
  --recusada-fundo: #fee2e2;
  --fechado: #eef0f3;
  --perigo: #dc2626;
  --sombra: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.06);
  --raio: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.carregando { text-align: center; padding: 3rem 1rem; color: var(--suave); }
.oculto { display: none !important; }

/* ───────── botões ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--borda); background: var(--cartao);
  border-radius: 10px; padding: .55rem .9rem; font-weight: 600; min-height: 42px; text-decoration: none;
}
.btn:hover { background: #f3f4f6; }
.btn-primaria { background: var(--primaria-forte); color: #fff; border-color: var(--primaria-forte); }
.btn-primaria:hover { background: var(--primaria-escura); }
.btn-perigo { color: var(--perigo); border-color: #fecaca; }
.btn-perigo:hover { background: var(--recusada-fundo); }
.btn-ok { color: var(--aprovada); border-color: #bbf7d0; }
.btn-ok:hover { background: var(--aprovada-fundo); }
.btn-pequeno { min-height: 34px; padding: .3rem .65rem; font-size: .9rem; }
.btn-largo { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--primaria-forte); font-weight: 600; padding: .25rem; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--cor, var(--primaria)); color: #fff; font-weight: 700; font-size: .95rem;
}
.avatar.grande { width: 4rem; height: 4rem; font-size: 1.5rem; }

/* ───────── login ───────── */
.login { max-width: 460px; margin: 0 auto; padding: 2.5rem 1rem 3rem; text-align: center; }
.login .logo { width: 64px; height: 64px; }
.login h1 { margin: .75rem 0 .25rem; font-size: 1.6rem; }
.login > p { color: var(--suave); margin: 0 0 1.5rem; }
.nomes { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.nome-btn {
  display: flex; align-items: center; gap: .6rem; text-align: left;
  background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: .8rem; font-weight: 600; box-shadow: var(--sombra);
}
.nome-btn:hover { border-color: var(--primaria); }
.login details { margin-top: 2rem; color: var(--suave); }
.login summary { cursor: pointer; padding: .5rem; }
.login details .nomes { margin-top: .75rem; }

.pin { max-width: 340px; margin: 0 auto; padding: 2rem 1rem; text-align: center; }
.pin h2 { margin: .75rem 0 .25rem; }
.pin p { color: var(--suave); margin: 0 0 1.25rem; min-height: 1.5em; }
.pin p.erro { color: var(--perigo); font-weight: 600; }
.bolinhas { display: flex; justify-content: center; gap: .9rem; margin-bottom: 1.5rem; }
.bolinhas span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primaria); }
.bolinhas span.cheia { background: var(--primaria); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.teclado button {
  height: 64px; border-radius: 50%; width: 64px; margin: 0 auto;
  border: 1px solid var(--borda); background: var(--cartao); font-size: 1.5rem; font-weight: 600;
}
.teclado button:active { background: var(--primaria-clara); }
.pin form { display: grid; gap: .75rem; text-align: left; }
.campo { display: grid; gap: .3rem; }
.campo span { font-size: .85rem; color: var(--suave); font-weight: 600; }
.campo input, .campo select, .campo textarea {
  border: 1px solid var(--borda); border-radius: 10px; padding: .6rem .75rem; background: #fff; width: 100%;
}
.campo input:focus, .campo textarea:focus { outline: 2px solid var(--primaria); outline-offset: -1px; }

/* ───────── layout ───────── */
.topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; background: var(--primaria); color: #fff;
}
.topo .marca { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.topo .marca img { width: 28px; height: 28px; }
.topo .quem { display: flex; align-items: center; gap: .5rem; }
.topo .quem .avatar { width: 1.9rem; height: 1.9rem; font-size: .8rem; box-shadow: 0 0 0 2px #fff6; }
.topo .link { color: #fff; }
.abas {
  display: flex; gap: .25rem; overflow-x: auto; padding: .5rem 1rem 0;
  background: var(--cartao); border-bottom: 1px solid var(--borda); scrollbar-width: none;
}
.abas button {
  border: 0; background: none; padding: .6rem .8rem; font-weight: 600; color: var(--suave);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.abas button.ativa { color: var(--primaria-forte); border-bottom-color: var(--primaria); }
.contagem {
  display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.3rem; padding: 0 .3rem;
  border-radius: 99px; background: var(--perigo); color: #fff; font-size: .75rem; margin-left: .25rem;
}
main { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.cartao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem; }
.cartao + .cartao { margin-top: 1rem; }
.cartao h3 { margin-bottom: .75rem; font-size: 1rem; }

.navmes { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.navmes h2 { font-size: 1.25rem; text-transform: capitalize; text-align: center; flex: 1; }
.navmes .btn { width: 42px; padding: 0; font-size: 1.2rem; }
.selo { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; vertical-align: middle; }
.selo.fechado { background: #e5e7eb; color: #374151; }

.resumo { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.resumo .item { flex: 1 1 140px; background: var(--cartao); border-radius: 12px; padding: .7rem .9rem; box-shadow: var(--sombra); }
.resumo .num { font-size: 1.5rem; font-weight: 700; }
.resumo .rot { font-size: .8rem; color: var(--suave); }

.legenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--suave); margin: .75rem 0 0; }
.legenda span { display: inline-flex; align-items: center; gap: .3rem; }
.legenda i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

.aviso {
  border-radius: 12px; padding: .75rem .9rem; margin-bottom: 1rem; font-size: .92rem;
  background: var(--pendente-fundo); color: #78350f;
}
.aviso.info { background: var(--primaria-clara); color: #7c2d12; }
.aviso ul { margin: .35rem 0 0; padding-left: 1.2rem; }

/* ───────── calendário (vendedora) ───────── */
.calendario { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendario .cab { text-align: center; font-size: .75rem; font-weight: 700; color: var(--suave); padding: .2rem 0; text-transform: uppercase; }
.dia {
  position: relative; min-height: 64px; border-radius: 10px; border: 1px solid var(--borda);
  background: var(--cartao); padding: .3rem; text-align: left; display: flex; flex-direction: column; gap: 2px;
}
.dia .n { font-weight: 700; font-size: .9rem; }
.dia.fora { opacity: .45; }
.dia.passado { background: #fafafa; }
.dia.hoje { outline: 2px solid var(--primaria); outline-offset: -2px; }
.dia.fechado { background: var(--fechado); border-color: transparent; color: var(--suave); }
.dia.bloqueado { background: repeating-linear-gradient(135deg, #fff, #fff 6px, #fef2f2 6px, #fef2f2 12px); }
.dia .pontos { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; }
.dia .pontos i { width: 9px; height: 9px; border-radius: 50%; background: var(--cor); }
.dia .tag { font-size: .65rem; font-weight: 700; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dia.minha-pendente { background: var(--pendente-fundo); border-color: #fcd34d; }
.dia.minha-pendente .tag { color: var(--pendente); }
.dia.minha-aprovada { background: var(--aprovada-fundo); border-color: #86efac; }
.dia.minha-aprovada .tag { color: var(--aprovada); }
.dia.minha-recusada { background: var(--recusada-fundo); border-color: #fca5a5; }
.dia.minha-recusada .tag { color: var(--recusada); }
.dia.lotado:not([class*='minha-']) .n::after { content: ' ●'; color: var(--perigo); font-size: .6rem; vertical-align: middle; }

.semanas { display: grid; gap: .4rem; }
.semana { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: 10px; background: var(--fundo); font-size: .92rem; }
.semana .ok { color: var(--aprovada); font-weight: 700; }
.semana .falta { color: var(--pendente); font-weight: 700; }

/* ───────── grade (equipe / gestão) ───────── */
.grade-wrap { overflow-x: auto; border-radius: var(--raio); background: var(--cartao); box-shadow: var(--sombra); }
table.grade { border-collapse: separate; border-spacing: 0; font-size: .85rem; min-width: 100%; }
.grade th, .grade td { border-bottom: 1px solid var(--borda); text-align: center; padding: 0; }
.grade thead th { position: sticky; top: 0; background: var(--cartao); padding: .35rem .1rem; font-weight: 600; min-width: 34px; }
.grade thead th small { display: block; font-size: .65rem; color: var(--suave); text-transform: uppercase; }
.grade .nome { position: sticky; left: 0; z-index: 1; background: var(--cartao); text-align: left; padding: .35rem .6rem; white-space: nowrap; font-weight: 600; border-right: 1px solid var(--borda); }
.grade .nome .avatar { width: 1.5rem; height: 1.5rem; font-size: .7rem; margin-right: .35rem; }
.grade .seg { border-left: 2px solid #cbd5e1; }
.grade .col-fechado { background: var(--fechado); }
.grade .col-bloq { background: repeating-linear-gradient(135deg, transparent, transparent 5px, #fef2f2 5px, #fef2f2 10px); }
.grade .col-hoje { box-shadow: inset 0 3px 0 var(--primaria); }
.grade td.cel { height: 38px; min-width: 34px; }
.grade td.cel button { width: 100%; height: 100%; min-height: 38px; border: 0; background: none; padding: 0; font-weight: 700; font-size: .75rem; }
.grade td.cel button:hover { background: #f1f5f9; }
.grade .f { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; background: var(--cor); }
.grade .f.pendente { background: repeating-linear-gradient(135deg, var(--cor), var(--cor) 4px, color-mix(in srgb, var(--cor) 55%, #fff) 4px, color-mix(in srgb, var(--cor) 55%, #fff) 8px); outline: 2px dashed var(--pendente); outline-offset: 1px; }
.grade .f.recusada { background: var(--recusada-fundo); color: var(--recusada); text-decoration: line-through; }
.grade tfoot td { font-size: .75rem; font-weight: 700; padding: .35rem 0; color: var(--suave); }
.grade tfoot td.cheio { color: var(--aprovada); }
.grade tfoot td.excesso { color: #fff; background: var(--perigo); }
.grade .sem { font-size: .75rem; padding: 0 .5rem; white-space: nowrap; }

.barra { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.barra .espaco { flex: 1; }

/* ───────── listas ───────── */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--borda); }
.lista li:last-child { border-bottom: 0; }
.lista .cresce { flex: 1; min-width: 0; }
.lista small { color: var(--suave); display: block; }
.vazio { color: var(--suave); text-align: center; padding: 1.5rem 0; }
.form-linha { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.form-linha .campo { flex: 1 1 160px; }
.dias-check { display: flex; flex-wrap: wrap; gap: .4rem; }
.dias-check label { border: 1px solid var(--borda); border-radius: 8px; padding: .35rem .6rem; display: inline-flex; gap: .3rem; align-items: center; }
input[type='color'] { width: 42px; height: 34px; padding: 2px; border: 1px solid var(--borda); border-radius: 8px; background: #fff; }
.grade-2 { display: grid; gap: 1rem; }
@media (min-width: 900px) { .grade-2 { grid-template-columns: 1fr 1fr; align-items: start; } .grade-2 .cartao + .cartao { margin-top: 0; } }

/* ───────── diálogo e toast ───────── */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(440px, calc(100vw - 24px));
  box-shadow: 0 20px 60px rgb(0 0 0 / .25); color: var(--texto);
}
dialog::backdrop { background: rgb(15 23 42 / .45); }
.dlg { padding: 1.25rem; display: grid; gap: .9rem; }
.dlg h3 { font-size: 1.15rem; }
.dlg h3::first-letter { text-transform: uppercase; }
.dlg .acoes { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.dlg .acoes.coluna { flex-direction: column; }
.dlg .acoes.coluna .btn { width: 100%; }
.dlg ul { margin: 0; padding-left: 1.1rem; }
.status { font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; }
.status.pendente { background: var(--pendente-fundo); color: var(--pendente); }
.status.aprovada { background: var(--aprovada-fundo); color: var(--aprovada); }
.status.recusada { background: var(--recusada-fundo); color: var(--recusada); }
.senha-gerada { font: 700 1.6rem/1 ui-monospace, Consolas, monospace; letter-spacing: .15em; text-align: center; background: var(--fundo); padding: .9rem; border-radius: 12px; user-select: all; }

#toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translate(-50%, 150%);
  background: #111827; color: #fff; padding: .75rem 1rem; border-radius: 12px; max-width: calc(100vw - 32px);
  transition: transform .25s ease, visibility .25s; z-index: 100; font-weight: 500; box-shadow: var(--sombra);
  visibility: hidden;
}
#toast.mostra { transform: translate(-50%, 0); visibility: visible; }
#toast.erro { background: var(--perigo); }

@media (min-width: 700px) {
  .dia { min-height: 84px; padding: .45rem; }
  .dia .n { font-size: 1rem; }
  .dia .tag { font-size: .72rem; }
  .nomes { grid-template-columns: repeat(3, 1fr); }
  .login { max-width: 640px; }
}

/* ───────── impressão: só a grade, em paisagem ───────── */
.so-impressao { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .topo, .abas, .barra, .navmes .btn, .aviso, .legenda, #toast, .nao-imprime { display: none !important; }
  .so-impressao { display: block; margin-bottom: 6px; }
  main { padding: 0; max-width: none; }
  .grade-wrap { overflow: visible; box-shadow: none; }
  .grade td.cel { height: 24px; min-width: 0; }
  .grade .f { width: 18px; height: 18px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .grade .col-fechado, .grade .nome .avatar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ───────── dias especiais (campanha, feriado aberto) ───────── */
.dia.especial { border: 2px solid var(--especial); }
.dia.trabalho { background: #dbeafe; }
.dia.trabalho .tag { color: var(--especial); }
/* ───────── férias ───────── */
.dia.ferias { background: #e0f2fe; border-color: #7dd3fc; }
.dia.ferias .tag { color: #0369a1; }
.dia.ferias-pendente { border-style: dashed; }
.grade .fe { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #e0f2fe; font-size: .85rem; }
.grade .fe.pendente { outline: 2px dashed var(--pendente); outline-offset: 1px; }
.caixa-regras { margin-top: 1rem; background: var(--fundo); border-radius: 12px; padding: .75rem .9rem; font-size: .88rem; }
.caixa-regras ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.guia-frame { display: block; width: 100%; height: 70vh; border: 0; }
.dia .tag .longo { display: none; }
.dia .tag .curto { font-size: .8rem; }
@media (min-width: 700px) { .dia .tag .longo { display: inline; } .dia .tag .curto { display: none; } }
.dica { color: var(--suave); font-size: .82rem; font-weight: 400; }
.grade .col-especial { box-shadow: inset 0 -3px 0 var(--especial); }
.grade th small.marca { color: var(--especial); font-size: .7rem; }
.grade .t { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #dbeafe; color: var(--especial); font-weight: 800; }
.opcoes { display: grid; gap: .4rem; }
.opcao { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--borda); border-radius: 10px; padding: .6rem .75rem; cursor: pointer; }
.opcao:has(input:checked) { border-color: var(--primaria); background: var(--primaria-clara); }
.campo input[type='radio'], .campo input[type='checkbox'] { width: auto; padding: 0; margin: 0; }
.dias-check label { white-space: nowrap; }
.opcao input { margin-top: .25rem !important; accent-color: var(--primaria-forte); flex: none; }
.opcao > span { flex: 1; }
.opcao small { display: block; color: var(--suave); }
input[type="checkbox"] { accent-color: var(--primaria-forte); }
