/* ============================================================
   Obelysk Admin — Тёмная тема
   Базовые: тёмно-серый (#1a1d24), белый / светло-серый текст
   Палитра акцентов (ColorHunt):
     #CAF900 — лайм (позитив, успех, активные статусы)
     #EEFDB7 — кремовый (светлый текст, мягкие фоны)
     #FFB2D4 — нежно-розовый (предупреждения, истечение)
     #E90060 — глубокий пурпур (основной акцент, опасности)
   ============================================================ */

/* ---------- Переменные ---------- */
:root {
  /* Фоны - более тёмные */
  --bg-app: #0a0c10;          /* почти чёрный */
  --bg-sidebar: #0d0f14;
  --bg-card: #111319;
  --bg-card-hover: #181a20;
  --bg-input: #1a1d24;
  --bg-overlay: rgba(0, 0, 0, 0.75);

  /* Текст */
  --text-primary: #f0f1f4;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Границы */
  --border: #1f2937;
  --border-light: #2d3748;

  /* Акценты — палитра ColorHunt */
  --accent: #E90060;            /* красный — опасные действия, удаление, отключение */
  --accent-hover: #ff1a78;
  --accent-dim: rgba(233, 0, 96, 0.15);
  --accent-green: #CAF900;      /* лайм — успех, активные статусы, кнопки подтверждения */
  --accent-green-hover: #d4f900;
  --accent-green-dim: rgba(202, 249, 0, 0.12);
  --accent-cream: #EEFDB7;      /* кремовый — светлый текст/иконки */
  --accent-cream-dim: rgba(238, 253, 183, 0.10);
  --accent-pink: #FFB2D4;       /* нежно-розовый — предупреждения */
  --accent-pink-dim: rgba(255, 178, 212, 0.12);
  --accent-blue: #6c9eff;       /* синий — информация */
  --accent-blue-dim: rgba(108, 158, 255, 0.12);
  /* Обратная совместимость (старые имена) */
  --accent-yellow: #FFB2D4;
  --accent-yellow-dim: rgba(255, 178, 212, 0.12);

  /* Статусы */
  --status-active: #CAF900;
  --status-pending: #FFB74D;
  --status-danger: #E90060;
  --status-info: #6c9eff;

  /* Радиусы */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* Тени */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);

  /* Прочее */
  --sidebar-w: 250px;
  --transition: 0.2s ease;
}

/* ---------- Сброс ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ---------- Скроллбар ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   Сайдбар
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo {
  font-size: 28px;
  line-height: 1;
}

.sidebar__brand-text strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-cream);
}

.sidebar__brand-text small {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.sidebar__nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-link.active svg {
  color: var(--accent);
}

.sidebar__footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--online {
  background: var(--status-active);
  box-shadow: 0 0 6px var(--status-active);
}

.status-dot--offline {
  background: var(--status-danger);
}

.status-dot--pending {
  background: var(--status-pending);
}

.sidebar__theme-toggle {
  display: none;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 99;
}

/* ============================================================
   Основная область
   ============================================================ */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__menu {
  display: none;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.topbar__menu:hover {
  background: var(--bg-card);
}

.topbar__title {
  font-size: 1.25rem;
  font-weight: 600;
  flex: 1;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__env {
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.topbar__env.env-production {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.content {
  padding: 28px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* ============================================================
   Карточки и сетки
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.card__title {
  font-size: 1.05rem;
  font-weight: 600;
}

.card__subtitle {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-top: 2px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid--stats {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

/* ---------- KPI карточки ---------- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
}

.stat-card--green::before {
  background: var(--accent-green);
}

.stat-card--yellow::before {
  background: var(--accent-yellow);
}

.stat-card--blue::before {
  background: var(--accent-blue);
}

.stat-card__icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.stat-card__label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-card__hint {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 6px;
}

/* ============================================================
   Таблицы
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ============================================================
   Бейджи и метки
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--active {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.badge--pending {
  background: rgba(255, 183, 77, 0.15);
  color: var(--status-pending);
}

.badge--cancelled,
.badge--failed,
.badge--banned {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge--expired,
.badge--paused {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.badge--completed,
.badge--refunded {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

.badge--neutral {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.badge--processing {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

/* ============================================================
   Кнопки
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent-green);
  color: #0a0c10;
  font-weight: 600;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-green-hover);
}

.btn--secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--border-light);
}

.btn--danger {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn--danger:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--success {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.btn--success:hover:not(:disabled) {
  background: var(--accent-green);
  color: #0a0c10;
}

.btn--ghost {
  color: var(--text-secondary);
}

.btn--ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn--icon {
  padding: 7px;
  width: 34px;
  height: 34px;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Формы
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  flex-shrink: 0;
  border: 1.5px solid var(--border, #3f3f46);
  border-radius: 4px;
  background: var(--bg-hover, #1f2228);
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  accent-color: var(--accent, #e90060);
}

input[type="checkbox"]:hover {
  border-color: var(--accent, #e90060);
}

input[type="checkbox"]:checked {
  background: var(--accent, #e90060);
  border-color: var(--accent, #e90060);
}

input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent-pink, #ffb2d4);
  outline-offset: 2px;
}

.user-row-checkbox {
  margin: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.checkbox-row label {
  margin: 0;
  color: var(--text-primary);
  cursor: pointer;
}

/* ---------- Панель фильтров ---------- */
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 18px;
}

.filters .form-group {
  margin: 0;
  min-width: 160px;
}

.filters input,
.filters select {
  min-width: 160px;
}

/* ---------- Поле поиска ---------- */
.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-box input {
  padding-left: 38px;
}

.search-box::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M15.5 14h-.79l-.28-.27a6.5 6.5 0 1 0-.7.7l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0A4.5 4.5 0 1 1 14 9.5 4.5 4.5 0 0 1 9.5 14z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

/* ============================================================
   Пагинация
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination__info {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.pagination__controls {
  display: flex;
  gap: 6px;
}

/* ============================================================
   Массовые действия
   ============================================================ */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bulk-actions__info {
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
}

.bulk-actions__buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   Лоадеры
   ============================================================ */
.loader {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loader--lg {
  width: 40px;
  height: 40px;
  margin: 80px auto;
  border-width: 4px;
}

.loader--page {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}

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

/* ============================================================
   Тосты
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: slideIn 0.3s ease;
  border-left: 3px solid var(--accent-blue);
}

.toast--success {
  border-left-color: var(--accent-green);
}

.toast--error {
  border-left-color: var(--accent);
}

.toast--warning {
  border-left-color: var(--status-pending);
}

.toast__body {
  flex: 1;
  font-size: 0.86rem;
}

.toast__title {
  font-weight: 600;
  margin-bottom: 2px;
}

.toast__close {
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ============================================================
   Модальные окна
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 150;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

.modal--lg {
  max-width: 720px;
}

.modal--sm {
  max-width: 400px;
}

@keyframes modalIn {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal__title {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal__close {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
}

.modal__close:hover {
  color: var(--text-primary);
}

.modal__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ============================================================
   Drawer (боковая панель деталей)
   ============================================================ */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  max-width: 90vw;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  z-index: 120;
  transform: translateX(100%);
  transition: transform var(--transition);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.drawer.active {
  transform: translateX(0);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  z-index: 1;
}

.drawer__title {
  font-size: 1.1rem;
  font-weight: 600;
}

.drawer__body {
  padding: 24px;
}

/* ---------- Детальные описания ---------- */
.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row__label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-row__value {
  text-align: right;
  word-break: break-word;
  font-weight: 500;
}

.detail-row__value code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ---------- Секция ---------- */
.section {
  margin-bottom: 28px;
}

.section__title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
}

/* ---------- Пустое состояние ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ---------- Ошибка ---------- */
.error-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--accent);
}

.error-state__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

/* ---------- Временная шкала ---------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.timeline-item__dot--green {
  background: var(--accent-green);
}

.timeline-item__dot--blue {
  background: var(--accent-blue);
}

.timeline-item__content {
  flex: 1;
}

.timeline-item__text {
  font-size: 0.86rem;
}

.timeline-item__time {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin-top: 2px;
}

/* ---------- Мини-бар-чарт ---------- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding-top: 10px;
}

.bar-chart__bar {
  flex: 1;
  background: var(--accent-dim);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: background var(--transition);
}

.bar-chart__bar:hover {
  background: var(--accent);
}

.bar-chart__bar--green {
  background: var(--accent-green-dim);
}

.bar-chart__bar--green:hover {
  background: var(--accent-green);
}

/* ---------- Текстовые утилиты ---------- */
.text-muted {
  color: var(--text-muted);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-accent {
  color: var(--accent);
}
.text-green {
  color: var(--accent-green);
}
.text-mono {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
}
.text-right {
  text-align: right;
}
.text-center {
  text-align: center;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ---------- Защищённый контент (до ввода ключа) ---------- */
.lock-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Центрируем по высоте доступной области (без 100vh — учитываем сайдбар/topbar) */
  min-height: calc(100vh - 200px);
  padding: 40px 20px;
  text-align: center;
}

.lock-screen__card {
  max-width: 420px;
  width: 100%;
}

.lock-screen__icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.lock-screen__title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.lock-screen__desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.login-widget {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin: 8px 0 4px;
}

.text-danger {
  color: var(--status-danger, var(--accent));
}

/* ============================================================
   Адаптивность
   ============================================================ */
@media (max-width: 1024px) {
  .grid--2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.open + .sidebar-overlay {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .topbar__menu {
    display: flex;
  }

  .content {
    padding: 18px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters .form-group,
  .filters input,
  .filters select {
    min-width: 100%;
    width: 100%;
  }

  .search-box {
    max-width: 100%;
  }

  .topbar {
    padding: 14px 18px;
  }

  .topbar__title {
    font-size: 1.1rem;
  }

  .stat-card__value {
    font-size: 1.6rem;
  }

  .modal {
    padding: 20px;
  }

  .drawer {
    width: 100%;
  }

  th,
  td {
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .content {
    padding: 14px;
  }

  .card {
    padding: 16px;
  }

  .btn {
    padding: 8px 14px;
  }
}

/* ----- Column sort / filter ----- */
.th-sortable {
  color: var(--text-secondary);
  white-space: nowrap;
}
.th-sortable:hover {
  color: var(--text-primary);
}
.col-filter {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border, #2a2d36);
  border-radius: 4px;
  color: var(--text-primary);
}
.col-filter:focus {
  outline: none;
  border-color: var(--accent, #5b8def);
}

/* ----- Plans layout + DnD sort ----- */
.plans-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.plans-layout__main {
  flex: 1;
  min-width: 0;
}
.plan-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.plan-card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.plan-card .btn-group {
  margin-top: auto;
}
.plan-sort-panel {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border, #2a2d36);
  border-radius: 8px;
  padding: 14px;
  position: sticky;
  top: 16px;
}
.plan-sort-panel__title {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.plan-sort-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--bg-input);
  border-radius: 6px;
  cursor: grab;
  color: var(--text-secondary);
  font-size: 0.86rem;
  user-select: none;
}
.plan-sort-item:active {
  cursor: grabbing;
}
.plan-sort-item.dragging {
  opacity: 0.45;
}
.plan-sort-item.drag-over {
  outline: 1px dashed var(--accent, #5b8def);
}

/* ----- Support full-page chat ----- */
.support-chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 420px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border, #2a2d36);
  overflow: hidden;
}
.support-chat__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #2a2d36);
  background: var(--bg-sidebar);
}
.support-chat__meta {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
.support-chat__thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.support-msg {
  max-width: 75%;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-input);
  font-size: 0.9rem;
}
.support-msg--admin {
  align-self: flex-end;
  background: #1a2740;
  border: 1px solid #2a3f66;
}
.support-msg--user {
  align-self: flex-start;
}
.support-msg__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.support-chat__composer {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #2a2d36);
  background: var(--bg-sidebar);
}
.row--unread td {
  font-weight: 600;
  background: rgba(91, 141, 239, 0.06);
}

@media (max-width: 900px) {
  .plans-layout {
    flex-direction: column;
  }
  .plan-sort-panel {
    width: 100%;
    position: static;
  }
}
