:root {
  --bg: #0a0a0c;
  --bg-soft: #121215;
  --card: #17171b;
  --card-hover: #1f1f25;
  --line: #2b2b33;
  --text: #f2eee8;
  --muted: #9b948b;
  --accent: #ff7a1a;
  --accent-dim: #7c3a06;
  --accent-2: #ffb340;
  --accent-2-dim: #6f4a0d;
  --good: #34d399;
  --warn: #facc15;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(255, 122, 26,.13), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(255, 179, 64,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-2); }

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Шапка ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 12, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 66px; }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; letter-spacing: .5px; color: var(--text); }
.logo:hover { color: var(--text); }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #1a0a00; font-weight: 900; font-size: 18px;
}
.logo span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--muted); padding: 8px 12px; border-radius: 9px;
  font-weight: 500; font-size: 14px; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.active { color: var(--accent); background: rgba(255, 122, 26,.10); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.ip-button {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(255, 122, 26,.16), rgba(255, 179, 64,.14));
  border: 1px solid var(--accent-dim); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-family: ui-monospace, monospace;
  cursor: pointer; font-size: 13px; transition: transform .12s, box-shadow .15s;
}
.ip-button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 122, 26,.2); }
.ip-button.copied { border-color: var(--good); color: var(--good); }

.online-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted); padding: 7px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }

.burger { display: none; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 8px 11px; cursor: pointer; font-size: 17px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: transform .12s, background .15s, border-color .15s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-1px); background: var(--card-hover); color: var(--text); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #e85d04); border-color: transparent; color: #1a0a00; }
.btn-primary:hover { background: linear-gradient(135deg, #ff9648, var(--accent)); color: #1a0a00; }
.btn-secondary { background: linear-gradient(135deg, var(--accent-2), #f59e0b); border-color: transparent; color: #241500; }
.btn-secondary:hover { color: #241500; }
.btn-danger { border-color: #7f1d1d; color: var(--bad); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Карточки ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.card-link { display: block; color: inherit; transition: transform .15s, border-color .15s, background .15s; }
.card-link:hover { transform: translateY(-3px); border-color: var(--accent-dim); background: var(--card-hover); color: inherit; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

main { flex: 1; padding: 32px 0 60px; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--muted); }

h1, h2, h3 { line-height: 1.25; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 36px 0 16px; }
.section-title h2 { margin: 0; font-size: 21px; }

/* ---------- Hero ---------- */
.hero {
  border: 1px solid var(--line); border-radius: 22px; padding: 56px 40px;
  background:
    radial-gradient(700px 300px at 20% 0%, rgba(255, 122, 26,.16), transparent 65%),
    radial-gradient(600px 300px at 85% 100%, rgba(255, 179, 64,.13), transparent 60%),
    var(--bg-soft);
  text-align: center; position: relative; overflow: hidden;
}
.hero h1 { font-size: clamp(32px, 6vw, 52px); margin: 0 0 14px; letter-spacing: -1.5px; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 17px; max-width: 620px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.stat-row { display: flex; gap: 28px; justify-content: center; margin-top: 34px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat b { display: block; font-size: 26px; color: var(--accent-2); }
.stat small { color: var(--muted); font-size: 13px; }

/* ---------- Бейджи ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid; white-space: nowrap;
}
.badge.good { color: var(--good); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .10); }
.badge.warn { color: var(--warn); border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .10); }
.badge.bad { color: var(--bad); border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .10); }
.badge.info { color: var(--info); border-color: rgba(96, 165, 250, .35); background: rgba(96, 165, 250, .10); }
.badge.muted { color: var(--muted); border-color: var(--line); background: var(--bg-soft); }
.badge.accent { color: var(--accent-2); border-color: rgba(255, 179, 64,.35); background: rgba(255, 179, 64,.10); }

/* ---------- Форум ---------- */
.section-card { display: flex; gap: 16px; align-items: flex-start; }
.section-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: rgba(255, 122, 26,.12); border: 1px solid var(--accent-dim); font-size: 20px;
}
.section-card h3 { margin: 0 0 4px; font-size: 17px; }
.section-card p { margin: 0; color: var(--muted); font-size: 14px; }
.section-meta { margin-left: auto; text-align: right; color: var(--muted); font-size: 13px; flex: none; }

.topic-row {
  display: flex; gap: 14px; align-items: center; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  transition: border-color .15s, background .15s; color: inherit; margin-bottom: 10px;
}
.topic-row:hover { border-color: var(--accent-dim); background: var(--card-hover); color: inherit; }
.topic-main { min-width: 0; flex: 1; }
.topic-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topic-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topic-stats { display: flex; gap: 18px; color: var(--muted); font-size: 13px; flex: none; }
.topic-stats b { display: block; color: var(--text); text-align: center; }

.avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-dim), var(--accent-2-dim)); color: #fff;
  font-weight: 700; font-size: 15px; text-transform: uppercase;
}
.avatar.lg { width: 64px; height: 64px; font-size: 24px; border-radius: 16px; }

/* ---------- Посты ---------- */
.post { display: flex; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 14px; }
.post-side { width: 120px; flex: none; text-align: center; }
.post-side .avatar { margin: 0 auto 8px; }
.post-author { font-weight: 600; font-size: 14px; word-break: break-word; }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }

.prose { overflow-wrap: break-word; }
.prose p { margin: 0 0 12px; }
.prose > :last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { margin: 22px 0 10px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 12px; }
.prose li { margin-bottom: 5px; }
.prose code { background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; font-size: 13px; color: var(--accent-2); }
.prose pre { background: var(--bg-soft); padding: 14px; border-radius: 10px; overflow-x: auto; border: 1px solid var(--line); }
.prose pre code { background: none; padding: 0; color: var(--text); }
.prose blockquote { margin: 0 0 12px; padding: 8px 16px; border-left: 3px solid var(--accent-dim); color: var(--muted); background: var(--bg-soft); border-radius: 0 8px 8px 0; }
.prose img { max-width: 100%; border-radius: 10px; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose th { background: var(--bg-soft); }

.shots { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.shots a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; transition: border-color .15s; }
.shots a:hover { border-color: var(--accent); }
.shots img { display: block; width: 150px; height: 100px; object-fit: cover; }

/* ---------- Формы ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-row .hint { color: var(--muted); font-size: 13px; margin-top: 5px; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 10px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 26,.13);
}
textarea { resize: vertical; min-height: 110px; font-family: inherit; }
select { cursor: pointer; }
input[type=file] { color: var(--muted); font-size: 13px; }

.checkbox { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; margin-bottom: 10px; cursor: pointer; }
.checkbox input { margin-top: 3px; flex: none; accent-color: var(--accent); }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }

.auth-box { max-width: 420px; margin: 40px auto; }

/* ---------- Сообщения ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.flash.ok { color: var(--good); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); }
.flash.err { color: var(--bad); border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); }
.flash.info { color: var(--info); border-color: rgba(96, 165, 250, .35); background: rgba(96, 165, 250, .08); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: var(--bg-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.data th a { color: var(--muted); }
table.data th a:hover { color: var(--accent); }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--card-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.num { color: var(--muted); font-family: ui-monospace, monospace; font-size: 13px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font-size: 14px;
}
.pagination a:hover { border-color: var(--accent-dim); color: var(--text); }
.pagination .current { background: var(--accent); color: #1a0a00; border-color: transparent; font-weight: 600; }

/* ---------- Админка ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.admin-nav { position: sticky; top: 86px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.admin-nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 500; }
.admin-nav a:hover { background: var(--bg-soft); color: var(--text); }
.admin-nav a.active { background: rgba(255, 122, 26,.12); color: var(--accent); }
.admin-nav .count { background: var(--bad); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.admin-nav hr { border: none; border-top: 1px solid var(--line); margin: 8px 4px; }

.kpi { padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
.kpi b { display: block; font-size: 30px; line-height: 1.1; color: var(--accent-2); }
.kpi small { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 13px; font-weight: 500; }
.tabs a:hover { border-color: var(--accent-dim); color: var(--text); }
.tabs a.active { background: var(--accent); border-color: transparent; color: #1a0a00; font-weight: 600; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filters .f { display: flex; flex-direction: column; gap: 5px; }
.filters label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.filters select, .filters input { min-width: 140px; padding: 8px 11px; font-size: 13px; }

.bulk-bar { display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: var(--bg-soft); border: 1px solid var(--accent-dim); border-radius: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.bulk-bar select { min-width: 160px; padding: 7px 11px; font-size: 13px; }
.bulk-bar.is-idle { display: none; }

.detail-grid { display: grid; grid-template-columns: 1fr 330px; gap: 20px; align-items: start; }
.side-panel { position: sticky; top: 86px; display: grid; gap: 16px; }
.field-list { display: grid; gap: 10px; font-size: 14px; }
.field-list div { display: flex; justify-content: space-between; gap: 12px; }
.field-list dt, .field-list .k { color: var(--muted); }

.note { padding: 12px 14px; background: rgba(255, 179, 64,.07); border: 1px solid rgba(255, 179, 64,.25); border-radius: 10px; margin-bottom: 10px; font-size: 14px; }
.note .meta { color: var(--muted); font-size: 12px; margin-bottom: 5px; }

.history { display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.history b { color: var(--text); }

/* ---------- Футер ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 32px 0; margin-top: auto; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.socials { display: flex; gap: 10px; }
.socials a { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; background: var(--card); font-size: 13px; font-weight: 700; }
.socials a:hover { border-color: var(--accent); }

/* ---------- Адаптив ---------- */
@media (max-width: 980px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-nav hr { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; }
}

@media (max-width: 760px) {
  .burger { display: block; }
  .nav {
    display: none; position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; background: var(--bg-soft); border-bottom: 1px solid var(--line);
    padding: 10px; gap: 2px;
  }
  .nav.open { display: flex; }
  .header-inner { position: relative; }
  .online-badge { display: none; }
  .hero { padding: 40px 22px; }
  .post { flex-direction: column; gap: 12px; }
  .post-side { width: auto; display: flex; align-items: center; gap: 10px; text-align: left; }
  .post-side .avatar { margin: 0; }
  .topic-stats { display: none; }
  .footer-inner { flex-direction: column; }
}
