:root {
  --ink: #16202b;
  --muted: #5b6b78;
  --paper: #f4f6f7;
  --surface: #ffffff;
  --line: #dbe2e6;
  --accent: #1d5fa3;
  --pending: #b5651d;
  --pending-soft: #b5651d14;
  --done: #2f8f5b;
  --done-soft: #2f8f5b14;
  --danger: #b23a3a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.topbar h1 { flex: 1; font-size: 19px; margin: 0; }
.btn-voltar, .btn-atualizar {
  border: none;
  background: var(--paper);
  border-radius: 8px;
  font-size: 18px;
  padding: 10px 14px;
  color: var(--accent);
}

main { padding: 14px; padding-bottom: 40px; }

.lista { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-num { font-size: 20px; font-weight: 700; }
.card-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.badge {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--pending-soft);
  color: var(--pending);
  white-space: nowrap;
}

.item-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
}
.item-row.done { border-color: var(--done); background: var(--done-soft); }
.item-row-top { display: flex; justify-content: space-between; gap: 10px; }
.item-nome { font-size: 17px; font-weight: 600; }
.item-cod { font-size: 13px; color: var(--muted); }
.item-qtd { font-size: 14px; color: var(--muted); margin-top: 4px; }
.item-lote { font-size: 14px; margin-top: 8px; font-weight: 600; color: var(--done); }
.pill-status {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.pill-status.pendente { background: var(--pending-soft); color: var(--pending); }
.pill-status.feito { background: var(--done-soft); color: var(--done); }

.scan-screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: stretch;
}
.scan-item-info {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.scan-input-wrap {
  background: var(--surface);
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
}
.scan-hint { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
#scanInput {
  width: 100%;
  font-size: 24px;
  text-align: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
#scanInput:focus { outline: 3px solid var(--accent); }

.confirm-box {
  background: var(--done-soft);
  border: 1px solid var(--done);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}
.confirm-box .valor { font-size: 26px; font-weight: 800; margin: 6px 0 16px; word-break: break-all; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

button.primary, button.secondary {
  font-size: 17px;
  font-weight: 700;
  padding: 14px 20px;
  border-radius: 10px;
  border: none;
}
button.primary { background: var(--accent); color: #fff; flex: 1; }
button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); flex: 1; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 16px; }
.error-state { text-align: center; color: var(--danger); padding: 30px 20px; font-size: 15px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 16px;
  right: 16px;
  background: var(--ink);
  color: #fff;
  padding: 14px 18px;
  border-radius: 10px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ecef; --muted: #93a0aa; --paper: #10161d; --surface: #1a222b;
    --line: #2b3540; --accent: #6fa8dc; --pending: #d98a4a; --pending-soft: #d98a4a22;
    --done: #5fae85; --done-soft: #5fae8522; --danger: #d06868;
  }
}
