
:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #3b82f6;
  --accent-light: #93c5fd;
  --navy: #1e293b;
  --navy-mid: #334155;
  --navy-light: #475569;
  --secondary-color: #64748b;
  --bg-color: #f1f5f9;
  --white: #FFFFFF;
  --text-muted: #64748b;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --success: #4CAF50;
  --error: #F44336;
  --warning: #FF9800;
  --info: #2196F3;
}

/* ========== 2. БАЗОВЫЕ СТИЛИ ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Inter', 'Roboto', 'Arial', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* ========== 3. КНОПКИ ========== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
  border: 1px solid var(--primary-dark);
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.12);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover {
  background-color: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-danger {
  background-color: var(--error);
  color: var(--white);
}

.btn-danger:hover {
  background-color: #d32f2f;
}

.btn-block {
  width: 100%;
}

.btn-text {
  background: none;
  border: none;
  color: var(--navy-mid);
  cursor: pointer;
  padding: 5px 8px;
  font-size: 13px;
  margin: 0 3px;
  transition: all 0.2s;
}

.btn-text:hover {
  background-color: var(--primary-light);
  border-radius: 4px;
}

.btn-text-danger {
  color: #b71c1c;
}

.btn-text-danger:hover {
  background-color: #ffebee;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 22px;
  cursor: pointer;
  position: relative;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* ========== 4. АВТОРИЗАЦИЯ ========== */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-color);
}

.auth-card {
  background-color: var(--white);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(26, 35, 50, 0.18);
  border: 1px solid var(--gray-200);
  width: 100%;
  max-width: 450px;
  padding: 40px;
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-header .subtitle {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

.logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.brand-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.brand-logo img {
  height: 64px;
  width: auto;
  max-width: 400px;
  object-fit: contain;
  display: block;
}

.auth-logo {
  max-width: 420px;
  width: 100%;
  height: auto;
  margin: 0 auto 24px;
  display: block;
}

.auth-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}

.auth-footer {
  text-align: center;
  color: var(--gray-500);
  font-size: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-200);
}

.info-message {
  background-color: #FFF3E0;
  color: var(--warning);
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  border-left: 4px solid var(--warning);
}

.error-message {
  background-color: #FFEBEE;
  color: var(--error);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
  border-left: 4px solid var(--error);
}

.error-message.hidden,
.success-message.hidden {
  display: none;
}

.success-message {
  background-color: #E8F5E9;
  color: var(--success);
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 20px;
  border-left: 4px solid var(--success);
}

/* ========== 5. HEADER ========== */
.header {
  background: var(--navy);
  color: var(--white);
  padding: 0 28px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.2;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.user-role {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.65);
}

.btn-header {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--white);
}

.btn-header:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.55);
  color: var(--white);
}

.role-badge {
  display: none;
}

/* ========== 6. ДАШБОРД ========== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.main {
  flex: 1;
  overflow: hidden;
  padding: 20px;
  min-height: 0;
}

.main.main--admin {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.workspace {
  display: flex;
  height: 100%;
  gap: 20px;
}

/* ========== 7. ТАБЛИЦА ЗАЯВОК ========== */
.tickets-panel {
  flex: 1;
  background-color: var(--white);
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(26, 35, 50, 0.08);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--gray-800);
}

.filter-tabs {
  display: flex;
  gap: 5px;
}

.filter-tab {
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  transition: all 0.2s;
}

.filter-tab:hover {
  border-color: var(--navy-light);
  color: var(--navy);
}

.filter-tab.active {
  background-color: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.tickets-table-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
}

.tickets-table thead {
  position: sticky;
  top: 0;
  background-color: var(--white);
  z-index: 10;
}

.tickets-table th {
  text-align: left;
  padding: 15px 10px;
  border-bottom: 2px solid var(--gray-300);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--gray-700);
}

.tickets-table td {
  padding: 15px 10px;
  border-bottom: 1px solid var(--gray-200);
  cursor: pointer;
}

.tickets-table tbody tr:hover {
  background-color: var(--gray-50);
}

.tickets-table tbody tr.active {
  background-color: var(--primary-light);
  border-left: 3px solid var(--primary-color);
}

/* ========== 8. ЧАТ ========== */
.chat-panel {
  width: 400px;
  background-color: var(--white);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(58, 77, 170, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 500px;
  flex-shrink: 0;
}

.chat-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(135deg, var(--primary-light) 0%, #f3f6ff 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

.chat-header .icon-btn {
  color: var(--gray-700);
}

.chat-header .icon-btn:hover {
  background-color: rgba(52, 81, 216, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background-color: #f8faff;
}

.chat-placeholder {
  text-align: center;
  color: var(--gray-500);
  padding: 40px 20px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.message.sent {
  align-self: flex-end;
}

.message.received {
  align-self: flex-start;
}

.message.bot {
  align-self: flex-start;
}

.message-content {
  padding: 12px 15px;
  border-radius: 18px;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.4;
}

.message.sent .message-content {
  background-color: var(--primary-color);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.message.received .message-content {
  background-color: var(--white);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.bot .message-content {
  background-color: #e8eeff;
  color: var(--gray-800);
  border-bottom-left-radius: 4px;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-top: 5px;
  color: var(--gray-600);
  padding: 0 5px;
}

.message.sent .message-meta {
  justify-content: flex-end;
}

.message-sender {
  font-weight: 500;
}

.message-time {
  margin-left: 10px;
}

.message-files {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.file-attachment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 12px;
  color: inherit;
  text-decoration: none;
}

.message.received .file-attachment,
.message.bot .file-attachment {
  background-color: var(--gray-100);
}

.typing-indicator {
  padding: 8px 20px;
  color: var(--gray-600);
  font-style: italic;
  font-size: 13px;
  background-color: #f9f9f9;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.chat-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--gray-200);
  background-color: var(--white);
  flex-shrink: 0;
}

.chat-footer textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  resize: vertical;
  margin-bottom: 12px;
  font-size: 14px;
  font-family: inherit;
}

.chat-footer textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.1);
}

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

#needHumanBtn {
  background: transparent;
  border: 1px solid #1d7f4e;
  color: #1d7f4e;
}

#needHumanBtn:hover {
  background: #1d7f4e;
  color: var(--white);
}

#clearChatBtn {
  border-color: #8b95ad;
  color: #4a5674;
}

/* ========== 9. ПРИВЕТСТВЕННЫЙ ЭКРАН (FAQ) ========== */
.welcome-screen {
  padding: 14px 16px;
  max-height: 220px;
  overflow-y: auto;
  background: #fcfdff;
  border-bottom: 1px solid var(--gray-200);
}

.welcome-header {
  text-align: center;
  margin-bottom: 12px;
}

.welcome-header h4 {
  font-size: 18px;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.welcome-header p {
  color: var(--gray-600);
  font-size: 14px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.faq-item {
  padding: 10px 12px;
  background: #f4f7ff;
  border: 1px solid #d8e1ff;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray-800);
}

.faq-item:hover {
  background: var(--primary-light);
  border-color: var(--primary-dark);
}

.custom-question {
  border-top: 1px solid var(--gray-200);
  padding-top: 20px;
}

.custom-question p {
  margin-bottom: 12px;
  color: var(--gray-700);
}

.custom-question-input {
  display: flex;
  gap: 10px;
}

.custom-question-input input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
}

.custom-question-input input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* ========== 10. СТАТУСЫ ========== */
.status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  display: inline-block;
}

.status-new {
  background-color: #E3F2FD;
  color: #1565C0;
}

.status-progress {
  background-color: #FFF3E0;
  color: #E65100;
}

.status-completed {
  background-color: #E8F5E9;
  color: #2E7D32;
}

.status-canceled {
  background-color: #FFEBEE;
  color: #C62828;
}

.deadline-date {
  display: block;
  font-weight: 500;
}

.deadline-hint {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.deadline-overdue,
.deadline-hint.deadline-overdue {
  color: #c62828;
}

.deadline-soon,
.deadline-hint.deadline-soon {
  color: #e65100;
}

.row-urgency-overdue {
  background: #fff5f5;
}

.row-urgency-soon {
  background: #fffaf0;
}

.panel-header-stack {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.panel-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.sort-label {
  font-size: 13px;
  color: var(--text-muted, #666);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-select {
  padding: 6px 10px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  font-size: 13px;
}

.urgency-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.urgency-chip {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.urgency-overdue {
  background: #ffebee;
  color: #b71c1c;
}

.urgency-soon {
  background: #fff3e0;
  color: #e65100;
}

/* ========== 11. МОДАЛЬНЫЕ ОКНА ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: var(--white);
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-header .close-modal {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray-600);
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========== 12. ФОРМЫ ========== */
.form-group {
  margin-bottom: 20px;
  padding: 0 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: 14px;
}

/* ========== 13. УВЕДОМЛЕНИЯ ========== */
.notifications-wrapper {
  position: relative;
}

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: var(--error);
  color: var(--white);
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 380px;
  max-width: 90vw;
  background-color: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
}

.notifications-dropdown.hidden {
  display: none;
}

.dropdown-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--white);
}

.dropdown-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
}

.notifications-list {
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: background-color 0.2s;
}

.notification-item:hover {
  background-color: var(--gray-50);
}

.notification-item.unread {
  background-color: var(--primary-light);
  border-left: 3px solid var(--primary-color);
}

.notification-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.notification-message {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 6px;
  line-height: 1.4;
}

.notification-time {
  font-size: 12px;
  color: var(--gray-500);
}

.notification-ticket {
  font-size: 12px;
  color: var(--navy-mid);
  font-weight: 500;
  margin-bottom: 4px;
}

.notification-empty small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.unread-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary-color);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--gray-500);
}

.notification-empty span {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ========== 14. АДМИН-ПАНЕЛЬ ========== */
.admin-panel {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
  gap: 0;
}

.admin-sidebar {
  width: 250px;
  background-color: var(--navy);
  border-right: none;
  padding: 20px 0;
}

.admin-nav {
  display: flex;
  flex-direction: column;
}

.nav-item {
  padding: 15px 20px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background-color: var(--navy-light);
  color: var(--white);
}

.nav-item.active {
  background-color: var(--navy-light);
  color: var(--white);
  border-left-color: var(--accent);
  font-weight: 600;
}

.admin-content {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--bg-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

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

.stat-card {
  background-color: var(--white);
  padding: 25px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.06);
  text-align: center;
}

.stat-card h3 {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--navy);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.page-header h2 {
  font-size: 24px;
  color: var(--gray-800);
  margin: 0;
}

.filters {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  align-items: flex-end;
  margin-bottom: 8px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.filter-field--grow {
  flex: 1;
  min-width: 220px;
}

.filter-field--actions {
  min-width: auto;
  justify-content: flex-end;
}

.filter-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-results-bar {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--gray-600);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}

.filter-select {
  padding: 10px 15px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background-color: var(--white);
  min-width: 180px;
}

.search-input {
  flex: 1;
  min-width: 250px;
  padding: 10px 15px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}

.table-wrapper {
  overflow-x: auto;
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background-color: var(--gray-100);
}

.data-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 13px;
  text-transform: uppercase;
  border-bottom: 2px solid var(--gray-300);
}

.data-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--gray-200);
}

.data-table tbody tr:hover {
  background-color: var(--gray-50);
}

/* История */
.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.history-action {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 5px;
}

.history-details {
  color: var(--gray-600);
  font-size: 13px;
  margin-bottom: 5px;
}

.history-user {
  color: var(--primary-dark);
  font-size: 12px;
  display: inline-block;
}

.history-time {
  color: var(--gray-500);
  font-size: 12px;
  float: right;
}

/* Отчёты */
.reports-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.report-section {
  background-color: var(--white);
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.report-section h3 {
  margin-bottom: 20px;
  color: var(--gray-800);
}

.report-filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.report-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.report-result {
  margin-top: 20px;
}
/* Отчёты */
.report-filters {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 30px;
  flex-wrap: wrap;
  background: var(--white);
  padding: 20px;
  border-radius: 8px;
}

.report-filters .form-group {
  margin-bottom: 0;
  padding: 0;
  min-width: 180px;
}

.report-stats {
  margin-bottom: 30px;
}

.report-stats h3 {
  margin-bottom: 20px;
  color: var(--gray-800);
}

.report-stats .stats-grid {
  grid-template-columns: repeat(5, 1fr);
}

.report-stats .stat-card {
  padding: 20px;
}

.report-stats .stat-card h4 {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 10px;
}

.report-stats .stat-value {
  font-size: 32px;
}

@media (max-width: 1024px) {
  .report-stats .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .report-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .report-filters .form-group {
    width: 100%;
  }
  
  .report-stats .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* ========== 15. АДАПТИВНОСТЬ ========== */
@media (max-width: 1024px) {
  .workspace {
    flex-direction: column;
  }
  
  .chat-panel {
    width: 100%;
    height: 400px;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 15px;
    height: 60px;
  }
  
  .logo {
    font-size: 20px;
  }
  
  .auth-card {
    padding: 20px;
  }
  
  .admin-panel {
    flex-direction: column;
  }
  
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .nav-item {
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  
  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--primary-color);
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .filters {
    flex-direction: column;
  }
  
  .search-input {
    width: 100%;
  }
  
  .chat-actions {
    flex-wrap: wrap;
  }
  
  .custom-question-input {
    flex-direction: column;
  }
  
  .panel-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .filter-tabs {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .tickets-table th:nth-child(4),
  .tickets-table td:nth-child(4) {
    display: none;
  }
  
  .user-name {
    display: none;
  }
}

/* ========== Страница входа: #1e293b, логотип сверху, форма по центру ========== */
body.login-page {
  margin: 0;
  min-height: 100vh;
  background: #1e293b;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #1e293b;
}

.login-screen-header {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 48px 24px 0;
}

.login-screen-logo {
  width: min(60vw, 400px);
  max-height: 120px;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-screen-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 48px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: 32px 36px 36px;
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-mid);
}

.login-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 16px;
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.login-field input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-error {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

.login-error.hidden {
  display: none;
}

.login-submit {
  margin-top: 4px;
  padding: 15px 16px;
  font-size: 14px;
  border-radius: 6px;
  text-transform: none;
  letter-spacing: 0.02em;
}

@media (min-width: 768px) {
  .login-screen-header {
    padding-top: 56px;
  }

  .login-screen-logo {
    max-height: 200px;
    max-width: 580px;
  }

  .login-box {
    padding: 36px 44px 40px;
  }
}

@media (max-width: 480px) {
  .login-screen-header {
    padding-top: 36px;
  }

  .login-screen-logo {
    max-height: 110px;
  }

  .login-screen-main {
    padding: 24px 16px 36px;
  }

  .login-box {
    padding: 28px 22px 30px;
  }
}

/* ========== Чат: подсказка и чипы FAQ ========== */
.chat-hint {
  padding: 8px 16px 0;
  margin: 0;
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.4;
}

.chat-faq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--gray-200);
  background: #fafbff;
}

.chat-faq-chips.hidden {
  display: none;
}

.faq-chip {
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-800);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.faq-chip:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.chat-header .chat-close {
  color: var(--gray-700);
}

.ticket-details-body {
  padding: 20px;
}

.ticket-files-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.ticket-files-list a {
  color: var(--primary-dark);
}

.ticket-files-badge {
  font-size: 12px;
  color: var(--gray-600);
  font-weight: 500;
}

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

.table-actions-legend {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--gray-600);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.table-actions-legend span {
  white-space: nowrap;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.admin-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.admin-action span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.relation-group .relation-search {
  width: 100%;
  margin-bottom: 6px;
}

.relation-clear {
  margin-top: 4px;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-height: 28px;
}

.selected-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-light, #eff6ff);
  border: 1px solid var(--primary-color, #2563eb);
  border-radius: 999px;
  font-size: 13px;
}

.selected-chips .chip button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--gray-600);
  padding: 0 2px;
}

.relation-group.hidden {
  display: none;
}