:root {
  /* Color Palette — YouTube Studio Dark Theme */
  --bg-base: #0f0f0f;
  --bg-surface: #1a1a1a;
  --bg-surface-hover: #262626;
  --bg-card: #212121;
  --bg-card-subtle: #141414;
  --border-subtle: #2e2e2e;
  --border-focus: #3ea6ff;

  --text-primary: #f1f1f1;
  --text-secondary: #aaaaaa;
  --text-muted: #717171;

  --accent-red: #ff0000;
  --accent-red-hover: #d90000;
  --accent-red-subtle: rgba(255, 0, 0, 0.08);
  --accent-blue: #3ea6ff;
  --accent-green: #2ba640;
  --accent-yellow: #f59e0b;

  /* Border Radius Scale (8 / 12 / 16px) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Spacing Scale (4 / 8 / 12 / 16 / 24 / 32px) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Typography Scale (12 / 14 / 16 / 20 / 24 / 32px) */
  --font-xs: 12px;
  --font-sm: 14px;
  --font-md: 16px;
  --font-lg: 20px;
  --font-xl: 24px;
  --font-2xl: 32px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.65);
  --shadow-main: var(--shadow-md);

  /* Layout Dimensions */
  --sidebar-width: 248px;
  --sidebar-compact-width: 72px;
  --topbar-height: 64px;
  --bottom-nav-height: 64px;
  --content-max-width: 1280px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[x-cloak] {
  display: none !important;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-sm);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: #4a4a4a;
}

/* Text Truncation Helpers */
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================= APP LAYOUT ================= */
.app-container {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
}

/* Sidebar (Desktop Full, Tablet Compact) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: width 0.2s ease;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-icon {
  background: var(--accent-red);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(255, 0, 0, 0.35);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text {
  font-size: var(--font-md);
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtext {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-red-subtle);
  color: var(--accent-red);
  font-weight: 600;
}

.nav-item.active svg {
  stroke: var(--accent-red);
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-xs);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-red);
  font-weight: 700;
  flex-shrink: 0;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

/* Main Wrapper & Centered Content */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: rgba(15, 15, 15, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-5);
}

.topbar-title {
  font-size: var(--font-lg);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.content-body {
  padding: var(--space-5);
  flex: 1;
  max-width: var(--content-max-width);
  width: 100%;
  margin: 0 auto;
}

/* Mobile Bottom Navigation */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-1);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: var(--font-xs);
  font-weight: 500;
  gap: var(--space-1);
  flex: 1;
  height: 100%;
  min-height: 44px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.bottom-nav-item.active {
  color: var(--accent-red);
  font-weight: 600;
}

/* ================= CARDS & CONTAINERS ================= */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-5);
  min-width: 0;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.card-title {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ================= BUTTONS (Min 44px height) ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}

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

.btn-primary {
  background: var(--accent-red);
  color: #fff;
}
.btn-primary:hover:not(:disabled):not(.disabled) {
  background: var(--accent-red-hover);
}

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

.btn-danger {
  background: rgba(255, 0, 0, 0.14);
  color: #ff6b6b;
  border-color: rgba(255, 0, 0, 0.3);
}
.btn-danger:hover:not(:disabled):not(.disabled) {
  background: rgba(255, 0, 0, 0.24);
}

.btn-sm {
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-xs);
  border-radius: var(--radius-sm);
}

.btn-icon-only {
  min-height: 38px;
  min-width: 38px;
  padding: var(--space-2);
}

/* ================= FORMS (Min 44px height) ================= */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  min-height: 44px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px var(--space-3);
  font-size: var(--font-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(62, 166, 255, 0.15);
}

.form-help {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: 1.4;
}

/* ================= GRIDS & STAT CARDS ================= */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

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

.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-red-subtle);
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-value {
  font-size: var(--font-xl);
  font-weight: 700;
  line-height: 1.2;
}

.stat-title {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

/* ================= BADGES & ALERTS ================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  font-size: var(--font-xs);
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.badge-info { background: rgba(62, 166, 255, 0.15); color: var(--accent-blue); }
.badge-success { background: rgba(43, 166, 64, 0.15); color: var(--accent-green); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.badge-danger { background: rgba(255, 0, 0, 0.15); color: #ff6b6b; }

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent-blue);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  animation: slideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.success { border-left-color: var(--accent-green); }
.toast.error { border-left-color: var(--accent-red); }

.toast-message {
  font-size: var(--font-sm);
  line-height: 1.4;
  color: var(--text-primary);
  flex: 1;
  word-break: break-word;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ================= MODALS / POPUPS (Sticky Header & Footer, Scrollable Body) ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: scaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-content.modal-wide {
  max-width: 720px;
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.modal-footer.space-between {
  justify-content: space-between;
}

@keyframes scaleUp {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ================= POPUP PILIH CHANNEL (Grid 2 Kolom Desktop, 1 Kolom HP) ================= */
.channel-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.channel-select-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-width: 0;
  user-select: none;
}

.channel-select-card:hover:not(.is-disabled) {
  border-color: #484848;
  background: var(--bg-surface-hover);
}

.channel-select-card.is-selected {
  border-color: var(--accent-red);
  background: rgba(255, 0, 0, 0.07);
}

.channel-select-card.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.channel-select-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #2b2b2b;
  flex-shrink: 0;
}

.channel-select-info {
  flex: 1;
  min-width: 0;
}

.channel-select-name {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-select-handle {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.channel-select-radio {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  font-size: var(--font-xs);
  font-weight: 700;
  transition: all 0.15s ease;
}

.channel-select-card.is-selected .channel-select-radio {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}

/* ================= LOGIN SCREEN ================= */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: var(--accent-red);
  color: #fff;
  margin-bottom: var(--space-4);
  box-shadow: 0 4px 16px rgba(255, 0, 0, 0.4);
}

/* ================= VIDEO LIST & HISTORY ROWS ================= */
.video-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.video-row {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 0;
}

.video-thumb {
  position: relative;
  width: 168px;
  aspect-ratio: 16/9;
  flex-shrink: 0;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--font-xs);
  color: var(--text-secondary);
  background: repeating-linear-gradient(135deg, #181818, #181818 10px, #1e1e1e 10px, #1e1e1e 20px);
  text-align: center;
  padding: var(--space-2);
}

.video-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.85);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.video-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.video-title {
  font-weight: 600;
  font-size: var(--font-sm);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Progress Bar */
.progress {
  height: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent-red);
  transition: width 0.25s ease;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

/* ================= VIDEO MAKER WORKSPACE ================= */
.maker-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: var(--space-5);
  align-items: start;
}

.maker-left {
  min-width: 0;
}

.maker-right {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-4));
  min-width: 0;
}

.mobile-collapse-btn {
  display: none;
}

/* Steps Bar (1-4) */
.steps-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-5);
}

.step-item {
  padding: var(--space-3) var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  min-height: 44px;
  user-select: none;
}

.step-item.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
}

.step-item.completed {
  color: var(--text-primary);
}

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-xs);
  flex-shrink: 0;
}

/* Cover Canvas Preview */
.canvas-preview-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.cover-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Background Gallery */
.bg-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-3);
}

.bg-thumb-card {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  cursor: pointer;
  background: #111;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.bg-thumb-card:hover {
  transform: translateY(-2px);
}

.bg-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bg-thumb-card.active {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.25);
}

.bg-active-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.bg-delete-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.bg-thumb-card:hover .bg-delete-btn {
  opacity: 1;
}

/* Tracklist Rows */
.tracklist-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: var(--font-xs);
  margin-bottom: var(--space-4);
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.track-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, background 0.15s ease;
  min-width: 0;
}

.track-row.drag-over {
  border-color: var(--accent-blue);
  background: rgba(62, 166, 255, 0.08);
}

.track-top-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.track-handle {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

.track-move-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.track-move-btns button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 4px;
}

.track-move-btns button:hover:not(:disabled) {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.track-move-btns button:disabled {
  opacity: 0.3;
  cursor: default;
}

.track-num {
  font-weight: 700;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.track-inputs {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--space-2);
}

.track-audio-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: var(--font-2xl);
  margin-bottom: var(--space-3);
  opacity: 0.65;
}

/* ================= RESPONSIVE BREAKPOINTS ================= */

/* 1. Tablet & Smaller Desktop (< 1024px): Video Maker Preview Moves to Top & Collapsible */
@media (max-width: 1023px) {
  .maker-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .maker-right {
    position: static;
    order: -1;
  }
  .mobile-collapse-btn {
    display: inline-flex;
  }
  .maker-preview-body.is-collapsed-mobile {
    display: none;
  }
}

/* 2. Tablet Only (768px – 1023px): Compact Icon-Only Sidebar, 2-Column Grids */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar {
    width: var(--sidebar-compact-width);
  }
  .sidebar-brand {
    justify-content: center;
    padding: 0;
  }
  .brand-meta,
  .nav-item span,
  .user-meta {
    display: none;
  }
  .sidebar-nav {
    padding: var(--space-3) var(--space-2);
    align-items: center;
  }
  .nav-item {
    justify-content: center;
    width: 48px;
    padding: 0;
  }
  .user-badge {
    flex-direction: column;
    padding: var(--space-2) var(--space-1);
    gap: var(--space-2);
    background: transparent;
    border: none;
  }
  .main-wrapper {
    margin-left: var(--sidebar-compact-width);
  }
  .content-body {
    padding: var(--space-4);
  }
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 3. Mobile (< 768px): Bottom Nav, 1-Column Content, Fullscreen Modals, Stacked Cards */
@media (max-width: 767px) {
  .sidebar {
    display: none;
  }
  .main-wrapper {
    margin-left: 0;
    padding-bottom: var(--bottom-nav-height);
  }
  .bottom-nav {
    display: flex;
  }
  .topbar {
    padding: 0 var(--space-4);
  }
  .topbar-title {
    font-size: var(--font-md);
  }
  .content-body {
    padding: var(--space-4);
  }
  .card {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }
  .grid-2, .grid-3, .grid-4, .channel-select-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Touch-friendly 44px height for all buttons on mobile */
  .btn, .btn-sm {
    min-height: 44px;
  }

  /* Video & Upload List Stacked Cards on Mobile */
  .video-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }
  .video-thumb {
    width: 100% !important;
  }
  .video-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
  .video-actions .btn {
    width: 100%;
  }

  /* Stepper 1-4 Compact on Mobile */
  .steps-bar {
    margin-bottom: var(--space-4);
  }
  .step-item {
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-1);
    font-size: 11px;
  }

  /* Tracklist Row on Mobile: Title & Artist on Top Row, Duration + Buttons on Bottom Row */
  .track-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  .track-top-line {
    width: 100%;
    align-items: flex-start;
  }
  .track-num {
    padding-top: 10px;
  }
  .track-inputs {
    grid-template-columns: minmax(0, 1fr);
  }
  .track-audio-meta {
    width: 100%;
    justify-content: space-between;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border-subtle);
  }
  .track-audio-meta .btn {
    flex: 1;
  }
  .track-audio-meta .btn-danger {
    flex: 0 0 44px;
  }

  .bg-delete-btn {
    opacity: 1;
  }

  /* Full-Screen Modals on Mobile */
  .modal-overlay {
    padding: 0;
  }
  .modal-content,
  .modal-content.modal-wide {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--space-4);
  }
  .modal-footer {
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
  }
}
