:root {
  --bg: #0f172a; --bg2: #1e293b; --card: #ffffff; --ink: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --brand: #2563eb; --brand-dark: #1d4ed8;
  --ok: #16a34a; --ok-bg: #dcfce7; --out: #ea580c; --out-bg: #ffedd5;
  --err: #dc2626; --err-bg: #fee2e2; --warn: #b45309; --warn-bg: #fef3c7;
  --shadow: 0 10px 30px rgba(2, 6, 23, .12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2)); color: var(--ink); min-height: 100vh;
}
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #60a5fa, #2563eb);
  display: grid; place-items: center; font-size: 18px; box-shadow: var(--shadow); }
.brand small { display: block; font-weight: 500; font-size: 11px; opacity: .8; }
.icon-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 38px; height: 38px;
  border-radius: 10px; font-size: 16px; cursor: pointer; }

.logo-chip { background: #fff; border-radius: 9px; padding: 4px 6px; display: inline-flex; align-items: center; flex: 0 0 auto; }
.logo-chip img { height: 26px; width: auto; display: block; }
.brand-big { text-align: center; margin: 2px 0 14px; }
.brand-big img { max-height: 80px; max-width: 80%; }

.screen { padding: 8px 16px 24px; }
.tab { padding-bottom: 96px; }
.card { background: var(--card); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
h1 { font-size: 22px; margin: 4px 0 18px; }
h2 { font-size: 16px; margin: 0 0 10px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
input { width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 15px; outline: none; transition: border .15s; }
input:focus { border-color: var(--brand); }
.btn { width: 100%; padding: 14px; border: 0; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: var(--brand); color: #fff; cursor: pointer; margin-top: 14px; transition: background .15s; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #f1f5f9; color: var(--ink); }
.btn.small { padding: 9px 12px; font-size: 13px; margin-top: 0; width: auto; }
.link { color: var(--brand); cursor: pointer; text-decoration: underline; font-size: 14px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.in { background: var(--ok-bg); color: var(--ok); }
.pill.out { background: var(--out-bg); color: var(--out); }
.pill.none { background: #f1f5f9; color: var(--muted); }

/* Tab bar */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  background: #fff; display: flex; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(2,6,23,.08); z-index: 40; }
.tabbtn { flex: 1; background: none; border: 0; padding: 10px 4px 12px; font-size: 11px; font-weight: 700;
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabbtn span { font-size: 20px; }
.tabbtn.active { color: var(--brand); }

/* Modal scanner */
.modal { position: fixed; inset: 0; background: rgba(2,6,23,.7); display: flex; align-items: flex-end; z-index: 60; }
.modal-inner { background: #fff; width: 100%; max-width: 480px; margin: 0 auto; border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); animation: slideUp .25s ease; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 16px; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
#reader { width: 100%; border-radius: 16px; overflow: hidden; background: #000; min-height: 260px; }
.scan-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

.result { border-radius: 14px; padding: 16px; margin-top: 10px; display: none; animation: pop .25s ease; }
.result.show { display: block; }
.result.ok { background: var(--ok-bg); color: #14532d; }
.result.outt { background: var(--out-bg); color: #7c2d12; }
.result.err { background: var(--err-bg); color: #7f1d1d; }
.result .big { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Listes */
.log { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.log:last-child { border-bottom: 0; }
.log .dot { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex: 0 0 auto; }
.log .dot.in { background: var(--ok-bg); } .log .dot.out { background: var(--out-bg); } .log .dot.cp { background: #e0e7ff; }
.log .meta { flex: 1; min-width: 0; } .log .meta b { font-size: 14px; } .log .meta span { display: block; color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.tag.late { background: var(--warn-bg); color: var(--warn); }

/* Ronde checklist */
.round-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.progress { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); transition: width .4s; }
.cp { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cp:last-child { border-bottom: 0; }
.cp .num { width: 26px; height: 26px; border-radius: 50%; background: #eef2f7; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.cp.done .num { background: var(--ok); color: #fff; }
.cp .nm { flex: 1; font-size: 14px; font-weight: 600; }
.cp .st { font-size: 12px; font-weight: 700; }
.cp.done .st { color: var(--ok); } .cp.pending .st { color: var(--muted); }

.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.banner { background: #fef9c3; color: #713f12; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; text-align: center; }
.footer-note { text-align: center; color: rgba(255,255,255,.5); font-size: 12px; padding: 14px; }
