/* versorisystem · Versori Produções — preto e branco, minimalista.
   Portaria = tema escuro (olhos descansados à noite). Painel (body.light) = tema claro. */
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('/fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('/fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('/fonts/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-display: swap; src: url('/fonts/poppins-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bodoni Moda'; font-weight: 500; font-display: swap; src: url('/fonts/bodoni-moda-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Bodoni Moda'; font-weight: 700; font-display: swap; src: url('/fonts/bodoni-moda-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #000;
  --surface: #0f0f0f;
  --surface-2: #181818;
  --line: rgba(255, 255, 255, .14);
  --line-soft: rgba(255, 255, 255, .08);
  --text: #fff;
  --muted: #8f8f8f;
  --ink: #fff;            /* cor do botão principal */
  --on-ink: #000;         /* texto sobre o botão principal */
  --ok: #6fd6a2;
  --ok-bg: rgba(111, 214, 162, .09);
  --warn: #e8b64a;
  --danger: #ff7a70;
  --danger-solid: #e5483d;
  --radius: 10px;
  --font-display: 'Bodoni Moda', 'Playfair Display', Georgia, serif;
  --font-body: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
body.light {
  --bg: #fafafa;
  --surface: #fff;
  --surface-2: #f1f1f1;
  --line: rgba(0, 0, 0, .16);
  --line-soft: rgba(0, 0, 0, .08);
  --text: #0a0a0a;
  --muted: #707070;
  --ink: #0a0a0a;
  --on-ink: #fff;
  --ok: #17835a;
  --ok-bg: rgba(23, 131, 90, .07);
  --warn: #a8731a;
  --danger: #c43b30;
  --danger-solid: #c43b30;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-body); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.5; }
body.light { height: auto; min-height: 100%; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; margin: 0; letter-spacing: .01em; }
.eyebrow { display: block; font-size: .64rem; font-weight: 500; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); }

/* ---------- botões ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--text);
  padding: .7rem 1.2rem; border-radius: 8px; font-weight: 500; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; text-decoration: none;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 600; }
.btn.primary:hover { opacity: .88; }
.btn.ghost { border-color: var(--line-soft); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.sm { min-height: 34px; padding: .35rem .8rem; font-size: .68rem; border-radius: 6px; }
.btn.block { width: 100%; }
.linkish { background: none; border: 0; color: var(--text); cursor: pointer; padding: 0; font-size: inherit; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); }

/* ---------- campos ---------- */
.field { display: grid; gap: .4rem; text-align: left; }
.field > span:first-child { font-size: .64rem; color: var(--muted); font-weight: 500; letter-spacing: .24em; text-transform: uppercase; }
.input, select.input {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--text);
  border-radius: 0; padding: .7rem .1rem; min-height: 46px; outline: none; font-size: 1rem;
  transition: border-color .15s;
}
select.input { text-overflow: ellipsis; }
select.input option { background: var(--surface); color: var(--text); }
.input:focus { border-bottom-color: var(--text); }
.input::placeholder { color: var(--muted); opacity: .7; }
.field > span.pw { position: relative; display: block; font-size: 1rem; color: inherit; font-weight: 400; letter-spacing: normal; text-transform: none; }
.pw .input { padding-right: 3rem; }
.eye { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; }
.eye:hover, .eye[aria-pressed='true'] { color: var(--text); }
.eye .slash { opacity: 0; }
.eye[aria-pressed='true'] .slash { opacity: 1; }

/* ---------- selos ---------- */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .66rem; font-weight: 500; letter-spacing: .06em; border: 1px solid var(--line); color: var(--text); white-space: nowrap; }
.badge.mesa { background: var(--surface-2); border-color: transparent; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-bg); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.new { border-style: dashed; color: var(--muted); }

/* ---------- aviso ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; top: max(env(safe-area-inset-top), 10px); display: grid; justify-items: center; gap: 8px; z-index: 100; pointer-events: none; padding: 0 12px; }
.toast { background: var(--text); color: var(--bg); padding: .75rem 1.1rem; border-radius: 8px; font-size: .88rem; font-weight: 500; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); max-width: 460px; animation: toast-in .2s ease-out; }
.toast.ok::before { content: '✓  '; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } }

/* ---------- marca ---------- */
.brand { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.brand img { height: 42px; width: auto; display: block; flex: none; }
.brand .t { min-width: 0; line-height: 1.2; }
.brand .t h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: .25em; margin-top: -.15em; }

/* ======================================================
   PORTARIA (scanner) — tema escuro
   ====================================================== */
.app { height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: max(env(safe-area-inset-top), 12px) 18px 12px; border-bottom: 1px solid var(--line-soft); }
.counter { text-align: right; line-height: 1; flex: none; }
.counter b { font-family: var(--font-display); font-weight: 500; font-size: 2.1rem; }
.counter span { color: var(--muted); font-size: .95rem; }
.counter small { display: block; color: var(--muted); font-size: .58rem; letter-spacing: .26em; text-transform: uppercase; margin-top: 4px; }
.netbar { display: flex; align-items: center; gap: .55rem; padding: 10px 18px; font-size: .72rem; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.off { background: var(--danger); }
.dot.wait { background: var(--warn); }
.netbar .sp { flex: 1; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line-soft); }
.tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: .9rem .5rem; font-weight: 500; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); cursor: pointer; min-height: 48px; }
.tab[aria-selected='true'] { color: var(--text); border-bottom-color: var(--text); }

.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); }
.reader-wrap { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; aspect-ratio: 1; max-height: 56dvh; margin: 0 auto; width: min(100%, 56dvh); }
#reader { width: 100%; height: 100%; }
#reader video { object-fit: cover; width: 100% !important; height: 100% !important; }
#reader img[alt='Info icon'], #reader > div:not([id]) { display: none !important; }
.reticle { position: absolute; inset: 15%; pointer-events: none; box-shadow: 0 0 0 999px rgba(0, 0, 0, .45); }
.reticle i { position: absolute; width: 26px; height: 26px; border: 2px solid #fff; }
.reticle i:nth-child(1) { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.reticle i:nth-child(2) { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.reticle i:nth-child(3) { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.reticle i:nth-child(4) { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.cam-msg { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; padding: 22px; background: #0a0a0a; color: var(--muted); font-size: .88rem; }
.hint { text-align: center; color: var(--muted); font-size: .8rem; margin: 16px 8px 0; }
.hint b { color: var(--text); font-weight: 500; }

.results { list-style: none; margin: 14px 0 0; padding: 0; display: grid; }
.res { width: 100%; text-align: left; display: flex; align-items: center; gap: .75rem; background: none; border: 0; border-bottom: 1px solid var(--line-soft); padding: .9rem .1rem; cursor: pointer; }
.res:active { background: var(--surface); }
.res .nm { font-weight: 500; font-size: 1rem; }
.res .sub { color: var(--muted); font-size: .76rem; }
.res .grow { flex: 1; min-width: 0; }
.res .tick { color: var(--ok); font-weight: 500; font-size: .76rem; text-align: right; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: .88rem; }

/* ficha do convite */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .72); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 640px; max-height: 90dvh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
.sheet-head { padding: 20px 20px 12px; display: flex; gap: 12px; align-items: flex-start; }
.sheet-head h2 { font-size: 1.4rem; line-height: 1.15; }
.sheet-head .meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: .76rem; }
.x { margin-left: auto; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--text); font-size: 1.05rem; cursor: pointer; }
.sheet-list { overflow-y: auto; padding: 4px 20px 8px; display: grid; }
.person { display: flex; align-items: center; gap: .8rem; border-top: 1px solid var(--line-soft); padding: .9rem .1rem; }
.person.in { background: var(--ok-bg); margin: 0 -20px; padding-left: calc(20px + .1rem); padding-right: 20px; }
.person.focus .who b::before { content: '→ '; }
.person .who { flex: 1; min-width: 0; }
.person .who b { display: block; font-weight: 500; font-size: 1.02rem; line-height: 1.25; overflow-wrap: anywhere; }
.person .who small { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 5px; color: var(--muted); font-size: .74rem; }
.person.in .who small .when { color: var(--ok); font-weight: 500; }
.person .act { flex: none; display: grid; justify-items: end; gap: 4px; }
.person .act .btn { min-width: 112px; }
.sheet-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; border-top: 1px solid var(--line-soft); }
.sheet-foot .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sum { text-align: center; color: var(--muted); font-size: .78rem; letter-spacing: .04em; }
.sum b { color: var(--text); font-weight: 600; }

/* tela inicial da portaria */
.gate { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: var(--bg); overflow-y: auto; }
.gate .box { width: min(100%, 360px); display: grid; gap: 20px; text-align: center; }
.gate .box img.logo { width: 150px; margin: 0 auto; }
.gate h2 { font-size: 1.3rem; }
.gate p { margin: 0; color: var(--muted); font-size: .86rem; }
.gate .err { color: var(--danger); font-size: .84rem; min-height: 1.2em; }

/* ======================================================
   PAINEL (admin) — tema claro
   ====================================================== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 70px; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 22px; flex-wrap: wrap; border-bottom: 1px solid var(--text); }
.admin-top .brand img { height: 52px; }
.admin-top .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.kpi { padding: 26px 20px 22px 0; }
.kpi + .kpi { padding-left: 24px; border-left: 1px solid var(--line-soft); }
.kpi b { display: block; font-family: var(--font-display); font-weight: 500; font-size: 3rem; line-height: 1; margin: 10px 0 8px; font-variant-numeric: lining-nums; }
.kpi em { font-style: normal; color: var(--muted); font-size: .8rem; }
.bar { height: 3px; background: var(--line-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--text); transition: width .5s; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; margin-top: 36px; }
.panel { min-width: 0; }
.panel h3 { font-family: var(--font-body); font-size: .68rem; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.panel + .panel { margin-top: 34px; }
.rows { display: grid; gap: 11px; }
.mini { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 14px; align-items: center; font-size: .82rem; }
.mini span.n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: .85rem; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed.open { max-height: 420px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 56px 1fr; gap: 6px 14px; font-size: .84rem; border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.feed time { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.feed .what b { font-weight: 500; }
.feed small { display: block; color: var(--muted); font-size: .74rem; }

.tag { display: inline-block; font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; padding: .12rem .5rem; border: 1px solid var(--line); border-radius: 4px; margin-right: 6px; white-space: nowrap; }
.tag.in { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.tag.out { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.tag.edit, .tag.add { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.tag.delete, .tag.reset { background: var(--danger); color: #fff; border-color: transparent; }
.modal .neg, .modal b.neg { color: var(--danger); font-weight: 600; }

.toolbar { display: grid; grid-template-columns: minmax(200px, 1fr) 170px minmax(150px, 230px) auto; gap: 18px; margin-bottom: 14px; align-items: end; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--text); white-space: nowrap; }
td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
td b { font-weight: 500; }
tr.in td:first-child { box-shadow: inset 2px 0 0 var(--ok); padding-left: 12px; }
td .sub { color: var(--muted); font-size: .72rem; }
td.acts { white-space: nowrap; text-align: right; }
td.acts .btn + .btn { margin-left: 4px; }

.hist summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: .68rem; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); }
.hist summary::-webkit-details-marker { display: none; }
.hist summary::after { content: '+'; font-size: 1.2rem; font-weight: 400; letter-spacing: 0; color: var(--text); }
.hist[open] summary::after { content: '–'; }
.hist .toolbar { margin-top: 16px; grid-template-columns: minmax(200px, 1fr) 190px 190px auto; }
.hist td.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist td.det { color: var(--muted); font-size: .78rem; max-width: 420px; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login .box { width: min(100%, 380px); display: grid; gap: 22px; text-align: center; }
.login img.logo { width: 170px; margin: 0 auto; }
.login h2 { font-size: 1.15rem; }
.login .err { color: var(--danger); font-size: .84rem; min-height: 1.2em; }
.modal { width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 26px; display: grid; gap: 18px; margin: auto; }
.scrim.center { align-items: center; padding: 16px; }
body.light .scrim { background: rgba(0, 0, 0, .45); }
.modal h3 { font-size: 1.2rem; }
.check { display: flex; gap: .6rem; align-items: center; font-size: .88rem; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi, .kpi + .kpi { padding: 20px 10px 18px 0; border-left: 0; }
  .kpi:nth-child(even) { padding-left: 18px; border-left: 1px solid var(--line-soft); }
  .kpi b { font-size: 2.5rem; }
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .grid2 > .panel { margin-bottom: 34px; }
  .toolbar, .hist .toolbar { grid-template-columns: 1fr 1fr; gap: 14px; }
  .toolbar .field:first-child { grid-column: 1 / -1; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
  td { border: 0; padding: 3px 0; }
  td.acts { text-align: left; padding-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
  tr.in td:first-child { box-shadow: none; padding-left: 0; }
  tr.in { box-shadow: inset 2px 0 0 var(--ok); padding-left: 12px; }
  .hist td.det { max-width: none; }
}

/* ---------- acréscimos: equipe, minhas movimentações, exportações ---------- */
.muted-link { font-size: .8rem; color: var(--muted); justify-self: center; }
.netbar .who { color: var(--text); font-weight: 500; white-space: nowrap; }
.mine { list-style: none; margin: 0; padding: 0; }
.mine li { display: grid; grid-template-columns: 48px auto 1fr; gap: 10px; align-items: baseline; padding: .75rem 0; border-bottom: 1px solid var(--line-soft); font-size: .92rem; }
.mine time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .82rem; }
.mine b { font-weight: 500; overflow-wrap: anywhere; }
.mine .empty { grid-template-columns: 1fr; }
.exports { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pin-big { font-family: var(--font-display); font-size: 3rem; letter-spacing: .3em; text-align: center; padding: .6rem 0; border: 1px solid var(--line); border-radius: 8px; }
.input.msg { border: 1px solid var(--line); border-radius: 8px; padding: .8rem; font-size: .84rem; line-height: 1.5; resize: none; min-height: 0; }

/* ---------- caixa de confirmação ---------- */
.dialog-scrim { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .62); animation: fade .15s; }
.dialog { width: min(100%, 380px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px 22px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: .4; } }
.dialog h3 { font-size: 1.3rem; margin-bottom: 12px; }
.dialog p { margin: 0 0 22px; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.dialog p b { color: var(--text); font-weight: 500; }
.dialog .neg, .dialog p b.neg { color: var(--danger); font-weight: 600; }
.dialog .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; font-weight: 600; }
.btn.danger-solid:hover { opacity: .9; border-color: var(--danger-solid); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
