:root {
  --bg: #0c0d10;
  --panel: #15171c;
  --panel-2: #1c1f26;
  --text: #f2f3f5;
  --muted: #8b90a0;
  --accent: #e01e2b;
  --accent-soft: rgba(224, 30, 43, 0.15);
  --border: #262a33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 0 14px 28px;
}

.topbar {
  padding: 18px 4px 8px;
}
.brand {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
.tab:disabled { opacity: 0.45; cursor: default; }

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 6px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.card .label { color: var(--muted); font-size: 13px; }
.card .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.card.full { grid-column: 1 / -1; }

.section-title {
  margin: 18px 2px 4px;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.loader, .err {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}
.err { color: var(--accent); }

/* ===== Общие элементы вкладок ===== */
.toolbar {
  display: flex;
  gap: 8px;
  margin: 6px 0 12px;
}
.input {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.select { background: var(--panel); }
.area { min-height: 96px; resize: vertical; margin: 10px 0; }
.hidden { display: none; }

.btn {
  display: inline-block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.btn:active { opacity: 0.85; }
.btn.ghost {
  width: auto;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 0;
  margin: 0 0 4px;
}
.btn.danger { background: #b3202a; border-color: #b3202a; }
.btn.danger.outline { background: transparent; color: #e0626a; }
.btn.outline { background: transparent; color: var(--text); }
.toolbar .btn { width: auto; margin-top: 0; flex: 0 0 auto; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.row.static { cursor: default; }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row-arrow { color: var(--muted); font-size: 20px; padding-left: 8px; }

.badge {
  display: inline-block;
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
}
.badge.red { color: #e0626a; border-color: #5a2326; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; word-break: break-word; }
.form-row { display: flex; gap: 8px; margin-top: 8px; }
.muted-line { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.code {
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
  margin: 0;
  color: var(--text);
}

/* ===== Настройки: тумблеры ===== */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.setting + .setting { border-top: 1px solid var(--border); }
.setting-label { font-size: 14px; font-weight: 600; }
.setting-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.switch { position: relative; flex: 0 0 auto; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 26px; transition: 0.2s;
}
.slider::before {
  content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ===== Рассылки ===== */
.radio-row { display: flex; gap: 18px; }
.radio { font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 6px; }

/* ===== Формы каталога ===== */
.flabel { color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 6px 0 2px; opacity: .85; }
.preview {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.checkrow { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 10px 0; }
.panel .input { margin-bottom: 2px; }
.panel .btn { margin-top: 12px; }
