:root {
  --bg-deep: #070913;
  --bg-panel: rgba(16, 19, 36, 0.78);
  --bg-panel-solid: #111427;
  --bg-elev: rgba(25, 30, 56, 0.72);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(139, 108, 255, 0.45);
  --text: #f3f5ff;
  --text-muted: #98a0c3;
  --text-dim: #646c92;
  --accent-1: #7c5cff;
  --accent-2: #ff6b4a;
  --accent-3: #23d5ab;
  --grad-primary: linear-gradient(135deg, #7c5cff 0%, #c058ff 50%, #ff7350 100%);
  --grad-subtle: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(255, 115, 80, 0.16));
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.58);
  --radius-lg: 20px;
  --radius-md: 13px;
  --radius-sm: 9px;
}

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

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .studio-name, .brand-mark {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* ---------- Ambient Aurora ---------- */
.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.32;
}
.aurora .b1 {
  width: 520px; height: 520px;
  background: #6c47ff;
  top: -160px; left: -120px;
}
.aurora .b2 {
  width: 460px; height: 460px;
  background: #ff6243;
  top: -120px; right: -100px;
}
.aurora .b3 {
  width: 540px; height: 540px;
  background: #1ea896;
  bottom: -240px; left: 32%;
  opacity: 0.18;
}

/* ---------- App Shell ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 92px 1fr;
  min-height: 100vh;
}

/* ---------- Left Tool Rail ---------- */
.tool-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(11, 14, 28, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  gap: 18px;
  z-index: 20;
}

.brand {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(15, 18, 36, 0.9);
  border: 1px solid rgba(155, 123, 255, 0.35);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.35);
  overflow: hidden;
  padding: 4px;
}
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}
.topbar-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 7px;
  flex-shrink: 0;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  flex: 1;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px;
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 500;
  text-align: center;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}
.rail-btn svg {
  width: 21px;
  height: 21px;
}
.rail-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.rail-btn.active {
  color: #fff;
  background: var(--grad-subtle);
  border-color: var(--border-strong);
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.25);
}

.rail-footer {
  padding: 6px;
}
.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #23d5ab;
  box-shadow: 0 0 12px #23d5ab;
}

/* ---------- Workspace & Topbar ---------- */
.workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 66px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(9, 11, 22, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.studio-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.studio-name {
  font-size: 19px;
  font-weight: 700;
}
.studio-name .grad {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.studio-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.35);
  color: #cbbaff;
}

.view-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  margin-left: 8px;
}
.view-tab {
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.view-tab.active {
  background: rgba(124, 92, 255, 0.25);
  color: #fff;
}
.count-pill {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.lang-switch:hover { color: #fff; border-color: rgba(255,255,255,0.2); }

.btn-pricing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(192, 88, 255, 0.32);
  transition: transform 0.15s;
}
.btn-pricing:hover { transform: translateY(-1px); }

.credit-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 13px;
}
.credit-pill .coin-icon {
  color: #ffb547;
  font-size: 14px;
}
.credit-pill .topup-plus {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(124, 92, 255, 0.3);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.auth-actions { display: flex; gap: 8px; }
.btn-ghost {
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
.btn-primary-sm {
  padding: 7px 14px;
  border-radius: 10px;
  background: #fff;
  color: #090b16;
  font-weight: 600;
}

/* ---------- User Dropdown ---------- */
.user-menu-wrap { position: relative; }
.avatar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}
.avatar-img, .avatar-initial {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-initial {
  background: var(--grad-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 250px;
  background: #14182e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 50;
}
.dd-email {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 12.5px;
  word-break: break-all;
}
.dd-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.dd-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  text-align: left;
}
.dd-item:hover { background: rgba(255, 255, 255, 0.06); }
.dd-logout { color: #ff7b7b; }

/* ---------- Center Stage (Zen Composer Layout) ---------- */
.stage {
  flex: 1;
  padding: 28px 28px 90px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.studio-zen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 140px);
  gap: 18px;
}

.stage-hero {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 4px;
}
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 99px;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #cabaff;
  margin-bottom: 10px;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #23d5ab;
  box-shadow: 0 0 10px #23d5ab;
}
.stage-hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(180deg, #ffffff 30%, #b7c0e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stage-hero p {
  color: var(--text-muted);
  font-size: 14px;
}

.preset-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.preset-pill {
  padding: 7px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
}
.preset-pill.active {
  background: #fff;
  color: #0b0d1a;
  border-color: #fff;
}

.canvas-card {
  max-width: 900px;
  width: 100%;
  margin: 6px auto 0;
  background: rgba(13, 16, 32, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.canvas-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Active generation result */
.result-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.result-media {
  max-height: 520px;
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-chip {
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-chip:hover { background: rgba(255, 255, 255, 0.13); }

/* Loading spinner inside canvas */
.gen-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 20px;
  text-align: center;
}
.orb-spinner {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #7c5cff, #ff6b4a, #23d5ab, #7c5cff);
  animation: spin 1.4s linear infinite;
  position: relative;
}
.orb-spinner::after {
  content: '';
  position: absolute;
  inset: 6px;
  background: #0f1224;
  border-radius: 50%;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Centered Composer Spotlight ---------- */
.prompt-dock-wrap {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  position: relative;
  z-index: 25;
}
.prompt-dock {
  width: 100%;
  background: rgba(17, 21, 42, 0.82);
  backdrop-filter: blur(26px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(124, 92, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.prompt-dock:focus-within {
  border-color: rgba(145, 112, 255, 0.55);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.65), 0 0 38px rgba(124, 92, 255, 0.18);
}

/* Quick prompt suggestion chips */
.prompt-suggestions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.sug-chip {
  padding: 6px 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.075);
  color: var(--text-muted);
  font-size: 12px;
  transition: all 0.16s ease;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sug-chip:hover {
  color: #fff;
  border-color: rgba(124, 92, 255, 0.45);
  background: rgba(124, 92, 255, 0.14);
  transform: translateY(-1px);
}

/* Subtle recent creations strip */
.recent-strip-wrap {
  max-width: 880px;
  width: 100%;
  margin: 18px auto 0;
}
.recent-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.link-btn {
  color: #b79eff;
  font-size: 12px;
  font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }
.recent-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}
.recent-mini {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d1020;
  cursor: pointer;
  position: relative;
}
.recent-mini img, .recent-mini video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s;
}
.recent-mini:hover img, .recent-mini:hover video {
  transform: scale(1.06);
}

.dock-uploads {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.upload-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 11px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.upload-slot:hover { border-color: var(--accent-1); color: #fff; }
.upload-slot img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 7px;
}
.upload-remove {
  margin-left: 4px;
  color: #ff8080;
  font-weight: 700;
}

.dock-main {
  position: relative;
}
.dock-main textarea {
  width: 100%;
  resize: none;
  font-size: 14px;
  color: var(--text);
  padding-right: 64px;
  max-height: 110px;
}
.dock-main textarea::placeholder { color: var(--text-dim); }
.prompt-counter {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 11px;
  color: var(--text-dim);
}

.dock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.dock-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.ctrl-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.ctrl-pill:hover { border-color: rgba(255, 255, 255, 0.22); }
.ctrl-select {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
}
.ctrl-select option {
  background: #14182e;
  color: #fff;
}

/* Model Picker Popover */
.model-picker-wrap { position: relative; }
.model-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grad-primary);
}
.model-cost-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(124, 92, 255, 0.22);
  color: #d6c8ff;
  font-weight: 600;
}

.model-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  width: 390px;
  max-width: 92vw;
  max-height: 360px;
  background: #13172d;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 60;
}
.model-search-row {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.model-search-row input {
  width: 100%;
  padding: 8px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.model-list {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  text-align: left;
}
.model-option:hover, .model-option.active {
  background: rgba(124, 92, 255, 0.18);
}
.model-option.model-featured-highlight {
  background: linear-gradient(135deg, rgba(255, 181, 71, 0.14), rgba(124, 92, 255, 0.16));
  border: 1px solid rgba(255, 181, 71, 0.45);
  box-shadow: 0 0 18px rgba(255, 181, 71, 0.12);
}
.model-option.model-featured-highlight:hover,
.model-option.model-featured-highlight.active {
  background: linear-gradient(135deg, rgba(255, 181, 71, 0.24), rgba(124, 92, 255, 0.28));
  border-color: rgba(255, 181, 71, 0.75);
}
.model-rec-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 99px;
  background: linear-gradient(135deg, #ffb547, #ff6bd6);
  color: #0b0d17;
  box-shadow: 0 2px 8px rgba(255, 181, 71, 0.35);
  white-space: nowrap;
}
.model-btn.model-btn-highlighted {
  border-color: rgba(255, 181, 71, 0.55);
  background: linear-gradient(135deg, rgba(255, 181, 71, 0.12), rgba(124, 92, 255, 0.16));
  box-shadow: 0 0 14px rgba(255, 181, 71, 0.16);
}
.model-trigger-star {
  color: #ffb547;
  font-size: 12px;
  margin-left: 2px;
  text-shadow: 0 0 8px rgba(255, 181, 71, 0.6);
}
.model-opt-title {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.model-opt-provider {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}
.model-opt-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.model-opt-price {
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffb547;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 13px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  box-shadow: 0 10px 26px rgba(124, 92, 255, 0.4);
  transition: transform 0.15s, opacity 0.15s;
}
.btn-generate:hover { transform: translateY(-1px); }
.btn-generate:disabled { opacity: 0.55; cursor: not-allowed; }
.gen-credit-tag {
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.28);
  font-size: 11.5px;
  font-weight: 600;
}

/* ---------- History / Gallery ---------- */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.chip.active {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 16px;
}
.gen-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gen-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #0c0f1f;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.gen-thumb img, .gen-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gen-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(9, 11, 22, 0.78);
  border: 1px solid var(--border);
}
.gen-meta {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gen-prompt {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gen-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-dim);
}

/* ---------- Pricing Cards ---------- */
.pricing-header {
  text-align: center;
  max-width: 640px;
  margin: 8px auto 28px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #b79eff;
}
.pricing-header h1 { font-size: 32px; margin: 6px 0 8px; }
.pricing-header p { color: var(--text-muted); }

.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 18px;
}
.pkg-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.pkg-card.popular {
  border-color: #9b7bff;
  box-shadow: 0 0 0 1px #9b7bff, 0 22px 50px rgba(124, 92, 255, 0.25);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.14), rgba(16, 19, 36, 0.88));
}
.pkg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pkg-name { font-size: 20px; font-weight: 700; }
.pkg-pop-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--grad-primary);
}
.pkg-price {
  font-family: 'Outfit', sans-serif;
  font-size: 34px;
  font-weight: 800;
}
.pkg-price small {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.pkg-bonus-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(35, 213, 171, 0.1);
  border: 1px solid rgba(35, 213, 171, 0.32);
  font-size: 12.5px;
}
.pkg-bonus-box strong { color: #4ff0c6; display: block; }
.pkg-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  color: var(--text-muted);
  font-size: 13px;
}
.pkg-features li::before {
  content: '✓ ';
  color: #23d5ab;
  font-weight: 700;
}
.btn-buy {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: #fff;
}
.pkg-card.popular .btn-buy, .btn-buy:hover {
  background: var(--grad-primary);
  border-color: transparent;
}

/* ---------- Panels & Tables ---------- */
.panel-wrap { display: flex; flex-direction: column; gap: 18px; }
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}
.glass-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.glass-card h3 { margin-bottom: 12px; }
.table-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
}
.row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 14, 0.76);
  backdrop-filter: blur(8px);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: #13172e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}
.btn-full {
  width: 100%;
  padding: 11px;
  border-radius: 11px;
  background: var(--grad-primary);
  font-weight: 700;
  color: #fff;
}
.or-sep {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin: 6px 0;
}

/* ---------- Channel Selector (Tripay) ---------- */
.channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}
.channel-card {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  font-size: 12px;
}
.channel-card.active {
  border-color: #9b7bff;
  background: rgba(124, 92, 255, 0.2);
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  top: 78px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 15px;
  border-radius: 12px;
  background: #191f3d;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}
.toast.error { border-color: #ff6b6b; color: #ffbdbd; }
.toast.success { border-color: #23d5ab; color: #b8ffec; }

/* ---------- Zoom Preview & Trash Bin & Lightbox ---------- */
.retention-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.retention-note strong {
  color: #4ff0c6;
}
.history-controls-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chip-trash {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: rgba(255, 107, 107, 0.35);
}
.chip-trash.active {
  background: linear-gradient(135deg, #ff5e7e, #ff3d57);
  border-color: transparent;
  color: #fff;
}
.trash-pill {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 700;
}
.btn-empty-trash {
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: #ffd2d2;
  background: rgba(255, 77, 109, 0.18);
  border: 1px solid rgba(255, 77, 109, 0.5);
  cursor: pointer;
  transition: all 0.18s;
}
.btn-empty-trash:hover {
  background: rgba(255, 77, 109, 0.34);
  color: #fff;
}

.gen-exp-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(9, 11, 22, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
}
.gen-thumb-zoomable {
  cursor: zoom-in;
}
.gen-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(7, 9, 20, 0.85) 100%);
  opacity: 0;
  transition: opacity 0.18s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
  gap: 6px;
}
.gen-card:hover .gen-thumb-overlay {
  opacity: 1;
}
.gen-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.btn-card-act {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.btn-card-act:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
}
.btn-card-danger {
  color: #ffb4b4;
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.1);
}
.btn-card-danger:hover {
  background: rgba(255, 107, 107, 0.25);
  color: #fff;
}
.btn-card-restore {
  color: #8affdf;
  border-color: rgba(35, 213, 171, 0.4);
  background: rgba(35, 213, 171, 0.12);
}
.btn-card-restore:hover {
  background: rgba(35, 213, 171, 0.28);
  color: #fff;
}

/* Studio Canvas Inline Zoom Viewport */
.result-zoom-viewport {
  position: relative;
  width: 100%;
  max-height: 620px;
  overflow: hidden;
  border-radius: 16px;
  background: #070913;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  user-select: none;
}
.result-zoom-viewport.is-zoomed {
  cursor: grab;
}
.result-zoom-viewport.is-zoomed:active {
  cursor: grabbing;
}
.result-zoom-viewport .result-media {
  transition: transform 0.08s ease-out;
  transform-origin: center center;
  max-height: 580px;
  width: auto;
  max-width: 100%;
  border-radius: 12px;
  pointer-events: none;
}
.result-zoom-viewport video.result-media {
  pointer-events: auto;
}
.zoom-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 18, 36, 0.86);
  border: 1px solid var(--border);
  padding: 4px 6px;
  border-radius: 99px;
}
.zoom-btn {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  cursor: pointer;
}
.zoom-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
.zoom-pct {
  min-width: 52px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #c4b5fd;
  cursor: pointer;
}

/* Fullscreen Lightbox Modal */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(4, 6, 15, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
}
.lightbox-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(10, 13, 28, 0.75);
  gap: 12px;
  flex-wrap: wrap;
}
.lightbox-info {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lb-btn {
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.lb-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.lb-zoom-level {
  min-width: 60px;
  justify-content: center;
  color: #c4b5fd;
}
.lb-danger {
  background: rgba(255, 82, 108, 0.16);
  border-color: rgba(255, 82, 108, 0.42);
  color: #ffc2cc;
}
.lb-danger:hover {
  background: rgba(255, 82, 108, 0.34);
  color: #fff;
}
.lb-primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(255, 110, 199, 0.28));
  border-color: rgba(155, 123, 255, 0.55);
  color: #f3e8ff;
}
.lb-primary:hover {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
}
.lb-close {
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}
.lightbox-prompt-drawer {
  max-width: 860px;
  width: calc(100% - 40px);
  margin: 12px auto 0;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(16, 20, 42, 0.94);
  border: 1px solid rgba(155, 123, 255, 0.38);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}
.lb-prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #c4b5fd;
}
.lb-prompt-meta {
  color: var(--text-dim);
  font-size: 11px;
}
.lb-prompt-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #f8fafc;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
  user-select: text;
}
.result-prompt-box {
  width: 100%;
  max-width: 780px;
  margin: 10px auto 2px;
  padding: 13px 16px;
  border-radius: 13px;
  background: rgba(14, 18, 38, 0.9);
  border: 1px solid rgba(155, 123, 255, 0.35);
  text-align: left;
}
.result-prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #c4b5fd;
  margin-bottom: 6px;
}
.result-prompt-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}
.gen-prompt.expanded {
  -webkit-line-clamp: unset;
  display: block;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(155, 123, 255, 0.28);
  color: var(--text);
  white-space: pre-wrap;
  max-height: 150px;
  overflow-y: auto;
}
.lightbox-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  user-select: none;
  cursor: grab;
}
.lightbox-stage:active {
  cursor: grabbing;
}
.lightbox-viewport {
  display: grid;
  place-items: center;
  transform-origin: center center;
  transition: transform 0.06s ease-out;
}
.lightbox-viewport img,
.lightbox-viewport video {
  max-width: 88vw;
  max-height: 78vh;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
.lightbox-viewport video {
  pointer-events: auto;
}
.lightbox-hint {
  text-align: center;
  padding: 8px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(10, 13, 28, 0.65);
}

/* ---------- Recent Strip Show/Hide Toggle ---------- */
.recent-strip-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.recent-count-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(155, 123, 255, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(155, 123, 255, 0.32);
}
.recent-strip-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.recent-toggle-btn {
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.16s;
}
.recent-toggle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(155, 123, 255, 0.45);
}
.recent-strip-wrap.is-collapsed {
  padding-bottom: 4px;
}
.setting-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.setting-toggle-row strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}
.setting-toggle-row span {
  font-size: 11.5px;
  color: var(--text-muted);
}
.switch-pill {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  white-space: nowrap;
}
.switch-pill.on {
  background: rgba(35, 213, 171, 0.18);
  border-color: rgba(35, 213, 171, 0.5);
  color: #6ff7d4;
}

/* ---------- Generation Failure Notification Card & Toast ---------- */
.toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  max-width: 440px;
  line-height: 1.45;
}
.toast-close {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
}
.toast-close:hover {
  opacity: 1;
}
.gen-error-card {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 82, 108, 0.12), rgba(16, 19, 36, 0.94));
  border: 1px solid rgba(255, 107, 107, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.gen-error-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gen-error-icon {
  font-size: 26px;
}
.gen-error-head h3 {
  margin: 0;
  color: #ffc2cc;
  font-size: 17px;
}
.gen-error-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.gen-error-reason {
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(8, 10, 22, 0.78);
  border: 1px solid rgba(255, 107, 107, 0.3);
  font-size: 13px;
  line-height: 1.55;
  color: #ffe4e8;
}
.gen-error-reason strong {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ff8fa3;
  margin-bottom: 4px;
}
.gen-error-reason p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.gen-error-refund {
  font-size: 12.5px;
  font-weight: 600;
  color: #6ff7d4;
  background: rgba(35, 213, 171, 0.1);
  border: 1px solid rgba(35, 213, 171, 0.3);
  padding: 8px 12px;
  border-radius: 9px;
}
.gen-thumb-failed {
  padding: 16px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  overflow-y: auto;
}
.gen-thumb-failed strong {
  color: #ff9b9b;
  font-size: 12.5px;
}
.gen-thumb-failed p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #ffd6d6;
}
.gen-thumb-failed span {
  font-size: 10.5px;
  color: #6ff7d4;
  margin-top: 2px;
}

/* ---------- Responsive (Mobile) ---------- */
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .tool-rail {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    flex-direction: row;
    padding: 4px 8px;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .brand, .rail-footer { display: none; }
  .rail-nav { flex-direction: row; justify-content: space-around; }
  .rail-btn { flex: 1; padding: 6px 2px; font-size: 10px; }

  .topbar {
    height: auto;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-left {
    display: contents;
  }
  .studio-title {
    order: 1;
  }
  .studio-name {
    font-size: 16px;
  }
  .studio-badge {
    display: none;
  }
  .topbar-right {
    order: 2;
    margin-left: auto;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .view-tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .view-tab {
    justify-content: center;
    padding: 6px 8px;
    font-size: 12px;
  }
  .lang-switch {
    padding: 5px 8px;
    font-size: 11px;
  }
  .btn-pricing {
    padding: 6px 10px;
    font-size: 11.5px;
  }
  .btn-pricing span {
    display: none;
  }
  .credit-pill {
    padding: 5px 9px;
    font-size: 12px;
    gap: 5px;
  }
  .auth-actions {
    gap: 5px;
  }
  .btn-ghost,
  .btn-primary-sm {
    padding: 6px 10px;
    font-size: 11.5px;
    border-radius: 8px;
  }
  .avatar-btn {
    padding: 3px 6px 3px 3px;
  }
  .avatar-img,
  .avatar-initial {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  .user-dropdown {
    right: 0;
    width: min(250px, calc(100vw - 24px));
  }

  .stage {
    padding: 16px 12px 96px;
  }
  .studio-zen {
    min-height: auto;
    justify-content: flex-start;
  }
  .stage-hero h1 {
    font-size: 24px;
  }
  .dock-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-generate {
    width: 100%;
    justify-content: center;
  }
  .model-popover {
    width: calc(100vw - 44px);
    max-width: 360px;
  }
}
