:root {
  --bg: #0d0e12;
  --bg-glow: rgba(254, 254, 254, 0.04);
  --surface: #15161c;
  --surface-2: #1c1d25;
  --surface-3: #24252f;
  --border: #2a2b36;
  --border-strong: #3a3b48;
  --text: #ececf1;
  --muted: #9b9daf;
  --faint: #6b6d80;
  --accent: #fefefe;
  --accent-text: #0d0e12;
  --success: #57f287;
  --danger: #ed4245;
  --warning: #fee75c;
  --orange: #f0883e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }
html { scrollbar-gutter: stable; } /* страница не «прыгает», когда появляется полоса прокрутки */

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(88, 101, 242, 0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Иконки Lucide: цвет берут от текста, не сжимаются в тесных строках */
.icon { display: inline-block; flex: none; vertical-align: -0.15em; }
.stat-label, .section-title, .with-icon, .note, .note-card, .toast, .bad-text, .gh-branch {
  display: flex; align-items: center; gap: 7px;
}
.stat-label .icon, .section-title .icon { color: var(--faint); }
.empty-icon { color: var(--faint); display: flex; justify-content: center; }
.nav-icon { display: inline-flex; justify-content: center; }
.nav-btn.active .nav-icon { color: var(--text); }
.rule-icon { color: var(--muted); }
.rule.on .rule-icon { color: var(--success); background: rgba(87, 242, 135, .1); }
.toast .icon { color: var(--success); }
.toast.error .icon { color: var(--danger); }
.note-card .icon { color: var(--warning); }
.gh-branch { display: inline-flex; gap: 4px; }
.brand-mark .icon { color: var(--accent-text); }
.login-moon .icon { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }

/* ---------- верхняя панель ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(13, 14, 18, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: 0.2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-size: 18px;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
/* с аватаркой белая подложка не нужна — иначе она просвечивает белыми уголками по скруглённым краям */
.brand-mark:has(img), .login-moon:has(img) { background: transparent; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0; }
.user { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; font-size: 14px; }

/* ---------- общие элементы ---------- */

.app { max-width: 1340px; margin: 0 auto; padding: 32px 28px 120px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-3);
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: #dedee3; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(237, 66, 69, .14); color: #ff8a8c; border-color: rgba(237, 66, 69, .3); }
.btn-danger:hover { background: rgba(237, 66, 69, .24); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; }

.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; }
.avatar-sm { width: 26px; height: 26px; }
.avatar-lg { width: 56px; height: 56px; border-radius: 16px; }
.avatar-fallback { display: grid; place-items: center; font-weight: 700; color: var(--muted); }

.card {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(21, 22, 28, .92) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
/* Без одиноких слов на последней строке: браузер сам переносит текст ровнее */
h1, h2, h3, h4 { text-wrap: balance; }
p, li, .hint, .muted, .faint, .setting-text, .pk-text, .empty { text-wrap: pretty; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.4px; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.2px; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.loader { display: grid; place-items: center; min-height: 50vh; }
.loader span {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { font-size: 34px; margin-bottom: 8px; }

/* ---------- вход ---------- */

.login {
  min-height: calc(100vh - 220px);
  display: grid; place-items: center;
}
.login-card { max-width: 440px; width: 100%; text-align: center; padding: 40px 34px; box-shadow: var(--shadow); }
.login-moon {
  width: 72px; height: 72px; margin: 0 auto 18px;
  border-radius: 22px; display: grid; place-items: center; font-size: 36px;
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 0 60px rgba(254, 254, 254, .18);
  overflow: hidden;
}
.login-moon img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.login-card p { color: var(--muted); margin: 10px 0 26px; }
.login-note { margin-top: 18px; font-size: 13px; color: var(--faint); }
.alert {
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 18px; font-size: 14px; text-align: left;
  background: rgba(237, 66, 69, .12); border: 1px solid rgba(237, 66, 69, .3); color: #ffb3b4;
}

/* ---------- список серверов ---------- */

.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.guild-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
  width: 100%;
}
.guild-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.guild-card .info { min-width: 0; flex: 1; }
.guild-card .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-card .sub { color: var(--muted); font-size: 13px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-card .sub-row { display: flex; align-items: center; gap: 8px; }
.guild-card .open-link { display: inline-flex; align-items: center; gap: 2px; }
.guild-card .open-link .icon { transform: rotate(180deg); transition: transform .15s; }
.guild-card:hover .open-link .icon { transform: rotate(180deg) translateX(-3px); }
.guild-card.no-bot { cursor: default; opacity: .78; }
.guild-card.no-bot:hover { transform: none; }
.section-label { margin: 30px 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }

/* ---------- страница сервера ---------- */

.guild-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar {
  position: sticky; top: 96px; display: flex; flex-direction: column; gap: 6px;
  /* меню не выше окна: если не помещается — прокручивается само, не дожидаясь конца страницы */
  max-height: calc(100vh - 112px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: transparent transparent; scrollbar-gutter: stable;
  padding-right: 4px;
}
.sidebar:hover { scrollbar-color: var(--border-strong) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: var(--border-strong); }
.sidebar-guild { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.sidebar-guild .name { font-weight: 700; line-height: 1.3; word-break: break-word; }
.sidebar-guild .sub { color: var(--muted); font-size: 13px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 0; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 14px;
  cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-btn.active { background: var(--surface-3); color: var(--text); }
.nav-icon { width: 20px; text-align: center; }
.nav-group {
  margin: 14px 12px 2px; color: var(--faint);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
}

.content { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* статистика */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 18px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -0.5px; }
.stat-value.ok { color: var(--success); }
.stat-value.off { color: var(--danger); }

/* строка настройки */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.setting + .setting { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.setting-text { min-width: 0; }
.setting-text p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }

/* переключатель */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background .2s, border-color .2s; cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--muted); transition: transform .2s, background .2s;
}
.switch input:checked + .track { background: rgba(87, 242, 135, .2); border-color: rgba(87, 242, 135, .55); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--success); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* правила автомодерации */
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.rule { display: flex; flex-direction: column; gap: 16px; transition: border-color .2s; }
.rule.on { border-color: rgba(87, 242, 135, .28); }
.rule-head { display: flex; gap: 14px; align-items: flex-start; }
.rule-icon {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; font-size: 20px;
  background: var(--surface-3);
}
.rule-title { flex: 1; min-width: 0; }
.rule-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.rule-body { display: flex; flex-direction: column; gap: 14px; }
.rule:not(.on) .rule-body { opacity: .5; }
.rule.wide { grid-column: 1 / -1; }

.field-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 7px; }
.fields { display: flex; gap: 12px; flex-wrap: wrap; }
.field { flex: 1; min-width: 120px; }

.segmented { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 7px 8px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset; }
.segmented button.active[data-value="warn"] { color: var(--warning); }
.segmented button.active[data-value="mute"] { color: var(--orange); }

.input, .select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.input:focus, .select:focus { border-color: var(--border-strong); background: var(--surface-3); }
.select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.select option { background: var(--surface-2); }
.input-row { display: flex; gap: 8px; }

/* чипы */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 11px;
  border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
  max-width: 100%;
}
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.spoiler .chip-text { filter: blur(5px); transition: filter .15s; }
.chip.spoiler:hover .chip-text { filter: none; }
.chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.chip button {
  width: 20px; height: 20px; border-radius: 50%; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.chip button:hover { background: var(--border-strong); color: var(--text); }
.chips-empty { color: var(--faint); font-size: 13px; }

/* кейсы */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters .input { max-width: 260px; }
.filters .select { max-width: 220px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; letter-spacing: .2px; }
.case-id {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 6px; padding: 2px 7px;
  justify-self: start;
}
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { min-width: 0; }
.person-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; line-height: 1.35; }
.person-sub { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.avatar-xs { width: 20px; height: 20px; }

/* --- список кейсов: каждая строка — ссылка на страницу кейса --- */
.case-list { display: flex; flex-direction: column; gap: 6px; container-type: inline-size; }
.case-card {
  display: grid;
  grid-template-columns: 40px 150px minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1fr) 92px 96px;
  gap: 16px; align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: inherit; text-decoration: none;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
a.case-card:hover { background: var(--surface-3); border-color: var(--border-strong); }
a.case-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.case-card.is-ended .c-reason, .case-card.is-ended .c-dur { opacity: .7; }
.case-head {
  background: transparent; padding-top: 0; padding-bottom: 4px;
  color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
}
.c-id, .c-date { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.c-id .mono { font-weight: 600; font-size: 14px; }
.c-sub { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-reason { color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-word; line-height: 1.4; }
.c-dur { color: var(--muted); font-size: 13px; }
.c-date { font-size: 13px; }

/* значок типа + точка статуса */
.case-icon {
  position: relative; width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: var(--surface-3);
}
.case-icon.type-warn { color: var(--warning); background: rgba(254, 231, 92, .1); }
.case-icon.type-mute, .case-icon.type-kick { color: var(--orange); background: rgba(240, 136, 62, .12); }
.case-icon.type-ban { color: #ff7b7d; background: rgba(237, 66, 69, .13); }
.case-icon.type-ok { color: var(--success); background: rgba(87, 242, 135, .1); }
.state-dot {
  position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--surface-2); background: var(--faint);
}
a.case-card:hover .state-dot { border-color: var(--surface-3); }
.state-dot.state-open { background: var(--success); }
.state-dot.state-done { display: none; }

/* компактный вид, когда список узкий (главная страница, телефон) */
@container (max-width: 820px) {
  .case-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas:
      "icon id     date"
      "icon user   user"
      "icon reason reason";
    row-gap: 8px; column-gap: 12px; align-items: start;
  }
  .case-head { display: none; }
  .c-icon { grid-area: icon; }
  .c-id { grid-area: id; }
  .c-date { grid-area: date; text-align: right; }
  .c-user { grid-area: user; min-width: 0; }
  .c-reason { grid-area: reason; }
  .c-mod, .c-dur { display: none; }
}

/* --- страница кейса --- */
.back-link {
  display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 4px 0;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; margin-bottom: 4px;
}
.back-link:hover { color: var(--text); }
.case-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.case-header-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.case-header-main .case-icon { width: 52px; height: 52px; border-radius: 14px; }
.case-header-main .state-dot { width: 14px; height: 14px; border-color: var(--bg); }
.case-header h1 { display: flex; align-items: center; gap: 8px; }
.case-header-sub { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; font-size: 14px; }
.case-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.state-pill { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; color: var(--muted); }
.state-dot-inline { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.state-pill.state-open { color: var(--success); }
.state-pill.state-open .state-dot-inline { background: var(--success); box-shadow: 0 0 0 4px rgba(87, 242, 135, .15); }
.state-pill.state-done .state-dot-inline { background: var(--muted); }

.card-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-title-row .card-title { margin-bottom: 0; }
.card-title-row .faint { font-size: 12px; }

.info-list { margin: 0; }
.info-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.info-row:first-child { border-top: 0; }
.info-row dt { color: var(--muted); font-size: 13px; font-weight: 500; align-self: start; padding-top: 2px; }
.info-row dd { margin: 0; min-width: 0; font-size: 14px; }
.reason-full { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.person-lg { flex-wrap: wrap; row-gap: 8px; }
.person-lg .avatar { width: 34px; height: 34px; }
.mono-id { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; display: flex; align-items: center; gap: 4px; }

.copy-btn, .icon-btn {
  display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--faint);
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; vertical-align: middle; flex: none;
}
.copy-btn { width: 22px; height: 22px; }
.copy-btn:hover, .icon-btn:hover { background: var(--surface-3); color: var(--text); }
.chip-link {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: 6px;
}
.chip-link:hover { color: var(--text); border-color: var(--border-strong); }
.chip-link.static { cursor: default; }
.chip-link.static:hover { color: var(--muted); border-color: var(--border); }
.text-link { color: var(--text); font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.ok-text { color: var(--success); display: inline-flex; align-items: center; gap: 6px; }
.bad-text { display: inline-flex; align-items: center; gap: 6px; }

.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.form-actions { display: flex; gap: 8px; margin-top: 10px; }
.form-card { border-color: rgba(87, 242, 135, .3); }
.form-card h3 { margin-bottom: 4px; }
.form-card p { margin: 0 0 12px; font-size: 14px; }

.notes { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.note { display: flex; gap: 10px; align-items: flex-start; }
.note-body { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.note-head { font-size: 13px; margin-bottom: 3px; }
.note-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.5; }

.edits { display: flex; flex-direction: column; gap: 14px; }
.edit-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.edit-head strong { color: var(--text); }
.edit-diff { margin: 8px 0 0 28px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.diff-old, .diff-new { border-radius: 8px; padding: 6px 10px; white-space: pre-wrap; word-break: break-word; }
.diff-old { background: rgba(237, 66, 69, .08); color: #ffb3b4; text-decoration: line-through; text-decoration-color: rgba(255, 179, 180, .5); }
.diff-new { background: rgba(87, 242, 135, .07); color: #b9f6cf; }

@media (max-width: 760px) {
  .info-row { grid-template-columns: 1fr; gap: 6px; }
  .case-actions { width: 100%; }
  .case-actions .btn { flex: 1; }
  .chip-link { margin-left: 0; }
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  justify-self: start; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-warn { color: var(--warning); background: rgba(254, 231, 92, .1); }
.badge-mute, .badge-kick { color: var(--orange); background: rgba(240, 136, 62, .12); }
.badge-ban { color: #ff7b7d; background: rgba(237, 66, 69, .13); }
.badge-ok { color: var(--success); background: rgba(87, 242, 135, .1); }
.badge-muted { color: var(--muted); background: var(--surface-3); }

.more { display: flex; justify-content: center; padding-top: 16px; }

/* статистика */
.segmented.period { flex: none; }
.segmented.period button { padding: 7px 14px; white-space: nowrap; }
.stat-sub { margin-top: 6px; font-size: 13px; }
.stat-text { font-size: 20px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 8px; }
.delta { font-weight: 600; margin-right: 4px; }
.delta.up { color: var(--success); }
.delta.down { color: #ff7b7d; }
.note-card { padding: 14px 18px; color: #ffe9a8; background: rgba(254, 231, 92, .07); border-color: rgba(254, 231, 92, .25); font-size: 14px; }

.chart { position: relative; margin-top: 14px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.grid-line { stroke: var(--border); stroke-width: 1; }
.axis-label { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.bar { fill: #b9bccc; transition: fill .12s; }
.bar.hl { fill: var(--accent); }
.hit { fill: transparent; cursor: default; }
.chart-tip {
  position: absolute; top: -6px; transform: translate(-50%, -100%);
  background: #0a0b0e; border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 7px 11px; font-size: 13px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow);
}
.table-view { margin-top: 12px; font-size: 13px; color: var(--muted); }
.table-view summary { cursor: pointer; width: max-content; }
.table-view table { margin-top: 10px; border-collapse: collapse; width: 100%; max-width: 420px; }
.table-view td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.table-view td:last-child { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.two-col > * { min-width: 0; }
.top-list { display: flex; flex-direction: column; gap: 4px; }
.top-row { display: flex; align-items: center; gap: 11px; padding: 7px 4px; }
.top-rank { width: 20px; text-align: center; color: var(--faint); font-weight: 700; font-size: 13px; flex: none; }
.top-rank.top-1 { color: #f5c542; }
.top-rank.top-2 { color: #c9ced8; }
.top-rank.top-3 { color: #d39a6a; }
.top-hash { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); font-weight: 700; flex: none; }
.top-main { flex: 1; min-width: 0; }
.top-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bar { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.top-bar span { display: block; height: 100%; border-radius: 4px; background: #b9bccc; }
.top-count {
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px;
  min-width: 64px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25;
}
.top-share { color: var(--faint); font-size: 12px; font-weight: 500; }

.progress { height: 8px; border-radius: 8px; background: var(--surface-3); margin-top: 16px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); border-radius: 8px; transition: width .4s; }
.note { margin: 14px 0 0; font-size: 14px; }
.note.ok { color: var(--success); }
.note.bad { color: #ff8a8c; }

.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 8px 0 -6px; }
.section-title .faint { text-transform: none; letter-spacing: 0; font-weight: 500; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 6px; vertical-align: 1px; }

.activity { display: flex; flex-direction: column; gap: 6px; }
.activity-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.activity .chart { margin-top: 10px; }

.ev-list { display: flex; flex-direction: column; }
.ev-row { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ev-row:last-child { border-bottom: 0; }
.ev-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; }
.ev-add { color: var(--success); background: rgba(87, 242, 135, .12); }
.ev-del { color: #ff7b7d; background: rgba(237, 66, 69, .13); }
.ev-text { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-text strong { color: var(--text); font-weight: 600; }
.ev-time { color: var(--faint); font-size: 12px; white-space: nowrap; }

/* GitHub */
.gh-list { display: flex; flex-direction: column; }
.gh-row { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--border); }
.gh-row:last-child { border-bottom: 0; }
.gh-icon { width: 40px; height: 40px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; flex: none; }
.gh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gh-repo { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gh-repo a { text-decoration: none; }
.gh-repo a:hover { text-decoration: underline; }
.gh-branch { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); color: var(--muted); }
.gh-sub { color: var(--muted); font-size: 13px; }
.gh-sub .case-id { text-decoration: none; font-size: 12px; }
.gh-status { font-size: 12px; color: var(--faint); }
.bad-text { color: #ff8a8c; }
@media (max-width: 760px) {
  .gh-row { flex-wrap: wrap; }
  .gh-form .field { flex: 1 1 100% !important; }
}

@media (max-width: 960px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .activity-nums { grid-template-columns: 1fr 1fr; }
}

/* панель сохранения */
.savebar {
  position: fixed; left: 50%; bottom: 24px; z-index: 30;
  transform: translate(-50%, 140%);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  width: min(720px, calc(100% - 32px));
  padding: 12px 12px 12px 22px;
  background: #0a0b0e; border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.2);
}
.savebar.show { transform: translate(-50%, 0); }
.savebar-text { font-weight: 600; }
.savebar-actions { display: flex; gap: 8px; }

/* уведомления */
.toasts { position: fixed; top: 80px; right: 24px; z-index: 40; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 380px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 4px solid var(--success);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 500;
  animation: toast-in .25s ease-out;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- мобильные ---------- */

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rules { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app { padding: 20px 16px 120px; }
  .topbar { padding: 12px 16px; }
  .user-name { display: none; }
  .guild-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  /* на телефоне вместо ленты вкладок — кнопка с текущим разделом и раскрывающееся меню */
  .guild-layout { position: relative; }
  .sidebar {
    display: none; position: absolute; top: 62px; left: 0; right: 0; z-index: 40;
    max-height: min(70vh, 560px); overflow-y: auto; padding: 10px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  }
  .nav-open .sidebar { display: flex; }
  .nav-open .mnav-chevron .icon { transform: rotate(90deg); }
  .sidebar-guild { display: none; }
  .nav-group { margin: 12px 12px 2px; }
  .setting { flex-direction: column; align-items: flex-start; }
  .savebar { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .savebar-actions .btn { flex: 1; }
  .toasts { left: 16px; right: 16px; }
  .toast { max-width: none; }
  h1 { font-size: 24px; }
}

/* --- участники --- */
.member-list { display: flex; flex-direction: column; gap: 6px; container-type: inline-size; }
.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 110px 130px 130px 130px;
  gap: 16px; align-items: center;
  padding: 11px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid transparent;
  color: inherit; text-decoration: none; font-size: 14px;
  transition: background .15s, border-color .15s;
}
a.member-row:hover { background: var(--surface-3); border-color: var(--border-strong); }
a.member-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.member-head {
  background: transparent; padding-top: 0; padding-bottom: 4px;
  color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px;
}
.mr-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mr-user .person-text { display: flex; flex-direction: column; }
.mr-joined, .mr-msgs { display: flex; flex-direction: column; line-height: 1.35; }
.mr-msgs strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.mr-last { color: var(--muted); font-size: 13px; }
.mr-role { min-width: 0; }

@container (max-width: 760px) {
  .member-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "user msgs" "role level";
    row-gap: 8px;
  }
  .member-head, .mr-last, .mr-joined { display: none; }
  .mr-level { grid-area: level; justify-self: end; }
  .mr-user { grid-area: user; }
  .mr-msgs { grid-area: msgs; text-align: right; }
  .mr-role { grid-area: role; }
  .mr-joined { grid-area: joined; text-align: right; font-size: 13px; }
}

.role-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 3px 10px 3px 9px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600;
}
.role-chip .chip-dot { width: 9px; height: 9px; }
.role-chip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roles-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-list { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 4px; }
.bot-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px; vertical-align: 2px;
  background: #5865f2; color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
}
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { flex: none; }

.member-header { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-xl { width: 76px; height: 76px; border-radius: 50%; font-size: 28px; }
.member-header-text { min-width: 0; }
.member-header h1 { word-break: break-word; }
.member-header-sub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 14px; }
.stat-unit { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* --- значки команды --- */
.team-badge {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: -0.2em;
  margin-left: 6px; color: var(--team);
}
/* Участники команды в списках: рамка в цвет роли и лёгкий оттенок слева — заметно, но не кричит */
.member-row.is-team, .lb-row.is-team {
  border-color: color-mix(in srgb, var(--team) 38%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--team) 9%, transparent), transparent 45%),
    var(--surface-2);
}
a.member-row.is-team:hover, a.lb-row.is-team:hover {
  border-color: color-mix(in srgb, var(--team) 65%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--team) 13%, transparent), transparent 50%),
    var(--surface-3);
}
.team-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--team);
  background: color-mix(in srgb, var(--team) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--team) 35%, transparent);
}
.team-summary { display: flex; align-items: center; gap: 10px; flex: none; }
.team-summary .team-badge { margin-left: 0; }
.team-rows { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 12px; }
.team-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 210px 30px; gap: 12px; align-items: center;
  padding: 8px 10px; background: var(--surface-2); border-radius: 10px;
}
.team-preview .team-badge { margin-left: 0; }
.team-role { min-width: 0; }
@media (max-width: 760px) {
  .team-row { grid-template-columns: 26px minmax(0, 1fr) 30px; }
  .team-row .team-icon { grid-column: 2 / 4; }
  .team-summary { width: 100%; justify-content: space-between; }
}

/* --- рейтинг --- */
.page-head .subnav { flex: none; }
/* Переключатель «Список / Рейтинг» всегда в одном месте: справа сверху, длинное описание переносится */
.page-head:has(.subnav) { align-items: flex-start; flex-wrap: nowrap; }
.page-head:has(.subnav) > div:first-child { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
  .page-head:has(.subnav) { flex-wrap: wrap; }
}
.subnav button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; white-space: nowrap; }

.xp-bar { position: relative; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.xp-bar span {
  position: absolute; inset: 0 auto 0 0; border-radius: inherit;
  background: linear-gradient(90deg, #b9bac6, var(--accent));
  box-shadow: 0 0 10px rgba(254, 254, 254, .25);
}
.xp-bar-sm { height: 4px; width: 70px; }
.xp-bar-lg { height: 10px; }

.lvl-cell { display: flex; flex-direction: column; gap: 5px; }
.lvl-num { font-weight: 600; font-variant-numeric: tabular-nums; }

.level-card { display: flex; align-items: center; gap: 28px; }
.lvl-ring { position: relative; flex: none; }
.lvl-ring svg { display: block; }
.ring-track { stroke: var(--surface-3); }
.ring-fill { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(254, 254, 254, .35)); transition: stroke-dasharray .6s ease; }
.lvl-ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lvl-ring-num { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.lvl-ring-label { color: var(--muted); font-size: 12px; margin-top: 4px; text-transform: uppercase; letter-spacing: .8px; }
.level-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.level-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.level-title { font-size: 24px; font-weight: 700; margin-top: 2px; }
.level-progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.level-progress-head strong { color: var(--text); }
.level-progress-foot { font-size: 12px; margin-top: 6px; }
.level-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.level-facts > div { display: flex; flex-direction: column; gap: 4px; font-size: 13px; align-items: flex-start; min-width: 0; }
/* подписи в одну строку — чтобы все числа стояли ровно на одной линии */
.level-facts > div > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.level-facts strong { font-size: 15px; font-weight: 600; color: var(--text); }
.pill-muted { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  .level-card { flex-direction: column; align-items: stretch; }
  .level-card .lvl-ring { align-self: center; }
}

.lb-list { display: flex; flex-direction: column; gap: 6px; container-type: inline-size; }
.lb-row {
  display: grid; grid-template-columns: 52px minmax(0, 1.6fr) 72px 100px minmax(110px, 1fr) 100px 110px;
  gap: 16px; align-items: center; padding: 10px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid transparent; color: inherit; text-decoration: none; font-size: 14px;
  transition: background .15s, border-color .15s;
}
a.lb-row:hover { background: var(--surface-3); border-color: var(--border-strong); }
a.lb-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lb-head { background: transparent; padding-top: 0; padding-bottom: 4px; color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.lb-top { border-color: var(--border); }
.lb-place { display: inline-block; min-width: 28px; text-align: center; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-medal { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
.lb-medal.m1 { color: #f5c542; }
.lb-medal.m2 { color: #c9ced8; }
.lb-medal.m3 { color: #d9895b; }
.lvl-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 26px; padding: 0 8px;
  border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border-strong);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.lb-xp, .lb-msgs, .lb-voice { display: flex; flex-direction: column; line-height: 1.35; }
.lb-xp strong, .lb-msgs strong, .lb-voice strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-progress { display: flex; flex-direction: column; gap: 5px; }
@container (max-width: 760px) {
  .lb-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "rank user level" "rank progress xp"; row-gap: 8px; }
  .lb-head, .lb-msgs, .lb-voice { display: none; }
  .lb-rank { grid-area: rank; }
  .lb-row .mr-user { grid-area: user; }
  .lb-level { grid-area: level; justify-self: end; }
  .lb-progress { grid-area: progress; }
  .lb-xp { grid-area: xp; text-align: right; }
}

.level-settings { display: flex; flex-direction: column; gap: 24px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.hint { color: var(--faint); font-size: 13px; margin: 8px 0 0; }
.curve { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.curve-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.curve-lvl { font-weight: 700; }
.reward-row {
  display: grid; grid-template-columns: 22px 90px auto minmax(0, 1fr) 30px; gap: 10px; align-items: center;
  padding: 8px 10px; background: var(--surface-2); border-radius: 10px;
}
.reward-icon { color: var(--muted); display: inline-flex; }
.reward-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 640px) {
  .reward-row { grid-template-columns: 22px 80px auto 30px; }
  .reward-row .select { grid-column: 1 / -1; grid-row: 2; }
}

/* --- голос в рейтинге --- */
.voice-time { display: inline-flex; align-items: center; gap: 4px; }
.voice-setting { gap: 16px; }
.voice-limit { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 12px; }
.voice-limit > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.voice-limit strong { font-size: 15px; }
.level-facts .icon, .stat-sub .icon { vertical-align: -2px; }

/* --- статус бота --- */
.pr-preview { display: flex; align-items: center; gap: 18px; }
.pr-avatar { position: relative; flex: none; }
.pr-dot, .pr-dot-sm { display: inline-block; border-radius: 50%; background: var(--dot); }
.pr-dot { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border: 4px solid var(--surface); }
.pr-dot-sm { width: 11px; height: 11px; flex: none; }
.pr-main { min-width: 0; }
.pr-name { font-size: 18px; font-weight: 700; }
.pr-activity { margin-top: 4px; font-size: 14px; color: var(--muted); word-break: break-word; }
.pr-activity strong, .pr-item-preview strong { color: var(--text); font-weight: 600; }
.pr-sub { font-size: 13px; margin-top: 4px; }
.pr-statuses { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.pr-status {
  display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font: inherit; font-weight: 600; font-size: 14px;
}
.pr-status:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.pr-status.active { color: var(--text); border-color: var(--accent); background: var(--surface-3); }
.pr-status:disabled { cursor: default; }
.pr-rotate { width: 120px; flex: none; }
.pr-items { display: flex; flex-direction: column; gap: 10px; }
.pr-item { padding: 12px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.pr-item-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pr-item-btns { display: flex; gap: 4px; }
.pr-item-btns [data-dir="-1"] .icon { transform: rotate(90deg); }
.pr-item-preview { font-size: 13px; color: var(--muted); padding-left: 2px; word-break: break-word; }
.pr-vars { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.pr-var {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 2px; text-align: left;
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; color: inherit; font: inherit; cursor: pointer;
}
.pr-var:hover:not(:disabled) { border-color: var(--border-strong); }
.pr-var code { grid-row: 1 / 3; align-self: center; font-size: 13px; padding: 3px 7px; border-radius: 6px; background: var(--surface-3); }
.pr-var span { font-size: 12px; }
.pr-var strong { font-size: 14px; }
.pr-actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 760px) {
  .pr-statuses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pr-item-row { grid-template-columns: minmax(0, 1fr) auto; }
  .pr-item-row .input { grid-column: 1 / -1; grid-row: 2; }
}
.pr-group { margin: 16px 0 8px; }
.pr-group:first-of-type { margin-top: 0; }
.pr-var strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- фильтр ников --- */
.nf-samples { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.nf-samples .icon { transform: rotate(180deg); vertical-align: -2px; color: var(--faint); }

/* --- подстановки: вкладки по группам и компактные строки --- */
.pr-vars-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pr-vars-head p { margin: 4px 0 0; font-size: 14px; }
.pr-var-tabs button { padding: 7px 14px; white-space: nowrap; }
.pr-var-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; container-type: inline-size; }
.pr-var-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 9px 10px; margin: 0 -10px; border: 0; border-radius: 8px; background: transparent;
  color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--border); border-radius: 0;
}
.pr-var-row:hover:not(:disabled) { background: var(--surface-2); border-radius: 8px; }
.pr-var-row:disabled { cursor: default; }
.pr-key { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; color: var(--text); }
.pr-desc { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-val { color: var(--faint); font-variant-numeric: tabular-nums; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .pr-var-list { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .pr-var-row { grid-template-columns: auto minmax(0, 1fr); }
  .pr-val { grid-column: 2; justify-self: start; max-width: none; }
  .pr-var-tabs { width: 100%; overflow-x: auto; }
}

.version-tag {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 1px 6px; margin-left: 4px; border-radius: 6px; background: var(--surface-3); vertical-align: 2px;
}

/* --- страница участника в цвете его роли (--mc): ровная заливка и рамки, без градиентов и свечения --- */
.member-page { display: flex; flex-direction: column; gap: 18px; }
.member-hero {
  padding: 22px 24px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--mc) 32%, var(--border));
  background: color-mix(in srgb, var(--mc) 7%, var(--surface));
}
.member-page .avatar-xl { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px color-mix(in srgb, var(--mc) 85%, transparent); }
.member-page .stat-label .icon { color: var(--mc); }
.member-page .level-card { border-color: color-mix(in srgb, var(--mc) 22%, var(--border)); }
.member-page .ring-fill { stroke: var(--mc); filter: none; }
.member-page .ring-track { stroke: color-mix(in srgb, var(--mc) 16%, var(--surface-3)); }
.member-page .xp-bar span { background: var(--mc); box-shadow: none; }
.member-page .bar { fill: color-mix(in srgb, var(--mc) 70%, var(--surface-3)); }
.member-page .bar.hl { fill: var(--mc); }
.member-page .top-bar span { background: color-mix(in srgb, var(--mc) 80%, var(--surface-3)); }
.member-page .chip-link { border-color: color-mix(in srgb, var(--mc) 30%, var(--border)); }

/* --- обновления (история версий) --- */
.cl-hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cl-hero-version { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 40px; font-weight: 700; letter-spacing: -1px; margin: 4px 0 2px; }
.cl-hero-stats { display: grid; grid-template-columns: repeat(4, auto); gap: 8px 28px; }
.cl-hero-stats > div { display: flex; flex-direction: column; }
.cl-hero-stats strong { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cl-hero-stats span { color: var(--muted); font-size: 13px; }
.cl-c-added { color: var(--success); }
.cl-c-fixed { color: var(--orange); }
.cl-toolbar { display: flex; justify-content: flex-start; }
.cl-toolbar .segmented button { padding: 7px 14px; white-space: nowrap; }

.cl-timeline { position: relative; display: flex; flex-direction: column; gap: 14px; padding-left: 34px; }
.cl-timeline::before { content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px; width: 2px; background: var(--border); border-radius: 2px; }
.cl-item { position: relative; }
.cl-dot {
  position: absolute; left: -34px; top: 18px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--muted);
}
.cl-kind-minor .cl-dot, .cl-kind-first .cl-dot, .cl-kind-major .cl-dot { border-color: color-mix(in srgb, var(--success) 60%, transparent); color: var(--success); }
.cl-kind-patch .cl-dot { border-color: color-mix(in srgb, var(--orange) 55%, transparent); color: var(--orange); }
.cl-unreleased .cl-card { border-style: dashed; }
.cl-card { display: flex; flex-direction: column; gap: 14px; }
.cl-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cl-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cl-version { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 20px; font-weight: 700; }
.cl-badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.cl-kind-minor .cl-badge:not(.cl-current), .cl-kind-first .cl-badge:not(.cl-current), .cl-kind-major .cl-badge:not(.cl-current) {
  color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.cl-kind-patch .cl-badge:not(.cl-current) { color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); }
.cl-badge.cl-current { background: var(--accent); color: var(--accent-text); }
.cl-date { font-size: 13px; }
.cl-section-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.cl-added .cl-section-title { color: var(--success); }
.cl-changed .cl-section-title { color: #6cb6ff; }
.cl-fixed .cl-section-title { color: var(--orange); }
.cl-removed .cl-section-title { color: var(--danger); }
.cl-section ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; line-height: 1.5; font-size: 14px; }
.cl-section li::marker { color: var(--faint); }
.cl-section code, .cl-card code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); }
.cl-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.cl-meta .icon { vertical-align: -2px; }
.cl-sha { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--muted); text-decoration: none; }
.cl-sha:hover, .cl-link:hover { color: var(--text); }
.cl-plus { color: var(--success); font-weight: 600; }
.cl-minus { color: var(--danger); font-weight: 600; }
.cl-link { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.cl-meta .cl-link { margin-left: auto; }
@media (max-width: 760px) {
  .cl-hero-stats { grid-template-columns: repeat(2, auto); }
  .cl-hero-version { font-size: 32px; }
  .cl-meta .cl-link { margin-left: 0; }
}

/* --- GitHub: редактирование подключения --- */
.gh-actions { display: flex; gap: 8px; flex: none; }
.gh-editing { align-items: flex-start; }
.gh-edit-fields { margin: 8px 0 4px; }
@media (max-width: 760px) {
  .gh-actions { width: 100%; justify-content: flex-end; }
}

/* --- кнопка «Обновить» в верхней панели --- */
.refresh-btn[hidden] { display: none; }
.refresh-btn.spinning .icon { animation: spin .8s linear infinite; }
@media (max-width: 640px) {
  .refresh-label { display: none; }
}

/* --- дорожная карта --- */
.rm-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px;
  overflow-x: auto; padding-bottom: 8px; align-items: start;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.rm-col {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--c);
  border-radius: var(--radius); padding: 12px;
}
.rm-col-head { display: flex; align-items: flex-start; gap: 10px; }
.rm-col-head .rm-count, .rm-col-head .rm-add { margin-top: 3px; }
.rm-col-icon {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.rm-col-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.rm-col-title b { font-size: 14px; }
.rm-col-title small { color: var(--faint); font-size: 12px; line-height: 1.3; margin-top: 1px; }
.rm-count { font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 1px 8px; border-radius: 999px; }
.rm-add { flex: none; }
.rm-list { display: flex; flex-direction: column; gap: 8px; min-height: 64px; border-radius: 10px; transition: background .12s; }
.rm-list.drop-target { background: color-mix(in srgb, var(--c) 7%, transparent); }
.rm-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 20px 8px; border: 1px dashed var(--border); border-radius: 10px; }
.rm-drop-line { height: 3px; border-radius: 3px; background: var(--c); margin: -2px 0; }
.rm-card {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid color-mix(in srgb, var(--c) 70%, transparent);
  border-radius: 10px; padding: 10px 12px; cursor: grab; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .12s, background .12s, transform .12s;
}
.rm-card:hover { background: var(--surface-3); border-color: var(--border-strong); border-left-color: var(--c); }
.rm-card.dragging { opacity: .45; transform: scale(.98); }
.rm-card-title { font-weight: 600; font-size: 14px; line-height: 1.35; word-break: break-word; }
.rm-card-desc {
  color: var(--muted); font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.rm-card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rm-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface-3); text-decoration: none;
}
.rm-chip .icon { vertical-align: 0; }
.rm-pr-high { color: #ff8a65; background: color-mix(in srgb, #ff8a65 14%, transparent); }
.rm-pr-low { color: var(--faint); }
.rm-version { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.rm-version:hover { background: color-mix(in srgb, var(--success) 20%, transparent); }
.rm-age { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.rm-card.is-high .rm-card-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ff8a65; margin-right: 7px; vertical-align: 2px; }

.rm-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 9, .62); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 16px;
}
.rm-modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.rm-modal-head { display: flex; justify-content: space-between; align-items: center; }
.rm-textarea { min-height: 110px; resize: vertical; font: inherit; line-height: 1.5; }
.rm-status-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-status-opt {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
}
.rm-status-opt .icon { color: var(--c); }
.rm-status-opt:hover { color: var(--text); border-color: var(--border-strong); }
.rm-status-opt.active { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface-2)); }
.rm-modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.rm-modal-actions { display: flex; gap: 8px; margin-left: auto; }
.rm-dates { font-size: 12px; }
.page-head code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); }
@media (max-width: 760px) {
  .rm-board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .rm-col { scroll-snap-align: start; }
}

/* --- предложения участников --- */
.rm-toolbar { display: flex; justify-content: flex-start; }
.rm-from { color: #c4b5fd; background: color-mix(in srgb, #a78bfa 14%, transparent); }
.rm-from-note { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  color: var(--muted); background: color-mix(in srgb, #a78bfa 10%, var(--surface-2)); border: 1px solid color-mix(in srgb, #a78bfa 30%, transparent); }
.rm-from-note .icon { color: #a78bfa; flex: none; }
.rm-from-note b { color: var(--text); }
.rm-from-note code, .sg-code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.rm-notify { margin-top: -4px; }
.sg-badge { min-width: 18px; padding: 0 6px; border-radius: 999px; background: #a78bfa; color: #14101f; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }

.sg-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sg-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.sg-filter {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
}
.sg-filter span { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; color: var(--faint); }
.sg-filter:hover { color: var(--text); border-color: var(--border-strong); }
.sg-filter.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.sg-filter.active span { color: var(--accent-text); opacity: .7; }
.sg-search { flex: 1; min-width: 220px; }

.sg-list { display: flex; flex-direction: column; gap: 10px; }
.sg-row {
  display: flex; gap: 18px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.sg-row.is-new { border-left: 3px solid #a78bfa; }
.sg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.sg-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sg-status { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.sg-new { color: #c4b5fd; background: color-mix(in srgb, #a78bfa 16%, transparent); }
.sg-accepted { color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); }
.sg-rejected { color: var(--faint); background: var(--surface-3); }
.sg-code { color: var(--muted); }
.sg-when { font-size: 12px; margin-left: auto; }
.sg-title { margin: 0; font-size: 17px; line-height: 1.35; word-break: break-word; }
.sg-desc {
  color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sg-desc.open { display: block; }
.sg-more { align-self: flex-start; margin-left: 0; }
.sg-author { display: flex; align-items: center; gap: 9px; font-size: 13px; margin-top: 2px; }
.sg-author .team-badge { margin-left: 4px; }
.sg-reason { font-size: 13px; color: var(--muted); padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
.sg-reason .icon { vertical-align: -2px; }
.sg-reject-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.sg-reject-form textarea { min-height: 70px; resize: vertical; font: inherit; }
.sg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sg-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.sg-delete { margin-top: auto; }
.sg-card-link { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
@media (max-width: 700px) {
  .sg-row { flex-direction: column; gap: 12px; }
  .sg-side { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sg-delete { margin: 0 0 0 auto; }
}

/* --- репорты ошибок --- */
.rp-row {
  display: flex; gap: 18px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--st);
}
.rp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.rp-status {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--st); background: color-mix(in srgb, var(--st) 14%, transparent);
}
.rp-steps { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; color: var(--muted); }
.rp-steps b { color: var(--text); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.rp-reply { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.45;
  color: var(--muted); background: color-mix(in srgb, var(--st) 8%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--st) 22%, transparent); }
.rp-reply .icon { color: var(--st); flex: none; margin-top: 2px; }
.rp-reply b { color: var(--text); }
.rp-change-title { font-size: 13px; color: var(--muted); }
.rp-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.rp-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rp-pick {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600;
}
.rp-pick .icon { color: var(--c); }
.rp-pick:hover { color: var(--text); border-color: var(--border-strong); }
.rp-pick.active { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 15%, var(--surface-2)); }
.rp-badge { background: #6cb6ff; color: #0b1422; }
@media (max-width: 700px) {
  .rp-row { flex-direction: column; gap: 12px; }
  .rp-side { flex-direction: row; align-items: center; width: 100%; }
  .rp-picker { flex: 1; }
}

/* значки команды: пустой сервер и подсказка */
.team-empty { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-size: 14px; line-height: 1.5; }
.team-empty .icon { color: var(--warning); flex: none; margin-top: 3px; }
.team-empty b { color: var(--text); }
.team-hint { margin: 14px 0 10px; }
.setting-text code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--surface-3); }

/* «Скоро»: намёки вместо точного списка */
.cl-soon { background: linear-gradient(135deg, color-mix(in srgb, #a78bfa 8%, var(--surface)), var(--surface) 55%); }
.cl-soon-count { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; padding: 5px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #c4b5fd; background: color-mix(in srgb, #a78bfa 14%, transparent); }
.cl-teasers { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.cl-teasers li { position: relative; padding-left: 26px; font-size: 15px; line-height: 1.5; color: var(--text); font-style: italic; }
.cl-teasers li::before { content: "✦"; position: absolute; left: 4px; top: 0; color: #a78bfa; font-style: normal; }

/* --- пересчёт рейтинга --- */
.rc-card { display: flex; flex-direction: column; gap: 14px; }
.rc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rc-stats > div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.rc-stats strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.rc-stats span { color: var(--muted); font-size: 12.5px; }
.rc-up { color: var(--success); }
.rc-down { color: var(--danger); }
.rc-table { display: flex; flex-direction: column; gap: 4px; container-type: inline-size; }
.rc-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr 1.3fr 1.3fr; gap: 12px; padding: 8px 12px;
  border-radius: 9px; background: var(--surface-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.rc-head { background: transparent; padding-top: 0; color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.rc-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
@container (max-width: 560px) {
  .rc-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .rc-row > :nth-child(4) { display: none; }
}
@media (max-width: 640px) { .rc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* кнопка мобильного меню (на компьютере скрыта) */
.mnav-toggle {
  display: none; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; cursor: pointer; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.mnav-toggle .nav-icon { color: var(--text); }
.mnav-label { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; font-size: 15px; line-height: 1.25; }
.mnav-label small { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mnav-chevron { color: var(--muted); display: inline-flex; }
.mnav-chevron .icon { transform: rotate(-90deg); transition: transform .15s; }
/* номер версии на узком экране не помещается — прячем (он есть на вкладке «Обновления» и в /about) */
@media (max-width: 640px) {
  .brand .version-tag { display: none; }
}
@media (max-width: 760px) {
  .mnav-toggle { display: flex; }
}

/* окно карточки дорожной карты на узком экране */
@media (max-width: 640px) {
  .rm-modal .fields { flex-direction: column; }
  .rm-modal .fields > .field { width: 100%; }
  .rm-modal .segmented { width: 100%; }
  .rm-modal .segmented button { flex: 1; padding-left: 6px; padding-right: 6px; }
  .rm-modal-foot { flex-direction: column; align-items: stretch; }
  .rm-modal-foot .rm-dates { text-align: center; }
  .rm-modal-actions { margin-left: 0; }
  .rm-modal-actions .btn { flex: 1; }
}
.sg-more[hidden] { display: none; }

/* --- уровни доступа --- */
.access-tag { display: inline-block; flex: none; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 18px;
  color: var(--muted); background: var(--surface-3); }
.access-tag.access-admin { color: #57f287; background: color-mix(in srgb, #57f287 14%, transparent); }
.access-tag.access-owner { color: #f5c542; background: color-mix(in srgb, #f5c542 14%, transparent); }
.access-tag.access-moderator { color: #6cb6ff; background: color-mix(in srgb, #6cb6ff 14%, transparent); }
.ac-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ac-level { display: flex; flex-direction: column; gap: 12px; --c: var(--muted); border-top: 3px solid var(--c); }
.ac-level.access-moderator { --c: #6cb6ff; }
.ac-level.access-admin { --c: #57f287; }
.ac-level.access-owner { --c: #f5c542; }
.ac-head { display: flex; gap: 12px; align-items: flex-start; }
.ac-head h3 { margin: 0; }
.ac-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.ac-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.ac-level ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); }
.ac-level li .icon { color: var(--c); vertical-align: -2px; margin-right: 4px; }
.switch input:disabled + .track { opacity: .5; cursor: not-allowed; }
@media (max-width: 900px) { .ac-levels { grid-template-columns: minmax(0, 1fr); } }

/* --- приглашения закрыты --- */
.invite-closed { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px;
  border-color: color-mix(in srgb, var(--warning, #f0b232) 35%, var(--border)); }
.invite-closed h3 { margin: 0 0 4px; font-size: 15px; }
.invite-closed p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; max-width: 760px; }
.invite-closed-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  color: var(--warning, #f0b232); background: color-mix(in srgb, var(--warning, #f0b232) 14%, transparent); }
.guild-card .btn:disabled { opacity: .6; cursor: not-allowed; }

/* --- футер --- */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > .app { flex: 1 0 auto; width: 100%; box-sizing: border-box; padding-bottom: 48px; }
body:has(#savebar.show) .site-footer { padding-bottom: 110px; }
@media (max-width: 640px) {
  .invite-closed { flex-direction: column; }
}

/* --- права: команды модерации и управление сервером --- */
.rights-note { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.55; color: var(--muted);
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); }
.rights-note > .icon { color: var(--warning); flex: none; margin-top: 2px; }
.rights-note strong { color: var(--text); display: block; margin-bottom: 2px; }
.ml-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.ml-grid .card { margin: 0; }
.ml-card h3 code { font-size: 12px; margin-left: 6px; color: var(--muted); }
.ml-card.is-off .fields, .ml-card.is-off .field { opacity: .45; }
.fields.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }

/* --- роли и каналы сервера --- */
.mg-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.mg-list { position: sticky; top: 84px; padding: 12px; margin: 0; }
.mg-items { margin-top: 10px; max-height: calc(100vh - 220px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.mg-item { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; min-width: 0; }
.mg-item:hover { background: var(--surface-2, rgba(255,255,255,.04)); }
.mg-item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.mg-item.locked .mg-name { opacity: .55; }
.mg-item.is-cat { margin-top: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.mg-item.in-cat { padding-left: 18px; }
.mg-item .icon { color: var(--muted); flex: none; }
.mg-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.mg-dot.big { width: 18px; height: 18px; }
.mg-ico { width: 16px; height: 16px; flex: none; font-size: 14px; line-height: 16px; }
.mg-badge { color: var(--warning); display: inline-flex; }
.mg-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.mg-editor .card { margin-top: 0; }
.mg-editor > .card + .card { margin-top: 16px; }
.mg-editor .field { margin-bottom: 14px; }
.mg-title { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.mg-title h2 { margin: 0; }
.mg-title p { margin: 2px 0 0; font-size: 13px; }
.mg-ch-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.mg-lock { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px;
  color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
.mg-hint { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13.5px; }
.mg-color { display: flex; gap: 8px; align-items: center; }
.mg-color .input { max-width: 130px; }
.mg-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mg-swatch { width: 22px; height: 22px; border-radius: 6px; border: 0; cursor: pointer; }
.mg-swatch:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.mg-icon-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mg-icon-row .input { max-width: 190px; }
.mg-icon-preview { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-size: 20px; flex: none; color: var(--muted); }
.mg-icon-preview img { width: 26px; height: 26px; object-fit: contain; }
.btn.disabled { opacity: .5; pointer-events: none; }
.mg-check { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; cursor: pointer; }
.mg-check input { flex: none; }
.mg-check.locked { color: var(--muted); opacity: .6; cursor: not-allowed; }
.mg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 860px) {
  .mg-layout { grid-template-columns: minmax(0, 1fr); }
  .mg-list { position: static; }
  .mg-items { max-height: 320px; }
}
@media (max-width: 640px) {
  .fields.two { grid-template-columns: minmax(0, 1fr); }
  .ml-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- «Управление сервером»: строки настроек --- */
.pk-card { padding: 0; overflow: hidden; container-type: inline-size; }
.pk-card + .pk-card, .rights-note + .pk-card { margin-top: 16px; }
.pk-head { display: flex; gap: 14px; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.pk-head h2 { font-size: 18px; }
.pk-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.pk-head-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--text); }
.pk-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); grid-template-areas: "text add" "chips chips";
  column-gap: 28px; row-gap: 12px; align-items: start; padding: 18px 22px; }
.pk-text { grid-area: text; }
.pk-add { grid-area: add; width: 100%; }
.pk-chips { grid-area: chips; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.pk-chips .chips-empty { line-height: 28px; }
.pk-count { margin-left: 2px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px;
  color: var(--muted); background: var(--surface-3); }
.pk-more { border: 1px dashed var(--border-strong); background: none; color: var(--muted); font: inherit; font-size: 13px;
  padding: 4px 11px; border-radius: 999px; cursor: pointer; }
.pk-more:hover { color: var(--text); border-color: var(--text); }
.pk-row + .pk-row { border-top: 1px solid var(--border); }
.pk-text h4 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pk-text h4 .icon { color: var(--muted); }
.pk-text p { margin: 5px 0 0 23px; color: var(--muted); font-size: 13.5px; line-height: 1.5; max-width: 560px; }
.pk-control .field-label:empty { display: none; }
.pk-control .chips { min-height: 0; margin-bottom: 8px !important; }
.pk-control .chips-empty { line-height: 26px; }
.pk-control .select { width: 100%; }
/* узкая карточка — описание сверху, выбор под ним */
@container (max-width: 640px) {
  .pk-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text" "add" "chips"; padding: 16px 18px; }
  .pk-head { padding: 18px; }
  .pk-text p { max-width: none; }
}

/* --- «Команды модерации» --- */
.ml-card .pk-head { align-items: center; }
.ml-head-text { flex: 1; min-width: 0; }
.ml-head-text h2 code { font-size: 12.5px; font-weight: 500; margin-left: 6px; padding: 2px 7px; vertical-align: 2px; }
.ml-card.is-off .ml-body { opacity: .45; }
.ml-card + .ml-card, .ml-card + .pk-card { margin-top: 16px; }
.lim-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 20px 22px 22px; }
.lim-box { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: text; }
.lim-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lim-input { display: flex; align-items: baseline; gap: 6px; }
.lim-input input { min-width: 1.6ch; max-width: 110px; box-sizing: content-box; background: none; border: 0; padding: 0; color: var(--text);
  font: inherit; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; }
.lim-input input::-webkit-outer-spin-button, .lim-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lim-box:focus-within { border-color: var(--border-strong); }
.lim-unit { color: var(--muted); font-size: 14px; }
.lim-hint { color: var(--faint); font-size: 12.5px; }
.ml-body .pk-row { border-top: 0; }
@media (max-width: 520px) { .lim-row { grid-template-columns: minmax(0, 1fr); padding: 16px 18px 18px; } }

/* --- «Доступ к панели»: уровни строками --- */
.pk-card + .pk-card { margin-top: 16px; }
.ac-row { --c: var(--muted); display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 28px;
  align-items: center; padding: 16px 22px; }
.ac-row + .ac-row { border-top: 1px solid var(--border); }
.ac-row.access-moderator { --c: #6cb6ff; }
.ac-row.access-admin { --c: #57f287; }
.ac-row.access-owner { --c: #f5c542; }
.ac-who { display: flex; gap: 12px; align-items: center; }
.ac-who h4 { margin: 0; font-size: 15px; color: var(--c); }
.ac-who p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.ac-row .ac-icon { width: 36px; height: 36px; }
.ac-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ac-list li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px;
  white-space: nowrap; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); }
.ac-list li .icon { color: var(--c); }
@container (max-width: 760px) {
  .ac-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px 18px; }
  .ac-list li { white-space: normal; }
}
.ac-mine { display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 7px 12px; border-radius: 10px;
  font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }

/* --- настройки рейтинга: разделы --- */
.ls-card { container-type: inline-size; }
.ls-sec { padding: 22px; border-top: 1px solid var(--border); }
.ls-head { display: flex; gap: 12px; align-items: center; }
.ls-head-text { flex: 1; min-width: 0; }
.ls-head h4 { margin: 0; font-size: 15px; font-weight: 600; }
.ls-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.ls-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--muted); }
.ls-body { margin-top: 16px; padding-left: 46px; }
.ls-body > * + * { margin-top: 14px; }
.ls-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
.ls-empty { margin: 0; color: var(--faint); font-size: 13.5px; }
.lim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; }
.ls-line { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 14px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.ls-line strong { font-size: 14px; font-weight: 600; }
.ls-line p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.ls-body .pk-row { padding: 4px 0 0; }
.ls-body .pk-row + .pk-row { border-top: 0; padding-top: 14px; }
.ls-body .pk-text p { margin-left: 23px; }
.ls-body .voice-limit, .ls-body .curve { margin-top: 12px; }
@container (max-width: 640px) {
  .ls-sec { padding: 18px; }
  .ls-body { padding-left: 0; }
}
@container (max-width: 640px) {
  .ls-card .pk-head { flex-wrap: wrap; }
  .ls-card .pk-head .ml-head-text { flex-basis: calc(100% - 52px); }
  .ls-card .pk-head .team-summary { width: 100%; justify-content: space-between; padding-left: 52px; }
}
@container (max-width: 640px) {
  .ls-card .segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.lim-hint, .lim-label, .ls-line p { text-wrap: pretty; }
@container (max-width: 640px) {
  .ls-head { flex-wrap: wrap; }
}

/* --- гайд для команды --- */
.gd-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.gd-bar .input { flex: 1 1 320px; }
.gd-mine { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.gd-chip { padding: 3px 10px; border-radius: 999px; font-size: 12.5px; color: var(--text); background: var(--surface-3); }
.gd-toc { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.gd-toc a { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; font-size: 13px;
  color: var(--muted); text-decoration: none; border: 1px solid var(--border); background: var(--surface-2); }
.gd-toc a:hover { color: var(--text); border-color: var(--border-strong); }
.gd-h { margin: 30px 0 6px; scroll-margin-top: 90px; }
.gd-lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 820px; }
.gd-sec + .gd-sec { margin-top: 14px; }
.gd-sec.is-locked .gd-cmd { opacity: .55; }
.gd-ok, .gd-no, .gd-need { display: inline-flex; gap: 5px; align-items: center; flex: none; font-size: 12.5px; padding: 3px 10px;
  border-radius: 999px; white-space: nowrap; }
.gd-ok { color: #57f287; background: color-mix(in srgb, #57f287 12%, transparent); }
.gd-no, .gd-need { color: var(--muted); background: var(--surface-3); }
.gd-cmd { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; padding: 14px 22px; align-items: start; }
.gd-cmd + .gd-cmd { border-top: 1px solid var(--border); }
.gd-cmd-name code { font-size: 14px; font-weight: 600; padding: 3px 8px; }
.gd-cmd-body p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
.gd-usage { display: inline-block; font-size: 12.5px; color: var(--muted); padding: 3px 8px; white-space: normal; word-break: break-word; }
.gd-tab { display: flex; gap: 14px; align-items: center; padding: 14px 22px; }
.gd-tab + .gd-tab { border-top: 1px solid var(--border); }
.gd-tab.is-locked .gd-tab-text { opacity: .55; }
.gd-tab-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.gd-tab-text { flex: 1; min-width: 0; }
.gd-tab-text h4 { margin: 0; font-size: 15px; font-weight: 600; }
.gd-tab-text p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.gd-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.gd-tip { display: flex; gap: 12px; align-items: flex-start; margin: 0; }
.gd-tip h4 { margin: 0 0 4px; font-size: 14.5px; }
.gd-tip p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
@media (max-width: 640px) {
  .gd-cmd { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 18px; }
  .gd-tab { padding: 14px 18px; flex-wrap: wrap; }
}

/* --- категории команды и права --- */
.access-tag.access-junior { color: #c084fc; background: color-mix(in srgb, #c084fc 14%, transparent); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.cat-chip { --c: var(--muted); display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); background: none; border: 1px dashed var(--border-strong); }
.cat-chip:hover { color: var(--text); border-color: var(--text); }
.cat-chip.on { color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 14%, transparent); }
.cat-chip.fixed { cursor: default; opacity: .8; }
.cat-moderator { --c: #6cb6ff; }
.cat-junior { --c: #c084fc; }
.cat-admin { --c: #57f287; }
.cat-owner { --c: #f5c542; }
.pm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 14px 22px; }
.pm-row + .pm-row, .pk-head + .pm-row { border-top: 1px solid var(--border); }
.pm-text h4 { margin: 0; font-size: 15px; font-weight: 600; }
.pm-text p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; text-wrap: pretty; }
.ac-auto .pk-text p { max-width: 640px; }
.ac-next { display: flex; justify-content: flex-end; margin-top: 14px; }
@container (max-width: 700px) {
  .pm-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 18px; }
  .cat-chips { justify-content: flex-start; }
}

/* --- официальный сервер --- */
.og-card { position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px;
  align-items: center; padding: 26px 28px; border-color: color-mix(in srgb, #5865f2 40%, var(--border));
  background: radial-gradient(600px 200px at 0% 0%, color-mix(in srgb, #5865f2 16%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface) 0%, rgba(21, 22, 28, .92) 100%); }
.og-icon .avatar-xl { width: 76px; height: 76px; border-radius: 22px; font-size: 26px; box-shadow: 0 0 0 3px color-mix(in srgb, #5865f2 45%, transparent); }
.og-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: #8b95ff; }
.og-name { margin: 4px 0 2px; font-size: 24px; display: flex; align-items: center; gap: 8px; }
.og-verified { display: inline-grid; place-items: center; color: #5865f2; }
.og-verified .icon { fill: color-mix(in srgb, #5865f2 25%, transparent); }
.og-stats { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.og-online { width: 8px; height: 8px; border-radius: 50%; background: #23a55a; display: inline-block; }
.og-desc { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 620px; }
.og-action { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.og-card.compact { grid-template-columns: auto minmax(0, 1fr); padding: 20px; }
.og-card.compact .og-action { grid-column: 1 / -1; align-items: stretch; }
.og-card.compact .og-action .btn { width: 100%; justify-content: center; }
@media (max-width: 720px) {
  .og-card { grid-template-columns: auto minmax(0, 1fr); padding: 20px; gap: 16px; }
  .og-icon .avatar-xl { width: 60px; height: 60px; border-radius: 18px; }
  .og-name { font-size: 20px; }
  .og-action { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}

/* --- карточки серверов --- */
.srv-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin: 0; }
.srv-info { flex: 1; min-width: 0; }
.srv-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-sub { margin-top: 5px; color: var(--muted); font-size: 13px; }
.srv-card .btn .icon { transform: rotate(180deg); }
.srv-card.no-bot { opacity: .8; }
.srv-card .btn:disabled { opacity: .6; cursor: not-allowed; }
.srv-empty { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 14px; padding: 4px 2px; }
.srv-label-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.srv-note { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--warning); cursor: help;
  background: color-mix(in srgb, var(--warning) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); }

/* --- страница входа --- */
.login2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center;
  max-width: 1080px; margin: 4vh auto 0; }
.login2-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login2-brand .login-moon { margin: 0; width: 58px; height: 58px; }
.login2-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.login2 h1 { font-size: 38px; letter-spacing: -0.8px; line-height: 1.15; }
.login2-lead { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 14px 0 26px; max-width: 520px; }
.login2 .login-note { display: flex; align-items: center; gap: 6px; }
.login2-features { display: grid; gap: 14px; margin-top: 34px; }
.login2-feature { display: flex; gap: 12px; align-items: flex-start; }
.login2-feature h4 { margin: 0; font-size: 14.5px; }
.login2-feature p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.login2-side .og-card { grid-template-columns: auto minmax(0, 1fr); }
.login2-side .og-action { grid-column: 1 / -1; align-items: stretch; }
.login2-side .og-action .btn { justify-content: center; }
@media (max-width: 860px) {
  .login2 { grid-template-columns: minmax(0, 1fr); gap: 28px; margin-top: 0; }
  .login2 h1 { font-size: 30px; }
}
.guild-grid:has(.srv-card) { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* --- плашка категории после названия сервера --- */
.sidebar-guild-text { min-width: 0; }
.access-badge { --c: var(--muted); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
  margin-left: 7px; vertical-align: -4px; color: var(--c); cursor: help;
  background: color-mix(in srgb, var(--c) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.access-badge.access-owner { --c: #f5c542; }
.access-badge.access-admin { --c: #57f287; }
.access-badge.access-junior { --c: #c084fc; }
.access-badge.access-moderator { --c: #6cb6ff; }
.sidebar-guild-name { display: flex; align-items: center; gap: 7px; }
.sidebar-guild-name > span { min-width: 0; }
.sidebar-guild-name .access-badge { margin-left: 0; vertical-align: 0; flex: none; }
.nav-top-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 0 0 10px 4px;
  padding: 5px 10px 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.nav-top-back:hover { color: var(--text); border-color: var(--border-strong); }

/* --- футер --- */
.site-footer { border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 55%, transparent);
  color: var(--muted); font-size: 13.5px; }
.ft-inner { max-width: 1340px; margin: 0 auto; padding: 40px 28px 30px; display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 36px; }
.ft-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--text); font-size: 16px; }
.ft-logo .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
.ft-brand p { margin: 0 0 16px; line-height: 1.6; max-width: 340px; }
.ft-col h4 { margin: 4px 0 14px; color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: .3px; }
.ft-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ft-col li > a, .ft-col li > span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
.ft-col a:hover { color: var(--text); }
.ft-col .icon { color: var(--faint); flex: none; }
.ft-col strong { color: var(--text); font-weight: 600; }
.ft-col code { font-size: 12px; }
.ft-bottom { max-width: 1340px; margin: 0 auto; padding: 16px 28px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; color: var(--faint); font-size: 12.5px; }
@media (max-width: 1180px) { .ft-inner { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ft-brand { grid-column: 1 / -1; } .ft-brand p { max-width: 520px; } }
@media (max-width: 760px) { .ft-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .ft-inner { grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 30px 18px 22px; }
  .ft-bottom { flex-direction: column; padding: 14px 18px 20px; }
}

/* --- плашка «Панель обновилась» --- */
.build-bar { position: fixed; left: 50%; bottom: 22px; z-index: 60; display: none; align-items: center; gap: 14px;
  transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.build-bar.show { display: flex; }
.build-bar > .icon { color: #8b95ff; flex: none; }
.build-bar > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.build-bar strong { font-size: 14px; }
.build-bar span { color: var(--muted); font-size: 13px; line-height: 1.4; text-wrap: pretty; }
.build-bar .btn { flex: none; }
.build-bar.offline { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.build-spin { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--warning) 30%, transparent);
  border-top-color: var(--warning); animation: build-spin .9s linear infinite; }
@keyframes build-spin { to { transform: rotate(360deg); } }
body:has(#savebar.show) .build-bar { bottom: 100px; }

/* --- полоса прокрутки списка ролей и каналов: тонкая и тёмная, как в меню --- */
.mg-items { padding-right: 4px; }
/* Firefox понимает только эти два свойства; в Chrome они отключили бы тонкую полосу без стрелок ниже */
@supports not selector(::-webkit-scrollbar) { .mg-items { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; } }
.mg-items::-webkit-scrollbar { width: 6px; }
.mg-items::-webkit-scrollbar-track { background: transparent; }
.mg-items::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
.mg-items::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.mg-items::-webkit-scrollbar-button { display: none; height: 0; }

/* --- галочки в стиле сайта (как зелёный переключатель) --- */
input[type="checkbox"]:not(.switch input) {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 18px; height: 18px; border-radius: 6px; display: inline-grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  transition: background .15s, border-color .15s;
}
input[type="checkbox"]:not(.switch input)::after {
  content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--success); border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0); transition: transform .12s ease-out;
}
input[type="checkbox"]:not(.switch input):hover { border-color: var(--muted); }
input[type="checkbox"]:not(.switch input):checked { background: rgba(87, 242, 135, .16); border-color: rgba(87, 242, 135, .6); }
input[type="checkbox"]:not(.switch input):checked::after { transform: rotate(45deg) scale(1); }
input[type="checkbox"]:not(.switch input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"]:not(.switch input):disabled { opacity: .5; cursor: not-allowed; }

/* --- квадратик выбранного цвета — как остальные поля --- */
.mg-color input[type="color"] {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 40px; height: 40px; padding: 4px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); transition: border-color .15s;
}
.mg-color input[type="color"]:hover, .mg-color input[type="color"]:focus-visible { border-color: var(--border-strong); outline: none; }
.mg-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.mg-color input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
.mg-color input[type="color"]::-moz-color-swatch { border: none; border-radius: 7px; }
.mg-color .input, .mg-color .btn { height: 40px; }
.mg-swatch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.mg-check, .check { text-wrap: pretty; }
