/* ==========================================================================
   Оформление форума
   Цвета задаются переменными ниже: поменяйте их — поменяется весь сайт.
   Цвет акцента (кнопки, ссылки) выбирается в админке → Настройки.
   ========================================================================== */

:root {
  --paper: #F2F3F8;
  --surface: #FFFFFF;
  --surface-2: #F6F7FB;
  --line: #E1E4EE;
  --line-2: #CDD2E1;
  --ink: #1D2145;
  --ink-2: #4A5074;
  --ink-3: #747A9A;
  --accent: var(--accent-l, #3447D6);
  --on-accent: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --marker: #FFDF5E;
  --marker-ink: #2A2300;
  --ok: #18825A;
  --ok-soft: #E2F4EB;
  --bad: #C4314D;
  --bad-soft: #FCE8EC;
  --warn: #9A5800;
  --warn-soft: #FFF2D4;
  --pre-bg: #1D2145;
  --pre-ink: #E8EAF8;
  --shadow: 0 1px 2px rgba(29, 33, 69, .05), 0 12px 32px -18px rgba(29, 33, 69, .28);
  --shadow-pop: 0 2px 6px rgba(29, 33, 69, .08), 0 24px 48px -16px rgba(29, 33, 69, .35);

  --f-display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --f-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --f-mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;

  --r-lg: 18px;
  --r: 12px;
  --r-sm: 9px;
  --wrap: 1180px;
  color-scheme: light;
}

/* Тёмная тема: по кнопке в шапке или по настройкам системы */
:root[data-theme="dark"] {
  --paper: #121429;
  --surface: #1A1D38;
  --surface-2: #20244A;
  --line: #2B305A;
  --line-2: #3B4173;
  --ink: #E8EAF7;
  --ink-2: #B4B9D8;
  --ink-3: #868CB2;
  --accent: var(--accent-d, #8E9BFF);
  --on-accent: #10132A;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --marker: #FFD84A;
  --ok: #4CCB95;
  --ok-soft: #173A33;
  --bad: #FF7A92;
  --bad-soft: #3D1D2E;
  --warn: #F3B451;
  --warn-soft: #3B2F18;
  --pre-bg: #0D0F22;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -18px rgba(0, 0, 0, .6);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 48px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --paper: #121429;
    --surface: #1A1D38;
    --surface-2: #20244A;
    --line: #2B305A;
    --line-2: #3B4173;
    --ink: #E8EAF7;
    --ink-2: #B4B9D8;
    --ink-3: #868CB2;
    --accent: var(--accent-d, #8E9BFF);
    --on-accent: #10132A;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
    --marker: #FFD84A;
    --ok: #4CCB95;
    --ok-soft: #173A33;
    --bad: #FF7A92;
    --bad-soft: #3D1D2E;
    --warn: #F3B451;
    --warn-soft: #3B2F18;
    --pre-bg: #0D0F22;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -18px rgba(0, 0, 0, .6);
    --shadow-pop: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 48px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

/* ---------- База ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--f-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font: 600 clamp(24px, 3.2vw, 32px)/1.2 var(--f-display); letter-spacing: -.015em; }
h2 { font: 600 19px/1.3 var(--f-display); letter-spacing: -.01em; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--marker); color: var(--marker-ink); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.page { padding-top: 28px; padding-bottom: 64px; }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
.strong { font-weight: 600; color: var(--ink); }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 12px; }
.ic { width: 20px; height: 20px; flex: none; }
.inline-ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- Подсказки при наведении ---------- */

[data-tip] { position: relative; }
@media (hover: hover) {
  [data-tip]:hover::after, [data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper);
    font: 500 12.5px/1.35 var(--f-body);
    padding: 6px 10px;
    border-radius: 8px;
    white-space: nowrap;
    max-width: 260px;
    pointer-events: none;
    z-index: 30;
    animation: tip-in .12s ease-out .35s both;
  }
}
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, 3px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 17px;
  border-radius: 11px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s;
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; gap: 6px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 13px; }
.btn-block { width: 100%; }
.danger-text { color: var(--bad) !important; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none !important;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }
.icon-btn.ghosted { visibility: hidden; }

/* ---------- Шапка ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-row { display: flex; align-items: center; gap: 22px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none !important; min-width: 0; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--marker);
  color: var(--marker-ink);
  flex: none;
  transform: rotate(-4deg);
}
.brand-mark .ic { width: 22px; height: 22px; stroke-width: 2; }
.brand-mark.big { width: 64px; height: 64px; border-radius: 18px; }
.brand-mark.big .ic { width: 34px; height: 34px; }
.brand-name { font: 600 17px/1.15 var(--f-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.main-nav { display: flex; gap: 2px; }
.main-nav a { padding: 8px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a.on { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--marker); }

.head-search { position: relative; flex: 1; max-width: 340px; margin-left: auto; }
.head-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.head-search input {
  width: 100%;
  height: 40px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  padding: 0 14px 0 38px;
  font-size: 15px;
}
.head-search input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.head-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.theme-btn .when-dark { display: none; }
:root[data-theme="dark"] .theme-btn .when-dark { display: inline; }
:root[data-theme="dark"] .theme-btn .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .theme-btn .when-dark { display: inline; }
  :root[data-theme="auto"] .theme-btn .when-light { display: none; }
}
.theme-btn span { display: inline-grid; }
.bell { position: relative; }
.dot-count {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--bad);
  color: #fff;
  font: 700 11px/19px var(--f-body);
  text-align: center;
  border: 2px solid var(--surface);
}
.nav-toggle { display: none; }

/* Меню профиля */
.menu { position: relative; }
.menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 99px;
  cursor: pointer;
  border: 1.5px solid var(--line);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--surface-2); }
.menu-name { font-weight: 600; font-size: 14.5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .chev { width: 16px; height: 16px; color: var(--ink-3); transition: transform .15s; }
.menu[open] .chev { transform: rotate(180deg); }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: 50;
}
.menu-who { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-who strong { display: block; line-height: 1.2; }
.menu-who span { font-size: 13px; color: var(--ink-3); }
.menu-pop a, .menu-pop button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop .ic { color: var(--ink-3); width: 18px; height: 18px; }
.menu-pop form { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.pill {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 12px/22px var(--f-body);
  text-align: center;
}
.pill.warn { background: var(--marker); color: var(--marker-ink); }

/* Полоски под шапкой */
.announce { background: var(--accent); color: var(--on-accent); }
.announce-warn { background: var(--marker); color: var(--marker-ink); }
.announce .wrap { display: flex; gap: 10px; align-items: center; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }
.announce-text p { margin: 0; }
.announce a { color: inherit; text-decoration: underline; }
.banbar { background: var(--bad); color: #fff; }
.banbar .wrap { display: flex; gap: 10px; align-items: center; padding-top: 10px; padding-bottom: 10px; font-size: 15px; }

/* ---------- Подвал ---------- */

.site-foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: auto; }
.foot-row { display: flex; justify-content: space-between; gap: 24px; padding-top: 28px; padding-bottom: 32px; flex-wrap: wrap; }
.foot-brand strong { font: 600 15px var(--f-display); }
.foot-brand p { color: var(--ink-3); font-size: 14px; max-width: 420px; margin-top: 4px; }
.foot-nav { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.foot-nav a { color: var(--ink-2); font-size: 15px; }

/* ---------- Уведомления наверху страницы ---------- */

.flashes { display: grid; gap: 10px; margin-bottom: 22px; }
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 13px;
  font-weight: 500;
  animation: flash-in .3s ease-out;
}
.flash > span { flex: 1; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--bad-soft); color: var(--bad); }
.flash-info { background: var(--accent-soft); color: var(--accent); }
.flash-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 4px; border-radius: 7px; display: grid; opacity: .7; }
.flash-x:hover { opacity: 1; }
.flash-x .ic { width: 18px; height: 18px; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Общие блоки ---------- */

.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card { padding: 24px; box-shadow: var(--shadow); }
.card + .card, .card + section, section + .card { margin-top: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-sub { color: var(--ink-2); margin-top: 6px; max-width: 640px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-title { font-size: 17px; margin: 28px 0 12px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); }
.crumb-sep { color: var(--line-2); }

.with-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.main-col { min-width: 0; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  vertical-align: 2px;
  white-space: nowrap;
}
.tag .ic { width: 13px; height: 13px; }
.tag-warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.tag-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.note {
  position: relative;
  padding: 12px 16px 12px 46px;
  border-radius: 13px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  color: var(--ink-2);
  margin: 0 0 18px;
}
.note > .ic:first-child { position: absolute; left: 16px; top: 14px; color: var(--ink-3); }
.note.small { font-size: 14px; padding: 9px 13px 9px 40px; }
.note.small > .ic:first-child { left: 12px; top: 10px; width: 18px; height: 18px; }

.empty { text-align: center; padding: 48px 24px; background: var(--surface); border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); }
.empty-ic { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--surface-2); color: var(--ink-3); margin-bottom: 14px; }
.empty-ic .ic { width: 28px; height: 28px; }
.empty h3 { font: 600 18px var(--f-display); margin-bottom: 6px; }
.empty p { color: var(--ink-2); max-width: 440px; margin: 0 auto 18px; }

/* Аватарки и роли */
.av {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--av, #5A5F7A);
  color: #fff;
  font-family: var(--f-display);
  font-weight: 600;
  letter-spacing: -.02em;
  user-select: none;
}
.av-xs { width: 20px; height: 20px; font-size: 8.5px; }
.av-sm { width: 30px; height: 30px; font-size: 11px; }
.av-md { width: 40px; height: 40px; font-size: 14px; }
.av-lg { width: 54px; height: 54px; font-size: 18px; }
.av-xl { width: 92px; height: 92px; font-size: 31px; }
.av-gone { background: var(--line-2); color: var(--ink-3); }
.ulink { font-weight: 600; color: var(--ink); }
.ulink.gone { color: var(--ink-3); font-weight: 500; font-style: italic; }

.role {
  display: inline-flex;
  align-items: center;
  padding: 1px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.role-admin { background: var(--accent-soft); color: var(--accent); }
.role-moder { background: var(--ok-soft); color: var(--ok); }
.role-banned { background: var(--bad-soft); color: var(--bad); }
.role-user { background: var(--surface-2); }
.role-op { background: var(--marker); color: var(--marker-ink); }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: pulse 2.4s infinite; vertical-align: 2px; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Блок для новичков ---------- */

.welcome {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 32px;
  align-items: center;
  background: var(--marker);
  color: var(--marker-ink);
  border-radius: 22px;
  padding: 30px 34px;
  margin-bottom: 32px;
}
.welcome h2 { font: 700 27px/1.15 var(--f-display); color: var(--marker-ink); letter-spacing: -.02em; }
.welcome-text p { margin-top: 10px; font-size: 16px; opacity: .85; }
.welcome-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.welcome-steps li { display: flex; gap: 12px; background: rgba(255, 255, 255, .55); border-radius: 15px; padding: 15px; }
.welcome-steps li.done { background: rgba(255, 255, 255, .28); }
.welcome-steps li.done b { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .65; }
.step-n {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--marker-ink);
  color: var(--marker);
  font: 700 14px var(--f-display);
}
.step-n .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.welcome-steps b { display: block; font-size: 15.5px; line-height: 1.3; }
.welcome-steps p { font-size: 13.5px; line-height: 1.45; margin: 4px 0 8px; opacity: .8; }
.welcome-steps a { color: var(--marker-ink); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.step-done { font-size: 13px; font-weight: 600; opacity: .6; }
.welcome-x { position: absolute; top: 10px; right: 10px; color: var(--marker-ink); width: 34px; height: 34px; }
.welcome-x:hover { background: rgba(0, 0, 0, .07); color: var(--marker-ink); }

/* ---------- Разделы на главной ---------- */

.cats { overflow: hidden; }
.cat-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 150px 250px;
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}
.cat-row:last-child { border-bottom: 0; }
.cat-ic {
  display: inline-grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--cat) 13%, var(--surface));
  color: var(--cat);
  flex: none;
}
:root[data-theme="dark"] .cat-ic { background: color-mix(in srgb, var(--cat) 24%, var(--surface)); color: color-mix(in srgb, var(--cat) 55%, #fff); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .cat-ic { background: color-mix(in srgb, var(--cat) 24%, var(--surface)); color: color-mix(in srgb, var(--cat) 55%, #fff); }
}
.cat-ic .ic { width: 25px; height: 25px; }
.cat-ic.lg { width: 64px; height: 64px; border-radius: 19px; }
.cat-ic.lg .ic { width: 32px; height: 32px; }
.cat-main h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 17.5px; }
.cat-main h3 a { color: var(--ink); }
.cat-main p { color: var(--ink-2); font-size: 14.5px; margin-top: 3px; line-height: 1.5; }
.cat-stats { display: flex; gap: 18px; margin: 0; }
.cat-stats div { display: flex; flex-direction: column-reverse; }
.cat-stats dt { font-size: 12.5px; color: var(--ink-3); }
.cat-stats dd { margin: 0; font: 600 18px/1.2 var(--f-display); }
.cat-last { display: flex; gap: 10px; align-items: center; min-width: 0; }
.cat-last > div { min-width: 0; display: flex; flex-direction: column; }
.cat-last-title { color: var(--ink); font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-last-meta { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-last-meta .ulink { font-weight: 500; color: var(--ink-2); }

/* ---------- Боковая колонка ---------- */

.side { display: grid; gap: 16px; position: sticky; top: 88px; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.side-box h2 { font-size: 14.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.figures div { display: flex; flex-direction: column-reverse; }
.figures dd { margin: 0; font: 700 21px/1.1 var(--f-display); letter-spacing: -.02em; }
.figures dt { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li { display: flex; align-items: center; gap: 9px; font-size: 14.5px; min-width: 0; }
.people li .muted { margin-left: auto; white-space: nowrap; }
.people.roomy { gap: 12px; }
.mini-topics { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mini-topics li { display: flex; flex-direction: column; font-size: 14.5px; line-height: 1.4; }
.mini-topics a { color: var(--ink); font-weight: 500; }
.mini-topics span { font-size: 12.5px; color: var(--ink-3); }
.tips ul { margin: 0; padding-left: 18px; display: grid; gap: 10px; font-size: 14.5px; color: var(--ink-2); }
.tips b { color: var(--ink); }

/* ---------- Раздел и список тем ---------- */

.cat-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; flex-wrap: wrap; }
.cat-head > div:nth-child(2) { flex: 1; min-width: 220px; }
.t-list { overflow: hidden; }
.t-head, .t-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 76px 86px 150px; gap: 16px; align-items: center; }
.t-head { padding: 10px 20px; font-size: 12.5px; color: var(--ink-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.t-head span:first-child { grid-column: 1 / 3; }
.t-head span:not(:first-child) { text-align: center; }
.t-head span:last-child { text-align: left; }
.t-row { padding: 15px 20px; border-bottom: 1px solid var(--line); }
.t-row:last-child { border-bottom: 0; }
.t-row:hover { background: var(--surface-2); }
.t-row.is-pinned { background: color-mix(in srgb, var(--marker) 9%, var(--surface)); }
.t-title { font-size: 16.5px; display: flex; align-items: center; gap: 6px; line-height: 1.35; }
.t-title a { color: var(--ink); }
.t-flag { display: inline-grid; color: var(--ink-3); }
.t-flag .ic { width: 17px; height: 17px; }
.t-flag.pin { color: var(--warn); }
.t-meta { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.t-meta .ulink { font-weight: 500; color: var(--ink-2); }
.t-num { text-align: center; display: flex; flex-direction: column; line-height: 1.2; }
.t-num b { font: 600 16px var(--f-display); }
.t-num span { font-size: 12px; color: var(--ink-3); }
.t-last { display: flex; flex-direction: column; font-size: 13.5px; line-height: 1.35; min-width: 0; }
.t-last a { color: var(--ink-2); }
.t-last span { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-last .ulink { font-weight: 500; color: var(--ink-3); }

/* Страницы */
.pager { display: flex; align-items: center; gap: 10px; margin: 20px 0; flex-wrap: wrap; }
.pg-nums { display: flex; gap: 6px; flex-wrap: wrap; }
.pg-num, .pg-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none !important;
}
.pg-num:hover, .pg-step:hover { border-color: var(--ink-3); }
.pg-num.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pg-step .ic { width: 17px; height: 17px; }
.pg-step.next { margin-left: auto; }
.pg-gap { align-self: center; color: var(--ink-3); padding: 0 2px; }

/* ---------- Тема и сообщения ---------- */

.topic-head { margin-bottom: 16px; }
.topic-head h1 { font-size: clamp(22px, 2.8vw, 29px); max-width: 900px; }
.topic-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 12px; color: var(--ink-3); font-size: 14px; }
.topic-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.topic-meta .ic { width: 16px; height: 16px; }

.modbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1.5px dashed var(--line-2);
  margin-bottom: 16px;
}
.modbar-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ok); margin-right: 6px; }
.modbar-label .ic { width: 18px; height: 18px; }
.move-form { display: inline-flex; gap: 6px; }
.move-form select { height: 34px; border-radius: 9px; border: 1.5px solid var(--line-2); background: var(--surface); padding: 0 8px; font-size: 14px; max-width: 200px; }

.posts { display: grid; gap: 16px; }
.post {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  scroll-margin-top: 90px;
}
.post:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.post-author {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 22px 14px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}
.post-author-info { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.post-name { font-size: 15.5px; word-break: break-word; }
.post-count { font-size: 12.5px; color: var(--ink-3); }
.post-main { display: flex; flex-direction: column; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 22px 0; font-size: 13.5px; color: var(--ink-3); }
.post-num { margin-left: auto; color: var(--ink-3); font-weight: 600; }
.edited { font-style: italic; }
.post-body { padding: 10px 22px 6px; flex: 1; max-width: 880px; }
.post-actions { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px 14px 12px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none !important;
}
.act .ic { width: 18px; height: 18px; }
.act:hover { background: var(--surface-2); color: var(--ink); }
.act.danger:hover { color: var(--bad); background: var(--bad-soft); }
.act.subtle { margin-left: auto; }
.like.on { color: var(--bad); }
.like.on .ic, .like.has .ic { fill: currentColor; }
.like.has { color: var(--bad); }
.like.is-static { cursor: default; }
.like.is-static:hover { background: none; color: inherit; }
.like.pop .ic { animation: like-pop .35s ease-out; }
@keyframes like-pop { 40% { transform: scale(1.35); } }

.reply-box { margin-top: 28px; }
.reply-box h2 { margin-bottom: 12px; }
.reply-guest {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 28px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  flex-wrap: wrap;
}
.reply-guest > .ic { width: 32px; height: 32px; color: var(--accent); }
.reply-guest > div:nth-child(2) { flex: 1; min-width: 220px; }
.reply-guest p { color: var(--ink-2); font-size: 15px; }
.reply-guest-actions { display: flex; gap: 10px; }

/* ---------- Текст сообщений ---------- */

.prose { line-height: 1.65; word-wrap: break-word; overflow-wrap: anywhere; }
.prose > * + * { margin-top: .75em; }
.prose ul { margin-left: 0; padding-left: 1.3em; }
.prose li + li { margin-top: .25em; }
.prose blockquote {
  margin: .75em 0;
  padding: 10px 16px;
  border-left: 3px solid var(--marker);
  background: var(--surface-2);
  border-radius: 0 12px 12px 0;
  color: var(--ink-2);
}
.prose blockquote p:first-child strong:only-child { color: var(--ink); }
.prose code { font: .9em var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; }
.prose pre { background: var(--pre-bg); color: var(--pre-ink); padding: 14px 16px; border-radius: 12px; overflow-x: auto; font-size: 14px; line-height: 1.5; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose img { border-radius: 10px; max-height: 520px; display: block; }
.prose a { word-break: break-word; }
.prose .mention { background: var(--accent-soft); padding: 0 .35em; border-radius: 6px; font-weight: 600; }
.spoiler { background: var(--ink-2); color: transparent; border-radius: 5px; padding: 0 .3em; cursor: pointer; transition: background .2s, color .2s; user-select: none; }
.spoiler a, .spoiler code { visibility: hidden; }
.spoiler.open { background: var(--surface-2); color: inherit; user-select: auto; cursor: auto; }
.spoiler.open a, .spoiler.open code { visibility: visible; }
.prose-lg { font-size: 17px; line-height: 1.7; }
.prose-lg > * + * { margin-top: .8em; }
.clamp { max-height: 210px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }

/* ---------- Формы ---------- */

.form-card { padding: 26px 28px; }
.form-card h2 { margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.form-card h2 .ic { color: var(--ink-3); }
.narrow { max-width: 760px; }
.field { margin: 0 0 20px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend, .field .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 7px; padding: 0; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .filters input, .filters select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 11px;
  background: var(--surface);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { padding: 12px 14px; line-height: 1.55; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field select, .filters select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23747A9A' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; cursor: pointer; }
.hint { font-size: 13.5px; color: var(--ink-3); margin-top: 7px; line-height: 1.5; }
.hint + .field, .hint + .check, .hint + .choices, .hint + form, .hint + .btn, p + .field { margin-top: 16px; }
.field-row + .hint { margin: -10px 0 18px; }
.form-card > p:not(.hint):not(.note) { margin-bottom: 14px; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.form-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bad-soft);
  color: var(--bad);
  padding: 12px 15px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-weight: 500;
}
.form-error .ic { margin-top: 2px; }
.count-hint { float: right; font-size: 12.5px; color: var(--ink-3); font-weight: 400; }

.check { display: flex; gap: 12px; align-items: flex-start; margin: 4px 0 20px; cursor: pointer; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.check b { color: var(--ink); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices.stacked { flex-direction: column; margin-bottom: 18px; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500 !important;
  margin: 0 !important;
  background: var(--surface);
}
.choice input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice.rich { align-items: flex-start; padding: 13px 15px; }
.choice.rich input { margin-top: 3px; }
.choice.rich span { display: flex; flex-direction: column; gap: 2px; }
.choice.rich small { color: var(--ink-3); font-size: 13.5px; font-weight: 400; line-height: 1.45; }
.choice.rich select { margin-top: 8px; height: 38px; border-radius: 9px; border: 1.5px solid var(--line-2); background: var(--surface); padding: 0 10px; max-width: 320px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; cursor: pointer; margin: 0 !important; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch .av, .swatch .sw-dot { display: grid; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px transparent; transition: box-shadow .15s; }
.sw-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--sw); }
.swatch input:checked + .av, .swatch input:checked + .sw-dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }
.swatch input:focus-visible + .av, .swatch input:focus-visible + .sw-dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }

.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, 46px); gap: 8px; }
.icon-opt { position: relative; margin: 0 !important; cursor: pointer; }
.icon-opt input { position: absolute; opacity: 0; }
.icon-opt span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; border: 1.5px solid var(--line-2); color: var(--ink-2); }
.icon-opt span .ic { width: 22px; height: 22px; }
.icon-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.icon-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---------- Редактор сообщений ---------- */

.editor { border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface); overflow: visible; transition: border-color .15s, box-shadow .15s; }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ed-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: 13px 13px 0 0; flex-wrap: wrap; }
.ed-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.ed-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 16px;
}
.ed-btn:hover { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.ed-btn .ic { width: 19px; height: 19px; }
.ed-btn b, .ed-btn i, .ed-btn s { font-family: var(--f-body); font-size: 16px; }
.ed-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 5px; }
.ed-tabs { display: flex; background: var(--line); border-radius: 10px; padding: 3px; }
.ed-tab { border: 0; background: none; padding: 5px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.ed-tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.editor textarea {
  display: block;
  width: 100%;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 14px 16px !important;
  min-height: 150px;
  resize: vertical;
  background: transparent !important;
  line-height: 1.6;
}
.ed-preview { padding: 14px 16px; min-height: 150px; }
.ed-foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.ed-count { white-space: nowrap; }

/* ---------- Вход и регистрация ---------- */

.auth { display: flex; gap: 28px; justify-content: center; align-items: flex-start; padding: 20px 0 30px; flex-wrap: wrap; }
.auth-card { width: 100%; max-width: 460px; padding: 32px; }
.auth-card h1 { font-size: 27px; }
.auth-sub { color: var(--ink-2); margin: 8px 0 22px; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--ink-2); }
.auth-note { text-align: center; margin-top: 10px; color: var(--ink-3); font-size: 13.5px; }
.auth-aside { max-width: 320px; padding: 30px 6px; }
.auth-aside h2 { margin-bottom: 18px; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.perks li { display: flex; gap: 14px; color: var(--ink-2); line-height: 1.5; }
.perks .ic { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; }
.perks b { color: var(--ink); }

/* ---------- Мастер установки ---------- */

.setup-body { background: var(--paper); }
.setup { display: grid; grid-template-columns: 1fr minmax(0, 520px); gap: 56px; max-width: 1080px; margin: 0 auto; padding: 64px 24px; align-items: start; }
.setup-intro h1 { font-size: clamp(30px, 4vw, 42px); margin: 22px 0 14px; letter-spacing: -.025em; }
.setup-intro > p { font-size: 18px; color: var(--ink-2); max-width: 440px; }
.setup-steps { margin: 32px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 18px; max-width: 440px; }
.setup-steps li { counter-increment: s; display: flex; gap: 14px; color: var(--ink-2); line-height: 1.5; }
.setup-steps li::before {
  content: counter(s);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--marker);
  font: 700 14px var(--f-display);
}
.setup-steps b { color: var(--ink); }
.setup-card { padding: 32px; }

/* ---------- Профиль, участники ---------- */

.profile-card { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.profile-id { flex: 1; min-width: 220px; }
.profile-id h1 { font-size: 28px; word-break: break-word; }
.profile-tags { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); font-weight: 600; }
.profile-bio { margin-top: 12px; color: var(--ink-2); max-width: 620px; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin: 20px 0 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.profile-stats div { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column-reverse; }
.profile-stats dt { font-size: 13px; color: var(--ink-3); }
.profile-stats dd { margin: 0; font: 700 22px/1.2 var(--f-display); }
.profile-stats .small-dd { font: 600 15px/1.4 var(--f-body); }
.activity { overflow: hidden; }
.activity-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.activity-row:last-child { border-bottom: 0; }
.activity-row:hover { background: var(--surface-2); }
.activity-title { font-weight: 600; }
.activity-text { grid-column: 1; color: var(--ink-2); font-size: 14.5px; }
.activity-time { grid-row: 1; grid-column: 2; font-size: 13px; color: var(--ink-3); display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.activity-time .ic { width: 14px; height: 14px; color: var(--bad); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 13px; flex-wrap: wrap; margin-bottom: 18px; width: fit-content; }
.toolbar .tabs { margin-bottom: 0; }
.tabs a { padding: 7px 13px; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: 14.5px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tabs a:hover { background: var(--surface-2); }
.tabs a.on { background: var(--ink); color: var(--paper); }
.mini-search { position: relative; }
.mini-search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); }
.mini-search input { height: 42px; border-radius: 11px; border: 1.5px solid var(--line-2); background: var(--surface); padding: 0 12px 0 36px; width: 240px; font-size: 15px; }
.mini-search input:focus { outline: none; border-color: var(--accent); }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 22px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--ink);
  text-decoration: none !important;
  transition: border-color .15s;
}
.member:hover { border-color: var(--ink-3); }
.member-name { font-weight: 600; margin-top: 4px; word-break: break-word; }
.member-meta { font-size: 13px; color: var(--ink-3); }
.settings-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.settings-grid .card + .card { margin-top: 0; }

.notes { overflow: hidden; }
.note-row { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--ink-2); text-decoration: none !important; }
.note-row:last-child { border-bottom: 0; }
.note-row:hover { background: var(--surface-2); }
.note-row.unread { background: var(--accent-soft); color: var(--ink); }
.note-row b { color: var(--ink); }
.note-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); flex: none; }
.note-ic .ic { width: 18px; height: 18px; }
.note-like { color: var(--bad); }
.note-like .ic { fill: currentColor; }
.note-text { flex: 1; min-width: 0; }
.note-time { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

/* ---------- Помощь, правила, поиск ---------- */

.help { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.help-toc { position: sticky; top: 90px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.help-toc h2 { font-size: 14px; margin-bottom: 10px; }
.help-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14.5px; color: var(--ink-3); }
.help-toc a { color: var(--ink-2); }
.help-body { max-width: 760px; }
.help-body section { padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.help-body section:last-child { border-bottom: 0; }
.help-body h2 { font-size: 21px; margin-bottom: 4px; }
.help-body ol { padding-left: 1.3em; }
.help-body li + li { margin-top: .3em; }
.help-body code { font: .88em var(--f-mono); background: var(--surface); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; }
.kbd-btn { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border: 1.5px solid var(--line-2); border-radius: 8px; background: var(--surface); font-size: .9em; font-weight: 600; white-space: nowrap; }
.kbd-btn .ic { width: 15px; height: 15px; }
.structure { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.structure-item { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 16px; font-size: 15px; line-height: 1.5; }
.structure-item b { display: block; font: 600 16px var(--f-display); margin: 10px 0 4px; }
.structure-item p { color: var(--ink-2); }
.structure-ic { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--marker); color: var(--marker-ink); }
.structure-item + .structure-item { position: relative; }
.format-table { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: var(--surface); font-size: 15.5px; }
.ft-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.ft-row:last-child { border-bottom: 0; }
.ft-row > span { padding: 11px 16px; min-width: 0; }
.ft-row > span:first-child { border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; }
.ft-row small { color: var(--ink-3); font-size: 12.5px; }
.ft-row code { align-self: flex-start; max-width: 100%; overflow-wrap: anywhere; }
.help-body section > * + * { margin-top: .7em; }
.help-body section > h2 + * { margin-top: .5em; }
.img-placeholder { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--line-2); color: var(--ink-3); font-size: 13.5px; }
.ft-head { background: var(--surface-2); font-weight: 600; font-size: 13.5px; color: var(--ink-3); }
.ft-row .prose > * { margin: 0; }
.rules { max-width: 820px; padding: 32px 36px; }

.big-search { position: relative; display: flex; gap: 10px; margin-bottom: 24px; max-width: 720px; }
.big-search > .ic { position: absolute; left: 16px; top: 15px; color: var(--ink-3); }
.big-search input { flex: 1; height: 50px; border-radius: 13px; border: 1.5px solid var(--line-2); background: var(--surface); padding: 0 16px 0 46px; font-size: 17px; }
.big-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.big-search .btn { height: 50px; }
.results { overflow: hidden; }
.result { display: flex; flex-direction: column; gap: 3px; padding: 15px 20px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.result:last-child { border-bottom: 0; }
.result:hover { background: var(--surface-2); }
.result-title { font-weight: 600; font-size: 16px; }
.result-text { color: var(--ink-2); font-size: 14.5px; }
.result-meta { font-size: 13px; color: var(--ink-3); }
mark { background: var(--marker); color: var(--marker-ink); padding: 0 .15em; border-radius: 4px; }

.quote-preview { background: var(--surface-2); border-radius: 13px; padding: 14px 16px; margin-bottom: 20px; }
.quote-who { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }

/* ---------- Страница ошибки ---------- */

.error-page { text-align: center; padding: 48px 0 32px; max-width: 560px; margin: 0 auto; }
.error-code {
  font: 700 clamp(96px, 18vw, 168px)/1 var(--f-display);
  color: transparent;
  -webkit-text-stroke: 2px var(--line-2);
  letter-spacing: -.04em;
}
.error-ic { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--marker); color: var(--marker-ink); margin: -36px 0 18px; position: relative; transform: rotate(-4deg); }
.error-ic .ic { width: 30px; height: 30px; }
.error-page h1 { font-size: 28px; }
.error-page p { color: var(--ink-2); margin: 10px auto 24px; }
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* ==========================================================================
   Админка
   ========================================================================== */

.admin-body { background: var(--paper); }
.admin { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side-bg) 256px, transparent 256px); }
:root { --side-bg: #1D2145; }
:root[data-theme="dark"] { --side-bg: #0C0E20; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --side-bg: #0C0E20; } }
.admin-side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--side-bg);
  color: #C9CDE8;
  padding: 18px 14px;
  overflow-y: auto;
}
.admin-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; color: #fff; text-decoration: none !important; }
.admin-brand > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.admin-brand b { font: 600 15px/1.2 var(--f-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-brand small { font-size: 12.5px; color: #9BA1C9; }
.admin-nav { display: grid; gap: 3px; }
.admin-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: #C9CDE8; font-weight: 500; font-size: 15px; text-decoration: none; }
.admin-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-nav a.on { background: var(--marker); color: var(--marker-ink); }
.admin-nav .ic { width: 19px; height: 19px; }
.admin-nav .pill.warn { background: #FF7A92; color: #2A0A12; }
.admin-nav a.on .pill.warn { background: var(--marker-ink); color: var(--marker); }
.admin-side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.back-link { display: flex; align-items: center; gap: 8px; color: #C9CDE8; font-size: 14.5px; padding: 8px; border-radius: 9px; }
.back-link:hover { color: #fff; background: rgba(255, 255, 255, .07); text-decoration: none; }
.back-link .ic { width: 18px; height: 18px; }
.admin-side .theme-btn { color: #C9CDE8; }
.admin-side .theme-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.admin-top { display: flex; align-items: center; gap: 16px; padding: 26px 36px 8px; }
.admin-title { flex: 1; min-width: 0; }
.admin-title h1 { font-size: clamp(22px, 2.6vw, 28px); }
.admin-title p { color: var(--ink-2); margin-top: 4px; }
.admin-me { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none !important; padding: 5px 12px 5px 5px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.admin-me-name { display: flex; flex-direction: column; line-height: 1.2; font-weight: 600; font-size: 14px; }
.admin-me small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.admin-menu { display: none; }
.admin-content { padding: 18px 36px 56px; max-width: 1180px; width: 100%; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink); text-decoration: none !important; transition: border-color .15s; }
.tile:hover { border-color: var(--ink-3); }
.tile-label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.tile-value { font: 700 32px/1.15 var(--f-display); letter-spacing: -.03em; }
.tile-extra { font-size: 13px; color: var(--ink-3); }
.tile.warn { background: var(--marker); border-color: var(--marker); color: var(--marker-ink); }
.tile.warn .tile-label, .tile.warn .tile-extra { color: var(--marker-ink); opacity: .8; }

.checklist ul { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.checklist li > div { flex: 1; }
.checklist li p { font-size: 14px; color: var(--ink-3); }
.checklist li.done b { color: var(--ink-3); text-decoration: line-through; }
.check-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; }
.checklist li.done .check-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-mark .ic { width: 15px; height: 15px; stroke-width: 2.6; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; }
.dash-grid .card + .card { margin-top: 0; }
.dash-grid + .card { margin-top: 20px; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 210px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.bar-n { font-size: 11.5px; font-weight: 600; color: var(--ink-2); height: 15px; }
.bar { width: 100%; max-width: 30px; height: max(3px, calc(var(--h) * .72)); background: var(--accent); border-radius: 6px 6px 3px 3px; }
.bar-col:last-child .bar { background: var(--marker); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--marker-ink) 25%, transparent); }
.bar-col:hover .bar { filter: brightness(1.12); }
.bar-day { font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1; margin-top: 4px; }
.bar-wd { font-size: 11px; color: var(--ink-3); line-height: 1; }

.mini-reports { list-style: none; margin: 0; padding: 0; }
.mini-reports li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.mini-reports li:first-child { border-top: 0; }
.mini-text { flex: 1; min-width: 200px; color: var(--ink-2); font-size: 14.5px; }

.table-card { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-3); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions-col { text-align: right; width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }

.filters { display: grid; grid-template-columns: 2fr 1.3fr 1.3fr auto; gap: 14px; align-items: end; margin-bottom: 18px; padding: 18px 20px; }
.filters .field { margin: 0; }
.filters label { font-size: 13.5px; }
.filters .btn { height: 46px; }

.report-list { display: grid; gap: 16px; }
.report-list .card + .card { margin-top: 0; }
.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.report-comment { font-style: italic; color: var(--ink-2); margin-bottom: 12px; }
.report .quote-preview { margin-bottom: 14px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.user-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.user-head > div { flex: 1; min-width: 220px; }
.user-head h2 { font-size: 24px; }
.user-head p { margin-top: 8px; }
.manage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; margin: 20px 0; align-items: start; }
.manage-grid .card + .card { margin-top: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.danger-zone h2 { color: var(--bad); }
.danger-zone h2 .ic { color: var(--bad); }

.cat-admin { padding: 0; overflow: hidden; }
.cat-admin-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.cat-admin-row:last-child { border-bottom: 0; }
.cat-admin-main { flex: 1; min-width: 0; }
.order-btns { display: flex; flex-direction: column; gap: 2px; }

.settings-form .card + .card { margin-top: 20px; }
.settings-form .form-card { max-width: 820px; }
.accent-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.accent-opt { display: inline-flex; align-items: center; gap: 9px; padding: 8px 14px 8px 9px; border: 1.5px solid var(--line-2); border-radius: 99px; cursor: pointer; font-weight: 500 !important; margin: 0 !important; }
.accent-opt input { position: absolute; opacity: 0; }
.accent-sw { width: 22px; height: 22px; border-radius: 50%; background: var(--sw); }
.accent-opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.accent-opt:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.sticky-save {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding: 12px 14px;
  max-width: 820px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
}
.steps-list { margin: 0; padding-left: 1.3em; display: grid; gap: 8px; color: var(--ink-2); }
.steps-list code { font: .9em var(--f-mono); background: var(--surface-2); padding: .1em .4em; border-radius: 6px; }

/* ==========================================================================
   Адаптивность: планшеты и телефоны
   ========================================================================== */

@media (max-width: 1080px) {
  .cat-row { grid-template-columns: 50px minmax(0, 1fr) 140px; }
  .cat-last { grid-column: 2 / -1; }
  .with-side { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .welcome { grid-template-columns: 1fr; gap: 20px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .head-row { flex-wrap: wrap; gap: 10px; min-height: 60px; padding-top: 10px; padding-bottom: 10px; }
  .brand { flex: 1 1 0; }
  .main-nav, .head-search { display: none; }
  .head-actions { margin-left: auto; }
  .nav-toggle { display: inline-grid; }
  .site-head.open .main-nav { display: flex; flex-direction: column; order: 5; flex: 0 0 100%; padding-top: 4px; }
  .site-head.open .head-search { display: block; order: 4; flex: 0 0 100%; max-width: none; margin: 4px 0 0; }
  .site-head.open .main-nav a { padding: 11px 12px; }
  .menu-name { display: none; }

  .admin { grid-template-columns: 1fr; background: none; }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease-out; }
  .admin.side-open .admin-side { transform: none; box-shadow: var(--shadow-pop); }
  .admin.side-open::after { content: ''; position: fixed; inset: 0; background: rgba(10, 12, 30, .45); z-index: 55; }
  .admin-menu { display: inline-grid; }
  .admin-top { padding: 16px 18px 4px; }
  .admin-me-name { display: none !important; }
  .admin-me { padding: 4px; }
  .admin-content { padding: 14px 18px 48px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .help { grid-template-columns: 1fr; }
  .help-toc { position: static; }
  .setup { grid-template-columns: 1fr; gap: 28px; padding: 32px 20px; }
  .settings-grid { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 14px; }
  .page { padding-top: 18px; }
  .hide-sm { display: none !important; }
  .brand { flex: 1 1 0; gap: 9px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-name { font-size: 15px; max-width: none; }
  .head-actions { gap: 2px; }
  .head-actions .btn { height: 38px; padding: 0 12px; }
  .crumbs > span:nth-last-child(2), .crumbs > span[aria-current] { display: none; }
  .welcome { padding: 22px 20px; border-radius: 18px; }
  .welcome h2 { font-size: 22px; padding-right: 30px; }
  .welcome-steps { grid-template-columns: 1fr; gap: 10px; }
  .cat-row { grid-template-columns: 44px minmax(0, 1fr); gap: 12px 14px; padding: 16px; }
  .cat-ic { width: 44px; height: 44px; border-radius: 13px; }
  .cat-stats { grid-column: 2; }
  .cat-stats div { flex-direction: row-reverse; gap: 5px; align-items: baseline; }
  .cat-stats dd { font-size: 15px; }
  .cat-last { display: none; }
  .t-head { display: none; }
  .t-row { grid-template-columns: 36px minmax(0, 1fr) 54px; gap: 12px; padding: 13px 14px; }
  .t-row .av-md { width: 36px; height: 36px; font-size: 13px; }
  .t-last { display: none; }
  .post { grid-template-columns: 1fr; }
  .post-author { flex-direction: row; text-align: left; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .post-author .av-lg { width: 40px; height: 40px; font-size: 14px; }
  .post-author-info { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .post-head { padding: 12px 16px 0; }
  .post-body { padding: 8px 16px 4px; }
  .post-actions { padding: 6px 8px 10px; }
  .act span { display: none; }
  .act.like span { display: inline; }
  .act.subtle { margin-left: auto; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .form-card, .card { padding: 20px 18px; }
  .auth-card { padding: 24px 20px; }
  .structure { grid-template-columns: 1fr; }
  .ft-row { grid-template-columns: 1fr; }
  .ft-row > span:first-child { border-right: 0; border-bottom: 1px dashed var(--line); }
  .ft-head { display: none; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px 16px; }
  .tile-value { font-size: 26px; }
  .bars { gap: 3px; height: 180px; }
  .bar-wd { display: none; }
  .bar-n { font-size: 10px; }
  .filters { grid-template-columns: 1fr; }
  .mini-search input { width: 100%; }
  .mini-search { flex: 1; }
  .big-search { flex-direction: column; }
  .big-search .btn { width: 100%; }
  .rules { padding: 22px 20px; }
  .pg-step span { display: none; }
  .ed-foot > span:first-child { display: none; }
  .ed-foot { justify-content: flex-end; }
  .sticky-save { bottom: 8px; }
  .sticky-save .muted { display: none; }
}

@media (max-width: 420px) {
  .hide-xs { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
