/* ══════════════════════════════════════════════════════════
   3DismZ AI Pipeline Console — Fluxio Dark Theme
   ══════════════════════════════════════════════════════════ */

/* ── TOKENS ───────────────────────────────────────────────── */
:root {
  --bg:           #0d1117;
  --bg2:          #131929;
  --surface:      #161c2d;
  --surface2:     #1e2a45;
  --border:       #2a3556;
  --border-light: #334270;
  --text:         #e8edf5;
  --text-dim:     #7a8aaa;
  --text-muted:   #4a5878;
  --accent:       #3b82f6;
  --accent-dark:  #2563eb;
  --accent-glow:  rgba(59,130,246,0.12);
  --accent-grad:  #1e40af;
  --accent-grad2: #3b82f6;
  --accent2:      #f59e0b;
  --accent3:      #06b6d4;
  --success:      #22c55e;
  --danger:       #ef4444;
  --sidebar-w:    28px;
  --sidebar-w-open: 276px;
  --mono:         'JetBrains Mono', monospace;
  --sans:         'Syne', sans-serif;
  --radius:       2px;
  --shadow:       none;
  --shadow-lg:    none;
  --shadow-blue:  0 0 0 1px rgba(59,130,246,0.55);
  --transition:   0.12s linear;
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent3); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── APP SHELL ────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
body.no-sidebar .sidebar { display: none; }
body.no-sidebar .main-content,
body.no-sidebar.sidebar-pinned .main-content { margin-left: 0 !important; }
body.no-sidebar .ud-lb { left: 0; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #080d16;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.22s ease;
}
@media (min-width: 821px) {
  .sidebar:hover,
  body.sidebar-pinned .sidebar { width: var(--sidebar-w-open); }
  body:not(.no-sidebar) .main-content { transition: margin-left 0.22s ease; }
  body:not(.no-sidebar):has(.sidebar:hover) .main-content,
  body:not(.no-sidebar).sidebar-pinned .main-content { margin-left: var(--sidebar-w-open); }
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-brand { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.brand-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-bottom: 4px; }
.brand-mark:hover { text-decoration: none; }
.brand-icon {
  width: 32px; height: 32px;
  background: var(--accent-grad);
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 600; color: #fff;
  flex-shrink: 0; box-shadow: var(--shadow-blue);
}
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: #fff; }
.brand-sub { font-family: var(--mono); font-size: 9px; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; padding-left: 42px; }

.sidebar-section-label { font-family: var(--mono); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 2.5px; color: var(--text-muted); padding: 16px 16px 5px; }
.sidebar-nav { padding: 4px 8px 8px; }

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 2px; text-decoration: none;
  color: var(--text-dim); font-size: 12px; font-weight: 600;
  transition: all var(--transition); margin-bottom: 2px;
}
.nav-link:hover { background: var(--accent-glow); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-glow); color: #fff; border-left: 3px solid var(--accent); padding-left: 7px; }

.nav-dot {
  width: 18px; height: 18px; border-radius: 2px;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; flex-shrink: 0; color: var(--text-muted);
  transition: all var(--transition);
}
.nav-link:hover .nav-dot  { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.nav-link.active .nav-dot { background: var(--accent); border-color: var(--accent); color: #fff; }

.nav-type {
  font-family: var(--mono); font-size: 8px; text-transform: uppercase;
  letter-spacing: 1px; margin-left: auto;
  background: var(--surface2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 2px; color: var(--text-muted); flex-shrink: 0;
}
.nav-link.active .nav-type { background: rgba(59,130,246,0.2); border-color: rgba(59,130,246,0.4); color: var(--accent); }

.sidebar-studio-section { border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); padding: 6px 8px; background: rgba(59,130,246,0.03); }
.sidebar-library-section { flex: 1; padding: 6px 8px; border-bottom: 1px solid var(--border); }

.sidebar-standalone {
  margin-top: 6px;
  padding: 10px 8px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link.nav-library {
  font-size: 14px;
  font-weight: 700;
  padding: 9px 10px;
}
.nav-dot.nav-dot-book {
  color: inherit;
}
.nav-dot.nav-dot-book svg {
  display: block;
}
.nav-link.nav-library.active .nav-dot-book,
.nav-link.nav-library:hover .nav-dot-book {
  color: #fff;
}

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.user-pill { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 2px; }
.user-initial { width: 26px; height: 26px; background: var(--accent-grad); color: #fff; border-radius: 2px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.user-name { font-size: 11px; font-weight: 600; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
.logout-btn { width: 100%; background: none; border: 1px solid var(--border); color: var(--text-muted); font-family: var(--sans); font-size: 11px; font-weight: 600; padding: 7px 12px; border-radius: 2px; cursor: pointer; transition: all var(--transition); text-align: center; }
.logout-btn:hover { background: var(--surface2); color: var(--text-dim); border-color: var(--border-light); }
.auth-btn { display: block; text-align: center; padding: 9px 12px; border-radius: 2px; font-size: 12px; font-weight: 700; text-decoration: none; transition: all var(--transition); border: 1px solid var(--border); color: var(--text-dim); }
.auth-btn:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.auth-btn.primary { background: var(--accent-grad); border-color: var(--accent); color: #fff; }
.auth-btn.primary:hover { box-shadow: var(--shadow-blue); }

/* ── MAIN ─────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.site-notice-banner {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 36px; background: rgba(245,158,11,0.12);
  border-bottom: 1px solid rgba(245,158,11,0.35);
  font-size: 13px; line-height: 1.45; color: var(--text);
}
.free-gen-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 36px; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
}
.free-gen-banner.at-limit { color: #e85d5d; }
.free-gen-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--accent);
}
.free-gen-note { color: inherit; }
.site-notice-label {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent2);
  flex-shrink: 0;
}
.site-notice-msg { flex: 1; min-width: 160px; font-weight: 600; }
.site-notice-dismiss {
  margin-left: auto; background: none; border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 2px; padding: 2px 8px; cursor: pointer;
  font-size: 12px; line-height: 1.4;
}
.site-notice-dismiss:hover { color: var(--text); border-color: var(--text-dim); }
.site-notice-composer {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 36px 0;
}
.site-notice-composer input[type=text] {
  flex: 1; min-width: 220px; max-width: 520px;
  font-size: 13px; padding: 6px 10px;
  background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: 2px;
}
.site-notice-composer .site-notice-live {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
}
.age-policy-notice {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 520px;
}
.age-policy-notice .age-policy-review {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.age-policy-notice .age-policy-review:disabled {
  color: var(--text-muted);
  text-decoration: none;
  cursor: default;
}
.age-policy-notice.is-sent,
.age-policy-notice.is-allowed { color: var(--text-muted); }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header { padding: 32px 36px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; position: relative; }
.page-header:has(.gs-stacks),
.page-header:has(.gs-stack) { align-items: flex-start; padding-right: 520px; }
.page-header:has(.gs-stacks) + .jema-guide,
.page-header:has(.gs-stack) + .jema-guide { margin-right: 520px; }

/* Retired: room header specs (20s · fps · size…) — space goes to SFW gallery */
.page-header-note { display: none !important; }

/* Right cluster: NSFW (yellow) · Reset · SFW (blue) — side by side */
.gs-stacks {
  position: absolute; top: 20px; right: 28px; z-index: 3;
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  max-width: calc(100% - 48px);
}
.gs-stack {
  position: relative; top: auto; right: auto;
  display: flex; flex-direction: row; align-items: center; gap: 10px;
}
.gs-stack .btn-room-reset,
.gs-stacks > .btn-room-reset {
  flex: 0 0 auto; margin: 0;
}
.gs-thumb {
  position: relative; top: auto; right: auto; flex: 0 0 auto;
  width: 76px; height: 76px; padding: 0; border: 2px solid #facc15; border-radius: 4px;
  background: #111; overflow: hidden; cursor: pointer;
}
.gs-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gs-thumb span {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.72); color: #facc15;
  font-family: var(--mono); font-size: 8px; letter-spacing: .4px;
  text-transform: uppercase; padding: 3px 2px; text-align: center;
}
.gs-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gs-thumb-sfw { border-color: #3b82f6; }
.gs-thumb-sfw span { color: #60a5fa; }
.gs-stack-div {
  width: 1px; height: 52px; flex: 0 0 1px;
  background: #475569; opacity: .85;
}
.gs-gal-links {
  display: flex; flex-direction: column; gap: 7px; flex: 0 0 auto;
}
.gs-gal-btn {
  font-family: var(--mono, monospace); font-size: 9px; font-weight: 700;
  letter-spacing: 0.7px; text-transform: uppercase; white-space: nowrap;
  color: #facc15; background: rgba(7, 17, 31, .85);
  border: 1px solid #facc15; border-radius: 3px;
  padding: 6px 10px; cursor: pointer; line-height: 1.2;
}
.gs-gal-btn:hover { background: rgba(250, 204, 21, .12); color: #fde68a; }
.gs-gal-btn-sfw {
  color: #60a5fa; border-color: #3b82f6;
}
.gs-gal-btn-sfw:hover { background: rgba(59, 130, 246, .14); color: #93c5fd; }
.gs-lb.is-sfw .gs-lb-title { color: #60a5fa; }
.gs-lb.is-sfw .gs-kind-toggle { display: none; }
.gs-cell.is-pick-sfw { border-color: #3b82f6; }

/* Quick Start gallery + viewer lightbox */
.gs-lb {
  display: none; position: fixed; z-index: 200; inset: 0;
  background: rgba(0,0,0,.72); align-items: center; justify-content: center; padding: 24px;
}
.gs-lb.open { display: flex; }
.gs-lb-panel {
  background: var(--surface, #161c2d); border: 1px solid var(--border, #1e2a45);
  border-radius: 4px; width: min(920px, 100%); max-height: 88vh; overflow: auto;
  padding: 18px 20px; color: var(--text, #e8eefc);
}
.gs-lb-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.gs-lb-head-left {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; min-width: 0;
}
.gs-lb-title {
  font-family: var(--mono, monospace); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: #facc15;
}
.gs-kind-toggle {
  display: inline-flex; border: 1px solid #facc15; border-radius: 3px; overflow: hidden;
}
.gs-kind-btn {
  font-family: var(--mono, monospace); font-size: 9px; font-weight: 700;
  letter-spacing: 0.7px; text-transform: uppercase;
  color: #facc15; background: transparent; border: 0;
  padding: 5px 10px; cursor: pointer; line-height: 1;
}
.gs-kind-btn + .gs-kind-btn { border-left: 1px solid #facc15; }
.gs-kind-btn.is-on { background: #facc15; color: #0b1220; }
.gs-kind-btn:hover:not(.is-on) { background: rgba(250, 204, 21, .12); }
.gs-lb-hint {
  margin: 12px 0 0; font-family: var(--mono, monospace); font-size: 10px;
  color: var(--text-dim, #7a8aaa); line-height: 1.4;
}
.gs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px; max-height: 58vh; overflow-y: auto; padding-right: 4px;
}
.gs-empty {
  grid-column: 1 / -1; padding: 28px 12px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--text-dim, #7a8aaa);
}
.gs-cell {
  position: relative; background: #111; border: 2px solid transparent;
  border-radius: 3px; overflow: hidden;
}
.gs-cell.is-pick { border-color: #facc15; }
.gs-cell-media {
  display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0;
  background: #0a0f1a; cursor: zoom-in; overflow: hidden;
}
.gs-cell-media img, .gs-cell-media video {
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
.gs-cell-actions {
  display: flex; gap: 6px; padding: 6px; background: rgba(0,0,0,.55);
}
.gs-cell-actions a {
  flex: 1; text-align: center; text-decoration: none;
  font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .4px;
  color: #e2e8f0; background: #1e293b; border: 1px solid #334155; border-radius: 2px;
  padding: 4px 2px;
}
.gs-cell-actions a:hover { border-color: #60a5fa; color: #fff; }
.gs-cell-remove {
  position: absolute; top: 6px; left: 6px; width: 24px; height: 24px;
  background: rgba(239,68,68,.9); border-radius: 50%; color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  z-index: 2; cursor: pointer; line-height: 1;
}
.gs-pager {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  margin-top: 12px; font-family: var(--mono, monospace); font-size: 11px;
}
.gs-pager-lbl { color: var(--text-dim, #7a8aaa); }

.gs-view {
  display: none; position: fixed; z-index: 260; inset: 0;
  background: rgba(0,0,0,.88); flex-direction: column;
  align-items: center; justify-content: center; padding: 48px 56px 72px;
}
.gs-view.open { display: flex; }
.gs-view-stage {
  flex: 1 1 auto; width: 100%; max-width: 1100px; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.gs-view-stage img, .gs-view-stage video {
  max-width: 100%; max-height: calc(100vh - 160px);
  object-fit: contain; display: block; border-radius: 2px;
  background: #000; box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
.gs-view-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 72px; border: 1px solid rgba(96,165,250,.45);
  background: rgba(7,17,31,.75); color: #93c5fd; font-size: 32px; line-height: 1;
  cursor: pointer; border-radius: 4px; z-index: 2;
}
.gs-view-nav:hover { background: rgba(29,78,216,.55); color: #fff; }
.gs-view-prev { left: 12px; }
.gs-view-next { right: 12px; }
.gs-view-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
}
.gs-view-count {
  font-family: var(--mono); font-size: 11px; color: #94a3b8; letter-spacing: .4px;
}
.gs-view-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gs-view-actions .btn { text-decoration: none; font-size: 12px; }

.btn-room-reset {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  background: transparent;
  color: #facc15;
  border: 2px solid #facc15;
  border-radius: 6px;
  padding: 7px 16px;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-start;
}
.btn-room-reset:hover { background: rgba(250, 204, 21, 0.12); }

/* Narrow-screen tools host (empty on desktop; site.js fills it under .page-divider) */
.page-tools-bar { display: none; }
.asset-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
/* Stack Save / Extend under the still / clip. Applied by attachAssetActions on
   every media host (Video Builder frames, pipeline stills, Character Pack, etc.). */
.stack-asset-actions {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  overflow: visible !important;
}
.stack-asset-actions > img,
.stack-asset-actions > video {
  width: 100%;
  flex-shrink: 0;
  display: block;
}
/* Square frame slots (Video Builder) keep the ratio on the media, not the cell. */
.frame-slot.stack-asset-actions > img,
.frame-slot.stack-asset-actions > video {
  aspect-ratio: 1;
  height: auto !important;
  max-height: none;
  object-fit: cover;
}
/* Widescreen slots (Scene Director clips) */
.frame-slot.stack-asset-actions[style*="16/9"] > img,
.frame-slot.stack-asset-actions[style*="16/9"] > video,
.frame-slot.stack-asset-actions[style*="16 / 9"] > img,
.frame-slot.stack-asset-actions[style*="16 / 9"] > video {
  aspect-ratio: 16 / 9;
}
/* Character pack slots — fixed still height, Save underneath */
.char-ref.stack-asset-actions {
  min-height: 140px;
}
.char-ref.stack-asset-actions > img {
  height: 140px !important;
  width: 100%;
  object-fit: cover;
  flex-shrink: 0;
}
.stack-asset-actions > .asset-actions {
  margin-top: 0;
  width: 100%;
  flex-shrink: 0;
  flex-direction: column;
  padding: 6px;
  box-sizing: border-box;
}
.stack-asset-actions > .asset-actions > button {
  width: 100%;
  flex: 0 0 auto;
  min-width: 0;
}
/* Open / Download bars: Save drops onto its own full-width row underneath. */
.output-links > .asset-actions,
.step-output-links > .asset-actions,
.final-output-links > .asset-actions {
  flex-basis: 100%;
  width: 100%;
  margin-top: 8px;
}
.output-links > .asset-actions > button,
.step-output-links > .asset-actions > button,
.final-output-links > .asset-actions > button {
  width: 100%;
  flex: 1 1 auto;
}
.asset-actions > button {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #fff;
}
.btn-save-library { background: #2a9d2a; }
.btn-extend-wan { background: #0e7490; }
.btn-extend-wan:hover { background: #155e75; }
.page-eyebrow { font-family: var(--mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 2.5px; color: var(--text-muted); margin-bottom: 6px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; color: var(--text); }
.page-title span { color: var(--accent); }
.page-divider { height: 1px; background: var(--border); margin: 20px 36px 0; }
.page-body { padding: 28px 36px 48px; flex: 1; }

/* ── CARDS ────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--surface2); display: flex; align-items: center; gap: 12px; }
.card-icon { width: 32px; height: 32px; background: var(--accent-grad); border-radius: 2px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; box-shadow: var(--shadow-blue); }
.card-title { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; color: var(--text); }
.card-subtitle { font-family: var(--mono); font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.card-body { padding: 20px; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); margin-bottom: 6px; }
.form-label .hint { font-weight: 400; font-size: 9px; text-transform: none; letter-spacing: 0; color: var(--text-muted); margin-left: 4px; }
.form-control { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 2px; color: var(--text); font-family: var(--mono); font-size: 12px; padding: 10px 12px; outline: none; transition: border-color var(--transition), box-shadow var(--transition); resize: vertical; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(59,130,246,0.12); }
textarea.form-control { min-height: 90px; line-height: 1.5; }
select.form-control option { background: var(--surface); color: var(--text); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--sans); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; padding: 11px 20px; border-radius: 2px; border: none; cursor: pointer; transition: all var(--transition); text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: var(--shadow-blue); }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 0 0 1px rgba(59,130,246,0.35); color: #fff; text-decoration: none; }
.btn-primary:disabled { background: var(--surface2); color: var(--text-muted); cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); }
.btn-secondary:hover { background: var(--surface); color: var(--text); border-color: var(--border-light); text-decoration: none; }
.btn-cancel { background: none; border: 2px solid var(--accent2); color: var(--accent2); display: none; }
.btn-cancel:hover { background: rgba(245,158,11,0.08); }
.btn-cancel.visible { display: inline-flex; }
.btn-full { width: 100%; }
.btn-sm { font-size: 10px; padding: 6px 12px; }

/* ── ACTION ROW ───────────────────────────────────────────── */
.action-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 4px; }

/* ── STATUS BOX ───────────────────────────────────────────── */
.status-box { display: none; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.status-box.visible { display: block; }
.status-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.done { border-top-color: var(--success); animation: none; }
.spinner.err  { border-top-color: var(--danger); animation: none; }
.status-text      { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 500; }
.status-text.done { color: var(--success); }
.status-text.err  { color: var(--danger); }
.log-area { padding: 10px 16px; max-height: 160px; overflow-y: auto; font-family: var(--mono); font-size: 11px; }
.log-line { display: flex; gap: 10px; padding: 2px 0; border-bottom: 1px solid rgba(42,53,86,0.5); line-height: 1.6; }
.log-line:last-child { border-bottom: none; }
.log-ts  { color: var(--text-muted); flex-shrink: 0; min-width: 58px; font-size: 10px; }
.log-msg { color: var(--text-dim); }
.log-msg.queue    { color: var(--accent2); }
.log-msg.progress { color: var(--accent); }
.log-msg.complete { color: var(--success); }
.log-msg.error    { color: var(--danger); }

/* Compact per-still logs on character pack cards */
.slot-log.log-area {
  margin-top: 4px;
  min-height: 44px;
  max-height: 72px;
  padding: 4px 8px;
  font-size: 9px;
  background: var(--bg2, var(--surface2));
  border: 1px solid var(--border);
  border-radius: 2px;
}
.slot-log .log-ts { min-width: 52px; font-size: 9px; }
.ss-btn.slot-gen { width: 100%; margin-top: 10px; }
.char-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ── PIPELINE LAYOUT ──────────────────────────────────────── */
.pipeline-layout { display: flex; align-items: flex-start; gap: 20px; }
.output-panel { display: none; flex-direction: column; gap: 0; flex: 1; min-width: 0; position: sticky; top: 24px; }
.output-panel.visible { display: flex; }
.output-panel-header { background: var(--surface2); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius) var(--radius) 0 0; padding: 13px 18px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.output-panel-body { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 2px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.output-placeholder { text-align: center; padding: 40px 20px; border: 2px dashed var(--border); border-radius: 2px; font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.output-panel-body img, .output-panel-body video { width: 100%; border-radius: 2px; border: 1px solid var(--border); display: block; }
.output-links { display: flex; gap: 8px; flex-wrap: wrap; }
.output-links a { font-family: var(--mono); font-size: 10px; color: var(--accent); border: 1px solid rgba(59,130,246,0.3); padding: 5px 10px; border-radius: 2px; text-decoration: none; text-transform: uppercase; letter-spacing: 1px; transition: background var(--transition); }
.output-links a:hover { background: var(--accent-glow); }
.output-links a.dl { color: var(--success); border-color: rgba(34,197,94,0.3); }
details summary { font-family: var(--mono); font-size: 10px; color: var(--text-dim); cursor: pointer; text-transform: uppercase; letter-spacing: 1px; padding: 4px 0; }
details pre { font-family: var(--mono); font-size: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 2px; padding: 10px; overflow-x: auto; color: var(--text-dim); margin-top: 6px; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow-y: auto; }

/* ── PIPELINE FORM CARD ───────────────────────────────────── */
.pipeline-form-card { width: 100%; max-width: 520px; flex-shrink: 0; }

/* ── DROP ZONE ────────────────────────────────────────────── */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 20px; text-align: center; cursor: pointer; transition: border-color var(--transition), background var(--transition); position: relative; background: var(--bg2); }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-glow); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-icon { font-size: 26px; margin-bottom: 8px; }
.drop-text { font-size: 12px; color: var(--text-dim); }
.drop-text span { color: var(--accent); }
.preview-wrap { display: none; margin-top: 12px; position: relative; max-width: 100%; }
.preview-wrap img,
.preview-wrap video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: #000;
}
.clip-start-toggle { display: flex; gap: 6px; margin-bottom: 8px; }
.clip-start-toggle button {
  flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 7px 8px; border-radius: 2px; cursor: pointer;
}
.clip-start-toggle button.on { border-color: #facc15; color: #fff; background: rgba(250,204,21,0.12); }
.preview-clear { position: absolute; top: 6px; right: 6px; background: var(--danger); border: none; color: #fff; font-size: 10px; font-family: var(--mono); padding: 3px 8px; border-radius: 2px; cursor: pointer; }
.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-dim); margin: 12px 0; }
.toggle-row span { flex: 1; text-align: center; }
.toggle-btn { background: none; border: 1px solid var(--border); color: var(--accent); font-family: var(--mono); font-size: 10px; padding: 4px 10px; border-radius: 2px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; transition: background var(--transition); }
.toggle-btn:hover { background: var(--accent-glow); }
.url-field { display: none; }

/* ── SEED ROW ─────────────────────────────────────────────── */
.seed-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.seed-row .rand-btn { background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); font-size: 18px; padding: 8px 14px; border-radius: 2px; cursor: pointer; line-height: 1; transition: all var(--transition); }
.seed-row .rand-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── DASHBOARD WORKFLOW GRID ──────────────────────────────── */
.workflow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.workflow-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-decoration: none; display: flex; flex-direction: column; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); position: relative; animation: fadeUp 0.35s ease both; }
@keyframes fadeUp { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform: translateY(0); } }
.workflow-card:nth-child(1) { animation-delay:0.04s; } .workflow-card:nth-child(2) { animation-delay:0.08s; }
.workflow-card:nth-child(3) { animation-delay:0.12s; } .workflow-card:nth-child(4) { animation-delay:0.16s; }
.workflow-card:nth-child(5) { animation-delay:0.20s; }
.workflow-card:hover {  box-shadow: var(--shadow-blue); border-color: var(--accent); text-decoration: none; }
.workflow-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background:var(--accent-grad); opacity:0; transition: opacity var(--transition); }
.workflow-card:hover::before { opacity:1; }
.wf-thumb { height: 90px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: var(--bg2); }
.wf-thumb-icon { font-size: 38px; position: relative; z-index: 1; transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1); }
.workflow-card:hover .wf-thumb-icon { transform: scale(1.12); }
.wf-type-badge { position: absolute; top: 8px; right: 8px; font-family: var(--mono); font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 1.5px; padding: 3px 7px; border-radius: 2px; border: 1px solid; }
.badge-img  { color: var(--accent);  border-color: rgba(59,130,246,0.3);  background: rgba(59,130,246,0.1); }
.badge-vid  { color: var(--success); border-color: rgba(34,197,94,0.3);   background: rgba(34,197,94,0.1); }
.badge-edit { color: var(--accent2); border-color: rgba(245,158,11,0.3);  background: rgba(245,158,11,0.1); }
.badge-fix  { color: var(--accent3); border-color: rgba(6,182,212,0.3);   background: rgba(6,182,212,0.1); }
.wf-body { padding: 10px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.wf-name  { font-size: 13px; font-weight: 800; letter-spacing: -0.2px; color: var(--text); }
.wf-model { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.wf-desc  { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin-top: 4px; flex: 1; }
.wf-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.wf-hw { font-family: var(--mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.wf-arrow { width: 24px; height: 24px; border-radius: 2px; background: var(--surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-dim); transition: all var(--transition); }
.workflow-card:hover .wf-arrow { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── LIBRARY ──────────────────────────────────────────────── */
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.lib-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow var(--transition), border-color var(--transition); }
.lib-item:hover { box-shadow: var(--shadow-blue); border-color: var(--border-light); }
.lib-item.selected { border-color: #facc15; box-shadow: 0 0 0 1px #facc15; }
.lib-item.selected:hover { border-color: #facc15; box-shadow: 0 0 0 1px #facc15; }
.lib-prompt-box {
  width: 100%; box-sizing: border-box; resize: none; display: block;
  margin: 2px 0 0; padding: 5px 7px;
  font-family: var(--mono); font-size: 10px; line-height: 1.45;
  color: var(--text); background: var(--surface2);
  border: 1px solid var(--border); border-radius: 2px;
  white-space: pre-wrap; overflow-y: auto; cursor: text;
}
.lib-prompt-box:focus { outline: none; border-color: var(--accent3); }
.lib-reuse-btn {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--accent3); background: none;
  border: 1px solid rgba(6,182,212,0.3); border-radius: 2px;
  padding: 3px 8px; cursor: pointer; line-height: 1.4;
}
.lib-reuse-btn:hover { background: rgba(6,182,212,0.12); }
.lib-thumb { aspect-ratio: 1; background: var(--bg2); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.lib-thumb img, .lib-thumb video { width: 100%; height: 100%; object-fit: cover; }
.lib-thumb .lib-placeholder { font-size: 32px; color: var(--border); }
.lib-status { position: absolute; bottom: 6px; right: 6px; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.09em; padding: 2px 6px; border-radius: 2px; border: 1px solid currentColor; text-transform: uppercase; }
.lib-status.submitted, .lib-status.SUBMITTED { background: rgba(245,158,11,0.15); color: var(--accent2); }
.lib-status.completed,  .lib-status.COMPLETED { background: rgba(34,197,94,0.12);  color: var(--success); }
.lib-status.failed  { background: rgba(239,68,68,0.12);  color: var(--danger); }
.lib-status.review  { background: rgba(6,182,212,0.15);  color: var(--accent3); }
.lib-status.running { background: rgba(59,130,246,0.15); color: var(--accent); }
.lib-meta { padding: 10px 12px; }
.lib-wf     { font-family: var(--mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 3px; }
.lib-prompt { font-size: 11px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lib-date   { font-family: var(--mono); font-size: 9px; color: var(--text-muted); margin-top: 6px; }
.lib-actions { display: flex; gap: 6px; padding: 0 12px 10px; flex-wrap: wrap; }
.lib-actions a { font-family: var(--mono); font-size: 9px; color: var(--accent); border: 1px solid rgba(59,130,246,0.25); padding: 3px 8px; border-radius: 2px; text-decoration: none; text-transform: uppercase; }
.lib-delete { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; background: rgba(239,68,68,0.85); border: none; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--transition); line-height: 1; }
.lib-item:hover .lib-delete { opacity: 1; }
.lib-delete:hover { background: var(--danger); transform: scale(1.1); }
.lib-expiry-warn { position: absolute; bottom: 30px; right: 6px; font-family: var(--mono); font-size: 9px; padding: 2px 6px; border-radius: 2px; background: rgba(245,158,11,0.85); color: #fff; text-transform: uppercase; letter-spacing: 0.5px; }
.lib-footer { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 10px; gap: 8px; }
.expiry-badge { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: 1px; padding: 2px 7px; border-radius: 2px; border: 1px solid; }
.xxx-cap-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 2px 7px;
  border-radius: 2px;
  border: 1px solid #facc15;
  color: #facc15;
  background: rgba(250, 204, 21, 0.08);
  flex-shrink: 0;
}
.expiry-ok       { color: var(--success); border-color: rgba(34,197,94,0.3);  background: rgba(34,197,94,0.08); }
.expiry-warn     { color: var(--accent2); border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.08); }
.expiry-critical { color: var(--danger);  border-color: rgba(239,68,68,0.3);  background: rgba(239,68,68,0.08); }
.lib-delete-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: 11px; width: 24px; height: 24px; border-radius: 2px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition); padding: 0; line-height: 1; }
.lib-delete-btn:hover { background: rgba(239,68,68,0.08); border-color: var(--danger); color: var(--danger); }
.lib-delete-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── EXPIRY / NOTICE BANNERS ──────────────────────────────── */
.expiry-banner { display: flex; align-items: flex-start; gap: 12px; background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.2); border-left: 4px solid var(--accent2); border-radius: var(--radius); padding: 14px 18px; font-size: 13px; color: var(--text); margin-bottom: 24px; line-height: 1.5; }
.expiry-banner .expiry-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.expiry-banner strong { color: var(--accent2); }
.cleanup-notice { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.2); border-radius: var(--radius); padding: 10px 16px; font-family: var(--mono); font-size: 11px; color: var(--success); margin-bottom: 16px; }
.library-notice { display: flex; align-items: flex-start; gap: 12px; background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.2); border-left: 4px solid var(--accent2); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.notice-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.library-notice strong { color: var(--text); }

/* ── SECTION / COUNT BADGES ───────────────────────────────── */
.section-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-label h2 { font-size: 11px; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 2px; color: var(--text-dim); }
.count-badge { font-family: var(--mono); font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-dim); background: var(--surface2); border: 1px solid var(--border); padding: 3px 7px; border-radius: 2px; }
.stats-row { display: flex; gap: 20px; padding-bottom: 4px; }
.stat-box { text-align: right; }
.stat-num   { font-size: 22px; font-weight: 800; font-family: var(--mono); color: var(--text); line-height: 1; }
.stat-label { font-size: 9px; font-family: var(--mono); text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); margin-top: 2px; }

/* ── IDENTITY PAGES ───────────────────────────────────────── */
.main-content > .row, .main-content > h1, .main-content > h2, .main-content > h3, .main-content > form, .main-content > p { padding-left: 36px; padding-right: 36px; }
.main-content > .row { padding-top: 32px; margin-left: 0; margin-right: 0; }

/* ── UTILITY ──────────────────────────────────────────────── */
.spacer-16 { height: 16px; } .spacer-24 { height: 24px; } .spacer-32 { height: 32px; }
.text-dim { color: var(--text-dim); } .mono { font-family: var(--mono); }

/* ── PIPELINE STUDIO ──────────────────────────────────────── */
.studio-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: flex-start; }
.studio-layout.solo { grid-template-columns: 1fr; justify-items: center; }
.studio-recent { display: flex; flex-direction: column; gap: 8px; }
.recent-session-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; transition: border-color var(--transition); }
.recent-session-card:hover { border-color: var(--accent); }
.recent-name { font-size: 13px; font-weight: 700; color: var(--text); text-decoration: none; display: block; margin-bottom: 4px; }
.recent-name:hover { color: var(--accent); text-decoration: none; }
.recent-meta { display: flex; justify-content: space-between; margin-bottom: 8px; }
.progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-grad); border-radius: 2px; transition: width 0.4s ease; }
.workflow-picker { display: flex; flex-direction: column; gap: 6px; }
.wf-pick-item { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 2px; padding: 8px 12px; transition: all var(--transition); }
.wf-pick-item:hover { border-color: var(--accent); background: var(--accent-glow); }
.wf-pick-icon { font-size: 16px; }
.wf-pick-name { font-size: 13px; font-weight: 600; flex: 1; color: var(--text); }
.wf-pick-badge { font-family: var(--mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.wf-pick-add { background: var(--accent-grad); border: none; color: #fff; width: 22px; height: 22px; border-radius: 2px; cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all var(--transition); }
.wf-pick-add:hover { box-shadow: var(--shadow-blue); transform: scale(1.1); }
.pipeline-builder { min-height: 60px; background: var(--bg2); border: 2px dashed var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pipeline-empty { font-family: var(--mono); font-size: 11px; color: var(--text-muted); text-align: center; width: 100%; }
.pipeline-step-chip { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 2px; padding: 5px 10px; font-size: 12px; font-weight: 600; transition: border-color var(--transition); }
.pipeline-step-chip:hover { border-color: var(--accent); }
.chip-num     { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.chip-icon    { font-size: 14px; }
.chip-name    { color: var(--text); }
.chip-remove  { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 0; line-height: 1; transition: color var(--transition); }
.chip-remove:hover { color: var(--danger); }
.chip-arrow   { color: var(--text-muted); font-size: 12px; }
.chip-produces { font-size: 11px; opacity: 0.6; flex-shrink: 0; }
.chip-incompat { color: var(--accent2); font-size: 13px; flex-shrink: 0; cursor: help; }
.wf-pick-produces { font-size: 10px; opacity: 0.5; margin-left: auto; margin-right: 6px; flex-shrink: 0; }

/* Session layout */
.studio-session-layout { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: flex-start; }
.step-rail { display: flex; flex-direction: column; gap: 0; position: sticky; top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.step-rail-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); }
.step-rail-item:last-of-type { border-bottom: none; }
.step-rail-item:hover    { background: var(--bg2); }
.step-rail-item.current  { background: var(--accent-glow); border-left: 3px solid var(--accent); }
.step-rail-item.accepted { opacity: 0.6; }
.step-rail-item.locked   { opacity: 0.4; }
.step-rail-num { width: 22px; height: 22px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; font-weight: 600; flex-shrink: 0; }
.step-rail-item.current  .step-rail-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-rail-item.accepted .step-rail-num { background: var(--success); border-color: var(--success); color: #fff; }
.step-rail-info { flex: 1; min-width: 0; }
.step-rail-name   { font-size: 11px; font-weight: 700; color: var(--text); }
.step-rail-status { font-family: var(--mono); font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.step-rail-icon   { font-size: 14px; flex-shrink: 0; }
.step-connector   { height: 1px; background: var(--border); }
.step-connector.done { background: var(--success); }
.step-complete-badge { padding: 14px; text-align: center; font-weight: 700; color: var(--success); font-size: 13px; }
.step-panel { display: none; }
.step-panel.active { display: block; }
.step-panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.step-num-badge { font-family: var(--mono); font-size: 10px; background: var(--accent-grad); color: #fff; padding: 3px 8px; border-radius: 2px; text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0; }
.step-wf-name  { font-size: 16px; font-weight: 800; color: var(--text); }
.step-attempt  { font-family: var(--mono); font-size: 10px; color: var(--text-muted); margin-left: auto; }
.step-output { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.step-output-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-dim); margin-bottom: 10px; }
.step-output-media { width: 100%; border-radius: 2px; border: 1px solid var(--border); display: block; margin-bottom: 10px; }
.step-output-links { display: flex; gap: 8px; }
.prefill-img-wrap { margin-bottom: 8px; }
.prefill-img { width: 100%; max-height: 160px; object-fit: contain; border-radius: 2px; border: 1px solid rgba(34,197,94,0.4); display: block; }

.review-gate { background: rgba(59,130,246,0.05); border: 1px solid rgba(59,130,246,0.2); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 16px; margin-top: 16px; }
.review-gate-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 12px; }
.review-gate-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.review-accept { background: var(--success); color: #fff; border: none; flex: 1; min-width: 140px; }
.review-accept:hover { background: #16a34a; color: #fff; }
.review-rerun { background: var(--surface2); border: 1px solid var(--accent2); color: var(--accent2); flex: 1; min-width: 140px; }
.review-rerun:hover { background: rgba(245,158,11,0.08); color: var(--accent2); }
.review-reject { background: none; border: 1px solid var(--border); color: var(--text-dim); }
.review-reject:hover { border-color: var(--danger); color: var(--danger); }
.step-accepted-banner { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.2); border-radius: 2px; padding: 10px 14px; font-size: 13px; color: var(--success); font-weight: 600; margin-top: 12px; }
.session-complete { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.studio-builder { max-width: 760px; width: 100%; }
.studio-layout:has(> .studio-builder:only-child) { display: flex; justify-content: center; }
.studio-layout:has(> .studio-builder:only-child) .studio-builder { max-width: 860px; }
.session-delete-btn { background: none; border: none; color: var(--text-muted); font-size: 14px; cursor: pointer; padding: 0 2px; line-height: 1; flex-shrink: 0; transition: color var(--transition); }
.session-delete-btn:hover { color: var(--danger); }

/* ── ACTIVE STEP LAYOUT ───────────────────────────────────── */
.active-step-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: flex-start; }
.step-main { min-width: 0; }
.step-progress-bar { margin-bottom: 4px; }
.step-progress-label { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.step-progress-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.step-progress-fill { height: 100%; background: var(--accent-grad2); border-radius: 2px; transition: width 0.5s ease; }

.prefill-banner { display: flex; gap: 12px; align-items: flex-start; background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.2); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.prefill-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 2px; border: 1px solid rgba(34,197,94,0.3); flex-shrink: 0; }
.prefill-info { flex: 1; min-width: 0; }
.prefill-label { font-size: 11px; font-weight: 700; color: var(--success); margin-bottom: 4px; }
.prefill-url { font-family: var(--mono); font-size: 9px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final-outputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 20px 0; }
.final-output-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.final-output-item img, .final-output-item video { width: 100%; display: block; }
.final-output-links { display: flex; gap: 6px; padding: 8px; }

/* ── AI DESCRIPTION PANEL ─────────────────────────────────── */
.ai-desc-panel { margin-top: 12px; border: 1px solid var(--border); border-radius: 2px; overflow: hidden; display: none; }
.ai-desc-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface2); cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.ai-desc-header:hover { background: var(--bg2); }
.ai-desc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); }
.ai-desc-toggle { font-size: 10px; color: var(--text-dim); }
.ai-desc-body { padding: 12px 14px; background: var(--bg2); }
.ai-desc-loading { font-family: var(--mono); font-size: 11px; color: var(--text-dim); padding: 4px 0; }
.ai-desc-text { width: 100%; min-height: 80px; font-size: 12px; line-height: 1.6; resize: vertical; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-family: var(--sans); }
.ai-desc-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
.nav-burger { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 700px) {
  .studio-layout, .studio-session-layout, .active-step-layout { grid-template-columns: 1fr; }
  .step-rail { position: static; display: flex; flex-direction: row; overflow-x: auto; }
}

/* Phone / narrow: match JemaLTX — form + Generate first, outputs inline under.
   Custom rooms that never used .pipeline-layout (Tyge 1fr 360px, Jema/Sdxl
   1fr 1fr, Orch inline shells, Video Builder frames, etc.) get the same stack. */
@media (max-width: 820px) {
  /* Off-canvas nav — reclaim the fixed 230px so Generate isn't trapped */
  body:not(.no-sidebar) .sidebar {
    width: var(--sidebar-w-open);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  body:not(.no-sidebar).nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.45);
  }
  body:not(.no-sidebar) .main-content {
    margin-left: 0 !important;
  }
  .nav-burger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 120;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
  }
  body.no-sidebar .nav-burger { display: none; }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.55);
  }
  body.nav-open .sidebar-backdrop { display: block; }

  .page-header {
    padding-left: 56px !important;
    padding-right: 16px !important;
  }
  /* Undo desktop reservation for absolute Get Started cluster — tools live under the divider. */
  .page-header:has(.gs-stacks),
  .page-header:has(.gs-stack) {
    padding-right: 16px !important;
  }
  .page-header:has(.gs-stacks) + .jema-guide,
  .page-header:has(.gs-stack) + .jema-guide {
    margin-right: 14px !important;
  }
  .page-divider {
    margin-left: 14px !important;
    margin-right: 14px !important;
  }
  /* Second header row: Reset · Get Started · Galleries (relocated by site.js) */
  .page-tools-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 4px 56px;
    min-height: 0;
  }
  .page-tools-bar .gs-stacks {
    position: static;
    top: auto;
    right: auto;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-tools-bar .gs-stack {
    gap: 8px;
  }
  .page-tools-bar .gs-thumb {
    width: 64px;
    height: 64px;
  }
  .page-tools-bar .gs-stack-div {
    height: 44px;
  }
  .page-body,
  .pipeline-room .page-body {
    padding: 16px 14px 40px !important;
    max-width: 100%;
  }
  .jema-guide { margin-left: 14px !important; margin-right: 14px !important; }

  .pipeline-layout {
    flex-direction: column;
    align-items: stretch;
  }
  .pipeline-form-card {
    order: 1;
    max-width: 100%;
    width: 100%;
  }
  .output-panel,
  .output-panel.visible {
    order: 2;
    position: static;
    width: 100%;
    top: auto;
  }

  /* Defeat inline multi-column grids on every room */
  .page-body [style*="grid-template-columns"],
  .page-body [style*="grid-template-columns "] {
    grid-template-columns: 1fr !important;
  }
  .orch-shell,
  .lsl-grid,
  .lsl-row,
  .lsl-row3,
  .char-slots,
  .frame-picks,
  .room-form-output {
    grid-template-columns: 1fr !important;
  }

  #out-t2i {
    min-height: 240px !important;
    width: 100%;
  }
}

/* ══════════════════════════════════════════════════════════
   site.css PATCH — append to end of site.css
   ══════════════════════════════════════════════════════════

   Fixes:
   1. Max content width ~70% on all pages
   2. More top padding on pipeline/model pages
   3. Workflow card tiles visible in dark theme
   ══════════════════════════════════════════════════════════ */

/* ── FIX 1: Content max width ─────────────────────────────── */
/* Constrains all page content to ~70% — comfortable reading
   width without stretching edge to edge on wide monitors     */
.page-body {
  max-width: 1080px;
}

/* ── FIX 2: Top padding on model/pipeline pages ───────────── */
/* Pipeline pages have .pipeline-layout as the first child
   inside .page-body — the .page-header above needs more air  */
.page-header {
  padding-top: 40px;
}

/* ── FIX 3: Workflow card tiles visible in dark theme ─────── */
/* Cards need stronger contrast against the dark bg           */
.workflow-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: none;
}

.workflow-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-blue);
  
}

/* Thumb area — taller, more visual impact */
.wf-thumb {
  height: 110px;
  position: relative;
}

/* Accent top stripe appears on hover */
.workflow-card::before {
  background: var(--accent-grad);
}

/* Emoji icon bigger and brighter */
.wf-thumb-icon {
  font-size: 42px;
  
}

/* Card body — add model line back for visual weight */
.wf-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

/* Arrow button more visible */
.wf-arrow {
  background: var(--surface2);
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  font-size: 13px;
}
.workflow-card:hover .wf-arrow {
  background: var(--accent-grad);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-blue);
}

/* Hardware tag */
.wf-hw {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-muted);
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 2px;
}

/* Section label headings */
.section-label h2 {
  color: var(--text-dim);
  font-size: 11px;
}

/* Workflow grid — min tile width bumped slightly */
.workflow-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

/* ── Pipeline room backdrop — vertically tiled ComfyUI watermark ──────────────
   Scoped to .pipeline-room (set on <main> for PipelinePageBase rooms only),
   so generation rooms get the backdrop while Library / Intelligence pages stay clean.
   Asset lives at wwwroot/assets/cui2.png → served at /assets/cui2.png. */
.pipeline-room .page-body {
    background-image: url('/assets/cui2.png');
    background-repeat: repeat-y;
    background-position: top center;
}

.ltx-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.ltx-prompt-head .form-label { margin-bottom: 0; }
.ltx-guide-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(8, 13, 22, 0.82);
  padding: 18px 12px;
  overflow: auto;
}
.ltx-guide-overlay.open { display: flex; align-items: flex-start; justify-content: center; }
.ltx-guide-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 16px 16px 20px;
}
.ltx-guide-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ltx-guide-top h2 {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}
.ltx-guide-note {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
  margin: 0 0 14px;
}
.ltx-guide-layer { margin-bottom: 14px; }
.ltx-guide-layer h3 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent3);
  margin: 0 0 8px;
}
.ltx-chip-row { display: flex; flex-direction: column; gap: 6px; }
.ltx-chip {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 8px 10px;
}
.ltx-chip.on { border-color: #facc15; box-shadow: 0 0 0 1px #facc15; }
.ltx-chip-label { font-size: 12px; font-weight: 700; color: #fff; }
.ltx-chip-text { font-size: 11px; color: var(--text-dim); line-height: 1.45; margin-top: 4px; }
.ltx-guide-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ── Pricing / forge cards (CUI blue, not Forge red) ───────── */
.pricing-page { padding: 8px 28px 32px; }
.pricing-back-row { margin: 0 0 10px; }
.pricing-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; font-weight: 800;
  color: var(--text); text-decoration: none;
  border: 1px solid var(--border-light); background: rgba(255,255,255,0.04);
  border-radius: 2px; padding: 6px 12px;
}
.pricing-back:hover { border-color: var(--accent); color: #fff; background: var(--accent-glow); text-decoration: none; }
.pricing-back span { font-size: 14px; line-height: 1; }
.pricing-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.pricing-hero-main { flex: 1; min-width: 0; }
.pricing-lead {
  font-size: 15px;
  font-weight: 700;
  margin: 8px 0 0;
  color: var(--text);
}
.pricing-tagline {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.1;
  margin: 8px 0 0;
  color: var(--text);
}
.pricing-topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px; margin-bottom: 18px;
}
.compare-pill, .currency-pill {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-light); background: rgba(255,255,255,0.06);
  color: var(--text); text-decoration: none; border-radius: 2px; padding: 6px 10px;
  font-family: var(--mono); font-size: 10px; font-weight: 800;
}
.compare-pill { color: #f4ff44; box-shadow: 0 0 0 1px rgba(59,130,246,0.25); }
.currency-pill { justify-self: end; color: var(--text-dim); }
.currency-pill strong { color: var(--text); }
.billing-toggle {
  justify-self: center; display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.035); border: 1px solid var(--border); border-radius: 2px; padding: 3px;
}
.billing-toggle a {
  color: var(--text-muted); text-decoration: none; padding: 5px 10px; border-radius: 2px;
  font-family: var(--mono); font-size: 11px; font-weight: 800;
}
.billing-toggle a.active {
  color: white; background: rgba(59,130,246,0.22); border: 1px solid rgba(59,130,246,0.42);
}
.billing-toggle a span { color: #f4ff44; font-size: 9px; }
.pricing-header {
  margin-bottom: 0;
  padding: 0;
  display: block;
}
.pricing-header-copy { min-width: 0; max-width: 820px; }
.pricing-hero-art {
  display: block;
  width: 210px;
  height: 210px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.pricing-subtitle { color: var(--text-dim); max-width: 820px; font-size: 13px; margin-top: 6px; }
.pricing-notice {
  border: 1px solid rgba(59,130,246,0.35); background: rgba(59,130,246,0.10);
  color: var(--text); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 11px;
}
.pricing-notice.subtle { border-color: var(--border); background: rgba(255,255,255,0.035); color: var(--text-dim); }
/* Five plans always share one row on desktop; cards shrink/narrow rather than wrap. */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  width: 100%;
}
.pricing-card {
  background: #161c2d; border: 1px solid var(--border-light); border-radius: 2px;
  overflow: hidden; min-height: 0; position: relative;
  display: flex; flex-direction: column;
}
.pricing-card.free-tier { border-color: var(--border-light); }
.pricing-card .product-code {
  font-family: var(--mono); font-size: 9px; font-weight: 900; letter-spacing: .04em;
  color: #93c5fd; border: 1px solid rgba(59,130,246,0.45); border-radius: 2px;
  padding: .12rem .32rem; white-space: nowrap;
}
.pricing-card-body {
  padding: 14px 12px 14px;
  display: flex; flex-direction: column; flex: 1; min-width: 0;
  gap: 0;
}
.pricing-card-main { flex: 1 1 auto; min-width: 0; }
.pricing-card-footer { margin-top: auto; padding-top: 14px; flex-shrink: 0; }
.pricing-card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pricing-card h2 { font-size: 16px; line-height: 1.1; color: var(--text); margin: 0; }
.pricing-card.popular h2 { color: #93c5fd; }
.pricing-card-subtitle {
  min-height: 0; color: var(--text); font-size: 10px; font-weight: 700;
  margin: 8px 0 12px; line-height: 1.35;
}
.price-line { display: flex; align-items: baseline; gap: 4px; margin: 6px 0 2px; flex-wrap: wrap; }
.price-line strong { font-family: var(--mono); color: white; font-size: 22px; font-weight: 900; letter-spacing: -1px; }
.price-line span { font-family: var(--mono); color: var(--text); font-size: 10px; font-weight: 800; }
.discount-price-line {
  display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; margin: 6px 0 2px;
}
.discount-price-line .regular-price {
  text-decoration: line-through; opacity: .55; font-size: 1rem; font-weight: 800;
}
.discount-price-line .discount-price { font-size: 1.55rem; font-weight: 950; color: #fff; }
.discount-price-line .discount-badge {
  font-size: .68rem; font-weight: 950; color: #111; background: #fff200;
  border-radius: 2px; padding: .16rem .36rem; white-space: nowrap;
}
.billing-note { color: var(--text-muted); font-family: var(--mono); font-size: 9px; min-height: 16px; }
.pricing-action-form { margin-top: 0; padding-top: 0; }
.pricing-btn {
  width: 100%; height: 34px; border-radius: 2px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; font-weight: 900; transition: border-color .12s, box-shadow .12s;
}
.pricing-btn span { font-size: 18px; vertical-align: -1px; padding-left: 8px; }
.pricing-btn.primary { background: var(--accent); border: 1px solid var(--accent); color: white; }
.pricing-btn.secondary { background: transparent; border: 1px solid var(--border-light); color: white; }
.pricing-btn:hover { box-shadow: var(--shadow-blue); }
.pricing-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.pricing-divider { height: 1px; background: var(--border); margin: 12px 0; }
.pricing-card h3 { color: white; font-size: 10px; margin: 10px 0 6px; }
.pricing-card h3.pricing-not-included { color: #94a3b8; margin-top: 12px; }
.feature-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.feature-list li { display: flex; align-items: flex-start; gap: 5px; color: #cbd5e1; font-size: 10px; line-height: 1.35; }
.feature-list .check { color: white; font-family: var(--mono); flex-shrink: 0; }
.feature-list-out li { color: #94a3b8; }
.feature-list-out .check { color: #e85d5d; }
.feature-list strong { color: #93c5fd; }
.feature-list strong:not(.highlight) { color: white; }
.feature-list-out strong,
.feature-list-out strong:not(.highlight) { color: #cbd5e1; font-weight: 600; }
.artificer-tiles {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.artificer-tile {
  border: 1px solid var(--border-light);
  border-radius: 2px;
  overflow: hidden;
  background: #0b0f18;
}
.artificer-tile img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.compare-panel {
  margin-top: 18px; border: 1px solid var(--border-light); border-radius: 2px;
  background: rgba(59,130,246,0.12);
  padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.compare-panel h2 { font-size: 18px; margin-bottom: 4px; }
.compare-panel p { color: var(--text-dim); font-size: 12px; }
.compare-panel-btn {
  color: white; border: 1px solid rgba(59,130,246,0.50); padding: 8px 12px; border-radius: 2px;
  text-decoration: none; font-family: var(--mono); font-size: 10px; font-weight: 900; white-space: nowrap;
}

/* Keep all five cards on one row until the viewport is phone-narrow. */
@media (max-width: 720px) {
  .pricing-topbar { grid-template-columns: 1fr; }
  .compare-pill, .billing-toggle, .currency-pill { justify-self: stretch; justify-content: center; }
  .pricing-hero { flex-direction: column; }
  .pricing-hero-art { width: 148px; height: 148px; }
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-action-form { margin-top: 18px; padding-top: 0; }
  .compare-panel { flex-direction: column; align-items: flex-start; }
}

/* ── Clio Styles library ───────────────────────────────────── */
.clio-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin-bottom: 16px; position: sticky; top: 0; z-index: 5;
  padding: 10px 0 12px;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
}
.clio-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.clio-chip {
  font-family: var(--mono); font-size: 10px; letter-spacing: .4px;
  text-transform: uppercase; padding: 5px 10px; border-radius: 2px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); cursor: pointer; line-height: 1;
}
.clio-chip:hover { color: var(--text); border-color: var(--border-light); }
.clio-chip.is-on {
  color: #fff; border-color: var(--accent); background: var(--accent-glow);
}
.clio-chip .clio-chip-n {
  margin-left: 5px; opacity: .65; font-size: 9px;
}
.clio-search-wrap {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
}
.clio-search {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 2px; color: var(--text); padding: 6px 10px;
  width: min(240px, 55vw);
}
.clio-search:focus { outline: none; border-color: var(--accent); }
.clio-count {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim); white-space: nowrap;
}
.clio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}
.clio-empty {
  grid-column: 1 / -1; padding: 36px 12px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}
.clio-tile {
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: 2px;
  overflow: hidden; cursor: pointer; aspect-ratio: 1;
  content-visibility: auto; contain-intrinsic-size: 160px 160px;
  transition: border-color var(--transition), transform var(--transition);
}
.clio-tile:hover, .clio-tile:focus-visible {
  border-color: var(--accent); transform: translateY(-2px);
}
.clio-tile.is-fav { border-color: var(--accent2); }
.clio-tile.is-pick { border-color: #facc15; }
.clio-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: #0a0f1a;
}
.clio-tile-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 8px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  font-family: var(--mono); font-size: 9px; color: #e8edf5;
  line-height: 1.25; letter-spacing: .2px;
}
.clio-tile-fav {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  border: 0; border-radius: 2px; background: rgba(0,0,0,.55);
  color: var(--accent2); font-size: 12px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.clio-tile-fav:hover { background: rgba(0,0,0,.8); }

.clio-detail {
  display: none; position: fixed; z-index: 220; inset: 0;
  background: rgba(0,0,0,.72); align-items: center; justify-content: center;
  padding: 24px;
}
.clio-detail.open { display: flex; }
.clio-detail-panel {
  position: relative; display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(280px, 1fr);
  gap: 0; width: min(860px, 100%); max-height: 88vh;
  background: var(--surface); border: 1px solid var(--border); border-radius: 2px;
  overflow: hidden;
}
.clio-detail-close {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 28px; height: 28px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); cursor: pointer;
  font-size: 12px; border-radius: 2px;
}
.clio-detail-media { background: #0a0f1a; min-height: 280px; }
.clio-detail-media img {
  width: 100%; height: 100%; object-fit: cover; display: block; min-height: 280px;
}
.clio-detail-body {
  padding: 18px 20px 16px; overflow-y: auto; max-height: 88vh;
}
.clio-detail-section {
  font-family: var(--mono); font-size: 9px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent3); margin-bottom: 4px;
}
.clio-detail-name {
  font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 10px;
  line-height: 1.25;
}
.clio-detail-prose {
  font-size: 12px; color: var(--text-dim); line-height: 1.55;
  margin-bottom: 14px; max-height: 160px; overflow-y: auto;
}
.clio-detail-label {
  display: block; font-family: var(--mono); font-size: 9px;
  letter-spacing: .8px; text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 6px;
}
.clio-detail-actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
}
.clio-detail-actions .btn { font-size: 11px; padding: 5px 12px; }
.clio-detail-msg {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  margin-top: 10px; min-height: 14px;
}

/* Shared Styles picker overlay (in-room) */
.clio-lb {
  display: none; position: fixed; z-index: 210; inset: 0;
  background: rgba(0,0,0,.72); align-items: center; justify-content: center;
  padding: 20px;
}
.clio-lb.open { display: flex; }
.clio-lb-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 2px; width: min(980px, 100%); max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.clio-lb-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.clio-lb-title {
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: #facc15;
}
.clio-lb-body { padding: 12px 16px 16px; overflow: auto; flex: 1; min-height: 0; }
.clio-lb-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 10px 16px; border-top: 1px solid var(--border);
  background: var(--surface2);
}
.clio-lb-pick-name {
  font-family: var(--mono); font-size: 11px; color: var(--text); flex: 1; min-width: 120px;
}
.clio-lb-strength {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
}
.clio-lb-strength input[type=range] { width: 110px; }
.clio-prompt-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.clio-style-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; color: var(--accent3);
  background: rgba(6,182,212,.08); border: 1px solid rgba(6,182,212,.35);
  border-radius: 2px; padding: 3px 8px; max-width: 100%;
}
.clio-style-chip button {
  border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: 11px; line-height: 1; padding: 0 2px;
}
.clio-style-chip button:hover { color: var(--danger); }

@media (max-width: 720px) {
  .clio-detail-panel { grid-template-columns: 1fr; }
  .clio-detail-media img { max-height: 220px; min-height: 180px; }
}

.clio-src-bar {
  background: var(--surface); border: 1px solid var(--border); border-radius: 2px;
  padding: 12px 14px; margin-bottom: 16px;
}
.clio-src-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-bottom: 10px;
}
.clio-src-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent3);
}
.clio-src-hint { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.clio-src-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start;
}
.clio-src-drop {
  width: min(280px, 100%); min-height: 88px; padding: 12px;
}
.clio-src-drop .drop-icon { font-size: 18px; margin-bottom: 4px; }
.clio-src-drop .drop-text { font-size: 11px; }
.clio-src-preview {
  display: none; position: relative; width: 120px; height: 120px;
  border: 1px solid var(--border); border-radius: 2px; overflow: hidden; background: #0a0f1a;
}
.clio-src-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clio-src-preview .preview-clear {
  position: absolute; top: 4px; right: 4px; z-index: 2;
}
.clio-src-url-col { flex: 1; min-width: 180px; max-width: 360px; }
.clio-mode-toggle {
  display: inline-flex; border: 1px solid var(--border); border-radius: 2px;
  overflow: hidden; margin-bottom: 10px;
}
.clio-mode-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: .6px; text-transform: uppercase;
  padding: 5px 12px; border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
}
.clio-mode-btn + .clio-mode-btn { border-left: 1px solid var(--border); }
.clio-mode-btn.is-on { background: var(--accent-glow); color: #fff; }
.clio-src-status {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  margin-bottom: 10px; min-height: 14px;
}
.clio-src-status.has-img { color: var(--success); }
.clio-src-status.need-img { color: var(--accent2); }

