/* Aegis — оформление сайта
   Тёмная тема, графит + мягкий мятный акцент. Без внешних шрифтов. */

:root {
  color-scheme: dark;
  --bg: #08090b;
  --bg-soft: #0c0e11;
  --card: #0f1216;
  --card-hover: #12161b;
  --border: #1d222a;
  --border-strong: #2a313b;
  --text: #e8ebf0;
  --muted: #939ba8;
  --faint: #69717e;
  --accent: #5fe3b0;
  --accent-strong: #34d399;
  --accent-soft: rgba(95, 227, 176, 0.1);
  --accent-line: rgba(95, 227, 176, 0.32);
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 24px 48px -28px rgba(0, 0, 0, 0.85);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 78% -12%, rgba(95, 227, 176, 0.07), transparent 65%),
    radial-gradient(700px 420px at 0% 100%, rgba(95, 227, 176, 0.035), transparent 70%);
}

::selection {
  background: rgba(95, 227, 176, 0.24);
  color: #fff;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: #fff;
}

img {
  max-width: 100%;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

main.container {
  flex: 1;
  padding-top: 56px;
  padding-bottom: 88px;
}

/* ── Шапка ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 9, 11, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14.5px;
  color: var(--muted);
}

.nav a {
  position: relative;
  color: var(--muted);
}

.nav a:hover {
  color: var(--text);
}

.nav a.active {
  color: var(--text);
}

.nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -24px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.nav .btn {
  color: #0a0b0d;
}

.nav .btn:hover {
  color: #0a0b0d;
}

.user-link {
  color: var(--text);
  font-weight: 600;
}

/* ── Типографика ────────────────────────────────────────────────────────── */
h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.025em;
}

h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h3 {
  font-weight: 600;
}

p {
  margin: 0 0 12px;
}

p:last-child {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
}

.lead {
  max-width: 640px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.plain-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.plain-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
}

.plain-list code {
  color: var(--text);
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(95, 227, 176, 0.12);
}

code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 13px;
}

/* ── Кнопки ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #eef1f4;
  color: #0a0b0d;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover {
  background: #fff;
  color: #0a0b0d;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--card-hover);
  border-color: #3a424e;
  color: #fff;
}

.btn-small {
  padding: 8px 14px;
  font-size: 14px;
}

.btn-danger {
  background: #b93a3d;
  color: #fff;
}

.btn-danger:hover {
  background: #d34548;
  color: #fff;
}

.btn .arrow {
  color: var(--faint);
  transition: transform 0.15s ease, color 0.15s ease;
}

.btn:hover .arrow {
  color: var(--text);
  transform: translateX(2px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.actions form {
  margin: 0;
}

/* ── Главная ────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 40px 0 30px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -60px -24px -40px;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 80% at 25% 30%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(70% 80% at 25% 30%, #000 20%, transparent 78%);
  pointer-events: none;
}

.hero h1 {
  max-width: 860px;
  margin-bottom: 20px;
  font-size: clamp(42px, 7vw, 68px);
  line-height: 1.04;
  font-weight: 650;
  letter-spacing: -0.045em;
}

.hero-dim {
  color: var(--muted);
}

.hero .lead {
  max-width: 620px;
  font-size: 18px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 720px;
  margin: 48px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--border);
}

.hero-stats > div {
  padding-right: 24px;
}

.hero-stats > div + div {
  padding-left: 24px;
  border-left: 1px solid var(--border);
}

.hero-stats dt {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-stats dd {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.section {
  margin-top: 88px;
}

.section-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 200px at 100% 0%, rgba(95, 227, 176, 0.07), transparent 70%),
    var(--card);
}

.band h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.band p {
  max-width: 560px;
  color: var(--muted);
}

/* ── Сетки и карточки ───────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.features {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.card {
  position: relative;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--card-hover);
}

.card h2 {
  margin-bottom: 8px;
}

.card p {
  color: var(--muted);
}

.feature {
  padding-top: 22px;
}

.feature-index {
  display: block;
  margin-bottom: 26px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.feature h2 {
  font-size: 17px;
}

.feature p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
}

.card-link {
  display: block;
  color: var(--text);
}

.card-link h2 {
  transition: color 0.15s ease;
}

.card-link:hover h2 {
  color: var(--accent);
}

.stat,
.card .stat {
  margin-top: 16px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

/* ── Уровни ─────────────────────────────────────────────────────────────── */
.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.level-card:hover {
  transform: none;
}

.level-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.level-head h2 {
  margin: 0;
  font-size: 18px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--accent-line);
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ── Профиль ────────────────────────────────────────────────────────────── */
.profile {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
  padding: 26px;
  background:
    radial-gradient(420px 180px at 0% 0%, rgba(95, 227, 176, 0.08), transparent 70%),
    var(--card);
}

.profile h1 {
  margin-bottom: 4px;
}

.profile p {
  margin: 0;
}

.avatar {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-soft);
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.logout {
  margin-top: 32px;
}

.error-card h1 {
  color: var(--red);
}

/* ── Подвал ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  color: var(--faint);
  font-size: 13.5px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--text);
}

/* ── Формы ──────────────────────────────────────────────────────────────── */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 0 16px;
}

.section-head h1,
.section-head h2 {
  margin: 0;
}

.section-head h1 {
  font-size: clamp(26px, 3.4vw, 34px);
}

main > h1 + .muted {
  max-width: 680px;
  margin-top: -4px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.inline-form input,
.inline-form select,
.search-form input,
.search-form select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input[type="checkbox"],
.field input[type="radio"],
.inline-form input[type="checkbox"],
.inline-form input[type="radio"] {
  width: auto;
  padding: 0;
  border: none;
  background: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-form input:focus,
.inline-form select:focus,
.search-form input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(95, 227, 176, 0.1);
}

.field input[type="file"],
.inline-form input[type="file"] {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 14px;
}

.field input[type="file"]::file-selector-button,
.inline-form input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--card-hover);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.field input[type="file"]::file-selector-button:hover,
.inline-form input[type="file"]::file-selector-button:hover {
  border-color: #3a424e;
  background: #171c23;
}

.field input[type="color"] {
  height: 44px;
  padding: 4px;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.search-form select,
.inline-form select {
  appearance: none;
  flex: 0 0 auto;
  width: auto;
  min-width: 170px;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
}

.checkbox-list {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent-strong);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inline-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  width: auto;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0 24px;
}

.search-form input[type="search"] {
  flex: 1;
  min-width: 220px;
  width: auto;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  margin: 6px 0 14px;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

/* ── Уведомления ────────────────────────────────────────────────────────── */
.alert {
  margin: 18px 0;
  padding: 13px 16px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.08);
  color: #fecaca;
}

.alert-muted {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--muted);
}

.notice {
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
}

/* ── Таблицы ────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.table th,
.table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover {
  background: var(--card-hover);
}

.table a {
  color: var(--text);
}

.table a:hover {
  color: var(--accent);
}

.status {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-new {
  border-color: rgba(95, 227, 176, 0.3);
  background: var(--accent-soft);
  color: var(--accent);
}

.status-accepted {
  border-color: rgba(251, 191, 36, 0.32);
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
}

.status-closed {
  border-color: var(--border-strong);
  background: var(--bg-soft);
  color: var(--muted);
}

.status-rejected {
  border-color: rgba(248, 113, 113, 0.32);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
}

/* ── Тикеты ─────────────────────────────────────────────────────────────── */
.ticket-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.ticket-head h1 {
  margin: 6px 0 8px;
  font-size: clamp(26px, 3.4vw, 34px);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.message {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.message.from-staff {
  border-left: 2px solid var(--accent);
}

.message.from-author {
  border-left: 2px solid var(--border-strong);
}

.message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.message-author {
  font-size: 14.5px;
  font-weight: 600;
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #d5dae1;
}

.attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.attachments a {
  color: var(--accent);
}

.attachments a:hover {
  text-decoration: underline;
}

.staff-actions {
  margin-top: 24px;
}

.staff-actions h2 {
  margin-bottom: 4px;
}

.danger-zone {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ── Панель владельца ───────────────────────────────────────────────────── */
.badge-level {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}

.tab {
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13.5px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tab:hover {
  color: var(--text);
  border-color: #3a424e;
}

.tab.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── Конструктор заявок ─────────────────────────────────────────────────── */
.question-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.question-row input,
.question-row select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.remove-question {
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.remove-question:hover {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.4);
}

@media (max-width: 820px) {
  .question-row {
    grid-template-columns: 1fr;
  }
}

/* ── Правила ────────────────────────────────────────────────────────────── */
.rules-intro {
  max-width: 760px;
  margin-bottom: 20px;
  color: var(--muted);
}

.rules {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

.rules-section-public {
  padding: 24px 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.rules-section-public h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.rules-items {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rules-items li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.rules-items li:first-child {
  border-top: none;
  padding-top: 6px;
}

.rule-number {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
}

.rule-text {
  white-space: pre-wrap;
  color: #d5dae1;
}

.rule-punish {
  grid-column: 2;
  justify-self: start;
  display: inline-block;
  margin-top: 4px;
  padding: 2px 9px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.07);
  color: #fca5a5;
  font-size: 12px;
}

.rules-footer {
  margin-top: 28px;
}

.rules-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.rules-sections {
  display: grid;
  gap: 14px;
  margin: 14px 0;
}

.rules-section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.rules-section-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.rules-section-head input {
  flex: 1;
}

.rules-section input,
.rules-section textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.rules-item {
  display: grid;
  grid-template-columns: auto 70px 1fr 160px auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  user-select: none;
  padding: 6px 2px;
  font-size: 16px;
  line-height: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.rules-section.dragging,
.rules-item.dragging {
  opacity: 0.55;
}

.rules-section.drop-target {
  border-color: var(--accent);
}

.rules-item.drop-target {
  outline: 1px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 9px;
}

.rules-item textarea {
  min-height: 38px;
  resize: vertical;
}

.rules-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}

.rules-preview-card {
  position: sticky;
  top: 18px;
}

.rules-preview {
  margin-top: 12px;
}

.discord-embed {
  padding: 14px 16px;
  border-left: 4px solid var(--accent-strong);
  border-radius: 4px;
  background: #2b2d31;
  color: #dbdee1;
  font-size: 14px;
  line-height: 1.45;
}

.embed-title {
  margin-bottom: 8px;
  color: #f2f3f5;
  font-size: 16px;
  font-weight: 700;
}

.embed-desc {
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.embed-section {
  margin: 12px 0 4px;
  color: #f2f3f5;
  font-weight: 700;
}

.embed-line {
  margin: 3px 0;
}

.embed-punish {
  color: #ff8f92;
}

.embed-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #3f4147;
  color: #b5bac1;
  font-size: 12px;
}

.panel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel-actions {
  margin: 18px 0;
}

.panel-rows {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.panel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.panel-row input[type="text"],
.panel-row textarea,
.panel-row select {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.panel-field-row input[type="text"] {
  flex: 0 1 180px;
}

.panel-field-row textarea {
  flex: 1 1 260px;
  min-height: 38px;
  resize: vertical;
}

.panel-button-row input[type="text"],
.panel-button-row select {
  flex: 1 1 150px;
}

.embed-thumbnail {
  float: right;
  width: 80px;
  height: 80px;
  margin: 0 0 8px 12px;
  border-radius: 8px;
  object-fit: cover;
}

.embed-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-top: 8px;
}

.embed-field {
  grid-column: 1 / -1;
}

.embed-field.inline {
  grid-column: span 1;
}

.embed-field-name {
  color: #f2f3f5;
  font-size: 13px;
  font-weight: 600;
}

.embed-field-value {
  font-size: 13.5px;
  white-space: pre-wrap;
}

.embed-image {
  max-width: 100%;
  margin-top: 10px;
  border-radius: 6px;
}

.embed-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.embed-button {
  padding: 7px 14px;
  border-radius: 6px;
  background: #5865f2;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.embed-button.link {
  background: #4e5058;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.col-narrow {
  width: 38%;
}

@media (max-width: 980px) {
  .rules-layout,
  .panel-layout {
    grid-template-columns: 1fr;
  }

  .rules-preview-card {
    position: static;
  }

  .rules-item {
    grid-template-columns: 1fr;
  }
}

/* ── Приветствие ────────────────────────────────────────────────────────── */
.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.welcome-preview {
  display: block;
  width: 100%;
  margin: 12px 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}

.welcome-embed-preview {
  font-size: 14px;
}

.welcome-background {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-top: 16px;
}

.welcome-background img {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

@media (max-width: 980px) {
  .welcome-layout {
    grid-template-columns: 1fr;
  }
}

/* ── GPU ────────────────────────────────────────────────────────────────── */
.gpu-stats .stat {
  margin: 0 0 4px;
  font-size: 26px;
}

.gpu-rarity {
  margin-top: 34px;
}

.gpu-rarity h2 {
  margin-bottom: 12px;
  font-size: 17px;
}

.gpu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.gpu-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

.gpu-card h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

.gpu-card-off {
  opacity: 0.58;
}

.gpu-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.gpu-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-soft);
  font-size: 22px;
}

.gpu-meta {
  display: flex;
  gap: 20px;
  margin: 0;
}

.gpu-meta dt {
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gpu-meta dd {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.gpu-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.gpu-actions form {
  margin: 0;
}

.gpu-edit {
  margin-top: 10px;
}

.gpu-edit > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
}

.gpu-edit > summary::-webkit-details-marker {
  display: none;
}

.gpu-edit[open] > summary {
  margin-bottom: 12px;
}

.gpu-edit .form {
  gap: 10px;
}

.badge-on {
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
  color: #86efac;
}

.badge-off {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
}

/* ── Адаптив ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  main.container {
    padding-top: 40px;
    padding-bottom: 64px;
  }

  .section {
    margin-top: 64px;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 0;
  }

  .nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 18px;
    font-size: 14px;
  }

  .nav a.active::after {
    bottom: -6px;
  }

  .hero {
    padding-top: 24px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 36px;
  }

  .hero-stats > div {
    padding: 0;
  }

  .hero-stats > div + div {
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
    border-left: none;
  }

  .profile {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .band {
    padding: 24px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn {
    width: 100%;
  }
}

/* Фокус с клавиатуры */
:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
