:root {
  --bg: #f3f6f8;
  --card: #ffffff;
  --text: #16303a;
  --muted: #5c7080;
  --line: #d7e1e8;
  --field: #f8fbfc;
  --accent: #0c6478;
  --accent-dark: #084e5e;
  --ok: #e7f6ee;
  --ok-text: #0f6b3c;
  --err: #fdecee;
  --err-text: #8d2433;
  --shadow: 0 1px 2px rgba(22, 48, 58, 0.04), 0 8px 24px rgba(22, 48, 58, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(900px 280px at 0% -10%, rgba(12, 100, 120, 0.08), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 64px;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
  margin: 0;
}

a { color: var(--accent-dark); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 6px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 4px;
}

.tab {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.tab { border-color: #c9d6df; }
button.tab:hover { background: #f4f8fa; }

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.lead, .muted, .hint { color: var(--muted); }
.meter {
  height: 8px;
  margin-top: 8px;
  background: #e6eef2;
  border-radius: 99px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.rules { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.rules li { margin: 4px 0; }
.lead { margin: 8px 0 0; max-width: 62ch; }
.hint { margin: 6px 0 0; font-size: 13px; }

.switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8eef2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8aa0ae;
}

.pill.on { background: var(--ok); color: var(--ok-text); }
.pill.on::before { background: #15915a; }
.pill.off { background: #f4eee8; color: #8a5a32; }
.pill.off::before { background: #c47b45; }

section, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  margin-top: 14px;
}

.section-head { margin-bottom: 14px; }
.section-head.follow { margin-top: 18px; }
.section-head p { margin: 4px 0 0; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.grid.follow { margin-top: 14px; }

.field { min-width: 0; }
.field.span { grid-column: 1 / -1; }

label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #24424d;
}

input, textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #c9d6df;
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea {
  min-height: 140px;
  resize: vertical;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
}

select {
  appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, #5c7080 50%),
    linear-gradient(135deg, #5c7080 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

input:hover, textarea:hover, select:hover { border-color: #a9c0cc; background-color: #fff; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(12, 100, 120, 0.16);
}

input::placeholder { color: #8aa0ae; }

.actions, .actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions-bar {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

button, .button {
  appearance: none;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

button:hover, .button:hover { background: var(--accent-dark); }
button:focus-visible, .button:focus-visible { outline: 3px solid rgba(12, 100, 120, 0.28); outline-offset: 2px; }

button.secondary, .button.secondary {
  background: #fff;
  color: var(--text);
  border-color: #c9d6df;
}

button.secondary:hover, .button.secondary:hover { background: #f4f8fa; border-color: #a9c0cc; }

button.stop {
  background: #fff;
  color: var(--err-text);
  border-color: #f0c5cb;
}

button.stop:hover { background: var(--err); }

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
  border: 1px solid transparent;
}

.banner.ok { background: var(--ok); color: var(--ok-text); border-color: #c9ead8; }
.banner.err { background: var(--err); color: var(--err-text); border-color: #f6d0d5; }

code, .url {
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  word-break: break-all;
}

.map {
  display: grid;
  gap: 8px;
}

.map-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) 1.2fr;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.map-name { font-weight: 600; }
.map-name span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

dl { display: grid; grid-template-columns: 240px 1fr; gap: 8px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

@media (max-width: 760px) {
  .grid, dl, .map-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .switch { width: 100%; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}
