:root {
  /* Базовые цвета фона */
  --bg0: #060913;
  --bg1: #0A0F1D;

  /* Эффекты стекла (Glassmorphism) */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.1); /* Тонкий блик сверху */
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

  /* Текст */
  --text: #F1F5FD;
  --muted: rgba(241, 245, 253, 0.6);

  /* Акценты (сделал чуть мягче и современеннее) */
  --accent1: #8B5CF6; /* Глубокий фиолетовый */
  --accent2: #06B6D4; /* Электрический циан */
  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #EF4444;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;

  /* Интеграция с Bootstrap (если используется) */
  --bs-body-bg: transparent;
  --bs-body-color: var(--text);
  --bs-border-color: var(--glass-border);
  --bs-primary: var(--accent1);
}

/* =========================================
   БАЗОВЫЕ НАСТРОЙКИ
   ========================================= */
html, body { height: 100%; margin: 0; }

body {
  color: var(--text);
  background: 
    radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.15), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(6, 182, 212, 0.15), transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(16, 185, 129, 0.08), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Легкий паттерн на фоне для текстуры */
.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: url('data:image/svg+xml;utf8,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="1" fill="rgba(255,255,255,0.03)"/></svg>');
}

/* =========================================
   УТИЛИТЫ И КАРКАС
   ========================================= */
.text-muted, .text-body-secondary { color: var(--muted) !important; }
.min-w-0 { min-width: 0; }
.value-break { overflow-wrap: anywhere; word-break: break-word; }

.a-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.a-main { min-width: 0; padding: 32px; }
.a-container { max-width: 1200px; margin: 0 auto; }

/* =========================================
   БОКОВЫЕ ПАНЕЛИ (Сайдбары)
   ========================================= */
.a-rail, .b-side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  background: rgba(10, 15, 29, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  box-shadow: 1px 0 24px rgba(0,0,0,0.1);
}

.a-brand, .b-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3), var(--glass-highlight);
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.a-brand:hover, .b-logo:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(139, 92, 246, 0.4), var(--glass-highlight);
}

.b-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

.b-title { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.5px; }
.b-sub { font-size: 0.8rem; color: var(--muted); }

/* Навигация */
.a-nav, .b-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.a-nav a, .a-nav-btn, .b-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-weight: 500;
}

.a-nav a i, .b-item i { font-size: 1.2rem; opacity: 0.8; transition: opacity 0.2s; }

.a-nav a:hover, .a-nav-btn:hover, .b-item:hover, .b-logout-btn:hover {
  color: #fff;
  background: var(--glass-bg-hover);
  border-color: var(--glass-border);
}

.a-nav a.active, .b-item.is-active {
  color: #fff;
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.1);
}
.a-nav a.active i, .b-item.is-active i { opacity: 1; color: var(--accent2); }

/* =========================================
   СТЕКЛЯННЫЕ КОМПОНЕНТЫ (Карточки, таблицы)
   ========================================= */
.card-glass, .navbar-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  border-radius: var(--radius-xl);
}

.table { margin: 0; color: var(--text); }
.card-glass .table-responsive {
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.card-glass .table thead th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--glass-border);
  padding: 16px;
}
.card-glass .table tbody td {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
.card-glass .table tbody tr { transition: background 0.2s ease; }
.card-glass .table tbody tr:hover { background: var(--glass-bg-hover); }

/* =========================================
   КНОПКИ И ФОРМЫ
   ========================================= */
.btn {
  border-radius: var(--radius-md);
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 20px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent1), var(--accent2));
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3), var(--glass-highlight);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5), var(--glass-highlight);
  filter: brightness(1.1);
}

.btn-outline-light {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--text);
  backdrop-filter: blur(10px);
}
.btn-outline-light:hover { background: var(--glass-bg-hover); color: #fff; }

.form-control, .form-select, .chat-input {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: all 0.3s ease;
}
.form-control:focus, .form-select:focus, .chat-input:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--accent1);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
  outline: none;
}

/* =========================================
   ЧАТ И ТИКЕТЫ
   ========================================= */
.ticket-item {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.2s ease;
}
.ticket-item:hover {
  background: var(--glass-bg-hover);
  padding-left: 24px; /* Легкий сдвиг при наведении */
}

.chat {
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
}

.chat-messages {
  padding: 24px;
  height: min(65vh, 700px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg { display: flex; gap: 16px; align-items: flex-end; }
.chat-msg--me { flex-direction: row-reverse; }

.chat-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.chat-avatar--user { background: rgba(139, 92, 246, 0.2); border: 1px solid var(--accent1); color: #fff; }
.chat-avatar--support { background: rgba(6, 182, 212, 0.2); border: 1px solid var(--accent2); color: #fff; }

.chat-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  line-height: 1.5;
}
.chat-msg--me .chat-bubble {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.1));
  border-color: rgba(139, 92, 246, 0.3);
  border-bottom-right-radius: 4px;
}
.chat-msg:not(.chat-msg--me) .chat-bubble {
  border-bottom-left-radius: 4px;
}

/* =========================================
   СКРОЛЛБАРЫ И АНИМАЦИИ
   ========================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-msg.is-new { animation: msgIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

/* =========================================
   АДАПТИВНОСТЬ (Mobile)
   ========================================= */
@media (max-width: 991px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-rail, .b-side { display: none; } /* Можно вернуть твою нижнюю панель, если нужна */
  .a-main { padding: 16px; padding-bottom: 100px; }
  .chat-bubble { max-width: 90%; }
}

/* =====================================================================
   ДОБАВКИ / HOTFIX (ничего не ломают твою тему, только чинят кривизну)
   ===================================================================== */

/* --- Sidebar: чтобы "Выйти" был красивым и всегда внизу --- */
.b-side{ display:flex; flex-direction:column; }
.b-nav{ flex:1; min-height:0; }
.b-spacer{ flex: 1 1 auto; }

.b-logout{ margin: 8px 0 0; }
.b-logout-btn{
  width:100%;
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  text-align:left;
}
.b-logout-btn i{ font-size:1.2rem; opacity:.85; }

/* --- Ticket list: выравнивание #id / тема / стрелка --- */
.ticket-list{ display:block; }
.ticket-item-id{
  min-width: 64px;
  font-weight: 800;
  letter-spacing: .3px;
  color: rgba(241,245,253,.85);
}
.ticket-item-main{ flex: 1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.ticket-item-subject{ font-weight: 800; line-height: 1.2; }
.ticket-item-meta{ display:flex; align-items:center; flex-wrap:wrap; gap:10px; font-size:.9rem; }
.ticket-item-meta .dot{ opacity:.5; }
.ticket-item-action{ opacity:.6; flex: 0 0 auto; }
.ticket-item:hover .ticket-item-action{ opacity: 1; }

/* Поиск в списке тикетов (иконка внутри поля) */
.ticket-search{ position:relative; min-width: 260px; }
.ticket-search > i{ position:absolute; left:12px; top:50%; transform:translateY(-50%); opacity:.75; pointer-events:none; }
.ticket-search input{ padding-left: 38px; border-radius: 999px; }

/* --- Chat composer: чтобы кнопки и подсказка не уезжали --- */
.chat-composer{
  padding: 16px;
  background: rgba(0,0,0,.18);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-form-row{ display:flex; gap:12px; align-items:flex-end; }
.chat-form-row .chat-input{ flex:1; min-width:0; resize:none; }
.chat-actions{ display:flex; gap:10px; align-items:center; flex:0 0 auto; }

.chat-hint{
  margin-top: 10px;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.3;
}

/* Спиннер НЕ должен быть виден сразу */
.send-spin{ display:none; }
.chat-form.is-sending [data-send-btn]{ pointer-events:none; opacity:.9; }
.chat-form.is-sending .send-label{ display:none; }
.chat-form.is-sending .send-spin{ display:inline-flex; align-items:center; }

@media (max-width: 520px){
  .ticket-search{ min-width: 180px; }
  .chat-form-row{ flex-wrap:wrap; }
  .chat-actions{ width:100%; justify-content:flex-end; }
}

/* --- File drop (Создать тикет): красивее + чтобы кнопка-ссылка была читабельной --- */
.file-drop{
  background: rgba(0,0,0,.18);
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.file-drop.is-dragover{
  background: rgba(139,92,246,.12);
  border-color: rgba(139,92,246,.35);
}
.file-drop-head{ display:flex; gap:14px; align-items:flex-start; }
.file-drop-icon{
  width: 42px; height: 42px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--glass-border);
}
.file-drop-title{ font-weight: 800; margin-bottom: 2px; }
.file-drop-text{ color: rgba(241,245,253,.78); font-size: .95rem; }
.file-drop [data-file-browse].btn.btn-link{
  color: rgba(241,245,253,.95);
  text-decoration: underline;
  text-decoration-color: rgba(6,182,212,.55);
}
.file-drop [data-file-browse].btn.btn-link:hover{
  color:#fff;
  text-decoration-color: rgba(6,182,212,1);
}

/* Chips со списком файлов */
.file-list{ display:flex; flex-wrap:wrap; gap:8px; }
.file-chip{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}
.file-chip i{ opacity:.85; }
.file-chip-name{ max-width: 220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file-chip-size{ color: rgba(241,245,253,.65); font-size: .85rem; }
.file-chip-remove{
  border: none;
  background: transparent;
  color: rgba(241,245,253,.75);
  display:flex;
  align-items:center;
  justify-content:center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
}
.file-chip-remove:hover{ background: rgba(255,255,255,.08); color:#fff; }

/* Bootstrap btn-link иногда становится синим, возвращаем в тему только внутри file-drop */

