:root {
  --primary: #c41e3a;
  --primary-dark: #9b1830;
  --bg: #0b1426;
  --surface: #152238;
  --surface2: #1e2f4a;
  --text: #e8eef5;
  --text-muted: #8b9bb4;
  --border: #2a3f5f;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  --radius: 10px;
  --font: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
button, input, select, textarea { font-family: inherit; }
header.chrome {
  background: linear-gradient(135deg, #152238 0%, #0b1426 100%);
  border-bottom: 2px solid var(--primary);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.brand img { height: 42px; width: auto; border-radius: 4px; display: block; background: transparent; }
.brand h1 { font-size: 1.05rem; font-weight: 600; }
.brand p { font-size: 0.72rem; color: var(--text-muted); }
.hdr-actions, nav.desk { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
nav.desk { padding: 0.55rem 1rem 0; }
.nav-btn, .btn, .btn-ghost, .btn-good, .btn-bad, .btn-warn {
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  padding: 0.5rem 0.8rem;
  font-size: 0.92rem;
  min-height: 40px;
}
.nav-btn.active, .btn-primary, .btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-ghost { background: transparent; }
.btn-good { background: #1e7f46; border-color: #1e7f46; color: #fff; }
.btn-bad { background: #a32020; border-color: #a32020; color: #fff; }
.btn-warn { background: #9a6b12; border-color: #9a6b12; color: #fff; }
.btn:disabled, .nav-btn:disabled { opacity: 0.45; cursor: not-allowed; }
main { max-width: 1180px; margin: 0 auto; padding: 1rem; }
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  margin-bottom: 0.9rem;
}
.card h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.65rem; }
.muted { color: var(--text-muted); font-size: 0.88rem; }
.tiny { font-size: 0.75rem; color: var(--text-muted); }
label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.2rem; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  font-size: 16px;
  min-height: 42px;
}
textarea { min-height: 72px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
.grid { display: grid; gap: 0.7rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.stat {
  background: var(--surface2);
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.stat b { display: block; font-size: 1.35rem; }
.stat span { color: var(--text-muted); font-size: 0.75rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.4rem 0.35rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.72rem;
  background: var(--surface2);
}
.pill.pass { background: #1e7f46; color: #fff; }
.pill.fail { background: #a32020; color: #fff; }
.pill.pending { background: #3d4d6a; }
.pill.warn { background: #9a6b12; color: #fff; }
.login-wrap { max-width: 460px; margin: 8vh auto; }
.id-big { font-size: 2.4rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1; }
.level-big { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 0.8rem; }
.scan-actions button { min-height: 76px; font-size: 1.35rem; font-weight: 700; }
video.cam, canvas.cam { width: 100%; max-height: 280px; background: #000; border-radius: 8px; }
.label-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: #d9dee7;
  padding: 12px;
  border-radius: 8px;
}
.label-card {
  background: #fff;
  color: #111;
  border: 1px dashed #888;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.label-card img { display: block; }
.label-card .meta { padding: 0 6px; line-height: 1; }
.label-card .lv { font-weight: 700; }
.label-card .digits { font-weight: 800; letter-spacing: 0.02em; }
.label-card .sub { color: #444; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 1rem;
}
.modal.show { display: flex; }
.modal .card { width: min(520px, 100%); }
.toast {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: #123; border: 1px solid var(--border); color: #fff;
  padding: 0.55rem 0.8rem; border-radius: 8px; display: none; z-index: 90;
}
body.sun {
  --bg: #f4f1ea;
  --surface: #fff;
  --surface2: #efe8dc;
  --text: #1b1b1b;
  --text-muted: #5c564c;
  --border: #d5cdbf;
}
body.sun header.chrome { background: #fff; }
.checkline { display: flex; gap: 0.4rem; align-items: center; font-size: 0.9rem; }
.checkline input { width: auto; min-height: 0; }
@media (max-width: 800px) {
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .brand h1 { font-size: 0.95rem; }
  table { font-size: 0.8rem; }
}
