:root {
  --bg: #0a0b0d;
  --surface: #181b22;
  --surface-2: #1e222b;
  --ink: #f4f5f7;
  --muted: #9aa0ab;
  --line: #2a2f3a;
  --danger: #e85d4c;
  --ok: #3ddc84;
  --warn: #d4a017;
  --font: system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

button, input, select { font: inherit; color: inherit; }

.wrap {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.banner {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(212, 160, 23, 0.7);
  background: rgba(212, 160, 23, 0.16);
  color: #f3d48a;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.brand { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.host { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }

.lang { display: flex; gap: 6px; }
.lang-btn, .btn {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 8px 12px;
  cursor: pointer;
}
.lang-btn.on { background: #e8eaee; color: #0a0b0d; border-color: transparent; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

h1, h2 { margin: 0 0 8px; font-size: 1.05rem; }
.lead, .muted { color: var(--muted); font-size: 0.82rem; }
.err { color: var(--danger); font-size: 0.82rem; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0e1117;
  padding: 12px;
}

.btn.pri {
  background: linear-gradient(180deg, #e8eaee, #a8aeb8 45%, #7a8190);
  color: #0a0b0d;
  border-color: transparent;
  font-weight: 700;
}
.btn.block { width: 100%; }
.btn.danger { border-color: var(--danger); color: #f0b4ac; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.station-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 650; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(232, 93, 76, 0.18);
}
.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.18);
}
.dot.wait { background: var(--warn); box-shadow: none; }

.detected {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.mono, code {
  font-family: var(--mono);
  font-size: 0.78rem;
  word-break: break-all;
}
code {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0e1117;
  border: 1px solid var(--line);
}

.ready { border-color: rgba(61, 220, 132, 0.45); }
.fail { border-color: rgba(232, 93, 76, 0.55); }

.qrs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.qr {
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 10px;
}
.qr svg { display: block; width: 100%; height: auto; }
.qr figcaption {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 700;
}
.qr code {
  color: #f4f5f7;
  background: #0e1117;
}

.meta { display: grid; grid-template-columns: 8rem 1fr; gap: 4px 10px; margin: 8px 0 0; font-size: 0.85rem; }
.meta dt { color: var(--muted); }

.faults { margin: 0; padding-left: 1.1rem; }
.faults li { margin: 4px 0; }
.faults li.on { color: var(--danger); font-weight: 700; }

.sheet-wrap { margin-top: 8px; }
.sheet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sticker {
  width: 100%;
  min-height: 48mm;
  border: 1px dashed #8d93a0;
  background: #fff;
  color: #111;
  border-radius: 8px;
  padding: 4mm;
}
.sticker-top, .sticker-body { display: flex; justify-content: space-between; gap: 8px; }
.sticker-top { align-items: baseline; margin-bottom: 3mm; }
.brand-mark { font-weight: 800; letter-spacing: -0.02em; }
.lab-chip {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border: 1px solid #111;
  border-radius: 999px;
  padding: 1px 6px;
}
.sticker-body { align-items: center; }
.sticker svg { width: 32mm; height: 32mm; }
.serial { font-family: var(--mono); font-weight: 800; font-size: 1rem; }
.groups { font-family: var(--mono); font-size: 0.78rem; margin-top: 4px; }
.stamp {
  margin: 3mm 0 0;
  font-size: 0.72rem;
  font-weight: 700;
}

@media (max-width: 800px) {
  .grid, .qrs, .sheet { grid-template-columns: 1fr; }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff; }
  .no-print { display: none !important; }
  .wrap { width: auto; padding: 0; }
  .sheet { display: grid; grid-template-columns: 1fr 1fr; }
  .sticker { break-inside: avoid; border: 1px solid #000; }
}
