/* Lapang — общие стили. Тема «поле»: зелень рисового поля + терракота. Светлая и тёмная, телефон в первую очередь, крупные кнопки для солнца. */
:root {
  --bg: #f5f3ec; --surface: #ffffff; --surface-2: #eeebe0; --line: #ddd8c8;
  --ink: #1e2a1a; --ink-2: #44523d; --muted: #737b68;
  --brand: #2f7a34; --brand-ink: #ffffff; --brand-soft: #e1efd9; --brand-deep: #1f5a25;
  --accent: #c0632b; --accent-soft: #f8e4d6;
  --danger: #b93a2b; --danger-soft: #fbe3de; --info: #2a66a3; --info-soft: #e0ebf7;
  --shadow: 0 1px 2px rgba(30, 42, 26, .06), 0 6px 20px rgba(30, 42, 26, .07);
  --r: 14px; --r-s: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10140e; --surface: #181e15; --surface-2: #20281c; --line: #2e3828;
    --ink: #ecefe4; --ink-2: #bcc5b1; --muted: #8e977f;
    --brand: #6cbf5c; --brand-ink: #0b1608; --brand-soft: #22361c; --brand-deep: #9be08a;
    --accent: #e88a52; --accent-soft: #3d2516;
    --danger: #f0786a; --danger-soft: #3d1d18; --info: #82b4ea; --info-soft: #182a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10140e; --surface: #181e15; --surface-2: #20281c; --line: #2e3828;
  --ink: #ecefe4; --ink-2: #bcc5b1; --muted: #8e977f;
  --brand: #6cbf5c; --brand-ink: #0b1608; --brand-soft: #22361c; --brand-deep: #9be08a;
  --accent: #e88a52; --accent-soft: #3d2516;
  --danger: #f0786a; --danger-soft: #3d1d18; --info: #82b4ea; --info-soft: #182a3d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }

/* шапка */
.top {
  position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.logo img { width: 34px; height: 34px; border-radius: 9px; }
.logo small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; margin-top: -2px; }
.top .sp { flex: 1; }
.pill-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.pill-btn:hover { border-color: var(--brand); color: var(--brand); }

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 20px 16px 32px; }
.narrow { max-width: 620px; }

/* карточки и кнопки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 12px; border: 0; background: var(--brand); color: var(--brand-ink); font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .06s, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.line { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.wa { background: #1fa855; color: #fff; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; }

label.f { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: var(--ink-2); }
.in {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); outline: none;
}
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 1.2em; margin-top: 8px; }

/* выбор вариантов (сетка кнопок) */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; min-height: 56px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.choice:hover { border-color: var(--brand); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice b { font-weight: 700; }
.choice small { color: var(--muted); font-size: 13px; }
.choice[disabled] { opacity: .45; cursor: not-allowed; background: var(--surface-2); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--brand-soft); color: var(--brand-deep); }
.tag.warn { background: var(--accent-soft); color: #8a3f12; }
:root[data-theme="dark"] .tag.warn { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.warn { color: var(--accent); } }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.hide { display: none !important; }

/* шаги записи */
.steps { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps i { flex: 1; height: 5px; border-radius: 5px; background: var(--line); }
.steps i.on { background: var(--brand); }

/* подвал с подписью */
.foot { text-align: center; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); font-size: 12.5px; color: var(--muted); }
.foot a { color: var(--muted); }
.foot .made { margin-top: 6px; }

.toast {
  position: fixed; right: 16px; top: 70px; z-index: 50; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px;
  font-weight: 600; box-shadow: var(--shadow); max-width: min(360px, calc(100vw - 32px)); animation: tin .2s ease-out;
}
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

.dialog-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: var(--r); max-width: 720px; width: 100%; max-height: 86vh; overflow: auto; padding: 20px; box-shadow: var(--shadow); }
pre.code { background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: 12px; overflow: auto; white-space: pre; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Lapang ---------- */
.net { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.net i { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.net.off i { background: var(--accent); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.item .grow { flex: 1; min-width: 0; }
.item b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { color: var(--muted); font-size: 13px; }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }
.bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.q { margin-bottom: 20px; }
.q > .ql { font-weight: 700; font-size: 17px; margin-bottom: 8px; display: block; }
.q.bad .in, .q.bad .choices { outline: 2px solid var(--danger); outline-offset: 2px; border-radius: 12px; }
.q .req { color: var(--danger); }
.note { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-weight: 600; color: var(--ink); }
.rep { border: 1.5px dashed var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.rep-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 800; }
.photo { max-width: 100%; max-height: 240px; border-radius: 12px; display: block; margin-bottom: 8px; }
.navbar { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; border-top: 1px solid var(--line); margin-top: 8px; z-index: 5; }
.navbar .btn { flex: 1; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile small { color: var(--muted); font-weight: 600; font-size: 13px; }
.tile b { display: block; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#map { height: 480px; border-radius: var(--r); border: 1px solid var(--line); z-index: 1; }
.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 600; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -115%); z-index: 3; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1.4fr 1fr; } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .in { width: auto; min-height: 40px; padding: 6px 12px; }
.qr svg { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 6px; }
