/* ===== Sistema de Ponto — estilos (sem dependências externas) ===== */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --navy: #0b1b3a;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-soft: #e8efff;
  --ok: #15803d;      --ok-bg: #dcfce7;
  --warn: #b45309;    --warn-bg: #fef3c7;
  --bad: #b91c1c;     --bad-bg: #fee2e2;
  --info: #1d4ed8;    --info-bg: #dbeafe;
  --neutral: #475569; --neutral-bg: #eef2f7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.pad { padding: 0 1.2rem 1.2rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* ===== topo ===== */
.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-in {
  max-width: 1180px; margin: 0 auto; padding: .6rem 1rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--brand);
  display: grid; place-items: center;
}
.brand-mark svg { width: 18px; height: 18px; }
.nav { display: flex; gap: .15rem; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: #c7d2e8; padding: .45rem .8rem; border-radius: 9px; font-weight: 500; white-space: nowrap;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.who { display: flex; align-items: center; gap: .6rem; color: #c7d2e8; font-size: .9rem; }
.who a { color: #c7d2e8; }
.who form { margin: 0; }
.linklike {
  background: none; border: 0; padding: 0; color: #c7d2e8; font: inherit; cursor: pointer;
}
.linklike:hover { color: #fff; text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.container.narrow { max-width: 560px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head p { margin: .15rem 0 0; color: var(--muted); }

/* ===== cartões ===== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-title { padding: 1rem 1.2rem 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; margin-bottom: 1rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .95rem 1.1rem;
}
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.15; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }
.stat.info .value { color: var(--brand); }

/* ===== botões ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.05rem; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font: 600 .95rem var(--font); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }
.btn.secondary:hover { background: var(--neutral-bg); }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #991b1b; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn.lg { padding: 1rem 1.5rem; font-size: 1.1rem; border-radius: 14px; width: 100%; }
.btn svg { width: 1.15em; height: 1.15em; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(29, 78, 216, .35); outline-offset: 2px;
}

/* ===== formulários ===== */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field > label, .label-text { font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
input[type=text], input[type=password], input[type=time], input[type=date], input[type=number],
input[type=month], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit;
}
textarea { min-height: 88px; resize: vertical; }
input:disabled { background: var(--neutral-bg); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.check {
  display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .75rem;
  border: 1px solid var(--line-2); border-radius: 999px; background: #fff; cursor: pointer; font-weight: 500;
}
.check input { margin: 0; accent-color: var(--brand); }
.check:has(input:checked) { background: var(--brand-soft); border-color: #a9c0ff; }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.toolbar .field { margin: 0; }
.toolbar select, .toolbar input { min-width: 0; }

/* ===== avisos ===== */
.flashes { max-width: 1180px; margin: 1rem auto 0; padding: 0 1rem; }
.container.narrow .flashes, .flashes.in-narrow { padding: 0; }
.flash {
  padding: .8rem 1rem; border-radius: 12px; margin-bottom: .6rem; font-weight: 500;
  border: 1px solid transparent;
}
.flash.success { background: var(--ok-bg); color: #14532d; border-color: #bbf0cc; }
.flash.error { background: var(--bad-bg); color: #7f1d1d; border-color: #fbc5c5; }
.flash.info { background: var(--info-bg); color: #1e3a8a; border-color: #bcd2fb; }

/* ===== tabelas ===== */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: .65rem .85rem; background: #f8fafc;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: .6rem .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfe; }
.table .num { text-align: right; }
.table tr.off td { background: #f8fafc; color: var(--muted); }
.table tr.today td { background: #f3f7ff; }
.table tr.today td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.table tfoot td { background: #f8fafc; font-weight: 700; border-top: 2px solid var(--line-2); }
.date-cell { white-space: nowrap; font-weight: 600; }
.date-cell small { color: var(--muted); font-weight: 500; margin-left: .35rem; }

/* ===== chips e selos ===== */
.chip {
  display: inline-block; padding: .12rem .5rem; border-radius: 7px; font-weight: 600;
  font-size: .86rem; margin: .1rem .2rem .1rem 0; font-variant-numeric: tabular-nums;
}
.chip-in { background: var(--ok-bg); color: #166534; }
.chip-out { background: var(--neutral-bg); color: #334155; }
.chip-manual { box-shadow: inset 0 0 0 1.5px var(--warn); }
.badge {
  display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem;
  font-weight: 700; white-space: nowrap;
}
.b-ok, .b-presente { background: var(--ok-bg); color: var(--ok); }
.b-atraso, .b-aguardando { background: var(--warn-bg); color: var(--warn); }
.b-falta, .b-atrasado, .b-incompleto { background: var(--bad-bg); color: var(--bad); }
.b-em_andamento { background: var(--info-bg); color: var(--info); }
.b-folga, .b-feriado, .b-saiu, .b-neutral { background: var(--neutral-bg); color: var(--neutral); }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); align-items: center; }

details.adj summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .85rem; list-style: none; }
details.adj summary::-webkit-details-marker { display: none; }
details.adj[open] summary { margin-bottom: .5rem; }
.adj-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; min-width: 260px; }
.adj-item { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: .45rem; }
.adj-item input[type=time] { width: auto; flex: 0 0 118px; padding: .35rem .55rem; font-size: .85rem; }
.adj-item input[type=text] { flex: 1 1 140px; padding: .35rem .55rem; font-size: .85rem; }

/* ===== login ===== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background:
  radial-gradient(1100px 500px at 10% -10%, #dbe6ff 0%, transparent 60%),
  radial-gradient(900px 500px at 110% 110%, #e1ecff 0%, transparent 55%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { color: var(--ink); justify-content: center; margin-bottom: 1.1rem; font-size: 1.15rem; }
.auth-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: .25rem; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.25rem; }

/* ===== área do colaborador ===== */
.hero { text-align: center; padding: 1.4rem 1.2rem 1.3rem; }
.hero .weekday { color: var(--muted); font-weight: 600; }
.hero .clock { font-size: 3.4rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero .next { margin: .9rem 0 1rem; color: var(--ink-2); }
.hero .next strong { color: var(--ink); }
.today-list { margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--line-2); }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.mini { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; text-align: center; }
.mini .v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini .l { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.list-days { list-style: none; padding: 0; margin: 0; }
.list-days li { display: flex; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.list-days li:last-child { border-bottom: 0; }

.scanner { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 70vh; width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame {
  position: absolute; inset: 14% 12%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .38); pointer-events: none;
}

.month-nav { display: flex; align-items: center; gap: .5rem; }
.month-nav .label { font-weight: 700; min-width: 150px; text-align: center; }

.error-box { text-align: center; padding: 3rem 1rem; }
.error-box .code { font-size: 3.5rem; font-weight: 800; color: var(--line-2); line-height: 1; }

/* ===== tela do QR (tablet/TV) ===== */
body.display {
  background: radial-gradient(1200px 700px at 15% 0%, #16346b 0%, transparent 60%), var(--navy);
  color: #fff; min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; overflow: hidden;
}
.display-in { width: 100%; max-width: 980px; display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: center; }
.display .company { font-size: 1.2rem; font-weight: 700; color: #9db4e3; letter-spacing: .02em; }
.display .dclock { font-size: clamp(3.5rem, 11vw, 8rem); font-weight: 700; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin: .4rem 0; }
.display .ddate { font-size: clamp(1.1rem, 2.6vw, 1.8rem); color: #c7d2e8; }
.display .how { margin-top: 2rem; color: #9db4e3; font-size: 1.1rem; max-width: 30ch; }
.display .how b { color: #fff; }
.qr-card { background: #fff; border-radius: 28px; padding: 1.6rem; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); width: min(46vh, 80vw, 420px); }
.qr-card img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.qr-bar { height: 8px; background: #e2e8f0; border-radius: 99px; margin-top: 1.1rem; overflow: hidden; }
.qr-bar > i { display: block; height: 100%; width: 100%; background: var(--brand); border-radius: 99px; }
.qr-offline { color: #fecaca; margin-top: .8rem; text-align: center; font-weight: 600; }

/* ===== responsivo ===== */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .display-in { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: 1.5rem; }
  .display .how { margin-left: auto; margin-right: auto; }
}
@media (max-width: 560px) {
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
  .hero .clock { font-size: 3rem; }
  .who .who-name { display: none; }
  .topbar-in { gap: .5rem 1rem; }
  .who { margin-left: auto; }
  .nav { order: 3; flex: 1 1 100%; }
  .mini .v { font-size: 1.1rem; }
  .mini .l { font-size: .68rem; letter-spacing: 0; }
  .month-nav .label { min-width: 120px; }
}

/* ===== impressão (espelho de ponto em PDF/papel) ===== */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .no-print, .flashes { display: none !important; }
  .print-only { display: block; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table th, .table td { padding: 3px 6px; }
  .chip { background: none !important; padding: 0 3px 0 0; font-weight: 600; }
  .badge { background: none !important; padding: 0; }
  .table tr.today td { background: none; box-shadow: none; }
}
.sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; margin-top: 3.5rem; }
.sign-row div { border-top: 1px solid #000; padding-top: .3rem; text-align: center; font-size: .85rem; }
