/* ═══════════════════════════════════════════════════════════════════════════
   TECHPACK STUDIO — PREMIUM LIGHT THEME
   Aesthetic: Atelier Blanc — refined, minimal, editorial
   Typography: Satoshi (display) + General Sans (body)
   Palette: Soft white canvas + electric violet + warm gold
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://api.fontshare.com/v2/css?f[]=satoshi@700,900&f[]=general-sans@400,500,600&display=swap');

:root {
  /* ── Surface Palette (was --void-*, kept names for compatibility) ─── */
  --void-deepest: #f5f5f7;     /* page bg deepest */
  --void-deep: #fafafc;         /* page bg */
  --void-base: #ffffff;         /* base card surface */
  --void-raised: #ffffff;       /* raised card */
  --void-elevated: #f9f9fb;     /* elevated section */
  --void-surface: #f0f0f4;      /* button surface */
  --void-hover: #e8e8ee;        /* hover state */

  /* ── Text ──────────────────────────────────────────────────────────── */
  --text-primary: #0f0f1a;      /* near-black */
  --text-secondary: #4a4a5e;    /* dark gray */
  --text-tertiary: #6b6b85;     /* medium gray */
  --text-ghost: #a3a3b3;        /* light gray */

  /* ── Accent: Electric Violet ──────────────────────────────────────── */
  --accent: #7c3aed;
  --accent-light: #6d28d9;       /* darker for contrast on white */
  --accent-dim: #5b21b6;
  --accent-glow: rgba(124, 58, 237, 0.18);
  --accent-subtle: rgba(124, 58, 237, 0.06);

  /* ── Secondary: Warm Gold ─────────────────────────────────────────── */
  --gold: #b8923a;
  --gold-light: #d4a853;
  --gold-dim: #8a6d28;
  --gold-glow: rgba(184, 146, 58, 0.18);

  /* ── Status ────────────────────────────────────────────────────────── */
  --success: #16a34a;
  --success-dim: rgba(22, 163, 74, 0.1);
  --error: #dc2626;
  --error-dim: rgba(220, 38, 38, 0.08);
  --warning: #d97706;
  --warning-dim: rgba(217, 119, 6, 0.1);

  /* ── Glass / Borders ──────────────────────────────────────────────── */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(15, 15, 26, 0.08);
  --glass-shine: rgba(255, 255, 255, 0.6);
  --glass-blur: 14px;

  /* ── Geometry ──────────────────────────────────────────────────────── */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 100px;

  /* ── Shadows ───────────────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(15,15,26,.04), 0 1px 3px rgba(15,15,26,.06);
  --shadow-md: 0 2px 8px rgba(15,15,26,.06), 0 4px 12px rgba(15,15,26,.08);
  --shadow-lg: 0 4px 16px rgba(15,15,26,.08), 0 12px 32px rgba(15,15,26,.1);
  --shadow-xl: 0 8px 32px rgba(15,15,26,.12), 0 24px 64px rgba(15,15,26,.14);
  --shadow-glow-accent: 0 4px 24px rgba(124, 58, 237, 0.18);
  --shadow-glow-gold: 0 4px 24px rgba(184, 146, 58, 0.16);

  /* ── Typography ────────────────────────────────────────────────────── */
  --font-display: 'Satoshi', system-ui, sans-serif;
  --font-body: 'General Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* ── Layout ────────────────────────────────────────────────────────── */
  --sidebar-w: 64px;
  --topbar-h: 60px;

  /* ── Transitions ───────────────────────────────────────────────────── */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ═══ RESET & BASE ════════════════════════════════════════════════════════ */

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

body {
  font-family: var(--font-body);
  background: var(--void-deepest);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--void-surface); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--void-hover); }

::selection { background: var(--accent); color: white; }

/* ═══ LOGIN ═══════════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,58,237,.06), transparent),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(184,146,58,.04), transparent),
    var(--void-deepest);
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow-xl);
  animation: cardReveal 0.6s var(--ease-out-expo);
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand { text-align: center; margin-bottom: 40px; }
.login-brand h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.login-brand h1 span { color: var(--accent-light); }
.login-brand .brand-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 6px;
}
.login-brand .brand-line {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  margin: 14px auto 0;
  border-radius: 2px;
}

/* ═══ FORM ELEMENTS (dark inputs) ═════════════════════════════════════════ */

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 11px 16px;
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all var(--duration-normal) var(--ease-out-expo);
  outline: none;
}
.form-input:hover { border-color: rgba(15,15,26,0.18); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #ffffff;
}
.form-input::placeholder { color: var(--text-ghost); }

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

textarea.form-input {
  resize: vertical;
  min-height: 72px;
  font-family: var(--font-body);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--void-surface);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: var(--void-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

.btn-danger {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(248,113,113,0.15);
}
.btn-danger:hover { background: rgba(248,113,113,0.18); }

.btn-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(52,211,153,0.15);
}
.btn-success:hover { background: rgba(52,211,153,0.18); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--void-surface); }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-full { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-xs); }

.login-error { color: var(--error); font-size: 12px; text-align: center; margin-top: 12px; display: none; }

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

.app { display: none; min-height: 100vh; }
.app.active { display: block; }

/* ── Top Bar ─────────────────────────────────────────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 20px; }
.topbar-brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.topbar-brand span { color: var(--accent-light); }

.topbar-context { display: flex; align-items: center; gap: 12px; }
.topbar-context .style-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent-light);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(124,58,237,0.15);
}
.topbar-context .breadcrumb { font-size: 13px; color: var(--text-tertiary); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Persistent credit balance pill. Lives in the topbar so users always see
   their balance and it updates live on every charge/refund. */
.topbar-credits {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  background: color-mix(in srgb, var(--accent) 12%, var(--void-base));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.topbar-credits:hover {
  background: color-mix(in srgb, var(--accent) 20%, var(--void-base));
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.topbar-credits:active { transform: scale(0.97); }
.topbar-credits-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.topbar-credits-value {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.topbar-credits-label {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 12px;
}
.topbar-credits.low {
  background: color-mix(in srgb, #dc2626 14%, var(--void-base));
  border-color: color-mix(in srgb, #dc2626 50%, transparent);
}
.topbar-credits.low .topbar-credits-icon,
.topbar-credits.low .topbar-credits-value { color: #dc2626; }
.topbar-credits.unlimited .topbar-credits-value { color: var(--text-secondary); font-weight: 500; }

.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.topbar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold-dim));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 0 0 2px var(--void-deepest), 0 0 0 3px var(--accent-dim);
}

/* ── Sidebar (4-icon rail) ───────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--glass-border);
  padding: 14px 0 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 90;
}

.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.rail-btn:hover { background: var(--void-surface); color: var(--text-primary); }
.rail-btn.active {
  background: var(--accent-subtle);
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.rail-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Dashboard rail icon — outlined-square visual treatment per the topbar
   relocation. Sits at the top of the rail above Tools. */
.rail-btn-dashboard {
  border: 1.5px solid var(--glass-border);
  margin-bottom: 4px;
}
.rail-btn-dashboard:hover { border-color: var(--accent); }
.rail-btn-dashboard.active { border-color: var(--accent); }

/* Locked rail buttons — applied to Library + Tech Pack when no project
   is selected (topStyleCode shows "--"). Prevents accidental clicks
   into project-bound surfaces. */
.rail-btn.rail-locked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Tooltip — slides in from the right on hover or keyboard focus. */
.rail-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--text-primary);
  color: var(--void-base);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 200;
  letter-spacing: 0.2px;
}
.rail-btn[data-tip]:hover::after,
.rail-btn[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.rail-spacer { flex: 1; }

/* Legacy classes — markup was removed but keep these inert so any stray
   dynamic mount (Sidebar.mount fallback in tabs-html.js) doesn't blow up
   styling for the rest of the page. */
.sidebar-section, .sidebar-section-title, .sidebar-section-header,
.sidebar-item { display: none !important; }

/* ── Library page ────────────────────────────────────────────────────────── */
.lib-shell { display: flex; flex-direction: column; min-height: 70vh; }
.lib-kindbar {
  display: flex; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--glass-border);
  background: rgba(124,58,237,0.03);
}
.lib-kind {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; background: transparent; color: var(--text-secondary);
  border: 1px solid transparent; cursor: pointer; font-size: 12px; font-weight: 600;
}
.lib-kind:hover { background: rgba(124,58,237,0.06); color: var(--text-primary); }
.lib-kind.active { background: rgba(124,58,237,0.16); color: var(--accent); border-color: rgba(124,58,237,0.3); }
.lib-kind-icon { font-size: 14px; }

.lib-body { display: grid; grid-template-columns: 260px 1fr; min-height: 60vh; }
.lib-tree { border-right: 1px solid var(--glass-border); padding: 12px; overflow-y: auto; }
.lib-tree-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.lib-tree-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-tertiary); }
.lib-tree-list { display: flex; flex-direction: column; gap: 2px; }

.lib-folder {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px;
  cursor: pointer; color: var(--text-secondary); font-size: 12.5px; user-select: none;
}
.lib-folder:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.lib-folder.active { background: rgba(124,58,237,0.16); color: var(--accent); }
.lib-folder.drop-target { background: rgba(34,197,94,0.16); color: #22c55e; border: 1px dashed #22c55e; padding: 6px 9px; }
.lib-folder-icon { width: 16px; text-align: center; opacity: 0.7; }
.lib-folder-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-folder-count { font-family: var(--font-mono); font-size: 10px; opacity: 0.5; }
.lib-folder-action {
  background: transparent; border: 0; color: inherit; opacity: 0.4; cursor: pointer;
  font-size: 13px; padding: 0 4px; line-height: 1;
}
.lib-folder-action:hover { opacity: 1; }
.lib-badge {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  background: rgba(20,184,166,0.18); color: #14b8a6; padding: 1px 6px; border-radius: 4px;
}

.lib-main { padding: 16px 20px; position: relative; overflow-y: auto; }
.lib-main-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lib-main-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.lib-main-actions { display: flex; gap: 8px; }

.lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.lib-item {
  position: relative; aspect-ratio: 3/4; overflow: hidden; border-radius: 8px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,0.02);
  cursor: grab;
}
.lib-item:active { cursor: grabbing; }
.lib-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent); color: #fff;
  display: flex; align-items: center; gap: 6px; font-size: 11px;
}
.lib-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-item-del {
  background: transparent; border: 0; color: #fff; cursor: pointer; opacity: 0.7;
  font-size: 14px; padding: 0 4px; line-height: 1;
}
.lib-item-del:hover { opacity: 1; color: var(--error); }
/* Reportable-id chip (GI_/Ml_) — top-left overlay, click to copy. */
.lib-item-id {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  max-width: calc(100% - 12px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px; line-height: 1;
  color: #fff; background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 5px;
  padding: 3px 6px; cursor: pointer; opacity: 0.8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lib-item-id:hover { opacity: 1; background: rgba(0,0,0,0.8); }

.lib-drop-hint {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(124,58,237,0.16); border: 2px dashed var(--accent); border-radius: 8px;
  color: var(--accent); font-size: 14px; font-weight: 700; pointer-events: none;
}
.lib-shell.lib-dragging .lib-drop-hint { display: flex; }

/* ── Main Content ────────────────────────────────────────────────────────── */

.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 10px;
  min-height: calc(100vh - var(--topbar-h));
  padding-bottom: 80px;
  background:
    radial-gradient(ellipse 70% 40% at 30% 0%, rgba(124,58,237,.03), transparent),
    radial-gradient(ellipse 50% 30% at 90% 100%, rgba(212,168,83,.02), transparent),
    var(--void-deepest);
}

/* ═══ PROJECTS GRID (DASHBOARD) ═══════════════════════════════════════════ */

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.dashboard-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.pack-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}
.pack-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--glass-shine), transparent);
  pointer-events: none;
}
.pack-card:hover {
  border-color: rgba(124,58,237,0.2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-accent);
}

.pack-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pack-card-code {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-light);
}
.pack-card-date { font-size: 11px; color: var(--text-ghost); }
.pack-card-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.pack-card-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--void-surface);
  color: var(--text-tertiary);
  border: 1px solid var(--glass-border);
}
.pack-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

.pack-card-new {
  border: 2px dashed rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: var(--text-ghost);
  background: transparent;
  backdrop-filter: none;
}
.pack-card-new::before { display: none; }
.pack-card-new:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-subtle);
  box-shadow: var(--shadow-glow-accent);
}
.pack-card-new .plus { font-size: 32px; margin-bottom: 8px; font-weight: 300; }
.pack-card-new span { font-size: 13px; font-weight: 500; }

/* ═══ MODE SELECTION ══════════════════════════════════════════════════════ */

.mode-selection {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: calc(100vh - var(--topbar-h) - 120px);
  padding: 40px;
}

.mode-card {
  width: 340px;
  padding: 48px 36px;
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-slow) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}
.mode-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--glass-shine), transparent 40%);
  pointer-events: none;
}
.mode-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-xl);
}
.mode-card.mode-collection:hover {
  border-color: rgba(124,58,237,0.3);
  box-shadow: var(--shadow-xl), var(--shadow-glow-accent);
}
.mode-card.mode-techpack:hover {
  border-color: rgba(212,168,83,0.3);
  box-shadow: var(--shadow-xl), var(--shadow-glow-gold);
}
.mode-card.mode-concept:hover {
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: var(--shadow-xl), 0 0 30px rgba(52, 211, 153, 0.15);
}
.mode-card.mode-concept .mode-icon { filter: drop-shadow(0 0 12px rgba(52, 211, 153, 0.25)); }

.mode-card .mode-icon {
  font-size: 48px;
  margin-bottom: 20px;
  display: block;
}
.mode-card.mode-collection .mode-icon { filter: drop-shadow(0 0 12px var(--accent-glow)); }
.mode-card.mode-techpack .mode-icon { filter: drop-shadow(0 0 12px var(--gold-glow)); }

.mode-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.mode-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* ═══ EDITOR / SECTION CARDS ══════════════════════════════════════════════ */

.editor-page { display: none; }
.editor-page.active { display: block; }

.section-card {
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 22px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.section-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-shine), transparent);
}

.section-card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-card-title .icon { color: var(--accent-light); }

/* ═══ OUTLINE ICON SYSTEM ═══════════════════════════════════════════════
   Convention: inline <svg viewBox="0 0 24 24" fill="none"
                            stroke="currentColor" stroke-width="1.5"
                            stroke-linecap="round" stroke-linejoin="round">
   wrapped in <span class="icon">. Stroke inherits currentColor so icons
   flip automatically with the theme. Size via the class variants below. */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  vertical-align: middle;
  line-height: 1;
}
.icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  fill: none;
}
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 40px; height: 40px; }
.icon-2xl { width: 56px; height: 56px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.form-group-inline { display: flex; flex-direction: column; }
.form-group-inline label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.form-group-inline .form-input { font-size: 13px; padding: 9px 14px; }

/* ═══ COLOR PALETTE — GRID OF MINIMALIST SQUARES ═══════════════════════════ */

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.palette-tile {
  position: relative;
  background: rgba(15, 15, 26, 0.02);
  border: 1px solid rgba(15, 15, 26, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
  display: flex;
  flex-direction: column;
}
.palette-tile:hover {
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Top: large color square — native picker inside */
.palette-color-picker {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  position: relative;
  transition: all var(--duration-normal);
  overflow: hidden;
}
.palette-color-picker input[type="color"] {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
.palette-color-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.palette-color-picker input[type="color"]::-webkit-color-swatch { border: none; }
.palette-color-picker input[type="color"]::-moz-color-swatch { border: none; }

/* Bottom: text fields */
.palette-tile-fields {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.palette-field {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(15, 15, 26, 0.08);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 11px;
  outline: none;
  transition: all var(--duration-fast);
  width: 100%;
}
.palette-field:hover { border-color: rgba(15, 15, 26, 0.15); }
.palette-field:focus { border-color: var(--accent); background: rgba(0, 0, 0, 0.5); }
.palette-field::placeholder { color: var(--text-ghost); }
.palette-field-name { font-weight: 600; font-size: 12px; }
.palette-field-mono { font-family: var(--font-mono); font-size: 10px; }

/* Action buttons (save / remove) */
.palette-tile-actions {
  display: flex;
  gap: 4px;
  padding: 0 12px 12px;
}
.palette-action-btn {
  flex: 1;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-fast);
  background: rgba(15, 15, 26, 0.04);
  color: var(--text-tertiary);
}
.palette-action-btn:hover { background: rgba(15, 15, 26, 0.1); color: var(--text-primary); }
.palette-action-btn.save:hover { background: var(--gold-glow); color: var(--gold); border-color: rgba(212, 168, 83, 0.3); }

/* Must-use primary color toggle */
.palette-action-btn.must-use {
  font-size: 10px;
  padding: 4px 6px;
  letter-spacing: 0.2px;
}
.palette-action-btn.must-use.active {
  background: var(--gold-glow);
  color: var(--gold);
  border-color: var(--gold);
  font-weight: 700;
}
.palette-action-btn.must-use:hover:not(.active) {
  background: var(--gold-glow);
  color: var(--gold);
  border-color: rgba(212, 168, 83, 0.3);
}

/* "MUST" badge on the color swatch */
.palette-must-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--gold);
  color: #000;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.6px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
  box-shadow: 0 2px 8px rgba(184, 146, 58, 0.35);
  z-index: 2;
}

/* Outer tile accent when must-use */
.palette-tile.is-must-use {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 4px 16px rgba(184, 146, 58, 0.18);
}
.palette-tile.is-must-use:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 6px 20px rgba(184, 146, 58, 0.25);
}
.palette-action-btn.remove {
  flex: 0 0 30px;
}
.palette-action-btn.remove:hover { background: rgba(248, 113, 113, 0.15); color: var(--error); border-color: rgba(248, 113, 113, 0.3); }

/* Empty state */
.palette-tile.empty .palette-color-picker { background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)); }

/* Add tile */
.palette-tile-add {
  border: 2px dashed rgba(167, 139, 250, 0.25);
  background: rgba(124, 58, 237, 0.04);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  transition: all var(--duration-normal);
}
.palette-tile-add:hover {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.12);
  transform: translateY(-2px);
}
.palette-add-icon {
  font-size: 32px;
  font-weight: 200;
  color: var(--accent-light);
  margin-bottom: 6px;
  line-height: 1;
}
.palette-add-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Legacy class compatibility — kept for safety */
.palette-swatch { position: relative; min-width: 100px; }

/* ═══ IMAGE UPLOAD ZONES ══════════════════════════════════════════════════ */

.image-upload-zone {
  border: 2px dashed rgba(167, 139, 250, 0.25);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal);
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(124, 58, 237, 0.04);
}
.image-upload-zone:hover {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.12);
}
.image-upload-zone.drag-over {
  border-color: var(--accent-light);
  background: rgba(124, 58, 237, 0.18);
  border-width: 3px;
}
.image-upload-zone.has-image {
  border-style: solid;
  border-color: rgba(124, 58, 237, 0.4);
  padding: 8px;
}
.image-upload-zone .upload-icon { font-size: 24px; color: var(--accent-light); margin-bottom: 6px; opacity: 0.85; }
.image-upload-zone .upload-text { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.image-upload-zone .upload-hint { font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
.image-upload-zone img { max-width: 100%; max-height: 200px; object-fit: contain; border-radius: var(--radius-xs); }
.image-upload-zone input[type="file"] { display: none; }

/* ═══ PRODUCT OVERVIEW ════════════════════════════════════════════════════ */

.product-overview { display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.product-upload-area {
  border: 2px dashed rgba(167, 139, 250, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(124, 58, 237, 0.05);
}
.product-upload-area:hover { border-color: var(--accent); background: rgba(124, 58, 237, 0.12); }
.product-upload-area.drag-over { border-color: var(--accent-light); background: rgba(124, 58, 237, 0.18); }
.product-upload-area.has-image { border-style: solid; border-color: rgba(124, 58, 237, 0.4); padding: 12px; }
.product-upload-area img { max-width: 100%; max-height: 260px; object-fit: contain; }
.product-upload-area .upload-icon { font-size: 36px; color: var(--accent-light); margin-bottom: 8px; opacity: 0.85; }
.product-upload-area .upload-label { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.product-upload-area .upload-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }
.product-upload-area input[type="file"] { display: none; }

.product-illustrations {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-height: 280px;
  background: var(--void-base);
}
.product-illustrations-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.product-illustrations-header h4 { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.illustrations-grid { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.illustration-item { text-align: center; flex: 1; min-width: 120px; }
.illustration-item .illust-preview {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--void-raised);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  overflow: hidden;
  padding: 8px;
  transition: all var(--duration-normal);
  cursor: pointer;
}
.illustration-item .illust-preview:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow-accent);
  transform: scale(1.02);
}
.illustration-item .illust-preview img { max-width: 100%; max-height: 180px; object-fit: contain; }
.illustration-item .illust-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); font-weight: 600; }
.illustration-placeholder { color: var(--text-ghost); font-size: 12px; }

/* ═══ GENERATE BUTTON ═════════════════════════════════════════════════════ */

.btn-generate {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
  padding: 10px 24px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-normal);
  box-shadow: 0 2px 16px var(--accent-glow);
  letter-spacing: 0.3px;
}
.btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px var(--accent-glow);
  filter: brightness(1.12);
}
.btn-generate:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn-generate.loading { pointer-events: none; }
.btn-generate.loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  margin-left: 8px;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pulse animation when generating */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
  50% { box-shadow: 0 0 40px rgba(124,58,237,0.35); }
}

/* ═══ BOM TABLES ══════════════════════════════════════════════════════════ */

.bom-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.bom-table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
.bom-table thead { background: var(--void-elevated); }
.bom-table th {
  padding: 10px 12px;
  font-weight: 600;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--glass-border);
}
.bom-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-secondary);
}
.bom-table tbody tr { transition: background var(--duration-fast); }
.bom-table tbody tr:hover { background: var(--void-raised); }
.bom-table .color-sub-row { background: rgba(255,255,255,0.01); }
.bom-table .color-sub-row td { font-size: 11px; color: var(--text-ghost); padding: 4px 12px; }

.bom-table input {
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  font-family: var(--font-body);
  font-size: 12px;
  width: 100%;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  transition: all var(--duration-fast);
}
.bom-table input:hover { border-color: var(--glass-border); background: var(--void-base); }
.bom-table input:focus { border-color: var(--accent); background: var(--void-base); outline: none; box-shadow: 0 0 0 2px var(--accent-glow); }

.bom-table .img-cell {
  width: 44px; height: 44px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-ghost);
  overflow: hidden;
  transition: all var(--duration-fast);
}
.bom-table .img-cell:hover { border-color: var(--accent); color: var(--accent-light); }
.bom-table .img-cell img { width: 100%; height: 100%; object-fit: cover; }

/* ═══ ORDERS TABLE ════════════════════════════════════════════════════════ */

.orders-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.orders-table thead { background: var(--void-elevated); }
.orders-table th {
  padding: 12px 14px;
  color: var(--text-tertiary);
  font-weight: 600;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--glass-border);
}
.orders-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.03); text-align: center; }
.orders-table .color-cell { font-family: var(--font-mono); font-weight: 600; color: var(--accent-light); text-align: left; }
.orders-table input[type="number"] {
  width: 60px; padding: 6px 8px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--void-base);
  color: var(--text-primary);
  outline: none;
}
.orders-table input[type="number"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.orders-table .total-cell { font-family: var(--font-mono); font-weight: 700; color: var(--gold); font-size: 14px; }
.orders-table .date-input {
  width: 130px; padding: 6px 8px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  font-family: var(--font-body);
  font-size: 12px;
  background: var(--void-base);
  color: var(--text-primary);
}

/* ═══ CONSTRUCTION / DETAILS ══════════════════════════════════════════════ */

.construction-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.annotation-area {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--void-base);
  min-height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.detail-group {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.detail-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.sample-item { text-align: center; }
.sample-item label { display: block; font-size: 10px; font-weight: 600; color: var(--text-ghost); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }

/* ═══ COLOR TAGS ══════════════════════════════════════════════════════════ */

.color-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--void-base);
  min-height: 42px;
  cursor: text;
}
.color-tags-container:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.color-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--void-surface);
  color: var(--accent-light);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(124,58,237,0.12);
}
.color-tag .remove { cursor: pointer; font-size: 14px; opacity: 0.5; }
.color-tag .remove:hover { opacity: 1; color: var(--error); }
.color-tag-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  min-width: 80px;
  flex: 1;
  color: var(--text-primary);
}

/* ═══ SAVE BAR ════════════════════════════════════════════════════════════ */

.save-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  z-index: 90;
}
.save-status { font-size: 12px; color: var(--text-ghost); margin-right: auto; }

/* ═══ MODALS ══════════════════════════════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  /* Above .studio-overlay (z-index 2000) so confirmation dialogs
     opened from inside the Studio editor sit IN FRONT of the editor
     instead of behind it (task #88, Rashad 2026-05-30). Still below
     .toast-container (10000) and .lb-picker-overlay (9100). */
  z-index: 2500;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--void-raised);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 500px;
  max-width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
  animation: cardReveal 0.3s var(--ease-out-expo);
}
.modal-header {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-ghost); padding: 4px; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 22px 28px; }
.modal-footer { padding: 16px 28px; border-top: 1px solid var(--glass-border); display: flex; justify-content: flex-end; gap: 8px; }

.template-list { list-style: none; }
.template-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--duration-fast);
  background: var(--void-base);
}
.template-list li:hover { border-color: var(--accent); background: var(--accent-subtle); }
.template-list .tpl-name { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.template-list .tpl-desc { font-size: 11px; color: var(--text-tertiary); }
.template-list .tpl-actions { display: flex; gap: 4px; }

/* ═══ TOASTS ══════════════════════════════════════════════════════════════ */

.toast-container { position: fixed; top: 72px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast-container .toast { pointer-events: auto; }
.toast {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.08);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastSlide 0.35s var(--ease-out-expo);
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(12px);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
@keyframes toastSlide {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══ GENERATION LOG ══════════════════════════════════════════════════════ */

#genLog {
  background: #1a1a2e !important;
  color: #a0e0a0 !important;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.7;
}

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

.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-tertiary); }
.hidden { display: none !important; }

/* ═══ STUDIO PANEL (floating outfit editor) ═════════════════════════════ */

.studio-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.55);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .25s var(--ease-out-expo);
}

.studio-panel {
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 1180px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: cardReveal .4s var(--ease-out-expo);
}
/* With moodboard column the panel needs more width so the canvas isn't cramped.
   Cap at 96vw on smaller displays so it never overflows horizontally. */
.studio-panel.has-moodboard {
  max-width: min(1560px, 97vw);
}

.studio-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 26px 16px;
  border-bottom: 1px solid var(--glass-border);
}
.studio-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.studio-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.studio-close {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.studio-close:hover { background: var(--void-surface); color: var(--text-primary); }

.studio-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
  flex: 1;
}
/* When an outfit has trend provenance, add a moodboard column on the left.
   Wider (360px) so palette swatches and chip clouds don't wrap awkwardly. */
.studio-panel.has-moodboard .studio-body {
  grid-template-columns: 360px 1fr 340px;
}

.studio-image-wrap {
  padding: 22px;
  background: var(--void-deepest);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
  min-height: 0;
}
.studio-image-frame {
  position: relative;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-md);
  max-height: 100%;
}
.studio-image-frame canvas {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 200px);
  border-radius: var(--radius-sm);
}
.studio-pick-dot {
  /* Marquee selection rectangle (replaces the legacy single-point dot
     per user direction 2026-05-14). Box positioned by JS via left/top/
     width/height in CSS pixels; styling is the outline + tinted fill. */
  position: absolute;
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.5), 0 2px 8px rgba(0,0,0,.35);
  pointer-events: none;
  z-index: 5;
  border-radius: 4px;
  transition: none;
}
.studio-pick-dot.drafting {
  border-style: dashed;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,.4); }
  50% { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px rgba(124,58,237,0.2); }
}
.studio-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.studio-eyedropper-icon { font-size: 16px; }

.studio-sidebar {
  background: #ffffff;
  padding: 20px 22px;
  overflow-y: auto;
  border-left: 1px solid var(--glass-border);
}
/* v2 launcher layout: rail + detail in a 2-column flex; no padding (rail is
   flush to the left edge, detail handles its own padding via the launcher css). */
.studio-sidebar.studio-sidebar-v2 {
  display: flex;
  padding: 0;
  background: var(--surface-1, #11111a);
  color: var(--text, #e9e9ef);
  overflow: hidden;
}
.studio-sidebar.studio-sidebar-v2 .tg-rail   { flex: 0 0 auto; } /* rail's own width-css decides */
.studio-sidebar.studio-sidebar-v2 .tg-detail { flex: 1 1 auto; min-width: 0; }

.studio-section { margin-bottom: 22px; }
.studio-section:last-child { margin-bottom: 0; }
.studio-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.studio-palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}
.studio-swatch {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}
.studio-swatch-color {
  height: 44px;
}
.studio-swatch-label {
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #fff;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.studio-picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.studio-picked-swatch {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: repeating-conic-gradient(#e5e5ea 0 25%, #fff 0 50%) 50% / 16px 16px;
}
.studio-picked-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.studio-picked-hex {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.studio-target {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.studio-color-picker-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}
.studio-color-picker-label input[type="color"] {
  width: 40px;
  height: 28px;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}
.studio-picker-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--glass-border);
}
.studio-target-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--glass-border);
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}
.studio-target-chip:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--accent);
}

.studio-apply-btn {
  width: 100%;
  padding: 13px 20px;
  font-size: 13px;
  margin-bottom: 6px;
}
.studio-apply-btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.5);
  cursor: not-allowed;
}
.studio-apply-hint {
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 8px;
}

/* Empty state (no selection yet) */
.studio-empty-state {
  text-align: center;
  padding: 24px 12px;
  background: var(--void-elevated);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius-md);
}
.studio-empty-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.6; }
.studio-empty-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.studio-empty-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* Selection card (when piece selected) */
.studio-selection-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent-subtle), transparent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.studio-selection-swatch {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--glass-border);
  flex-shrink: 0;
}
.studio-selection-info { flex: 1; }
.studio-selection-color {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.studio-selection-hex {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.studio-selection-clear {
  background: none;
  border: none;
  width: 26px;
  height: 26px;
  font-size: 18px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}
.studio-selection-clear:hover { background: var(--void-surface); color: var(--error); }

.studio-divider-section {
  border-top: 1px solid var(--glass-border);
  padding-top: 18px;
  margin-top: 4px;
}

/* ═══ Toolbar (zoom + history) ═════════════════════════════════ */
.studio-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}
.studio-toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 3px 6px;
  box-shadow: var(--shadow-sm);
}
.studio-tool-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.studio-tool-btn:hover:not([disabled]) { background: var(--void-surface); color: var(--text-primary); }
.studio-tool-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.studio-tool-btn.studio-tool-danger:hover:not([disabled]) { background: var(--error-dim); color: var(--error); }
.studio-zoom-label, .studio-hist-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: center;
  padding: 0 4px;
}

/* ═══ Loading overlay on image ════════════════════════════════ */
.studio-image-frame {
  position: relative;
}
.studio-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(3px);
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  gap: 10px;
  animation: fadeIn 0.2s ease-out;
}
.studio-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(124, 58, 237, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.studio-loading-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 6px;
}
.studio-loading-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Button spinner inside Apply button */
.studio-btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}
.studio-apply-btn.is-loading {
  background: var(--void-hover) !important;
  color: var(--text-tertiary) !important;
  filter: grayscale(0.4);
  cursor: wait;
  pointer-events: none;
  box-shadow: none;
}

/* Section title with stage tag */
.studio-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.studio-stage-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--void-surface);
  color: var(--text-tertiary);
  letter-spacing: 0.4px;
  text-transform: none;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.studio-stage-tag.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid rgba(124,58,237,0.2);
}

/* Color chips with active state */
.studio-target-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--glass-border);
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.studio-target-chip:hover {
  transform: scale(1.15);
}
.studio-target-chip.active {
  transform: scale(1.2);
  box-shadow: 0 0 0 2px var(--accent), 0 4px 10px rgba(124,58,237,0.35);
}

/* "Keep" chip */
.studio-chip-keep {
  background: repeating-linear-gradient(
    45deg,
    var(--void-surface),
    var(--void-surface) 4px,
    #fff 4px,
    #fff 8px
  );
}
.studio-chip-keep.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
}
.studio-chip-keep span {
  text-align: center;
  letter-spacing: 0.5px;
}

/* Mobile: stack */
@media (max-width: 900px) {
  .studio-body,
  .studio-panel.has-moodboard .studio-body { grid-template-columns: 1fr; }
  .studio-sidebar { border-left: none; border-top: 1px solid var(--glass-border); }
  .studio-moodboard-column { border-right: none; border-bottom: 1px solid var(--glass-border); max-height: 40vh; }
  .studio-image-wrap canvas { max-height: 60vh; }
}

/* ═══ CONCEPT STUDIO RESULTS ═════════════════════════════════════════════ */

.concept-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.concept-result-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
}
.concept-result-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-accent);
}
.concept-result-image {
  cursor: zoom-in;
  background: var(--void-base);
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.concept-result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.concept-result-meta {
  padding: 10px 12px 6px;
}
.concept-result-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}
.concept-result-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-ghost);
}
/* GI_ reportable id row on a result card. */
.concept-result-id {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.concept-result-id-code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 5px;
  padding: 2px 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}
.concept-result-id-code:hover { color: var(--text-primary); background: rgba(255,255,255,0.09); }
.concept-result-id-report {
  font-size: 10px;
  color: #fca5a5;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.4);
  border-radius: 5px;
  padding: 2px 7px;
  cursor: pointer;
}
.concept-result-id-report:hover { background: rgba(239,68,68,0.16); }
.concept-result-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px 12px;
}

/* ═══ STAGGER ANIMATIONS ═════════════════════════════════════════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pack-grid .pack-card {
  animation: fadeUp 0.4s var(--ease-out-expo) both;
}
.pack-grid .pack-card:nth-child(1) { animation-delay: 0.05s; }
.pack-grid .pack-card:nth-child(2) { animation-delay: 0.1s; }
.pack-grid .pack-card:nth-child(3) { animation-delay: 0.15s; }
.pack-grid .pack-card:nth-child(4) { animation-delay: 0.2s; }
.pack-grid .pack-card:nth-child(5) { animation-delay: 0.25s; }
.pack-grid .pack-card:nth-child(6) { animation-delay: 0.3s; }

.mode-card { animation: fadeUp 0.5s var(--ease-out-expo) both; }
.mode-card:nth-child(2) { animation-delay: 0.12s; }

/* ─── Sources workspace (cooked + simple) ─────────────────────────────── */
.src-card {
  background: var(--void-surface);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.src-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.src-row-main { flex: 1; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.src-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
}
.src-badge-cooking { background: rgba(124,58,237,.15); color: #c4a3ff; }
.src-badge-failed  { background: rgba(239,68,68,.15); color: #fca5a5; }
.src-badge-ready   { background: rgba(16,185,129,.15); color: #6ee7b7; }

.src-cook-progress { margin-top: 10px; }
.src-cook-bar {
  height: 5px; border-radius: 3px; background: rgba(255,255,255,0.05); overflow: hidden;
}
.src-cook-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  transition: width 0.5s ease;
}
.src-cook-msg { margin-top: 6px; }
.src-cook-error {
  margin-top: 10px;
  background: rgba(239,68,68,.08);
  border-left: 3px solid #ef4444;
  padding: 8px 12px;
  border-radius: 4px;
}

.src-expand { border-top: 1px solid var(--glass-border); padding-top: 12px; }

.src-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
.src-img-cell {
  position: relative;
  aspect-ratio: 3/4;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  overflow: hidden;
}
.src-img-cell img { width: 100%; height: 100%; object-fit: cover; }
.src-img-del {
  position: absolute; top: 4px; right: 4px;
  background: rgba(220,38,38,0.88); color: white;
  border: none; border-radius: 4px;
  padding: 2px 6px; font-size: 10px; cursor: pointer;
}

.src-summary {
  display: flex; gap: 18px; padding: 6px 0 12px 0;
  color: var(--text-tertiary); font-size: 12px;
}
.src-macro-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 8px 0 6px 0;
  font-weight: 600;
}
.src-story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.src-story-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.src-story-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124,58,237,0.4);
}
.src-story-thumb {
  aspect-ratio: 4/3;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}
.src-story-thumb img { width: 100%; height: 100%; object-fit: cover; }
.src-story-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text-tertiary); font-size: 11px;
}
.src-story-body { padding: 8px 10px; }
.src-story-body strong { display: block; font-size: 13px; margin-bottom: 3px; }
.src-story-meta { color: var(--text-tertiary); font-size: 10px; }

.src-upload-form {
  padding: 14px;
  margin-bottom: 12px;
  background: rgba(124,58,237,.04);
  border-left: 3px solid #7c3aed;
}

/* Generic chips for story detail modal */
.chip {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}
.chip-green  { background: rgba(16,185,129,.10); color: #6ee7b7; border-color: rgba(16,185,129,.25); }
.chip-purple { background: rgba(124,58,237,.10); color: #c4a3ff; border-color: rgba(124,58,237,.30); }
.chip-red    { background: rgba(239,68,68,.10); color: #fca5a5; border-color: rgba(239,68,68,.25); }

/* ─── Outfit card: story badge + "why this outfit" provenance ────────── */
.concept-story-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  max-width: calc(100% - 16px);
}
.concept-story-macro {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(124,58,237,0.4);
}
.concept-result-image { position: relative; }

.concept-why {
  padding: 0 12px 4px;
  border-top: 1px solid var(--glass-border);
  margin-top: 4px;
}
.concept-why-toggle { padding: 6px 0 !important; }
.concept-why-body {
  padding: 6px 0 10px 0;
  font-size: 11px;
  line-height: 1.5;
}
.why-mood {
  font-style: italic;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-left: 2px solid #7c3aed;
  background: rgba(124,58,237,0.05);
  border-radius: 2px;
  margin-bottom: 8px;
}
.why-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-tertiary);
  margin: 8px 0 4px 0;
}
.why-list { margin: 0 0 6px 18px; padding: 0; }
.why-list li { margin-bottom: 4px; }
.why-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.why-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.why-palette-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.why-palette-chip > div {
  width: 26px; height: 26px; border-radius: 4px;
  border: 1px solid var(--glass-border);
}
.why-palette-chip span { font-size: 9px; max-width: 50px; text-align: center; }
.why-mood-imgs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 4px;
}
.why-mood-imgs img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  border-radius: 3px; border: 1px solid var(--glass-border);
}

/* Premium service badge + sublabel (publisher · season) */
.src-badge-premium {
  background: linear-gradient(90deg, rgba(234,179,8,.15), rgba(245,158,11,.15));
  color: #fcd34d;
  border: 1px solid rgba(234,179,8,.35);
}
.src-sublabel {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ─── Macro trend cards (Concept Studio story picker) ─────────────────── */
.concept-macro-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.macro-card {
  position: relative;
  background: var(--void-surface);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.macro-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124,58,237,0.4);
}
.macro-card.active {
  border-color: #7c3aed;
  box-shadow: 0 0 0 1px #7c3aed inset;
  background: rgba(124,58,237,0.05);
}
.macro-card-thumb {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: rgba(255,255,255,0.03);
}
.macro-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.88;
  transition: opacity 0.2s;
}
.macro-card.active .macro-card-thumb img { opacity: 1; }
.macro-card-thumb-empty {
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(124,58,237,.02));
}
.macro-card-body { padding: 10px 12px; }
.macro-card-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.macro-card-desc {
  font-size: 11px; color: var(--text-secondary);
  line-height: 1.35; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.macro-card-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.macro-card-check {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,0.5); color: #fff;
  backdrop-filter: blur(6px);
  transition: background 0.15s;
}
.macro-card.active .macro-card-check {
  background: #7c3aed; color: #fff;
}

/* ─── Specific-story grid picker ─────────────────────────────────────── */
.story-macro-group {
  margin-bottom: 18px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(0,0,0,.12);
  overflow: hidden;
}
.story-macro-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: rgba(124,58,237,.06);
  border-bottom: 1px solid var(--glass-border);
}
.story-macro-name {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.story-macro-count {
  font-size: 11px;
  color: var(--text-tertiary);
  flex: 1;
}
.story-macro-actions { display: flex; gap: 6px; }

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 12px;
}
.story-card {
  position: relative;
  background: var(--void-surface);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}
.story-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124,58,237,.45);
}
.story-card.active {
  border-color: #7c3aed;
  box-shadow: 0 0 0 1px #7c3aed inset, 0 4px 12px rgba(124,58,237,.2);
}
.story-card-thumb {
  position: relative;
  aspect-ratio: 4/5;
  overflow: hidden;
  background: rgba(255,255,255,.03);
}
.story-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.82;
  transition: opacity 0.2s;
}
.story-card.active .story-card-thumb img { opacity: 1; }
.story-card-thumb-empty {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(124,58,237,.02));
}
.story-card-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,.55); color: #fff;
  backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255,255,255,.25);
  transition: background 0.15s, border-color 0.15s;
}
.story-card.active .story-card-check {
  background: #7c3aed;
  border-color: #fff;
}
.story-kind-badge {
  position: absolute;
  bottom: 6px; left: 6px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  backdrop-filter: blur(4px);
}
.story-card-body { padding: 8px 10px; }
.story-card-title {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-card-meta {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* ─── Brand-voice 3-step pills (None / Medium / High) ───────────────── */
.brand-pills {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--void-surface);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  margin-top: 6px;
}
.brand-pill {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.2s;
}
.brand-pill:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}
.brand-pill.active {
  background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}

/* ─── Studio: story badge in header ──────────────────────────────────── */
.studio-story-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(124,58,237,.06));
  border: 1px solid rgba(124,58,237,.35);
  border-radius: 20px;
  margin-left: auto;
  margin-right: 14px;
}
.studio-story-badge-name {
  font-size: 12px;
  font-weight: 600;
  /* Default (light mode) = dark purple for contrast against the pale
     badge background. Dark-mode override below brings back the pale
     #e4d8ff that reads on a dark backdrop. */
  color: var(--accent-light);
  letter-spacing: .01em;
}
.studio-story-badge-macro {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--accent);
  padding: 2px 7px;
  background: rgba(124,58,237,.18);
  border-radius: 3px;
}
body.tg-theme-dark .studio-story-badge-name { color: #e4d8ff; }
body.tg-theme-dark .studio-story-badge-macro {
  color: #c4a3ff;
  background: rgba(124,58,237,.25);
}

/* ─── Studio mood-board: under the image ─────────────────────────────── */
.studio-moodboard {
  /* Take the full column width so the inner grid/chips breathe */
  width: 100%;
  max-width: 820px;
  align-self: center;
  margin-top: 22px;
  padding: 26px 28px 30px 28px;
  background: linear-gradient(180deg, rgba(124,58,237,.04) 0%, rgba(0,0,0,.15) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  animation: moodboard-fade 0.55s ease-out both;
  box-shadow: 0 6px 28px rgba(0,0,0,.22);
  flex-shrink: 0;  /* don't let flex collapse this when image frame stretches */
}
@keyframes moodboard-fade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.moodboard-header {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
}
.moodboard-eyebrow {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #c4a3ff;
  font-weight: 700;
  margin-bottom: 6px;
}
.moodboard-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.01em;
  background: linear-gradient(90deg, #fff 0%, #d8c6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.moodboard-mood {
  margin: 0 0 18px 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  font-style: italic;
  border-left: 2px solid #7c3aed;
  padding-left: 14px;
}
.moodboard-block {
  margin-bottom: 18px;
  animation: moodboard-block-fade 0.55s ease-out both;
}
.moodboard-block:nth-child(2) { animation-delay: 0.08s; }
.moodboard-block:nth-child(3) { animation-delay: 0.12s; }
.moodboard-block:nth-child(4) { animation-delay: 0.16s; }
.moodboard-block:nth-child(5) { animation-delay: 0.20s; }
.moodboard-block:nth-child(6) { animation-delay: 0.24s; }
.moodboard-block:nth-child(7) { animation-delay: 0.28s; }
@keyframes moodboard-block-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.moodboard-block-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}
.moodboard-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}
.moodboard-swatch { text-align: center; }
.moodboard-swatch-color {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform 0.2s;
}
.moodboard-swatch:hover .moodboard-swatch-color { transform: scale(1.04); }
.moodboard-swatch-name {
  font-size: 11px;
  font-weight: 500;
  margin-top: 6px;
  color: var(--text-primary);
}
.moodboard-swatch-hex {
  font-size: 9px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
.moodboard-strategy {
  margin: 0;
  padding-left: 22px;
  counter-reset: stepcount;
  list-style: none;
}
.moodboard-strategy li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 4px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  counter-increment: stepcount;
}
.moodboard-strategy li::before {
  content: counter(stepcount);
  position: absolute;
  left: -22px;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(124,58,237,.2);
  color: #c4a3ff;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(124,58,237,.35);
}
.moodboard-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.moodboard-chip {
  display: inline-block;
  padding: 5px 12px;
  font-size: 11px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  transition: background 0.15s, transform 0.15s;
}
.moodboard-chip:hover { transform: translateY(-1px); background: rgba(255,255,255,.08); }
.moodboard-chip-green  { background: rgba(16,185,129,.10); color: #6ee7b7; border-color: rgba(16,185,129,.30); }
.moodboard-chip-purple { background: rgba(124,58,237,.10); color: #c4a3ff; border-color: rgba(124,58,237,.35); }
.moodboard-chip-red    { background: rgba(239,68,68,.10); color: #fca5a5; border-color: rgba(239,68,68,.28); }
.moodboard-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.moodboard-imgs img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  cursor: zoom-in;
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
  filter: saturate(0.92);
}
.moodboard-imgs img:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(124,58,237,.3);
  filter: saturate(1.1);
}

.moodboard-lightbox {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
  animation: moodboard-fade 0.2s ease-out both;
  flex-direction: column;
  gap: 12px;
}
.moodboard-lightbox img { max-width: 90vw; max-height: 88vh; border-radius: 8px; }
.moodboard-lightbox-hint { color: rgba(255,255,255,.5); font-size: 11px; }

/* ─── Smooth in-place toggle transitions on the story picker ─────────── */
.story-card, .macro-card { transition: transform 0.14s, border-color 0.14s, background 0.15s, box-shadow 0.18s; }
.story-card-check, .macro-card-check { transition: background 0.15s, border-color 0.15s, color 0.15s; }
.story-macro-group { transition: opacity 0.2s ease; }

/* ═══════════════════════════════════════════════════════════════════════════
   Studio moodboard column — dark-surface, compact, side-by-side with image
   ═══════════════════════════════════════════════════════════════════════════ */
.studio-moodboard-column {
  background: #141420;
  color: #e8e8f0;
  border-right: 1px solid rgba(255,255,255,0.08);
  padding: 18px 18px 22px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* The inner .studio-moodboard lives in the column and owns no extra chrome now */
.studio-moodboard-column .studio-moodboard {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  margin: 0;
  max-width: none;
  width: auto;
  animation: moodboard-fade 0.45s ease-out both;
}

/* Header */
.mb-header {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mb-eyebrow {
  display: inline-block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #c4a3ff;
  font-weight: 700;
  margin-bottom: 4px;
}
.mb-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  background: linear-gradient(90deg, #fff 0%, #d8c6ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Mood sentence */
.mb-mood {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: #b8b8c8;
  font-style: italic;
  padding: 8px 12px;
  background: rgba(124,58,237,.08);
  border-left: 2px solid #7c3aed;
  border-radius: 0 4px 4px 0;
}

/* Section wrapper + title */
.mb-section { animation: mb-fade 0.4s ease-out both; }
.mb-section:nth-child(3)  { animation-delay: 0.05s; }
.mb-section:nth-child(4)  { animation-delay: 0.10s; }
.mb-section:nth-child(5)  { animation-delay: 0.14s; }
.mb-section:nth-child(6)  { animation-delay: 0.18s; }
.mb-section:nth-child(7)  { animation-delay: 0.22s; }
.mb-section:nth-child(8)  { animation-delay: 0.26s; }
.mb-section:nth-child(9)  { animation-delay: 0.30s; }
@keyframes mb-fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.mb-section-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  color: #8a8aa0;
  margin-bottom: 8px;
}

/* Palette grid — tight, 5-per-row */
.mb-palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.mb-swatch {
  text-align: center;
}
.mb-swatch-color {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transition: transform 0.18s;
  cursor: help;
}
.mb-swatch:hover .mb-swatch-color { transform: scale(1.08); }
.mb-swatch-name {
  font-size: 9px;
  color: #d0d0dc;
  margin-top: 3px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Strategy — numbered compact list */
.mb-strategy {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: mbstep;
}
.mb-strategy li {
  counter-increment: mbstep;
  position: relative;
  padding-left: 22px;
  margin-bottom: 7px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #c8c8d8;
}
.mb-strategy li::before {
  content: counter(mbstep);
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(124,58,237,.22);
  color: #c4a3ff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(124,58,237,.35);
}

/* Chip clouds — properly contrasted for dark bg */
.mb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.mb-chip {
  display: inline-block;
  padding: 4px 10px;
  font-size: 10.5px;
  border-radius: 11px;
  background: rgba(255,255,255,0.07);
  color: #e5e5f0;
  border: 1px solid rgba(255,255,255,0.13);
  transition: background 0.15s, transform 0.15s;
}
.mb-chip:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.mb-chip-neutral { /* default above */ }
.mb-chip-green {
  background: rgba(16,185,129,.18);
  color: #a7f3d0;
  border-color: rgba(16,185,129,.40);
}
.mb-chip-green:hover { background: rgba(16,185,129,.28); }
.mb-chip-purple {
  background: rgba(124,58,237,.22);
  color: #d8c2ff;
  border-color: rgba(124,58,237,.45);
}
.mb-chip-purple:hover { background: rgba(124,58,237,.32); }
.mb-chip-red {
  background: rgba(239,68,68,.18);
  color: #fca5a5;
  border-color: rgba(239,68,68,.40);
}
.mb-chip-red:hover { background: rgba(239,68,68,.28); }

/* ── Signal "why this outfit" panel — atelier recipe card ──────────────────
   Editorial fashion treatment: serif italic display for the signal name +
   garment titles, JetBrains-Mono spec labels (couture/technical feel), numbered
   garment cards with an accent left-rule. Replaces the old flat label:value
   spec-sheet. Lives in .studio-moodboard-column. Dark default here; light
   overrides grouped with the other body:not(.tg-theme-dark) rules below. */
.sig-recipe {
  --sig-accent: #c4a3ff;
  --sig-ink: #ece9f5;
  --sig-muted: #8f8aa6;
  --sig-rule: rgba(255,255,255,0.09);
  --sig-cell: #15131f;
  --sig-serif: 'Hoefler Text', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* Hero */
.sig-hero { padding-bottom: 16px; border-bottom: 1px solid var(--sig-rule); }
.sig-eyebrow {
  display: block;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--sig-accent); margin-bottom: 9px;
}
.sig-name {
  margin: 0;
  font-family: var(--sig-serif); font-style: italic; font-weight: 600;
  font-size: 27px; line-height: 1.05; letter-spacing: -.01em; color: var(--sig-ink);
}
.sig-hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sig-pill { font-size: 10.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.sig-pill-theme { background: rgba(124,58,237,.20); color: #d8c2ff; border: 1px solid rgba(124,58,237,.42); }
.sig-pill-gender {
  background: rgba(255,255,255,0.06); color: var(--sig-muted); border: 1px solid var(--sig-rule);
  text-transform: uppercase; letter-spacing: .12em; font-size: 9px; padding: 5px 10px; font-weight: 700;
}
/* Optional palette swatch strip */
.sig-palette {
  display: flex; gap: 0; margin-top: 13px; height: 18px;
  border-radius: 6px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.sig-sw { flex: 1; min-width: 0; }
/* Section label (The Brief / The Recipe) */
.sig-sec-label {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--sig-muted); margin-bottom: 10px;
}
/* The Brief — dial spec grid (hairline-separated cells) */
.sig-dial-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--sig-rule); border: 1px solid var(--sig-rule);
  border-radius: 8px; overflow: hidden;
}
.sig-dial { display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; background: var(--sig-cell); }
.sig-dial-k {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 8px; letter-spacing: .14em; text-transform: uppercase; color: var(--sig-muted);
}
.sig-dial-v { font-size: 12.5px; font-weight: 600; color: var(--sig-ink); }
/* The Recipe — per-garment cards */
.sig-recipe-list { display: flex; flex-direction: column; gap: 10px; }
.sig-card {
  position: relative; padding: 13px 14px 13px 16px;
  background: rgba(255,255,255,0.025); border: 1px solid var(--sig-rule);
  border-left: 2px solid var(--sig-accent); border-radius: 8px;
  animation: sig-rise .4s ease-out both;
}
.sig-recipe-list .sig-card:nth-child(3) { animation-delay: .05s; }
.sig-recipe-list .sig-card:nth-child(4) { animation-delay: .10s; }
.sig-recipe-list .sig-card:nth-child(5) { animation-delay: .15s; }
@keyframes sig-rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.sig-card-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 10px; }
.sig-card-num {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700; color: var(--sig-accent); letter-spacing: .05em;
}
.sig-card-title {
  margin: 0; font-family: var(--sig-serif); font-style: italic; font-weight: 600;
  font-size: 16px; line-height: 1.1; color: var(--sig-ink);
}
.sig-spec { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.sig-spec-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: baseline; }
.sig-spec-k {
  margin: 0; font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--sig-muted); padding-top: 1px;
}
.sig-spec-v { margin: 0; font-size: 12px; line-height: 1.45; color: #d6d2e4; }
/* "What this choice means" line under a signal SELECTION (theme/dial) in the
   Concept Studio wizard — populated from Stone's /api/signals description field. */
.sig-sel-desc { margin-top: 4px; font-size: 11px; line-height: 1.4; font-style: italic; color: rgba(233,233,239,0.5); }

/* Mood images strip — 3 thumbs */
.mb-imgs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.mb-imgs img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: zoom-in;
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
  filter: saturate(0.9);
}
.mb-imgs img:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 5px 16px rgba(124,58,237,.45);
  filter: saturate(1.1);
}

/* ─── Outfit card: hydration loading state ───────────────────────────── */
.concept-result-loading {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(124,58,237,.08), rgba(0,0,0,.3));
  color: var(--text-tertiary);
}
.concept-result-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.concept-result-loading-label { font-size: 11px; letter-spacing: .05em; }

/* ─── Outfit card: in-flight generation placeholder ──────────────────────
   Shown for ~5–20s while Gemini is rendering. Three layers:
   1. concept-result-pending card (subtle pulsing border via animation)
   2. concept-result-shimmer  (sweeping gradient highlight)
   3. concept-result-pending-label (spinner + "Generating…" text)
   The label sits on top via z-index so the shimmer reads as background. */
.concept-result-pending {
  position: relative;
  animation: cardPulseBorder 1.8s ease-in-out infinite;
}
.concept-result-pending .concept-result-image {
  position: relative;
  overflow: hidden;
  cursor: default;
  background: linear-gradient(135deg, rgba(124,58,237,.10), rgba(236,72,153,.06) 50%, rgba(0,0,0,.35));
  aspect-ratio: 3/4;
  display: block;
}
.concept-result-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 0%,
    transparent 35%,
    rgba(255,255,255,0.10) 50%,
    transparent 65%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: shimmerSweep 1.6s linear infinite;
  pointer-events: none;
}
.concept-result-pending-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  pointer-events: none;
}
.concept-result-pending .concept-result-spinner {
  width: 36px; height: 36px;
  border-color: rgba(255,255,255,0.10);
  border-top-color: var(--accent, #7c3aed);
}
@keyframes shimmerSweep {
  0%   { background-position: 220% 0; }
  100% { background-position: -120% 0; }
}
@keyframes cardPulseBorder {
  0%, 100% { border-color: rgba(124,58,237,0.25); box-shadow: 0 0 0 0 rgba(124,58,237,0.0); }
  50%      { border-color: rgba(124,58,237,0.55); box-shadow: 0 0 0 4px rgba(124,58,237,0.10); }
}

/* ─── Outfit card: failed-generation placeholder ───────────────────────── */
.concept-result-failed {
  border-color: rgba(239,68,68,0.35) !important;
}
.concept-result-failed .concept-result-image {
  cursor: default;
  background: linear-gradient(135deg, rgba(239,68,68,.08), rgba(0,0,0,.35));
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.concept-result-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: #ef4444;
}
.concept-result-error-label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 600;
}
.concept-result-error-msg {
  font-size: 10px;
  margin-top: 6px;
  color: rgba(255,255,255,0.55);
  max-width: 80%;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONCEPT WIZARD — Stripe-style step rail + content + right panel
   Used by tabs-html.js concept() template.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reserve 320px on the right of the concept page for the fixed wiz-right panel. */
.concept-wizard { padding: 0 320px 0 0; margin-top: -8px; }
.wiz-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 1fr;
  gap: 0;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  min-height: calc(100vh - var(--topbar-h) - 48px);
}
/* Trailing full-width sections (Generated Outfits, Log) span both columns */
.wiz-grid > .section-card { grid-column: 1 / -1; }

/* Step rail (left) — stretches to row height so its background fills the column */
.wiz-rail {
  position: relative;
  padding: 28px 20px;
  border-right: 1px solid var(--glass-border);
  background: var(--void-elevated);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wiz-rail-line {
  position: absolute;
  left: 43px;
  top: 52px;
  bottom: 28px;
  width: 2px;
  background: var(--glass-border);
  z-index: 0;
}
.wiz-rail-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.wiz-rail-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--void-base);
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  flex: 0 0 24px;
  z-index: 1;
}
.wiz-rail-step.done .wiz-rail-dot {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.wiz-rail-step.done .wiz-rail-dot span { display: none; }
.wiz-rail-step.done .wiz-rail-dot::after { content: '✓'; }
.wiz-rail-step.active .wiz-rail-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.wiz-rail-meta { padding-top: 2px; display: flex; flex-direction: column; gap: 2px; }
.wiz-rail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
}
.wiz-rail-step.active .wiz-rail-label,
.wiz-rail-step.done .wiz-rail-label { color: var(--text-secondary); }
.wiz-rail-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.wiz-rail-step:not(.active):not(.done) .wiz-rail-name {
  color: var(--text-tertiary);
  font-weight: 500;
}
.wiz-rail-step:hover .wiz-rail-name { color: var(--text-primary); }

/* Step content (single-step focus) */
.wiz-content {
  padding: 32px 40px 48px;
  overflow-y: auto;
  background: var(--void-base);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.wiz-step { display: none; max-width: 1100px; width: 100%; }
.wiz-step.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.wiz-step.active > .wiz-actions:last-child { margin-top: auto; }

.wiz-crumb {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
}
.wiz-h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 6px;
}
.wiz-lede {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 28px;
}

.wiz-mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 12px;
}
.wiz-mode-card {
  position: relative;
  text-align: left;
  padding: 28px 28px 26px;
  border: 2px solid var(--glass-border);
  border-radius: 14px;
  background: var(--void-base);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, border-color .15s ease,
              box-shadow .15s ease, background .15s ease;
}
.wiz-mode-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -10px rgba(0,0,0,.18);
}
.wiz-mode-card.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.wiz-mode-card.selected .wiz-mode-icon { color: var(--accent); }
.wiz-mode-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wiz-mode-icon svg { width: 100%; height: 100%; }
.wiz-mode-card:hover .wiz-mode-icon { color: var(--accent); }
.wiz-mode-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.wiz-mode-subhead {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.4;
}
.wiz-mode-text {
  font-size: 13px;
  color: var(--text-tertiary);
  line-height: 1.55;
}

/* Step 3 brand-models folder selector — promoted to its own header
   row above the model strip so users actually notice the picker. */
.wiz-models-folder-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--accent-subtle);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 12px;
  margin: 4px 0 10px;
  flex-wrap: wrap;
}
.wiz-models-folder-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex: 0 0 auto;
}
.wiz-models-folder-select {
  flex: 1 1 220px;
  min-width: 180px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--void-base);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}
.wiz-models-folder-select:hover { border-color: var(--accent); }
.wiz-models-folder-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.wiz-models-folder-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
.wiz-models-folder-link:hover { text-decoration: underline; }

.wiz-subpanel { margin-top: 8px; }
.wiz-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  margin: 14px 0 6px;
  font-weight: 600;
}
.wiz-help {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 10px;
  line-height: 1.5;
}

.wiz-actions {
  display: flex;
  gap: 10px;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
  align-items: center;
}
.wiz-actions-spacer { flex: 1; }

/* Reference sketch tool — standalone card under the wizard */
.wiz-tool-card {
  margin-top: 32px;
  padding: 20px;
  border: 1px dashed var(--glass-border);
  border-radius: 10px;
  background: var(--void-elevated);
}
.wiz-tool-head { margin-bottom: 14px; }
.wiz-tool-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.wiz-tool-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Right panel — fixed to the viewport like the workspace sidebar so the user
   can hit "Generate Outfits" at any scroll position. Out-of-flow; the 320px
   right padding on .concept-wizard reserves room for it. */
.wiz-right {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--void-elevated);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 90;
}
.wiz-right-top {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--glass-border);
}
.wiz-right-top label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 6px;
}
.wiz-name-input {
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  background: transparent;
  color: var(--text-primary);
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 4px 0;
  outline: none;
  font-family: inherit;
}
.wiz-name-input:hover, .wiz-name-input:focus {
  border-bottom-color: var(--glass-border);
}
.wiz-desc-input {
  width: 100%;
  margin-top: 8px;
  font-size: 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 0;
  padding: 4px 0;
  resize: none;
  font-family: inherit;
  outline: none;
}
.wiz-save-pill {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

.wiz-right-summary {
  padding: 18px 22px;
  flex: 1;
  overflow-y: auto;
}
.wiz-summary-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.wiz-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 12px;
}
.wiz-summary-row:last-child { border-bottom: 0; }
.wiz-summary-row .k { color: var(--text-tertiary); }
.wiz-summary-row .v { color: var(--text-primary); font-weight: 500; }
.wiz-summary-row .v.placeholder { color: var(--text-tertiary); font-style: italic; font-weight: 400; }

.wiz-right-bottom {
  padding: 18px 22px 22px;
  border-top: 1px solid var(--glass-border);
}
.wiz-count-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wiz-count-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-tertiary);
  flex: 1;
}
.wiz-count-input {
  width: 70px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  background: var(--void-base);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  font-family: inherit;
}
.wiz-gen-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.wiz-gen-btn:hover { background: var(--accent-light); }
.wiz-gen-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME TOGGLE (sidebar bottom)
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar-foot {
  width: 100%;
  padding: 10px 10px 4px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.theme-toggle-compact {
  width: 44px;
  height: 28px;
  padding: 0;
  justify-content: center;
}
.theme-toggle:hover { background: var(--void-elevated); color: var(--text-primary); }
.theme-toggle-track {
  width: 32px; height: 16px;
  background: var(--void-surface);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
  flex: 0 0 32px;
}
.theme-toggle-knob {
  position: absolute;
  top: 1px; left: 1px;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.theme-toggle.is-dark .theme-toggle-track { background: var(--accent-glow); }
.theme-toggle.is-dark .theme-toggle-knob { transform: translateX(16px); }
.theme-toggle-label { font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME OVERRIDES — applied when <body> has class tg-theme-dark
   Inverts the surface palette, keeps the accent purple intact.
   ═══════════════════════════════════════════════════════════════════════════ */
body.tg-theme-dark {
  --void-deepest: #0a0a12;
  --void-deep: #0f0f17;
  --void-base: #15151f;
  --void-raised: #1a1a26;
  --void-elevated: #1c1c28;
  --void-surface: #2a2a38;
  --void-hover: #34344a;

  --text-primary: #e9e9ef;
  --text-secondary: #b8b8c8;
  --text-tertiary: rgba(233,233,239,0.55);
  --text-ghost: rgba(233,233,239,0.35);

  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.08);
  --glass-border-strong: rgba(255,255,255,0.12);
  /* Without this override the .pack-card::before / .pack-card-new::before
     glass-sheen gradients paint a 60% white overlay on top of the dark
     card → the whole card looks medium-grey. Drop the sheen to a near-
     invisible value in dark mode. */
  --glass-shine: rgba(255,255,255,0.02);

  --accent-glow: rgba(124, 58, 237, 0.22);

  background: var(--void-deepest);
  color: var(--text-primary);
}
body.tg-theme-dark .topbar,
body.tg-theme-dark .sidebar,
body.tg-theme-dark .main-content {
  background: var(--void-deep);
  color: var(--text-primary);
}
body.tg-theme-dark .section-card,
body.tg-theme-dark .wiz-grid,
body.tg-theme-dark .wiz-right,
body.tg-theme-dark .wiz-content {
  background: var(--void-base);
  color: var(--text-primary);
}
body.tg-theme-dark .form-input,
body.tg-theme-dark input[type="text"],
body.tg-theme-dark input[type="number"],
body.tg-theme-dark textarea,
body.tg-theme-dark select {
  background: var(--void-raised);
  color: var(--text-primary);
  border-color: var(--glass-border);
}
body.tg-theme-dark .btn-secondary {
  background: var(--void-raised);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

/* ═══ TECH PACK WIZARD BAR ════════════════════════════════════════════════
   Floating bar pinned just below the topbar when the user enters the Tech
   Pack wizard via the rail icon. Hosts the 6-step rail + back/next controls.
   body.tg-techpack-wizard adds top padding so content does not slide under
   the bar. */
.techpack-wizard-bar {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w);
  right: 0;
  z-index: 95;
  background: var(--void-base);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 6px 24px -8px rgba(0,0,0,0.18);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
body.tg-techpack-wizard .main-content { padding-top: 96px; }

.tpw-exit {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-tertiary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.tpw-exit:hover { color: var(--text-primary); border-color: var(--accent); }

.tpw-rail {
  flex: 1 1 auto;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tpw-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast), color var(--duration-fast),
              border-color var(--duration-fast);
}
.tpw-step:hover { color: var(--text-primary); border-color: var(--accent); }
.tpw-step.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.tpw-step.done { color: var(--text-secondary); }
.tpw-step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--void-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.tpw-step.active .tpw-step-dot { background: var(--accent); color: #fff; }
.tpw-step.done .tpw-step-dot { background: #10b981; color: #fff; }

.tpw-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tpw-save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  min-width: 90px;
  white-space: nowrap;
  transition: opacity 0.28s ease;
}
.tpw-save-status.idle { opacity: 0; }
.tpw-save-status.saving { color: var(--text-secondary); opacity: 1; }
.tpw-save-status.saved { color: #10b981; opacity: 1; }
.tpw-save-status.error { color: #ef4444; opacity: 1; }
.tpw-save-icon { font-size: 14px; line-height: 1; }
.tpw-save-retry {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-left: 2px;
}
.tpw-save-retry:hover { opacity: 0.75; }

/* ═══ TECH PACK HOME + PATTERN PICKER ════════════════════════════════════
   Full-page views (sibling to dashboardView / editorView). techpackHomeView
   lists every TechPack the caller owns + a "+ New" tile.
   techpackPickerView is the pattern picker that the New tile opens. */
.tp-home, .tp-pick {
  padding: 32px 40px 64px;
  max-width: 1280px;
  margin: 0 auto;
}
.tp-home-head, .tp-pick-head {
  margin-bottom: 22px;
}
.tp-home-head h1, .tp-pick-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
}
.tp-pick-head .btn { margin-bottom: 10px; }

.tp-home-grid, .tp-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.tp-home-card, .tp-pick-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
  text-align: left;
  color: inherit;
}
.tp-home-card:hover, .tp-pick-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.tp-home-card-img, .tp-pick-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tp-home-card-img img, .tp-pick-card-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tp-home-card-meta, .tp-pick-card-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}
.tp-home-card-name, .tp-pick-card-name {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-home-card-sub { font-size: 11px; }
.tp-home-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.18);
  color: #a78bfa;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

/* "+ New Tech Pack" + "Upload your own pattern" tiles */
.tp-home-new, .tp-pick-upload {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  background: transparent;
}
.tp-home-new-plus, .tp-pick-upload-plus {
  font-size: 38px;
  font-weight: 200;
  color: var(--accent);
  line-height: 1;
}
.tp-home-new-label, .tp-pick-upload-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}
.tp-pick-upload-sub { text-align: center; max-width: 200px; }

.tp-home-empty, .tp-pick-empty {
  grid-column: 1 / -1;
  padding: 30px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Upload-tile status states — driven by Techpack._setUploadStatus so
   the user always has visible feedback during an upload (no silent
   waits). */
.tp-pick-upload.busy { border-color: var(--accent); }
.tp-pick-upload.ok   { border-color: #10b981; }
.tp-pick-upload.error { border-color: #ef4444; }
.tp-pick-upload.busy .tp-pick-upload-plus { opacity: 0.35; }
.tp-pick-upload.ok   .tp-pick-upload-plus,
.tp-pick-upload.error .tp-pick-upload-plus { display: none; }
.tp-pick-upload.ok   .tp-pick-upload-label { color: #10b981; }
.tp-pick-upload.error .tp-pick-upload-label { color: #ef4444; }
.tp-spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tp-spin-rot 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes tp-spin-rot { to { transform: rotate(360deg); } }

/* ═══ TECH PACK v2 PAGES ═════════════════════════════════════════════════
   Shared shell for the new 7-page wizard (Cover / Info / Photoshoot /
   Colors / Fabrics / Trims / Care). Light surface on purpose — mirrors
   the printable PDF surface and the screenshots the user provided. */
.tp-page {
  background: #fff;
  color: #111;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 32px 40px;
  max-width: 1080px;
  margin: 0 auto 24px;
  min-height: 520px;
}
.tp-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5e5ea;
  margin-bottom: 28px;
}
.tp-page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  color: #111;
}
.tp-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f5f5f7;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  font-size: 12px;
  color: #444;
}
.tp-header-badge img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Cover */
.tp-page-cover { text-align: center; }
.tp-cover-title {
  margin: 0 0 32px;
  font-size: 28px;
  font-weight: 700;
  color: #111;
  outline: none;
  padding: 4px 12px;
  border-radius: 6px;
}
.tp-cover-title:focus { background: #f5f5f7; }
.tp-cover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}
.tp-cover-slot { display: flex; flex-direction: column; gap: 6px; }
.tp-cover-img,
.tp-cover-slot .tp-image-slot {
  aspect-ratio: 3 / 4;
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.tp-cover-img img { width: 100%; height: 100%; object-fit: contain; }
.tp-cover-caption { font-size: 12px; color: #555; }
.tp-cover-hint { color: #888 !important; margin-top: 16px; }

/* Info */
.tp-info-table { width: 100%; border-collapse: collapse; background: #fff; }
.tp-info-table tr { border-bottom: 1px solid #e5e5ea; }
.tp-info-table td { padding: 12px 14px; font-size: 13px; vertical-align: middle; }
.tp-info-label { width: 28%; font-weight: 500; color: #333; }
.tp-info-input {
  width: 100%;
  background: transparent;
  border: 0;
  font-size: 13px;
  color: #111;
  font-family: inherit;
  padding: 4px 0;
  outline: none;
}
.tp-info-input:focus { background: #f5f5f7; padding: 4px 8px; border-radius: 4px; }
.tp-info-logo-cell .tp-image-slot { width: 120px; height: 80px; min-height: 80px; }

/* Photoshoot */
.tp-photoshoot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.tp-photo-col { display: flex; flex-direction: column; }
.tp-photo-head {
  text-align: center;
  padding: 10px 0;
  border-bottom: 1px solid #e5e5ea;
  font-weight: 500;
  font-size: 13px;
  color: #444;
  margin-bottom: 10px;
}
.tp-photoshoot-grid .tp-image-slot {
  aspect-ratio: 3 / 4;
  background: #fff;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
}

/* Image slot — drop-zone tile used by every v2 page that takes an
   image. Click anywhere on the tile to open the file picker. */
.tp-image-slot {
  position: relative;
  background: #fafafa;
  border: 1px dashed #ccc;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}
.tp-image-slot.has-img { border-style: solid; border-color: #d0d0d6; }
.tp-image-slot img { width: 100%; height: 100%; object-fit: contain; }
.tp-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #999;
  font-size: 12px;
  text-align: center;
}
.tp-image-placeholder-plus {
  font-size: 28px;
  font-weight: 200;
  color: #bbb;
  line-height: 1;
}
.tp-image-slot-click { position: absolute; inset: 0; cursor: pointer; }
.tp-image-slot.uploading { border-color: var(--accent); }
.tp-image-slot.uploading::after {
  content: 'Uploading…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  font-size: 12px;
  color: var(--accent);
  pointer-events: none;
}
.tp-image-slot.error { border-color: #ef4444; }

/* Subsection card — used by Colors page to group "Main Colors". */
.tp-subsection-card {
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.tp-subsection-head {
  text-align: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5ea;
  font-size: 13px;
  font-weight: 500;
  color: #444;
}

/* Add-anything tile (+) — Add Color / Add Fabric / Add Trim. */
.tp-add-tile {
  background: transparent;
  border: 1px dashed #c0c0c5;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px;
  color: #888;
  font-size: 12px;
  min-height: 100px;
}
.tp-add-tile:hover { border-color: var(--accent); color: var(--accent); }
.tp-add-tile-label { font-weight: 500; }
.tp-add-card { min-height: 320px; }

/* AI auto-fill buttons (v3 — "Generate from photo" affordances). */
.tp-ai-btn {
  appearance: none;
  background: linear-gradient(135deg, #6f6cff 0%, #b16cff 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  margin-top: 8px;
  margin-right: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 120ms ease, transform 80ms ease;
}
.tp-ai-btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.tp-ai-btn-ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tp-ai-btn:hover { filter: brightness(1.07); }
.tp-ai-btn:active { transform: translateY(1px); }
.tp-ai-btn:disabled { opacity: .55; cursor: progress; }
.tp-ai-btn-head {
  margin-top: 0;
  margin-left: auto;
  align-self: center;
}
.tp-card-actions { padding: 0 16px 12px; }

/* Colors */
.tp-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 18px;
  padding: 22px;
}
.tp-color-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tp-color-swatch-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid #d0d0d6;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.tp-color-swatch-wrap input[type=color] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}
.tp-color-label {
  width: 100%;
  background: transparent;
  border: 0;
  font-size: 12px;
  color: #333;
  padding: 4px 0;
  text-align: left;
  font-family: inherit;
  outline: none;
}
.tp-color-label:focus { background: #f5f5f7; padding: 4px 6px; border-radius: 4px; }
.tp-color-hex { font-size: 10px; color: #888; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tp-color-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: 0;
  background: rgba(255,255,255,0.85);
  color: #666;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: none;
}
.tp-color-tile:hover .tp-color-del { display: inline-flex; align-items: center; justify-content: center; }
.tp-color-del:hover { color: #ef4444; }

/* Cards (Fabrics + Trims) */
.tp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.tp-card {
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tp-card-head {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e5ea;
}
.tp-card-title {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 500;
  color: #111;
  outline: none;
}
.tp-card-title:focus { background: #f5f5f7; padding: 2px 6px; border-radius: 4px; }
.tp-card-del {
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #999;
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
}
.tp-card-del:hover { background: #fef2f2; color: #ef4444; }
.tp-card-photo {
  aspect-ratio: 3 / 2;
  background: #fff;
  border-bottom: 1px solid #e5e5ea;
  overflow: hidden;
}
.tp-card-photo .tp-image-slot {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #fafafa;
  min-height: 0;
}
.tp-card-props {
  padding: 8px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tp-card-prop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dotted #ececef;
}
.tp-card-prop:last-child { border-bottom: 0; }
.tp-card-prop-label { color: #666; font-size: 11px; flex: 0 0 100px; }
.tp-card-prop input {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  text-align: right;
  font-size: 12px;
  color: #111;
  font-family: inherit;
  padding: 2px 0;
  outline: none;
  min-width: 0;
}
.tp-card-prop input:focus { background: #f5f5f7; padding: 2px 6px; border-radius: 4px; }
.tp-card-color-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tp-card-color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid #d0d0d6;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.tp-card-color-swatch input[type=color] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}
.tp-card-hex {
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #555;
}

/* Care Instructions — 5 columns of icon + label. Driven by
   Techpack._careOptions catalog. */
.tp-care-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  overflow: hidden;
}
.tp-care-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid #e5e5ea;
  background: #fff;
}
.tp-care-col:last-child { border-right: 0; }
.tp-care-col-head {
  width: 100%;
  text-align: center;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  border-bottom: 1px solid #e5e5ea;
}
.tp-care-col-body {
  width: 100%;
  padding: 28px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #111;
}
.tp-care-col-body:hover { background: #fafafa; }
.tp-care-svg {
  width: 72px;
  height: 72px;
}
.tp-care-col-label {
  width: 100%;
  text-align: center;
  padding: 10px 8px 16px;
  border-top: 1px solid #e5e5ea;
  font-size: 12px;
  color: #444;
  min-height: 36px;
}

/* Popover picker — appears over the column body */
.tp-care-popover {
  position: absolute;
  z-index: 200;
  background: #fff;
  border: 1px solid #d0d0d6;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.tp-care-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  color: #111;
}
.tp-care-popover-item:hover { background: #f5f5f7; }
.tp-care-popover-icon { display: inline-flex; align-items: center; }
.tp-care-popover-icon .tp-care-svg { width: 28px; height: 28px; }
.tp-care-popover-label { flex: 1 1 auto; }

/* Dark-theme override: these pages stay light so they mirror the
   printable PDF surface. Without this rule body.tg-theme-dark
   inverts the text. */
body.tg-theme-dark .tp-page,
body.tg-theme-dark .tp-page * { color: #111; }
body.tg-theme-dark .tp-page .text-muted,
body.tg-theme-dark .tp-cover-hint { color: #888 !important; }
body.tg-theme-dark .tp-page .tp-card-prop-label { color: #666; }
body.tg-theme-dark .tp-page .tp-card-hex,
body.tg-theme-dark .tp-page .tp-color-hex { color: #888; }
body.tg-theme-dark .tp-page .tp-card-prop input,
body.tg-theme-dark .tp-page .tp-info-input,
body.tg-theme-dark .tp-page .tp-card-title,
body.tg-theme-dark .tp-page .tp-color-label { color: #111; }

/* Tech Pack wizard Step 0 picker (Library 2D-Art) — DEPRECATED modal flow.
   Replaced by techpackPickerView (full-page). Kept for any direct callers. */
.tpw-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.tpw-pick-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.tpw-pick-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tpw-pick-tile img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}
.tpw-pick-name {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.tpw-position {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

/* ═══ SECTION LANDINGS ═════════════════════════════════════════════════════
   Rendered into #landingView by Sections.show(name). Sub-items become big
   cards with icon + title + description. Click navigates to the matching
   tab via Sections._openCard. */
.landing-view {
  max-width: 1480px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}
.landing-view.hidden { display: none; }
.landing-head { margin-bottom: 28px; }
.landing-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}
.landing-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.landing-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 24px 22px 22px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--void-base);
  cursor: pointer;
  font-family: inherit;
  transition: transform .15s ease, border-color .15s ease,
              box-shadow .15s ease, background .15s ease;
}
.landing-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -10px rgba(0,0,0,.18);
}
.landing-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.landing-card-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 14px;
}
.landing-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.landing-card-desc {
  font-size: 12.5px;
  color: var(--text-tertiary);
  line-height: 1.55;
}

/* Image-on-top variant — used by the Tools landing today. Cards are
   wider (landing-grid-img bumps the min-track size) and the AI-generated
   banner fills the full card width. */
.landing-grid-img {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 26px;
}

/* ── Team Credits table (Account › Team) ─────────────────────────── */
.team-credits-list { display: block; }
.team-credits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.team-credits-table th,
.team-credits-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--glass-border);
  text-align: left;
  vertical-align: middle;
}
.team-credits-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.team-credits-table .tc-name { font-weight: 600; }
.team-credits-table .tc-email { font-size: 11px; color: var(--text-tertiary); }
.team-credits-table .tc-balance { font-variant-numeric: tabular-nums; font-weight: 600; }
/* RU3/RU5: the standalone role badge column was dropped; chips own the
   role display. The single remaining "Owner" pill sits next to the
   member name and signals the locked-owner status only. */
.team-credits-table .tc-owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--void-base);
  border: 1px solid var(--accent);
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Project share dialog table — mirrors team-credits styling. */
.ps-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ps-table th, .ps-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--glass-border);
  text-align: left; vertical-align: middle;
}
.ps-table th {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.ps-table select { padding: 4px 8px; font-size: 12px; }

/* Account activity feed. */
.aa-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.aa-chip {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.aa-chip:hover { border-color: var(--accent); }
.aa-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.aa-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.aa-table th, .aa-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--glass-border);
  text-align: left;
  vertical-align: middle;
}
.aa-table th {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.aa-kind {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; margin-right: 4px;
  background: var(--void-base); color: var(--text-tertiary);
  border: 1px solid var(--glass-border);
  text-transform: uppercase;
}
.aa-kind-gen { color: #2563eb; border-color: #2563eb; }
.aa-kind-tx { color: var(--accent); border-color: var(--accent); }
.aa-cost { font-variant-numeric: tabular-nums; font-weight: 600; }
.aa-cost-debit { color: #dc2626; }
.aa-cost-credit { color: #16a34a; }

/* ── Quick-tools panels (six standalone Fermat-style tools) ──────────── */
.qt-page {
  /* Width cap raised from 980px → near-viewport so the two-column
     layout (135acbd) doesn't dead-end in centered margins on wide
     monitors. min(1920px, 98vw) keeps a 1% gutter on each side for
     ultra-wide displays. */
  max-width: min(1920px, 98vw);
  margin: 0 auto;
  padding: 28px 24px 40px;
}
.qt-head {
  margin: 0 0 24px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
}
.qt-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 8px 10px;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
}
.qt-back:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.qt-back svg { color: currentColor; }
.qt-head-text { flex: 1; min-width: 0; }
.qt-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.qt-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
}
.qt-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}
.qt-grid.one { grid-template-columns: 1fr; }
.qt-grid.two { grid-template-columns: 1fr 1fr; }
.qt-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 20px;
  min-height: 220px;
  border: 1.5px dashed var(--glass-border);
  border-radius: 12px;
  background: var(--void-base);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.qt-drop:hover, .qt-drop.drag {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--void-base));
}
.qt-drop-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.qt-drop-hint {
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.qt-drop-thumb { width: 100%; }
.qt-drop-thumb img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}
.qt-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qt-field { display: block; }
.qt-field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.qt-color {
  width: 100%;
  height: 44px;
  padding: 4px;
  cursor: pointer;
}
.qt-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 22px;
}
.qt-result {
  border-top: 1px solid var(--glass-border);
  padding-top: 22px;
}
.qt-result-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}
.qt-result-image {
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qt-result-image img {
  max-width: 100%;
  max-height: 600px;
  display: block;
  cursor: zoom-in;
}
.qt-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* `[hidden]` must defeat any explicit `display: flex/grid/block` set on the
   same element. Without `!important` the UA stylesheet rule loses to our
   own rules below, so panels we mark with the `hidden` attribute keep
   showing (e.g. both Upload + Library panels stacked, or the generation
   skeleton stuck visible after the result lands). */
[hidden] { display: none !important; }

/* Dual-input control: Upload | From Library ----------------------------- */
.qt-source { display: flex; flex-direction: column; }
.qt-source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qt-source-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.qt-source-tabs {
  display: inline-flex;
  gap: 0;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  overflow: hidden;
}
.qt-source-tab {
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-tertiary);
  font-family: inherit;
}
.qt-source-tab.active {
  background: var(--accent);
  color: #fff;
}
.qt-lib {
  min-height: 220px;
  border: 1.5px dashed var(--glass-border);
  border-radius: 12px;
  background: var(--void-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 12px;
}
.qt-lib-btn { font-size: 13px; }
.qt-lib-thumb { width: 100%; }
.qt-lib-thumb img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

/* Upload spinner during FileReader.readAsDataURL -------------------------- */
.qt-drop { position: relative; }
.qt-drop-spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  border-radius: 12px;
  z-index: 1;
}
.qt-drop.loading .qt-drop-spinner {
  display: flex;
}
.qt-drop-spinner::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: qt-spin 0.8s linear infinite;
}
@keyframes qt-spin {
  to { transform: rotate(360deg); }
}
.qt-drop-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
}

/* Generation skeleton in the result block --------------------------------- */
.qt-skeleton {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #f0f0f3;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qt-skeleton-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.6) 50%,
    transparent 100%);
  animation: qt-shimmer 1.6s linear infinite;
}
@keyframes qt-shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.qt-skeleton-copy {
  position: relative;
  color: var(--text-tertiary);
  font-size: 13px;
  z-index: 1;
}

/* QuickTool pages bust out of the 1480px landing-view cap so the
   two-column layout fills wide displays. User reported empty L+R
   margins on 1920px+ monitors after the redesign shipped. */
.landing-view:has(.qt-page) {
  max-width: min(1920px, 98vw);
  padding-left: 20px;
  padding-right: 20px;
}

/* Two-column QuickTool layout --------------------------------------------- */
/* Left column: head + inputs + action button.
   Right column: growing grid of generation cards. Stacks on narrow
   screens. */
.qt-twocol {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-bottom: 18px;
}
@media (max-width: 1024px) {
  .qt-twocol { grid-template-columns: 1fr; }
}
.qt-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;   /* let nested grids shrink properly */
}
.qt-col-left  { }
.qt-col-right { }

/* Unified source panel — drop area with inline Library + Upload
   buttons. No tabs; the dropzone itself is the only surface. */
.qt-source {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qt-source-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qt-source-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
}
.qt-source-actions {
  display: flex;
  gap: 6px;
}
.qt-drop.qt-drop-unified {
  min-height: 260px;
}

/* Result grid — newest first, square cards, click to open in Studio. */
.qt-result-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
}
.qt-result-pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.qt-result-pane-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.qt-result-pane-hint {
  font-size: 11.5px;
}
.qt-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  min-height: 260px;
  align-content: start;
}
/* Unified dropzone — taller + the picked thumbnail fills the panel
   instead of capping at 180px. User wants the input preview big +
   high-res so they can see what they're about to render. */
.qt-drop.qt-drop-unified {
  min-height: min(620px, calc(100vh - 320px));
  flex: 1;
}
.qt-drop.qt-drop-unified .qt-drop-body {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.qt-drop.qt-drop-unified .qt-drop-thumb {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qt-drop.qt-drop-unified .qt-drop-thumb img {
  max-width: 100%;
  max-height: calc(min(620px, 100vh - 320px) - 60px);
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Library item — graceful fallback when a thumbnail URL 404s (e.g.
   gens whose B2 upload silently failed). The <img onerror> replaces
   itself with a "Image unavailable" label so the broken-image icon
   never reaches the grid. */
.lib-item-broken {
  background: repeating-linear-gradient(135deg,
    rgba(255,255,255,0.04) 0 8px,
    rgba(255,255,255,0.08) 8px 16px);
}
.lib-item-broken-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  min-height: 120px;
  padding: 12px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
}

.qt-result-empty {
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 40px 20px;
  border: 1.5px dashed var(--glass-border);
  border-radius: 12px;
  background: var(--void-base);
}
.qt-result-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid var(--glass-border);
  background: #efefef;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.qt-result-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.qt-result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qt-result-card-pending {
  cursor: default;
  background: linear-gradient(120deg, #2a2a36 0%, #1c1c26 100%);
}
.qt-result-card-pending:hover {
  transform: none;
  border-color: var(--glass-border);
  box-shadow: none;
}
.qt-result-card-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 30%,
    rgba(255,255,255,0.08) 50%,
    transparent 70%);
  background-size: 200% 100%;
  animation: qtShimmer 1.4s linear infinite;
}
@keyframes qtShimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.qt-result-card-label {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255,255,255,0.75);
  pointer-events: none;
}

/* Inline error banner ----------------------------------------------------- */
.qt-error {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: color-mix(in srgb, #dc2626 12%, var(--void-base));
  border: 1px solid color-mix(in srgb, #dc2626 35%, transparent);
  border-radius: 10px;
  font-size: 13px;
  color: color-mix(in srgb, #dc2626 90%, #000);
}

/* Cost chip --------------------------------------------------------------- */
.qt-cost-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  margin-right: auto;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
}

/* Seed-prompt chips (Generate Garments inspiration row) ------------------- */
.qt-seed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.qt-chip {
  font-size: 11.5px;
  padding: 6px 10px;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
}
.qt-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Color swatch grid (Change Colors) --------------------------------------- */
.qt-swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.qt-swatch {
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: transform .12s ease;
}
.qt-swatch:hover { transform: scale(1.08); }
.qt-field-sub {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qt-field-sublabel {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* Sketch type segmented control ------------------------------------------ */
.qt-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qt-seg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1.5px solid var(--glass-border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--void-base);
}
.qt-seg:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--void-base));
}
.qt-seg input { position: absolute; opacity: 0; pointer-events: none; }
.qt-seg span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.qt-seg small {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Fidelity slider (Colorful Sketch) -------------------------------------- */
.qt-slider {
  width: 100%;
  accent-color: var(--accent);
}
.qt-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ── LibraryBrowser picker modal (LU3) ────────────────────────────────
   The unified import-mode shell. Hosts LibraryBrowser inside the
   standard .modal-overlay → .modal pattern. 90vw × 80vh on desktop;
   full-screen on narrow viewports. */
.lb-picker-overlay { z-index: 9100; }
.lb-picker-modal {
  width: 90vw; max-width: 1200px;
  height: 80vh; max-height: 860px;
  display: flex; flex-direction: column;
  padding: 0;            /* override default .modal padding so body fills */
  overflow: hidden;
}
.lb-picker-modal .modal-header {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.lb-picker-modal .modal-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--text-tertiary);
}
.lb-picker-body { flex: 1 1 auto; min-height: 0; overflow: hidden;
                   display: flex; flex-direction: column; }
.lb-picker-body .lib-shell { flex: 1 1 auto; min-height: 0;
                              display: flex; flex-direction: column; }

@media (max-width: 720px) {
  .lb-picker-modal {
    width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
    border-radius: 0;
  }
}

/* Import-mode selection highlight + footer bar. Selection lives on
   .lb-selected (single-select for v1); .lb-footer hosts the Cancel /
   Use selected actions per Mink's brief. */
.lb-mode-import .lib-item { transition: outline-color .12s; outline: 2px solid transparent; outline-offset: -2px; }
.lb-mode-import .lib-item:hover { outline-color: rgba(99, 102, 241, 0.35); }
.lb-mode-import .lib-item.lb-selected {
  outline-color: var(--accent);
  outline-width: 3px;
}
.lb-footer {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; gap: 14px;
  border-top: 1px solid var(--glass-border);
  background: var(--bg-primary);
}
.lb-footer-hint { font-size: 12px; color: var(--text-tertiary); }
.lb-footer-actions { display: flex; gap: 8px; }

/* ── Lightbox overlay ─────────────────────────────────────────────────── */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage:active { cursor: grabbing; }
.lb-img {
  max-width: 92vw;
  max-height: 92vh;
  user-select: none;
  pointer-events: none;
  transition: transform 0.08s ease;
}
.lb-close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.lb-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  z-index: 1;
}
/* Reportable-id provenance footer (GI_/Ml_) — sits above the hint. */
.lb-provenance {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: rgba(20,20,24,0.82);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 9px;
  z-index: 2;
  max-width: calc(100vw - 40px);
  flex-wrap: wrap;
  justify-content: center;
}
.lb-prov-label {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lb-prov-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: #fff;
  background: rgba(255,255,255,0.08);
  padding: 3px 8px;
  border-radius: 6px;
  user-select: all;
}
.lb-prov-btn {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.lb-prov-btn:hover { background: rgba(255,255,255,0.18); }
.lb-prov-report { border-color: rgba(239,68,68,0.45); color: #fca5a5; }
.lb-prov-report:hover { background: rgba(239,68,68,0.18); }
.landing-card-img {
  padding: 0;
  overflow: hidden;
}
.landing-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  overflow: hidden;
}
.landing-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.landing-card-img .landing-card-body {
  padding: 18px 22px 22px;
}

/* ═══════════════════════════════════════════════════════════════════════
   QuickTools v2 — canvas-first redesign (2026-05-17 · light-themed)
   Per mocks/tool-page-v2.html. Used by tabs-html.js _v2* helpers.
   Colours use the SPA's existing light-mode vars (--void-*, --text-*,
   --accent) so the tool area lives in the same visual language as the
   rest of the app.
   ═══════════════════════════════════════════════════════════════════════ */

.tool-page {
  max-width: 100%;
  margin: 0;
  padding: 10px;
}

/* Page head: back · title (+ info ?) · cmd palette card · download icon */
.tool-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 4px;
}
.tool-head-left {
  display: flex; align-items: center; gap: 12px;
}
.tool-back {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 7px 12px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.tool-back:hover { border-color: var(--accent); color: var(--accent); }
.tool-head h1 {
  margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.3px;
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-primary);
}
.tool-info-btn {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.tool-info-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }

.tool-cmd-card {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 8px 14px;
  display: flex; align-items: center; gap: 12px;
  min-width: 320px; cursor: pointer; color: var(--text-primary);
  font-family: inherit;
}
.tool-cmd-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.tool-cmd-ico {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent-subtle); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.tool-cmd-name {
  display: flex; flex-direction: column; line-height: 1.2; min-width: 0;
  text-align: left;
}
.tool-cmd-name b { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.tool-cmd-name span { font-size: 11.5px; color: var(--text-tertiary); }
.tool-cmd-kbd {
  background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  padding: 2px 7px; border-radius: 5px; font-size: 10.5px;
  color: var(--text-tertiary); font-family: ui-monospace, monospace;
  margin-left: auto;
}
.tool-cmd-chev { color: var(--text-tertiary); font-size: 11px; }

.tool-head-right {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
}
.tool-icon-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.tool-icon-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-subtle); }
.tool-icon-btn.has-selection {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-subtle);
}
.tool-icon-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: #fff;
  font-size: 9.5px; font-weight: 700;
  padding: 1px 5px; border-radius: 999px;
  min-width: 16px; text-align: center;
}

.tool-sub {
  color: var(--text-tertiary); font-size: 13px;
  margin: 0 0 12px;
}

/* Guidance — small floating popover pinned to the top-left of the canvas
   body. Lives INSIDE .tool-canvas-body so it scrolls / docks with the
   canvas. Hidden by default; ToolGuidance.show() adds .open. */
.tool-canvas-body { position: relative; }
.tool-guidance {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: min(320px, calc(100% - 24px));
  display: none;
}
.tool-guidance.open { display: block; }
.tool-guidance[hidden] { display: none; }
.tool-guidance-card {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px;
  align-items: start;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.tool-guidance-marker {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent-subtle); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.tool-guidance-text { font-size: 12.5px; line-height: 1.45; color: var(--text-primary); }
.tool-guidance-text h4 {
  margin: 0 0 4px; font-size: 10.5px; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700;
}
.tool-guidance-steps {
  margin: 0; padding-left: 16px; color: var(--text-secondary);
  font-size: 12px;
}
.tool-guidance-steps li { margin: 2px 0; }
.tool-guidance-video {
  grid-column: 1 / -1;
  border: 1px solid var(--glass-border); border-radius: 8px;
  aspect-ratio: 16/9;
  background: var(--void-elevated);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  margin-top: 6px;
}
.tool-guidance-video video { width: 100%; height: 100%; object-fit: cover; }
.tool-guidance-video-ph {
  color: var(--text-tertiary); font-size: 11px; padding: 6px;
  text-align: center;
}
.tool-guidance-dismiss {
  background: transparent; border: 0; color: var(--text-tertiary);
  font-size: 18px; cursor: pointer; padding: 0 4px; align-self: start;
  line-height: 1;
}
.tool-guidance-dismiss:hover { color: var(--text-primary); }

/* Workspace: canvas + parameters rail */
.tool-workspace {
  display: grid; grid-template-columns: 1fr 300px; gap: 14px;
}
@media (max-width: 980px) {
  .tool-workspace { grid-template-columns: 1fr; }
}

.tool-canvas-wrap {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.tool-canvas-strip-top {
  padding: 9px 14px; border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-tertiary);
}
.tool-canvas-status::before { content: '●'; color: var(--success); margin-right: 6px; }
.tool-canvas-status.has-image::before { color: var(--accent); }
.tool-canvas-status b { color: var(--text-primary); font-weight: 600; }
.tool-canvas-body {
  min-height: 440px; padding: 22px;
  flex: 1;
  display: flex;
  background:
    linear-gradient(135deg, transparent 49%, rgba(124,58,237,0.04) 49%, rgba(124,58,237,0.04) 51%, transparent 51%) 0 0 / 14px 14px,
    var(--void-deep);
}
.tool-canvas-body.dual { gap: 16px; }
.tool-canvas-strip-bot {
  padding: 9px 14px; border-top: 1px solid var(--glass-border);
  display: flex; align-items: center;
  font-size: 11.5px; color: var(--text-tertiary);
  font-family: ui-monospace, monospace;
}
.tool-canvas-strip-right { margin-left: auto; }

/* Dropzone */
.tool-dropzone {
  flex: 1; border: 1.5px dashed var(--glass-border);
  border-radius: 14px; padding: 36px 24px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 8px;
  background: var(--void-base);
  transition: border-color 0.15s, background 0.15s;
  position: relative; cursor: pointer;
}
.tool-dropzone:hover { border-color: var(--accent); background: var(--accent-subtle); }
.tool-dropzone.drag { border-color: var(--accent); background: var(--accent-subtle); }
.tool-dropzone.has-image {
  border-style: solid;
  border-color: var(--accent);
  padding: 0; gap: 0;
}
.tool-dropzone-label {
  position: absolute; top: 12px; left: 14px;
  font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-tertiary); font-weight: 600;
}
.tool-dropzone-empty {
  display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.tool-dropzone.has-image .tool-dropzone-empty { display: none; }
.tool-dropzone-chip {
  width: 54px; height: 54px; border-radius: 14px;
  background: var(--accent-subtle); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 4px;
}
.tool-dropzone h3 {
  margin: 6px 0 4px; font-size: 16px; font-weight: 600;
  color: var(--text-primary);
}
.tool-dropzone-sub { margin: 0; color: var(--text-tertiary); font-size: 13px; }
.tool-dropzone-meta { margin: 4px 0 12px; color: var(--text-ghost); font-size: 11.5px; }
.tool-dropzone-actions {
  display: flex; gap: 10px; margin-top: 6px;
}
.tool-btn {
  padding: 10px 16px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid transparent;
}
.tool-btn-primary {
  background: var(--text-primary); color: var(--void-base);
  border-color: var(--text-primary);
}
.tool-btn-primary:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool-btn-ghost {
  background: var(--void-elevated); color: var(--text-primary);
  border-color: var(--glass-border);
}
.tool-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.tool-dropzone-status {
  position: absolute; bottom: 12px; right: 14px;
  font-size: 10.5px; color: var(--text-tertiary);
}
.tool-dropzone-status::before { content: '●'; color: var(--success); margin-right: 5px; }
.tool-dropzone-spinner {
  position: absolute; top: 14px; right: 14px;
  width: 18px; height: 18px;
  border: 2px solid var(--accent-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: none;
  animation: tool-spin 0.8s linear infinite;
}
.tool-dropzone.loading .tool-dropzone-spinner { display: block; }
@keyframes tool-spin { to { transform: rotate(360deg); } }
.tool-dropzone-thumb { width: 100%; height: 100%; display: none; }
.tool-dropzone.has-image .tool-dropzone-thumb { display: flex; align-items: center; justify-content: center; }

/* Clear / replace control — visible only when the dropzone has an image.
   Top-right floating chip; click to wipe the slot so the user can re-pick
   from Library or upload a new file. */
.tool-dropzone-clear {
  position: absolute; top: 10px; right: 10px; z-index: 4;
  display: none; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 12px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.tool-dropzone-clear:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}
.tool-dropzone.has-image .tool-dropzone-clear { display: inline-flex; }
body.tg-theme-dark .tool-dropzone-clear {
  background: var(--void-elevated);
  color: var(--text-primary);
}

/* RolePreview — owner-only "View as <role>" topbar widget + banner. */
.topbar-role-preview { display: inline-flex; align-items: center; }
.role-preview-btn { display: inline-flex !important; align-items: center; gap: 6px; }
.role-preview-btn b { color: var(--accent); margin-left: 2px; }
.role-preview-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 220px;
  background: var(--void-raised, #fff);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}
.role-preview-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: transparent; border: 0; cursor: pointer;
  padding: 9px 12px; border-radius: 7px;
  color: var(--text-primary); font: inherit; font-size: 13px;
  text-align: left;
}
.role-preview-item:hover { background: var(--accent-subtle); color: var(--accent); }
.role-preview-item.on { background: var(--accent-subtle); color: var(--accent); font-weight: 600; }
.role-preview-item-meta { color: var(--text-tertiary); font-size: 11.5px; }
.role-preview-divider {
  height: 1px; background: var(--glass-border);
  margin: 6px 0;
}
.role-preview-exit { color: var(--error); font-weight: 600; }
.role-preview-exit:hover { background: rgba(220,38,38,0.08); color: var(--error); }

.role-preview-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9000;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  color: #fff;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 12px; justify-content: center;
  box-shadow: 0 -4px 18px rgba(124,58,237,0.30);
}
.role-preview-banner-dot { font-size: 16px; line-height: 1; }
.role-preview-banner-exit {
  margin-left: auto;
  background: rgba(255,255,255,0.18);
  color: #fff; border: 1px solid rgba(255,255,255,0.30);
  padding: 5px 12px; border-radius: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer;
}
.role-preview-banner-exit:hover { background: rgba(255,255,255,0.30); }

/* CanvasMarker — rectangle-drawing overlay (High-Res "Marked element"). */
.tool-marker-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: none;
  cursor: crosshair;
}
.tool-dropzone.tool-marker-on .tool-marker-overlay { display: block; }
.tool-marker-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
}
.tool-marker-rect {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(124, 58, 237, 0.10);
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(15, 15, 26, 0.30);
}
.tool-dropzone-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; }

/* Prompt-only canvas variant (generate-garments) */
.tool-dropzone-prompt-only { cursor: default; }
.tool-dropzone-prompt-only:hover { background: var(--void-base); border-color: var(--glass-border); }
.tool-seed-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-width: 720px; margin-top: 16px;
}
.tool-seed-chip {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 7px 14px; border-radius: 999px;
  font-size: 12px; cursor: pointer;
}
.tool-seed-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }

/* Parameters rail */
.tool-params {
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  display: flex; flex-direction: column;
  align-self: start; position: sticky; top: 12px;
  max-height: calc(100vh - 24px);
}
.tool-params-head {
  padding: 13px 16px; border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center;
}
.tool-params-head h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.tool-params-preset {
  margin-left: auto; font-size: 11.5px; color: var(--accent);
  cursor: pointer; text-decoration: none;
}
.tool-params-body {
  padding: 14px 16px; display: flex; flex-direction: column; gap: 14px;
  overflow: auto; flex: 1;
}
.tool-field { display: flex; flex-direction: column; gap: 6px; }
.tool-field label {
  font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-tertiary); font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.tool-field-mute {
  text-transform: none; letter-spacing: 0;
  color: var(--text-ghost); font-weight: 400;
}
.tool-field-val { color: var(--text-primary); font-weight: 600; text-transform: none; letter-spacing: 0; }
.tool-field input,
.tool-field select,
.tool-field textarea {
  background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 9px 12px; border-radius: 8px;
  font: inherit; font-size: 13px; width: 100%;
}
.tool-field textarea { min-height: 64px; resize: vertical; }
.tool-field input:focus, .tool-field textarea:focus, .tool-field select:focus {
  outline: 0; border-color: var(--accent); background: var(--void-base);
}
.tool-field-helper { font-size: 11.5px; color: var(--text-tertiary); }

.tool-orient {
  display: flex; background: var(--void-elevated);
  border: 1px solid var(--glass-border); border-radius: 8px; padding: 3px;
}
.tool-orient button {
  flex: 1; background: transparent; border: 0; color: var(--text-tertiary);
  padding: 7px 8px; border-radius: 6px; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500;
}
.tool-orient button:hover { color: var(--text-primary); }
.tool-orient button.active { background: var(--accent); color: #fff; }

.tool-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px; background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 999px; outline: none;
}
.tool-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; background: var(--accent);
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 2px 6px rgba(124,58,237,0.30);
}
.tool-slider-endpoints {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--text-tertiary);
}
.tool-color { padding: 4px !important; height: 36px; cursor: pointer; background: var(--void-elevated) !important; }

.tool-params-outputs {
  padding: 14px 16px; border-top: 1px solid var(--glass-border);
  display: flex; flex-direction: column; gap: 10px;
}
.tool-params-cost {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--text-secondary);
}
.tool-params-cost b { color: var(--accent); font-family: ui-monospace, monospace; }
.tool-render-btn {
  background: var(--accent);
  color: #fff; border: 0; padding: 14px 18px; border-radius: 10px;
  font-size: 14.5px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-glow-accent);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tool-render-btn:hover { background: var(--accent-light); }
.tool-render-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Generations grid (below canvas) */
.tool-gens { margin-top: 18px; }
.tool-gens-head {
  display: flex; align-items: center; margin-bottom: 10px;
  padding: 0 2px;
}
.tool-gens-head h3 {
  margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.tool-gens-count {
  background: var(--void-elevated); color: var(--text-tertiary);
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  font-weight: 500; border: 1px solid var(--glass-border);
}
.tool-gens-hint {
  margin-left: auto; color: var(--accent); font-size: 12px;
}
.tool-gens-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px;
}
@media (max-width: 1400px) { .tool-gens-grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 1000px) { .tool-gens-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 600px)  { .tool-gens-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-gens-empty {
  grid-column: 1 / -1;
  text-align: center; color: var(--text-tertiary); font-size: 12.5px;
  padding: 32px 12px;
  border: 1px dashed var(--glass-border); border-radius: 10px;
  background: var(--void-base);
}
.tool-gens-card {
  aspect-ratio: 1; border-radius: 10px;
  background: var(--void-elevated);
  border: 1px solid var(--glass-border);
  position: relative; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); font-size: 10.5px;
  overflow: hidden;
}
.tool-gens-card.pending {
  background: repeating-linear-gradient(45deg, var(--void-elevated) 0 10px, var(--void-deep) 10px 20px);
}
.tool-gens-card.pending::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent-subtle), transparent);
  animation: tool-shimmer 1.4s ease-in-out infinite;
}
@keyframes tool-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.tool-gens-card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.tool-gens-card:hover { border-color: var(--accent); }
.tool-gens-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-subtle); }
.tool-gens-sel {
  position: absolute; top: 6px; left: 6px;
  width: 20px; height: 20px; border-radius: 5px;
  background: rgba(255,255,255,0.85); border: 1.5px solid var(--text-tertiary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; cursor: pointer;
  z-index: 2;
}
.tool-gens-card.selected .tool-gens-sel {
  background: var(--accent); border-color: var(--accent);
}
.tool-gens-card.selected .tool-gens-sel::after { content: '✓'; }

.tool-error {
  margin-top: 14px; background: var(--error-dim);
  border: 1px solid var(--error); color: var(--error);
  padding: 10px 14px; border-radius: 8px; font-size: 13px;
}

/* Tool switcher modal (⌘K) */
.tool-switcher-backdrop {
  position: fixed; inset: 0; background: rgba(15,15,26,0.45);
  z-index: 9999; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 18vh; backdrop-filter: blur(4px);
}
.tool-switcher {
  width: min(560px, 92vw);
  background: var(--void-base);
  border: 1px solid var(--glass-border);
  border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-xl);
}
.tool-switcher input {
  width: 100%; background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font-size: 15px; padding: 18px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.tool-switcher-list { max-height: 50vh; overflow: auto; padding: 8px; }
.tool-switcher-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-primary); font-size: 13.5px;
}
.tool-switcher-item.on { background: var(--accent-subtle); }
.tool-switcher-item .ico-square {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-subtle); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.tool-switcher-item .name { flex: 1; }
.tool-switcher-item .name span { display: block; font-size: 11.5px; color: var(--text-tertiary); }

/* ─── QuickTools wizard stepper (3 pills under the page head) ───────────── */
.qt-stepper {
  display: flex;
  gap: 12px;
  margin: 0 0 22px;
}
.qt-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--void-base, #1a1c25);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.07));
  border-radius: 12px;
  transition: border-color 0.2s, background 0.2s;
}
.qt-step-num {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text-tertiary, rgba(233,236,241,0.55));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.qt-step-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.qt-step-lbl {
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-tertiary, rgba(233,236,241,0.55));
  font-weight: 600;
}
.qt-step-ttl {
  font-size: 13.5px;
  color: var(--text-primary, #e9ecf1);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Active step — accent border + accent-soft number pill */
.qt-step.on {
  border-color: var(--accent, #7c5cff);
  background: linear-gradient(180deg,
    rgba(124,92,255,0.10), rgba(124,92,255,0.04));
}
.qt-step.on .qt-step-num {
  background: var(--accent, #7c5cff);
  color: #fff;
}
.qt-step.on .qt-step-lbl {
  color: var(--accent, #7c5cff);
}
/* Done step — quieter accent. JS swaps the number text to '✓' on done. */
.qt-step.done .qt-step-num {
  background: rgba(124,92,255,0.20);
  color: var(--accent, #7c5cff);
}
/* Smaller screens — drop the ttl text, keep just num + lbl */
@media (max-width: 720px) {
  .qt-step-ttl { display: none; }
  .qt-step { gap: 8px; padding: 10px 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Studio Editor — dark-mode contrast fixes (2026-05-17)
   The base .studio-panel hard-codes background:#ffffff and several text
   colours use --text-tertiary (~55% alpha) which becomes near-invisible
   when the underlying var flips dark. Override per-element here so both
   modes are readable without touching the light-mode defaults.
   ═══════════════════════════════════════════════════════════════════════ */
body.tg-theme-dark .studio-panel {
  background: var(--void-base) !important;
  border-color: var(--glass-border) !important;
}
/* The left column = trend moodboard. Renders as a separate column INSIDE
   .studio-panel.has-moodboard. Its own background was inherited from
   parent; force dark explicitly so the strategy/trend chips read. */
body.tg-theme-dark .studio-moodboard-column,
body.tg-theme-dark .studio-moodboard {
  background: var(--void-base) !important;
  color: var(--text-primary);
}
body.tg-theme-dark .studio-moodboard h3,
body.tg-theme-dark .studio-moodboard h4,
body.tg-theme-dark .studio-moodboard .moodboard-section-title,
body.tg-theme-dark .studio-moodboard .studio-story-badge-name {
  color: var(--text-primary);
}
body.tg-theme-dark .studio-moodboard p,
body.tg-theme-dark .studio-moodboard li,
body.tg-theme-dark .studio-moodboard .text-muted {
  color: var(--text-secondary);
}
body.tg-theme-dark .studio-moodboard .moodboard-chip,
body.tg-theme-dark .studio-moodboard .chip {
  background: var(--void-elevated);
  color: var(--text-primary);
  border-color: var(--glass-border);
}
body.tg-theme-dark .studio-header {
  border-bottom-color: var(--glass-border);
}
body.tg-theme-dark .studio-title {
  color: var(--text-primary);
}
body.tg-theme-dark .studio-subtitle {
  color: var(--text-secondary);
}
body.tg-theme-dark .studio-close {
  color: var(--text-primary);
  background: var(--void-elevated);
}
body.tg-theme-dark .studio-close:hover {
  background: var(--accent-subtle);
  color: var(--accent);
}
body.tg-theme-dark .studio-image-wrap {
  background: var(--void-deep);
}
body.tg-theme-dark .studio-image-frame {
  background: var(--void-base);
  border-color: var(--glass-border);
}
/* Right toolset rail inside the studio panel — icon buttons + active state */
body.tg-theme-dark .studio-panel .toolset-rail,
body.tg-theme-dark .studio-panel .studio-tool-rail {
  background: var(--void-elevated);
  border-color: var(--glass-border);
}
body.tg-theme-dark .studio-panel .toolset-rail button,
body.tg-theme-dark .studio-panel .studio-tool-rail button {
  color: var(--text-secondary);
}
body.tg-theme-dark .studio-panel .toolset-rail button:hover,
body.tg-theme-dark .studio-panel .studio-tool-rail button:hover {
  color: var(--text-primary);
  background: var(--accent-subtle);
}
body.tg-theme-dark .studio-panel .toolset-rail button.active,
body.tg-theme-dark .studio-panel .studio-tool-rail button.active {
  color: var(--accent);
  background: var(--accent-subtle);
}
/* Tool side-pane (Edit piece copy, palette-in-play, etc.) */
body.tg-theme-dark .studio-panel .studio-side,
body.tg-theme-dark .studio-panel .studio-sidepane,
body.tg-theme-dark .studio-panel .studio-tool-pane {
  background: var(--void-base);
  color: var(--text-primary);
  border-color: var(--glass-border);
}
body.tg-theme-dark .studio-panel .studio-tool-pane h3,
body.tg-theme-dark .studio-panel .studio-tool-pane h4 {
  color: var(--text-primary);
}
body.tg-theme-dark .studio-panel .studio-tool-pane p,
body.tg-theme-dark .studio-panel .studio-tool-pane .text-muted {
  color: var(--text-secondary);
}
/* Bottom toolbar (zoom controls + pagination) */
body.tg-theme-dark .studio-panel .studio-bottom,
body.tg-theme-dark .studio-panel .studio-toolbar {
  background: var(--void-elevated);
  border-color: var(--glass-border);
  color: var(--text-secondary);
}
body.tg-theme-dark .studio-panel .studio-bottom button,
body.tg-theme-dark .studio-panel .studio-toolbar button {
  color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════
   Studio Editor — LIGHT MODE override (2026-05-17 aggressive pass)
   The moodboard column + all .mb-* children are hardcoded for dark
   backdrops (light text on dark bg). When the SPA is in light theme
   the whole column reads as washed-out pale text on white. Override
   everything that has a hardcoded dark-mode colour value here, so
   light mode renders dark text on a light surface.
   Scope: body:not(.tg-theme-dark) — the light default.
   ═══════════════════════════════════════════════════════════════════════ */
body:not(.tg-theme-dark) .studio-moodboard-column {
  background: var(--void-base);
  color: var(--text-primary);
  border-right-color: var(--glass-border);
}
body:not(.tg-theme-dark) .mb-header {
  border-bottom-color: var(--glass-border);
}
body:not(.tg-theme-dark) .mb-eyebrow {
  color: var(--accent);
}
body:not(.tg-theme-dark) .mb-title {
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body:not(.tg-theme-dark) .mb-mood {
  color: var(--text-secondary);
  background: var(--accent-subtle);
}
body:not(.tg-theme-dark) .mb-section-title {
  color: var(--text-tertiary);
}
body:not(.tg-theme-dark) .mb-swatch-color {
  border-color: var(--glass-border);
  box-shadow: 0 1px 3px rgba(15,15,26,.10);
}
body:not(.tg-theme-dark) .mb-swatch-name {
  color: var(--text-secondary);
}
body:not(.tg-theme-dark) .mb-strategy li {
  color: var(--text-secondary);
}
body:not(.tg-theme-dark) .mb-strategy li::before {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(124,58,237,.45);
}
body:not(.tg-theme-dark) .mb-chip {
  background: var(--void-elevated);
  color: var(--text-primary);
  border-color: var(--glass-border);
}
body:not(.tg-theme-dark) .mb-chip:hover {
  background: var(--void-surface);
}
body:not(.tg-theme-dark) .mb-chip-green {
  background: rgba(16,185,129,.10);
  color: #047857;
  border-color: rgba(16,185,129,.40);
}
body:not(.tg-theme-dark) .mb-chip-green:hover { background: rgba(16,185,129,.18); }
body:not(.tg-theme-dark) .mb-chip-purple {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(124,58,237,.45);
}
body:not(.tg-theme-dark) .mb-chip-purple:hover { background: rgba(124,58,237,.14); }
body:not(.tg-theme-dark) .mb-chip-red {
  background: rgba(220,38,38,.08);
  color: #b91c1c;
  border-color: rgba(220,38,38,.40);
}
body:not(.tg-theme-dark) .mb-chip-red:hover { background: rgba(220,38,38,.14); }
/* Signal panel — light overrides for the sig-* additions. */
/* Signal recipe card — light theme: swap the CSS-var palette + a few surfaces. */
body:not(.tg-theme-dark) .sig-recipe {
  --sig-accent: var(--accent, #7c3aed);
  --sig-ink: #1c1b22;
  --sig-muted: #6b6675;
  --sig-rule: rgba(0,0,0,0.10);
  --sig-cell: #faf9fc;
}
body:not(.tg-theme-dark) .sig-card { background: rgba(0,0,0,0.015); }
body:not(.tg-theme-dark) .sig-pill-theme { background: var(--accent-subtle, rgba(124,58,237,.10)); color: var(--accent, #6d28d9); border-color: rgba(124,58,237,.35); }
body:not(.tg-theme-dark) .sig-spec-v { color: #35323d; }
body:not(.tg-theme-dark) .sig-sel-desc { color: var(--text-muted, #6b6675); }
body:not(.tg-theme-dark) .mb-imgs img {
  border-color: var(--glass-border);
}
/* Right tool-pane (Edit piece) — same treatment: hardcoded dark in the
   base file; flip the surface + text for light mode explicitly. */
body:not(.tg-theme-dark) .studio-panel .studio-tool-pane,
body:not(.tg-theme-dark) .studio-panel .studio-side {
  background: var(--void-base);
  color: var(--text-primary);
  border-color: var(--glass-border);
}
/* Studio toolbar at the bottom of the image area */
body:not(.tg-theme-dark) .studio-toolbar {
  background: var(--void-elevated);
  border-color: var(--glass-border);
  color: var(--text-primary);
}

/* The v2 right sidebar (Edit-piece launcher) — base CSS is hardcoded
   to a fallback dark color and the launcher injects its own dark
   .tg-* styles via JS. Override both for light mode. */
body:not(.tg-theme-dark) .studio-sidebar.studio-sidebar-v2 {
  background: var(--void-base);
  color: var(--text-primary);
  border-left: 1px solid var(--glass-border);
}
body:not(.tg-theme-dark) .tg-rail {
  background: var(--void-elevated);
  border-right: 1px solid var(--glass-border);
}
body:not(.tg-theme-dark) .tg-rail-toggle {
  background: transparent;
  color: var(--text-tertiary);
  border-color: var(--glass-border);
}
body:not(.tg-theme-dark) .tg-rail-toggle:hover {
  color: var(--text-primary);
  background: var(--void-surface);
}
body:not(.tg-theme-dark) .tg-rail-divider {
  background: var(--glass-border);
}
body:not(.tg-theme-dark) .tg-rail-group-label {
  color: var(--text-tertiary);
}
body:not(.tg-theme-dark) .tg-icon-btn {
  color: var(--text-secondary);
  background: transparent;
}
body:not(.tg-theme-dark) .tg-icon-btn:hover {
  color: var(--text-primary);
  background: var(--void-surface);
}
body:not(.tg-theme-dark) .tg-icon-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
body:not(.tg-theme-dark) .tg-icon-tip {
  background: var(--text-primary);
  color: var(--void-base);
  border-color: var(--text-primary);
}
body:not(.tg-theme-dark) .tg-detail-header {
  border-bottom: 1px solid var(--glass-border);
}
body:not(.tg-theme-dark) .tg-detail-title h3 {
  color: var(--text-primary);
}
body:not(.tg-theme-dark) .tg-detail-title p {
  color: var(--text-tertiary);
}
body:not(.tg-theme-dark) .tg-detail-empty {
  color: var(--text-tertiary);
}
body:not(.tg-theme-dark) .tg-field-label {
  color: var(--text-tertiary);
}
body:not(.tg-theme-dark) .tg-help {
  color: var(--text-secondary);
}

/* ── Animate Generation (VG2) ───────────────────────────────────────────
   Tiny extension on top of the unified .tool-* shell.

   `.tool-toggle` is the 2-button segmented variant of `.tool-orient` —
   audio Off/On lives here. Shares the orient look so the param panel
   stays visually consistent. */

.tool-orient.tool-toggle { display: inline-flex; padding: 3px; gap: 0; }
.tool-orient.tool-toggle button { min-width: 56px; }

/* Canvas-strip-top "Pick from Library" chip — injected by
   animate-generation.js after init(). The user can swap source
   images without first clearing the dropzone. */
.tool-canvas-strip-top .ag-lib-chip {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-primary);
  padding: 4px 10px; font: 500 12px/1 system-ui, sans-serif;
  border-radius: 6px; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tool-canvas-strip-top .ag-lib-chip:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.18);
}

/* Video tile inside the unified gen-grid (.tool-gens-grid). Mirrors
   the image-tile layout so a mixed image+video grid reads as one
   collection — the only difference is the play-icon overlay + a
   small meta strip with the inline download link. */
.tool-gens-card.tool-gen-video-tile { position: relative; cursor: zoom-in; }
.tool-gens-card.tool-gen-video-tile video {
  width: 100%; height: 100%; object-fit: cover;
  display: block; border-radius: inherit; background: #000;
}
.tool-gen-video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.25), transparent 60%);
  opacity: 0.85;
  transition: opacity .15s;
}
.tool-gens-card.tool-gen-video-tile:hover .tool-gen-video-overlay { opacity: 1; }
.tool-gen-video-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; gap: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff; font-size: 11px;
}
.tool-gen-video-dl { color: #fff; text-decoration: underline;
  font-weight: 500; pointer-events: auto; }
.tool-gen-video-dl:hover { color: var(--accent); }

/* Library-grid video tiles. Tiny play-icon overlay so a mixed
   image+video grid reads as one collection. */
.lib-item.lib-item-video { position: relative; }
.lib-item-video-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.25), transparent 60%);
  opacity: 0.85;
  transition: opacity .15s;
}
.lib-item.lib-item-video:hover .lib-item-video-overlay { opacity: 1; }

/* WID3 (2026-05-21): display_id chip — copyable handle on workspace
   picker cards + a smaller inline variant in the topbar switcher
   dropdown. Mono font signals 'this is a stable identifier you can
   share'; the click target is the whole button for accessibility. */
.ws-display-id-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 10px;
  background: rgba(124,58,237,0.06);
  border: 1px solid rgba(124,58,237,0.18);
  border-radius: 999px;
  color: var(--text-secondary, #4a4a5e);
  cursor: pointer;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 11px; line-height: 1.4;
  transition: background .12s, border-color .12s, color .12s;
}
.ws-display-id-chip:hover {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.32);
  color: var(--accent, #7c3aed);
}
.ws-display-id-chip-mono { letter-spacing: 0.02em; }

/* Smaller variant inside the topbar workspace-switcher dropdown. */
.ws-switcher-display-id {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(120,120,150,0.10);
  border-radius: 4px;
  color: var(--text-tertiary, #8b8b9e);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  margin-left: 6px;
}

/* Lightbox video + prev/next chrome (VG2 rework-C). */
.lb-overlay .lb-video {
  max-width: 92vw; max-height: 88vh;
  border-radius: 10px; background: #000;
  box-shadow: 0 16px 60px rgba(0,0,0,0.55);
}
.lb-overlay .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; font-size: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  transition: background .12s, transform .12s;
}
.lb-overlay .lb-nav:hover { background: rgba(0,0,0,0.65); transform: translateY(-50%) scale(1.05); }
.lb-overlay .lb-nav-prev { left: 18px; }
.lb-overlay .lb-nav-next { right: 18px; }

/* UI.focusNewCard — brief glow on a freshly-appended generation card
   so users on long pages don't miss the new shimmer below the fold.
   Two soft pulses then fade. The wrapper class lives on the card for
   ~1.7s, just past the animation duration. */
@keyframes ui-focus-pulse-kf {
  0%   { box-shadow: 0 0 0 0 rgba(124,58,237,0.55); }
  40%  { box-shadow: 0 0 0 8px rgba(124,58,237,0.00); }
  60%  { box-shadow: 0 0 0 0 rgba(124,58,237,0.45); }
  100% { box-shadow: 0 0 0 12px rgba(124,58,237,0.00); }
}
.ui-focus-pulse {
  animation: ui-focus-pulse-kf 1.5s ease-out 1;
  /* Ensures the glow renders cleanly above adjacent cards. */
  position: relative; z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
  .ui-focus-pulse { animation: none; }
}


/* Concept Studio model-tile gender badge (mig 049 / task #85). Renders the
   existing "Men" / "Women" / "No gender" chip and — for user uploads —
   makes it click-to-edit. Inline styles on the rendered span keep their
   colour priority; we only add hover affordances + an underline pulse so
   the chip reads as a button when interactive. */
.cs-gender-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  user-select: none;
  z-index: 2;
}
.cs-gender-badge--missing {
  background: rgba(239, 68, 68, 0.9);
}
.cs-gender-badge[onclick] {
  outline: 1px solid rgba(255, 255, 255, 0.18);
  transition: background-color 0.12s, outline-color 0.12s, transform 0.08s;
}
.cs-gender-badge[onclick]:hover {
  outline-color: rgba(255, 255, 255, 0.55);
  background: rgba(124, 58, 237, 0.85);
}
.cs-gender-badge[onclick]:active { transform: translateY(1px); }
