:root {
  --fundo: #DCDCDC;
  --sombra: #AEAEAE;
  --laranja: #FF5F00;
  --preto: #000000;
  --branco: #FFFFFF;
  --raio: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--fundo);
  color: var(--preto);
  font-size: 14px;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------------- botões genéricos ---------------- */
.botao {
  background: var(--branco);
  border: 1.5px solid var(--sombra);
  border-radius: 8px;
  padding: 9px 18px;
  font-weight: 600;
  box-shadow: 0 2px 0 var(--sombra);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.botao:hover:not(:disabled) {
  color: var(--laranja);
  border-color: var(--laranja);
  box-shadow: 0 5px 10px var(--sombra);
  transform: translateY(-2px);
}
.botao:active:not(:disabled) { transform: translateY(0); box-shadow: 0 1px 0 var(--sombra); }
.botao:disabled { opacity: .5; cursor: not-allowed; }
.botao.primario { background: var(--preto); color: var(--branco); border-color: var(--preto); }
.botao.primario:hover:not(:disabled) { background: var(--branco); }
.botao.pequeno { padding: 5px 12px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--laranja); outline-offset: 2px; }

/* ---------------- login ---------------- */
.tela-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.cartao-login {
  width: 100%;
  max-width: 380px;
  background: var(--branco);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 10px 0 var(--sombra), 0 18px 30px var(--sombra);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.logo-login { width: 84px; margin: 0 auto; }
.cartao-login h1 { margin: 0; font-size: 24px; }
.cartao-login .sub { margin: -8px 0 8px; color: #555; }
.cartao-login label { text-align: left; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
input[type=email], input[type=password], input[type=text], input[type=date] {
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--sombra);
  border-radius: 8px;
  background: var(--branco);
  transition: border-color .15s;
}
input:hover, input:focus { border-color: var(--laranja); outline: none; }
.erro { color: #b00000; background: #fff0f0; border-radius: 6px; padding: 8px; margin: 0; font-size: 13px; }
.ok { color: #1e6b1e; background: #effaef; border-radius: 6px; padding: 8px; margin: 0; font-size: 13px; }

/* ---------------- estrutura (camadas: topo > lateral > conteúdo) ---------------- */
.app {
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "topo topo" "lateral conteudo";
  height: 100vh;
}
.topo {
  grid-area: topo;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: var(--fundo);
  box-shadow: 0 6px 10px -2px var(--sombra), 0 3px 0 var(--sombra);
}
.topo .logo { width: 54px; height: 54px; object-fit: contain; }
.topo h1 { margin: 0; font-size: 20px; }
.atualizado { margin: 3px 0 0; font-size: 13px; color: #333; display: flex; gap: 10px; flex-wrap: wrap; }
.aviso { color: #b00000; font-weight: 600; }
.topo-direita { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.btn-datacrazy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  color: var(--preto);
  background: var(--branco);
  border: 1.5px solid transparent;
  border-radius: var(--raio);
  box-shadow: 0 3px 0 var(--sombra);
  text-decoration: none;
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn-datacrazy svg { height: 20px; width: auto; display: block; }
.btn-datacrazy .seta { font-size: 13px; font-weight: 700; }
.btn-datacrazy:hover, .btn-datacrazy:focus-visible {
  color: var(--laranja);
  border-color: var(--laranja);
  box-shadow: 0 8px 16px var(--sombra);
  transform: translateY(-2px);
}
.setor-atual {
  font-weight: 700;
  border: 1.5px solid var(--laranja);
  border-radius: 20px;
  padding: 6px 14px;
  background: var(--branco);
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--sombra);
  transition: color .15s, box-shadow .15s, transform .15s;
}
.setor-atual:hover, .setor-atual:focus-visible {
  color: var(--laranja);
  box-shadow: 0 8px 16px var(--sombra);
  transform: translateY(-2px);
}
.setor-atual:empty { display: none; }

.lateral {
  grid-area: lateral;
  position: relative;
  z-index: 2;
  background: var(--fundo);
  box-shadow: 6px 0 10px -2px var(--sombra), 3px 0 0 var(--sombra);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}
.grupo { display: flex; flex-direction: column; gap: 6px; }
.grupo.inferior { border-top: 1.5px solid var(--sombra); padding-top: 12px; margin-top: 12px; }
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--branco);
  border: 1.5px solid transparent;
  border-radius: var(--raio);
  padding: 11px 12px;
  font-weight: 600;
  box-shadow: 0 2px 0 var(--sombra);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.item .ic { width: 18px; text-align: center; opacity: .8; }
.item:hover, .subitem:hover {
  color: var(--laranja);
  border-color: var(--laranja);
  box-shadow: 0 6px 12px var(--sombra);
  transform: translateY(-2px);
}
.item.ativo, .subitem.ativo { border-color: var(--laranja); }
.sub { display: none; flex-direction: column; gap: 5px; padding: 2px 0 6px 18px; }
.sub.aberto { display: flex; }
.subitem {
  text-align: left;
  background: var(--branco);
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  box-shadow: 0 1px 0 var(--sombra);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.sub .vazio { font-size: 12px; color: #555; padding: 4px; }

.usuario-wrap { position: relative; }
.usuario-pop {
  display: none;
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  width: 100%;
  min-width: 220px;
  background: var(--branco);
  border: 1.5px solid var(--laranja);
  border-radius: var(--raio);
  padding: 14px;
  box-shadow: 0 8px 18px var(--sombra);
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  word-break: break-all;
}
.usuario-pop span { font-size: 12.5px; color: #333; }
.usuario-pop .botao { margin-top: 6px; }
.usuario-wrap:hover .usuario-pop, .usuario-wrap:focus-within .usuario-pop { display: flex; }
/* ponte invisível para o mouse não "cair" entre o botão e o popup */
.usuario-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; }

.conteudo {
  grid-area: conteudo;
  position: relative;
  z-index: 1;
  overflow: auto;
  padding: 26px 28px 40px;
}

/* ---------------- painéis ---------------- */
.painel {
  background: var(--fundo);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 0 0 1.5px var(--sombra), 0 6px 0 var(--sombra);
  margin-bottom: 22px;
}
.painel-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.painel h2 { margin: 0; font-size: 19px; }
.painel .desc { margin: 4px 0 0; color: #333; font-size: 13px; }

.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.cartao {
  background: var(--branco);
  border-radius: var(--raio);
  padding: 12px 14px;
  border: 1.5px solid transparent;
  box-shadow: 0 3px 0 var(--sombra);
  transition: border-color .15s, box-shadow .15s, transform .15s, color .15s;
}
.cartao:hover { border-color: var(--laranja); box-shadow: 0 8px 16px var(--sombra); transform: translateY(-2px); }
.cartao .rot { font-size: 12px; color: #444; }
.cartao .val { font-size: 24px; font-weight: 700; margin-top: 2px; }
.cartao.destaque .val { color: var(--laranja); }

.tabela-wrap { overflow-x: auto; background: var(--branco); border-radius: var(--raio); box-shadow: 0 3px 0 var(--sombra); }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { padding: 10px 12px; text-align: center; white-space: nowrap; }
th { background: var(--preto); color: var(--branco); font-size: 12.5px; font-weight: 600; position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
tbody tr:nth-child(even) { background: #f3f3f3; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fff1e8; }
tbody tr:hover td:first-child { color: var(--laranja); }
td.total { font-weight: 700; }
tfoot td { font-weight: 700; border-top: 2px solid var(--preto); background: var(--fundo); }
.vazio-tabela { padding: 30px; text-align: center; color: #444; }

/* ---------------- calendário ---------------- */
.cal-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cal-cab strong { font-size: 16px; }
.cal-grade { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-sem { text-align: center; font-weight: 700; font-size: 12px; color: #333; padding: 4px 0; }
.dia {
  min-height: 74px;
  background: var(--branco);
  border: 1.5px solid transparent;
  border-radius: var(--raio);
  padding: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 3px 0 var(--sombra);
  transition: color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.dia .n { font-weight: 700; font-size: 16px; }
.dia .ds { font-size: 11px; color: #555; }
.dia .qt { font-size: 12px; font-weight: 600; }
.dia:not(:disabled):hover { color: var(--laranja); border-color: var(--laranja); box-shadow: 0 8px 16px var(--sombra); transform: translateY(-2px); }
.dia:not(:disabled):hover .ds { color: var(--laranja); }
.dia:disabled { background: transparent; box-shadow: none; border: 1.5px dashed var(--sombra); color: #888; cursor: default; }
.dia.hoje { border-color: var(--preto); }
.dia.selecionado { border-color: var(--laranja); }
.dia.vago { visibility: hidden; }

/* calendário de intervalo (relatórios) */
.rel-grade { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 24px; align-items: start; }
.mini .dia { min-height: 44px; padding: 6px; align-items: center; justify-content: center; text-align: center; }
.mini .dia .n { font-size: 14px; }
.mini .dia.no-intervalo { background: #ffe3d1; }
.mini .dia.extremo { background: var(--laranja); color: var(--branco); border-color: var(--laranja); }
.campos-data { display: flex; flex-direction: column; gap: 14px; }
.campos-data label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.dica { font-size: 12.5px; color: #333; margin: 0; }
.atalhos { display: flex; flex-wrap: wrap; gap: 8px; }

.progresso { padding: 30px 10px; text-align: center; }
.barra { height: 22px; background: var(--branco); border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--sombra); margin: 14px auto; max-width: 520px; }
.barra > div { height: 100%; width: 0; background: var(--laranja); transition: width .15s; }
.progresso .pct { font-weight: 700; font-size: 18px; }

/* ---------------- configurações ---------------- */
.form-usuario { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-usuario label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chk {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--branco);
  border: 1.5px solid var(--sombra);
  border-radius: 20px;
  padding: 6px 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.chk:hover { color: var(--laranja); border-color: var(--laranja); }
.chk input { accent-color: var(--laranja); }
.chk:has(input:checked) { border-color: var(--laranja); }
.chk.admin { font-weight: 700; }
.acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--fundo); margin: 1px; }
.tag.adm { background: var(--preto); color: var(--branco); }

.carregando { padding: 40px; text-align: center; color: #333; }

[data-dica] { cursor: help; }
.dica-flutuante {
  position: fixed;
  z-index: 100;
  max-width: 260px;
  padding: 8px 12px;
  background: var(--preto);
  color: var(--branco);
  border-left: 3px solid var(--laranja);
  border-radius: 8px;
  box-shadow: 0 8px 18px var(--sombra);
  font-size: 12.5px;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s;
}
.dica-flutuante.visivel { opacity: 1; visibility: visible; }

.filtro { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.filtro select {
  font: inherit;
  padding: 8px 10px;
  border: 1.5px solid var(--sombra);
  border-radius: 8px;
  background: var(--branco);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.filtro select:hover, .filtro select:focus { border-color: var(--laranja); outline: none; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "topo" "lateral" "conteudo"; height: auto; min-height: 100vh; }
  .lateral { box-shadow: 0 6px 10px -2px var(--sombra), 0 3px 0 var(--sombra); }
  .topo h1 { font-size: 16px; }
  .setor-atual { display: none; }
  .btn-datacrazy { height: 34px; padding: 0 10px; }
  .btn-datacrazy svg { height: 16px; }
  .conteudo { padding: 18px 16px 30px; overflow: visible; }
  .rel-grade { grid-template-columns: 1fr; }
  .dia { min-height: 56px; padding: 5px; }
  .dia .ds { display: none; }
}
