:root {
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card: #fff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.screen { min-height: 100dvh; padding: 16px; }
.hidden { display: none !important; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }

/* Login */
.login-card { max-width: 420px; margin: 12vh auto 0; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.logo { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.brand small { display: block; color: var(--muted); }

/* Form */
.topbar { display: flex; align-items: center; justify-content: space-between; max-width: 560px; margin: 0 auto 12px; padding: 4px 2px; }
.form { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; }
label { font-size: 13px; font-weight: 600; margin-top: 10px; }
input, select, textarea {
  width: 100%; padding: 12px; font-size: 16px; border: 1px solid #cbd5e1; border-radius: 10px;
  background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29,78,216,.15); }
.row { display: flex; gap: 10px; }
.col { flex: 1; min-width: 0; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }

.btn { border: 0; border-radius: 10px; padding: 12px 14px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.primary.big { margin-top: 16px; padding: 15px; font-size: 17px; }
.btn.ghost { background: #fff; border: 1px solid var(--brand); color: var(--brand); white-space: nowrap; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--brand); font-weight: 600; cursor: pointer; }

.photo-btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 16px; border: 1px dashed var(--brand); border-radius: 10px; color: var(--brand); font-weight: 600; cursor: pointer; }
.image-row { display: flex; align-items: center; gap: 12px; }
.preview { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }
.scanner { position: relative; margin-top: 8px; border-radius: 12px; overflow: hidden; background: #000; min-height: 200px; }
.scanner video, .scanner canvas { width: 100%; height: auto; display: block; }
.scanner canvas.drawingBuffer { position: absolute; top: 0; left: 0; }

.err { color: var(--danger); font-size: 14px; min-height: 18px; }
.msg { font-size: 14px; min-height: 18px; }
.msg.ok { color: #15803d; }
.msg.bad { color: var(--danger); }
.footer { text-align: center; color: #94a3b8; font-size: 12px; margin: 18px 0; }
