:root {
  --navy: #214478;
  --navy-d: #16305a;
  --navy-l: #e8eef8;
  --bg: #f3f5f9;
  --card: #fff;
  --line: #dfe4ec;
  --text: #1b2430;
  --muted: #5b6678;
  --ok: #1f7a3f;
  --ok-bg: #e4f4ea;
  --warn: #8a5a00;
  --warn-bg: #fff4d6;
  --bad: #b42318;
  --bad-bg: #fde8e6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
:focus-visible { outline: 3px solid #5b9bd5; outline-offset: 2px; }

/* ---------- Formulários e botões ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 5px; }
label:first-child { margin-top: 0; }
input, select { width: 100%; min-height: 46px; padding: 9px 12px; font: inherit; color: var(--text); background: #fff; border: 1px solid #c7cedb; border-radius: 8px; }
input:hover, select:hover { border-color: #9aa6ba; }
input:focus, select:focus { border-color: var(--navy); outline: 3px solid rgba(33, 68, 120, 0.2); outline-offset: 0; }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; accent-color: var(--navy); flex: none; }
input[type="file"] { padding: 8px; background: var(--bg); }
button { min-height: 46px; padding: 9px 18px; font: inherit; font-weight: 600; color: var(--navy); background: #fff; border: 1px solid #c7cedb; border-radius: 8px; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
button:hover { background: var(--navy-l); border-color: #aebbd2; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { color: #fff; background: var(--ok); border-color: var(--ok); }
button.primary:hover { background: #176431; border-color: #176431; }
button.dark { color: #fff; background: var(--navy); border-color: var(--navy); }
button.dark:hover { background: var(--navy-d); border-color: var(--navy-d); }
button.danger { color: #fff; background: var(--bad); border-color: var(--bad); }
button.danger:hover { background: #8f1c12; border-color: #8f1c12; }
button.quiet { min-height: 40px; padding: 4px 10px; font-size: 13px; font-weight: 500; color: var(--muted); background: none; border: 0; }
button.quiet:hover { color: var(--navy); background: var(--navy-l); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sub { color: var(--muted); font-size: 14px; }

/* ---------- Avisos ---------- */
.alert { margin: 14px 0; padding: 10px 14px; border-radius: 8px; font-size: 14px; background: var(--warn-bg); color: var(--warn); border: 1px solid #f0dca0; }
.alert.ok { background: var(--ok-bg); color: #14532d; border-color: #b7e0c4; }
.alert.bad { background: var(--bad-bg); color: #7a1a12; border-color: #f4c1bc; }

/* ---------- Entrada ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, var(--navy-d), var(--navy)); }
.login { width: 100%; max-width: 420px; padding: 28px; background: var(--card); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.login h1 { font-size: 24px; color: var(--navy); }
.login .lead { margin: 4px 0 20px; color: var(--muted); font-size: 14px; }
.login button[type="submit"] { width: 100%; min-height: 50px; font-size: 16px; }
.login .actions { margin-top: 22px; }

/* ---------- Cabeçalho ---------- */
.top { padding: 14px 24px; color: #fff; background: var(--navy); box-shadow: var(--shadow); }
.top.staff { border-bottom: 4px solid #f2b705; }
.top-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.top h1 { color: #fff; font-size: 19px; line-height: 1.25; }
.chip { display: inline-block; margin-top: 6px; padding: 2px 10px; font-size: 12px; font-weight: 600; color: #4a3200; background: #f2b705; border-radius: 99px; }
.stats { display: flex; gap: 10px; }
.stat { min-width: 96px; padding: 6px 14px; background: rgba(255, 255, 255, 0.12); border-radius: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: #cbd8ef; }
.stat b { display: block; font-size: 24px; line-height: 1.15; color: #fff; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tabs button { min-height: 40px; padding: 6px 16px; color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, 0.35); }
.tabs button:hover { background: rgba(255, 255, 255, 0.14); }
.tabs button.dark { color: var(--navy); background: #fff; border-color: #fff; }
.tabs .spacer { flex: 1; }

main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-shell main { flex: 1; width: 100%; }
.foot { display: flex; justify-content: space-between; align-items: center; padding: 4px 24px; color: var(--muted); background: #fff; border-top: 1px solid var(--line); font-size: 12px; }

/* ---------- Credenciar ---------- */
.grid { display: grid; gap: 24px; align-items: start; }
@media (min-width: 960px) { .grid { grid-template-columns: minmax(320px, 5fr) 6fr; } }
.card { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 0; }
.card.wide { grid-column: 1 / -1; }
.card h2 { font-size: 18px; margin-bottom: 4px; }
.cards { display: grid; gap: 20px; align-items: start; }
@media (min-width: 960px) { .cards { grid-template-columns: 1fr 1fr; } }
.sec { margin: 22px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 700; color: var(--text); }
.search-input { min-height: 56px; font-size: 18px; padding: 10px 16px; border-radius: 10px; }
.count { margin: 12px 2px 6px; font-size: 14px; color: var(--muted); }
ul.list { list-style: none; margin: 0; padding: 0; }
ul.list.results { display: grid; gap: 8px; }
ul.list.results button { width: 100%; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-height: 58px; text-align: left; font-weight: 400; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 10px; }
ul.list.results button:hover { border-color: #9bb0d3; background: #f7f9fd; }
ul.list.results button.sel { border-color: var(--navy); background: var(--navy-l); box-shadow: inset 3px 0 0 var(--navy); }
ul.list.results b { font-weight: 700; }
.tag { align-self: flex-start; padding: 2px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); background: #eef1f6; border-radius: 99px; }
.tag.ok { color: #14532d; background: var(--ok-bg); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.person h2 { font-size: 26px; line-height: 1.2; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.meta span { padding: 3px 10px; font-size: 13px; color: var(--muted); background: #eef1f6; border-radius: 99px; }
.person .actions button { min-height: 52px; font-size: 16px; }
.label-box { overflow-x: auto; padding: 16px; background: var(--bg); border: 1px dashed #b9c3d6; border-radius: 8px; }
.label { display: inline-block; background: #fff; border: 1px solid #8793a8; box-shadow: var(--shadow); }
.edit { margin-top: 28px; padding: 18px; background: #fffaf0; border: 1px solid #f0dca0; border-radius: var(--radius); }
.edit h3 { font-size: 16px; margin-bottom: 4px; }
.fields { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .fields { grid-template-columns: 1fr 1fr; } }

/* ---------- Gestão ---------- */
.row-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item .actions { margin-top: 8px; }
.row-item button { min-height: 38px; padding: 4px 12px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 42px; margin: 0; font-size: 15px; font-weight: 400; color: var(--text); }
.scroll { max-height: 260px; overflow: auto; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.cols { display: flex; flex-wrap: wrap; gap: 24px; }
.cols > div { flex: 1 1 220px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.cols > div button { margin-top: auto; }
.cols h4 { font-size: 15px; margin-bottom: 4px; }

/* ---------- Janelas ---------- */
.modal { position: fixed; inset: 0; z-index: 10; display: flex; justify-content: center; align-items: flex-start; padding: 16px; overflow: auto; background: rgba(16, 24, 40, 0.55); }
.modal .box, .modal form { width: 100%; max-width: 440px; margin-top: 8vh; padding: 22px; background: #fff; border-radius: 14px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); }
.modal h2 { font-size: 20px; }
.modal .step { margin: 4px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- Impressão ---------- */
#print { display: none; }
/* O tamanho da etiqueta e a margem zero (@page) são definidos em app.js a partir de LABEL_W e LABEL_H.
   Margem zero é o que faz o navegador não imprimir cabeçalho e rodapé (data, endereço, título). */
@media print {
  html, body { margin: 0 !important; padding: 0 !important; height: auto !important; background: #fff !important; }
  body > :not(#print) { display: none !important; }
  #print { display: block; margin: 0; padding: 0; break-inside: avoid; break-after: avoid; }
}

/* ---------- Telas pequenas ---------- */
@media (max-width: 640px) {
  .top, main { padding-left: 14px; padding-right: 14px; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
  .person h2 { font-size: 22px; }
}

/* ---------- Logos ---------- */
.brandline { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-plate { background: #fff; border-radius: 8px; padding: 4px 10px; object-fit: contain; }
.event-logo { height: 48px; max-width: 160px; }
.acq-logo { height: 40px; width: auto; }
.top-row > .acq-logo { margin-left: auto; }
.login-page { position: relative; }
.acq-corner { position: absolute; top: 16px; right: 16px; height: 44px; width: auto; }
.logo-prev { max-height: 64px; max-width: 220px; padding: 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; }
@media (max-width: 640px) { .acq-logo { height: 30px; } .event-logo { height: 38px; } }
.col { display: grid; gap: 20px; align-content: start; min-width: 0; }
