:root {
  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --ink: #18212f;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #175cd3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-body: 15px;
  --text-heading-sm: 18px;
  --text-heading-md: clamp(26px, 3vw, 32px);
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
}

.topbar {
  min-height: 68px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  width: min(1120px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
}

.topbar h1 {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: clamp(20px, 2vw, 22px);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.safety-banner {
  color: #7a2e0e;
  background: var(--warning-soft);
  border-bottom: 1px solid #fedf89;
  font-size: var(--text-sm);
}

.safety-banner-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 9px 0;
}

.safety-banner strong {
  font-weight: 700;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.nav-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  gap: 4px;
  padding: 8px 0;
  overflow-x: auto;
}

.nav-inner a {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: #344054;
  border-radius: 7px;
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
}

.nav-inner a:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-inner a[aria-current="page"] {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px #dbeafe;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 30px auto 64px;
}

.hero {
  margin-bottom: 22px;
}

.hero h2,
.card h2 {
  margin: 6px 0 7px;
  color: var(--ink);
  font-size: var(--text-heading-md);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.hero p:not(.eyebrow) {
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.6;
}

.card {
  margin-bottom: 16px;
  padding: clamp(18px, 2.4vw, 24px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 4px 0 14px;
  font-size: var(--text-heading-sm);
  line-height: 1.4;
  font-weight: 600;
}

.login {
  max-width: 440px;
  margin: 7vh auto;
}

.login h2 {
  font-size: 26px;
  font-weight: 600;
}

.login > p:not(.eyebrow) {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
}

.inline-form,
.form-grid {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: var(--text-sm);
  font-weight: 500;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font: inherit;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.03);
}

input:hover,
select:hover {
  border-color: #98a2b3;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  box-shadow: none;
}

button {
  min-height: 40px;
  padding: 8px 14px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 7px;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.quiet,
.secondary {
  color: #344054;
  background: var(--surface);
  border-color: var(--line-strong);
}

.quiet:hover,
.secondary:hover {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: #98a2b3;
}

.secondary {
  margin-top: 10px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.23);
  outline-offset: 2px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.release h3 {
  overflow-wrap: anywhere;
}

.release-ref {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #344054;
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.technical-note {
  margin: 7px 0 0;
  color: #98a2b3;
  font-family: inherit;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.section-heading p:not(.eyebrow),
#add-release > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-strip article {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
}

.status-strip .eyebrow {
  margin-bottom: 8px;
}

.status-strip code,
.status-strip strong {
  display: block;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
}

.status-strip small {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.45;
}

.section-heading {
  margin: 30px 0 14px;
}

.section-heading h3 {
  margin: 5px 0 5px;
  color: var(--ink);
  font-size: var(--text-heading-sm);
  line-height: 1.4;
  font-weight: 600;
}

.section-heading p {
  max-width: 760px;
  margin: 0;
}

.build-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.build-picker button {
  min-width: 214px;
}

.form-help {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.5;
}

.empty-state {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 14px 16px;
  color: #344054;
  background: var(--surface-subtle);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.empty-state span {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.cards .card {
  height: 100%;
  margin-bottom: 0;
}

.release {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.release h3 {
  margin: 3px 0 9px;
}

.switch-card {
  border-top: 3px solid #84adff;
}

.switch-card.public-control {
  border-top-color: #fdb022;
}

.public-control::before {
  content: "Локальная демонстрация — настоящий сайт не изменяется";
  display: block;
  margin: -4px 0 16px;
  padding: 7px 9px;
  color: #7a2e0e;
  background: var(--warning-soft);
  border: 1px solid #fedf89;
  border-radius: 6px;
  font-size: var(--text-xs);
}

.switch-card .stack {
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #475467;
  background: #f2f4f7;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.badge.verified {
  color: var(--success);
  background: var(--success-soft);
  border-color: #abefc6;
}

.badge.failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #fecdca;
}

.badge.registered {
  color: var(--info);
  background: var(--primary-soft);
  border-color: #b2ddff;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-form .card {
  margin-bottom: 0;
}

.settings-status,
.settings-section-head,
.routing-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.settings-status h3,
.settings-section-head h3,
.routing-card h3 {
  margin-bottom: 0;
}

.settings-status-copy {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.55;
}

.settings-section-head {
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-section-head > p {
  min-width: 0;
  flex: 1;
  max-width: none;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-base);
}

.identity-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 14px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: #344054;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.identity-box span {
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.identity-box strong {
  font-weight: 600;
}

.identity-box small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.wide-field {
  grid-column: 1 / -1;
}

label > small {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 400;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.channel-card {
  min-width: 0;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.channel-card legend {
  padding: 0 7px;
  color: var(--ink);
  font-size: var(--text-heading-sm);
  font-weight: 600;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: #344054;
  cursor: pointer;
}

.channel-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
}

.channel-status span {
  width: 7px;
  height: 7px;
  background: #f79009;
  border-radius: 50%;
}

.channel-status.valid {
  color: var(--success);
}

.channel-status.valid span {
  background: var(--success);
}

.channel-status.invalid {
  color: var(--danger);
}

.channel-status.invalid span {
  background: var(--danger);
}

.channel-status.not_configured span,
.channel-status.untested span {
  background: #f79009;
}

.verification-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.verification-row {
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

button.compact {
  min-height: 36px;
  padding: 8px 12px;
  font-size: var(--text-sm);
}

.badge.valid {
  color: var(--success);
  background: var(--success-soft);
  border-color: #abefc6;
}

.badge.invalid {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #fecdca;
}

.badge.untested {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}

.routing-card {
  border-color: #b2ccff;
  background: #f8faff;
  box-shadow: var(--shadow);
}

.routing-card p:not(.eyebrow) {
  margin: 4px 0 0;
  color: var(--muted);
}

.routing-card button {
  flex: 0 0 auto;
}

.routing-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
}

.flash {
  margin-bottom: 18px;
  padding: 11px 14px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #abefc6;
  border-radius: 8px;
  font-size: var(--text-base);
}

.flash.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #fecdca;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: var(--text-sm);
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

th {
  color: #475467;
  background: var(--surface-subtle);
  font-weight: 600;
}

.table-primary {
  display: block;
  color: #344054;
  font-weight: 600;
}

td small {
  display: block;
  margin-top: 2px;
  color: #98a2b3;
  font-size: var(--text-xs);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fcfcfd;
}

footer {
  padding: 22px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--text-xs);
}

@media (max-width: 900px) {
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar-inner {
    min-height: 62px;
    align-items: center;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar-inner,
  .safety-banner-inner,
  .nav-inner {
    width: min(100% - 24px, 1120px);
  }

  .nav-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow-x: visible;
  }

  .nav-inner a {
    min-width: 0;
    text-align: center;
  }

  .grid.two,
  .form-grid,
  .channel-grid {
    grid-template-columns: 1fr;
  }

  .release {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-form {
    display: grid;
    align-items: stretch;
  }

  .settings-status,
  .settings-section-head,
  .routing-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .verification-row {
    width: 100%;
    justify-content: space-between;
  }

  .routing-actions,
  .routing-card button {
    width: 100%;
  }

  .build-picker {
    grid-template-columns: 1fr;
  }

  .build-picker button {
    width: 100%;
  }

  .identity-box {
    grid-template-columns: 1fr;
  }

  .identity-box span {
    grid-row: auto;
  }

  main {
    width: min(100% - 24px, 1120px);
    margin-top: 22px;
  }
}

@media (max-width: 520px) {
  .status-strip {
    grid-template-columns: 1fr;
  }
}
