/*

 */

/* --- Remove.bg Design System --- */
:root {
  /* Remove.bg exact colors */
  --primary-color: #009af6;
  --primary-hover: #0077cc;
  --primary-ring: rgba(0, 154, 246, 0.1);
  
  --background-color: #ffffff;
  --card-background: #ffffff;
  --card-border: #e5e7eb;
  
  --text-color: #111827;
  --muted-text-color: #6b7280;
  --light-text-color: #9ca3af;
  
  --error-bg: #fef2f2;
  --error-text: #dc2626;
  --error-border: #fecaca;
  
  --success-bg: #f0fdf4;
  --success-text: #16a34a;
  --success-border: #bbf7d0;
  
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* --- Base Styles --- */
* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

  body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

/* --- Minimal Header --- */
.global-header {
  background: var(--card-background);
  border-bottom: 1px solid var(--card-border);
  padding: 16px 0;
  margin-bottom: 0;
  }
  
  .container {
  max-width: 1200px;
    margin: 0 auto;
  padding: 0 24px;
}

.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
}

.left-group { display:flex; align-items:center; gap:28px; }
.header-links { display:flex; align-items:center; gap:8px; }
.header-link { color: var(--text-color); text-decoration: none; font-weight: 600; }
.header-link:hover { text-decoration: none; color: var(--text-color); }

/* Ghost button used for "How to" in header: same size as Log in, no outline/bg by default */
.global-header .btn-ghost.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 92px;
  padding: 6px 16px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-color);
    font-weight: 700;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.01em;
}
.global-header .btn-ghost.btn-small:hover {
  background: #f3f4f6; /* same as btn-outline hover */
    border: 1px solid var(--card-border);
}

/* User menu (right aligned) */
.user-menu { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.user-label { color: var(--muted-text-color); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.user-email { background: none; border: 1px solid var(--card-border); padding: 8px 10px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.user-email:hover { background: #f3f4f6; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--card-background); border: 1px solid var(--card-border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; z-index: 1000; }
.user-credits { margin-bottom: 8px; }
.user-credits .uc-title { color: var(--muted-text-color); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.user-credits .uc-values { font-weight: 700; }
.user-action { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--card-border); border-radius: 10px; color: var(--text-color); text-decoration: none; font-weight: 600; margin-top: 6px; }
.user-action:hover { background: #f3f4f6; }
.user-action.primary { background: var(--primary-color); color: #fff; border-color: var(--primary-color); text-align: left; }
.user-action.primary:hover { background: var(--primary-hover); }
.inline-form { display: block; margin-top: 6px; }
.inline-form .user-action.signout-button { width: 100%; text-align: left; }

/* Mobile burger for guests; reuse user-menu-panel styling */
.mobile-menu { display: none; position: relative; }
.mobile-menu-btn { background: none; border: 1px solid var(--card-border); padding: 8px 10px; border-radius: 10px; cursor: pointer; }

/* Show burger and hide inline links on small screens */
@media (max-width: 768px) {
  .auth-buttons { display: none !important; }
  .global-header .auth-buttons { display: none !important; }
  .header-links { display: none !important; }
  .mobile-menu { display: inline-block; }
  /* Hide How to / FAQ inside signed-in header row; shown inside panel */
  .mobile-only { display: block; }
}

/* Guest auth buttons */
.auth-buttons { display: inline-flex; align-items: center; gap: 8px; }
.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  height: 34px;
  min-width: 80px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-decoration: none;
}
.btn-outline { border: 1px solid var(--card-border); color: var(--text-color); background: transparent; }
.btn-outline:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary-color); color: #fff; border: 1px solid var(--primary-color); }
.btn-primary:hover { background: var(--primary-hover); }

.page-title .home-link {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.page-title .home-link:hover {
  text-decoration: none;
  color: inherit;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--text-color);
}

.page-title .logo-inline {
  display: inline-block;
  line-height: 0;
  color: inherit;
}

.page-title .logo-inline svg {
  height: 32px;
  width: auto;
    display: block;
}

/* Desktop-only: nudge logo down 2px to align with wordmark */
@media (min-width: 1024px) {
  .page-title .logo-inline { position: relative; top: 2px; }
}

/* --- Main Content --- */
.main-content {
  padding: 20px 0;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  margin-bottom: 64px;
  padding: 0;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 20px;
  color: var(--text-color);
  letter-spacing: -0.025em;
}

.hero-sub {
  font-size: 20px;
  color: var(--muted-text-color);
  margin: 0 0 64px;
  font-weight: 400;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Guest section improvements */
.guest-section {
  margin: 80px auto;
  max-width: 1100px;
  padding: 0 24px;
  position: relative;
}

/* Reduce gap between hero subheadline and the first guest section */
/* Only adjust spacing for the guest hero */
.guest-hero { margin-bottom: 0; padding-bottom: 0; }
/* First guest section right after the hero: remove its own top spacing entirely */
.guest-hero + .guest-section { margin-top: 0; padding-top: 0; }
/* Remove the default 20px top margin on the grid for the first block */
.guest-hero + .guest-section .feature-grid { margin-top: 0; }
/* Default desktop gap below subheadline */
.guest-hero .hero-sub { margin-bottom: 64px; }
/* Reduce gap before USP section by 20% on desktop (64px → ~51px) */
@media (min-width: 769px) {
  .guest-hero + .usp-section { margin-top: -26px; padding-top: 0; }
}

/* Final override to neutralize any nth-child padding/margin on the FIRST guest section */
.main-content > .guest-hero + section.guest-section {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
.main-content section.guest-section:first-of-type {
  margin-top: 0 !important;
  padding-top: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
}
.main-content section.guest-section:first-of-type .feature-grid { margin-top: 0 !important; }

.guest-section:nth-child(even) {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 24px;
  padding: 80px 48px;
  margin: 80px auto;
}

.guest-section h2 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 24px;
  color: var(--text-color);
  text-align: center;
  letter-spacing: -0.02em;
}

.guest-section h3 {
  font-size: 20px;
    font-weight: 600;
  line-height: 1.3;
  margin: 0 0 16px;
  color: var(--text-color);
}

/* --- Dropzone (Remove.bg Style) --- */
.dropzone {
  margin: 0 auto 32px;
  max-width: 600px;
}

.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  display: none;
}
  
  .file-input-label {
    display: flex;
  flex-direction: column;
    align-items: center;
    justify-content: center;
  min-height: 280px;
  padding: 48px 32px;
  background: var(--card-background);
  border: 3px dashed #d1d5db;
  border-radius: var(--radius-xl);
    cursor: pointer;
  transition: all 0.2s ease;
    text-align: center;
    color: var(--muted-text-color);
    position: relative;
  gap: 16px;
  box-shadow: var(--shadow);
  }
  
  .file-input-label::before {
    content: "";
  width: 64px;
  height: 64px;
  background: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23009af6' stroke-width='2'%3E%3Cpath d='M12 16V8'/%3E%3Cpath d='M8 12l4 4 4-4'/%3E%3Crect x='3' y='16' width='18' height='4' rx='2'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0.7;
}

  .file-input-label:hover {
    border-color: var(--primary-color);
  background-color: #f8fafc;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.file-input-wrapper.dragging .file-input-label {
  border-color: var(--primary-color);
  background-color: #f0f9ff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

#fileName {
  font-weight: 600;
  color: var(--text-color);
  font-size: 18px;
}

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

.dropzone-subtext {
  font-size: 16px;
  color: var(--muted-text-color);
  margin: 0;
}

/* --- Reassurance --- */
.reassurance {
  text-align: center;
  color: var(--light-text-color);
  font-size: 14px;
  margin: 16px 0 0;
  background: transparent;
  border: none;
  padding: 0;
}

.reassurance a {
  color: inherit;
  text-decoration: underline;
}

.reassurance a:hover {
  color: inherit;
  text-decoration: underline;
}

.reassurance .sep {
  opacity: 0.6;
  margin: 0 8px;
}

/* --- Advanced Options (Collapsed by Default) --- */
.advanced {
  margin: 24px auto;
  max-width: 600px;
  background: transparent;
  border: none;
  padding: 0;
}

.advanced summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted-text-color);
  font-size: 14px;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius);
  transition: background-color 0.2s ease;
}

.advanced summary:hover {
  background-color: #f3f4f6;
  color: var(--text-color);
}

.advanced-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
  padding: 20px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.advanced-row .field {
  display: grid;
  gap: 8px;
}

/* Make default checkbox styling to match dropdown height and alignment */
.make-default-field { display: grid; gap: 8px; }
.make-default-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary-color);
}
.make-default-field label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
}

.advanced-row label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.advanced-row select {
    width: 100%;
  padding: 10px 12px;
    border: 1px solid var(--card-border);
  border-radius: var(--radius);
    background-color: var(--card-background);
    color: var(--text-color);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.advanced-row select:focus {
    outline: none;
    border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.checkbox-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.checkbox-field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  margin: 0;
}

/* --- Primary Button --- */
.btn-primary {
    width: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: block;
  padding: 16px 24px;
  background: var(--primary-color);
  color: white;
    border: none;
  border-radius: var(--radius-lg);
  font-size: 18px;
  font-weight: 600;
    cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
  box-shadow: var(--shadow);
}

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

.btn-primary:focus {
    outline: none;
  box-shadow: 0 0 0 3px var(--primary-ring), var(--shadow);
  }

.btn-primary:disabled {
  background: #d1d5db;
    cursor: not-allowed;
  transform: none;
    box-shadow: none;
  }
  
/* Header auth buttons: force compact, consistent sizing and typography */
.global-header .auth-buttons .btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 6px 12px;
  height: 34px;
  min-width: 92px;
  border-radius: 9999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: none;
}

.global-header .auth-buttons .btn-primary.btn-small {
  display: inline-flex;
  width: auto;
  padding: 6px 16px;
}

.global-header .auth-buttons .btn-outline.btn-small {
  padding: 6px 16px;
}

/* --- Processing View --- */
.processing {
  text-align: center;
  padding: 48px 24px;
  max-width: 600px;
  margin: 0 auto;
}

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

.stepper {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.step {
  padding: 0 16px;
  border-radius: 20px;
  border: 2px solid var(--card-border);
    color: var(--muted-text-color);
    font-weight: 600;
  font-size: 14px;
  background: var(--card-background);
  transition: all 0.2s ease;
}

.step.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.step.done {
  background: var(--success-bg);
  border-color: var(--success-text);
  color: var(--success-text);
}

.progress-wrap {
  display: grid;
  gap: 16px;
  place-items: center;
  margin-bottom: 32px;
}

.progress-line {
  width: 100%;
  max-width: 400px;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.progress-text {
    color: var(--muted-text-color);
  font-weight: 600;
  font-size: 16px;
}

/* --- Result View --- */
.result {
    text-align: center;
  padding: 48px 24px;
  max-width: 600px;
  margin: 0 auto;
}

.result-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-color);
}

.result-card {
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn-secondary {
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  background: #f3f4f6;
  color: var(--text-color);
  border: 1px solid var(--card-border);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Ensure the auth modal buttons align perfectly (desktop + mobile) */
#authModal .btn-primary,
#authModal .btn-secondary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 12px 18px !important;
  white-space: nowrap !important;
  line-height: 1 !important;
  min-width: 120px;
  margin: 0 !important; /* override global .btn-primary margin: 0 auto */
  width: auto !important;
}

#authModal .btn-primary { width: auto !important; }

/* Center on desktop, stack on small screens */
#authModal .auth-actions-row { justify-content: center !important; width: 100%; }
@media (max-width: 480px) {
  #authModal .auth-actions-row {
    flex-direction: column !important;
    gap: 10px !important;
  }
  #authModal .auth-actions-row .btn-primary,
  #authModal .auth-actions-row .btn-secondary {
    width: 100% !important;
    min-width: 0 !important;
  }
}

.btn-secondary:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

/* --- Jobs Table (Styled for Remove.bg) --- */
.jobs-section {
  margin-top: 0px;
  padding: 0 15px;
}

.jobs-section h2 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--text-color);
  text-align: center;
}

.table-wrap {
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* Desktop: limit table to 80% width and center */
@media (min-width: 1024px) {
  .jobs-section .table-wrap { width: 80%; margin: 0 auto; }
}

  table {
    width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  }
  
  th, td {
  padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
  }
  
  thead th {
  background-color: #f9fafb;
  font-weight: 600;
  color: var(--text-color);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:hover {
  background-color: #f9fafb;
}

.relative-time {
  color: var(--muted-text-color);
  font-weight: 500;
}

.summary-cell {
  max-width: 300px;
}

.summary-text {
  color: var(--muted-text-color);
  font-weight: 500;
  line-height: 1.4;
}

  /* Download button states */
  .download-btn {
    display: inline-flex;
    align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--card-border);
  background: var(--card-background);
  color: var(--text-color);
  transition: all 0.2s ease;
  width: 120px;
  font-size: 14px;
  height: 39px;
  vertical-align: middle;
}

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

.download-btn.ready:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.trash-btn {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  color: #9ca3af;
  height: 39px;
  width: 39px;
    display: inline-flex;
    align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 8px;
}
.trash-btn svg { width: 18px; height: 18px; }
.trash-btn:hover {
  color: var(--error-text) !important;
  background: rgba(220,38,38,0.06);
}

.edit-btn {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  color: #9ca3af; /* grey by default, like trash */
  height: 39px;
  width: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 8px;
}
.edit-btn svg { width: 18px; height: 18px; }
.edit-btn:hover {
  color: #4f46e5 !important; /* blue on hover */
  background: rgba(79,70,229,0.06);
}

/* Keep the status column tight to its content */
.status-cell { white-space: nowrap; width: 1%; }

.download-btn.disabled {
  background: #f3f4f6;
  color: var(--light-text-color);
    border-style: dashed;
  cursor: not-allowed;
}

.download-btn.error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

.download-btn.processing {
  background: #f3f4f6;
  color: var(--muted-text-color);
  border-style: dashed;
  pointer-events: none;
  }

  /* Progress pill for in-flight jobs */
  .progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: #f3f4f6;
  color: var(--muted-text-color);
  font-weight: 500;
  font-size: 12px;
}

  .progress-pill .bar-wrap {
  width: 60px;
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
    overflow: hidden;
  }

  .progress-pill .bar {
    height: 100%;
    width: 40%;
  background: var(--primary-color);
  border-radius: 2px;
  animation: progressPulse 1.5s ease-in-out infinite;
}

  @keyframes progressPulse {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

/* --- Alerts --- */
#alerts {
  display: none;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  margin-bottom: 24px;
  font-weight: 600;
  text-align: center;
}

/* --- Footer --- */
.site-footer {
  margin-top: 80px;
  padding: 32px 0;
  text-align: center;
  color: var(--muted-text-color);
  font-size: 14px;
  border-top: 1px solid var(--card-border);
  background: var(--card-background);
}

.site-footer .footer-link {
  color: var(--muted-text-color);
  text-decoration: none;
  font-weight: 500;
}

.site-footer .footer-link:hover {
  color: var(--text-color);
  text-decoration: underline;
}

.site-footer .sep {
  margin: 0 8px;
  opacity: 0.6;
}

.footer-signout-form {
  display: inline;
}

.button-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--muted-text-color);
}

.button-link:hover {
  color: var(--text-color);
  text-decoration: underline;
}

/* --- Flash Messages --- */
.flash {
  position: fixed;
  left: 24px;
  top: 24px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  z-index: 10000;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.flash.hide {
  opacity: 0;
  transform: translateY(-8px);
}

.flash-notice {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}

.flash-alert {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: var(--error-border);
}

/* --- Balance Badge --- */
  .balance-badge {
    position: fixed;
  left: 24px;
  bottom: 24px;
  padding: 12px 16px;
  background: var(--card-background);
    color: var(--text-color);
  border-radius: var(--radius-lg);
  font-size: 14px;
    z-index: 9999;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg);
  line-height: 1.4;
  display: grid;
  grid-auto-rows: auto;
  gap: 8px;
}

/* Hide floating badge on small screens; always visible on desktop */
@media (max-width: 1023px) {
  .balance-badge { display: none; }
}

/* Center and size nicely on small/medium screens */
@media (max-width: 1023px) {
  .balance-badge {
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    bottom: 16px;
    width: calc(100% - 32px);
    max-width: 360px;
  }
  .buy-credits-btn { display: block; width: 100%; text-align: center; }
  }

  .balance-badge .balance-label {
  font-weight: 600;
    font-size: 12px;
  color: var(--muted-text-color);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  }

  .balance-badge .balance-values {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-variant-numeric: tabular-nums;
  font-weight: 600;
  }

.balance-badge .balance-values .sep {
  opacity: 0.65;
}

  .buy-credits-btn {
  margin-top: 0;
    padding: 8px 12px;
  background: var(--primary-color);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-weight: 600;
    font-size: 12px;
    cursor: pointer;
  transition: background-color 0.2s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.buy-credits-btn:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

/* --- Auth Styles --- */
.auth-wrap {
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 48px 24px;
}

  .auth-card {
  width: min(400px, 90vw);
    background: var(--card-background);
    border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.auth-title {
  margin: 0 0 8px;
  font-size: 24px;
  color: var(--text-color);
  text-align: center;
  font-weight: 700;
}

.auth-sub {
  margin: 0 0 24px;
  color: var(--muted-text-color);
  text-align: center;
  font-size: 16px;
}

.auth-field {
  margin-bottom: 20px;
}

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

  .auth-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  color: var(--text-color);
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.password-wrap {
  position: relative;
}

.password-wrap .auth-input {
  padding-right: 80px;
}

.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid var(--card-border);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--muted-text-color);
  cursor: pointer;
  font-size: 12px;
}

.toggle-password:hover {
  color: var(--text-color);
  border-color: var(--primary-color);
}

.auth-error {
  display: block;
  margin-top: 6px;
  color: var(--error-text);
  font-weight: 600;
  font-size: 13px;
  min-height: 18px;
}

.auth-inline-alert {
  margin: 8px 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error-text);
  font-weight: 600;
  font-size: 14px;
}

.auth-inline-notice {
  margin: 8px 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 600;
  font-size: 14px;
}

.auth-actions {
  margin-top: 24px;
}

.auth-links {
  margin-top: 20px;
  text-align: center;
  color: var(--muted-text-color);
  font-size: 14px;
}

.auth-links a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.auth-links a:hover {
  text-decoration: underline;
}

.auth-links .sep {
  opacity: 0.6;
  margin: 0 8px;
}

  .auth-alert {
  width: min(400px, 90vw);
  margin-bottom: 16px;
    border: 1px solid var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  /* USP section: stack video (right) above text (left) on mobile */
  .usp-card-right { order: -1; }
  /* Reorder: upload, reassurance, then examples */
  .feature-grid .guest-upload-slot { order: 1; }
  .feature-grid .mobile-reassurance { order: 2; display: block !important; margin-bottom: 20px; }
  .feature-grid .guest-examples-slot { order: 3; }
  /* Hide the desktop reassurance on mobile */
  .desktop-reassurance { display: none !important; }
  /* tighten gap below hero sub on mobile */
  .guest-hero .hero-sub { margin-bottom: 16px !important; }
  /* reduce gap after first guest section (between examples and problems) */
  .guest-hero + .guest-section { margin-bottom: 24px; }
  
  .hero-title {
    font-size: 36px;
  }
  
  .hero-sub {
    font-size: 18px;
  }
  
  .file-input-label {
    min-height: 240px;
    padding: 32px 24px;
  }
  
  .dropzone-text {
    font-size: 20px;
  }
  
  .advanced-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .stepper {
    gap: 8px;
  }
  
  .step {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .result-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 300px;
  }
  
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  .balance-badge {
    left: 16px;
    bottom: 16px;
    right: 16px;
    width: auto;
  }
}

/* --- Legal Pages (Imprint / Privacy) --- */
.legal-page {
  max-width: 900px;
  margin: 40px auto;
  padding: 28px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* --- Transcript / Timeline Overlay (responsive) --- */
.transcript-overlay-card {
  /* allow taller viewport usage by default */
  max-height: 90vh;
}

@media (max-width: 768px) {
  /* Use more vertical space on mobile and tighten padding */
  .transcript-overlay-card {
    max-height: 98vh !important;
    width: calc(100% - 16px) !important;
    padding: 16px !important;
  }
  /* Mobile layout: hide Save; show Cancel + Re-Run side-by-side */
  .transcript-overlay-card #saveButton,
  .transcript-overlay-card #saveTl,
  .transcript-overlay-card .hide-on-mobile { display: none !important; }
  .transcript-overlay-card .auth-actions-row {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
  }
  .transcript-overlay-card .auth-actions-row > div { width: auto !important; display: flex !important; gap: 10px !important; }
  .transcript-overlay-card .btn-primary,
  .transcript-overlay-card .btn-secondary {
    width: 120px !important; /* match jobs table download button */
    height: 39px !important; /* match jobs table download button */
    min-height: 39px !important;
    padding: 8px 16px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  /* Ensure cancel (direct child) and inner group buttons stack uniformly */
  .transcript-overlay-card .auth-actions-row > button.btn-secondary { width: 120px !important; height: 39px !important; min-height: 39px !important; }
  .transcript-overlay-card .auth-actions-row > div > .btn-primary,
  .transcript-overlay-card .auth-actions-row > div > .btn-secondary { width: 120px !important; height: 39px !important; min-height: 39px !important; }
  /* Inputs stretch nicely on mobile */
  .transcript-overlay-card input.time-input { width: 80px !important; }
  .transcript-overlay-card textarea.content-input { 
    width: calc(100vw - 200px) !important; /* Much more conservative width */
    max-width: 220px !important; /* Smaller max width for mobile */
    min-height: 40px !important; 
    height: auto !important; /* Let height adjust to content */
    font-size: 13px !important;
    padding: 6px !important;
    box-sizing: border-box !important;
  }
}

.legal-page h1 {
  font-size: 32px;
  line-height: 1.2;
  margin: 0 0 16px;
}

.legal-page h2 {
  font-size: 22px;
  margin: 28px 0 8px;
}

.legal-page h3 {
  font-size: 18px;
  margin: 20px 0 6px;
}

.legal-page p,
.legal-page li {
  color: var(--text-color);
}

.legal-page ul {
  margin: 8px 0 16px 20px;
}

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

.legal-page a { color: var(--primary-color); }
.legal-page a:hover { color: var(--primary-hover); }

@media (max-width: 480px) {
  .hero-title {
    font-size: 28px;
  }
  
  .hero-sub {
    font-size: 16px;
  }
  
  .file-input-label {
    min-height: 200px;
    padding: 24px 16px;
  }
  
  .dropzone-text {
    font-size: 18px;
  }
  
  .dropzone-subtext {
    font-size: 14px;
  }
  
  .btn-primary {
    font-size: 16px;
    padding: 14px 20px;
  }
  
  .result-title {
    font-size: 24px;
  }
  
  .jobs-section h2 {
    font-size: 24px;
  }
}

/* --- Problem Section Cards --- */
.problem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.problem-card {
  display: block;
  padding: 0;
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.problem-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #d1d5db;
}

.problem-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fef2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.problem-content {
  flex: 1;
}

.problem-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-color);
}

.problem-content p {
  font-size: 14px;
  color: var(--muted-text-color);
  margin: 0;
  line-height: 1.5;
}

/* Square image container for problem cards */
.problem-image {
  width: 100%;
  margin: 0;
  aspect-ratio: 1 / 1; /* square */
  background: #ffffff; /* transparent/white */
}

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

/* Caption area under image */
.problem-caption {
  padding: 16px 20px;
}
.problem-caption h4 { margin: 0 0 6px; }
.problem-caption p { margin: 0; }

/* --- Waveform Enhancement --- */
.waveform-placeholder {
  height: 280px;
  border: 2px dashed var(--card-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 32px;
  text-align: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.waveform-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23009af6' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  opacity: 0.5;
}

.waveform-placeholder .before-after {
  display: flex;
  gap: 32px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.waveform-placeholder .wave-section {
  text-align: center;
  padding: 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--card-border);
}

.waveform-placeholder .wave-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-text-color);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.waveform-placeholder .description {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  position: relative;
  z-index: 1;
}

.waveform-arrow {
  color: var(--primary-color);
  font-size: 24px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

/* --- Enhanced Feature Cards --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
  position: relative;
}

/* Force 4 equal columns when explicitly requested */
.feature-grid.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.feature-card {
  padding: 24px;
  background: var(--card-background);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Shimmer animation for example video skeleton */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #111827;
}

/* Utility to remove top accent bar on specific cards */
.feature-card.no-accent::before { display: none; content: none; }

/* USP section typography: match pain card copy size */
.usp-card-left p { font-size: 16px; line-height: 1.5; }
/* Vertically center content in left USP card */
.usp-card-left > div { justify-content: center !important; }
/* Desktop-only slight right padding for USP paragraph */
@media (min-width: 769px) {
  .usp-card-left p { padding-right: 12px; }
}

.feature-card h4 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-color);
}

.feature-card p {
  font-size: 14px;
  color: var(--muted-text-color);
  margin: 0;
  line-height: 1.6;
}

/* Browser-like tabs for examples card */
.examples-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}
.examples-tab {
  appearance: none;
  background: var(--card-background);
  color: var(--text-color);
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}
.examples-tab:hover { background: #f3f4f6; }
.examples-tab.active {
  background: var(--card-background);
  color: var(--text-color);
  border-color: var(--card-border);
  position: relative;
  top: 1px;
}

/* Variant buttons reuse outline style */
/* Segmented toggle for Original/ScreenDub */
.examples-toggle { display: inline-flex; border: 1px solid var(--card-border); border-radius: 9999px; overflow: hidden; background: var(--card-background); }
.examples-toggle .toggle-seg { appearance:none; border:none; background: transparent; padding: 8px 14px; font-weight: 600; cursor:pointer; color: var(--text-color); }
.examples-toggle .toggle-seg + .toggle-seg { border-left: 1px solid var(--card-border); }
.examples-toggle .toggle-seg.active { background: var(--primary-color); color:#fff; }

/* Match heights: make upload dropzone stretch like example card */
.guest-upload-slot { align-items: stretch; }
.guest-upload-slot .guest-upload .file-input-label { height: 100%; min-height: 0; }
/* Offset upload to align its top with the example video's top (tabs + padding ≈ 70px) */
/* Match top of upload with top of actual video area in examples (exact margin set via JS) */
.guest-upload { margin-top: 0; }
@media (max-width: 768px) { .guest-upload { margin-top: 0; } }

/* Process steps with connections */
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 20px;
  position: relative;
}

.process-grid::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), transparent, var(--primary-color));
  z-index: 0;
}

.process-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  min-height: 320px;
}

.step-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #111827;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(0, 154, 246, 0.3);
}

.step-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e6f4ff, #bfdbfe);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto auto 12px;
  position: relative;
  z-index: 2;
}

/* --- Enhanced CTA Section --- */
.cta-section {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #b3e5fc;
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  margin: 80px auto;
  max-width: 800px;
  text-align: center;
}

.cta-section h2 {
  color: var(--text-color);
  margin-bottom: 16px;
}

.cta-section .cta-subtitle {
  font-size: 18px;
  color: var(--muted-text-color);
  margin-bottom: 32px;
  font-weight: 500;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--primary-color);
  color: white;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 154, 246, 0.2);
}

.cta-button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 154, 246, 0.3);
}

/* --- Better Responsive Grid --- */
@media (max-width: 768px) {
  .hero-title {
    font-size: 36px;
  }
  /* Reduce container bottom margin on mobile */
  .hero { margin-bottom: 16px; }
  
  .hero-sub {
    font-size: 18px;
    margin-bottom: 16px;
  }
  
  .guest-section {
    margin: 60px auto;
    padding: 0 16px;
  }
  
  .guest-section h2 {
    font-size: 28px;
  }
  
  .feature-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  /* Explicitly collapse 4-col grids to single column on mobile */
  .feature-grid.grid-4 {
    grid-template-columns: 1fr;
  }
  /* Stack 4-step process cards on mobile */
  .process-grid { grid-template-columns: 1fr; }
  .process-grid::before { display: none; }
  .process-step { min-height: auto; }
  
  .problem-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .waveform-placeholder {
    height: 180px;
    padding: 24px 16px;
  }
  
  .waveform-placeholder .before-after {
    flex-direction: column;
    gap: 16px;
  }
  
  .cta-section {
    padding: 32px 24px;
    margin: 60px auto;
  }
  
  /* Problem section becomes single column on mobile */
  .guest-section div[style*="grid-template-columns:1.2fr .8fr"] {
    display: block !important;
  }
  
  .guest-section div[style*="grid-template-columns:1.2fr .8fr"] > div:last-child {
    margin-top: 32px;
  }
  
  /* Better/Comparison grid adjustments */
  .guest-section div[style*="grid-template-columns:repeat(2,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  
  .guest-section div[style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  /* Force first guest-section to have zero top spacing on mobile as well */
  .main-content > .guest-hero + section.guest-section,
  .main-content section.guest-section:first-of-type {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  }
