:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1c2529;
  --muted: #5d6b73;
  --line: #d8e0e5;
  --accent: #1565c0;
  --ok: #2e7d32;
  --bad: #c62828;
  --warn: #ef6c00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  padding: 14px 20px;
  background: #1c2529;
  color: #fff;
}
header h1 { margin: 0; font-size: 19px; font-weight: 600; }
header .sub { margin: 3px 0 0; font-size: 13px; color: #9fb0b9; }

main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  align-items: start;
}

/* ---------- панель параметров ---------- */

#panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px;
  height: calc(100vh - 62px);
  overflow-y: auto;
  position: sticky;
  top: 0;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px 12px;
  margin: 0 0 14px;
}
legend { font-weight: 600; font-size: 13px; padding: 0 5px; color: var(--muted); }

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 9px;
}
label.check { display: flex; align-items: center; gap: 7px; color: var(--ink); }
label.check input { margin: 0; }
label.file input { margin-top: 4px; font-size: 12px; width: 100%; }

input[type=number], input[type=date], select {
  width: 100%;
  margin-top: 3px;
  padding: 6px 7px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
input[type=range] { width: 100%; margin-top: 6px; }

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

.alpha-line { display: flex; justify-content: space-between; color: var(--ink); }
.alpha-ends { display: flex; justify-content: space-between; margin-top: 2px; }

.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
code { background: #eef2f4; padding: 1px 4px; border-radius: 3px; font-size: 12px; }

button {
  width: 100%;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}
button:hover { background: #0d47a1; }
button:disabled { background: #90a4ae; cursor: progress; }

#demo-bar {
  border: 1px solid #ffcc80;
  background: #fff8e1;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.demo-note { margin: 0 0 9px; font-size: 12.5px; line-height: 1.45; }

details {
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 10px;
  background: #fbfcfd;
}
details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
details[open] summary { margin-bottom: 8px; }
details details { background: #fff; }

textarea {
  width: 100%;
  margin-top: 3px;
  padding: 6px 7px;
  font: 12.5px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  resize: vertical;
}

button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.secondary:hover { background: #e8f0fb; color: var(--accent); }

.buttons { display: flex; gap: 6px; margin-top: 8px; }
.buttons button { padding: 7px 8px; font-size: 13px; }

.cfg-group { margin-bottom: 10px; }
.cfg-group h4 {
  margin: 0 0 5px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cfg-row {
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}
.cfg-row span { font-size: 12.5px; color: var(--ink); }
.cfg-row input { margin-top: 0; padding: 3px 6px; font-size: 13px; }

.ok-note { color: var(--ok); }
.bad-note { color: var(--bad); }

.links { margin-top: 12px; font-size: 13px; }
.links a { color: var(--accent); }

/* ---------- рабочая область ---------- */

#work { padding: 14px; display: flex; flex-direction: column; gap: 14px; }

#map {
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e8edf0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}
.card h2 { margin: 0 0 8px; font-size: 16px; }

.hidden { display: none; }
/* label { display: block } перебивает встроенный стиль [hidden], возвращаем его */
[hidden] { display: none !important; }

.status {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
}
.status.error { border-color: var(--bad); background: #fdecea; color: var(--bad); }
.status.busy { border-color: var(--accent); background: #e8f0fb; color: var(--accent); }

/* ---------- проверка ---------- */

.check { border-left: 5px solid var(--ok); }
.check.failed { border-left-color: var(--bad); }
.check h2 { display: flex; align-items: center; gap: 9px; }
.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 11px;
  color: #fff;
  background: var(--ok);
}
.badge.bad { background: var(--bad); }
.check-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.check-list li {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 11px;
  background: #e8f5e9;
  color: #1b5e20;
}
.check.failed .check-list li { background: #eef2f4; color: var(--muted); }

.issues { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--bad); }
.issues.warn { color: var(--warn); }

/* ---------- показатели ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 9px;
}
.stat {
  background: #f7f9fa;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 10px;
}
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat .v { font-size: 19px; font-weight: 600; margin-top: 2px; }
.stat .u { font-size: 12px; color: var(--muted); font-weight: 400; }

.note { margin: 10px 0 0; padding-left: 18px; font-size: 13px; }
.note.warn li { color: var(--warn); }
.note.tip li { color: var(--accent); }

.downloads { margin-top: 12px; display: flex; gap: 9px; }
.button {
  display: inline-block;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 5px;
  text-decoration: none;
}
.button:hover { background: var(--accent); color: #fff; }

/* ---------- таблицы ---------- */

.table-wrap { max-height: 340px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: #f7f9fa; font-size: 12px; color: var(--muted); z-index: 1; }
tbody tr:hover { background: #e8f0fb; cursor: default; }
td.num, th.num { text-align: right; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.bad-cell { color: var(--bad); font-weight: 600; }
.ok-cell { color: var(--ok); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  #panel { height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  #map { height: 380px; }
}
