/* ═══════════════════════════════════════════════════════════════════════
   Fabric AI — Enterprise Dark Theme
   Design ref: Vercel / Linear / Raycast
   ═══════════════════════════════════════════════════════════════════════ */

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

/* --- Design Tokens --- */
:root {
  /* Palette */
  --bg:              #09090b;
  --bg-card:         #18181b;
  --bg-elevated:     #27272a;
  --border:          #3f3f46;
  --border-hover:    #52525b;
  --text-primary:    #fafafa;
  --text-secondary:  #a1a1aa;
  --text-muted:      #71717a;
  --accent:          #8b5cf6;
  --accent-hover:    #a78bfa;
  --accent-dim:      rgba(139, 92, 246, 0.10);
  --accent-glow:     rgba(139, 92, 246, 0.15);
  --success:         #22c55e;
  --success-dim:     rgba(34, 197, 94, 0.12);
  --error:           #ef4444;
  --error-dim:       rgba(239, 68, 68, 0.12);
  --warning:         #f59e0b;
  --warning-dim:     rgba(245, 158, 11, 0.12);

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Legacy aliases (used in HTML inline styles / JS) */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-2xl: 24px;

  /* Shadows — layered for depth */
  --shadow-xs:    0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:    0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg:    0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl:    0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 24px 48px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(63, 63, 70, 0.5);
  --shadow-glow:  0 0 24px var(--accent-glow), 0 0 48px rgba(139, 92, 246, 0.08);

  /* Motion */
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.55, 0, 1, 0.45);
  --ease-out:  cubic-bezier(0, 0.55, 0.45, 1);
  --dur-fast:  120ms;
  --dur-norm:  200ms;
  --dur-slow:  300ms;

  /* Legacy aliases */
  --duration-fast:   150ms;
  --duration-normal: 250ms;
  --shadow-card:     var(--shadow-sm);
  --shadow-elevated: var(--shadow-lg);
  --bg-primary:      var(--bg);
}


/* ═══════════════════════════════════════
   BASE
   ═══════════════════════════════════════ */

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle noise texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover {
  color: var(--accent-hover);
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(139, 92, 246, 0.3);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

[hidden] {
  display: none !important;
}


/* ═══════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 transparent;
}


/* ═══════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════ */

h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h1 { font-size: clamp(1.375rem, 2vw, 1.75rem); }
h2 { font-size: clamp(1.125rem, 1.5vw, 1.375rem); }
h3 { font-size: clamp(0.9375rem, 1.2vw, 1.125rem); }
h4 { font-size: 0.875rem; }

.section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--success); }
.text-error     { color: var(--error); }


/* ═══════════════════════════════════════
   NAV
   ═══════════════════════════════════════ */

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
  border-bottom: 1px solid rgba(63, 63, 70, 0.4);
}

.nav-gradient {
  position: sticky;
  top: 56px;
  z-index: 99;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover), #c084fc, var(--accent));
  background-size: 200% 100%;
  animation: navGradientShift 6s ease infinite;
  opacity: 0.8;
}

@keyframes navGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}


/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.section {
  min-height: calc(100vh - 58px);
}

.upload-layout {
  display: grid;
  grid-template-columns: 30% 1fr;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 768px) {
  .upload-layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}


/* ═══════════════════════════════════════
   APP HEADER (section headers)
   ═══════════════════════════════════════ */

.app-header {
  padding: var(--space-10) 0 var(--space-8);
  max-width: 1400px;
  margin: 0 auto;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.app-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.title-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  font-weight: 400;
}

.app-logo {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.app-logo h1 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.app-logo .badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}


/* ═══════════════════════════════════════
   UPLOAD CONTAINERS
   ═══════════════════════════════════════ */

.upload-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}


/* ═══════════════════════════════════════
   UPLOAD STEPS
   ═══════════════════════════════════════ */

.upload-step {
  margin-bottom: var(--space-10);
}

.step-label {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.step-label h2 {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
}

.step-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  width: 100%;
  padding-left: 40px;
  margin-top: -2px;
}


/* ═══════════════════════════════════════
   DROP ZONE
   ═══════════════════════════════════════ */

.drop-zone,
.upload-zone {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--dur-norm) var(--ease);
  background: var(--bg-card);
}

.drop-zone:hover,
.upload-zone:hover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.04);
  box-shadow: var(--shadow-glow);
}

.drop-zone.drag-over,
.upload-zone.drag-over {
  border-color: var(--accent-hover);
  background: rgba(139, 92, 246, 0.08);
  box-shadow: var(--shadow-glow), inset 0 0 40px rgba(139, 92, 246, 0.06);
  transform: scale(1.005);
}

.drop-zone.has-files,
.upload-zone.has-files {
  border-style: solid;
  border-color: var(--border);
  padding: var(--space-6);
}

.drop-icon,
.upload-zone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-4);
  color: var(--text-muted);
  display: block;
  transition: all var(--dur-norm) var(--ease);
  opacity: 0.6;
}

.drop-zone:hover .drop-icon,
.upload-zone:hover .upload-zone-icon {
  color: var(--accent);
  opacity: 1;
  transform: translateY(-2px);
}

.drop-zone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.drop-text,
.upload-zone-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.drop-text strong {
  color: var(--accent);
  font-weight: 600;
}

.drop-hint,
.upload-zone-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.drop-zone-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.btn-remove {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}

.btn-remove:hover {
  background: var(--error);
  border-color: var(--error);
  transform: scale(1.1);
}

.drop-zone input[type="file"],
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}


/* ═══════════════════════════════════════
   THUMBNAILS
   ═══════════════════════════════════════ */

.thumbs-area {
  margin-top: var(--space-4);
}

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

.thumbs-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.thumb-item {
  position: relative;
  width: 64px;
  height: 64px;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all var(--dur-fast) var(--ease);
  background: var(--bg-card);
}

.thumb-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-item-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.75);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 0.625rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.thumb-item:hover .thumb-item-remove {
  opacity: 1;
}

.thumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.btn-add-more {
  margin-top: var(--space-3);
}


/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  letter-spacing: -0.01em;
}

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

/* Primary — violet gradient */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  transition: all var(--dur-fast) var(--ease);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.08) 50%, transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: var(--shadow-glow), 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Secondary — outline */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  transition: all var(--dur-fast) var(--ease);
}
.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* WhatsApp share button */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-md);
  border: none;
  background: #25D366;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-norm) var(--ease);
}
.btn-whatsapp .btn-icon {
  width: 18px;
  height: 18px;
}
.btn-whatsapp:hover {
  background: #1ebe5d;
  box-shadow: 0 0 16px rgba(37, 211, 102, 0.25);
}
.btn-whatsapp:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-whatsapp:disabled:hover {
  box-shadow: none;
}

/* Ghost / text button */
.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8125rem;
  font-family: inherit;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--dur-fast) var(--ease);
}

.btn-text:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: var(--error-dim);
  border-color: var(--error);
}

/* Download */
.btn-download {
  background: transparent;
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-download:hover:not(:disabled) {
  background: var(--success-dim);
  border-color: var(--success);
}

/* Generate — hero CTA */
.btn-generate {
  width: 100%;
  max-width: 480px;
  height: 52px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: var(--radius-lg);
  gap: var(--space-3);
}

/* Download all */
.btn-download-all {
  height: 44px;
  gap: var(--space-2);
  padding: 0 var(--space-6);
}

/* Size variants */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  height: 32px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  height: 48px;
}

/* Icon button */
.btn-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}

.btn-icon-only:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

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


/* ═══════════════════════════════════════
   GENERATE AREA
   ═══════════════════════════════════════ */

/* --- Login Page --- */
.login-container {
  max-width: 380px;
  margin: 80px auto 0;
  text-align: center;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: var(--space-3);
}

.login-logo svg {
  width: 48px;
  height: 48px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: left;
}

.login-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.login-input {
  padding: 10px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.btn-login {
  margin-top: var(--space-2);
  padding: 11px 0;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity 150ms ease, transform 100ms ease;
}

.btn-login:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.login-error {
  font-size: 0.8125rem;
  color: var(--error);
  text-align: center;
  margin: 0;
}

.login-footer {
  margin-top: var(--space-8);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Options Panel --- */
.options-panel {
  margin-top: var(--space-8);
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  margin-top: var(--space-5);
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 160px;
  flex: 1;
}

.option-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.option-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.options-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Pill Toggle */
.pill-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg);
}

.pill-btn {
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.pill-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.pill-btn--active {
  color: var(--text-primary);
  background: var(--accent);
}

.pill-btn--active:hover {
  background: var(--accent-hover);
}

/* Select Dropdown */
.option-select {
  padding: 7px 12px;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 150ms ease;
  appearance: auto;
}

.option-select:hover {
  border-color: var(--border-hover);
}

.option-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Detail photo attachment on thumbnails */
.detail-attach-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 3px 6px;
  font-size: 0.6875rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 150ms ease;
}

.detail-attach-btn:hover {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

.detail-attach-btn.has-detail {
  color: var(--success);
  background: var(--success-dim);
  border-color: var(--success);
  border-style: solid;
}

.color-attach-btn {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border-color: #f59e0b;
}

.color-attach-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.color-attach-btn.has-detail {
  color: var(--success);
  background: var(--success-dim);
  border-color: var(--success);
}

/* Detail area under each product thumb */
.detail-area {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 3px;
}

.detail-previews {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.mini-thumb-wrap {
  position: relative;
  display: inline-block;
}

.detail-mini-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  display: block;
}

.mini-thumb-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: var(--error);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 0.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 100ms ease;
  padding: 0;
}

.mini-thumb-wrap:hover .mini-thumb-remove {
  opacity: 1;
}

/* ── Component Grid (5-component upload system) ──────────────── */
.component-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-top: 2px;
}

.component-slot {
  border: 1.5px dashed var(--border);
  border-radius: 4px;
  padding: 6px 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  position: relative;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
}

.component-slot:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb, 59, 130, 246), 0.05);
}

.component-slot.filled {
  border-style: solid;
  border-color: var(--success, #22c55e);
  background: rgba(34, 197, 94, 0.06);
}

.component-slot.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.component-slot-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 1;
}

.component-slot.filled .component-slot-label {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.component-slot-hint {
  font-size: 0.55rem;
  color: var(--text-muted, #999);
  line-height: 1.2;
  z-index: 1;
}

.component-slot.filled .component-slot-hint {
  display: none;
}

.component-slot-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px;
  z-index: 0;
}

.component-slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--error);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 0.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 100ms ease;
  z-index: 2;
  padding: 0;
}

.component-slot:hover .component-slot-remove {
  opacity: 1;
}

/* Locked options for basic tier */
.option-group.locked {
  opacity: 0.4;
  pointer-events: none;
}

.generate-area {
  margin-top: var(--space-10);
  text-align: center;
  padding: 0 var(--space-6);
}

.generate-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--space-3);
}


/* ═══════════════════════════════════════
   CARDS (generic)
   ═══════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-body {
  padding: var(--space-4);
}

.card-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* ═══════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════ */

.progress-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6);
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  font-size: 0.8125rem;
}

.progress-label {
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.progress-eta {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.progress-bar-track {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 300ms var(--ease);
  position: relative;
}

.progress-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: progressShimmer 1.8s ease-in-out infinite;
}

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

/* Legacy progress bar classes */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 300ms var(--ease);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: progressShimmer 1.8s ease-in-out infinite;
}

.progress-label-text { color: var(--text-secondary); }
.progress-label-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}


/* ═══════════════════════════════════════
   PROGRESS ACTIONS
   ═══════════════════════════════════════ */

.progress-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0 var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.progress-stats {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}


/* ═══════════════════════════════════════
   GENERATION GRID (progress section)
   ═══════════════════════════════════════ */

.gen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-6);
}

.gen-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-norm) var(--ease),
              box-shadow var(--dur-norm) var(--ease),
              border-color var(--dur-fast) var(--ease);
  animation: cardFadeIn 0.4s var(--ease) both;
}

.gen-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

/* Staggered entrance */
.gen-card:nth-child(1)  { animation-delay: 0ms; }
.gen-card:nth-child(2)  { animation-delay: 40ms; }
.gen-card:nth-child(3)  { animation-delay: 80ms; }
.gen-card:nth-child(4)  { animation-delay: 120ms; }
.gen-card:nth-child(5)  { animation-delay: 160ms; }
.gen-card:nth-child(6)  { animation-delay: 200ms; }
.gen-card:nth-child(7)  { animation-delay: 240ms; }
.gen-card:nth-child(8)  { animation-delay: 280ms; }
.gen-card:nth-child(9)  { animation-delay: 320ms; }
.gen-card:nth-child(10) { animation-delay: 360ms; }
.gen-card:nth-child(11) { animation-delay: 400ms; }
.gen-card:nth-child(12) { animation-delay: 440ms; }

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gen-card-image {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg);
  overflow: hidden;
}

.gen-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform var(--dur-slow) var(--ease);
}

.gen-card-image img:hover {
  transform: scale(1.03);
}

.gen-card-thumbnail {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.gen-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gen-card-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.gen-card-badge.success {
  background: rgba(34, 197, 94, 0.9);
  color: #fff;
}

.gen-card-badge.failed {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

/* Pending state */
.gen-card.pending .gen-card-image {
  animation: pendingPulse 2s ease-in-out infinite;
}

/* Generating state */
.gen-card.generating .gen-card-image::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 2px solid rgba(63, 63, 70, 0.5);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.gen-card-info {
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  border-top: 1px solid rgba(63, 63, 70, 0.3);
}

.gen-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.gen-card-actions {
  display: flex;
  gap: var(--space-1);
}

/* gen-card inside gen-grid original/arrow/result layout */
.gen-card-original {
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--bg);
}
.gen-card-original img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gen-card-arrow {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-1);
  font-size: 0.875rem;
}
.gen-card-result {
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
}
.gen-card-result img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gen-card-meta {
  padding: var(--space-2) var(--space-3);
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(63, 63, 70, 0.3);
}

/* Spinner inside gen-card-result */
.gen-card-result .spinner,
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(63, 63, 70, 0.5);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}


/* ═══════════════════════════════════════
   RESULT THUMB STATES
   ═══════════════════════════════════════ */

.result-thumb-pending {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pendingPulse 2s ease-in-out infinite;
}

.result-thumb-generating {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-thumb-error {
  background: rgba(239, 68, 68, 0.08);
}

.result-error-icon {
  font-size: 1.5rem;
  color: var(--error);
  font-weight: bold;
  opacity: 0.7;
}

.pending-spinner,
.generating-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(63, 63, 70, 0.5);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.generating-spinner {
  border-top-color: var(--accent-hover);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pendingPulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.6; }
}


/* ═══════════════════════════════════════
   RESULTS SECTION
   ═══════════════════════════════════════ */

.results-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6);
}

.results-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.results-stats {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  font-variant-numeric: tabular-nums;
}

.results-bottom {
  margin-top: var(--space-10);
  text-align: center;
  padding-bottom: var(--space-8);
}


/* ═══════════════════════════════════════
   RESULTS GRID
   ═══════════════════════════════════════ */

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

.result-card {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 150ms var(--ease),
              box-shadow 150ms var(--ease),
              border-color 150ms var(--ease);
  position: relative;
  background: var(--bg-card);
}

.result-card:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2), 0 0 0 1px var(--accent);
  border-color: var(--accent);
  z-index: 2;
}

.result-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
}

.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-2);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  display: flex;
  justify-content: flex-end;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.result-card:hover .result-actions {
  opacity: 1;
}


/* ═══════════════════════════════════════
   IMAGE MODAL
   ═══════════════════════════════════════ */

.image-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 200ms var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.image-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-modal);
  animation: modalSlideUp 250ms var(--ease);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.image-modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all var(--dur-fast) var(--ease);
}

.image-modal-close:hover {
  background: var(--error);
  border-color: var(--error);
  transform: scale(1.1);
}

.image-modal-img {
  width: 100%;
}

.image-modal-img img {
  width: 100%;
  display: block;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.image-modal-error {
  padding: var(--space-12);
  text-align: center;
  color: var(--text-muted);
}

.image-modal-info {
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-modal-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.image-modal-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.image-modal-actions {
  padding: 0 var(--space-6) var(--space-6);
  display: flex;
  gap: var(--space-2);
}

.image-modal-actions .btn-primary {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* ═══════════════════════════════════════
   LIGHTBOX (legacy)
   ═══════════════════════════════════════ */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-norm) var(--ease),
              visibility var(--dur-norm);
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.96);
  transition: transform var(--dur-norm) var(--ease);
}

.lightbox-overlay.active .lightbox-content {
  transform: scale(1);
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}

.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 32px;
  height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}

.lightbox-close:hover {
  background: var(--error);
  border-color: var(--error);
}

.lightbox-caption {
  text-align: center;
  margin-top: var(--space-4);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}

.lightbox-nav:hover {
  background: var(--border);
}

.lightbox-nav.prev { left: -56px; }
.lightbox-nav.next { right: -56px; }

/* Simple lightbox (used in HTML) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}


/* ═══════════════════════════════════════
   GENERIC MODAL
   ═══════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-norm) var(--ease),
              visibility var(--dur-norm);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform var(--dur-norm) var(--ease);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.125rem;
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}


/* ═══════════════════════════════════════
   STATS BAR
   ═══════════════════════════════════════ */

.stats-bar {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.stat-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}


/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder {
  color: var(--text-muted);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}


/* ═══════════════════════════════════════
   CONFIG PANEL
   ═══════════════════════════════════════ */

.config-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.config-panel h3 {
  margin-bottom: var(--space-4);
}

.config-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.config-row .form-group {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}


/* ═══════════════════════════════════════
   TWO-COLUMN LAYOUT
   ═══════════════════════════════════════ */

.layout-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-6);
  align-items: start;
}

@media (max-width: 900px) {
  .layout-split {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  position: sticky;
  top: var(--space-6);
}


/* ═══════════════════════════════════════
   IMAGE GRID
   ═══════════════════════════════════════ */

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


/* ═══════════════════════════════════════
   TAGS / CHIPS
   ═══════════════════════════════════════ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg);
}

.tag.tag-success {
  color: var(--success);
  background: var(--success-dim);
  border-color: transparent;
}

.tag.tag-error {
  color: var(--error);
  background: var(--error-dim);
  border-color: transparent;
}

.tag.tag-accent {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: transparent;
}


/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  color: var(--text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  opacity: 0.3;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.empty-state-text {
  font-size: 0.875rem;
}


/* ═══════════════════════════════════════
   TOAST / NOTIFICATION
   ═══════════════════════════════════════ */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  animation: toastIn 0.3s var(--ease);
  max-width: 360px;
  backdrop-filter: blur(8px);
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--error); }
.toast.toast-info    { border-left: 3px solid var(--accent); }

.toast-exit {
  animation: toastOut 0.2s var(--ease) forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}


/* ═══════════════════════════════════════
   SKELETON LOADER
   ═══════════════════════════════════════ */

.skeleton {
  background: linear-gradient(90deg, #18181b 25%, #27272a 50%, #18181b 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════
   BATCH TOOLBAR
   ═══════════════════════════════════════ */

.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.batch-toolbar-left,
.batch-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}


/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 1200px) {
  .image-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .app {
    padding: var(--space-4);
  }

  .app-header {
    padding: var(--space-6) var(--space-4) var(--space-6);
  }

  .upload-container {
    padding: 0 var(--space-4);
  }

  .generate-area {
    padding: 0 var(--space-4);
  }

  .image-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-bar {
    gap: var(--space-4);
    padding: var(--space-4);
  }

  .stat-divider {
    display: none;
  }

  .batch-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .lightbox-nav.prev { left: var(--space-2); }
  .lightbox-nav.next { right: var(--space-2); }

  .drop-zone,
  .upload-zone {
    padding: var(--space-8) var(--space-4);
  }

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

@media (max-width: 480px) {
  .image-grid {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .config-row {
    flex-direction: column;
  }

  .config-row .form-group {
    width: 100%;
  }

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

  .image-modal {
    max-width: 95vw;
    border-radius: var(--radius-lg);
  }

  .image-modal-img img {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .btn-generate {
    max-width: 100%;
  }
}


/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm          { gap: var(--space-2); }
.gap-md          { gap: var(--space-4); }
.gap-lg          { gap: var(--space-6); }
.w-full          { width: 100%; }
.mt-sm           { margin-top: var(--space-2); }
.mt-md           { margin-top: var(--space-4); }
.mt-lg           { margin-top: var(--space-6); }
.mb-md           { margin-bottom: var(--space-4); }
.mb-lg           { margin-bottom: var(--space-6); }
.hidden          { display: none !important; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Nav Bar
   ═══════════════════════════════════════ */

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(12px) saturate(1.6);
  -webkit-backdrop-filter: blur(12px) saturate(1.6);
  border-bottom: 1px solid rgba(63, 63, 70, 0.4);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}
.nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-primary);
}
.nav-logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.nav-wordmark {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.nav-wordmark-accent {
  color: var(--accent);
}
.nav-badge {
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.4;
}
.nav-gen-counter {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.nav-counter-icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}
.nav-accent-line {
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover), #c084fc, var(--accent));
  background-size: 200% 100%;
  animation: navGradientShift 6s ease infinite;
  opacity: 0.7;
}

/* Settings button — now uses .nav-action-btn in nav group */

/* Selfie column slide transition for user mode */
.upload-col--selfie {
  transition: all var(--dur-slow) var(--ease);
  overflow: hidden;
}
.upload-col--selfie.collapsed {
  display: none;
}
/* Single-column mode when selfie is collapsed */
.upload-columns.single-column {
  grid-template-columns: 1fr;
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Section Layout
   ═══════════════════════════════════════ */

.section-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6) var(--space-8);
}
.section-header {
  margin-bottom: var(--space-8);
}
.section-header .section-title {
  font-size: clamp(1.375rem, 2vw, 1.75rem);
  text-transform: none;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.section-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Upload Columns
   ═══════════════════════════════════════ */

.upload-columns {
  display: grid;
  grid-template-columns: minmax(240px, 30%) 1fr;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 768px) {
  .upload-columns {
    grid-template-columns: 1fr;
  }
}

.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}
.upload-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.upload-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.upload-card-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.step-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
}

/* Selfie drop zone — shorter/portrait */
.drop-zone--selfie {
  padding: var(--space-8) var(--space-6);
}
.drop-zone--selfie .drop-zone-preview img {
  max-height: 220px;
}

/* Drop zone icon (SVG) */
.drop-zone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-3);
  color: var(--text-muted);
  display: block;
  opacity: 0.6;
  transition: all var(--dur-norm) var(--ease);
}
.drop-zone:hover .drop-zone-icon {
  color: var(--accent);
  opacity: 1;
  transform: translateY(-2px);
}
.drop-zone-text {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.drop-zone-text strong {
  color: var(--accent);
}
.drop-zone-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Product Thumbs
   ═══════════════════════════════════════ */

.thumbs-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.btn-text--danger {
  color: var(--error);
  opacity: 0.7;
}
.btn-text--danger:hover {
  color: var(--error);
  opacity: 1;
  background: var(--error-dim);
}
.btn-text svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 2px;
}

/* JS-created product thumbnails */
.product-thumb {
  position: relative;
  width: 100px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  overflow: visible;
}
.product-thumb img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.product-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.75);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.product-thumb:hover .product-thumb-remove {
  opacity: 1;
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Generate Button
   ═══════════════════════════════════════ */

.btn-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  max-width: 480px;
  height: 52px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all var(--dur-fast) var(--ease);
}
.btn-generate:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  box-shadow: var(--shadow-glow), 0 2px 4px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}
.btn-generate:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn-generate-icon {
  width: 20px;
  height: 20px;
}

.btn-remove svg {
  width: 12px;
  height: 12px;
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Progress Section
   ═══════════════════════════════════════ */

.progress-header {
  margin-bottom: var(--space-4);
}
.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  font-size: 0.8125rem;
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Results Bar
   ═══════════════════════════════════════ */

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.results-bar .results-stats {
  margin-bottom: 0;
}
.results-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Lightbox Backdrop
   ═══════════════════════════════════════ */

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.92);
}
.lightbox .lightbox-img {
  position: relative;
  z-index: 1;
}
.lightbox .lightbox-close {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 2;
  width: 36px;
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox .lightbox-close svg {
  width: 16px;
  height: 16px;
}
.lightbox .lightbox-close:hover {
  background: var(--error);
  border-color: var(--error);
}


/* ═══════════════════════════════════════
   HTML-SPECIFIC: Error Toast (dynamic)
   ═══════════════════════════════════════ */

.error-toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--error);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transform: translateX(120%);
  transition: transform 300ms var(--ease);
}
.error-toast--visible {
  transform: translateX(0);
}
.error-toast-msg {
  flex: 1;
}
.error-toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.error-toast-close:hover {
  color: var(--text-primary);
}

/* Info toast (non-error, for progress messages) */
.info-toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid #a855f7;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text-primary);
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transform: translateX(120%);
  transition: transform 300ms var(--ease);
}
.info-toast--visible { transform: translateX(0); }
.info-toast-msg { flex: 1; }
.info-toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.info-toast-close:hover { color: var(--text-primary); }


/* ═══════════════════════════════════════
   LANDING PAGE — Mode Selection
   ═══════════════════════════════════════ */

.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: var(--space-10) var(--space-6);
  gap: var(--space-12);
}

.landing-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.landing-logo-icon {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 0 24px rgba(139, 92, 246, 0.3));
}

.landing-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.landing-title-accent {
  color: var(--accent);
}

.landing-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* Card container */
.landing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
  max-width: 680px;
  width: 100%;
}

@media (max-width: 600px) {
  .landing-cards {
    grid-template-columns: 1fr;
    max-width: 340px;
  }
}

/* Individual card */
.landing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--dur-norm) var(--ease);
  text-align: center;
  outline: none;
  font-family: inherit;
  color: inherit;
}

.landing-card:hover,
.landing-card:focus-visible {
  border-color: var(--accent);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.landing-card:active {
  transform: translateY(-1px);
}

.landing-card-icon {
  width: 80px;
  height: 80px;
}

.landing-card-icon svg {
  width: 100%;
  height: 100%;
}

.landing-card-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.landing-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.landing-card-arrow {
  position: absolute;
  top: var(--space-4);
  right: var(--space-5);
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: all var(--dur-fast) var(--ease);
}

.landing-card:hover .landing-card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── Flag button ───────────────────────────────────────────────────────── */
.btn-flag {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
  padding: 4px;
}
.btn-flag svg { width: 14px; height: 14px; }
.gen-card:hover .btn-flag,
.result-card:hover .btn-flag,
.btn-flag.flagged { opacity: 1; }
.btn-flag.flagged { background: #ef4444; color: #fff; }
.btn-flag:hover { background: rgba(0,0,0,0.7); }
.btn-flag.flagged:hover { background: #dc2626; }

/* Flagged card indicator */
.gen-card.flagged,
.result-card.flagged { outline: 2px solid #ef4444; outline-offset: -2px; }

/* ═══════════════════════════════════════════════════════════════
   Usage Counter (nav bar)
   ═══════════════════════════════════════════════════════════════ */
.nav-usage-counter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 9999px);
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.nav-usage-counter.usage-low {
  color: var(--warning);
  border-color: var(--warning);
}

/* ═══════════════════════════════════════════════════════════════
   Batch Gate (Rating + Cooldown)
   ═══════════════════════════════════════════════════════════════ */
.batch-gate {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.batch-gate-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem;
}

/* Star rating */
.star-rating {
  display: inline-flex;
  gap: 8px;
}
.star-rating .star {
  font-size: 2rem;
  background: none;
  border: none;
  color: var(--border);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  padding: 0;
  line-height: 1;
}
.star-rating .star:hover,
.star-rating .star.active {
  color: #f59e0b;
  transform: scale(1.15);
}
.star-rating .star:hover ~ .star {
  color: var(--border);
}

/* Cooldown timer */
.cooldown-timer {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  margin-top: 0.5rem;
  letter-spacing: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   My Batches / History
   ═══════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════
   Client Dashboard Cards
   ═══════════════════════════════════════════════════════════════ */
.client-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3, 12px);
  margin-bottom: var(--space-5, 24px);
}

.client-stat-card {
  background: var(--card, #18181b);
  border: 1px solid var(--border, #3f3f46);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-4, 16px);
  text-align: center;
}

.client-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #71717a);
  margin-bottom: var(--space-1, 4px);
}

.client-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary, #fafafa);
  font-variant-numeric: tabular-nums;
}

.client-stat-sub {
  font-size: 0.75rem;
  color: var(--text-secondary, #a1a1aa);
  margin-top: 2px;
}

.client-stat-bar {
  height: 6px;
  background: var(--bg, #09090b);
  border-radius: 3px;
  margin-top: var(--space-2, 8px);
  overflow: hidden;
}

.client-stat-bar-fill {
  height: 100%;
  background: var(--accent, #8b5cf6);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.client-stat-bar-fill.bar-warning { background: var(--warning, #f59e0b); }
.client-stat-bar-fill.bar-danger { background: var(--error, #ef4444); }

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

/* Nav action buttons (My Batches, Model) — grouped, distinct from counter */
.nav-btn-group {
  display: flex;
  gap: 1px;
  background: var(--border, #3f3f46);
  border-radius: var(--radius-md, 10px);
  overflow: hidden;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #a1a1aa);
  background: var(--bg-elevated, #27272a);
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 150ms ease;
}
.nav-action-btn:hover {
  color: var(--text-primary, #fafafa);
  background: var(--accent, #8b5cf6);
}
.nav-action-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.history-actions {
  display: flex;
  gap: var(--space-3, 12px);
  align-items: center;
  margin-bottom: var(--space-4, 16px);
}

.history-batch-card {
  background: var(--card, #18181b);
  border: 1px solid var(--border, #3f3f46);
  border-radius: var(--radius-lg, 12px);
  margin-bottom: var(--space-3, 12px);
  overflow: hidden;
}

.history-batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  gap: var(--space-3, 12px);
}

.history-batch-info {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  flex-wrap: wrap;
}

.history-batch-date {
  font-weight: 600;
  color: var(--text-primary, #fafafa);
  font-size: 0.9rem;
}

.history-batch-mode {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent, #8b5cf6);
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full, 9999px);
}

.history-batch-count {
  font-size: 0.8rem;
  color: var(--text-secondary, #a1a1aa);
}

.history-batch-rating {
  color: #f59e0b;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.history-batch-actions {
  display: flex;
  gap: var(--space-2, 8px);
  align-items: center;
  flex-shrink: 0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}
.btn-icon-sm {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 2px;
}

.btn-toggle-batch {
  background: none;
  border: 1px solid var(--border, #3f3f46);
  color: var(--text-secondary);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px 8px;
}
.btn-toggle-batch:hover { color: var(--text-primary); }

.history-batch-images {
  padding: 0 var(--space-4, 16px) var(--space-4, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 12px);
  border-top: 1px solid var(--border, #3f3f46);
  padding-top: var(--space-3, 12px);
}

.history-image-pair {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  background: var(--bg, #09090b);
  border-radius: var(--radius-md, 10px);
  padding: var(--space-2, 8px);
}

.history-img-wrap {
  flex: 1;
  position: relative;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  aspect-ratio: 3/4;
  max-height: 320px;
}
.history-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
}
.history-img-wrap img.draggable {
  object-fit: none;
  object-position: center center;
  cursor: grab;
}
.history-img-wrap img.draggable.dragging {
  cursor: grabbing;
}

.history-img-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(0,0,0,0.5);
  padding: 2px 0;
}

.history-img-arrow {
  font-size: 1.2rem;
  color: var(--text-muted, #71717a);
  flex-shrink: 0;
}

.history-img-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--card, #18181b);
  color: var(--text-muted, #71717a);
  font-size: 0.7rem;
}

.history-dl-single {
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--text-muted, #71717a);
  flex-shrink: 0;
  padding: 4px;
}
.history-dl-single:hover { color: var(--accent, #8b5cf6); }

.history-failed-note {
  font-size: 0.8rem;
  color: var(--error, #ef4444);
  text-align: center;
  margin: 0;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted, #71717a);
  font-size: 0.9rem;
}

/* ─── Flag UI ─────────────────────────────────────────────── */
.history-batch-num {
  font-weight: 700;
  color: var(--primary, #a855f7);
  font-size: 0.85rem;
}
.history-item-num {
  font-weight: 600;
  color: var(--text-muted, #71717a);
  font-size: 0.75rem;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.history-item-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.flag-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.35;
  transition: opacity 0.15s;
  padding: 4px;
}
.flag-btn:hover { opacity: 0.7; }
.flag-btn.flagged { opacity: 1; filter: none; }
.flag-reason-tag {
  font-size: 0.6rem;
  color: #f97316;
  background: rgba(249,115,22,0.1);
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.history-image-pair.flagged {
  border-left: 3px solid #f97316;
  padding-left: 8px;
}
.history-batch-flag-count {
  font-size: 0.75rem;
  color: #f97316;
  background: rgba(249,115,22,0.12);
  padding: 2px 8px;
  border-radius: 10px;
}
.btn-flag-batch {
  font-size: 0.75rem !important;
}
.flag-dropdown {
  background: var(--surface, #27272a);
  border: 1px solid var(--border, #3f3f46);
  border-radius: 8px;
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.flag-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text, #e4e4e7);
  padding: 8px 14px;
  text-align: left;
  font-size: 0.82rem;
  cursor: pointer;
}
.flag-dropdown-item:hover {
  background: var(--primary, #a855f7);
  color: #fff;
}
/* ─── Feedback UI ─────────────────────────────────────────── */
.feedback-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.35;
  transition: opacity 0.15s;
  padding: 4px;
}
.feedback-btn:hover { opacity: 0.7; }
.feedback-btn.has-feedback { opacity: 1; }
.feedback-bubble {
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #a3e635;
  background: rgba(163,230,53,0.08);
  border-left: 2px solid rgba(163,230,53,0.3);
  border-radius: 0 6px 6px 0;
  line-height: 1.4;
}
.btn-feedback-batch {
  font-size: 0.75rem !important;
}

@media (max-width: 600px) {
  .history-image-pair { flex-direction: column; }
  .history-img-arrow { transform: rotate(90deg); }
  .history-img-wrap { max-height: 120px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Saree Card Stack (one saree at a time upload)
   ═══════════════════════════════════════════════════════════════════════ */
.saree-batch-counter {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  white-space: nowrap;
}
.saree-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Individual saree card */
.saree-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.saree-card:hover {
  border-color: var(--border-hover);
}
.saree-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.saree-card-number {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #f59e0b;
}
.saree-card-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.saree-card-remove:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Flat-lay upload area (inside card) */
.saree-flatlay-zone {
  padding: 1rem;
}
.saree-flatlay-dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.saree-flatlay-dropzone:hover,
.saree-flatlay-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
/* Ghost placeholder for flat-lay */
.saree-flatlay-dropzone {
  position: relative;
  overflow: hidden;
}
.saree-flatlay-dropzone .flatlay-ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.12;
  border-radius: 8px;
  pointer-events: none;
  transition: opacity 0.2s;
}
.saree-flatlay-dropzone:hover .flatlay-ghost {
  opacity: 0.25;
}
.saree-flatlay-dropzone .flatlay-ghost-overlay {
  position: relative;
  z-index: 1;
}
.saree-flatlay-dropzone .drop-zone-icon {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  margin: 0 auto 0.5rem;
  display: block;
}
.saree-flatlay-dropzone .drop-zone-text {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.saree-flatlay-dropzone .drop-zone-hint {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Flat-lay preview (after upload) */
.saree-flatlay-preview {
  position: relative;
  padding: 0.75rem;
}
.saree-flatlay-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 8px;
  background: #000;
}
.saree-flatlay-replace {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(9, 9, 11, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s;
}
.saree-flatlay-replace:hover {
  color: var(--text-primary);
}

/* Component slots grid (2x2) */
.saree-components {
  padding: 0 0.75rem 0.75rem;
}
.saree-components-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding-left: 0.125rem;
}
.saree-component-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.saree-component-slot {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.saree-component-slot:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.saree-component-slot.filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-dim);
  padding: 0.25rem;
}
/* Ghost placeholder image */
.saree-component-slot .slot-ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  opacity: 0.15;
  pointer-events: none;
  transition: opacity 0.2s;
}
.saree-component-slot:hover .slot-ghost {
  opacity: 0.3;
}
.saree-component-slot.filled .slot-ghost {
  display: none;
}
/* Overlay text on top of ghost */
.saree-component-slot .slot-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.saree-component-slot .slot-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.saree-component-slot .slot-plus {
  font-size: 1.25rem;
  color: var(--text-muted);
  line-height: 1;
}
.saree-component-slot.filled .slot-overlay {
  display: none;
}
.saree-component-slot .slot-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.saree-component-slot .slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(9, 9, 11, 0.8);
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.saree-component-slot .slot-remove:hover {
  color: var(--error);
}

/* Add saree button */
.saree-add-area {
  margin-top: 0.75rem;
}
.btn-add-saree {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem;
  background: none;
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-add-saree:hover {
  border-color: #f59e0b;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}
.btn-add-saree:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-add-saree:disabled:hover {
  border-color: var(--border);
  color: var(--text-secondary);
  background: none;
}
.btn-add-saree svg {
  width: 20px;
  height: 20px;
}

/* ═══════════════════════════════════════════════════════════════════════
   Photo Guide (collapsible, on upload page)
   ═══════════════════════════════════════════════════════════════════════ */
.photo-guide {
  margin: 1.5rem 0;
}
.photo-guide-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.photo-guide-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.photo-guide-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  border-radius: 12px 12px 0 0;
  border-bottom: none;
}
.photo-guide-toggle-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.photo-guide-chevron {
  width: 14px;
  height: 14px;
  margin-left: auto;
  transition: transform 0.2s;
}
.photo-guide-toggle[aria-expanded="true"] .photo-guide-chevron {
  transform: rotate(180deg);
}
.photo-guide-content {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 1.25rem;
}
.photo-guide-intro {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.photo-guide-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}
.photo-guide-item {
  text-align: center;
}
.photo-guide-img-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 3/4;
  margin-bottom: 0.5rem;
}
.photo-guide-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-guide-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-guide-item h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.photo-guide-item p {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.photo-guide-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}
.photo-guide-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.photo-guide-arrow svg {
  width: 16px;
  height: 16px;
  color: #f59e0b;
}
.photo-guide-result-img {
  position: relative;
  width: 180px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}
.photo-guide-result-img img {
  width: 100%;
  display: block;
}
.photo-guide-result-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(139, 92, 246, 0.8);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
}
.photo-guide-result-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
  max-width: 320px;
}

@media (max-width: 600px) {
  .photo-guide-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .photo-guide-result-img {
    width: 140px;
  }
}
