/* Админский интерфейс - стили */

.admin-templates {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.admin-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
}

.admin-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  min-width: 150px;
}

.filter-input {
  flex: 1;
  min-width: 200px;
}

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

.admin-templates-list {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
}

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

.admin-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.admin-table th {
  padding: 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.admin-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-table .actions {
  display: flex;
  gap: 8px;
}

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #ff3d5f;
}

.btn-secondary {
  background: #2b2c36;
  color: #fff;
}

.btn-secondary:hover {
  background: #35364a;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(108, 229, 177, 0.2);
  color: #6ce5b1;
}

.badge-danger {
  background: rgba(255, 92, 122, 0.2);
  color: #ff5c7a;
}

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

.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.admin-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Модальное окно */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border-radius: 20px;
  padding: 32px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 800;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.form-control[type="file"] {
  padding: 8px;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-error {
  padding: 60px 20px;
  text-align: center;
}

.admin-error h1 {
  color: var(--danger);
  margin-bottom: 16px;
}

/* Форма входа администратора */
.admin-login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: var(--bg);
}

.admin-login-form {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.admin-login-form h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
}

.admin-login-error {
  background: rgba(255, 92, 122, 0.2);
  color: #ff5c7a;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.admin-login-form .form-group {
  margin-bottom: 20px;
}

.admin-login-form .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.admin-login-form .form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.admin-login-form .form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.admin-login-form .form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-login-form .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Drag-and-drop загрузка файлов */
.file-upload-container {
  width: 100%;
}

.file-upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-upload-dropzone:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.file-upload-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(91, 124, 250, 0.1);
  transform: scale(1.02);
}

.file-upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.file-upload-text {
  margin-bottom: 20px;
}

.file-upload-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px 0;
}

.file-upload-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.file-upload-button {
  display: inline-block;
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.file-upload-button:hover {
  background: #6b7ff0;
}

.file-upload-button input {
  display: none;
}

/* Предпросмотр файла */
.file-preview {
  margin-top: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.file-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.file-preview-info {
  flex: 1;
}

.file-preview-name {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.file-preview-size {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.file-preview-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.file-preview-remove:hover {
  background: rgba(255, 92, 122, 0.2);
  color: var(--danger);
}

.file-preview-content {
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 400px;
  overflow: auto;
}

.file-preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: contain;
}

.file-preview-video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
}

/* Админский интерфейс разделов */
.admin-sections {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.admin-sections-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.admin-sections-list {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
}

.admin-table tr.active {
  background: rgba(108, 229, 177, 0.1);
}

.admin-table tr {
  cursor: pointer;
}

.admin-section-details {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
}

.admin-section-details.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.section-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-details-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.section-card-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.section-card-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.card-preview {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.card-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-order {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.card-info {
  padding: 12px;
}

.card-info h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
}

.card-template {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.card-actions {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

/* Навигация админ-панели */
.admin-panel-wrapper {
  min-height: 100vh;
  background: var(--bg);
}

.admin-nav {
  background: var(--card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-nav-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 4px;
}

.admin-nav-item {
  padding: 16px 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  position: relative;
}

.admin-nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.admin-nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-nav-back {
  margin-left: auto;
  color: var(--muted);
}

.admin-nav-back:hover {
  color: var(--text);
}

/* Страница слайдеров */
.admin-sliders {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-sliders-list {
  margin-top: 24px;
}

.sliders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
}

.slider-card-item {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.slider-card-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.slider-card-preview {
  position: relative;
  width: 100%;
  padding-top: 50%; /* 2:1 aspect ratio */
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.slider-card-preview video,
.slider-card-preview img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

.slider-card-order {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.slider-card-content {
  padding: 16px;
}

.slider-card-subtitle {
  font-size: 11px;
  color: #4ade80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.slider-card-actions {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
}

/* Адаптивность */
@media (max-width: 1024px) {
  .sliders-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-templates,
  .admin-sections,
  .admin-sliders {
    padding: 16px;
  }

  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .admin-filters {
    flex-direction: column;
  }

  .filter-input,
  .filter-select {
    width: 100%;
  }

  .admin-table {
    font-size: 12px;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px;
  }

  .admin-table .actions {
    flex-direction: column;
  }

  .admin-sections-layout {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .sliders-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    padding: 24px;
    margin: 20px;
  }

  .file-upload-dropzone {
    padding: 30px 16px;
  }

  .file-upload-icon {
    font-size: 36px;
  }

  .file-preview-content {
    max-height: 250px;
  }

  .admin-nav-container {
    padding: 0 12px;
    gap: 0;
  }

  .admin-nav-item {
    padding: 12px 14px;
    font-size: 13px;
  }
}

/* ============================================
   DASHBOARD ANALYTICS STYLES
   ============================================ */

.admin-dashboard {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.dashboard-period-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 16px 20px;
  border-radius: 12px;
}

.dashboard-period-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.dashboard-date-input {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
  min-width: 140px;
}

.dashboard-date-input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.12);
}

.period-btn {
  padding: 10px 20px;
  border: none;
  background: rgba(99, 102, 241, 0.8);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.period-btn:hover {
  background: rgba(99, 102, 241, 1);
}

.period-btn.active {
  background: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.period-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.period-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.period-btn.secondary.active {
  background: #6366f1;
  color: #fff;
}

/* Metrics Cards Grid */
.dashboard-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.metric-label {
  font-size: 11px;
  color: #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 16px;
}

.metric-value {
  font-size: 36px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.1;
  margin-bottom: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.metric-value .metric-currency {
  font-size: 24px;
  font-weight: 500;
  margin-left: 4px;
}

.metric-subtitle {
  font-size: 12px;
  color: #6b7280;
  font-weight: 400;
}

.metric-suffix {
  font-size: 18px;
  color: #1a1a2e;
  font-weight: 500;
  margin-left: 2px;
}

/* Charts Section */
.dashboard-section {
  margin-bottom: 32px;
}

.dashboard-section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.chart-container {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
}

.chart-canvas-wrapper {
  position: relative;
  height: 300px;
}

/* Cohort Tables */
.cohort-section {
  margin-bottom: 32px;
}

.cohort-tables-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.cohort-table-container {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.cohort-table-title {
  padding: 14px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.cohort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cohort-table th,
.cohort-table td {
  padding: 10px 12px;
  text-align: center;
  border: 1px solid #e5e7eb;
}

.cohort-table th {
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 600;
  font-size: 12px;
}

.cohort-table td.cohort-label {
  text-align: left;
  font-weight: 500;
  background: #f9fafb;
  color: #374151;
  white-space: nowrap;
}

.cohort-table td.cohort-size {
  background: #f9fafb;
  color: #374151;
  font-weight: 500;
}

.cohort-table .cohort-cell {
  transition: all 0.15s ease;
  font-weight: 500;
  min-width: 80px;
}

.cohort-table tr:hover td {
  filter: brightness(0.95);
}

/* Вкладка «Расходы» (себестоимость генераций) */
.costs-table-wrapper {
  overflow-x: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.costs-table th,
.costs-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

/* Таблицы на белом фоне внутри тёмной темы дашборда — цвет текста явно */
.costs-table td {
  color: #374151;
}

.costs-table th {
  background: #f3f4f6;
  color: #6b7280;
  font-weight: 600;
  font-size: 12px;
}

.costs-table th:first-child,
.costs-table td:first-child {
  text-align: left;
}

.costs-service-row,
.costs-job-row {
  cursor: pointer;
  height: 44px;
}

.costs-service-row:hover td,
.costs-job-row:hover td {
  background: #f9fafb;
}

.costs-service-name {
  font-weight: 600;
  color: #374151;
}

.costs-model-row td {
  background: #fafafa;
  color: #6b7280;
}

.costs-table td.costs-model-name {
  padding-left: 28px;
}

.costs-jobs-error {
  color: #dc2626;
}

.costs-job-details > td {
  padding: 8px 12px 16px;
  background: #f9fafb;
}

.costs-table-nested {
  font-size: 12px;
}

.costs-empty {
  padding: 16px;
  color: #6b7280;
}

.costs-rates {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.costs-rates-current {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-weight: 600;
  color: var(--text);
}

.costs-rate-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.costs-rate-form .form-input {
  min-height: 44px;
  width: auto;
}

.costs-rate-form .costs-rate-submit {
  min-height: 44px;
}

/* Вкладка «Прибыль» */
.profit-note {
  margin-top: 12px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.costs-table td.profit-negative {
  color: #dc2626;
  font-weight: 600;
}

.costs-table td.profit-missing {
  color: #9ca3af;
}

.profit-day-partial td {
  font-style: italic;
}

.profit-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

/* Сноска на тёмном фоне дашборда: контраст ≥ 4.5:1 */
.profit-note .metric-subtitle {
  color: #9ca3af;
}

.profit-total-row td {
  font-weight: 700;
  background: #f3f4f6;
  border-top: 2px solid #e5e7eb;
}

/* Dashboard Loading State */
.dashboard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--muted);
}

.dashboard-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 20px;
  color: #ef4444;
  text-align: center;
}

/* Cohort Charts Grid */
.cohort-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

/* Dashboard Responsive */
@media (max-width: 1400px) {
  .dashboard-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .dashboard-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-charts-grid {
    grid-template-columns: 1fr;
  }
  
  .cohort-charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .admin-dashboard {
    padding: 16px;
  }
  
  .dashboard-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .metric-card {
    padding: 16px;
  }
  
  .metric-value {
    font-size: 24px;
  }
  
  .metric-label {
    font-size: 10px;
  }
  
  .dashboard-period-selector {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .cohort-charts-grid {
    grid-template-columns: 1fr;
  }
  
  .cohort-table-container {
    overflow-x: auto;
  }
  
  .cohort-table {
    min-width: 800px;
  }
}

@media (max-width: 480px) {
  .dashboard-metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .metric-value {
    font-size: 28px;
  }
  
  .chart-canvas-wrapper {
    height: 250px;
  }
}


/* ============================================
   DASHBOARD TABS
   ============================================ */

.dashboard-tabs {
  display: flex;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0;
  gap: 16px;
}

.tab-button {
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.tab-button:hover {
  color: var(--text);
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

.tab-button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ============================================
   TEMPLATE USAGE STATS
   ============================================ */

.template-stats-section {
  margin-top: 32px;
}

.template-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.template-stats-totals {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.template-stats-total {
  background: var(--card);
  padding: 16px 24px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-stats-total .label {
  font-size: 13px;
  color: var(--muted);
}

.template-stats-total .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

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

.template-stats-list {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-stats-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-stats-title .count {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.template-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.template-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.template-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  flex-shrink: 0;
}

.template-rank.top-3 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.template-thumbnail {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.template-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.template-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-slug {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.template-usage-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.progress-bar-container {
  flex-grow: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  border-radius: 4px;
  transition: width 0.4s ease-out;
}

.template-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

.template-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

@media (max-width: 900px) {
  .template-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .template-stats-totals {
    width: 100%;
    justify-content: space-between;
  }
  
  .template-stats-total {
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 600px) {
  .template-item {
    flex-wrap: wrap;
  }
  
  .template-info {
    width: calc(100% - 108px);
  }
  
  .template-usage {
    width: 100%;
    margin-top: 8px;
  }
}

/* ============================================
   TEMPLATE STATS - SUMMARY CARDS
   ============================================ */

.template-stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--card);
  padding: 20px 24px;
  border-radius: 16px;
  text-align: center;
}

.summary-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}

.summary-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================
   TEMPLATE STATS - COLUMNS
   ============================================ */

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

.template-ranking-column {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
}

.template-ranking-column h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.template-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-ranking-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.template-ranking-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.template-ranking-position {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  flex-shrink: 0;
}

.template-ranking-position.gold {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.template-ranking-position.silver {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
}

.template-ranking-position.bronze {
  background: linear-gradient(135deg, #f59e0b, #b45309);
}

.template-ranking-thumbnail {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.template-ranking-info {
  flex-grow: 1;
  min-width: 0;
}

.template-ranking-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.template-ranking-slug {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-ranking-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.template-ranking-count {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.template-ranking-bar {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.template-ranking-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  border-radius: 3px;
  transition: width 0.4s ease-out;
}

.template-ranking-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 900px) {
  .template-stats-columns {
    grid-template-columns: 1fr;
  }
  
  .template-stats-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .template-stats-summary {
    grid-template-columns: 1fr;
  }
  
  .template-ranking-item {
    flex-wrap: wrap;
  }
  
  .template-ranking-stats {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
  }
  
  .template-ranking-bar {
    flex-grow: 1;
    margin-left: 12px;
  }
}

/* ============================================
   TEMPLATE STATS - ADDITIONAL CLASSES FROM JS
   ============================================ */

.template-ranking-column .template-ranking-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.template-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  flex-shrink: 0;
}

.template-info {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-slug {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.template-progress {
  width: 100px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.template-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  border-radius: 4px;
  transition: width 0.4s ease-out;
}

/* ============================================
   CLIPS ADMIN — общие
   ============================================ */

.admin-section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.admin-section-item:hover,
.admin-section-item.active {
  background: rgba(108, 229, 177, 0.08);
}

.section-info h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.section-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--text);
}

/* ============================================
   CLIPS STUDIO — переменные и базовые
   ============================================ */

.clips-admin {
  --clips-bg: #0f0d18;
  --clips-surface: rgba(255, 255, 255, 0.04);
  --clips-surface-hover: rgba(255, 255, 255, 0.07);
  --clips-border: rgba(255, 255, 255, 0.08);
  --clips-border-strong: rgba(255, 255, 255, 0.14);
  --clips-text: #ecebf5;
  --clips-muted: #8b8aa3;
  --clips-accent: #8b6cff;
  --clips-accent-soft: rgba(139, 108, 255, 0.18);
  --clips-success: #6ce5b1;
  --clips-warning: #f5b96b;
  --clips-danger: #ff6584;
  background: var(--clips-bg);
  color: var(--clips-text);
  min-height: calc(100vh - 56px);
}

.clips-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ----- Кнопки studio ----- */
.btn-clips {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--clips-border);
  background: var(--clips-surface);
  color: var(--clips-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
  font-family: inherit;
}

.btn-clips:hover {
  background: var(--clips-surface-hover);
  border-color: var(--clips-border-strong);
}

.btn-clips:active {
  transform: translateY(1px);
}

.btn-clips-ghost {
  background: transparent;
}

.btn-clips-primary {
  background: linear-gradient(135deg, #7d5dff, #a472ff);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 6px 18px rgba(125, 93, 255, 0.35);
}

.btn-clips-primary:hover {
  background: linear-gradient(135deg, #8a6dff, #b07dff);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-clips--disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================
   CLIPS LIST SCREEN
   ============================================ */

.clips-list-screen {
  padding: 32px clamp(16px, 3vw, 36px);
  max-width: 1600px;
  margin: 0 auto;
}

.clips-list-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.clips-list-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.clips-list-subtitle {
  margin: 0;
  color: var(--clips-muted);
  font-size: 14px;
}

.clips-list-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.clips-filter-input,
.clips-filter-select {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--clips-surface);
  color: var(--clips-text);
  border: 1px solid var(--clips-border);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.clips-filter-input {
  flex: 1;
  min-width: 220px;
}

.clips-filter-input:focus,
.clips-filter-select:focus {
  border-color: var(--clips-accent);
  background: var(--clips-surface-hover);
}

.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.clips-card {
  background: var(--clips-surface);
  border: 1px solid var(--clips-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
  display: flex;
  flex-direction: column;
}

.clips-card:hover {
  background: var(--clips-surface-hover);
  border-color: var(--clips-border-strong);
  transform: translateY(-2px);
}

.clips-card-cover {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.clips-card-cover img,
.clips-card-cover-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clips-muted);
  background: rgba(255, 255, 255, 0.03);
  object-fit: cover;
}

.clips-card-status {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--clips-muted);
}

.clips-card-status--on {
  color: var(--clips-success);
  background: rgba(108, 229, 177, 0.16);
}

.clips-card-body {
  padding: 14px 16px 18px;
}

.clips-card-body h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.clips-card-slug {
  margin: 0 0 10px;
  color: var(--clips-muted);
  font-size: 12px;
}

.clips-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--clips-muted);
}

.clips-card-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  display: inline-block;
}

.clips-availability {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--clips-muted);
}

.clips-availability--public { color: var(--clips-success); background: rgba(108, 229, 177, 0.12); }
.clips-availability--pro { color: var(--clips-accent); background: var(--clips-accent-soft); }
.clips-availability--hidden { color: var(--clips-muted); }
.clips-availability--testing { color: var(--clips-warning); background: rgba(245, 185, 107, 0.12); }

.clips-empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--clips-muted);
  background: var(--clips-surface);
  border: 1px dashed var(--clips-border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.clips-empty-state--inline {
  background: transparent;
  border: none;
  padding: 32px 16px;
}

/* ============================================
   CLIPS STUDIO LAYOUT
   ============================================ */

.clips-studio {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
  background: var(--clips-bg);
}

.clips-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px clamp(16px, 3vw, 32px) 18px;
  border-bottom: 1px solid var(--clips-border);
  background: rgba(255, 255, 255, 0.02);
  flex-wrap: wrap;
}

.clips-studio-header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.clips-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--clips-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  font-family: inherit;
}

.clips-back-link:hover {
  color: var(--clips-text);
}

.clips-studio-title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.clips-studio-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--clips-muted);
  font-size: 13px;
}

.clips-save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 12px;
}

.clips-save-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.clips-save-status--saved { color: var(--clips-success); }
.clips-save-status--saving { color: var(--clips-warning); }
.clips-save-status--error { color: var(--clips-danger); }

.clips-studio-header-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.clips-studio-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  padding: 20px clamp(16px, 3vw, 32px) 32px;
  flex: 1;
  min-height: 0;
}

@media (max-width: 1100px) {
  .clips-studio-body {
    grid-template-columns: 1fr;
  }
}

/* ----- Левая колонка ----- */

.clips-studio-left {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.clips-preview-block {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--clips-border);
  border-radius: 18px;
  padding: 18px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.clips-preview-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clips-muted);
}

.clips-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clips-accent);
  box-shadow: 0 0 0 4px var(--clips-accent-soft);
}

.clips-preview-aspect {
  margin-left: auto;
  color: var(--clips-muted);
  font-size: 11px;
}

.clips-preview-frame {
  position: relative;
  flex: 1;
  margin: 14px auto 0;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--clips-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 720px;
  overflow: hidden;
}

.clips-preview-frame--phone {
  aspect-ratio: 9 / 16;
  max-width: 220px;
}

.clips-preview-frame--wide {
  aspect-ratio: 16 / 9;
}

.clips-preview-frame-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--clips-muted);
  font-size: 12px;
  text-align: center;
  padding: 16px;
}

.clips-preview-slot-tag {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  letter-spacing: 0.05em;
}

.clips-preview-bottom {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--clips-muted);
}

.clips-preview-slot-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.clips-preview-time {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 12px;
  color: var(--clips-muted);
}

/* ----- Таймлайн ----- */

.clips-timeline-block {
  background: var(--clips-surface);
  border: 1px solid var(--clips-border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.clips-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.clips-timeline-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--clips-muted);
  font-weight: 600;
}

.clips-timeline-title-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.clips-timeline-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.clips-timeline-time {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
  font-size: 12px;
  color: var(--clips-muted);
}

.clips-player-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clips-player-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--clips-border);
  background: var(--clips-surface);
  color: var(--clips-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.clips-player-btn:hover {
  background: var(--clips-surface-hover);
}

.clips-player-btn--play {
  background: linear-gradient(135deg, #7d5dff, #a472ff);
  border-color: transparent;
  color: #fff;
}

.clips-player-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--clips-muted);
}

.clips-waveform-wrap {
  position: relative;
}

.clips-audio-player {
  display: none;
}

.clips-waveform-canvas {
  position: relative;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.clips-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  overflow: hidden;
  box-sizing: border-box;
}

.clips-waveform-bar {
  flex: 1 1 auto;
  background: rgba(139, 108, 255, 0.18);
  border-radius: 1px;
  min-width: 1px;
  transition: background-color 0.15s ease;
}

.clips-waveform-bar--active {
  background: rgba(168, 132, 255, 0.95);
  box-shadow: 0 0 6px rgba(168, 132, 255, 0.45);
}

.clips-waveform-dividers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.clips-waveform-divider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(-0.5px);
}

.clips-waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.65);
  pointer-events: none;
  transform: translateX(-1px);
  transition: left 0.06s linear;
}

.clips-waveform-playhead::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

.clips-audio-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 20px;
  text-align: center;
  border: 1px dashed var(--clips-border-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--clips-text);
}

.clips-audio-dropzone h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.clips-audio-dropzone p {
  margin: 0;
  color: var(--clips-muted);
  font-size: 13px;
  max-width: 360px;
}

/* ----- Слоты ----- */

.clips-slots-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-behavior: smooth;
}

.clips-slots-rail::-webkit-scrollbar { height: 8px; }
.clips-slots-rail::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }

.clips-slots-empty {
  width: 100%;
  text-align: center;
  color: var(--clips-muted);
  padding: 16px;
}

.clips-slot-card {
  flex: 0 0 168px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--clips-border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.clips-slot-card:hover {
  border-color: var(--clips-border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.clips-slot-card--active {
  border-color: var(--clips-accent);
  background: var(--clips-accent-soft);
  box-shadow: 0 8px 24px rgba(139, 108, 255, 0.18);
}

.clips-slot-card-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--clips-text);
}

.clips-slot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clips-success);
}

.clips-slot-status-dot--draft {
  background: var(--clips-muted);
}

.clips-slot-card-frame {
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--clips-muted);
  letter-spacing: 0.06em;
  font-family: 'JetBrains Mono', 'Menlo', monospace;
}

.clips-slot-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 10px;
  color: var(--clips-muted);
}

.clips-slot-card-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clips-slot-card-index {
  font-weight: 700;
  color: var(--clips-text);
}

.clips-slot-card-duration {
  font-family: 'JetBrains Mono', 'Menlo', monospace;
}

/* ============================================
   ПРАВАЯ ПАНЕЛЬ
   ============================================ */

.clips-studio-right {
  background: var(--clips-surface);
  border: 1px solid var(--clips-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: flex-start;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.clips-studio-right::-webkit-scrollbar { width: 6px; }
.clips-studio-right::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

.clips-slot-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--clips-border);
}

.clips-slot-panel-index {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--clips-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.clips-slot-panel-titles {
  flex: 1;
  min-width: 0;
}

.clips-slot-panel-titles h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.clips-slot-panel-titles p {
  margin: 2px 0 0;
  color: var(--clips-muted);
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Menlo', monospace;
}

.clips-slot-panel-close {
  background: transparent;
  border: none;
  color: var(--clips-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.clips-slot-panel-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--clips-text);
}

.clips-panel-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.clips-panel-block-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clips-muted);
  font-weight: 700;
}

.clips-panel-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ----- Сетка режимов ----- */
.clips-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.clips-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--clips-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--clips-text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.clips-mode-card:hover {
  border-color: var(--clips-border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.clips-mode-card--active {
  border-color: var(--clips-accent);
  background: var(--clips-accent-soft);
  box-shadow: inset 0 0 0 1px var(--clips-accent);
}

.clips-mode-card-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(139, 108, 255, 0.18);
  color: var(--clips-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clips-mode-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.clips-mode-card-info h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clips-mode-card-info p {
  margin: 0;
  font-size: 10px;
  color: var(--clips-muted);
  line-height: 1.3;
}

/* ----- Поля ----- */

.clips-input,
.clips-textarea,
.clips-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--clips-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--clips-text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.clips-textarea {
  min-height: 84px;
  resize: vertical;
}

.clips-input:focus,
.clips-textarea:focus,
.clips-select:focus {
  border-color: var(--clips-accent);
  background: rgba(0, 0, 0, 0.4);
}

.clips-model-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--clips-border);
  border-radius: 10px;
  padding: 6px 8px;
}

.clips-model-card-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(139, 108, 255, 0.18);
  color: var(--clips-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clips-model-card .clips-select {
  background: transparent;
  border: none;
  padding: 6px 4px;
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
}

.clips-model-meta {
  font-size: 11px;
  color: var(--clips-muted);
  line-height: 1.4;
  padding: 0 2px;
}

/* ----- Reference card ----- */

.clips-reference-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--clips-border);
  border-radius: 10px;
}

.clips-reference-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(139, 108, 255, 0.18);
  color: var(--clips-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.clips-reference-card-info {
  flex: 1;
  min-width: 0;
}

.clips-reference-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--clips-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clips-reference-card-usage {
  font-size: 11px;
  color: var(--clips-muted);
  margin-top: 2px;
}

.clips-reference-card-toggle {
  background: transparent;
  border: none;
  color: var(--clips-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.clips-reference-card-toggle:hover {
  color: var(--clips-text);
  background: rgba(255, 255, 255, 0.06);
}

.clips-reference-toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--clips-muted);
  cursor: pointer;
}

/* ----- Audio strip toggle ----- */

.clips-audio-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--clips-border);
  border-radius: 12px;
}

.clips-audio-strip-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--clips-text);
}

.clips-audio-strip-subtitle {
  font-size: 11px;
  color: var(--clips-muted);
  margin-top: 2px;
}

.clips-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}

.clips-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}

.clips-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.clips-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.clips-toggle--on .clips-toggle-track {
  background: var(--clips-accent);
}

.clips-toggle--on .clips-toggle-thumb {
  transform: translateX(18px);
}

/* ============================================
   МОДАЛКА КЛИПА
   ============================================ */

.clips-modal {
  max-width: 540px;
}

.clips-modal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 768px) {
  .clips-modal-row {
    grid-template-columns: 1fr;
  }

  .clips-studio-header {
    padding: 16px;
  }

  .clips-studio-body {
    padding: 16px;
  }

  .clips-studio-right {
    position: relative;
    top: auto;
    max-height: none;
  }
}

/* ===== Clip slots editor v2 — custom durations ===== */

.clips-waveform-divider {
  cursor: ew-resize;
  pointer-events: auto;
  z-index: 2;
  width: 1px;
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.12s, width 0.12s;
}
.clips-waveform-divider::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -22px;
  right: -22px;
}
.clips-waveform-divider:hover {
  background: rgba(168, 132, 255, 0.7);
  width: 2px;
}
.clips-waveform-divider--dragging {
  background: var(--clips-accent, #a884ff);
  width: 2px;
  box-shadow: 0 0 8px rgba(168, 132, 255, 0.6);
}

.clips-slot-card {
  position: relative;
}
.clips-slot-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.clips-slot-card:hover .clips-slot-card-actions,
.clips-slot-card--active .clips-slot-card-actions {
  opacity: 1;
}
.clips-slot-card-action-btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s;
}
.clips-slot-card-action-btn:hover {
  background: rgba(168, 132, 255, 0.25);
  border-color: rgba(168, 132, 255, 0.5);
}
.clips-slot-card-action-btn--danger:hover {
  background: rgba(255, 90, 90, 0.25);
  border-color: rgba(255, 90, 90, 0.5);
}

/* Drag&drop reorder — visual feedback. */
.clips-slot-card[draggable="true"] {
  cursor: grab;
}

.clips-slot-card[draggable="true"]:active {
  cursor: grabbing;
}

.clips-slot-card--dragging {
  opacity: 0.4;
}

.clips-slot-card--drag-over {
  border-color: var(--clips-accent);
  box-shadow: 0 0 0 2px var(--clips-accent), 0 8px 24px rgba(139, 108, 255, 0.30);
  transform: translateY(-2px);
  transition: transform 80ms ease, box-shadow 80ms ease;
}

/* Визуальное отличие зеркального слота. Голубой тон отделяет от обычных
   (белый) и активного (фиолетовый), сразу читается «копия». */
.clips-slot-card--mirror {
  border-color: rgba(106, 191, 255, 0.45);
  background: linear-gradient(180deg, rgba(106, 191, 255, 0.10), rgba(106, 191, 255, 0.04));
}

.clips-slot-card--mirror.clips-slot-card--active {
  border-color: #6abfff;
  background: linear-gradient(180deg, rgba(106, 191, 255, 0.22), rgba(106, 191, 255, 0.10));
  box-shadow: 0 8px 24px rgba(106, 191, 255, 0.20);
}

.clips-slot-card--mirror .clips-slot-card-frame {
  border-style: solid;
  border-color: rgba(106, 191, 255, 0.30);
  background: rgba(106, 191, 255, 0.06);
}

.clips-slot-card--mirror .clips-slot-status-dot {
  background: #6abfff;
}

/* Read-only панель зеркала справа. */
.clips-mirror-panel {
  border: 1px solid rgba(106, 191, 255, 0.35);
  background: rgba(106, 191, 255, 0.06);
}

.clips-mirror-jump-btn {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(106, 191, 255, 0.16);
  border: 1px solid rgba(106, 191, 255, 0.35);
  color: #cce6ff;
  cursor: pointer;
}

.clips-mirror-jump-btn:hover {
  background: rgba(106, 191, 255, 0.28);
}

.clips-mirror-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--clips-muted);
  line-height: 1.5;
}

.clips-mirror-warning {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(245, 185, 107, 0.12);
  border: 1px solid rgba(245, 185, 107, 0.4);
  color: var(--clips-warning);
  font-size: 12px;
  line-height: 1.5;
}

.clips-mirror-warning strong { color: var(--clips-warning); }

.clips-mirror-summary {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.clips-mirror-summary-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.clips-mirror-summary-line--block {
  flex-direction: column;
  align-items: flex-start;
}

.clips-mirror-summary-label {
  flex: 0 0 110px;
  color: var(--clips-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.clips-mirror-summary-value {
  color: var(--clips-text);
  word-break: break-word;
}

/* Переход между слотами на таймлайне (рендерится между .clips-slot-card). */
.clips-slot-transition {
  flex: 0 0 96px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  background: rgba(168, 132, 255, 0.04);
  border: 1px dashed rgba(168, 132, 255, 0.22);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
}
.clips-slot-transition-arrow {
  font-size: 14px;
  line-height: 1;
  color: rgba(168, 132, 255, 0.85);
  font-weight: 600;
}
.clips-slot-transition-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  padding: 4px 6px;
  cursor: pointer;
}
.clips-slot-transition-select:focus {
  outline: none;
  border-color: rgba(168, 132, 255, 0.6);
}
.clips-slot-transition-ms-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.clips-slot-transition-ms {
  flex: 1 1 auto;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  padding: 4px 6px;
  text-align: right;
}
.clips-slot-transition-ms:focus {
  outline: none;
  border-color: rgba(168, 132, 255, 0.6);
}
.clips-slot-transition-ms-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
}

.clips-slot-add-tile {
  flex: 0 0 168px;
  min-height: 156px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.clips-slot-add-tile:hover {
  border-color: rgba(168, 132, 255, 0.6);
  color: #fff;
  background: rgba(168, 132, 255, 0.08);
}

.clips-slot-duration-field .clips-panel-block-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.clips-slot-duration-hint {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0;
  text-transform: none;
}
.clips-slot-duration-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.clips-slot-duration-row input {
  flex: 0 0 100px;
  text-align: right;
}
.clips-slot-duration-unit {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}
.clips-slot-duration-meta {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.clips-model-warning {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #ffd081;
  background: rgba(255, 176, 0, 0.08);
  border: 1px solid rgba(255, 176, 0, 0.4);
  border-radius: 8px;
}

@media (pointer: coarse) {
  .clips-waveform-divider::before {
    left: -28px;
    right: -28px;
  }
  .clips-slot-card-actions {
    opacity: 1;
  }
  .clips-slot-card-action-btn {
    width: 32px;
    height: 32px;
  }
}

/* ===== Clip model parameters panel ===== */

.clips-model-params {
  /* блок настроек активной модели */
}
.clips-model-params .clips-panel-block-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.clips-model-params-hint {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  text-transform: none;
  letter-spacing: 0;
  font-family: monospace;
}
.clips-model-params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.clips-model-param-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.clips-model-param-row--full {
  grid-column: 1 / -1;
}
.clips-model-param-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.clips-model-param-row .clips-input,
.clips-model-param-row .clips-select {
  width: 100%;
}
.clips-model-param-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.3;
}
.clips-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}
.clips-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--clips-accent, #a884ff);
}

@media (max-width: 720px) {
  .clips-model-params-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Preview reference (admin test image) ===== */

.clips-reference-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 18px 14px;
  background: rgba(168, 132, 255, 0.04);
  border: 1.5px dashed rgba(168, 132, 255, 0.35);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}
.clips-reference-dropzone:hover {
  background: rgba(168, 132, 255, 0.1);
  border-color: rgba(168, 132, 255, 0.6);
}
.clips-reference-dropzone-title {
  font-size: 13px;
  font-weight: 600;
}
.clips-reference-dropzone-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

.clips-reference-card--filled {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}
.clips-reference-card-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.clips-reference-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.clips-reference-card-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.clips-reference-card-action {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s;
}
.clips-reference-card-action:hover {
  background: rgba(168, 132, 255, 0.25);
  border-color: rgba(168, 132, 255, 0.5);
}
.clips-reference-card-action--danger:hover {
  background: rgba(255, 90, 90, 0.25);
  border-color: rgba(255, 90, 90, 0.5);
}

/* ===== Slot preset video upload ===== */

.clips-preset-card {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.clips-preset-card--filled {
  aspect-ratio: 16/9;
}
.clips-preset-video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}
.clips-preset-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.clips-preset-card:hover .clips-preset-card-actions {
  opacity: 1;
}
@media (pointer: coarse) {
  .clips-preset-card-actions { opacity: 1; }
}

/* ===== Live Preview generation ===== */

.clips-preview-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.clips-preview-frame-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.clips-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 5;
  color: #fff;
  text-align: center;
  padding: 16px;
}
.clips-preview-overlay-text {
  font-size: 14px;
  font-weight: 600;
}
.clips-preview-overlay-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.clips-preview-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(168, 132, 255, 0.25);
  border-top-color: var(--clips-accent, #a884ff);
  border-radius: 50%;
  animation: clips-spin 0.9s linear infinite;
}
@keyframes clips-spin {
  to { transform: rotate(360deg); }
}

.clips-preview-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.clips-preview-actions .btn-clips {
  flex: 1 1 auto;
}

.btn-clips--disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* ===== First & Last frames ===== */

.clips-flf-block .clips-panel-block-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.clips-flf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.clips-flf-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.clips-flf-dropzone {
  padding: 12px 10px;
}
.clips-flf-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.clips-flf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.clips-flf-thumb-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.clips-flf-thumb:hover .clips-flf-thumb-actions {
  opacity: 1;
}
@media (pointer: coarse) {
  .clips-flf-thumb-actions { opacity: 1; }
}
.clips-flf-source--linked {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  background: rgba(168, 132, 255, 0.08);
  border: 1px dashed rgba(168, 132, 255, 0.4);
  border-radius: 8px;
  font-size: 12px;
  color: #c5b0ff;
  text-align: left;
}
.clips-checkbox-row--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Gallery strip + Live Preview tabs ===== */

.clips-preview-tabs {
  display: inline-flex;
  margin-left: auto;
  gap: 2px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
}
.clips-preview-tab {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.clips-preview-tab:hover {
  color: #fff;
}
.clips-preview-tab--active {
  background: rgba(168, 132, 255, 0.3);
  color: #fff;
}

.clips-gallery-strip {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}
.clips-gallery-strip-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.clips-gallery-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
.clips-gallery-thumb {
  position: relative;
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.clips-gallery-thumb:hover {
  border-color: rgba(168, 132, 255, 0.5);
  transform: translateY(-1px);
}
.clips-gallery-thumb--active {
  border-color: var(--clips-accent, #a884ff);
  box-shadow: 0 0 12px rgba(168, 132, 255, 0.4);
}
.clips-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.clips-gallery-thumb-actions {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s;
}
.clips-gallery-thumb:hover .clips-gallery-thumb-actions {
  opacity: 1;
}
@media (pointer: coarse) {
  .clips-gallery-thumb-actions { opacity: 1; background: rgba(0, 0, 0, 0.35); }
}
.clips-gallery-thumb-btn {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.clips-gallery-thumb-btn:hover {
  background: rgba(168, 132, 255, 0.4);
  border-color: rgba(168, 132, 255, 0.7);
}
.clips-gallery-thumb-btn--danger:hover {
  background: rgba(255, 90, 90, 0.4);
  border-color: rgba(255, 90, 90, 0.7);
}

/* ===== Gallery picker modal ===== */

.clips-gallery-picker-overlay {
  z-index: 100;
}
.clips-gallery-picker {
  width: min(900px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: #15131c;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.clips-gallery-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.clips-gallery-picker-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.clips-gallery-picker-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}
.clips-gallery-picker-close:hover {
  background: rgba(255, 255, 255, 0.05);
}

.clips-gallery-picker-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.clips-gallery-picker-groups {
  overflow-y: auto;
  padding: 12px 18px 18px;
}
.clips-gallery-picker-group + .clips-gallery-picker-group {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}
.clips-gallery-picker-group-title {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.clips-gallery-picker-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.clips-gallery-picker-thumb {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.12s;
}
.clips-gallery-picker-thumb:hover {
  border-color: var(--clips-accent, #a884ff);
  transform: translateY(-2px);
}
.clips-gallery-picker-thumb img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.clips-gallery-picker-thumb-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  padding: 6px 8px;
  text-align: left;
  background: rgba(0, 0, 0, 0.4);
}
.clips-gallery-picker-thumb--last-frame {
  border-color: rgba(168, 132, 255, 0.4);
}
.clips-gallery-picker-thumb--last-frame .clips-gallery-picker-thumb-label {
  color: #c5b0ff;
}

.clips-from-gallery-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.clips-from-gallery-btn:hover {
  background: rgba(168, 132, 255, 0.12);
  border-color: rgba(168, 132, 255, 0.4);
  color: #fff;
}

.clips-reference-empty,
.clips-flf-empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.clips-reference-empty .clips-from-gallery-btn,
.clips-flf-empty .clips-from-gallery-btn {
  align-self: center;
}

/* ===== Assembled clip preview modal ===== */

.clips-assembled-overlay {
  z-index: 110;
}
.clips-assembled-modal {
  width: min(720px, 92vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #15131c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.clips-assembled-frame {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.clips-assembled-frame--wide { aspect-ratio: 16/9; }
.clips-assembled-frame--phone { aspect-ratio: 9/16; max-height: 70vh; }
.clips-assembled-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.clips-assembled-actions {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.clips-assembled-actions .btn-clips {
  flex: 1 1 auto;
}

/* ===== FLF dynamic prompts ===== */
.clips-flf-prompt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(168, 132, 255, 0.05);
  border: 1px solid rgba(168, 132, 255, 0.18);
  border-radius: 8px;
}
.clips-flf-prompt-label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}
.clips-flf-prompt-input.clips-textarea {
  min-height: 56px;
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 8px;
  resize: vertical;
}
.clips-flf-prompt-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.35;
}

/* ==== SEO-тексты тегов (/adminpanel/tag-seo) ==== */
.admin-tag-seo-page { padding: 16px; max-width: 900px; margin: 0 auto; }
.tag-seo-hint { color: rgba(255,255,255,.6); font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.tag-seo-search {
  width: 100%; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05); color: #fff;
}
.tag-seo-summary { color: rgba(255,255,255,.7); font-size: 13px; margin-bottom: 16px; }
.tag-seo-list { display: flex; flex-direction: column; gap: 16px; }
.tag-seo-card {
  border: 1px solid rgba(255,255,255,.12); border-radius: 12px;
  padding: 16px; background: rgba(255,255,255,.03);
}
.tag-seo-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.tag-seo-link { color: #b4ff39; font-size: 12px; text-decoration: none; word-break: break-all; }
.tag-seo-meta { color: rgba(255,255,255,.5); font-size: 12px; margin-left: auto; }
.tag-seo-field { display: block; margin-bottom: 12px; }
.tag-seo-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: rgba(255,255,255,.7); margin-bottom: 4px;
}
.tag-seo-counter { color: rgba(255,255,255,.4); font-size: 11px; }
.tag-seo-input {
  width: 100%; padding: 8px 10px; border-radius: 8px; resize: vertical;
  border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.25);
  color: #fff; font: inherit; font-size: 13px; line-height: 1.5;
}
.tag-seo-input:focus { outline: none; border-color: #b4ff39; }
.tag-seo-actions { display: flex; align-items: center; gap: 12px; }
.tag-seo-status { font-size: 12px; color: rgba(255,255,255,.6); }
.tag-seo-status--ok { color: #b4ff39; }
.tag-seo-status--error { color: #ef4444; }
.tag-seo-empty { color: rgba(255,255,255,.5); text-align: center; padding: 24px; }

/* Вкладка «Рекомендации» (блок «Для вас»): выключатели и статус снимка */
.reco-flag-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.reco-flag-label {
  flex: 1;
}

.reco-flag-state {
  min-width: 88px;
  font-weight: 600;
}

.reco-flag-toggle {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  cursor: pointer;
}

.reco-snapshot,
.reco-window {
  margin: 12px 0 20px;
  opacity: 0.8;
  font-size: 14px;
}

/* Перекос групп A/B (docs/development/plan-home-reco-v2.md §1.4) */
.reco-srm,
.reco-epoch {
  margin: 0 0 12px;
  font-size: 14px;
  opacity: 0.8;
}

.reco-srm-alert {
  opacity: 1;
  font-weight: 600;
  color: var(--danger, #ff5c7a);
}

/* ===== Клипы: тестовые фото по номерам и подписи фото (docs/development/plan-clip-multi-photo.md) ===== */
.clips-reference-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clips-reference-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clips-reference-slot-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
}

.clips-user-photos-labels {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

/* Клипы: режим подачи фото в омни-модель и карты лиц в превью слота */
.clips-photo-mode {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.clips-face-maps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.clips-face-map {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 72px;
  margin: 0;
}

.clips-face-map img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.clips-face-map figcaption {
  overflow: hidden;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
