/* ═══════════════════════════════════════════════════════════
   SHREEKAMA AI STUDIO — Design System v5
   Background: #631664 family · Text: Pure white · Modern lucid UI
   ═══════════════════════════════════════════════════════════ */
:root {
  --brand:        #631664;
  --bg:           #1E0822;
  --bg-sidebar:   #170620;
  --surface:      #2D1035;
  --surface-2:    #3A1842;
  --surface-3:    #4A2252;
  --surface-glass: rgba(45, 16, 53, 0.65);
  --gold:         #C9A84C;
  --gold-l:       #E2C97E;
  --white:        #FFFFFF;
  --white-90:     rgba(255,255,255,0.90);
  --white-70:     rgba(255,255,255,0.70);
  --white-50:     rgba(255,255,255,0.50);
  --white-30:     rgba(255,255,255,0.30);
  --white-12:     rgba(255,255,255,0.12);
  --white-06:     rgba(255,255,255,0.06);
  --err:          #E85555;
  --err-bg:       rgba(232,85,85,0.12);
  --success:      #4CAF50;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  --font-d: 'Cormorant Garamond', Georgia, serif;
  --font-b: 'DM Sans', system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.15s var(--ease);
  --t-med: 0.25s var(--ease);

  --sidebar-w: 240px;
  --sidebar-c: 60px;
  --header-h: 56px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--white);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35; }
.hidden { display: none !important; }
::selection { background: rgba(99,22,100,0.5); color: var(--white); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--white-12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--white-30); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: var(--font-b); }
img { max-width: 100%; }

/* ── AUTH OVERLAY ──────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(99,22,100,0.35) 0%, transparent 60%),
    radial-gradient(ellipse at 75% 25%, rgba(201,168,76,0.08) 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  background: var(--surface-glass);
  backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--white-06);
  border-radius: var(--r-xl);
  padding: 48px 44px;
  max-width: 400px; width: 90%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  animation: fadeUp 0.6s var(--ease) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.auth-logo { margin-bottom: 28px; }
.auth-logo-img { display: block; height: auto; width: 160px; max-width: 160px; margin: 0 auto; object-fit: contain; filter: brightness(1.1); }
.auth-headline {
  font-family: var(--font-d); font-size: 32px; font-weight: 300;
  line-height: 1.2; margin-bottom: 12px; color: var(--white);
}
.auth-headline em { font-style: italic; }
.auth-body { color: var(--white-70); font-size: 15px; font-weight: 300; margin-bottom: 28px; }
.ms-login-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; color: #1e1e1e; border: none;
  border-radius: var(--r-md); padding: 13px 24px;
  font-size: 15px; font-weight: 500;
  cursor: pointer; transition: var(--t-fast);
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
  width: 100%; justify-content: center;
}
.ms-login-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.ms-login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.auth-error {
  margin-top: 12px; padding: 10px 14px;
  background: var(--err-bg); border: 1px solid rgba(232,85,85,0.25);
  border-radius: var(--r-sm); color: #ff9999; font-size: 13px; text-align: left;
}
.auth-hint { margin-top: 14px; font-size: 13px; color: var(--white-50); }

/* ── APP SHELL ─────────────────────────────────────────────── */
.app { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; }

/* ── HEADER ────────────────────────────────────────────────── */
.site-header {
  position: relative; z-index: 100; height: var(--header-h);
  background: rgba(23,6,32,0.85);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--white-06);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.sidebar-hamburger {
  width: 36px; height: 36px; border: none; background: transparent;
  color: var(--white-70); border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.sidebar-hamburger:hover { background: var(--white-06); color: var(--white); }
.header-brand {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  transition: opacity var(--t-fast);
}
.header-brand:hover { opacity: 0.85; }
.header-logo { height: 24px; }
.header-studio-label {
  font-size: 13px; font-weight: 300; color: var(--white-50);
  letter-spacing: 0.06em; padding-left: 10px;
  border-left: 1px solid var(--white-12);
}
.header-right { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 12px 4px 4px; background: var(--white-06);
  border: 1px solid var(--white-06); border-radius: var(--r-full);
  font-size: 13px; color: var(--white-70);
}
.user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #8B2A8D);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: #fff;
}
.btn-ghost {
  padding: 6px 14px; border: 1px solid var(--white-12); background: transparent;
  color: var(--white-70); font-size: 13px; border-radius: var(--r-sm);
  cursor: pointer; transition: var(--t-fast);
}
.btn-ghost:hover { border-color: var(--white-30); color: var(--white); background: var(--white-06); }

/* ── APP BODY ──────────────────────────────────────────────── */
.app-body { display: flex; flex: 1; min-height: 0; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--white-06);
  display: flex; flex-direction: column;
  transition: width var(--t-med);
  overflow: hidden; position: relative;
}
.sidebar.collapsed { width: var(--sidebar-c); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--white-30); padding: 16px 14px 6px; white-space: nowrap;
  transition: opacity var(--t-fast);
}
.sidebar.collapsed .sidebar-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 14px;
  background: transparent; border: none;
  color: var(--white-70); font-family: var(--font-b); font-size: 13px;
  border-radius: var(--r-sm); cursor: pointer; transition: var(--t-fast);
  white-space: nowrap; overflow: hidden; text-align: left;
  border: 1px solid transparent;
}
.sidebar-item svg { flex-shrink: 0; width: 18px; height: 18px; }
.sidebar-item:hover { color: var(--white); background: var(--white-06); }
.sidebar-item.active {
  color: var(--white);
  background: linear-gradient(135deg, rgba(99,22,100,0.4), rgba(99,22,100,0.15));
  border-color: rgba(99,22,100,0.4);
}
.sidebar-item-label { transition: opacity var(--t-fast), width var(--t-fast); overflow: hidden; }
.sidebar.collapsed .sidebar-item-label { opacity: 0; width: 0; }
.sidebar-item-badge {
  font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--white-06); color: var(--white-50);
  padding: 2px 7px; border-radius: var(--r-full); margin-left: auto;
  white-space: nowrap; flex-shrink: 0;
  transition: opacity var(--t-fast);
}
.sidebar.collapsed .sidebar-item-badge { opacity: 0; width: 0; padding: 0; margin: 0; overflow: hidden; }
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 14px;
  background: transparent; border: none; border-top: 1px solid var(--white-06);
  color: var(--white-30); cursor: pointer; transition: var(--t-fast);
}
.sidebar-collapse-btn:hover { color: var(--white-70); background: var(--white-06); }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-collapse-btn svg { transition: transform var(--t-med); }

/* ── MAIN CONTENT ──────────────────────────────────────────── */
.main-content {
  flex: 1; min-width: 0; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 20%, rgba(99,22,100,0.06) 0%, transparent 60%);
}

/* ════════════════════════════════════════════════════════════
   SHARED MODULE STYLES
   ════════════════════════════════════════════════════════════ */

/* Module page wrapper */
.module-page { padding: 32px; max-width: 1200px; margin: 0 auto; animation: fadeUp 0.3s var(--ease); }
.module-page-full { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* Module header */
.module-header { margin-bottom: 28px; }
.module-title { font-family: var(--font-d); font-size: 28px; font-weight: 400; margin-bottom: 4px; }
.module-desc { color: var(--white-50); font-size: 14px; font-weight: 300; }

/* Cards */
.card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--white-06);
  border-radius: var(--r-lg); padding: 24px;
  transition: var(--t-fast);
}
.card:hover { border-color: var(--white-12); }
.card-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.card-desc { font-size: 13px; color: var(--white-50); font-weight: 300; line-height: 1.5; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border: none;
  background: linear-gradient(135deg, var(--brand), #4A1150);
  color: var(--white); font-family: var(--font-b); font-size: 14px; font-weight: 500;
  border-radius: var(--r-sm); cursor: pointer;
  transition: var(--t-fast); position: relative; overflow: hidden;
  box-shadow: 0 4px 20px rgba(99,22,100,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(99,22,100,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border: 1px solid var(--white-12);
  background: var(--white-06); color: var(--white);
  font-family: var(--font-b); font-size: 14px; font-weight: 400;
  border-radius: var(--r-sm); cursor: pointer; transition: var(--t-fast);
}
.btn-secondary:hover { border-color: var(--white-30); background: var(--white-12); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-icon {
  width: 36px; height: 36px; border: none; background: transparent;
  color: var(--white-70); border-radius: var(--r-sm); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.btn-icon:hover { background: var(--white-06); color: var(--white); }

/* Form controls — lucid glass style */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 400; color: var(--white-70); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--white-12);
  border-radius: var(--r-sm);
  color: var(--white); font-family: var(--font-b); font-size: 14px;
  transition: var(--t-fast);
  backdrop-filter: blur(8px);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: rgba(99,22,100,0.6);
  box-shadow: 0 0 0 3px rgba(99,22,100,0.15);
  background: rgba(255,255,255,0.06);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--white-30); }
.form-select {
  appearance: none; cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-select option { background: var(--surface); color: var(--white); }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* Inline pill controls */
.pill-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill-control {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--white-12);
  border-radius: var(--r-full);
  font-size: 13px; color: var(--white-70); white-space: nowrap;
  backdrop-filter: blur(8px);
}
.pill-control svg { flex-shrink: 0; opacity: 0.5; }
.pill-select {
  appearance: none; background: transparent; border: none;
  color: var(--white); font-family: var(--font-b); font-size: 13px;
  cursor: pointer; outline: none; padding: 0 20px 0 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center;
}
.pill-select option { background: var(--surface); color: var(--white); }

/* Range slider */
.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--white-12); outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--brand);
  border: 2px solid var(--white); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.range-value { font-size: 13px; color: var(--white-70); min-width: 32px; text-align: center; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; background: var(--white-06);
  border: 1px solid var(--white-06);
  border-radius: var(--r-full); font-size: 13px; color: var(--white-70);
}
.chip-gold { border-color: rgba(201,168,76,0.3); color: var(--gold-l); }

/* Image grid */
.image-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.image-card {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); border: 1px solid var(--white-06);
  transition: var(--t-fast);
}
.image-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
.image-card img { width: 100%; height: auto; display: block; }
.image-card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px; display: flex; justify-content: flex-end;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  opacity: 0; transition: opacity var(--t-fast);
}
.image-card:hover .image-card-overlay { opacity: 1; }

/* Loading spinner */
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--white-12);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-lg { width: 48px; height: 48px; border-width: 3px; }

/* State panels */
.state-panel {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 48px 24px; flex: 1;
}
.state-icon { margin-bottom: 16px; color: var(--white-30); }
.state-title { font-family: var(--font-d); font-size: 24px; font-weight: 400; margin-bottom: 8px; }
.state-desc { color: var(--white-50); font-size: 14px; font-weight: 300; max-width: 400px; }

/* Empty state orb */
.empty-orb {
  width: 80px; height: 80px; border-radius: 50%; margin-bottom: 20px;
  background: radial-gradient(circle at 35% 35%, rgba(99,22,100,0.35), transparent 70%);
  border: 1px solid rgba(99,22,100,0.15);
  animation: orbPulse 4s ease-in-out infinite;
}
@keyframes orbPulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 40px rgba(99,22,100,0.12); }
  50%     { transform: scale(1.04); box-shadow: 0 0 60px rgba(99,22,100,0.2); }
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--white-12);
  border-radius: var(--r-lg); padding: 40px 24px;
  text-align: center; cursor: pointer;
  transition: var(--t-fast);
  background: var(--white-06);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: rgba(99,22,100,0.5);
  background: rgba(99,22,100,0.08);
}
.upload-zone-icon { color: var(--white-30); margin-bottom: 12px; }
.upload-zone-text { color: var(--white-50); font-size: 14px; }
.upload-zone-text strong { color: var(--white-70); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; border-radius: var(--r-full); font-size: 13px; z-index: 9999;
  backdrop-filter: blur(16px); border: 1px solid var(--white-06);
  font-family: var(--font-b); white-space: nowrap;
  animation: toastIn 0.3s var(--ease);
  color: var(--white);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-info { background: rgba(45,16,53,0.95); }
.toast-error { background: rgba(180,45,45,0.95); }
.toast-success { background: rgba(45,120,45,0.95); }

/* Progress bar */
.progress-bar { height: 4px; background: var(--white-06); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.3s; }

/* ════════════════════════════════════════════════════════════
   HOME MODULE — Card grid
   ════════════════════════════════════════════════════════════ */
.home-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.home-card {
  background: var(--surface-glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--white-06);
  border-radius: var(--r-lg); padding: 28px;
  cursor: pointer; transition: var(--t-fast);
  display: flex; flex-direction: column; gap: 14px;
}
.home-card:hover {
  border-color: rgba(99,22,100,0.4);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(99,22,100,0.15);
}
.home-card-icon {
  width: 44px; height: 44px; border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(99,22,100,0.3), rgba(99,22,100,0.1));
  border: 1px solid rgba(99,22,100,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--white-70);
}
.home-card-title { font-size: 16px; font-weight: 500; }
.home-card-desc { font-size: 13px; color: var(--white-50); font-weight: 300; line-height: 1.5; }
.home-card-badge {
  display: inline-flex; align-self: flex-start;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--r-full);
  background: var(--white-06); color: var(--white-50);
}
.home-card-badge.active-badge { background: rgba(76,175,80,0.15); color: var(--success); }
.home-card-badge.soon-badge { background: rgba(201,168,76,0.1); color: var(--gold); }

/* ════════════════════════════════════════════════════════════
   IMAGE GENERATOR — Studio layout
   ════════════════════════════════════════════════════════════ */
.studio-layout { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.studio-output {
  flex: 1; min-height: 0; overflow-y: auto; display: flex;
  align-items: flex-start; justify-content: center; padding: 24px;
}
.studio-input-wrap {
  flex-shrink: 0; display: flex; justify-content: center;
  background: rgba(23,6,32,0.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--white-06);
}
.studio-input {
  width: 100%; max-width: 1080px;
  padding: 16px 20px 12px;
}

/* Unified toolbar — all controls in ONE horizontal row */
.ig-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.ig-toolbar-sep {
  flex-shrink: 0;
  width: 1px; height: 28px;
  background: var(--white-12);
  margin: 0 4px;
}
.ref-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ref-chip {
  position: relative; display: flex; align-items: center;
  background: rgba(255,255,255,0.04); border: 1px solid var(--white-12);
  border-radius: var(--r-full); height: 34px; overflow: hidden;
  transition: var(--t-fast); flex-shrink: 0;
}
.ref-chip.face-chip { border-color: rgba(201,168,76,0.3); }
.ref-chip.has-file { border-color: rgba(99,22,100,0.4); }
.ref-chip.face-chip.has-file { border-color: rgba(201,168,76,0.5); }
.ref-chip-inner {
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px; color: var(--white-70); font-size: 13px; height: 100%;
}
.ref-chip.face-chip .ref-chip-inner { color: var(--gold-l); }
.ref-chip-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: var(--r-full) 0 0 var(--r-full); }
.ref-chip-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ref-chip-persist { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.ref-chip-add {
  width: 30px; height: 100%; background: rgba(255,255,255,0.04);
  border: none; border-left: 1px solid var(--white-06);
  color: var(--white-50); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.ref-chip-add:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.face-chip .ref-chip-add { background: rgba(201,168,76,0.08); }
.face-chip .ref-chip-add:hover { background: rgba(201,168,76,0.15); color: var(--gold-l); }
.ref-chip-rm {
  position: absolute; right: 0; top: 0; bottom: 0; width: 28px;
  background: rgba(232,85,85,0.85); border: none; color: #fff;
  cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 var(--r-full) var(--r-full) 0;
}
.ref-chip-rm:hover { background: var(--err); }
.ref-chip-file { display: none; }

.ref-divider { width: 1px; height: 20px; background: var(--white-12); }

/* ── Virtual Try-On Controls ─────────────────────────────── */
.ig-control {
  display: flex; flex-direction: column; gap: 3px;
  flex-shrink: 0;
}
.ig-control-label {
  font-size: 11px; font-weight: 400; color: var(--white-30);
  letter-spacing: 0.03em; padding-left: 2px;
}
.ig-select {
  appearance: none; -webkit-appearance: none;
  padding: 7px 28px 7px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--white-12);
  border-radius: var(--r-md);
  color: var(--white); font-family: var(--font-b); font-size: 13px;
  cursor: pointer; transition: var(--t-fast);
  backdrop-filter: blur(8px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 0;
  height: 34px;
}
.ig-select:hover {
  border-color: var(--white-30);
  background-color: rgba(255,255,255,0.06);
}
.ig-select:focus {
  outline: none;
  border-color: rgba(99,22,100,0.6);
  box-shadow: 0 0 0 3px rgba(99,22,100,0.15);
  background-color: rgba(255,255,255,0.06);
}
.ig-select option {
  background: var(--surface); color: var(--white);
  padding: 8px;
}

/* ── Settings Toggle Button ──────────────────────────────── */
.ig-settings-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--white-12);
  border-radius: var(--r-md);
  color: var(--white-50);
  cursor: pointer; transition: var(--t-fast);
  font-size: 16px; line-height: 1;
  align-self: flex-end;
}
.ig-settings-toggle:hover {
  border-color: var(--white-30);
  color: var(--white-70);
  background: rgba(255,255,255,0.06);
}
.ig-settings-toggle.active {
  border-color: rgba(99,22,100,0.6);
  color: var(--gold);
  background: rgba(99,22,100,0.15);
}

/* ── Collapsible Settings Panel ──────────────────────────── */
.ig-settings-panel {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s var(--ease), padding 0.3s var(--ease),
              opacity 0.25s var(--ease);
  opacity: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  margin: 0 0 4px;
  padding: 0 16px;
}
.ig-settings-panel.open {
  max-height: 300px;
  opacity: 1;
  padding: 16px;
  border-color: var(--white-12);
  margin: 8px 0 12px;
}
.ig-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.ig-setting {
  display: flex; flex-direction: column; gap: 6px;
}
.ig-setting-label {
  font-size: 11px; font-weight: 500; color: var(--white-30);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.ig-setting-val {
  font-size: 12px; color: var(--white-70);
  font-variant-numeric: tabular-nums;
}
.ig-range-wrap {
  display: flex; align-items: center; gap: 8px;
}
.ig-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px; outline: none;
  cursor: pointer;
}
.ig-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--surface);
  cursor: pointer; transition: var(--t-fast);
}
.ig-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 6px rgba(201,168,76,0.4);
}
.ig-range::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--surface);
  cursor: pointer;
}
.ig-settings-hint {
  margin-top: 10px;
  font-size: 11px; color: var(--white-30);
  font-style: italic; text-align: right;
}

/* ── Token Usage Bar ─────────────────────────────────────── */
.ig-token-bar {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--white-12);
  border-radius: var(--r-md);
  margin-top: 10px;
  font-size: 12px;
}
.ig-token-bar.hidden { display: none; }
.ig-token-item {
  display: flex; align-items: center; gap: 5px;
}
.ig-token-label {
  color: var(--white-30);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ig-token-count {
  color: var(--white-90);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.ig-token-total .ig-token-count {
  color: var(--gold);
  font-weight: 600;
}
.ig-token-sep {
  width: 1px; height: 14px;
  background: var(--white-12);
}

/* ── Debug Error Box ──────────────────────────────────────── */
.ig-debug-box {
  width: 100%; max-width: 480px; margin: 16px auto 0;
  background: rgba(232,85,85,0.06);
  border: 1px solid rgba(232,85,85,0.25);
  border-radius: var(--r-lg);
  overflow: hidden; text-align: left;
}
.ig-debug-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; cursor: pointer;
  color: var(--white-50); font-size: 12px; font-weight: 500;
  letter-spacing: 0.03em;
  transition: var(--t-fast);
}
.ig-debug-header:hover { color: var(--white-70); }
.ig-debug-header svg { transition: transform 0.2s ease; }
.ig-debug-box.open .ig-debug-header svg { transform: rotate(180deg); }
.ig-debug-body {
  max-height: 0; overflow: hidden; padding: 0 14px;
  transition: max-height 0.3s ease, padding 0.3s ease;
  font-size: 12px; color: var(--white-50); line-height: 1.5;
}
.ig-debug-box.open .ig-debug-body {
  max-height: 400px; overflow-y: auto;
  padding: 0 14px 14px;
}
.ig-debug-label {
  color: var(--white-30); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px;
}
.ig-debug-raw {
  background: rgba(0,0,0,0.3); border-radius: var(--r-sm);
  padding: 10px 12px; margin: 6px 0 0; overflow-x: auto;
  font-size: 11px; line-height: 1.4; color: var(--white-70);
  white-space: pre-wrap; word-break: break-all;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* ── Virtual Try-On: Thumbnail grid & Lightbox ────────────── */
.ig-batches-wrap {
  width: 100%; max-width: 720px; padding: 0 16px;
  display: flex; flex-direction: column; margin-top: auto;
}
.ig-batch-header { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.ig-batch-time { font-size: 11px; color: rgba(255,255,255,0.3); margin-left: auto; }
.ig-batch-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 16px;
}
.ig-thumb-card {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); border: 1px solid var(--white-06);
  cursor: pointer; transition: var(--t-fast); aspect-ratio: auto;
}
.ig-thumb-card img {
  width: 100%; max-height: 70vh; object-fit: contain; display: block;
  background: rgba(0,0,0,0.2);
}
.ig-thumb-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.ig-thumb-actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 6px; display: flex; justify-content: flex-end;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
  opacity: 0; transition: opacity var(--t-fast);
}
.ig-thumb-card:hover .ig-thumb-actions { opacity: 1; }
.ig-thumb-btn {
  height: 26px !important; width: 26px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50% !important; backdrop-filter: blur(8px);
}
.ig-batch-actions {
  display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 8px;
}

/* ── Chat Conversation Thread ────────────────────────────── */
.ig-chat-turn { margin-bottom: 12px; }
.ig-chat-user { display: flex; justify-content: flex-end; }
.ig-chat-bubble {
  max-width: 85%; padding: 10px 14px;
  background: rgba(99,22,100,0.2); border: 1px solid rgba(99,22,100,0.3);
  border-radius: 14px 14px 4px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.ig-chat-prompt { font-size: 14px; line-height: 1.5; color: var(--white); word-break: break-word; }
.ig-chat-meta { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ig-chat-time { font-size: 11px; color: rgba(255,255,255,0.3); margin-left: auto; }
.chip-sm { font-size: 10px; padding: 1px 6px; }
.ig-chat-model { }
.ig-chat-model .ig-thumb-card { max-width: 360px; }
.ig-chat-loading {
  display: flex; align-items: center; gap: 10px; padding: 12px 0;
  font-size: 13px; color: var(--white-50);
}
.ig-chat-error {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: rgba(220,50,50,0.1); border: 1px solid rgba(220,50,50,0.3);
  border-radius: var(--r-md); font-size: 13px; color: rgba(220,100,100,0.9);
  margin-bottom: 12px;
}

/* Edit target highlight */
.ig-thumb-card.edit-target {
  outline: 2px solid rgba(201,168,76,0.7);
  outline-offset: 2px;
  box-shadow: 0 0 16px rgba(201,168,76,0.3);
}

/* Edit indicator bar */
.ig-edit-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; margin-bottom: 4px;
  background: rgba(201,168,76,0.1); border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--r-sm); font-size: 12px;
}
.ig-edit-label { color: rgba(201,168,76,0.9); flex: 1; }
.ig-edit-cancel {
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: var(--white-50); border-radius: var(--r-sm);
  padding: 2px 10px; font-size: 11px; cursor: pointer;
}
.ig-edit-cancel:hover { color: var(--white); border-color: var(--white-30); }

/* ── Sidebar Chat Session List ───────────────────────────── */
.ig-session-list { margin-top: 8px; }
.ig-session-item {
  display: flex; align-items: center; padding: 4px 8px;
  cursor: pointer;
}
.ig-session-title {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; cursor: pointer;
}
.ig-session-del {
  flex-shrink: 0; background: none; border: none; color: var(--white-30);
  cursor: pointer; padding: 2px; border-radius: 4px; opacity: 0;
  transition: opacity var(--t-fast);
}
.ig-session-item:hover .ig-session-del { opacity: 1; }
.ig-session-del:hover { color: rgba(220,80,80,0.9); background: rgba(220,80,80,0.1); }
.ig-new-chat-btn { gap: 8px; }

/* ── Delete Confirmation Dialog ──────────────────────────── */
.ig-dialog-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.6); display: flex;
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.ig-dialog-overlay.open { opacity: 1; }
.ig-dialog {
  background: var(--bg-card, #1a1a2e); border: 1px solid var(--white-12);
  border-radius: var(--r-lg); padding: 24px; max-width: 380px; width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.ig-dialog-title { font-size: 16px; font-weight: 600; margin: 0 0 8px; color: var(--white); }
.ig-dialog-desc { font-size: 13px; color: var(--white-70); margin: 0 0 16px; line-height: 1.5; }
.ig-dialog-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--white-70); cursor: pointer;
  margin-bottom: 20px;
}
.ig-dialog-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: rgba(201,168,76,0.9);
}
.ig-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ig-dialog-btn { height: 34px; padding: 0 16px; font-size: 13px; border-radius: var(--r-sm); }
.ig-dialog-btn-danger { background: rgba(220,60,60,0.8); border-color: rgba(220,60,60,0.6); }
.ig-dialog-btn-danger:hover { background: rgba(220,60,60,1); }

/* Model Face Dropdown */
.ig-model-select { position: relative; display: inline-block; }
.ig-model-trigger {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px 0 6px;
  border-radius: 9999px; border: 1px solid rgba(201,168,76,0.3);
  background: rgba(255,255,255,0.04); cursor: pointer;
  font-size: 13px; color: var(--white-70); transition: var(--t-fast);
}
.ig-model-trigger:hover { border-color: rgba(201,168,76,0.5); }
.ig-model-thumb { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.ig-model-name { white-space: nowrap; }
.ig-model-caret { opacity: 0.5; flex-shrink: 0; }
.ig-model-menu {
  display: none; position: absolute; bottom: 100%; left: 0;
  margin-bottom: 6px; min-width: 200px; max-height: 260px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--white-12);
  border-radius: var(--r-md);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5), 0 8px 40px rgba(0,0,0,0.6);
  z-index: 9000;
}
.ig-model-menu.open { display: block; }
.ig-model-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  color: var(--white-70); transition: background 0.15s;
}
.ig-model-option:hover { background: rgba(255,255,255,0.06); }
.ig-model-option.active { background: rgba(201,168,76,0.12); color: var(--gold); }
/* Selected model chip — standalone styling (not using ref-chip overflow:hidden) */
.ig-model-chip {
  display: inline-flex; align-items: center; gap: 0;
  height: 34px; border-radius: var(--r-full);
  border: 1px solid rgba(201,168,76,0.5);
  background: rgba(255,255,255,0.04);
  cursor: pointer; position: relative;
  overflow: visible;
}
.ig-model-chip .ig-chip-body {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 2px; height: 100%;
}
.ig-model-chip .ig-chip-thumb {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 1.5px solid rgba(201,168,76,0.4);
}
.ig-model-chip .ig-chip-name {
  font-size: 13px; color: var(--gold-l);
  white-space: nowrap; font-weight: 400;
}
.ig-model-chip .ig-chip-caret {
  opacity: 0.5; flex-shrink: 0; color: var(--gold-l);
}
.ig-model-chip .ig-chip-rm {
  width: 28px; height: 100%; border: none;
  background: rgba(232,85,85,0.15); color: var(--err);
  cursor: pointer; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  border-left: 1px solid rgba(232,85,85,0.2);
  transition: var(--t-fast);
}
.ig-model-chip .ig-chip-rm:hover { background: rgba(232,85,85,0.85); color: #fff; }
/* Avatar fallback when image fails to load */
.ig-chip-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), #8B2A8D);
  border: 1.5px solid rgba(201,168,76,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--gold-l);
}
.ig-model-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), #8B2A8D);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--gold-l);
}

/* Lightbox */
.ig-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(12px);
  display: flex; flex-direction: column;
  opacity: 0; transition: opacity 0.2s ease;
  touch-action: none;
}
.ig-lightbox.open { opacity: 1; }
.ig-lb-close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.7);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.5);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.ig-lb-close:hover { background: rgba(0,0,0,0.8); border-color: #fff; }
.ig-lb-body {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; padding: 60px 24px 24px; cursor: grab;
}
.ig-lb-img {
  max-width: 90vw; max-height: 80vh; object-fit: contain;
  border-radius: var(--r-md); transition: transform 0.1s ease;
  transform-origin: center center; user-select: none;
  -webkit-user-drag: none;
}
.ig-lb-toolbar {
  display: flex; justify-content: center; gap: 8px;
  padding: 12px 24px 20px; flex-shrink: 0;
}
.ig-lb-btn {
  height: 38px; min-width: 38px; padding: 0 12px;
  border-radius: 9999px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; transition: var(--t-fast);
}
.ig-lb-btn:hover { background: rgba(255,255,255,0.2); }
.ig-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.5);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--t-fast); box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.ig-lb-nav:hover { background: rgba(0,0,0,0.75); border-color: #fff; }
.ig-lb-prev { left: 16px; }
.ig-lb-next { right: 16px; }

/* Prompt row */
.prompt-row { display: flex; align-items: flex-end; gap: 10px; }
.prompt-actions { display: flex; flex-direction: column; gap: 6px; align-items: center; flex-shrink: 0; }
.prompt-expand-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: 1px solid var(--white-12);
  border-radius: var(--r-sm); color: var(--white-50); cursor: pointer;
  transition: var(--t-fast);
}
.prompt-expand-btn:hover { background: rgba(255,255,255,0.08); color: var(--white); border-color: var(--white-30); }
.prompt-wrap {
  flex: 1; background: rgba(255,255,255,0.04);
  border: 1px solid var(--white-12);
  border-radius: var(--r-lg); transition: all 0.3s var(--ease);
}
.prompt-wrap:focus-within { border-color: rgba(99,22,100,0.5); box-shadow: 0 0 0 3px rgba(99,22,100,0.1); }
.prompt-wrap.expanded {
  border-color: rgba(99,22,100,0.4);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
}
.studio-input-wrap.expanded {
  z-index: 50;
}
.studio-input-wrap.expanded .prompt-textarea {
  min-height: 200px;
  max-height: calc(70vh - 120px);
}
.prompt-textarea {
  width: 100%; background: transparent; border: none;
  color: var(--white); font-family: var(--font-b);
  font-size: 15px; line-height: 1.6; padding: 12px 16px;
  resize: none; outline: none; min-height: 46px; max-height: 180px;
  overflow-y: auto; transition: min-height 0.3s var(--ease);
}
.prompt-textarea::placeholder { color: var(--white-30); }

.send-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), #4A1150);
  border: none; border-radius: 50%;
  color: var(--white); cursor: pointer;
  transition: var(--t-fast);
  box-shadow: 0 4px 16px rgba(99,22,100,0.25);
}
.send-btn:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(99,22,100,0.35); }
.send-btn:active { transform: scale(0.97); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.send-btn svg { transition: transform var(--t-fast); }

.hint-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.hint-text { font-size: 11px; color: var(--white-30); }

/* Loading steps */
.load-steps { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.load-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--white-30); padding: 6px 12px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  transition: all 0.3s;
}
.load-step.active { color: var(--white); background: rgba(99,22,100,0.15); border-color: rgba(99,22,100,0.3); }
.load-step.done { color: var(--gold); border-color: rgba(201,168,76,0.15); }
.load-step-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ════════════════════════════════════════════════════════════
   PROMPT GENERATOR — App-style interface
   ════════════════════════════════════════════════════════════ */
.pg-app { max-width: 900px; }

/* Hero description */
.pg-hero { margin-bottom: 28px; }
.pg-hero-title {
  font-family: var(--font-d); font-size: 28px; font-weight: 400;
  margin-bottom: 6px; color: var(--white);
}
.pg-hero-desc {
  color: var(--white-50); font-size: 14px; font-weight: 300; line-height: 1.6;
  max-width: 640px;
}
.pg-hero-desc strong { color: var(--white-70); }

/* Controls row */
.pg-controls { display: grid; grid-template-columns: 240px 1fr; gap: 24px; margin-bottom: 28px; }

/* Upload zone */
.pg-upload-zone {
  width: 240px; height: 300px;
  border: 2px dashed var(--white-12);
  border-radius: var(--r-lg);
  cursor: pointer; transition: var(--t-fast);
  background: var(--white-06);
  overflow: hidden; position: relative;
}
.pg-upload-zone:hover, .pg-upload-zone.dragover {
  border-color: rgba(99,22,100,0.5);
  background: rgba(99,22,100,0.08);
}
.pg-upload-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
  height: 100%; padding: 20px;
}
.pg-upload-text { font-size: 13px; color: var(--white-50); text-align: center; }
.pg-upload-text strong { color: var(--white-70); }
.pg-upload-hint { font-size: 11px; color: var(--white-30); }
.pg-upload-preview { width: 100%; height: 100%; position: relative; }
.pg-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.pg-preview-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex; align-items: center; justify-content: space-between;
}
.pg-preview-name {
  font-size: 12px; color: var(--white-70);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px;
}
.pg-preview-change {
  padding: 4px 12px; border: 1px solid var(--white-30);
  background: rgba(0,0,0,0.4); color: var(--white-70);
  font-size: 11px; border-radius: var(--r-full);
  cursor: pointer; transition: var(--t-fast);
  font-family: var(--font-b);
}
.pg-preview-change:hover { background: rgba(0,0,0,0.6); color: var(--white); border-color: var(--white-50); }

/* Video style grid */
.pg-style-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pg-style-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--white-06);
  border-radius: var(--r-md);
  cursor: pointer; transition: var(--t-fast);
  text-align: left; font-family: var(--font-b);
  color: var(--white-70);
}
.pg-style-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--white-12);
  color: var(--white);
}
.pg-style-card.selected {
  background: linear-gradient(135deg, rgba(99,22,100,0.3), rgba(99,22,100,0.1));
  border-color: rgba(99,22,100,0.5);
  color: var(--white);
  box-shadow: 0 0 0 1px rgba(99,22,100,0.2);
}
.pg-style-icon { font-size: 18px; flex-shrink: 0; width: 28px; text-align: center; }
.pg-style-info { flex: 1; min-width: 0; }
.pg-style-name { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; }
.pg-style-desc {
  display: block; font-size: 11px; color: var(--white-30);
  font-weight: 300; line-height: 1.3; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pg-style-card.selected .pg-style-desc { color: var(--white-50); }
.pg-style-tag {
  flex-shrink: 0; font-size: 9px; letter-spacing: 0.05em;
  text-transform: uppercase; padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--white-06); color: var(--white-30);
  white-space: nowrap;
}
.pg-style-tag.voice { background: rgba(201,168,76,0.12); color: var(--gold); }

/* Generate button row */
.pg-action { display: flex; align-items: center; gap: 14px; }
.pg-generate-btn { padding: 12px 32px; font-size: 15px; }
.pg-action-hint { font-size: 11px; color: var(--white-30); }

/* ── Output Panel ──────────────────────────────────────────── */
.pg-output-panel {
  background: var(--surface-glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--white-06);
  border-radius: var(--r-lg);
  margin-bottom: 28px;
  animation: fadeUp 0.3s var(--ease);
  overflow: hidden;
}

/* Tabs */
.pg-tabs {
  display: flex; border-bottom: 1px solid var(--white-06);
  background: rgba(0,0,0,0.15);
}
.pg-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 14px 16px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--white-50); font-family: var(--font-b); font-size: 13px;
  font-weight: 400; cursor: pointer; transition: var(--t-fast);
  white-space: nowrap;
}
.pg-tab:hover { color: var(--white-70); background: rgba(255,255,255,0.02); }
.pg-tab.active {
  color: var(--white);
  border-bottom-color: var(--brand);
  background: rgba(99,22,100,0.08);
}
.pg-tab svg { flex-shrink: 0; }

/* Tab body */
.pg-tab-body { min-height: 200px; }
.pg-tab-content { padding: 0; }
.pg-tab-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--white-06);
}
.pg-tab-label { font-size: 13px; font-weight: 500; color: var(--white-70); }
.pg-copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border: 1px solid var(--white-12);
  background: transparent; color: var(--white-50);
  font-family: var(--font-b); font-size: 12px;
  border-radius: var(--r-full); cursor: pointer; transition: var(--t-fast);
}
.pg-copy-btn:hover { border-color: var(--white-30); color: var(--white); background: var(--white-06); }
.pg-copy-btn.copied { border-color: rgba(76,175,80,0.4); color: var(--success); background: rgba(76,175,80,0.08); }

.pg-output-text {
  margin: 0; padding: 20px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12.5px; line-height: 1.7;
  color: var(--white-90);
  white-space: pre-wrap; word-wrap: break-word;
  max-height: 400px; overflow-y: auto;
  background: transparent;
}

/* Loading state */
.pg-tab-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 48px;
  color: var(--white-50); font-size: 14px;
}
.pg-tab-empty-msg {
  padding: 48px; text-align: center;
  color: var(--white-30); font-size: 14px; font-style: italic;
}
.pg-tab-error {
  display: flex; align-items: center; gap: 10px;
  padding: 20px; color: var(--err); font-size: 14px;
}

/* Background selection banner */
.pg-bg-banner {
  padding: 10px 20px;
  background: rgba(201,168,76,0.08);
  border-bottom: 1px solid rgba(201,168,76,0.15);
  font-size: 13px; color: var(--gold-l); font-weight: 400;
  line-height: 1.5;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pg-controls { grid-template-columns: 1fr; }
  .pg-upload-zone { width: 100%; height: 200px; }
  .pg-style-grid { grid-template-columns: 1fr; }
  .pg-tabs { overflow-x: auto; }
  .pg-tab { font-size: 12px; padding: 12px 10px; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: var(--header-h); bottom: 0; z-index: 200;
    transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,0.4); }
  .sidebar.collapsed { transform: translateX(-100%); width: var(--sidebar-w); box-shadow: none; }
  .module-page { padding: 20px; }
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .header-studio-label { display: none; }
  .header-logo { height: 20px; }
}

/* ═══════════════════════════════════════════════════════════
   GALLERY MODULE
   ═══════════════════════════════════════════════════════════ */
.gallery-loading { display: flex; align-items: center; justify-content: center; padding: 60px 0; }
.gallery-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.gallery-card {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  cursor: pointer; background: var(--white-06);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.gallery-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.gallery-card img { width: 100%; display: block; aspect-ratio: 4/5; object-fit: cover; }
.gallery-card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 32px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  opacity: 0; transition: opacity var(--t-fast);
}
.gallery-card:hover .gallery-card-overlay { opacity: 1; }
.gallery-card-prompt { font-size: 12px; color: var(--white); line-height: 1.4; margin-bottom: 4px; }
.gallery-card-meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--white-50); }
.gallery-card-actions {
  position: absolute; top: 6px; right: 6px;
  opacity: 0; transition: opacity var(--t-fast);
}
.gallery-card:hover .gallery-card-actions { opacity: 1; }
.gallery-delete-btn:hover { background: var(--err) !important; color: #fff !important; }

/* ── Mode Bar (Single/Multi Image Switcher) ──────────────── */
.ig-mode-bar {
  display: flex; gap: 4px; padding: 8px 12px;
  border-bottom: 1px solid var(--white-12);
}
.ig-mode-btn {
  padding: 5px 16px; border-radius: 9999px; font-size: 12px; font-weight: 500;
  background: transparent; color: var(--white-50); border: 1px solid var(--white-30);
  cursor: pointer; transition: all var(--t-fast);
}
.ig-mode-btn.active {
  background: var(--gold); color: var(--bg); border-color: var(--gold);
}
.ig-mode-btn:hover:not(.active) {
  border-color: var(--white-50); color: var(--white-70);
}

/* ── Pose Reference Slots (Multi Mode) ───────────────────── */
.ig-pose-control { min-width: 0; }
.ig-pose-chip { max-width: 140px; }
.ig-pose-attach {
  height: 34px; padding: 0 12px; font-size: 13px;
  border-radius: 9999px; white-space: nowrap; flex-shrink: 0;
}

/* ── Multi-Image Grid Row ────────────────────────────────── */
.ig-multi-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; max-width: 100%;
}
.ig-multi-card {
  position: relative; border-radius: 10px; overflow: hidden; cursor: pointer;
}
.ig-multi-card img {
  width: 100%; display: block; border-radius: 10px;
}
.ig-multi-label {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; text-transform: uppercase;
  letter-spacing: 0.5px; z-index: 1; pointer-events: none;
}
.ig-multi-card .ig-thumb-actions {
  position: absolute; bottom: 6px; right: 6px;
  display: flex; gap: 4px; opacity: 0; transition: opacity var(--t-fast);
}
.ig-multi-card:hover .ig-thumb-actions { opacity: 1; }
.ig-multi-card.edit-target {
  outline: 2px solid #f0c040; outline-offset: -2px;
  box-shadow: 0 0 12px rgba(240,192,64,0.3);
}
