:root {
  --g: #3aa935;
  --g-dark: #2b7f28;
  --ink: #1f2733;
  --muted: #8a9199;
  --line: #e6e8eb;
  --red: #d8322a;
  --amber: #e8a33d;
  --bg: #f4f6f7;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(31, 39, 51, .08);
}

* { box-sizing: border-box; }

/* Собственный display у класса перебивает атрибут hidden — возвращаем ему силу. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  font-family: Manrope, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; flex-direction: column; height: 100%; }

/* ── шапка ───────────────────────────────────────────────────────────────── */

.bar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.bar strong { font-size: 15px; font-weight: 700; }

.bar__meta { font-size: 12px; color: var(--muted); }

.cad { display: flex; align-items: center; gap: 0; }

.cad__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  outline: 0;
  background: #fff;
}
.cad__input:focus { border-color: var(--g); }

.cad__btn {
  height: 40px;
  padding: 0 18px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: var(--g);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.cad__btn:hover { background: var(--g-dark); }
.cad__btn:disabled { opacity: .5; cursor: default; }

/* ── контролы ────────────────────────────────────────────────────────────── */

.btn {
  height: 38px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--g);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.btn:hover { background: var(--g-dark); }
.btn--ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: #f6f8f9; }
.btn--ghost.is-on { border-color: var(--g); color: var(--g); }
.btn--sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn--full { width: 100%; }

.sel, .inp {
  height: 38px;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}
.sel--sm { height: 30px; font-size: 13px; }
.inp { width: 100%; margin-bottom: 8px; }

.range { width: 100%; accent-color: var(--g); margin: 2px 0 10px; }

.btns { display: flex; gap: 8px; margin-top: 10px; }
.btns--wrap { flex-wrap: wrap; }
.btns .btn { flex: 1; }

/* ── карта ───────────────────────────────────────────────────────────────── */

.main { flex: 1 1 auto; display: flex; min-height: 0; }

.mapwrap { position: relative; flex: 1 1 auto; min-width: 0; }
.map { position: absolute; inset: 0; background: #dfe4e6; }

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 500;
}
.overlay.is-hidden { opacity: 0; }

.maptools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.seg {
  display: flex;
  background: #fff;
  border-radius: 10px;
  padding: 3px;
  box-shadow: var(--shadow);
}
.seg__b {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.seg__b.is-on { background: var(--g); color: #fff; }

.dpad {
  position: absolute;
  right: 12px;
  bottom: 24px;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dpad__cross {
  position: relative;
  width: 108px;
  height: 74px;
}
.dpad__b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.dpad__b:hover { background: #f2f5f6; }
.dpad__b--u { position: absolute; left: 37px; top: 0; }
.dpad__b--d { position: absolute; left: 37px; bottom: 0; }
.dpad__b--l { position: absolute; left: 0; top: 20px; }
.dpad__b--r { position: absolute; right: 0; top: 20px; }

.toast {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 700;
  background: rgba(31, 39, 51, .92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-err { background: var(--red); }

.drawhint {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 700;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── правая панель ───────────────────────────────────────────────────────── */

.side {
  flex: 0 0 420px;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.card--dev { background: #fbfcfc; border: 1px dashed var(--line); box-shadow: none; }
.card__h { margin: 0 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card__h--sum { cursor: pointer; margin: 0; }
.card--dev[open] .card__h--sum { margin-bottom: 10px; }

.verdict {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--muted);
}
.verdict__icon { font-size: 20px; line-height: 1.2; }
.verdict__t { font-weight: 700; font-size: 15px; }
.verdict__s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.verdict--ok { border-left-color: var(--g); }
.verdict--ok .verdict__icon { color: var(--g); }
.verdict--bad { border-left-color: var(--red); }
.verdict--bad .verdict__icon { color: var(--red); }
.verdict--warn { border-left-color: var(--amber); }
.verdict--warn .verdict__icon { color: var(--amber); }

.kv { margin: 0; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); flex: 0 0 auto; }
.kv dd { margin: 0; text-align: right; font-weight: 600; }

.dist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.dist li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); }
.dist li:last-child { border-bottom: 0; }
.dist b { font-variant-numeric: tabular-nums; }
.dist .is-bad { color: var(--red); }
.dist .is-ok { color: var(--g); }

.row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 4px; }
.row__l { color: var(--muted); }
.row__v b { font-variant-numeric: tabular-nums; }

/* подпись над полем: без неё «00:00:0000000:0» читается как непонятный код */
.lab { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 8px 0 0; }
.hint a { color: var(--g); }
.hint code { background: #f0f2f3; padding: 1px 4px; border-radius: 4px; font-size: 11px; }

.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 4px 0;
}
.chk input { width: 16px; height: 16px; accent-color: var(--g); cursor: pointer; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin: 10px 0;
}
.grid2 > div:last-child:nth-child(odd) { grid-column: 1 / -1; }

.lbl { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.inp--sm { height: 32px; margin-bottom: 0; font-size: 13px; }
.sel--sm { width: 100%; }

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 11px;
  margin-top: 10px;
  background: #f4f7f5;
  border-radius: 9px;
  font-size: 13px;
  color: var(--muted);
}
.stat b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }

.card--lead { border-top: 3px solid var(--g); }
.hint--top { margin: 0 0 12px; }

.chk--agree { align-items: flex-start; font-weight: 400; font-size: 12.5px; color: var(--muted); margin: 2px 0 12px; }
.chk--agree input { margin-top: 1px; flex: 0 0 auto; }
.chk--agree a { color: var(--g); }

#leadForm .inp { margin-bottom: 10px; }
#leadForm .inp:invalid:not(:placeholder-shown) { border-color: var(--red); }
#leadBtn[disabled] { opacity: .55; cursor: default; }

.leadok {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 10px;
  background: #eef8ec;
  font-size: 13px;
  line-height: 1.5;
}
.leadok__i {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--g);
  color: #fff;
  font-size: 15px;
}
.leadok b { display: block; margin-bottom: 2px; }
.leadok span { color: var(--muted); }

.ymres { margin-top: 10px; font-size: 12.5px; line-height: 1.5; }
.ymres table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.ymres td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.ymres td:last-child { text-align: right; font-weight: 600; }
.ymres .y-ok { color: var(--g); }
.ymres .y-bad { color: var(--red); }
.ymres p { margin: 6px 0 0; color: var(--muted); }


@media (max-width: 900px) {
  .main { flex-direction: column; }
  .mapwrap { flex: 0 0 55vh; }
  .side { flex: 1 1 auto; padding: 12px; border-left: 0; border-top: 1px solid var(--line); }
  .bar__right { margin-left: 0; width: 100%; }
}

/* ── проверка участка по реестру ─────────────────────────────────────────── */

.checkres { margin-top: 10px; }
.checkres__v {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px;
  background: #eef0f2; border-left: 4px solid #8a9199; font-size: 14px; line-height: 1.3;
}
.checkres__v--ok { background: #eaf6e9; border-left-color: var(--g); }
.checkres__v--warn { background: #fdf3e1; border-left-color: var(--amber); }
.checkres__v--restricted { background: #fdeede; border-left-color: #e0701f; }
.checkres__v--stop { background: #fbe9e8; border-left-color: var(--red); }
.checkres__tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #4b535b; }
.checkres__z { list-style: none; margin: 8px 0; padding: 0; }
.checkres__z li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; border-top: 1px solid var(--line); }
.checkres__z li:first-child { border-top: 0; }
.checkres__z i { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; }
.checkres__z span { flex: 1 1 auto; min-width: 0; }
.checkres__z b { font-weight: 700; font-variant-numeric: tabular-nums; }
.checkres__more, .checkres__none { color: var(--muted); }
a.btn { display: block; text-align: center; text-decoration: none; line-height: 36px; }
a.btn.btn--sm { line-height: 30px; }
#checkRes .btn { margin-top: 8px; }
