/**
 * Common Styles - Dark Theme
 * 
 * Единая темная тема для всех админ-панелей
 */

/* CSS Variables для темной темы */
:root {
  /* Цвета фона */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --bg-active: #1f6feb;
  
  /* Цвета текста */
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-inverse: #0d1117;
  
  /* Цвета границ */
  --border-primary: #30363d;
  --border-secondary: #21262d;
  --border-active: #1f6feb;
  
  /* Акцентные цвета */
  --accent-primary: #1f6feb;
  --accent-primary-hover: #388bfd;
  --accent-success: #238636;
  --accent-success-hover: #2ea043;
  --accent-danger: #da3633;
  --accent-danger-hover: #f85149;
  --accent-warning: #9e6a03;
  --accent-warning-hover: #bb8009;
  
  /* Тени */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  
  /* Радиусы */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Отступы */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* Reset and Base Styles */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

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

/* Header */
.header { 
  background: var(--bg-secondary);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 70px;
  margin-bottom: 0;
  box-shadow: var(--shadow-sm);
}

.header-left { 
  display: flex; 
  flex-direction: column; 
  gap: var(--spacing-sm);
}

.header h1 { 
  color: var(--text-primary);
  font-size: 24px; 
  font-weight: 600;
  margin: 0; 
}

.header-nav { 
  display: flex; 
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.nav-link { 
  color: var(--text-secondary);
  text-decoration: none; 
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

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

.nav-link.active { 
  background: var(--accent-primary);
  color: white; 
  border-color: var(--accent-primary);
}

.header-buttons { 
  display: flex; 
  gap: var(--spacing-sm);
  align-items: center;
}

/* Container */
.container { 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: var(--spacing-lg);
}

/* Panel/Card */
.panel { 
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-md);
}

.panel h2 { 
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
}

.panel p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

/* Buttons */
.btn { 
  padding: 10px 18px;
  border: none; 
  border-radius: var(--radius-sm);
  cursor: pointer; 
  font-size: 14px; 
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border: 1px solid transparent;
}

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

.btn-primary { 
  background: var(--accent-primary);
  color: white; 
  border-color: var(--accent-primary);
}

.btn-primary:hover:not(:disabled) { 
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success,
.btn-new { 
  background: var(--accent-success);
  color: white; 
  border-color: var(--accent-success);
}

.btn-success:hover:not(:disabled),
.btn-new:hover:not(:disabled) { 
  background: var(--accent-success-hover);
  border-color: var(--accent-success-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-danger:hover:not(:disabled) { 
  background: var(--accent-danger-hover);
  border-color: var(--accent-danger-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary { 
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-primary);
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-remove {
  background: var(--accent-danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-remove:hover {
  background: var(--accent-danger-hover);
  transform: scale(1.1);
}

/* Table */
.table-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-sm);
}

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

.table th, 
.table td { 
  padding: 12px 16px;
  text-align: left; 
  border-bottom: 1px solid var(--border-primary);
}

.table th { 
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  color: var(--text-secondary);
}

.table tbody tr {
  transition: background 0.2s ease;
}

.table tbody tr:hover { 
  background: var(--bg-tertiary);
}

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

/* Status badges */
.status,
.badge { 
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px; 
  font-weight: 600;
  display: inline-block;
}

.status.active,
.badge.active { 
  background: rgba(35, 134, 54, 0.2);
  color: var(--accent-success);
  border: 1px solid var(--accent-success);
}

.status.finished,
.badge.finished { 
  background: rgba(31, 111, 235, 0.2);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.status.waiting,
.badge.waiting { 
  background: rgba(158, 106, 3, 0.2);
  color: var(--accent-warning);
  border: 1px solid var(--accent-warning);
}

.status.disabled,
.badge.disabled {
  background: rgba(110, 118, 129, 0.2);
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
}

/* Form elements */
.form-group { 
  margin-bottom: var(--spacing-md);
}

.form-group label { 
  display: block; 
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.form-group input, 
.form-group select, 
.form-group textarea { 
  width: 100%; 
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

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

.form-group input[type="checkbox"] {
  width: auto;
  margin-right: var(--spacing-xs);
  cursor: pointer;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-group small {
  display: block;
  margin-top: var(--spacing-xs);
  font-size: 12px;
  color: var(--text-muted);
}

/* Grid layout */
.grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

/* Code */
code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Monaco', 'Courier New', 'Consolas', monospace;
  font-size: 12px;
  color: #f0883e;
  border: 1px solid var(--border-primary);
}

pre {
  background: var(--bg-tertiary);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--border-primary);
}

pre code {
  background: transparent;
  padding: 0;
  border: none;
}

/* Tags container */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--bg-tertiary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  font-size: 13px;
}

.tag code {
  background: transparent;
  padding: 0;
  color: var(--text-primary);
  border: none;
}

/* Loading state */
.loading {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-secondary);
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Error message */
.error-message {
  background: rgba(218, 54, 51, 0.15);
  color: var(--accent-danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: var(--spacing-md) 0;
  border: 1px solid var(--accent-danger);
}

/* Success message */
.success-message {
  background: rgba(35, 134, 54, 0.15);
  color: var(--accent-success);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: var(--spacing-md) 0;
  border: 1px solid var(--accent-success);
}

/* Warning message */
.warning-message {
  background: rgba(158, 106, 3, 0.15);
  color: var(--accent-warning);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: var(--spacing-md) 0;
  border: 1px solid var(--accent-warning);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-footer,
.form-actions {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-primary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border-primary);
}

.tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

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

/* Container and Layout - для страницы чатов */
body:has(.container > .sidebar) .container,
.container.chats-container {
  display: flex !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: calc(100vh - 70px) !important;
  overflow: hidden !important;
}

body:has(.container > .sidebar) .content,
.container.chats-container .content {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
}

/* Sidebar */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary);
  font-weight: 600;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* Responsive */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  .header {
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: flex-start;
  }
  
  .header-nav {
    flex-wrap: wrap;
    width: 100%;
  }
  
  .container {
    padding: var(--spacing-md);
  }
  
  .modal-content {
    width: 95%;
    padding: var(--spacing-md);
  }
}

/* Main Container (for sidebar layouts) */
.main-container {
  display: flex;
  height: calc(100vh - 70px);
  overflow: hidden;
}

.sidebar {
  width: 280px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.content-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
}

.content-empty h2 {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 20px;
  color: var(--text-secondary);
}

.content-empty p {
  margin: 0;
  font-size: 14px;
}

/* List items */
.bot-item,
.list-item {
  padding: 12px var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bot-item:hover,
.list-item:hover {
  background: var(--bg-tertiary);
}

.bot-item.active,
.list-item.active {
  background: rgba(31, 111, 235, 0.15);
  border-left: 3px solid var(--accent-primary);
}

.bot-item-info,
.list-item-info {
  flex: 1;
}

.bot-item-name,
.list-item-name {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.bot-item-status,
.list-item-status {
  font-size: 12px;
  color: var(--text-secondary);
}

.bot-item-status.enabled,
.list-item-status.enabled {
  color: var(--accent-success);
}

.bot-item-status.disabled,
.list-item-status.disabled {
  color: var(--text-muted);
}

/* Cards */
.scenarios-section,
.card-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-md);
}

.scenarios-header,
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
}

.scenarios-header h2,
.card-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text-primary);
}

.scenarios-list,
.card-list {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.scenario-card,
.card {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  transition: all 0.2s ease;
  cursor: pointer;
  background: var(--bg-tertiary);
}

.scenario-card:hover,
.card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.scenario-card.active,
.card.active {
  border-color: var(--accent-success);
  background: rgba(35, 134, 54, 0.1);
}

.scenario-card-header,
.card-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--spacing-sm);
}

.scenario-card-name,
.card-name {
  font-weight: 500;
  font-size: 16px;
  color: var(--text-primary);
  margin: 0;
}

.scenario-card-info,
.card-info {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: var(--spacing-sm);
}

.scenario-card-actions,
.card-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.scenario-badge {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

/* Utility classes */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

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

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* Block-specific styles */
.block-name-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.block-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
}

.block-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.block-description {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 350px;
}

.blocks-count {
  font-weight: 600;
  color: var(--text-primary);
}

.transition-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.transition-mode.linear {
  background: rgba(31, 111, 235, 0.2);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.transition-mode.linear::before {
  content: '→';
}

.transition-mode.random {
  background: rgba(158, 106, 3, 0.2);
  color: var(--accent-warning);
  border: 1px solid var(--accent-warning);
}

.transition-mode.random::before {
  content: '🎲';
}

.transition-mode.choice {
  background: rgba(123, 31, 162, 0.2);
  color: #a855f7;
  border: 1px solid #a855f7;
}

.transition-mode.choice::before {
  content: '🎯';
}

.transition-targets {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.btn-icon {
  padding: 6px 12px;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.btn-icon:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-icon.edit {
  color: var(--accent-success);
  border-color: var(--accent-success);
}

.btn-icon.edit:hover {
  background: rgba(35, 134, 54, 0.15);
}

.btn-icon.settings {
  color: var(--accent-warning);
  border-color: var(--accent-warning);
}

.btn-icon.settings:hover {
  background: rgba(158, 106, 3, 0.15);
}

.btn-icon.delete {
  color: var(--accent-danger);
  border-color: var(--accent-danger);
}

.btn-icon.delete:hover {
  background: rgba(218, 54, 51, 0.15);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
}

.empty-state-title {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--text-secondary);
}

.modal-body {
  padding: var(--spacing-lg);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-group label {
  margin: 0;
  cursor: pointer;
  font-weight: normal;
  color: var(--text-secondary);
}

.next-blocks-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.next-block-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
}

.next-block-name {
  flex: 1;
  font-family: monospace;
  font-size: 13px;
  color: var(--text-primary);
}

.btn-add {
  background: var(--accent-success);
  color: white;
  padding: 8px 16px;
  margin-top: var(--spacing-sm);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-add:hover {
  background: var(--accent-success-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Chat list styles */
.chat-list-item {
  padding: var(--spacing-md) var(--spacing-lg);
  cursor: pointer;
  border-bottom: 1px solid var(--border-primary);
  transition: all 0.2s ease;
  position: relative;
}

.chat-list-item:hover {
  background: var(--bg-tertiary);
  transform: translateX(2px);
}

.chat-list-item.active {
  background: rgba(31, 111, 235, 0.15);
  border-right: 3px solid var(--accent-primary);
}

.chat-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 16px;
  margin-bottom: 4px;
  padding-right: 30px;
}

.chat-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

.btn-delete-chat {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent-danger);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: all 0.2s ease;
}

.btn-delete-chat:hover {
  background: var(--accent-danger-hover);
  transform: scale(1.05);
  opacity: 1;
}

.chat-list-item:hover .btn-delete-chat {
  opacity: 1;
}

/* Game list styles */
.game-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.game-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-item:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.game-item.selected {
  border-color: var(--accent-primary);
  background: rgba(31, 111, 235, 0.15);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.1);
}

.game-item h4 {
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
}

.game-item p {
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

.game-details {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.editor-area {
  flex: 1;
  padding: var(--spacing-lg);
  overflow-y: auto;
  min-width: 0;
}

.editor-panel {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-md);
  max-width: 100%;
}

/* Status bar */
.status-bar-container {
  background: var(--bg-secondary);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  margin-bottom: var(--spacing-lg);
}

.status-bar-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-bar-count {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.status-bar-track {
  width: 100%;
  height: 32px;
  background: var(--bg-tertiary);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-primary);
}

.status-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-success), #20c997);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.status-bar-fill.full {
  background: linear-gradient(90deg, var(--accent-warning), #ff9800);
}

/* Filters */
.filters {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid var(--border-primary);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: white;
}

/* Registration card */
.registration-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  transition: all 0.2s ease;
}

.registration-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.registration-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--spacing-md);
}

.registration-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.registration-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Availability settings */
.availability-settings {
  display: none;
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
}

.availability-settings.active {
  display: block;
}

/* Messages styles */
.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-lg);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  min-height: 0;
  align-items: flex-start;
  justify-content: flex-start;
}

.msg {
  max-width: 75%;
  margin: 0;
  padding: 14px 18px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  word-wrap: break-word;
  box-shadow: var(--shadow-sm);
}

.msg.in {
  background: var(--bg-secondary);
  align-self: flex-start;
  border: 1px solid var(--border-primary);
  border-bottom-left-radius: 6px;
  color: var(--text-primary);
}

.msg.out {
  background: var(--accent-primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}

.msg .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.8;
}

.msg.out .meta {
  color: rgba(255, 255, 255, 0.8);
}

/* Log styles */
.log {
  max-width: 90%;
  align-self: center;
  margin: 4px auto;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0.85;
  border-left: 3px solid;
  font-family: 'Monaco', 'Menlo', monospace;
}

.log-info {
  background: rgba(31, 111, 235, 0.15);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.log-warning {
  background: rgba(158, 106, 3, 0.15);
  color: var(--accent-warning);
  border-color: var(--accent-warning);
}

.log-error {
  background: rgba(218, 54, 51, 0.15);
  color: var(--accent-danger);
  border-color: var(--accent-danger);
}

.log .meta {
  font-size: 11px;
  margin-top: 4px;
}

/* Callback styles */
.callback {
  max-width: 65%;
  align-self: flex-start;
  margin: 6px 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-left: 3px solid var(--text-muted);
  font-style: italic;
}

.callback .meta {
  font-size: 11px;
  margin-top: 4px;
  color: var(--text-muted);
}

/* Composer */
.composer {
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-shrink: 0;
}

.composer input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 24px;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.composer input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.1);
}

.composer input::placeholder {
  color: var(--text-muted);
}

.composer button {
  padding: 12px 20px;
  background: var(--accent-primary);
  border: 0;
  color: white;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.composer button:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.status {
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  text-align: center;
  flex-shrink: 0;
}

.progress-info {
  background: rgba(31, 111, 235, 0.15);
  border: 1px solid var(--accent-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin: var(--spacing-md) var(--spacing-lg) 0;
  display: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.progress-info.active {
  display: block;
}

.progress-info.show {
  display: block;
}

.progress-info.active {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.progress-left {
  flex: 1;
  min-width: 300px;
}

.progress-right {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

.progress-title {
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 4px;
  font-size: 14px;
}

.progress-details {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.progress-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-primary);
  color: white;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-right: var(--spacing-sm);
}

.progress-badge.finished {
  background: var(--accent-success);
}

.progress-badge.not-started {
  background: var(--text-muted);
}

.jump-controls {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
}

.jump-select,
.jump-input {
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
}

.jump-select {
  min-width: 200px;
  max-width: 300px;
}

.jump-input {
  width: 150px;
}

.btn-jump {
  background: var(--accent-success);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-jump:hover:not(:disabled) {
  background: var(--accent-success-hover);
  transform: translateY(-1px);
}

.btn-jump:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
}

.btn-reset {
  background: var(--accent-danger);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-reset:hover:not(:disabled) {
  background: var(--accent-danger-hover);
  transform: translateY(-1px);
}

.btn-reset:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  opacity: 0.5;
}

.tg-link {
  color: var(--accent-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.tg-link:hover {
  color: var(--accent-primary-hover);
  text-decoration: underline;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
