:root {
  --bg: #000;
  --panel: #0e0e0e;
  --panel-2: #161616;
  --line: #2a2a2a;
  --text: #fff;
  --muted: #a3a3a3;
  --neon: #39ff14;
  --neon-dim: #1f8f0b;
  --amber: #ffb020;
  --red: #ff4d4d;
  --blue: #5ab0ff;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--neon); }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--neon); outline-offset: 2px; }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(0,0,0,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.topbar .logo-sm { height: 44px; width: auto; max-width: 110px; object-fit: contain; display: block; }
.topbar .spacer { flex: 1; }
.store-pick { display: flex; align-items: center; gap: 8px; }
.store-pick label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.store-pick select { font-weight: 700; border-color: var(--neon); }
.store-name { font-weight: 800; color: var(--neon); }
.who { font-size: .9rem; color: var(--muted); }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
nav.tabs a {
  color: var(--muted); text-decoration: none; padding: 12px 12px; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent;
}
nav.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--neon); }
main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 80px; }

/* ---------- controles ---------- */
button, .btn {
  font: inherit; font-weight: 700; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 11px 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  min-height: 44px; transition: transform .12s ease, background .12s ease, opacity .12s;
}
button:hover, .btn:hover { border-color: #444; }
button:active, .btn:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: progress; }
.btn-primary { background: var(--neon); color: #000; border-color: var(--neon); }
.btn-primary:hover { background: #5cff3f; border-color: #5cff3f; }
.btn-ghost { background: transparent; }
.btn-danger { border-color: #5a1f1f; color: #ffb3b3; }
.btn-sm { padding: 6px 10px; min-height: 36px; font-size: .88rem; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
input, select, textarea {
  font: inherit; color: var(--text); background: #0b0b0b; border: 1px solid #333; border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--neon); }
label.field { display: grid; gap: 6px; font-size: .88rem; color: var(--muted); }
label.check { display: flex; gap: 10px; align-items: center; color: var(--text); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- cartões e estados ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card, .stack > * + * { margin-top: 14px; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.st-working { color: var(--neon); border-color: var(--neon-dim); }
.st-break { color: var(--amber); border-color: #6b4a0c; }
.st-none, .st-closed { color: var(--muted); border-color: #333; }
.st-pending { color: var(--red); border-color: #6b1f1f; }
.st-paid { color: var(--neon); border-color: var(--neon-dim); }
.st-unpaid { color: var(--amber); border-color: #6b4a0c; }
.st-corrected { color: var(--blue); border-color: #1f466b; }
.alert { border: 1px solid #6b1f1f; background: #1a0707; border-radius: var(--radius); padding: 12px 14px; }
.alert-info { border-color: #1f466b; background: #07111a; }
.alert a { color: #fff; font-weight: 700; }
.empty { color: var(--muted); text-align: center; padding: 28px 10px; }

/* ---------- área do funcionário ---------- */
.punch-hero { text-align: center; padding: 22px 16px 26px; }
.punch-hero .meta { color: var(--muted); }
.earn-label { margin-top: 18px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; }
.earn { font-size: clamp(2.8rem, 13vw, 5.2rem); font-weight: 900; color: var(--neon); letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; text-shadow: 0 0 22px rgba(57,255,20,.35); }
.clock { font-size: clamp(1.6rem, 7vw, 2.4rem); font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 4px; }
.frozen .earn, .frozen .clock { opacity: .7; text-shadow: none; }
.btn-punch {
  margin-top: 24px; width: min(100%, 420px); min-height: 76px; font-size: 1.35rem; border-radius: 20px; font-weight: 900;
  background: var(--neon); color: #000; border: 0; box-shadow: 0 0 0 6px rgba(57,255,20,.15), 0 0 32px rgba(57,255,20,.35);
}
.btn-punch.out { background: #fff; box-shadow: 0 0 0 6px rgba(255,255,255,.1); }
.btn-second { margin-top: 12px; width: min(100%, 420px); min-height: 56px; font-size: 1.05rem; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.timeline li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .inactive { text-decoration: line-through; color: var(--muted); }

/* ---------- resumo ---------- */
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.summary .sub { padding-left: 14px; font-size: .9rem; }
.summary .total { font-size: 1.25rem; font-weight: 900; color: var(--neon); border-top: 1px solid var(--line); padding-top: 10px; }
.summary .totallabel { border-top: 1px solid var(--line); padding-top: 12px; color: var(--text); font-weight: 800; }

/* ---------- tabelas responsivas (tabela no computador, cartões no celular) ---------- */
.rtable { width: 100%; border-collapse: collapse; }
.rtable th { text-align: left; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 10px; border-bottom: 1px solid var(--line); }
.rtable td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rtable tr.clickable { cursor: pointer; }
.rtable tr.clickable:hover td { background: #0b0b0b; }
.rtable .r { text-align: right; }
@media (max-width: 760px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
  .rtable td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; }
  .rtable td.cell-title { font-weight: 800; font-size: 1.05rem; }
  .rtable td.cell-title::before { content: none; }
  .rtable td.cell-actions { justify-content: flex-start; flex-wrap: wrap; }
  .rtable td.cell-actions::before { content: none; }
  .rtable .r { text-align: right; }
}

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(100%, 380px); text-align: center; }
.logo-lg { width: min(70vw, 260px); height: auto; max-height: 290px; object-fit: contain; margin: 0 auto 28px; display: block; }
.login-box form { display: grid; gap: 12px; text-align: left; }
.login-box .btn-primary { min-height: 54px; font-size: 1.1rem; }

/* ---------- recibo (prévia) ---------- */
.paper { background: #fff; color: #111; border-radius: 10px; padding: 22px; }
.paper .muted { color: #666; }
.paper .head { display: flex; gap: 14px; align-items: center; border-bottom: 1px solid #ddd; padding-bottom: 14px; margin-bottom: 14px; }
.paper .head img { height: 64px; max-width: 120px; object-fit: contain; }
.paper .paid { margin-left: auto; color: #108010; border: 2px solid #108010; border-radius: 6px; padding: 4px 12px; font-weight: 900; }
.paper dl dt { color: #666; } .paper .total { color: #108010; border-color: #ddd; } .paper .totallabel { color: #111; border-color: #ddd; }
.sig-wrap { background: #fff; border-radius: 10px; padding: 8px; }
.sig-pad { width: 100%; height: 180px; touch-action: none; display: block; background: #fff; border-bottom: 2px solid #111; cursor: crosshair; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; right: 0; bottom: 0; }

/* ---------- modal e toasts ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { width: min(100%, 560px); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid #333; border-radius: 18px; padding: 20px; animation: rise .18s ease-out; }
.modal header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal header h2 { margin: 0; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60; display: grid; gap: 8px; width: min(92vw, 460px); }
.toast { background: #111; border: 1px solid #333; border-left: 4px solid var(--neon); padding: 12px 14px; border-radius: 12px; animation: rise .18s ease-out; box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.toast.err { border-left-color: var(--red); }
.flash { animation: flash .6s ease-out; }
.pop { animation: pop .35s ease-out; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes flash { from { box-shadow: 0 0 0 0 rgba(57,255,20,.7); } to { box-shadow: 0 0 0 18px rgba(57,255,20,0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .v { font-size: 1.5rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.kpi .v.neon { color: var(--neon); }
.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.logo-preview { background: #1a1a1a; border-radius: 10px; padding: 12px; display: inline-block; }
.logo-preview img { max-height: 80px; max-width: 220px; display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.grid-2 > * { margin-top: 0 !important; }
.grid-2.stack { margin-top: 14px; }
