:root {
  --app-bg: #f5f7fb;
  --app-surface: #ffffff;
  --app-surface-soft: #f8fafc;
  --app-border: #e4e9f1;
  --app-text: #111827;
  --app-muted: #64748b;
  --app-primary: #6c5ce7;
  --app-primary-dark: #5145cd;
  --app-success: #16a34a;
  --app-danger: #dc2626;
  --app-sidebar: #111827;
  --app-sidebar-soft: #1f2937;
  --app-radius: 18px;
  --app-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
  --sidebar-width: 270px;
}

* {
  box-sizing: border-box;
}

.app-shell-page {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: Inter, Arial, sans-serif;
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 0%, rgba(108, 92, 231, 0.28), transparent 30%),
    var(--app-sidebar);
  color: #ffffff;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 13px;
  background: linear-gradient(135deg, #8b7cff, #5b4ee5);
  box-shadow: 0 10px 22px rgba(108, 92, 231, 0.35);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  margin-bottom: 3px;
  font-size: 1rem;
}

.sidebar-brand span {
  color: #aeb8c8;
  font-size: 0.78rem;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
  margin-top: 22px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.sidebar-nav a:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.sidebar-nav a.is-active {
  border-color: rgba(139, 124, 255, 0.35);
  background: linear-gradient(
    135deg,
    rgba(108, 92, 231, 0.3),
    rgba(108, 92, 231, 0.13)
  );
  color: #ffffff;
}

.sidebar-nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 900;
}

.sidebar-footer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer-card strong,
.sidebar-footer-card small {
  display: block;
}

.sidebar-footer-card strong {
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.sidebar-footer-card small {
  color: #94a3b8;
  font-size: 0.67rem;
}

.sidebar-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 900;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px clamp(20px, 3vw, 38px);
  border-bottom: 1px solid rgba(228, 233, 241, 0.95);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  letter-spacing: -0.035em;
}

.app-header p {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.79rem;
}

.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--app-border);
  border-radius: 11px;
  background: #ffffff;
  color: var(--app-text);
  font-size: 1.05rem;
  cursor: pointer;
}

.app-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.app-header-actions form {
  margin: 0;
}

.header-action-link,
.header-logout-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: #ffffff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.header-action-link:hover,
.header-logout-button:hover {
  transform: translateY(-1px);
  border-color: #c6bddf;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.header-logout-button {
  border-color: #fecaca;
  color: #b91c1c;
}

.app-content {
  width: min(100%, 1480px);
  flex: 1;
  margin-inline: auto;
  padding: clamp(20px, 3vw, 38px);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(20px, 3vw, 38px);
  border-top: 1px solid var(--app-border);
  color: var(--app-muted);
  font-size: 0.75rem;
}

.app-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.app-footer a {
  color: #475569;
  font-weight: 700;
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--app-primary);
}

.app-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 990;
  display: none;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.crm-page-grid {
  display: grid;
  gap: 22px;
}

.crm-card {
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
}

.crm-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.crm-card-header h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  letter-spacing: -0.025em;
}

.crm-card-header p {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.83rem;
}

.crm-primary-button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(
    135deg,
    var(--app-primary),
    var(--app-primary-dark)
  );
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.22);
  cursor: pointer;
}

.crm-primary-button:hover {
  transform: translateY(-1px);
}

.crm-empty-state {
  padding: 38px 20px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: var(--app-surface-soft);
  color: var(--app-muted);
  text-align: center;
}

.app-shell-page input,
.app-shell-page select,
.app-shell-page textarea {
  width: 100%;
  border: 1px solid #d9e0ea;
  border-radius: 11px;
  background: #ffffff;
  color: var(--app-text);
  font: inherit;
}

.app-shell-page input,
.app-shell-page select {
  min-height: 44px;
  padding: 10px 12px;
}

.app-shell-page textarea {
  padding: 12px;
  resize: vertical;
}

.app-shell-page input:focus,
.app-shell-page select:focus,
.app-shell-page textarea:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.11);
}

.app-shell-page label {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 750;
}

@media (max-width: 980px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.24s ease;
  }

  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-open .app-sidebar-backdrop {
    display: block;
  }

  .app-main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
  }

  .app-header-actions .header-action-link {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-header {
    min-height: 72px;
    padding: 11px 14px;
  }

  .app-header p {
    display: none;
  }

  .app-content {
    padding: 16px 12px 24px;
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px 14px;
  }

  .app-footer nav {
    gap: 12px;
  }

  .crm-card {
    padding: 17px;
    border-radius: 15px;
  }

  .crm-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-primary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell-page *,
  .app-shell-page *::before,
  .app-shell-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   CRM PAGE COMPONENTS
========================================================= */

.crm-secondary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--app-border);
  border-radius: 11px;
  background: #ffffff;
  color: #334155;
  font-size: 0.79rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.crm-secondary-button:hover {
  transform: translateY(-1px);
  border-color: #c4b5fd;
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.07);
}

.overview-welcome-card,
.create-page-intro,
.queue-page-summary,
.developer-contact-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid #ded9fb;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 92% 15%,
      rgba(108, 92, 231, 0.17),
      transparent 30%
    ),
    linear-gradient(135deg, #ffffff, #f7f5ff);
  box-shadow: var(--app-shadow);
}

.overview-welcome-card::after,
.create-page-intro::after,
.queue-page-summary::after,
.developer-contact-card::after {
  content: "";
  position: absolute;
  right: -55px;
  bottom: -85px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.08);
  pointer-events: none;
}

.overview-welcome-card > *,
.create-page-intro > *,
.queue-page-summary > *,
.developer-contact-card > * {
  position: relative;
  z-index: 1;
}

.overview-welcome-kicker,
.developer-section-label {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--app-primary);
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.overview-welcome-card h2,
.create-page-intro h2,
.queue-page-summary h2,
.developer-contact-card h2 {
  max-width: 720px;
  margin: 0 0 10px;
  color: #111827;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.overview-welcome-card p,
.create-page-intro p,
.queue-page-summary p,
.developer-contact-card p {
  max-width: 720px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.overview-welcome-actions,
.developer-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.overview-production-status {
  min-width: 245px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid rgba(22, 163, 74, 0.16);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.07);
}

.overview-production-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.12);
}

.overview-production-status strong,
.overview-production-status small {
  display: block;
}

.overview-production-status strong {
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.overview-production-status small {
  color: var(--app-muted);
  font-size: 0.69rem;
}

.overview-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.overview-stat-card {
  position: relative;
  overflow: hidden;
  min-height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
  border: 1px solid var(--app-border);
  border-radius: 17px;
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.055);
}

.overview-stat-card::after {
  content: "";
  position: absolute;
  top: -28px;
  right: -28px;
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.07);
}

.overview-stat-card > * {
  position: relative;
  z-index: 1;
}

.overview-stat-card span {
  color: var(--app-muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.overview-stat-card strong {
  margin: 7px 0 5px;
  color: #111827;
  font-size: 2rem;
  letter-spacing: -0.055em;
}

.overview-stat-card small {
  color: #94a3b8;
  font-size: 0.69rem;
}

.overview-recent-list {
  display: grid;
  gap: 10px;
}

.overview-recent-job {
  display: grid;
  grid-template-columns:
    minmax(260px, 1.4fr)
    minmax(200px, 0.8fr)
    auto;
  align-items: center;
  gap: 20px;
  padding: 15px 17px;
  border: 1px solid var(--app-border);
  border-radius: 13px;
  background: var(--app-surface-soft);
}

.overview-recent-job-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.overview-video-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(108, 92, 231, 0.11);
  color: var(--app-primary);
  font-size: 0.76rem;
}

.overview-recent-job-main strong,
.overview-recent-job-main small {
  display: block;
}

.overview-recent-job-main strong {
  overflow: hidden;
  margin-bottom: 5px;
  color: #1e293b;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-recent-job-main small {
  color: var(--app-muted);
  font-size: 0.69rem;
}

.overview-recent-progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.overview-recent-progress span {
  font-size: 0.72rem;
  font-weight: 850;
}

.overview-recent-progress small {
  color: var(--app-muted);
  font-size: 0.66rem;
}

.overview-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf4;
}

.overview-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--app-primary),
    #9388f6
  );
}

.overview-recent-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #ddd8fb;
  border-radius: 9px;
  background: #ffffff;
  color: var(--app-primary-dark);
  font-size: 0.7rem;
  font-weight: 850;
  text-decoration: none;
}

/* =========================================================
   CREATE VIDEO PAGE
========================================================= */

.create-page-step {
  min-width: 150px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid #ded9fb;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.76);
  text-align: center;
}

.create-page-step strong,
.create-page-step span {
  display: block;
}

.create-page-step strong {
  color: var(--app-primary);
  font-size: 2rem;
  letter-spacing: -0.05em;
}

.create-page-step span {
  color: var(--app-muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.video-creation-panel h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.video-creation-panel > p {
  margin: 0 0 22px;
  color: var(--app-muted);
  font-size: 0.82rem;
}

.video-creation-panel form {
  display: grid;
  gap: 20px;
}

.video-creation-panel textarea {
  min-height: 210px;
}

.video-creation-panel .settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.video-creation-panel .voice-select-row {
  display: flex;
  gap: 8px;
}

.video-creation-panel .voice-select-row select {
  min-width: 0;
}

.video-preview-button,
.voice-preview-button {
  min-width: 90px;
  border: 1px solid #ddd8fb;
  border-radius: 10px;
  background: #f7f5ff;
  color: var(--app-primary-dark);
  font-size: 0.69rem;
  font-weight: 850;
  cursor: pointer;
}

.video-creation-panel .voice-pool,
.video-creation-panel .caption-settings {
  padding: 19px;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background: var(--app-surface-soft);
}

.video-creation-panel .voice-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.video-creation-panel .voice-option label {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
}

.video-creation-panel .voice-option input {
  width: auto;
  min-height: auto;
}

.video-creation-panel .caption-settings-heading h3 {
  margin: 0 0 5px;
  font-size: 0.95rem;
}

.video-creation-panel .caption-settings-heading p {
  margin: 0 0 17px;
  color: var(--app-muted);
  font-size: 0.75rem;
}

.video-creation-panel .caption-controls-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;
}

.video-creation-panel form > button[type="submit"] {
  width: fit-content;
  min-width: 190px;
  min-height: 45px;
  padding: 11px 18px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(
    135deg,
    var(--app-primary),
    var(--app-primary-dark)
  );
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(108, 92, 231, 0.2);
  cursor: pointer;
}

/* =========================================================
   VIDEO QUEUE
========================================================= */

.queue-page-summary {
  padding-block: 28px;
}

#video-queue-panel {
  overflow: hidden;
}

#video-queue-panel > h2 {
  margin: 0 0 18px;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

#video-queue-panel table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#video-queue-panel th {
  padding: 12px 13px;
  border-bottom: 1px solid var(--app-border);
  background: #f8fafc;
  color: #64748b;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.055em;
  text-align: left;
  text-transform: uppercase;
}

#video-queue-panel td {
  padding: 15px 13px;
  border-bottom: 1px solid #edf0f5;
  color: #334155;
  font-size: 0.75rem;
  vertical-align: middle;
}

#video-queue-panel tbody tr:last-child td {
  border-bottom: 0;
}

#video-queue-panel tbody tr:hover td {
  background: #fafbfe;
}

.job-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #5145cd;
  font-size: 0.65rem;
  font-weight: 850;
  white-space: nowrap;
}

.job-status-completed {
  background: #dcfce7;
  color: #15803d;
}

.job-status-failed,
.job-status-cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

.job-status-waiting {
  background: #f1f5f9;
  color: #64748b;
}

.job-progress {
  min-width: 170px;
}

.job-progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.job-progress-header span {
  font-weight: 850;
}

.job-progress-header small {
  color: var(--app-muted);
  font-size: 0.63rem;
}

.job-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf4;
}

.job-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--app-primary),
    #9388f6
  );
}

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

.job-actions form {
  margin: 0;
}

.job-actions a,
.job-actions button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 9px;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 0.63rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.job-actions .danger-button,
.job-actions .cancel-button {
  border-color: #fecaca;
  color: #b91c1c;
}

.job-actions .retry-button {
  border-color: #ddd8fb;
  color: var(--app-primary-dark);
}

.notification-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-button,
.notification-sound-toggle {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  font-size: 0.68rem;
  font-weight: 800;
}

.notification-button {
  cursor: pointer;
}

.notification-sound-toggle {
  margin: 0;
}

.notification-sound-toggle input {
  width: auto;
  min-height: auto;
}

.notification-status {
  color: var(--app-muted);
  font-size: 0.65rem;
}

/* =========================================================
   ABOUT DEVELOPER
========================================================= */

.developer-page {
  display: grid;
  gap: 22px;
}

.developer-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(108, 92, 231, 0.2),
      transparent 33%
    ),
    linear-gradient(135deg, #ffffff, #f7f5ff);
}

.developer-profile-mark {
  width: clamp(105px, 12vw, 145px);
  height: clamp(105px, 12vw, 145px);
  display: grid;
  place-items: center;
  border: 8px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  background: linear-gradient(145deg, #8073ed, #5145cd);
  color: #ffffff;
  box-shadow: 0 18px 45px rgba(81, 69, 205, 0.25);
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.developer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 13px;
}

.developer-badge,
.developer-version-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.11);
  color: var(--app-primary-dark);
  font-size: 0.64rem;
  font-weight: 850;
}

.developer-version-badge {
  background: #eef2f7;
  color: #475569;
}

.developer-hero h2 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.06;
  letter-spacing: -0.055em;
}

.developer-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.91rem;
  line-height: 1.75;
}

.developer-environment {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 750;
}

.developer-content-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 22px;
}

.developer-content-grid h2,
.developer-page .crm-card-header h2 {
  margin: 0 0 12px;
  font-size: 1.28rem;
  letter-spacing: -0.035em;
}

.developer-introduction p {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.84rem;
  line-height: 1.85;
}

.developer-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.developer-check-grid span {
  position: relative;
  padding: 11px 11px 11px 34px;
  border: 1px solid var(--app-border);
  border-radius: 11px;
  background: var(--app-surface-soft);
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
}

.developer-check-grid span::before {
  content: "✓";
  position: absolute;
  left: 12px;
  top: 10px;
  color: var(--app-primary);
  font-weight: 900;
}

.developer-expertise-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}

.developer-expertise-grid article {
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background:
    linear-gradient(145deg, #ffffff, #f8fafc);
}

.developer-expertise-grid strong,
.developer-expertise-grid span {
  display: block;
}

.developer-expertise-grid strong {
  margin-bottom: 7px;
  color: #1e293b;
  font-size: 0.79rem;
}

.developer-expertise-grid span {
  color: var(--app-muted);
  font-size: 0.69rem;
  line-height: 1.55;
}

.developer-tech-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.developer-tech-grid span {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 9px;
  border: 1px solid var(--app-border);
  border-radius: 11px;
  background: var(--app-surface-soft);
  color: #334155;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.developer-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.developer-project-grid article {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: var(--app-surface-soft);
}

.developer-project-grid span,
.developer-project-grid strong {
  display: block;
}

.developer-project-grid span {
  margin-bottom: 7px;
  color: var(--app-muted);
  font-size: 0.65rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.developer-project-grid strong {
  overflow-wrap: anywhere;
  color: #1e293b;
  font-size: 0.76rem;
  line-height: 1.5;
}

.developer-contact-card {
  background:
    radial-gradient(
      circle at 92% 15%,
      rgba(139, 124, 255, 0.28),
      transparent 35%
    ),
    #111827;
  color: #ffffff;
}

.developer-contact-card h2 {
  color: #ffffff;
}

.developer-contact-card p {
  color: #aeb8c8;
}

.developer-contact-card .developer-section-label {
  color: #a99eff;
}

/* =========================================================
   RESPONSIVE PAGE COMPONENTS
========================================================= */

@media (max-width: 1180px) {
  .overview-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-creation-panel .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-creation-panel .caption-controls-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .developer-expertise-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .developer-tech-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .overview-welcome-card,
  .create-page-intro,
  .queue-page-summary,
  .developer-contact-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .overview-production-status {
    width: 100%;
  }

  .overview-recent-job {
    grid-template-columns: 1fr;
  }

  .overview-recent-actions a {
    width: 100%;
  }

  .developer-content-grid {
    grid-template-columns: 1fr;
  }

  .developer-expertise-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #video-queue-panel {
    overflow-x: auto;
  }

  #video-queue-panel table {
    min-width: 850px;
  }
}

@media (max-width: 680px) {
  .overview-stat-grid,
  .video-creation-panel .settings-grid,
  .video-creation-panel .caption-controls-grid,
  .developer-check-grid,
  .developer-expertise-grid,
  .developer-tech-grid,
  .developer-project-grid {
    grid-template-columns: 1fr;
  }

  .developer-hero {
    grid-template-columns: 1fr;
  }

  .developer-profile-mark {
    width: 95px;
    height: 95px;
    border-radius: 23px;
  }

  .create-page-step {
    width: 100%;
  }

  .video-creation-panel .voice-select-row {
    flex-direction: column;
  }

  .video-creation-panel .voice-preview-button {
    min-height: 42px;
  }

  .video-creation-panel form > button[type="submit"] {
    width: 100%;
  }

  .notification-controls {
    display: none;
  }
}

/* =========================================================
   API & INTEGRATIONS
========================================================= */

.api-settings-page {
  max-width: 1280px;
  margin-inline: auto;
}

.api-settings-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(25px, 4vw, 42px);
  border: 1px solid #ded9fb;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 90% 12%,
      rgba(108, 92, 231, 0.2),
      transparent 34%
    ),
    linear-gradient(135deg, #ffffff, #f7f5ff);
  box-shadow: var(--app-shadow);
}

.api-settings-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -100px;
  width: 235px;
  height: 235px;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.07);
}

.api-settings-hero > * {
  position: relative;
  z-index: 1;
}

.api-settings-hero h2 {
  margin: 0 0 10px;
  color: #111827;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.api-settings-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

.api-settings-summary {
  min-width: 185px;
  display: grid;
  place-items: center;
  padding: 22px;
  border: 1px solid #ddd8fb;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.api-settings-summary strong,
.api-settings-summary span {
  display: block;
}

.api-settings-summary strong {
  margin-bottom: 5px;
  color: var(--app-primary);
  font-size: 2rem;
  letter-spacing: -0.06em;
}

.api-settings-summary span {
  color: var(--app-muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.api-settings-form {
  display: grid;
  gap: 22px;
}

.api-provider-section {
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.055);
}

.api-provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.api-provider-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.api-provider-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--app-border);
  border-radius: 15px;
  background:
    linear-gradient(145deg, #ffffff, #fafbfe);
}

.api-provider-card-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.api-provider-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(
    145deg,
    rgba(108, 92, 231, 0.16),
    rgba(108, 92, 231, 0.08)
  );
  color: var(--app-primary-dark);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.api-provider-card h3,
.api-provider-card p {
  margin: 0;
}

.api-provider-card h3 {
  margin-bottom: 4px;
  color: #1e293b;
  font-size: 0.87rem;
  letter-spacing: -0.02em;
}

.api-provider-card p {
  color: var(--app-muted);
  font-size: 0.65rem;
}

.api-state {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.61rem;
  font-weight: 850;
  white-space: nowrap;
}

.api-state::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.api-state.is-ready {
  background: #dcfce7;
  color: #15803d;
}

.api-state.is-ready::before {
  background: #22c55e;
}

.api-provider-card label {
  margin-bottom: 7px;
}

.api-provider-card input {
  background: #ffffff;
}

.api-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.api-save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(222, 217, 251, 0.95);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.13);
  backdrop-filter: blur(16px);
}

.api-save-bar strong,
.api-save-bar span {
  display: block;
}

.api-save-bar strong {
  margin-bottom: 4px;
  color: #1e293b;
  font-size: 0.77rem;
}

.api-save-bar span {
  color: var(--app-muted);
  font-size: 0.67rem;
}

.api-remove-section {
  border-color: #fee2e2;
  box-shadow: 0 12px 35px rgba(185, 28, 28, 0.04);
}

.api-remove-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.api-danger-button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #fecaca;
  border-radius: 11px;
  background: #fff7f7;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 850;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.api-danger-button:hover {
  transform: translateY(-1px);
  background: #fee2e2;
}

.api-settings-page > .success {
  padding: 13px 15px;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.75rem;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .api-provider-grid-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .api-settings-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .api-settings-summary {
    width: 100%;
  }

  .api-provider-grid,
  .api-provider-grid-three,
  .api-fields-grid {
    grid-template-columns: 1fr;
  }

  .api-provider-card-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .api-provider-card-header .api-state {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .api-save-bar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .api-save-bar .crm-primary-button {
    width: 100%;
  }

  .api-remove-form {
    grid-template-columns: 1fr;
  }

  .api-danger-button {
    width: 100%;
  }
}

/* =========================================================
   SYSTEM HEALTH
========================================================= */

.system-health-page {
  max-width: 1380px;
  margin-inline: auto;
}

.system-health-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(25px, 4vw, 40px);
  border: 1px solid #d8e3f2;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(34, 197, 94, 0.14),
      transparent 34%
    ),
    linear-gradient(135deg, #ffffff, #f6faf8);
  box-shadow: var(--app-shadow);
}

.system-health-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.06);
}

.system-health-hero > * {
  position: relative;
  z-index: 1;
}

.system-health-hero h2 {
  margin: 0 0 9px;
  color: #111827;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.05em;
}

.system-health-hero p {
  max-width: 680px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.system-health-live {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px;
  border: 1px solid #bbf7d0;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.system-health-live strong,
.system-health-live small {
  display: block;
}

.system-health-live strong {
  margin-bottom: 4px;
  color: #166534;
  font-size: 0.8rem;
}

.system-health-live small {
  color: var(--app-muted);
  font-size: 0.67rem;
}

.system-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.health-detail-list {
  display: grid;
  gap: 10px;
}

.health-detail-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, 0.65fr) minmax(0, 1.35fr);
  align-items: center;
  gap: 18px;
  padding: 13px 14px;
  border: 1px solid var(--app-border);
  border-radius: 11px;
  background: var(--app-surface-soft);
}

.health-detail-list span {
  color: var(--app-muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.health-detail-list strong {
  overflow-wrap: anywhere;
  color: #1e293b;
  font-size: 0.74rem;
  line-height: 1.5;
  text-align: right;
}

.health-api-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.health-api-grid article {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--app-border);
  border-radius: 13px;
  background: var(--app-surface-soft);
}

.health-api-grid strong,
.health-api-grid span {
  display: block;
}

.health-api-grid strong {
  margin-bottom: 4px;
  color: #1e293b;
  font-size: 0.75rem;
}

.health-api-grid article > div > span {
  color: var(--app-muted);
  font-size: 0.63rem;
  line-height: 1.45;
}

@media (max-width: 1050px) {
  .health-api-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .system-health-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .system-health-live {
    width: 100%;
  }

  .system-health-grid {
    grid-template-columns: 1fr;
  }

  .health-api-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .health-detail-list > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .health-detail-list strong {
    text-align: left;
  }

  .health-api-grid article {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =========================================================
   PUBLISHING
========================================================= */

.publishing-page {
  max-width: 1380px;
  margin-inline: auto;
}

.publishing-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(25px, 4vw, 42px);
  border: 1px solid #ded9fb;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 90% 12%,
      rgba(108, 92, 231, 0.18),
      transparent 34%
    ),
    linear-gradient(135deg, #ffffff, #f7f5ff);
  box-shadow: var(--app-shadow);
}

.publishing-hero::after {
  content: "";
  position: absolute;
  right: -65px;
  bottom: -105px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.07);
}

.publishing-hero > * {
  position: relative;
  z-index: 1;
}

.publishing-hero h2 {
  margin: 0 0 10px;
  color: #111827;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.publishing-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

.publishing-readiness {
  width: min(100%, 320px);
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--app-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08);
}

.publishing-readiness .api-state {
  width: fit-content;
}

.publishing-readiness small {
  color: var(--app-muted);
  font-size: 0.69rem;
  line-height: 1.55;
}

.publishing-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.publishing-status-grid .overview-stat-card strong {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.publishing-checklist {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.publishing-checklist article {
  min-height: 125px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 18px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fffafa;
}

.publishing-checklist article.is-complete {
  border-color: #bbf7d0;
  background: #f7fff9;
}

.publishing-check-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.75rem;
  font-weight: 900;
}

.publishing-checklist article.is-complete .publishing-check-icon {
  background: #dcfce7;
  color: #15803d;
}

.publishing-checklist strong,
.publishing-checklist small {
  display: block;
}

.publishing-checklist strong {
  margin-bottom: 7px;
  color: #1e293b;
  font-size: 0.77rem;
}

.publishing-checklist small {
  color: var(--app-muted);
  font-size: 0.66rem;
  line-height: 1.55;
}

.publishing-video-list {
  display: grid;
  gap: 10px;
}

.publishing-video-card {
  display: grid;
  grid-template-columns:
    minmax(280px, 1fr)
    auto
    auto;
  align-items: center;
  gap: 18px;
  padding: 15px 17px;
  border: 1px solid var(--app-border);
  border-radius: 13px;
  background: var(--app-surface-soft);
}

.publishing-video-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.publishing-video-main > div {
  min-width: 0;
}

.publishing-video-main strong,
.publishing-video-main small {
  display: block;
}

.publishing-video-main strong {
  overflow: hidden;
  margin-bottom: 5px;
  color: #1e293b;
  font-size: 0.79rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.publishing-video-main small {
  color: var(--app-muted);
  font-size: 0.67rem;
}

.publishing-video-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.publishing-video-actions a {
  min-height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid #ddd8fb;
  border-radius: 9px;
  background: #ffffff;
  color: var(--app-primary-dark);
  font-size: 0.67rem;
  font-weight: 850;
  text-decoration: none;
}

@media (max-width: 1120px) {
  .publishing-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .publishing-checklist {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .publishing-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .publishing-readiness {
    width: 100%;
  }

  .publishing-video-card {
    grid-template-columns: 1fr;
  }

  .publishing-video-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .publishing-status-grid {
    grid-template-columns: 1fr;
  }

  .publishing-video-actions a {
    width: 100%;
  }
}

/* =========================================================
   SCENES LIBRARY
========================================================= */

.scenes-page {
  max-width: 1440px;
  margin-inline: auto;
}

.scenes-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid #ded9fb;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 90% 12%,
      rgba(108, 92, 231, 0.18),
      transparent 34%
    ),
    linear-gradient(135deg, #ffffff, #f7f5ff);
  box-shadow: var(--app-shadow);
}

.scenes-hero::after {
  content: "";
  position: absolute;
  right: -65px;
  bottom: -105px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.07);
}

.scenes-hero > * {
  position: relative;
  z-index: 1;
}

.scenes-hero h2 {
  margin: 0 0 10px;
  color: #111827;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.scenes-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.87rem;
  line-height: 1.75;
}

.scene-job-selector {
  width: min(100%, 360px);
  padding: 17px;
  border: 1px solid var(--app-border);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.scene-job-selector label {
  margin-bottom: 8px;
}

.scene-selected-video {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border: 1px solid var(--app-border);
  border-radius: 15px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.scene-selected-video span,
.scene-selected-video strong,
.scene-selected-video small {
  display: block;
}

.scene-selected-video span {
  margin-bottom: 5px;
  color: var(--app-primary);
  font-size: 0.63rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene-selected-video strong {
  margin-bottom: 5px;
  color: #1e293b;
  font-size: 0.88rem;
}

.scene-selected-video small {
  color: var(--app-muted);
  font-size: 0.68rem;
}

.scene-stat-grid .overview-stat-card strong {
  font-size: clamp(1.45rem, 2.3vw, 2rem);
}

.scene-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.scene-library-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--app-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.055);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.scene-library-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.09);
}

.scene-media-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0f172a;
}

.scene-media-preview img,
.scene-media-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.scene-media-missing {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(
      135deg,
      rgba(108, 92, 231, 0.12),
      rgba(15, 23, 42, 0.18)
    ),
    #1e293b;
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 800;
}

.scene-number-badge,
.scene-type-badge {
  position: absolute;
  top: 11px;
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.scene-number-badge {
  left: 11px;
}

.scene-type-badge {
  right: 11px;
}

.scene-library-content {
  padding: 17px;
}

.scene-library-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.scene-library-meta span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.59rem;
  font-weight: 800;
}

.scene-narration {
  display: -webkit-box;
  overflow: hidden;
  min-height: 63px;
  margin: 0 0 13px;
  color: #334155;
  font-size: 0.73rem;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.scene-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.scene-keywords span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border: 1px solid #e8e5fb;
  border-radius: 999px;
  background: #faf9ff;
  color: var(--app-primary-dark);
  font-size: 0.58rem;
  font-weight: 750;
}

.scene-details {
  border-top: 1px solid var(--app-border);
  padding-top: 13px;
}

.scene-details summary {
  color: var(--app-primary-dark);
  font-size: 0.67rem;
  font-weight: 850;
  cursor: pointer;
}

.scene-details > div {
  margin-top: 13px;
  padding: 11px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: var(--app-surface-soft);
}

.scene-details strong {
  display: block;
  margin-bottom: 6px;
  color: #1e293b;
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.scene-details p {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.66rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.scene-source-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid #ddd8fb;
  border-radius: 9px;
  background: #ffffff;
  color: var(--app-primary-dark);
  font-size: 0.63rem;
  font-weight: 850;
  text-decoration: none;
}

.scene-pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--app-border);
}

.scene-pagination a {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--app-border);
  border-radius: 10px;
  background: #ffffff;
  color: #475569;
  font-size: 0.67rem;
  font-weight: 850;
  text-decoration: none;
}

.scene-pagination a:last-child {
  justify-self: end;
}

.scene-pagination strong {
  color: var(--app-muted);
  font-size: 0.68rem;
  text-align: center;
}

.scenes-page > .success {
  padding: 13px 15px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.74rem;
  font-weight: 750;
}

@media (max-width: 1180px) {
  .scene-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .scenes-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .scene-job-selector {
    width: 100%;
  }

  .scene-selected-video {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .scene-library-grid {
    grid-template-columns: 1fr;
  }

  .scene-pagination {
    grid-template-columns: 1fr;
  }

  .scene-pagination a,
  .scene-pagination a:last-child {
    width: 100%;
    justify-self: stretch;
  }

  .scene-pagination strong {
    grid-row: 1;
  }
}

/* =========================================================
   LEGAL PAGES
========================================================= */

.legal-page {
  max-width: 1080px;
  display: grid;
  gap: 22px;
  margin-inline: auto;
}

.legal-hero {
  padding: clamp(25px, 4vw, 42px);
  border: 1px solid #ded9fb;
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 90% 10%,
      rgba(108, 92, 231, 0.17),
      transparent 34%
    ),
    linear-gradient(135deg, #ffffff, #f7f5ff);
  box-shadow: var(--app-shadow);
}

.legal-hero h2 {
  margin: 0 0 11px;
  color: #111827;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  letter-spacing: -0.05em;
}

.legal-hero p {
  max-width: 700px;
  margin: 0;
  color: var(--app-muted);
  font-size: 0.88rem;
  line-height: 1.75;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.legal-meta span {
  padding: 6px 10px;
  border: 1px solid #ddd8fb;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: #5145cd;
  font-size: 0.64rem;
  font-weight: 800;
}

.legal-content {
  display: grid;
  gap: 0;
}

.legal-content article {
  padding: 22px 0;
  border-bottom: 1px solid var(--app-border);
}

.legal-content article:first-child {
  padding-top: 0;
}

.legal-content article:last-of-type {
  border-bottom: 0;
}

.legal-content h2 {
  margin: 0 0 9px;
  color: #1e293b;
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.legal-content p {
  margin: 0;
  color: var(--app-muted);
  font-size: 0.79rem;
  line-height: 1.8;
}

.legal-content a {
  color: var(--app-primary-dark);
  font-weight: 800;
}

.legal-notice {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.7rem;
  line-height: 1.65;
}

/* =========================================================
   FINAL UI POLISH
========================================================= */

.app-shell-page,
.app-shell-page button,
.app-shell-page input,
.app-shell-page select,
.app-shell-page textarea {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sidebar-brand-copy {
  min-width: 0;
}

.sidebar-brand-copy strong,
.sidebar-brand-copy span,
.sidebar-brand-copy small {
  display: block;
}

.sidebar-brand-copy small {
  margin-top: 4px;
  color: #8f9caf;
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.015em;
}

.app-header {
  min-height: 74px;
  gap: 16px;
  padding-block: 11px;
}

.app-header-left {
  flex: 1 1 auto;
  overflow: hidden;
}

.app-header-left > div:last-child {
  min-width: 0;
}

.app-header h1,
.app-header p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-header-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.app-header-actions .crm-primary-button,
.app-header-actions .header-logout-button {
  min-height: 39px;
  white-space: nowrap;
}

/* Primary button hover fix */
.app-shell-page .crm-primary-button,
.app-shell-page a.crm-primary-button,
.app-shell-page button.crm-primary-button {
  border: 1px solid transparent;
  color: #ffffff;
}

.app-shell-page .crm-primary-button:hover,
.app-shell-page .crm-primary-button:focus,
.app-shell-page a.crm-primary-button:hover,
.app-shell-page button.crm-primary-button:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #594bd4, #4136ae);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(81, 69, 205, 0.28);
  text-decoration: none;
}

/* Secondary/header button hover fix */
.app-shell-page .crm-secondary-button:hover,
.app-shell-page .header-action-link:hover {
  background: #f7f5ff;
  color: #5145cd;
  text-decoration: none;
}

.app-shell-page .header-logout-button:hover {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #b91c1c;
}

/* System service cards alignment */
.app-shell-page .connection-status-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.app-shell-page .connection-card {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 17px 18px;
}

.app-shell-page .connection-card > div:first-child {
  min-width: 0;
}

.app-shell-page .connection-title {
  margin-bottom: 5px;
  line-height: 1.3;
}

.app-shell-page .connection-card small {
  max-width: 100%;
  line-height: 1.45;
}

.app-shell-page .connection-badge {
  justify-self: end;
  align-self: center;
}

.app-shell-page .api-connection-card {
  grid-column: 1 / -1;
  min-height: auto;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
  align-items: center;
}

.app-shell-page .api-provider-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.app-shell-page .api-provider {
  white-space: nowrap;
}

/* Recent video title overflow */
.overview-recent-job,
.overview-recent-job-main,
.overview-recent-job-main > div {
  min-width: 0;
}

.overview-recent-job-main strong {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* Queue title containment */
#video-queue-panel {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

#video-queue-panel td:nth-child(2) {
  min-width: 250px;
  max-width: 430px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#video-queue-panel td:nth-child(2) strong {
  line-height: 1.5;
}

/* Notifications moved below header */
.queue-notification-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 17px;
  border: 1px solid var(--app-border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.queue-notification-toolbar > div:first-child strong,
.queue-notification-toolbar > div:first-child span {
  display: block;
}

.queue-notification-toolbar > div:first-child strong {
  margin-bottom: 4px;
  color: #1e293b;
  font-size: 0.77rem;
}

.queue-notification-toolbar > div:first-child span {
  color: var(--app-muted);
  font-size: 0.67rem;
}

/* Smaller laptops */
@media (max-width: 1180px) {
  .app-header p {
    display: none;
  }

  .app-content {
    padding-inline: 22px;
  }
}

/* Tablet and mobile */
@media (max-width: 800px) {
  .app-shell-page .connection-status-grid {
    grid-template-columns: 1fr;
  }

  .app-shell-page .api-connection-card {
    grid-column: auto;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .app-shell-page .api-provider-list {
    justify-content: flex-start;
  }

  .queue-notification-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-notification-toolbar .notification-controls {
    display: flex;
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .app-header {
    min-height: 66px;
  }

  .app-header h1 {
    max-width: 46vw;
    font-size: 1.05rem;
  }

  .app-header-actions .crm-primary-button {
    display: none;
  }

  .app-shell-page .connection-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .app-shell-page .connection-badge {
    justify-self: start;
  }

  .overview-recent-job-main strong {
    -webkit-line-clamp: 3;
  }

  .queue-notification-toolbar .notification-controls {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .queue-notification-toolbar .notification-status {
    grid-column: 1 / -1;
  }
}

.developer-profile-media {
  width: clamp(105px, 12vw, 145px);
  height: clamp(105px, 12vw, 145px);
  flex: 0 0 auto;
}

.developer-profile-media > img,
.developer-profile-media > .developer-profile-mark {
  width: 100%;
  height: 100%;
}

.developer-profile-media > img {
  display: block;
  border: 8px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 18px 45px rgba(81, 69, 205, 0.2);
}

@media (max-width: 680px) {
  .developer-profile-media {
    width: 95px;
    height: 95px;
  }

  .developer-profile-media > img {
    border-radius: 23px;
  }
}

/* =========================================================
   FINAL HEADER, SERVICE BOX & ACTION FIXES
========================================================= */

/* Full-width shared header on every CRM page */
.app-shell-page .app-main {
  width: calc(100% - var(--sidebar-width));
  max-width: none;
}

.app-shell-page .app-header {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Redis, Ollama and API proper cards */
.app-shell-page .connection-status-grid {
  gap: 16px;
}

.app-shell-page .connection-card {
  border: 1px solid var(--app-border) !important;
  border-radius: 15px !important;
  background: #ffffff !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
}

.app-shell-page .connection-card:hover {
  border-color: #d7d1fa !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

/* Queue action button default and hover states */
.app-shell-page #video-queue-panel .job-actions a,
.app-shell-page #video-queue-panel .job-actions button {
  border: 1px solid #dce2eb !important;
  background: #ffffff !important;
  color: #334155 !important;
  box-shadow: none !important;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease !important;
}

.app-shell-page #video-queue-panel .job-actions a:hover,
.app-shell-page #video-queue-panel .job-actions button:hover {
  transform: translateY(-1px);
  border-color: #c9c1f8 !important;
  background: #f5f3ff !important;
  color: #5145cd !important;
}

/* Delete and cancel remain red */
.app-shell-page #video-queue-panel .job-actions .danger-button,
.app-shell-page #video-queue-panel .job-actions .cancel-button {
  border-color: #fecaca !important;
  background: #ffffff !important;
  color: #b91c1c !important;
}

.app-shell-page #video-queue-panel .job-actions .danger-button:hover,
.app-shell-page #video-queue-panel .job-actions .cancel-button:hover {
  border-color: #fca5a5 !important;
  background: #fff1f2 !important;
  color: #991b1b !important;
}

/* Retry remains purple */
.app-shell-page #video-queue-panel .job-actions .retry-button:hover {
  border-color: #c9c1f8 !important;
  background: #f5f3ff !important;
  color: #5145cd !important;
}

@media (max-width: 980px) {
  .app-shell-page .app-main {
    width: 100%;
  }
}

/* =========================================================
   RALEWAY + FULL-WIDTH HEADER CORRECTION
========================================================= */

.app-shell-page,
.app-shell-page button,
.app-shell-page input,
.app-shell-page select,
.app-shell-page textarea {
  font-family: "Open Sans", sans-serif !important;
}

.app-shell-page .app-shell {
  width: 100%;
  max-width: none;
}

.app-shell-page .app-main {
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  margin-left: var(--sidebar-width) !important;
}

.app-shell-page .app-header {
  position: sticky;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  align-self: stretch;
}

.scene-job-selector {
  width: min(100%, 360px);
  max-width: 360px;
  min-width: 0;
}

.scene-job-selector select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .app-shell-page .app-main {
    width: 100% !important;
    margin-left: 0 !important;
  }
}

@media (max-width: 760px) {
  .scene-job-selector {
    width: 100%;
    max-width: 100%;
  }
}

/* Scene video selector compact text */
.scene-job-selector select,
.scene-job-selector select option {
  font-size: 0.78rem !important;
  font-weight: 500;
}

.scene-job-selector select {
  min-height: 42px;
  padding: 8px 36px 8px 11px;
}

/* Notification button color fix */
.app-shell-page .notification-button {
  border-color: transparent !important;
  background: linear-gradient(135deg, #6c5ce7, #5145cd) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(81, 69, 205, 0.2);
}

.app-shell-page .notification-button:hover,
.app-shell-page .notification-button:focus {
  border-color: transparent !important;
  background: linear-gradient(135deg, #594bd4, #4136ae) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 11px 25px rgba(81, 69, 205, 0.28);
}

/* Remove credential button alignment */
.api-remove-form {
  align-items: end !important;
}

.api-remove-form .api-danger-button {
  align-self: end !important;
  min-height: 56px !important;
  height: 56px;
  margin: 0 !important;
  padding: 10px 20px;
  white-space: nowrap;
}

.api-remove-form select {
  min-height: 56px !important;
  height: 56px;
}

@media (max-width: 760px) {
  .api-remove-form .api-danger-button {
    width: 100%;
  }
}


/* Compact thumbnail prompt action */
.app-shell-page #video-queue-panel .job-actions .thumbnail-copy-button {
  width: auto !important;
  min-width: 0 !important;
  max-width: max-content !important;
  flex: 0 0 auto !important;
  white-space: nowrap;
  padding-left: 11px;
  padding-right: 11px;
}


/* =========================================================
   YOUTUBE PUBLISHING — SAFETY CHECKBOXES
========================================================= */

.app-shell-page .publishing-page .publishing-safety-card
.publishing-safety-option {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 11px !important;
  width: fit-content !important;
  max-width: 100%;
  margin: 0 0 15px !important;
  cursor: pointer;
  line-height: 1.45;
}

.app-shell-page .publishing-page .publishing-safety-card
.publishing-safety-option:last-child {
  margin-bottom: 0 !important;
}

.app-shell-page .publishing-page .publishing-safety-card
.publishing-safety-option input[type="checkbox"] {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: 0 0 18px !important;
  cursor: pointer;
}


/* YouTube publishing visibility spacing */
.app-shell-page .publishing-page
.publishing-safety-card > .api-fields-grid {
  margin-bottom: 22px;
}

.app-shell-page .publishing-page
#youtube-schedule-field small,
.app-shell-page .video-creation-panel
[data-auto-publish-schedule] small {
  display: block;
  margin-top: 6px;
}
