:root {
  --bg: #eef0f4;
  --panel: #ffffff;
  --ink: #1d2230;
  --muted: #5d6477;
  --line: #d7dbe3;
  --accent: #2f3c8f;
  --accent-ink: #ffffff;
  --accent-soft: #e8ebfa;
  --orange: #e8891c;
  --ok: #1f7a3f;
  --ok-soft: #e3f3e8;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  --danger: #b3261e;
  --danger-soft: #fbe5e3;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 Arial, Helvetica, sans-serif; }
button, input, select { font: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #f6f7f9; color: var(--ink); font-weight: bold; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #eceef2; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { color: var(--danger); }
.btn.link { background: none; border: 0; padding: 4px 6px; color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn.big { font-size: 17px; padding: 12px 22px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: bold; }
label.f input, label.f select {
  font-size: 15px; font-weight: normal; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
label.f input:focus, label.f select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.msg { padding: 9px 12px; border-radius: 6px; font-size: 14px; }
.msg.erro { background: var(--danger-soft); color: var(--danger); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.aviso { background: var(--warn-soft); color: var(--warn); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel); border-radius: 12px; padding: 28px 26px;
  box-shadow: 0 4px 24px rgba(20, 30, 70, .10); display: flex; flex-direction: column; gap: 14px;
}
.auth-card img { width: 170px; align-self: center; }
.auth-card h1 { font-size: 18px; margin: 0; text-align: center; }
.auth-card p { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- estrutura ---------- */
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 8px 16px; flex-wrap: wrap;
}
.topbar img { height: 30px; }
.topbar .titulo { font-weight: bold; font-size: 16px; }
.topbar .esp { flex: 1; }
.topbar .quem { color: var(--muted); font-size: 14px; }
.tabs { background: var(--panel); border-bottom: 1px solid var(--line); display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; }
.tabs a {
  padding: 11px 14px; text-decoration: none; color: var(--muted); font-weight: bold; font-size: 14px;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a.ativo { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a.add { color: var(--accent); }
.main { padding: 20px 16px 48px; max-width: 1280px; margin: 0 auto; }
.head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.head h2 { margin: 0; font-size: 20px; }
.head .sub { color: var(--muted); font-size: 14px; }
.head .esp { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- tabela de colaboradores ---------- */
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tabela td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela td.nome a { font-weight: bold; text-decoration: none; }
.tabela td.nome a:hover { text-decoration: underline; }
.tabela .hoje { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.tabela-wrap { overflow-x: auto; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: bold; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.aviso { background: var(--warn-soft); color: var(--warn); }
.tag.off { background: #eceef2; color: var(--muted); }
.vazio { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- pasta + folha ---------- */
.pasta-layout { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
.pasta { padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.pasta h3 { margin: 2px 4px 8px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.pasta .ano { margin: 10px 4px 4px; font-size: 12px; color: var(--muted); font-weight: bold; }
.pasta a {
  display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 14px;
}
.pasta a:hover { background: var(--bg); }
.pasta a.ativo { background: var(--accent-soft); color: var(--accent); font-weight: bold; }
.pasta a .atual { font-size: 11px; color: var(--orange); font-weight: bold; }
.acoes { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.relogio { font-size: 26px; font-weight: bold; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.relogio small { display: block; font-size: 12px; color: var(--muted); font-weight: normal; letter-spacing: 0; }
.ponto-card { padding: 14px 16px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ponto-card .prox { color: var(--muted); font-size: 14px; }
.sheet-scroll { overflow-x: auto; padding-bottom: 8px; }

/* ---------- folha A4 (igual ao PDF: 595 x 841 pt) ---------- */
.sheet {
  position: relative; width: 595pt; height: 841pt; margin: 0 auto;
  background: #fff; color: #000; box-shadow: 0 2px 12px rgba(0, 0, 0, .16);
  font-family: Arial, Helvetica, sans-serif; font-weight: bold; overflow: hidden;
}
.sheet svg.grid { position: absolute; left: 0; top: 0; width: 595pt; height: 841pt; pointer-events: none; }
.sheet .abs { position: absolute; white-space: nowrap; line-height: 1; }
.sheet .ctr { position: absolute; display: flex; align-items: center; justify-content: center; line-height: 1; white-space: nowrap; }
.sheet .name { text-decoration: underline; text-decoration-thickness: .72pt; text-underline-offset: 1.2pt; font-size: 11.1pt; }
.sheet .logo { position: absolute; left: 214.2pt; top: 126.2pt; width: 198.7pt; height: 67.2pt; }
.sheet .day { position: absolute; display: flex; align-items: center; justify-content: center; font-size: 11.6pt; user-select: none; }
.sheet .fds { position: absolute; background: #e9ebef; }
.sheet .linha-clique { position: absolute; cursor: pointer; z-index: 2; }
.sheet .linha-clique:hover { background: rgba(47, 60, 143, .10); outline: 1pt solid rgba(47, 60, 143, .45); }
.sheet .dash { position: absolute; display: flex; align-items: center; justify-content: center; font-size: 11.6pt; }
.sheet .stat { font-size: 11.6pt; }
.sheet .cellv { font-size: 10pt; }
.sheet .today { position: absolute; pointer-events: none; background: rgba(47, 60, 143, .08); outline: 1.5pt solid rgba(47, 60, 143, .5); }

/* ---------- diálogos ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(15, 20, 40, .45); }
dialog form, dialog .corpo { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
dialog h3 { margin: 0 0 4px; font-size: 18px; }
dialog .linha { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog .horarios { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
dialog .horarios input { text-align: center; }
dialog .botoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
dialog.largo { width: min(760px, calc(100vw - 32px)); }
.hist { max-height: 60vh; overflow: auto; font-size: 13px; }
.hist td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dica { font-size: 13px; color: var(--muted); margin: 0; }

@media (max-width: 860px) {
  .pasta-layout { grid-template-columns: 1fr; }
  .pasta { position: static; max-height: 220px; }
  dialog .linha { grid-template-columns: 1fr; }
  dialog .horarios { grid-template-columns: 1fr 1fr; }
}

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .sheet { margin: 0; box-shadow: none; }
  #print-root .today { display: none; }
  #print-root .fds, #print-root .linha-clique { display: none; }
}
#print-root { display: none; }

/* ---------- gestores ---------- */
.tabs .sep { flex: 1; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); }
fieldset.setores { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 10px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
fieldset.setores legend { font-size: 13px; color: var(--muted); font-weight: bold; padding: 0 4px; }
