/* MetaSnap Design System v2 - Enhanced UI/UX Components */

/* ============================================
   MODE SELECTOR - Professional Tab Style
   ============================================ */
.mode-selector {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: var(--ms-bg);
  border-radius: var(--ms-radius-lg);
  padding: 4px;
  border: 1px solid var(--ms-border);
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--ms-radius);
  border: none;
  background: transparent;
  color: var(--ms-text-secondary);
  font-weight: 500;
  font-size: var(--ms-text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.mode-btn:hover {
  color: var(--ms-text);
  background: var(--ms-surface);
}

.mode-btn.active {
  background: var(--ms-surface);
  color: var(--ms-primary);
  box-shadow: var(--ms-shadow-sm);
}

.mode-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ============================================
   GENERATOR CARDS - Refined Design
   ============================================ */
.generator-card {
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-xl);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--ms-shadow-sm);
}

.generator-card h2 {
  font-size: var(--ms-text-lg);
  font-weight: 700;
  color: var(--ms-text);
  margin-bottom: 6px;
}

.generator-card .section-subtitle {
  font-size: var(--ms-text-base);
  color: var(--ms-text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ============================================
   CHAT GENERATOR - Compact & Elegant
   ============================================ */
.chat-generator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.chat-upload-area {
  border: 2px dashed var(--ms-border);
  border-radius: var(--ms-radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 140px;
  max-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ms-bg);
  position: relative;
  overflow: hidden;
}

.chat-upload-area:hover,
.chat-upload-area.drag-over {
  border-color: var(--ms-primary);
  background: var(--ms-primary-light);
}

.chat-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ms-text-muted);
}

.chat-upload-placeholder svg {
  width: 32px;
  height: 32px;
  color: var(--ms-text-muted);
}

.chat-upload-placeholder p {
  font-size: var(--ms-text-sm);
  margin: 0;
}

.chat-image-previews {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px;
}

.chat-image-previews img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--ms-radius);
  border: 2px solid var(--ms-border);
  box-shadow: var(--ms-shadow-sm);
  transition: transform 0.2s ease;
}

.chat-image-previews img:hover {
  transform: scale(1.05);
  border-color: var(--ms-primary);
}

/* Chat Generator Controls Row */
.chat-controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.chat-controls-row .field {
  margin-bottom: 0;
}

.chat-controls-row select {
  width: auto;
  min-width: 130px;
}

.chat-controls-row .toggle {
  white-space: nowrap;
}

.chat-controls-row button {
  min-width: 120px;
}

/* ============================================
   URL GENERATOR - Clean Layout
   ============================================ */
.url-generator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.url-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.url-input-row input[type="url"] {
  flex: 1;
  height: 44px;
  font-size: var(--ms-text-base);
}

.url-controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.url-controls-row select {
  width: auto;
  min-width: 130px;
}

/* ============================================
   QUICK PUBLISH - Organized Layout
   ============================================ */
.quick-publish-section {
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  padding: 24px;
  margin-top: 20px;
}

.quick-publish-section h2 {
  font-size: var(--ms-text-lg);
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-publish-section h2 svg {
  width: 20px;
  height: 20px;
  color: var(--ms-primary);
}

.quick-publish-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .quick-publish-grid {
    grid-template-columns: 1fr;
  }
}

.quick-publish-grid .field-full {
  grid-column: 1 / -1;
}

.quick-publish-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ms-border-light);
}

/* ============================================
   BATCH AUTO - User Friendly Redesign
   ============================================ */
.batch-section {
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  overflow: hidden;
}

.batch-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--ms-border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.batch-header h2 {
  font-size: var(--ms-text-lg);
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-header h2 svg {
  width: 22px;
  height: 22px;
  color: var(--ms-primary);
}

.batch-header .batch-status-badge {
  font-size: var(--ms-text-xs);
  padding: 4px 10px;
  border-radius: var(--ms-radius-full);
  background: var(--ms-bg);
  color: var(--ms-text-secondary);
}

.batch-content {
  padding: 24px;
}

/* Batch Blocks */
.batch-block {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ms-border-light);
}

.batch-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.batch-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.batch-block-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ms-primary);
  color: var(--ms-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ms-text-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.batch-block-title {
  font-size: var(--ms-text-base);
  font-weight: 600;
  color: var(--ms-text);
}

.batch-block-subtitle {
  font-size: var(--ms-text-sm);
  color: var(--ms-text-muted);
  margin-left: auto;
}

/* Sources Management */
.sources-input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.sources-input-group input {
  flex: 1;
}

.sources-input-group select {
  width: 140px;
}

.sources-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.source-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--ms-bg);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  transition: all 0.15s ease;
}

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

.source-chip .source-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--ms-radius-sm);
  background: var(--ms-primary-light);
  color: var(--ms-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.source-chip .source-icon svg {
  width: 16px;
  height: 16px;
}

.source-chip .source-info {
  flex: 1;
  min-width: 0;
}

.source-chip .source-url {
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.source-chip .source-type-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ms-text-muted);
  margin-top: 2px;
}

.source-chip .source-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--ms-text-muted);
  cursor: pointer;
  border-radius: var(--ms-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.source-chip .source-remove:hover {
  background: var(--ms-error-light);
  color: var(--ms-error);
}

.source-chip .source-remove svg {
  width: 16px;
  height: 16px;
}

.sources-empty {
  text-align: center;
  padding: 24px;
  color: var(--ms-text-muted);
  font-size: var(--ms-text-sm);
  background: var(--ms-bg);
  border-radius: var(--ms-radius);
  border: 1px dashed var(--ms-border);
}

/* AI Article Discovery */
.ai-discovery-box {
  background: linear-gradient(135deg, var(--ms-primary-light) 0%, var(--ms-bg) 100%);
  border: 1px solid var(--ms-primary);
  border-radius: var(--ms-radius-lg);
  padding: 20px;
}

.ai-discovery-box .ai-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--ms-text-sm);
  font-weight: 600;
  color: var(--ms-primary);
  margin-bottom: 12px;
}

.ai-discovery-box .ai-label svg {
  width: 18px;
  height: 18px;
}

.ai-discovery-box textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  padding: 12px;
  font-size: var(--ms-text-sm);
  background: var(--ms-surface);
}

.ai-discovery-box textarea:focus {
  border-color: var(--ms-primary);
  box-shadow: 0 0 0 3px var(--ms-primary-light);
  outline: none;
}

.ai-discovery-box .ai-hint {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
  margin-top: 8px;
}

.ai-discovery-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* Article Results */
.article-results {
  margin-top: 16px;
}

.article-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.article-results-header h4 {
  font-size: var(--ms-text-sm);
  font-weight: 600;
  color: var(--ms-text);
  margin: 0;
}

.article-results-header .results-count {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
}

.article-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.article-result-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  cursor: pointer;
  transition: all 0.15s ease;
}

.article-result-card:hover {
  border-color: var(--ms-primary);
  box-shadow: var(--ms-shadow-sm);
}

.article-result-card.selected {
  border-color: var(--ms-primary);
  background: var(--ms-primary-light);
}

.article-result-card .article-checkbox {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--ms-primary);
}

.article-result-card .article-content {
  flex: 1;
  min-width: 0;
}

.article-result-card .article-title {
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-result-card .article-meta {
  display: flex;
  gap: 12px;
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
}

.article-result-card .article-source {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-result-card .relevance-badge {
  padding: 2px 8px;
  border-radius: var(--ms-radius-full);
  font-size: 10px;
  font-weight: 600;
}

.article-result-card .relevance-badge.high {
  background: var(--ms-success-light);
  color: #166534;
}

.article-result-card .relevance-badge.medium {
  background: var(--ms-warning-light);
  color: #92400e;
}

.article-result-card .relevance-badge.low {
  background: var(--ms-bg);
  color: var(--ms-text-muted);
}

/* Generation Strategy */
.strategy-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.strategy-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--ms-bg);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  cursor: pointer;
  transition: all 0.15s ease;
}

.strategy-option:hover {
  border-color: var(--ms-primary);
}

.strategy-option.active {
  border-color: var(--ms-primary);
  background: var(--ms-primary-light);
}

.strategy-option input[type="checkbox"],
.strategy-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--ms-primary);
  flex-shrink: 0;
}

.strategy-option .option-content {
  flex: 1;
}

.strategy-option .option-label {
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text);
}

.strategy-option .option-desc {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
  margin-top: 2px;
}

.strategy-option select {
  width: auto;
  min-width: 150px;
}

/* Schedule Configuration - Visual */
.schedule-config {
  background: var(--ms-bg);
  border-radius: var(--ms-radius-lg);
  padding: 20px;
}

.schedule-visual {
  margin-bottom: 20px;
}

.schedule-timeline {
  display: flex;
  height: 40px;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  overflow: hidden;
  position: relative;
}

.schedule-hour {
  flex: 1;
  border-right: 1px solid var(--ms-border-light);
  position: relative;
}

.schedule-hour:last-child {
  border-right: none;
}

.schedule-hour.active {
  background: var(--ms-primary-light);
}

.schedule-hour-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--ms-text-muted);
}

.schedule-windows {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.schedule-window-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ms-primary-light);
  border: 1px solid var(--ms-primary);
  border-radius: var(--ms-radius-full);
  font-size: var(--ms-text-sm);
  color: var(--ms-primary);
}

.schedule-window-chip button {
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--ms-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.schedule-window-chip button:hover {
  background: var(--ms-primary);
  color: var(--ms-text-inverse);
}

.schedule-add-window {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}

.schedule-add-window input[type="time"] {
  width: 120px;
}

.schedule-interval {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ms-border);
}

.interval-field {
  flex: 1;
}

.interval-field label {
  display: block;
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text-secondary);
  margin-bottom: 8px;
}

.interval-field .interval-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.interval-field input[type="number"] {
  width: 80px;
}

.interval-field .interval-unit {
  font-size: var(--ms-text-sm);
  color: var(--ms-text-muted);
}

/* Batch Results */
.batch-results {
  margin-top: 20px;
}

.batch-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.batch-results-header h4 {
  font-size: var(--ms-text-sm);
  font-weight: 600;
  margin: 0;
}

.batch-results-stats {
  display: flex;
  gap: 16px;
  font-size: var(--ms-text-xs);
}

.batch-results-stats .stat {
  display: flex;
  align-items: center;
  gap: 4px;
}

.batch-results-stats .stat.success {
  color: var(--ms-success);
}

.batch-results-stats .stat.error {
  color: var(--ms-error);
}

.batch-results-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.batch-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
}

.batch-result-item.success {
  border-left: 3px solid var(--ms-success);
}

.batch-result-item.error {
  border-left: 3px solid var(--ms-error);
}

.batch-result-item .result-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.batch-result-item.success .result-icon {
  background: var(--ms-success-light);
  color: var(--ms-success);
}

.batch-result-item.error .result-icon {
  background: var(--ms-error-light);
  color: var(--ms-error);
}

.batch-result-item .result-icon svg {
  width: 14px;
  height: 14px;
}

.batch-result-item .result-content {
  flex: 1;
  min-width: 0;
}

.batch-result-item .result-title {
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-result-item .result-meta {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
  margin-top: 2px;
}

.batch-result-item .result-status {
  font-size: var(--ms-text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--ms-radius-full);
}

.batch-result-item.success .result-status {
  background: var(--ms-success-light);
  color: #166534;
}

.batch-result-item.error .result-status {
  background: var(--ms-error-light);
  color: #991b1b;
}

.batch-result-item .result-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.result-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-badge.gradient {
  background: rgba(99, 102, 241, 0.12);
  color: var(--ms-primary, #6366f1);
}

.result-badge.pub-error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

/* Batch Run Button */
/* Auto-batch row above run button */
.batch-auto-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--ms-bg);
  border-top: 1px solid var(--ms-border);
  flex-wrap: wrap;
}

.batch-auto-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text);
  user-select: none;
}

.batch-auto-toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-track {
  width: 40px;
  height: 22px;
  background: var(--ms-border);
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.batch-auto-toggle-label input:checked + .toggle-track {
  background: var(--ms-primary, #6366f1);
}

.batch-auto-toggle-label input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.batch-job-status {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.batch-job-time {
  font-size: var(--ms-text-xs, 0.75rem);
  color: var(--ms-text-muted);
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-sm, 4px);
  padding: 2px 8px;
}

.batch-status-badge.active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.3);
}

.batch-status-badge.scheduled {
  background: rgba(99, 102, 241, 0.1);
  color: var(--ms-primary, #6366f1);
  border-color: rgba(99, 102, 241, 0.25);
}

/* ── Daily limits bar above Run button ── */
.batch-daily-limits {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: var(--ms-surface, #1e293b);
  border-top: 1px solid var(--ms-border);
  font-size: var(--ms-text-xs);
  color: var(--ms-text-secondary);
}
.batch-daily-counter,
.batch-time-window {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--ms-radius-sm);
  background: var(--ms-bg, #0f172a);
  border: 1px solid var(--ms-border-light);
  font-weight: 500;
  white-space: nowrap;
}
.batch-daily-counter.warn,
.batch-time-window.warn {
  color: var(--ms-warning, #f59e0b);
  border-color: var(--ms-warning, #f59e0b);
}
.batch-daily-counter.blocked,
.batch-time-window.blocked {
  color: var(--ms-error, #ef4444);
  border-color: var(--ms-error, #ef4444);
}

.batch-run-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--ms-bg);
  border-top: 1px solid var(--ms-border);
}

.batch-run-section button {
  min-width: 160px;
  height: 44px;
  font-size: var(--ms-text-base);
}

.batch-run-section .batch-status {
  flex: 1;
  font-size: var(--ms-text-sm);
  color: var(--ms-text-secondary);
}

/* ============================================
   PREVIEW COMPONENTS - Shared
   ============================================ */
.preview-tabs {
  display: flex;
  gap: 0;
  background: var(--ms-bg);
  padding: 2px;
  border-radius: var(--ms-radius-sm);
  border: 1px solid var(--ms-border-light);
}

.preview-tab {
  height: 30px;
  padding: 0 12px;
  font-size: var(--ms-text-xs);
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--ms-text-secondary);
  cursor: pointer;
  border-radius: var(--ms-radius-sm);
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.preview-tab:hover {
  color: var(--ms-text);
}

.preview-tab.active {
  background: var(--ms-surface);
  color: var(--ms-primary);
  box-shadow: var(--ms-shadow-xs);
}

.preview-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.preview-media[data-aspect="9:16"] {
  aspect-ratio: 9/16;
}

.preview-media[data-aspect="1:1"] {
  aspect-ratio: 1/1;
}

.preview-media[data-aspect="4:5"] {
  aspect-ratio: 4/5;
}

.preview-media[data-aspect="16:9"] {
  aspect-ratio: 16/9;
}

/* ============================================
   CONTROLS PANELS - Cleaner Design
   ============================================ */
.controls-panel {
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.controls-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.controls-panel-header:hover {
  background: var(--ms-bg);
}

.controls-panel-header h3 {
  font-size: var(--ms-text-base);
  font-weight: 600;
  margin: 0;
  color: var(--ms-text);
}

.controls-panel-header .collapse-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ms-text-muted);
  transition: transform 0.2s ease;
}

.controls-panel-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.controls-panel-content {
  padding: 0 20px 20px;
  border-top: 1px solid var(--ms-border-light);
}

.controls-panel-content.collapsed {
  display: none;
}

/* ============================================
   SOCIAL CONNECTIONS - Improved
   ============================================ */
.social-connections-grid {
  display: grid;
  gap: 12px;
}

.social-connection-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--ms-bg);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  transition: all 0.15s ease;
}

.social-connection-card:hover {
  border-color: var(--ms-primary);
}

.social-connection-card .platform-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--ms-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--ms-text-lg);
  font-weight: 700;
  color: var(--ms-text-inverse);
  flex-shrink: 0;
}

.social-connection-card .platform-icon.instagram {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.social-connection-card .platform-icon.tiktok {
  background: #000;
}

.social-connection-card .platform-icon.youtube {
  background: #ff0000;
}

.social-connection-card .platform-icon.twitter {
  background: #1da1f2;
}

.social-connection-card .platform-info {
  flex: 1;
}

.social-connection-card .platform-name {
  font-size: var(--ms-text-base);
  font-weight: 600;
  color: var(--ms-text);
}

.social-connection-card .platform-status {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
  margin-top: 2px;
}

.social-connection-card .platform-status.connected {
  color: var(--ms-success);
}

.social-connection-card .platform-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   PUBLISH HISTORY - Enhanced
   ============================================ */
.publish-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.publish-history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--ms-bg);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
}

.publish-history-item .history-platform {
  width: 36px;
  height: 36px;
  border-radius: var(--ms-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--ms-text-sm);
  color: var(--ms-text-inverse);
  flex-shrink: 0;
}

.publish-history-item .history-content {
  flex: 1;
  min-width: 0;
}

.publish-history-item .history-title {
  font-size: var(--ms-text-sm);
  font-weight: 500;
  color: var(--ms-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.publish-history-item .history-time {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
  margin-top: 2px;
}

.publish-history-item .history-status {
  padding: 4px 12px;
  border-radius: var(--ms-radius-full);
  font-size: var(--ms-text-xs);
  font-weight: 500;
}

.publish-history-item .history-status.sent {
  background: var(--ms-success-light);
  color: #166534;
}

.publish-history-item .history-status.queued {
  background: var(--ms-warning-light);
  color: #92400e;
}

.publish-history-item .history-status.failed {
  background: var(--ms-error-light);
  color: #991b1b;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
  .batch-content {
    padding: 16px;
  }
  
  .strategy-options {
    grid-template-columns: 1fr;
  }
  
  .schedule-interval {
    flex-direction: column;
    gap: 16px;
  }
  
  .sources-input-group {
    flex-direction: column;
  }
  
  .sources-input-group select {
    width: 100%;
  }
  
  .batch-run-section {
    flex-direction: column;
    gap: 12px;
  }
  
  .batch-run-section button {
    width: 100%;
  }
}

/* ============================================
   Batch Flow Step Indicator
   ============================================ */
.batch-flow-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  background: var(--ms-bg-alt, #f1f5f9);
  border-bottom: 1px solid var(--ms-border, #e2e8f0);
  flex-wrap: wrap;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ms-text-secondary, #64748b);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

/* Active / current step — solid filled pill, high contrast */
.flow-step.active {
  background: var(--ms-primary, #6366f1);
  color: #fff;
  border-color: var(--ms-primary, #6366f1);
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.35);
}

/* Completed step — green tinted */
.flow-step.done {
  background: var(--ms-success-light, #d1fae5);
  color: var(--ms-success, #10b981);
  border-color: var(--ms-success, #10b981);
}

/* Step number circle */
.flow-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 50%;
  background: var(--ms-border, #e2e8f0);
  color: var(--ms-text-secondary, #64748b);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
}

/* Active step: number circle is transparent so the pill bg shows through cleanly */
.flow-step.active .flow-step-num {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Done step: green filled circle with white number */
.flow-step.done .flow-step-num {
  background: var(--ms-success, #10b981);
  color: #fff;
}

.flow-step-label {
  white-space: nowrap;
}

.flow-step-arrow {
  color: var(--ms-text-muted, #94a3b8);
  font-size: 0.85rem;
  padding: 0 2px;
  flex-shrink: 0;
  user-select: none;
}

/* Deferred browser-side video publish status row inside a batch result card */
.deferred-pub-status {
  font-size: 0.78rem;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 5px;
  display: inline-block;
}
.deferred-pub-status.rendering {
  background: var(--ms-bg-alt, #f1f5f9);
  color: var(--ms-text-secondary, #64748b);
}
.deferred-pub-status.uploading {
  background: #eff6ff;
  color: #3b82f6;
}
.deferred-pub-status.publishing {
  background: #f0fdf4;
  color: var(--ms-success, #10b981);
}
.deferred-pub-status.done {
  background: var(--ms-success-light, #d1fae5);
  color: var(--ms-success, #10b981);
  font-weight: 600;
}
.deferred-pub-status.failed {
  background: #fef2f2;
  color: var(--ms-error, #ef4444);
}

/* Discovery stats text below "Validated Candidates" heading */
.discovery-stats-text {
  font-size: 0.78rem;
  color: var(--ms-text-secondary, #64748b);
  margin: -4px 0 8px;
  padding: 5px 10px;
  background: var(--ms-bg-alt, #f1f5f9);
  border-radius: 6px;
  border-left: 3px solid var(--ms-primary, #6366f1);
  line-height: 1.5;
}

/* ============================================
   BATCH LAYOUT PAGE
   ============================================ */

/* Batch Layout — reuses .editor-layout, .editor-toolbar, .editor-stage, .editor-inspector */
.bl-editor-layout {
  /* inherits editor-layout; no extra overrides needed */
}

/* Batch Layout canvas matches editor canvas */
#pageBatchLayout .preview-media canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* Batch Layout aspect buttons use variant-toggle compact — active state via JS class */
.bl-aspect-btn.active,
.bl-variant-btn.active {
  background: var(--ms-surface);
  color: var(--ms-primary);
  box-shadow: var(--ms-shadow-xs);
}

/* ============================================
   BUILDER REFACTOR — Touch-First, Preview-Centric
   Phases 1-7 unified styles
   ============================================ */

/* === PHASE 1: TOUCH-FIRST FOUNDATION ===
   Min 44px touch targets, generous spacing, clear feedback */

/* Buttons: ensure 44px minimum touch area */
button, .btn, .ghost-btn {
  min-height: 44px;
  padding: 0 var(--ms-space-4);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button.small, .btn.small, .ghost-btn.small {
  min-height: 36px;
  padding: 0 var(--ms-space-3);
}

/* Better active/focus feedback for touch */
button:active:not(:disabled) {
  transform: scale(0.97);
  transition-duration: 50ms;
}

button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ms-primary);
  outline-offset: 2px;
}

/* Select elements: 44px height */
select {
  min-height: 44px;
}

/* Text inputs: 44px height */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
input[type="number"] {
  min-height: 44px;
}

/* Toggle switches: larger touch target */
.toggle {
  min-height: 44px;
  padding: var(--ms-space-2) var(--ms-space-3);
  border-radius: var(--ms-radius);
  gap: var(--ms-space-3);
}

.toggle:hover {
  background: var(--ms-bg);
}

.toggle:active {
  background: var(--ms-border-light);
}

.toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

/* Range sliders: taller thumb for touch */
input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ms-primary);
  border: none;
  cursor: pointer;
}

input[type="range"] {
  height: 8px;
}

/* Preview tabs: larger touch targets */
.preview-tab {
  min-height: 40px;
  padding: 0 var(--ms-space-4);
  font-size: var(--ms-text-sm);
}

/* Variant buttons: touch-friendly */
.variant-btn {
  min-height: 40px;
  padding: 0 var(--ms-space-4);
}

/* More generous spacing in form fields */
.builder-panel .field {
  margin-bottom: var(--ms-space-4);
}

/* Controls grid: more space between items */
.controls-grid {
  gap: var(--ms-space-4);
}

.controls-grid.compact .field {
  margin-bottom: var(--ms-space-2);
}

/* Better spacing in control rows */
.control-row {
  gap: var(--ms-space-4);
  margin-bottom: var(--ms-space-4);
}

/* ============================================
   ON-CANVAS VISUAL EDITOR LAYOUT
   ============================================ */

/* ============================================
   HOME HUB — Create + History
   ============================================ */
.home-hub {
  display: flex;
  flex-direction: column;
  gap: var(--ms-space-4);
}

.home-create-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ms-space-4);
}

.home-hub .generator-card {
  margin: 0;
}

.home-hub .history-card {
  margin-top: var(--ms-space-2);
}

.home-hub .history {
  max-height: calc(100vh - 500px);
  overflow-y: auto;
}

@media (max-width: 799px) {
  .home-create-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   ON-CANVAS VISUAL EDITOR LAYOUT
   ============================================ */

/* Editor fills viewport below header — no page scroll */
body.editor-active {
  overflow: hidden;
}

body.editor-active .container {
  max-width: none;
  padding: 0;
}

body.editor-active .app-footer {
  display: none;
}

#pageGenerate.editor-active {
  padding: 0;
}

#pageGenerate.editor-active .home-hub {
  display: none;
}

.editor-layout {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--header-h, 56px));
  overflow: hidden;
  padding: var(--ms-space-2);
}

/* --- Editor Toolbar --- */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ms-space-3);
  padding: var(--ms-space-2) var(--ms-space-3);
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  margin-bottom: var(--ms-space-2);
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.editor-toolbar::-webkit-scrollbar {
  display: none;
}

.editor-toolbar-modes {
  display: flex;
  gap: 2px;
  background: var(--ms-bg);
  padding: 3px;
  border-radius: var(--ms-radius);
  flex-shrink: 0;
}

.editor-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--ms-radius-sm);
    background: transparent;
    color: var(--ms-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    font-size: 0;
    overflow: hidden;
    transition: background 0.15s ease, color 0.15s ease;
}

.editor-back-btn:hover {
    background: var(--ms-surface-hover, var(--ms-bg));
    color: var(--ms-text);
}

.editor-back-btn::before,
.editor-back-btn::after {
    content: none !important;
}

.editor-back-btn svg {
    display: block;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex: 0 0 auto;
    fill: currentColor;
    overflow: visible;
    pointer-events: none;
}

.editor-back-btn svg path {
    fill: currentColor;
}

.editor-mode {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--ms-space-2) var(--ms-space-3);
  min-height: 44px;
  min-width: 44px;
  border: none;
  border-radius: var(--ms-radius-sm);
  background: transparent;
  color: var(--ms-text-muted);
  font-size: var(--ms-text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.editor-mode svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.editor-mode:hover {
  color: var(--ms-text);
  background: var(--ms-surface-hover);
}

.editor-mode.active {
  background: var(--ms-surface);
  color: var(--ms-primary);
  box-shadow: var(--ms-shadow-sm);
  font-weight: 600;
}

.editor-toolbar-utils {
  display: flex;
  align-items: center;
  gap: var(--ms-space-3);
  flex-shrink: 0;
}

.variant-toggle.compact {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0;
  background: var(--ms-bg);
  padding: 2px;
  border-radius: var(--ms-radius-sm);
  border: 1px solid var(--ms-border-light);
}

.variant-toggle.compact .variant-btn {
  height: 30px;
  padding: 0 12px;
  font-size: var(--ms-text-xs);
  display: flex;
  align-items: center;
  border: none;
  background: transparent;
  color: var(--ms-text-secondary);
  cursor: pointer;
  border-radius: var(--ms-radius-sm);
  transition: all 0.15s ease;
}

.variant-toggle.compact .variant-btn:hover {
  color: var(--ms-text);
}

.variant-toggle.compact .variant-btn.active {
  background: var(--ms-surface);
  color: var(--ms-primary);
  box-shadow: var(--ms-shadow-xs);
}

.variant-toggle.compact .variant-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Grid toggle: compact inside toolbar */
.editor-toolbar-utils .toggle {
  min-height: unset;
  height: 34px;
  padding: 0 10px;
  gap: 6px;
  font-size: var(--ms-text-xs);
  font-weight: 500;
  color: var(--ms-text-secondary);
  border-radius: var(--ms-radius-sm);
}

.editor-toolbar-utils .toggle:hover {
  background: var(--ms-bg);
  color: var(--ms-text);
}

.editor-toolbar-utils .toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--ms-primary);
}

/* --- Toolbar Action Buttons (Card, Render, MP4, Publish) --- */
.editor-toolbar-actions {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  margin-left: auto;
  flex-shrink: 0;
}

.toolbar-action-btn {
  height: 30px;
  padding: 0 10px;
  font-size: var(--ms-text-xs);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-radius: var(--ms-radius-sm);
  background: var(--ms-primary);
  color: var(--ms-text-inverse);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.toolbar-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.toolbar-action-btn.ghost {
  background: var(--ms-bg);
  color: var(--ms-text-secondary);
  border: 1px solid var(--ms-border-light);
}

.toolbar-action-btn.ghost:hover:not(:disabled) {
  background: var(--ms-surface-hover, var(--ms-border-light));
  color: var(--ms-text);
}

.toolbar-action-btn.publish {
  background: var(--ms-primary);
  color: var(--ms-text-inverse);
}

.toolbar-action-btn.publish:hover:not(:disabled) {
  opacity: 0.9;
}

.toolbar-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 999px) {
  .toolbar-action-btn span {
    display: none;
  }
  .toolbar-action-btn {
    padding: 0 8px;
    min-width: 30px;
    justify-content: center;
  }
}

/* --- Editor Stage: Canvas + Inspector side by side --- */
.editor-stage {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: minmax(0, 1fr);
  gap: var(--ms-space-3);
  flex: 1;
  min-height: 0;
}

/* --- Canvas Area --- */
.editor-canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--ms-bg-alt);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  padding: var(--ms-space-3);
  min-height: 0;
  overflow: hidden;
}

.editor-canvas .preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  max-height: 70vh;
  width: 100%;
}

/* Video controls bar — compact under preview */
.editor-canvas .video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin: var(--ms-space-2) auto 0;
  padding: 6px var(--ms-space-3);
  background: var(--ms-surface);
  border: 1px solid var(--ms-border-light);
  border-radius: var(--ms-radius);
  gap: var(--ms-space-2);
}

.video-controls .ghost-btn.small {
  border: none;
  background: var(--ms-bg);
  color: var(--ms-text-secondary);
  border-radius: var(--ms-radius-sm);
  padding: 4px 10px;
  font-size: var(--ms-text-xs);
  font-weight: 500;
  line-height: 1;
}

.video-controls .ghost-btn.small:hover {
  background: var(--ms-border-light);
  color: var(--ms-text);
}

.video-controls .video-time {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
  font-family: var(--ms-font-mono, monospace);
  line-height: 1;
  padding-left: var(--ms-space-2);
  border-left: 1px solid var(--ms-border-light);
}

.editor-canvas .preview-frame {
  width: 100%;
  max-width: 480px;
  max-height: 100%;
  margin: 0 auto;
}

.editor-canvas .preview-media {
  position: relative;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--ms-radius-lg);
  overflow: hidden;
  box-shadow: var(--ms-shadow-lg);
  cursor: default;
  max-height: 100%;
}

.editor-canvas .preview-media[data-aspect="9:16"] {
  aspect-ratio: 9/16;
}

.editor-canvas .preview-media[data-aspect="1:1"] {
  aspect-ratio: 1/1;
}

.editor-canvas .preview-media[data-aspect="4:5"] {
  aspect-ratio: 4/5;
}

.editor-canvas .preview-media[data-aspect="16:9"] {
  aspect-ratio: 16/9;
}

/* Canvas interaction cursors based on mode */
.editor-canvas[data-mode="select"] .preview-media {
  cursor: default;
}

.editor-canvas[data-mode="crop"] .preview-media {
  cursor: grab;
}

.editor-canvas[data-mode="crop"] .preview-media.dragging {
  cursor: grabbing;
}

/* Canvas hint */
.editor-canvas-hint {
  position: absolute;
  bottom: var(--ms-space-3);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 16px;
  border-radius: var(--ms-radius-full);
  font-size: var(--ms-text-xs);
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.editor-canvas-hint.hidden {
  opacity: 0;
}

/* Video controls inside canvas area */
.editor-canvas .video-controls {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  padding: var(--ms-space-2) 0;
}

/* --- Contextual Inspector --- */
.editor-inspector {
  display: flex;
  flex-direction: column;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  overflow: hidden;
  min-height: 0;
  transition: width 0.2s ease;
}

.editor-inspector.collapsed {
  width: 40px;
  min-width: 40px;
}

.editor-inspector.collapsed .inspector-body,
.editor-inspector.collapsed .inspector-title {
  display: none;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ms-space-3) var(--ms-space-4);
  border-bottom: 1px solid var(--ms-border-light);
  flex-shrink: 0;
  background: var(--ms-bg);
}

.inspector-title {
  font-size: var(--ms-text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ms-text-secondary);
}

.inspector-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--ms-text-muted);
  cursor: pointer;
  border-radius: var(--ms-radius-sm);
  transition: all 0.15s ease;
}

.inspector-toggle:hover {
  background: var(--ms-surface-hover);
  color: var(--ms-text);
}

.editor-inspector.collapsed .inspector-toggle svg {
  transform: rotate(180deg);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--ms-space-3);
}

.inspector-body::-webkit-scrollbar {
  width: 4px;
}

.inspector-body::-webkit-scrollbar-thumb {
  background: var(--ms-border);
  border-radius: 2px;
}

/* Inspector sections: only active one is visible */
.inspector-section {
  display: none;
}

.inspector-section.active {
  display: block;
}

/* Compact fields in inspector */
.inspector-section .field.compact {
  margin-bottom: var(--ms-space-2);
}

.inspector-section .field.compact label {
  font-size: var(--ms-text-xs);
  margin-bottom: 2px;
}

.inspector-section .field.compact input,
.inspector-section .field.compact textarea,
.inspector-section .field.compact select {
  font-size: var(--ms-text-sm);
  padding: 6px 10px;
}

.inspector-section .field.compact textarea {
  resize: vertical;
  min-height: 36px;
}

.inspector-group {
  margin-bottom: var(--ms-space-3);
  /*padding-bottom: var(--ms-space-3);
  border-bottom: 1px solid var(--ms-border-light);*/
}

/* --- Editor Actions (bottom bar) --- */
.editor-actions {
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-lg);
  padding: var(--ms-space-3) var(--ms-space-4);
  margin-top: var(--ms-space-3);
  flex-shrink: 0;
}

.editor-actions-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ms-space-3);
}

.editor-actions-secondary {
  display: flex;
  gap: var(--ms-space-2);
  flex-shrink: 0;
}

.editor-actions-primary {
  display: flex;
  gap: var(--ms-space-2);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-bar-btn {
  min-height: 44px;
  padding: 0 var(--ms-space-4);
  font-size: var(--ms-text-sm);
  font-weight: 500;
  border-radius: var(--ms-radius);
  display: inline-flex;
  align-items: center;
  gap: var(--ms-space-2);
  white-space: nowrap;
}

.action-bar-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.action-bar-publish {
  background: var(--ms-primary);
  color: var(--ms-text-inverse);
}

.action-bar-publish:hover:not(:disabled) {
  background: var(--ms-primary-hover);
}

/* === ADVANCED SECTIONS (details/summary) === */
.builder-advanced {
  margin-top: var(--ms-space-3);
  border: 1px solid var(--ms-border-light);
  border-radius: var(--ms-radius);
  overflow: hidden;
}

.builder-advanced summary {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  padding: var(--ms-space-2) var(--ms-space-3);
  font-size: var(--ms-text-xs);
  font-weight: 500;
  color: var(--ms-text-secondary);
  cursor: pointer;
  user-select: none;
  background: var(--ms-bg);
  min-height: 36px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  list-style: none;
}

.builder-advanced summary::-webkit-details-marker {
  display: none;
}

.builder-advanced summary::before {
  content: '▸';
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}

.builder-advanced[open] summary::before {
  transform: rotate(90deg);
}

.builder-advanced summary:hover {
  color: var(--ms-text);
  background: var(--ms-surface-hover);
}

.builder-advanced > :not(summary) {
  padding: var(--ms-space-2) var(--ms-space-3) var(--ms-space-3);
}

/* ============================================
   RESPONSIVE: EDITOR LAYOUT
   ============================================ */

/* Desktop wide: inspector wider */
@media (min-width: 1200px) {
  .editor-stage {
    grid-template-columns: 1fr 360px;
  }

  .editor-canvas .preview-frame {
    max-width: 540px;
    text-align: -webkit-center;
  }
}

/* Tablet / narrow desktop: inspector narrower */
@media (max-width: 999px) {
  .editor-stage {
    grid-template-columns: 1fr 280px;
  }
}

/* Mobile: stack vertically, allow internal scroll */
@media (max-width: 799px) {
  body.editor-active {
    overflow: auto;
  }

  .editor-layout {
    height: auto;
    max-height: none;
    overflow-y: auto;
    padding: var(--ms-space-2);
  }

  .editor-toolbar {
    flex-wrap: nowrap;
    padding: var(--ms-space-2);
  }

  .editor-toolbar-modes {
    overflow-x: auto;
    flex-shrink: 1;
    min-width: 0;
  }

  .editor-mode span {
    display: none;
  }

  .editor-mode {
    padding: var(--ms-space-2);
    min-width: 44px;
    justify-content: center;
  }

  .editor-toolbar-utils {
    gap: var(--ms-space-2);
  }

  .editor-toolbar-actions {
    display: none;
  }

  .editor-stage {
    grid-template-columns: 1fr;
    gap: var(--ms-space-2);
  }

  .editor-canvas {
    min-height: 250px;
    max-height: 55vh;
  }

  .editor-canvas .preview-frame {
    max-width: 100%;
  }

  .editor-canvas .preview-media {
    max-height: 50vh;
  }

  .editor-inspector {
    max-height: 45vh;
    border-radius: var(--ms-radius-lg) var(--ms-radius-lg) var(--ms-radius) var(--ms-radius);
  }

  .editor-inspector.collapsed {
    width: auto;
    min-width: auto;
    max-height: 44px;
    overflow: hidden;
  }

  .editor-inspector.collapsed .inspector-toggle svg {
    transform: rotate(90deg);
  }
}

/* Very small screens: icon-only toolbar */
@media (max-width: 480px) {
  .editor-toolbar-utils .preview-tabs,
  .editor-toolbar-utils .toggle {
    display: none;
  }
}

/* Low-height viewport */
@media (max-height: 700px) and (min-width: 800px) {
  .editor-canvas .preview-media {
    max-height: 50vh;
  }
}

/* Page padding for home hub (removed when editor-active) */
#pageGenerate {
  padding-bottom: 20px;
}

#pageGenerate.editor-active {
  padding-bottom: 0;
}

/* Distribute & Settings pages — ensure scrollable content */
#pagePublish,
#pageSettings {
  padding-bottom: 40px;
  overflow-y: auto;
}

/* ============================================
   START PAGE — Hub with 3 Entry Points
   ============================================ */
.start-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: var(--ms-space-10) var(--ms-space-6);
  gap: 0;
}

.start-page-header {
  text-align: center;
  margin-bottom: var(--ms-space-10);
}

.start-page-header h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ms-text);
  margin-bottom: 10px;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.start-page-subtitle {
  font-size: 1rem;
  color: var(--ms-text-secondary);
  line-height: 1.5;
}

.start-page-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 920px;
  margin-bottom: var(--ms-space-12);
}

.start-card {
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 36px 28px 32px;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-xl);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--ms-shadow-xs);
  position: relative;
  overflow: hidden;
}

.start-card:hover {
  border-color: var(--ms-border-dark, rgba(0, 0, 0, 0.15));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  transform: translateY(-3px);
}

.start-card:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
}

.start-card-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ms-radius-lg);
  background: var(--ms-primary-light, rgba(99, 102, 241, 0.1));
  color: var(--ms-primary);
  position: relative;
  z-index: 1;
}

.start-card-icon svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.75;
}

.start-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ms-text);
  margin: 0;
  position: relative;
  z-index: 1;
}

.start-card p {
  font-size: var(--ms-text-sm);
  color: var(--ms-text-secondary);
  margin: 0;
  line-height: 1.55;
  position: relative;
  z-index: 1;
}

/* Start page - Recent items strip */
.start-recent {
  width: 100%;
  max-width: 920px;
}

.start-recent-header {
  display: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.start-recent-list {
  display: flex;
  gap: var(--ms-space-3);
  overflow-x: auto;
  padding: var(--ms-space-2) 2px;
  list-style: none;
  margin: 0;
  padding-left: 0;
  scroll-behavior: smooth;
}

.start-recent-list::-webkit-scrollbar {
  height: 5px;
}

.start-recent-list::-webkit-scrollbar-track {
  background: var(--ms-bg-alt);
  border-radius: 3px;
}

.start-recent-list::-webkit-scrollbar-thumb {
  background: var(--ms-border);
  border-radius: 3px;
}

.start-recent-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--ms-space-3);
  padding: 10px 16px;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 260px;
  min-width: 180px;
  box-shadow: var(--ms-shadow-xs);
}

.start-recent-item:hover {
  border-color: var(--ms-primary);
  background: var(--ms-surface);
  box-shadow: var(--ms-shadow-sm);
  transform: translateY(-1px);
}

.start-recent-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: var(--ms-radius-sm);
  flex-shrink: 0;
  border: 1px solid var(--ms-border-light);
}

.start-recent-item .recent-info {
  overflow: hidden;
  min-width: 0;
}

.start-recent-item .recent-info h5 {
  font-size: var(--ms-text-sm);
  font-weight: 600;
  color: var(--ms-text);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-recent-item .recent-info span {
  font-size: var(--ms-text-xs);
  color: var(--ms-text-muted);
}

/* ============================================
   GENERATE SUBVIEWS — Shared Styles
   ============================================ */
.generate-subview {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 160px);
}

.generate-subview.hidden {
  display: none;
}

.subview-topbar {
  display: flex;
  align-items: center;
  gap: var(--ms-space-4);
  padding: var(--ms-space-4) 0;
  margin-bottom: var(--ms-space-4);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--ms-surface);
  border: 1px solid var(--ms-border);
  border-radius: var(--ms-radius);
  color: var(--ms-text-secondary);
  font-size: var(--ms-text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--ms-shadow-xs);
}

.back-btn:hover {
  color: var(--ms-text);
  border-color: var(--ms-text-muted);
  box-shadow: var(--ms-shadow-sm);
}

.back-btn svg {
  width: 16px;
  height: 16px;
}

.new-content-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--ms-primary);
  border: none;
  border-radius: var(--ms-radius);
  color: #fff;
  font-size: var(--ms-text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.new-content-btn:hover {
  background: var(--ms-primary-hover);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.new-content-btn svg {
  width: 16px;
  height: 16px;
}

.subview-title {
  font-size: var(--ms-text-xl);
  font-weight: 700;
  color: var(--ms-text);
  letter-spacing: -0.01em;
}

.subview-topbar .ghost-btn {
  margin-left: auto;
}

/* Editor view: full viewport */
#editorView .editor-layout {
  min-height: calc(100vh - 160px);
}

/* History full view */
#historyView .history {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  border-radius: var(--ms-radius-lg);
}

/* ============================================
   FORM VIEWS — Centered, Generous Layout
   ============================================ */
#chatFormView,
#urlFormView {
  align-items: center;
}

#chatFormView .generator-card,
#urlFormView .generator-card {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 40px;
  border-radius: var(--ms-radius-xl);
  box-shadow: var(--ms-shadow);
  border: 1px solid var(--ms-border);
}

#chatFormView .generator-card h2,
#urlFormView .generator-card h2 {
  font-size: var(--ms-text-xl);
  font-weight: 700;
  margin-bottom: 6px;
}

#chatFormView .generator-card .section-subtitle,
#urlFormView .generator-card .section-subtitle {
  font-size: var(--ms-text-base);
  color: var(--ms-text-secondary);
  margin-bottom: 24px;
}

/* Enhanced upload area in form view */
#chatFormView .chat-upload-area {
  min-height: 160px;
  max-height: 220px;
  border-radius: var(--ms-radius-lg);
  padding: 28px;
}

#chatFormView .chat-upload-placeholder svg {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
}

#chatFormView .chat-upload-placeholder p {
  font-size: var(--ms-text-base);
}

/* Enhanced form fields in form view */
#chatFormView .field label,
#urlFormView .form-row label {
  font-size: var(--ms-text-sm);
  font-weight: 600;
  color: var(--ms-text-secondary);
  margin-bottom: 6px;
}

#chatFormView textarea,
#urlFormView input[type="url"] {
  padding: 12px 14px;
  font-size: var(--ms-text-base);
  border-radius: var(--ms-radius);
  border: 1px solid var(--ms-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#chatFormView textarea:focus,
#urlFormView input[type="url"]:focus {
  border-color: var(--ms-border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#chatFormView select,
#urlFormView select {
  padding: 10px 12px;
  font-size: var(--ms-text-sm);
  border-radius: var(--ms-radius);
}

/* Enhanced generate button in form views */
#chatFormView #chatGenerateBtn,
#urlFormView #generateBtn {
  padding: 10px 24px;
  font-size: var(--ms-text-base);
  font-weight: 600;
  border-radius: var(--ms-radius);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
  transition: all 0.2s ease;
}

#chatFormView #chatGenerateBtn:hover:not(:disabled),
#urlFormView #generateBtn:hover:not(:disabled) {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

/* URL form specific - controls row stays horizontal */
#urlFormView .form-row {
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

/* Toggle style enhancement in form views */
#chatFormView .toggle,
#urlFormView .toggle {
  font-size: var(--ms-text-sm);
  gap: 8px;
}

/* Status message styling */
#chatFormView .status,
#urlFormView .status {
  font-size: var(--ms-text-sm);
  margin-top: 8px;
}

/* ============================================
   RESPONSIVE — Start Page
   ============================================ */
@media (max-width: 640px) {
  .start-page {
    padding: var(--ms-space-6) var(--ms-space-4);
  }

  .start-page-header {
    margin-bottom: var(--ms-space-6);
  }

  .start-page-header h2 {
    font-size: 1.5rem;
  }

  .start-page-subtitle {
    font-size: var(--ms-text-sm);
  }

  .start-page-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    gap: 12px;
    margin-bottom: var(--ms-space-8);
  }

  .start-card {
    flex-direction: row;
    text-align: left;
    padding: 18px 20px;
    gap: 14px;
    align-items: center;
  }

  .start-card-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
  }

  .start-card-icon svg {
    width: 22px;
    height: 22px;
  }

  .start-card h3 {
    font-size: var(--ms-text-base);
  }

  .start-card p {
    display: none;
  }

  .start-recent-item {
    max-width: 200px;
    min-width: 160px;
  }

  /* Form view mobile */
  #chatFormView .generator-card,
  #urlFormView .generator-card {
    padding: 24px 20px;
  }
}

@media (min-width: 641px) and (max-width: 899px) {
  .start-page-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 680px;
    gap: 16px;
  }

  .start-card {
    padding: 28px 20px 24px;
  }

  .start-card-icon {
    width: 56px;
    height: 56px;
  }
}

@media (min-width: 1400px) {
  .start-page-grid {
    max-width: 1040px;
    gap: 24px;
  }

  .start-card {
    padding: 44px 32px 36px;
  }

  .start-page-header h2 {
    font-size: 2.25rem;
  }

  .start-recent {
    max-width: 1040px;
  }

  #chatFormView .generator-card,
  #urlFormView .generator-card {
    max-width: 740px;
    padding: 44px 48px;
  }
}

/* ── Video preview active: dim editor controls ── */

.video-edit-banner {
  display: flex;
  align-items: center;
  gap: var(--ms-space-2);
  padding: 10px 14px;
  margin: 0 0 var(--ms-space-3);
  background: var(--ms-primary-bg, rgba(99,102,241,0.08));
  border: 1px solid var(--ms-primary, #6366f1);
  border-radius: var(--ms-radius);
  color: var(--ms-primary, #6366f1);
  font-size: var(--ms-text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
  line-height: 1.4;
}
.video-edit-banner:hover {
  background: rgba(99,102,241,0.15);
}
.video-edit-banner-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* Only dim editing sections (select/crop) — keep video, audio, publish fully usable */
#inspectorBody.video-preview-active .inspector-section[data-mode="select"],
#inspectorBody.video-preview-active .inspector-section[data-mode="crop"] {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease;
}
#inspectorBody.video-preview-active .video-edit-banner {
  opacity: 1;
  pointer-events: auto;
}

/* ── Global Processing Popup ── */

.processing-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: ppFadeIn 0.2s ease;
}
.processing-popup.hidden {
  display: none !important;
}
.processing-popup-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 48px;
  background: var(--ms-surface, #1e293b);
  border: 1px solid var(--ms-border-light, #334155);
  border-radius: var(--ms-radius-lg, 12px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  min-width: 200px;
}
.processing-popup-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--ms-primary, #6366f1);
  border-radius: 50%;
  animation: ppSpin 0.8s linear infinite;
}
.processing-popup-msg {
  margin: 0;
  font-size: var(--ms-text-sm, 14px);
  font-weight: 500;
  color: var(--ms-text, #e2e8f0);
  text-align: center;
  line-height: 1.4;
}
@keyframes ppFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ppSpin {
  to { transform: rotate(360deg); }
}

/* ── All Generations Page ── */

/* "See all" link at the bottom of Recent Generations */
.history-see-all {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  cursor: pointer;
  color: var(--ms-primary, #6366f1);
  font-size: var(--ms-text-sm);
  font-weight: 500;
  grid-column: 1 / -1; /* span full grid row */
  border: 1px dashed var(--ms-border);
  border-radius: var(--ms-radius);
  transition: background 0.15s ease;
}
.history-see-all:hover {
  background: var(--ms-surface, #1e293b);
}

/* Generations grid uses the same .history grid styles.
   Each <li> is identical to Recent Generations cards.
   The only addition is a delete button overlaid on the thumbnail. */
.gen-card-wrap {
  position: relative;
}
.gen-card-wrap img {
  display: block;
}
.gen-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gen-delete-btn:hover {
  background: var(--ms-error, #ef4444);
}
.history li:hover .gen-delete-btn {
  opacity: 1;
}

.generations-load-more {
  display: flex;
  justify-content: center;
  padding: 16px;
  grid-column: 1 / -1;
}
.generations-load-more.hidden {
  display: none;
}

/* ============================================
 * Dark Mode Overrides
 * Status badges and elements with hardcoded light-mode colors
 * ============================================ */

html[data-theme="dark"] .status-badge.configured,
html[data-theme="dark"] .status-badge.active,
html[data-theme="dark"] .status-badge.sent,
html[data-theme="dark"] .publish-status.sent {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

html[data-theme="dark"] .status-badge.not-configured,
html[data-theme="dark"] .status-badge.queued,
html[data-theme="dark"] .publish-status.queued {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

html[data-theme="dark"] .status-badge.inactive,
html[data-theme="dark"] .status-badge.failed,
html[data-theme="dark"] .publish-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

html[data-theme="dark"] .alert.error,
html[data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

html[data-theme="dark"] .alert.success,
html[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--ms-surface);
  color: var(--ms-text);
  border-color: var(--ms-border);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--ms-text-muted);
}

html[data-theme="dark"] .header {
  border-bottom-color: var(--ms-border);
}

html[data-theme="dark"] .toast {
  background: var(--ms-surface);
  color: var(--ms-text);
  border-color: var(--ms-border);
  box-shadow: var(--ms-shadow-lg);
}

html[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

html[data-theme="dark"] .modal-content {
  background: var(--ms-surface);
  border-color: var(--ms-border);
}

html[data-theme="dark"] .dropdown-menu {
  background: var(--ms-surface);
  border-color: var(--ms-border);
  box-shadow: var(--ms-shadow-lg);
}

html[data-theme="dark"] .dropdown-item:hover {
  background: var(--ms-surface-hover);
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--ms-bg);
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--ms-border);
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--ms-text-muted);
}