:root {
  --bg: #0f1720; --bg-2: #16212d; --panel: #141f2b; --line: rgba(255, 255, 255, 0.12); --text: #e8eef4; --muted: #9fb0c0;
  --accent: #f2b544; --accent-ink: #1b1406; --ok: #4cc38a; --bad: #ef6461;
  color-scheme: dark; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 50% 0%, #1d2b3a 0%, var(--bg) 60%) fixed; color: var(--text); }
a { color: var(--accent); }
.top, main { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.top { padding-top: max(14px, env(safe-area-inset-top)); }
.back { text-decoration: none; font-size: 14px; }
h1 { margin: 8px 0 4px; font-size: 26px; }
h2 { margin: 0 0 12px; font-size: 20px; }
h3 { margin: 18px 0 4px; font-size: 17px; }
.lead { color: var(--muted); line-height: 1.55; margin: 6px 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.kicker { margin: 0; color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; }
button, input, select { font: inherit; color: inherit; }
button {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer;
}
button:hover { border-color: rgba(255, 255, 255, 0.3); }
button.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.big { width: 100%; min-height: 48px; font-size: 16px; }
button:disabled { opacity: 0.6; cursor: default; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
form label { display: grid; gap: 6px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
input:not([type=radio]), select {
  width: 100%; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.opt { display: flex !important; grid-template-columns: none; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px !important; color: var(--text) !important; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--accent); background: rgba(242, 181, 68, 0.08); }
.opt input { margin-top: 3px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.opt span { display: grid; gap: 2px; }
.opt small { color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.status { min-height: 1.2em; color: var(--bad); font-size: 14px; margin: 0 0 10px; }
.created h2 { color: var(--ok); }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; font-size: 14px; }
.qr-wrap { display: flex; gap: 16px; align-items: center; margin: 14px 0; }
.qr { width: 180px; height: 180px; flex: none; background: #fff; border-radius: 12px; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.warn { margin: 14px 0 0; color: #f6d38f; line-height: 1.5; word-break: break-all; }
.tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tests li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-2); border-radius: 12px; }
.t-main { display: grid; gap: 2px; min-width: 0; }
.t-btns { display: flex; gap: 6px; flex: none; }
.t-btns button { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.t-btns .x { width: 36px; padding: 0; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 12px; }
.res-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin: 10px 0 14px; }
.res-head h2 { margin: 2px 0; font-size: 24px; }
.res-head p { margin: 0; }
.res-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 2px; }
.stat b { font-size: 26px; color: var(--accent); }
.stat span { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
th.sorted { color: var(--accent); }
td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
tr.good td:nth-child(4) { color: var(--ok); font-weight: 600; }
tr.low td:nth-child(4) { color: var(--bad); }
.hard ol { margin: 6px 0 0; padding-left: 22px; line-height: 1.7; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 999px; font-weight: 600; margin: 0;
}
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .qr-wrap { flex-direction: column; align-items: flex-start; }
  .tests li { flex-direction: column; align-items: stretch; }
  td:nth-child(5), th:nth-child(5) { display: none; }
}
