/* ===== LSSD-портал: та же дизайн-система rx-, что и на panel.nomadbot.net ===== */

:root {
  --bg: #090b10;
  --panel: #111521;
  --panel2: #171d2b;
  --panel3: #0c111b;
  --text: #eef2ff;
  --muted: #8f9bb3;
  --line: #283248;
  --accent: #5865f2;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #38bdf8;
  --majestic: #ff2d55;
  --majestic2: #8b5cf6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(620px 620px at 10% 0%, rgba(255, 45, 85, .08), transparent 62%),
    radial-gradient(700px 700px at 88% 4%, rgba(88, 101, 242, .10), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
h1, h2 { margin: 0; }

svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rx-muted { color: var(--muted); font-size: 12px; }

/* ===== Каркас ===== */
body.rx { display: flex; min-height: 100vh; }

.rx-sidebar {
  width: 236px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
}

.rx-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.rx-brand:hover { background: rgba(255, 255, 255, .035); }

.rx-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
}

.rx-logo img { width: 100%; height: 100%; object-fit: cover; }
.rx-btitle { font-weight: 800; font-size: 15px; line-height: 1.1; }
.rx-bsub { font-size: 10px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; margin-top: 3px; }

.rx-nav { flex: 1; overflow-y: auto; padding: 12px 12px 16px; }

.rx-gtitle {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 14px 10px 8px;
}

.rx-group:first-child .rx-gtitle { padding-top: 6px; }

.rx-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 9px;
  color: #c3cde6;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 2px;
  position: relative;
}

.rx-link i { display: block; width: 20px; flex: none; opacity: .82; }
.rx-link i svg { width: 19px; height: 19px; }
.rx-link:hover { background: rgba(255, 255, 255, .045); color: #fff; }
.rx-link.active { background: rgba(88, 101, 242, .16); color: #fff; }
.rx-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.rx-link.active i { color: var(--accent); opacity: 1; }

.rx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.rx-topbar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 16, .72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.rx-tleft { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.rx-tright { display: flex; align-items: center; gap: 14px; flex: none; }

.rx-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
  min-width: 0;
}

.rx-pill i { flex: none; }
.rx-pill i svg { width: 15px; height: 15px; }
.rx-pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Кликабельный переход в Discord-сервер */
.rx-pill-link { transition: border-color .16s, background .16s, transform .16s; max-width: min(360px, 34vw); }
.rx-pill-link:hover { border-color: var(--accent); background: rgba(88, 101, 242, .16); transform: translateY(-1px); }
.rx-pill-link .rx-pill-go { opacity: .55; }
.rx-pill-link:hover .rx-pill-go { opacity: 1; }
.rx-pill-cta { background: var(--accent); border-color: var(--accent); color: #fff; }
.rx-pill.green { background: rgba(34, 197, 94, .14); color: #86efac; border-color: rgba(34, 197, 94, .3); }
.rx-pill.live { background: rgba(56, 189, 248, .14); color: #7dd3fc; border-color: rgba(56, 189, 248, .3); }

.rx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--green);
  box-shadow: 0 0 8px rgba(34, 197, 94, .6);
}

.rx-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 5px 7px 5px 10px;
  border: 1px solid rgba(143, 155, 190, .18);
  background: rgba(255, 255, 255, .035);
  border-radius: 13px;
  cursor: pointer;
  user-select: none;
  transition: background .16s, border-color .16s, transform .16s;
}

.rx-user:hover { background: rgba(255, 255, 255, .07); border-color: rgba(143, 155, 190, .34); transform: translateY(-1px); }
.rx-user:focus-visible { outline: 2px solid rgba(88, 101, 242, .5); outline-offset: 2px; }
.rx-uname { font-weight: 800; font-size: 13px; text-align: right; line-height: 1.1; }
.rx-urole { font-size: 10px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; text-align: right; margin-top: 3px; }

.rx-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--majestic2), var(--accent));
  flex: none;
}

.rx-logout { color: var(--muted); font-weight: 700; font-size: 12px; }
.rx-logout:hover { color: var(--text); }

.rx-burger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex: none;
}

.rx-content { padding: 24px 24px 40px; flex: 1; min-width: 0; }

/* Один зазор на всю страницу вместо margin-bottom у каждого блока: раньше
   у карточек его не было вовсе и соседние секции слипались в одну плиту. */
.rx-content > .content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Собственные отступы блоков обнуляем — иначе они складываются с gap.
   body.rx в селекторе нужен для веса: margin-bottom у .rx-phead и .rx-stats
   объявлен ниже по файлу и при равном весе победил бы. */
body.rx .rx-content > .content > * { margin-bottom: 0; }

.rx-backdrop { display: none; }
.rx-footer { margin-top: 22px; color: var(--muted); font-size: 12px; text-align: center; }

/* ===== Заголовок страницы ===== */
.rx-phead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.rx-phead h1 { font-size: 25px; margin: 0 0 5px; font-weight: 900; }
.rx-phead .sub { color: var(--muted); font-size: 13px; }

.rx-status {
  border: 1px solid rgba(34, 197, 94, .4);
  border-left: 3px solid var(--green);
  border-radius: 12px;
  padding: 11px 15px;
  background: rgba(34, 197, 94, .06);
  display: flex;
  gap: 11px;
  align-items: center;
}

.rx-status b { font-size: 13px; }
.rx-status small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.rx-status > svg { color: var(--green); flex: none; width: 19px; height: 19px; }
.rx-status.warn { border-color: rgba(234, 179, 8, .45); border-left-color: var(--yellow); background: rgba(234, 179, 8, .07); }
.rx-status.warn .rx-dot { background: var(--yellow); box-shadow: 0 0 8px rgba(234, 179, 8, .6); }
.rx-status.warn > svg { color: var(--yellow); }

.rx-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 13px;
}

.rx-back-btn:hover { border-color: var(--accent); color: #fff; }

/* ===== Карточки-метрики ===== */
.rx-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.rx-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.rx-stat-top { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }

.rx-stat-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(88, 101, 242, .14);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.rx-stat-ico svg { width: 17px; height: 17px; }
.rx-stat-ico.pink { background: rgba(255, 45, 85, .14); color: var(--majestic); }
.rx-stat-ico.cyan { background: rgba(56, 189, 248, .14); color: var(--blue); }
.rx-stat-ico.green { background: rgba(34, 197, 94, .14); color: var(--green); }
.rx-stat-ico.yellow { background: rgba(234, 179, 8, .14); color: var(--yellow); }

/* Один в один как в dashboard/style.css — обычный регистр, без разрядки.
   :not(.rx-stat-ico) — иначе правило перебивает цвет иконки, она ведь тоже span. */
.rx-stat-top span:not(.rx-stat-ico) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.rx-stat-num { font-size: 30px; font-weight: 900; line-height: 1.05; word-break: break-word; }
.rx-stat-num.pink { color: var(--majestic); }
.rx-stat-num.cyan { color: var(--blue); }
.rx-stat-num.green { color: var(--green); }
.rx-stat-num.yellow { color: var(--yellow); }
.rx-stat-sub { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ===== Колонки и карточки ===== */
.rx-cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-bottom: 22px; }

.rx-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  position: relative;
}

.rx-chead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.rx-chead h2 { font-size: 17px; margin: 0 0 3px; font-weight: 900; }
.rx-chead .sub { color: var(--muted); font-size: 12px; }
.rx-chead-inner { margin-top: 20px; }
.rx-chead-standalone { margin: 4px 0 14px; }

/* ===== Список заявок ===== */
.rx-applist { display: flex; flex-direction: column; gap: 8px; }

.rx-approw {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel3);
}

.rx-approw-main { min-width: 0; }
.rx-approw-main strong { display: block; font-size: 13.5px; }
.rx-approw-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }

/* В журнале описание события важнее служебной строки со временем и IP,
   поэтому оно идёт отдельной строкой обычным цветом, а не сливается в мелкое серое. */
.rx-approw-detail { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: #c3cde6; overflow-wrap: anywhere; }
.rx-approw-main time { color: #b7c5ef; font-variant-numeric: tabular-nums; }

.rx-empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }

/* ===== Профиль сотрудника ===== */
.rx-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel3);
}

.rx-rav {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--majestic2), var(--accent));
  flex: none;
}

.rx-rname { font-weight: 800; font-size: 14px; }
.rx-rrole { color: var(--muted); font-size: 12px; margin-top: 2px; }

.rx-facts { display: flex; flex-direction: column; }

.rx-fact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(40, 50, 72, .55);
  font-size: 13px;
}

.rx-fact:last-child { border-bottom: none; }
.rx-fact > span { color: var(--muted); }
.rx-fact > b { text-align: right; overflow-wrap: anywhere; }
.rx-fact code { font-family: Consolas, "JetBrains Mono", monospace; font-size: 12.5px; }

/* ===== Роли ===== */
.rx-roles { display: flex; flex-wrap: wrap; gap: 6px; }

.rx-role {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--rc, #99aab5);
  color: var(--rc, #dbe4ff);
  background: rgba(255, 255, 255, .03);
  white-space: nowrap;
}

/* ===== Бейджи ===== */
.rx-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: #b7c5ef;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.rx-badge.green { background: rgba(34, 197, 94, .14); color: #86efac; border-color: rgba(34, 197, 94, .3); }
.rx-badge.red { background: rgba(239, 68, 68, .14); color: #fca5a5; border-color: rgba(239, 68, 68, .3); }
.rx-badge.yellow { background: rgba(234, 179, 8, .14); color: #fde047; border-color: rgba(234, 179, 8, .3); }
.rx-badge.gray { background: rgba(148, 163, 184, .14); color: #cbd5e1; }

/* ===== Плитки разделов ===== */
.rx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.rx-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: start;
  transition: border-color .16s, transform .16s;
}

.rx-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.rx-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rx-tile strong { font-size: 17px; font-weight: 900; }
.rx-tile small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.rx-tile-cta {
  margin-top: 6px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
}

.rx-tile:hover .rx-tile-cta { background: #6673ff; }

/* ===== Выбор направления ===== */
.rx-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.rx-choice {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel3);
  transition: border-color .15s, transform .15s;
}

.rx-choice:hover { border-color: var(--accent); transform: translateY(-1px); }
.rx-choice span { color: #8b96ff; font-size: 11.5px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.rx-choice strong { font-size: 14px; line-height: 1.3; }

/* ===== Формы ===== */
.rx-form { max-width: 780px; display: grid; gap: 16px; }
.rx-field { display: grid; gap: 8px; }
.rx-field > span { color: #d5def9; font-size: 12.5px; font-weight: 800; }
.rx-field b { color: var(--majestic); }
.rx-field em { color: var(--majestic); font-style: normal; font-size: 12px; }
.rx-hint, .rx-hint-inline { color: var(--muted); font-size: 11.5px; font-weight: 600; }

input[type=text], input[type=file], textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel3);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
}

textarea { min-height: 120px; resize: vertical; }

input[type=text]:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, .16);
}

/* ===== Кнопки =====
   Язык интерфейса — приглушённые пилюли (см. .rx-badge), поэтому и кнопки
   такие же: тонкая рамка, полупрозрачная заливка, цвет вместо крика.
   Насыщенная заливка осталась только у .rx-btn.solid — это вход через Discord,
   единственное место, где кнопка должна перебивать всё вокруг. */
.rx-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.rx-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid rgba(88, 101, 242, .38);
  border-radius: 9px;
  background: rgba(88, 101, 242, .14);
  color: #b9c2ff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.rx-btn:hover { background: rgba(88, 101, 242, .24); border-color: rgba(88, 101, 242, .7); color: #fff; }
.rx-btn:active { transform: translateY(1px); }

.rx-btn.ghost { background: var(--panel2); border-color: var(--line); color: #a9b6d6; }
.rx-btn.ghost:hover { border-color: rgba(88, 101, 242, .55); color: #dbe4ff; background: var(--panel2); }

.rx-btn.ok { background: rgba(34, 197, 94, .13); border-color: rgba(34, 197, 94, .34); color: #86efac; }
.rx-btn.ok:hover { background: rgba(34, 197, 94, .22); border-color: rgba(34, 197, 94, .65); color: #d1fae5; }

/* Пишем и .ghost.danger: раньше сплошной красный перебивал ghost по порядку
   правил, и «Отказать» выглядел опаснее, чем есть. */
.rx-btn.danger, .rx-btn.ghost.danger {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .32);
  color: #fca5a5;
}

.rx-btn.danger:hover, .rx-btn.ghost.danger:hover {
  background: rgba(239, 68, 68, .2);
  border-color: rgba(239, 68, 68, .62);
  color: #fee2e2;
}

.rx-btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 800; }
.rx-btn.solid:hover { background: #6673ff; border-color: #6673ff; color: #fff; }

.rx-btn.wide { width: 100%; }
.rx-btn svg { width: 16px; height: 16px; opacity: .9; }

/* ===== Уведомления ===== */
.rx-alert, .alert {
  max-width: 780px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(239, 68, 68, .55);
  border-radius: 12px;
  color: #fecaca;
  background: rgba(239, 68, 68, .1);
  font-size: 13.5px;
}

.rx-alert.ok, .alert-ok {
  border-color: rgba(34, 197, 94, .55);
  color: #bbf7d0;
  background: rgba(34, 197, 94, .1);
}

/* Плашка гостя: человек вошёл, но на сервере фракции его нет. Не ошибка и не успех,
   поэтому цвет предупреждающий, а не красный — иначе выглядит как отказ в доступе. */
.rx-guest {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 17px;
  border: 1px solid rgba(234, 179, 8, .42);
  border-radius: 14px;
  background: rgba(234, 179, 8, .07);
}

.rx-guest-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  border: 1px solid rgba(234, 179, 8, .35);
  background: rgba(234, 179, 8, .12);
  color: var(--yellow);
}

.rx-guest-ico svg { width: 17px; height: 17px; }
.rx-guest-text { display: grid; gap: 4px; min-width: 0; }
.rx-guest-text strong { font-size: 14px; color: #fde68a; }
.rx-guest-text small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ===== Экран авторизации: отдельная страница без сайдбара и шапки ===== */
body.rx-authpage { display: block; }

.rx-auth {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  min-height: 100vh;
  padding: 32px 20px;
}

.rx-auth-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(420px, 100%);
  padding: 38px 34px 34px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .45);
}

.rx-auth-card.danger { border-color: rgba(239, 68, 68, .4); }

/* Значок LSCSD детализированный, поэтому крупнее обычной иконки.
   Файл лучше класть с прозрачным фоном: подложки под ним нет. */
.rx-auth-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: transparent;
}

.rx-auth-card h1 { font-size: 25px; font-weight: 900; letter-spacing: -.3px; }
.rx-auth-card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 13.5px; }

.rx-auth-btn {
  width: 100%;
  margin-top: 8px;
  justify-content: center;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 14.5px;
}

.rx-auth-alert {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid rgba(239, 68, 68, .45);
  border-radius: 10px;
  background: rgba(239, 68, 68, .1);
  color: #fca5a5;
  font-size: 12.5px;
  line-height: 1.5;
}

.rx-auth-hint { color: var(--muted); font-size: 11.5px; }
.rx-auth-card .rx-note { width: 100%; text-align: left; }
.rx-auth-foot { color: var(--muted); font-size: 11.5px; }

@media (max-width: 480px) {
  .rx-auth-card { padding: 30px 22px 26px; }
  .rx-auth-card h1 { font-size: 21px; }
}

.rx-note {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel3);
  color: var(--muted);
  font-size: 12px;
}

.rx-note code { color: #dbe4ff; overflow-wrap: anywhere; }

/* ===== Админка: маршруты заявок ===== */
.rx-route-groups { display: grid; gap: 16px; }
.rx-route-group { padding: 18px; }
.rx-route-list { display: grid; gap: 8px; }

/* Без overflow:hidden — иначе выпадающие списки каналов и ролей обрезаются краем карточки. */
.rx-route {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel3);
}

.rx-route[open] { border-color: rgba(88, 101, 242, .45); }
.rx-route.saved { border-color: rgba(34, 197, 94, .6); }

.rx-route > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.rx-route > summary::-webkit-details-marker { display: none; }
.rx-route-main { min-width: 0; flex: 1; }
.rx-route-main strong { display: block; font-size: 14px; }
.rx-route-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; }

.rx-caret { display: block; color: var(--muted); flex: none; transition: transform .18s ease; }
.rx-route[open] > summary .rx-caret { transform: rotate(180deg); }

.rx-route-body { padding: 4px 14px 14px; display: grid; gap: 14px; border-top: 1px solid rgba(40, 50, 72, .6); margin-top: 2px; padding-top: 14px; }
.rx-route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rx-route-grid > .rx-field:last-child { grid-column: 1 / -1; }

/* ===== Создание новой заявки ===== */
.rx-newform { display: grid; gap: 16px; }

.rx-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.rx-check input { position: absolute; opacity: 0; pointer-events: none; }

.rx-qbuilder {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel3);
}

.rx-qwrap { display: grid; gap: 10px; }
.rx-qwrap[hidden] { display: none; }
.rx-qlist { display: grid; gap: 10px; }

.rx-qrow {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.rx-qrow-main { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 9px; }
.rx-qrow-sub { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rx-qrow-sub > input { flex: 1 1 220px; min-height: 38px; }
.rx-qrow [data-qopts-field][hidden] { display: none; }

.rx-qmove { margin-left: auto; display: inline-flex; gap: 6px; }

.rx-qbtn {
  min-height: 36px;
  min-width: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.rx-qbtn:hover { border-color: var(--accent); color: var(--text); }
.rx-qbtn-del:hover { border-color: var(--red); color: #fca5a5; }
.rx-approw form { flex: none; }

/* ===== Админка: пользователи, роли и чёрный список ===== */
.rx-badge.cyan { background: rgba(56, 189, 248, .14); color: #7dd3fc; border-color: rgba(56, 189, 248, .3); }

/* Сетка галочек «какие разделы видит сотрудник». */
.rx-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

/* Аватар в строке пользователя: тот же размер, что и иконка раздела в маршрутах. */
.rx-route > summary > .rx-avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
}

.rx-route-body .rx-field select:disabled { opacity: .6; cursor: not-allowed; }

/* ===== Селекты каналов и ролей ===== */
.rx-select { position: relative; }

.rx-select > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel3);
  cursor: pointer;
  list-style: none;
}

.rx-select > summary::-webkit-details-marker { display: none; }
.rx-select[open] > summary { border-color: var(--accent); }
.rx-select[open] > summary .rx-caret { transform: rotate(180deg); }
.rx-select-value { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-select-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }

.rx-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

.rx-select-filter {
  width: 100%;
  min-height: 36px;
  margin-bottom: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel3);
  color: var(--text);
  outline: none;
  font-size: 13px;
}

.rx-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.rx-option:hover { background: rgba(255, 255, 255, .05); }
.rx-option input { position: absolute; opacity: 0; pointer-events: none; }

.rx-option-mark {
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel3);
  position: relative;
}

/* Галочка рисуется одинаково и в выпадающих списках (.rx-option), и в обычных чекбоксах (.rx-check). */
.rx-option input:checked + .rx-option-mark,
.rx-check input:checked + .rx-option-mark { border-color: var(--accent); background: var(--accent); }

.rx-option input:checked + .rx-option-mark::after,
.rx-check input:checked + .rx-option-mark::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.rx-option-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-option small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ===== Popup профиля ===== */
.rx-profile-popup {
  position: fixed;
  z-index: 9999;
  width: 300px;
  display: none;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .6);
}

.rx-profile-popup.open { display: block; }
.rx-pp-loading { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.rx-pp-head { display: flex; gap: 11px; align-items: center; }
.rx-pp-head img { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.rx-pp-head b { font-size: 14px; }
.rx-pp-id { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.rx-pp-access {
  display: inline-block;
  margin-top: 5px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(88, 101, 242, .25);
  color: #cdd5ff;
}

.rx-pp-facts { margin-top: 12px; display: grid; gap: 6px; }
.rx-pp-fact { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.rx-pp-fact span { color: var(--muted); }
.rx-pp-fact b { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rx-pp-title {
  margin-top: 13px;
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-weight: 800;
}

.rx-pp-roles { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; max-height: 150px; overflow-y: auto; }

.rx-pp-logout {
  display: block;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

.rx-pp-logout:hover { color: var(--majestic); }

/* ===== Закрытый приём заявок ===== */
/* Раздел не исчезает, а гаснет: видно, что форма существует, но сейчас не принимает. */
.rx-tile.closed, .rx-choice.closed, .rx-route.closed > summary {
  opacity: .55;
  filter: grayscale(.5);
}

.rx-tile.closed { pointer-events: none; }
.rx-tile.closed .rx-tile-cta { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.rx-choice.closed { cursor: default; }
.rx-choice.closed:hover { border-color: var(--line); transform: none; }
.rx-route-group.closed { border-color: rgba(239, 68, 68, .35); }
.rx-chead-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== Фильтры: фишки, сгруппированные по смыслу =====
   Полтора десятка бейджей в один ряд не читаются, поэтому каждая группа
   получает свою подпись и свою строку. */
.rx-filters {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(40, 50, 72, .6);
}

.rx-chipgroup {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.rx-chipgroup-title {
  padding-top: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.rx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rx-chips-main .rx-chip { font-size: 12.5px; padding: 6px 13px; }

.rx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel3);
  color: #9fadcb;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color .14s ease, color .14s ease, background .14s ease;
}

.rx-chip:hover { border-color: rgba(88, 101, 242, .5); color: #dbe4ff; }

/* Счётчик внутри фишки: приглушён, чтобы не спорить с названием. */
.rx-chip b {
  font-weight: 800;
  font-size: 11px;
  color: var(--muted);
  opacity: .85;
}

.rx-chip.active { background: var(--panel2); color: var(--text); border-color: rgba(88, 101, 242, .55); }
.rx-chip.active b { color: inherit; opacity: .7; }
.rx-chip.active.green { border-color: rgba(34, 197, 94, .5); color: #86efac; background: rgba(34, 197, 94, .1); }
.rx-chip.active.red { border-color: rgba(239, 68, 68, .5); color: #fca5a5; background: rgba(239, 68, 68, .1); }
.rx-chip.active.yellow { border-color: rgba(234, 179, 8, .5); color: #fde047; background: rgba(234, 179, 8, .1); }
.rx-chip.active.cyan { border-color: rgba(56, 189, 248, .5); color: #7dd3fc; background: rgba(56, 189, 248, .1); }

/* Строка поиска повторяет сетку групп фильтра: подпись слева, поле тянется,
   кнопки прижаты справа. Раньше это была сетка из двух колонок с подписью НАД
   полем — кнопка растягивалась на высоту подписи вместе с полем, отсюда её
   нелепый рост, а сама строка не совпадала с колонкой фишек. */
.rx-searchbar {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.rx-searchbar input[type=text] { min-height: 40px; }
.rx-searchbar .rx-actions { flex: none; }
.rx-searchbar .rx-btn { min-height: 40px; }

/* Пагинация висела вплотную к последней строке списка. */
.rx-pager {
  justify-content: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(40, 50, 72, .6);
}

.rx-pager .rx-hint { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ===== Все заявки ===== */
.rx-app-actions { margin-top: 4px; }

/* Заявки разложены по разделам: сплошная лента из девяти типов подряд
   не даёт понять, что именно ждёт решения. */
.rx-appgroups { display: grid; gap: 18px; }
.rx-appgroup { display: grid; gap: 10px; }

.rx-appgroup-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(40, 50, 72, .7);
}

.rx-appgroup-head h3 { margin: 0; font-size: 14.5px; font-weight: 800; }
.rx-appgroup-head .rx-stat-ico { width: 28px; height: 28px; border-radius: 8px; }
.rx-appgroup-head .rx-stat-ico svg { width: 15px; height: 15px; }
.rx-appgroup-count { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.rx-appgroup-head .rx-chip { margin-left: auto; }

/* Шапка раскрытой заявки: служебные поля в строку, без вертикальной простыни. */
.rx-appfacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(40, 50, 72, .6);
}

.rx-appfact {
  display: grid;
  gap: 3px;
  flex: 1 1 190px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel3);
}

.rx-appfact > span { color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.rx-appfact > b { font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.rx-appfact code { font-family: Consolas, "JetBrains Mono", monospace; font-size: 11.5px; color: var(--muted); }

/* Ответы: подпись вопроса сверху, ответ снизу.
   В одну строку «label — value» длинные ответы жались к правому краю
   и читались хуже самой формы, которую заполнял сотрудник. */
/* Отступ сверху не нужен: .rx-route-body — grid со своим gap. */
.rx-answers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.rx-answer {
  display: grid;
  gap: 5px;
  align-content: start;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 2px solid rgba(88, 101, 242, .5);
  border-radius: 10px;
  background: var(--panel3);
}

/* Развёрнутый ответ занимает всю ширину: причину или объяснение обрезать негде. */
.rx-answer.long { grid-column: 1 / -1; }

.rx-answer > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

.rx-answer > span em { color: var(--yellow); font-style: normal; font-weight: 700; font-size: 10.5px; }

.rx-answer p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rx-answer .rx-answer-empty { color: var(--muted); font-style: italic; }
/* У бейджей задан display, поэтому атрибут hidden сам по себе их не скрывает. */
.rx-badge[hidden] { display: none; }

/* Подсветка строки, статус которой только что прилетел по /api/stream. */
.rx-app-updated { animation: rx-flash 2.4s ease-out; }

@keyframes rx-flash {
  0% { background: rgba(88, 101, 242, .28); }
  100% { background: transparent; }
}

/* ===== Индикатор перехода между страницами ===== */
/* Уходящую страницу гасим, а не прячем: резкая подмена содержимого читается как «моргнуло». */
.rx-sidebar,
.rx-main,
.rx-auth {
  transition: opacity .22s ease, transform .22s ease, filter .22s ease;
}

body.rx-ready .rx-main,
body.rx-ready .rx-auth { animation: rx-page-in .24s ease both; }

body.rx-leaving .rx-sidebar,
body.rx-leaving .rx-main,
body.rx-leaving .rx-auth {
  opacity: .42;
  transform: translateY(5px) scale(.998);
  filter: blur(.4px);
}

@keyframes rx-page-in {
  from { opacity: 0; transform: translateY(8px); filter: blur(1px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Выше всего остального, включая попап профиля на 9999. */
.rx-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: radial-gradient(circle at 50% 46%, rgba(88, 101, 242, .18), rgba(9, 11, 16, .56) 42%, rgba(9, 11, 16, .72));
  backdrop-filter: blur(5px);
  transition: opacity .18s ease, visibility .18s ease;
}

.rx-loader.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.rx-loader-card {
  min-width: 140px;
  padding: 18px 20px 16px;
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid rgba(88, 101, 242, .38);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel), var(--panel3));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255, 255, 255, .06);
  transform: translateY(8px) scale(.96);
  transition: transform .22s ease;
}

.rx-loader.active .rx-loader-card { transform: none; }

.rx-loader-ring {
  position: relative;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 0 24px rgba(88, 101, 242, .22);
}

.rx-loader-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 3px solid rgba(88, 101, 242, .22);
  border-top-color: var(--majestic);
  border-right-color: var(--accent);
  animation: rx-loader-spin 1s linear infinite;
}

.rx-loader-ring img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  animation: rx-loader-pulse 1.25s ease-in-out infinite;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, .35));
}

.rx-loader-text {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .88;
}

@keyframes rx-loader-spin { to { transform: rotate(360deg); } }

@keyframes rx-loader-pulse {
  0%, 100% { transform: scale(.96); }
  50% { transform: scale(1.04); }
}

/* Кому анимации мешают — оставляем сам факт индикатора, но без движения. */
@media (prefers-reduced-motion: reduce) {
  .rx-sidebar,
  .rx-main,
  .rx-auth,
  .rx-loader,
  .rx-loader-card,
  .rx-loader-ring::before,
  .rx-loader-ring img,
  .rx-app-updated {
    transition: none !important;
    animation: none !important;
  }

  body.rx-leaving .rx-sidebar,
  body.rx-leaving .rx-main,
  body.rx-leaving .rx-auth {
    transform: none;
    filter: none;
  }
}

/* ===== Адаптив ===== */
@media (max-width: 1080px) {
  .rx-cols { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .rx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rx-grid, .rx-choice-grid, .rx-route-grid { grid-template-columns: 1fr; }
  .rx-pill-link { max-width: 44vw; }
  /* Подпись группы фильтров уезжает над фишками — колонка в 108px съедала половину экрана. */
  .rx-chipgroup { grid-template-columns: 1fr; gap: 7px; }
  .rx-chipgroup-title { padding-top: 0; }
  .rx-searchbar { grid-template-columns: 1fr; align-items: stretch; gap: 8px; }
  .rx-searchbar .rx-btn { flex: 1 1 auto; }
}

@media (max-width: 760px) {
  .rx-burger { display: flex; }
  .rx-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform .26s ease;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  }
  body.rx.nav-open .rx-sidebar { transform: translateX(0); }
  .rx-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .26s;
  }
  body.rx.nav-open .rx-backdrop { opacity: 1; pointer-events: auto; }
  body.rx.nav-open { overflow: hidden; }
  .rx-content { padding: 18px 15px 32px; }
  .rx-topbar { padding: 0 14px; }
  .rx-uname, .rx-urole { display: none; }
  .rx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rx-profile-popup { width: min(300px, calc(100vw - 24px)); }
}

@media (max-width: 560px) {
  .rx-stats { grid-template-columns: 1fr; }
  /* На узком экране в шапке оставляем только плашку сервера — она кликабельная и важнее статуса бота. */
  .rx-tleft > .rx-pill:not(.rx-pill-link) { display: none; }
  .rx-pill-link { max-width: none; flex: 1 1 auto; }
  .rx-logout { display: none; }
  .rx-approw { flex-direction: column; align-items: flex-start; }
  .rx-fact { flex-direction: column; align-items: flex-start; gap: 4px; }
  .rx-fact > b { text-align: left; }
  .rx-answers { grid-template-columns: 1fr; }
  .rx-appgroup-head .rx-chip { margin-left: 0; }
}
