/* PPCP AI Studio — Admin CSS */
/* Brand: gold #c8a96e · navy #1e3a5f */

/* Studio is dark-only: pin the design tokens on the wrapper so the page is
   immune to the site's light/dark toggle and inner components resolve to dark.
   (Reviewer note: #7A8499 flagged borderline for AA; using #9AA3B5 for
   --aif-muted instead to keep hint/placeholder text comfortably above 4.5:1.) */
#ppcp-ai-studio, .ppcp-ai-studio-wrap {
  --aif-base: #0D0F14;
  --aif-surface: #161B24;
  --aif-surface-2: #1E2535;
  --aif-border: #2A3347;
  --aif-text: #E8EAF0;
  --aif-muted: #9AA3B5;
  --aif-accent: #3B82F6;
}

#ppcp-ai-studio {
  max-width: 1100px;
}

/* -- PR: Credits balance badge (P3) -- wraps .as-tabs so the persistent badge
   sits to the right of the tab row, on every tab, without changing tab layout. */
.as-studio-chrome {
  align-items: flex-end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.as-studio-chrome .as-tabs { flex: 1 1 auto; }

.as-credits-badge {
  align-items: center;
  background: rgba(200, 169, 110, 0.12);
  border: 1px solid var(--as-gold, #c8a96e);
  border-radius: 999px;
  color: var(--as-gold, #c8a96e);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  margin-bottom: 6px;
  padding: 6px 14px;
  white-space: nowrap;
}
.as-credits-badge .dashicons { color: var(--as-gold, #c8a96e); font-size: 16px; height: 16px; width: 16px; }

/* Second copy, inline next to the Generate button — smaller, sits on the button row. */
.as-credits-badge--inline {
  margin-bottom: 0;
  margin-left: 12px;
  vertical-align: middle;
}

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.as-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 0;
  border-bottom: 2px solid var(--aif-border);
}

/* Studio rebuild PHASE 0 — Gallery's internal Results/Past Jobs/Portfolio
   sub-nav. Deliberately DISTINCT classes from .as-tabs/.as-tab (not just a
   modifier on them): ai-studio.js's top-level tab wiring selects `.as-tab`
   globally, so reusing that class on sub-nav buttons would make a sub-tab
   click also fire the top-level tab handler (and vice-versa, wipe the
   sub-tab's own active state on every top-level tab switch). Same visual
   language as .as-tabs/.as-tab, just under its own selector. */
.as-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--aif-border);
}
.as-subtab {
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--aif-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  transition: background 0.15s;
}
.as-subtab:hover  { background: var(--aif-surface); }
.as-subtab.active { background: var(--aif-surface); color: var(--aif-text); border-color: var(--aif-accent); }

.as-subpanel { display: none; }
.as-subpanel.active { display: block; }

.as-tab {
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--aif-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  transition: background 0.15s;
}

.as-tab:hover  { background: var(--aif-surface); }
.as-tab.active { background: var(--aif-surface); color: var(--aif-text); border-color: var(--aif-accent); }

/* -- .as-catalogue-tile / .as-catalogue-tile--locked / .as-catalogue-tile__lock-badge --
   Studio rebuild PHASE 0: the #as-service-catalogue tile-strip container these
   were originally built for is gone (deleted, decorative, serviceId read
   nowhere); these tile classes themselves are KEPT and reused by
   addImageUtilAction()'s locked "Replace background" affordance and by
   renderGenerateServiceOptions()'s folded-service locked state in the
   Generate panel (ai-studio.js). */
.as-catalogue-tile {
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  color: var(--aif-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
  padding: 12px 18px;
  transition: background 0.15s, border-color 0.15s;
}

.as-catalogue-tile:hover  { background: var(--aif-surface); }
.as-catalogue-tile.active {
  background: var(--aif-surface);
  border-color: var(--aif-accent);
  color: var(--aif-text);
}

.as-catalogue-tile--locked {
  /* Still clickable — it opens the upgrade affordance rather than doing
     nothing, so this is not `cursor: not-allowed`. */
  /* a11y round 2 (4b): dim via a darker existing surface token instead of
     `opacity` — `opacity` cascades onto the label text too and measured at
     ~2.7:1 against the tile background, well under WCAG AA. --aif-surface is
     already a darker tone than the default --aif-surface-2 tile background,
     giving the same "locked" visual weight while keeping the (unscaled)
     --aif-muted label text at ~6.8:1. */
  background: var(--aif-surface);
}

.as-catalogue-tile--locked .as-catalogue-tile__lock-badge {
  opacity: 0.7;
}

.as-catalogue-tile__lock-badge {
  font-size: 14px;
}

/* -- Studio IA rebuild 4b -- inline upgrade affordance shown on a locked
   service-catalogue tile click. Reuses .as-card-like surface tokens. */
.as-service-upsell {
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-accent);
  border-radius: 4px;
  margin: 8px 0 0;
  padding: 12px 16px;
}

.as-service-upsell__message {
  color: var(--aif-text);
  margin: 0 0 8px;
}

.as-service-upsell__cta {
  display: inline-block;
}

/* ── Upgrade sheet ─────────────────────────────────────────────────────────
   Phase 1 spec: "locked → upgrade sheet, not a dead click". Accessible modal
   dialog built by ai-studio.js (openUpgradeSheet) and appended to <body>;
   .as-service-upsell above is superseded by this and no longer populated. */
.as-upgrade-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 15, 20, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  padding: 16px;
}

.as-upgrade-sheet {
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-accent);
  border-radius: 8px;
  color: var(--aif-text);
  max-width: 360px;
  width: 100%;
  padding: 24px 20px 20px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.as-upgrade-sheet:focus { outline: none; }

.as-upgrade-sheet__title {
  margin: 0 0 8px;
  padding-right: 24px;
  font-size: 1.1rem;
  color: var(--aif-text);
}

.as-upgrade-sheet__message {
  margin: 0 0 16px;
  color: var(--aif-muted);
}

.as-upgrade-sheet__cta {
  display: inline-block;
}

.as-upgrade-sheet__close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--aif-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
}
.as-upgrade-sheet__close:hover { color: var(--aif-text); }

@media (max-width: 640px) {
  /* Bottom-sheet on phones instead of a centered dialog, matching the
     project's existing 640px mobile breakpoint. */
  .as-upgrade-sheet-backdrop { align-items: flex-end; padding: 0; }
  .as-upgrade-sheet {
    max-width: none;
    border-radius: 12px 12px 0 0;
    padding: 20px 16px 24px;
  }
}

/* ── Panels ──────────────────────────────────────────────────────────────── */
.as-panel { display: none; padding: 20px 0; }
.as-panel.active { display: block; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.as-card {
  background: var(--aif-surface);
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  color: var(--aif-text);
  margin-bottom: 20px;
  padding: 24px;
}

.as-card h2 {
  color: var(--aif-text);
  font-size: 18px;
  margin: 0 0 16px;
}

.as-card h3 {
  color: var(--aif-text);
  font-size: 14px;
  margin: 20px 0 8px;
}

/* -- PR: Instant identity -- Quick Identity is the PRIMARY model-creation card
   (plan P6). Gold left-border echoes the existing .as-tips accent so it reads
   as "the highlighted path" without introducing a new colour. */
.as-card--primary {
  border-color: var(--as-gold, #c8a96e);
  border-width: 2px;
  box-shadow: 0 1px 4px rgba(200, 169, 110, 0.15);
}

.as-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--aif-text);
  margin: 16px 0 6px;
}

/* Advanced / best-fidelity training path -- demoted to a collapsed <details> so
   Quick Identity reads as the default action. Plain, unobtrusive summary style
   consistent with the rest of the muted/secondary UI language (.as-hint colour). */
.as-advanced-details {
  margin-bottom: 20px;
}
.as-advanced-details > .as-card {
  margin-bottom: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.as-advanced-summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-border);
  border-radius: 6px 6px 0 0;
  color: var(--aif-text);
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}
.as-advanced-summary::-webkit-details-marker { display: none; }
.as-advanced-summary::before { content: "▶ "; font-size: 11px; color: var(--as-gold, #c8a96e); }
.as-advanced-details[open] .as-advanced-summary::before { content: "▼ "; }
.as-advanced-details[open] .as-advanced-summary { border-radius: 6px 6px 0 0; border-bottom: none; }
.as-advanced-details:not([open]) .as-advanced-summary { border-radius: 6px; }
.as-advanced-summary:hover { background: var(--aif-surface); border-color: var(--as-gold, #c8a96e); }

/* ── Generate step: progressive-disclosure sections (4c) ────────────────────
   Groups the Generate tab's controls (Model / Shot Type / Look / Scene &
   Backgrounds / Output) into native <details> panels living inside the one
   existing .as-card, rather than each promoting to its own card the way
   .as-advanced-details does. Same toggle language (▶/▼ marker swapped via the
   [open] attribute, no JS) as .as-advanced-details above, sized for a
   same-card divider instead of a stacked-card header. */
.as-gen-section {
  border-bottom: 1px solid var(--aif-border);
}
.as-gen-section:last-of-type {
  border-bottom: none;
}
.as-gen-section__summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 4px;
  color: var(--aif-text);
  font-size: 15px;
  font-weight: 600;
  user-select: none;
}
.as-gen-section__summary::-webkit-details-marker { display: none; }
.as-gen-section__summary::before { content: "▶ "; font-size: 11px; color: var(--as-gold, #c8a96e); }
.as-gen-section[open] > .as-gen-section__summary::before { content: "▼ "; }
.as-gen-section__summary:hover { color: var(--as-gold, #c8a96e); }
.as-gen-section__body {
  padding: 0 2px 18px;
}

/* Studio rebuild PHASE 0 — folded-service options (Custom Backgrounds / Logo
   Branding) inside the Generate panel's "Additional Services" section. The
   enabled/locked/suppressed states themselves reuse .as-catalogue-tile /
   .as-catalogue-tile--locked / .as-catalogue-tile__lock-badge (locked) and
   .as-stale-banner (suppressed) — no new lock/suppress visual language. */
.as-gen-service {
  margin-bottom: 16px;
}
.as-gen-service:last-child {
  margin-bottom: 0;
}
.as-gen-service h3 {
  margin-bottom: 8px;
}

.as-age-gate-reminder {
  font-style: italic;
}

/* ── Hint ────────────────────────────────────────────────────────────────── */
.as-hint {
  color: var(--aif-muted);
  font-size: 13px;
  margin: 4px 0 8px;
}

.as-optional {
  color: var(--aif-muted);
  font-size: 12px;
  font-weight: 400;
}

/* ── Upload zones ────────────────────────────────────────────────────────── */
.as-upload-zone {
  margin-bottom: 16px;
}

.as-drop-area {
  align-items: center;
  background: var(--aif-surface-2);
  border: 2px dashed #c8a96e;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
  justify-content: center;
  padding: 20px;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.as-drop-area:hover,
.as-drop-area.drag-over {
  background: var(--aif-surface);
  border-color: var(--aif-accent);
}

.as-drop-area .dashicons {
  color: #c8a96e;
  font-size: 32px;
  width: 32px;
  height: 32px;
}

.as-drop-area p {
  margin: 0;
}

.as-link {
  background: none;
  border: none;
  color: var(--aif-accent);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
}

.as-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.as-thumb {
  border: 2px solid var(--aif-border);
  border-radius: 4px;
  height: 72px;
  object-fit: cover;
  width: 72px;
}

/* ── Select ──────────────────────────────────────────────────────────────── */
.as-select {
  background-color: var(--aif-surface-2);
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  color: var(--aif-text);
  font-size: 14px;
  padding: 8px 12px;
  width: 220px;
}
.as-select::placeholder { color: var(--aif-muted); }

/* NEW base rule: covers plain text/email/etc inputs across the studio
   (e.g. group create/invite fields) that previously only had layout
   rules (flex/min-width) and no explicit colours, leaving text
   off-white-on-white / invisible. */
.as-input {
  background: var(--aif-surface-2);
  color: var(--aif-text);
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  padding: 9px 12px;
}
.as-input::placeholder { color: var(--aif-muted); }

/* ── Row / Col ───────────────────────────────────────────────────────────── */
.as-row {
  display: flex;
  gap: 32px;
  margin-bottom: 16px;
}

.as-col {
  flex: 1;
  min-width: 0;
}

/* ── Shot types ──────────────────────────────────────────────────────────── */
.as-shot-types {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.as-shot-type {
  align-items: center;
  background: var(--aif-surface-2);
  border: 2px solid var(--aif-border);
  border-radius: 6px;
  color: var(--aif-text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 20px;
  text-align: center;
  transition: border-color 0.15s;
}

.as-shot-type:hover,
.as-shot-type.active {
  border-color: var(--as-gold, #c8a96e);
  background: var(--aif-surface);
}

.as-shot-type input[type="radio"] {
  display: none;
}

.as-shot-type .dashicons {
  color: var(--aif-text);
  font-size: 24px;
  width: 24px;
  height: 24px;
}

/* ── Checkboxes ──────────────────────────────────────────────────────────── */
.as-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* ── Pose picker ─────────────────────────────────────────────────────────── */
.as-pose-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.as-pose-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  margin-bottom: 20px;
}

.as-pose-card {
  background: var(--aif-surface-2);
  border: 2px solid var(--aif-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 10px 6px 8px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.as-pose-card:hover   { border-color: var(--as-gold, #c8a96e); background: var(--aif-surface); }
.as-pose-card.selected { border-color: var(--aif-accent); background: rgba(59, 130, 246, 0.12); }

.as-pose-icon {
  color: var(--aif-text);
  font-size: 20px;
  margin-bottom: 6px;
  opacity: 0.5;
}

.as-pose-card.selected .as-pose-icon { opacity: 1; }

.as-pose-card span {
  color: var(--aif-text);
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

/* ── Model toggle (FLUX / SDXL) ─────────────────────────────────────────── */
.as-model-toggle {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.as-model-label {
  color: var(--aif-muted);
  font-size: 13px;
  font-weight: 600;
}

.as-model-opt {
  align-items: center;
  background: var(--aif-surface-2);
  border: 2px solid var(--aif-border);
  border-radius: 6px;
  color: var(--aif-text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  padding: 6px 14px;
  transition: border-color 0.15s, background 0.15s;
}

.as-model-opt input[type="radio"] { display: none; }
.as-model-opt:hover { border-color: var(--as-gold, #c8a96e); background: var(--aif-surface); }
/* Opaque (not alpha-blended) so the selected state can't wash out to
 * near-white when a lighter ancestor background shows through the tint —
 * see .as-quality-opt.active below for the same fix. */
.as-model-opt.active { background: #21304C; border-color: var(--aif-accent); color: var(--aif-text); }

.as-model-badge {
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  text-transform: uppercase;
}

.as-model-badge--new    { background: var(--aif-accent); color: #fff; }
.as-model-badge--legacy { background: var(--aif-border); color: var(--aif-muted); }

/* ── Background grid ─────────────────────────────────────────────────────── */
.as-bg-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.as-bg-tab {
  background: var(--aif-surface-2);
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  color: var(--aif-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 12px;
  transition: background 0.15s;
}

.as-bg-tab:hover  { background: var(--aif-surface); }
.as-bg-tab.active { background: var(--aif-accent); color: #fff; border-color: var(--aif-accent); }

.as-bg-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}

.as-bg-card {
  border: 3px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s, transform 0.1s;
}

.as-bg-card:hover   { border-color: var(--as-gold, #c8a96e); transform: scale(1.02); }
.as-bg-card.selected { border-color: var(--aif-accent); }
.as-bg-card.selected::after {
  background: var(--aif-accent);
  border-radius: 50%;
  color: #fff;
  content: '✓';
  font-size: 12px;
  font-weight: 700;
  height: 20px;
  line-height: 20px;
  position: absolute;
  right: 4px;
  text-align: center;
  top: 4px;
  width: 20px;
}

.as-bg-card img {
  display: block;
  height: 100px;
  object-fit: cover;
  width: 100%;
}

.as-bg-placeholder {
  /* Shown when a background has no preview thumbnail (e.g. the fallback catalogue).
     A subtle diagonal tint on the dark surface so the tile reads as an intentional
     option rather than an empty/broken cell; the card's label span sits over it. */
  background: linear-gradient(135deg, var(--aif-surface-2) 0%, var(--aif-surface) 100%);
  border: 1px solid var(--aif-border);
  height: 100px;
  width: 100%;
}

.as-bg-card span {
  background: rgba(0,0,0,0.5);
  bottom: 0;
  color: #fff;
  display: block;
  font-size: 11px;
  left: 0;
  overflow: hidden;
  padding: 3px 6px;
  position: absolute;
  right: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Per-background attire selector ─────────────────────────────────────── */
/* Absolutely positioned inside the card so toggling it never shifts the grid.
   Visibility is class-driven (not inline styles) so the mobile breakpoint
   below can layer its own collapse rule on top without JS needing to know
   the viewport. */
.as-bg-attire {
  background: rgba(20, 40, 70, 0.93);
  bottom: 20px;    /* sits just above the label span */
  display: none;
  left: 0;
  padding: 4px 5px;
  position: absolute;
  right: 0;
  z-index: 5;
}

.as-bg-attire.as-bg-attire--open { display: block; }

/* Disclosure toggle — only shown on mobile (see breakpoint below); on
   desktop the <select> below it is always the visible control. */
.as-bg-attire-toggle {
  display: none;
}

.as-bg-attire-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--aif-surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%239AA3B5'/%3E%3C/svg%3E") no-repeat right 6px center;
  background-size: 8px 5px;
  border: none;
  border-radius: 3px;
  color: var(--aif-text);
  cursor: pointer;
  font-size: 10px;
  padding: 3px 20px 3px 5px;
  width: 100%;
}

.as-bg-attire-select:focus { outline: 2px solid var(--aif-accent); }

/* ── Mobile (4d): background carousel + collapsed attire ──────────────────
   <=640px only — the desktop grid/attire rules above are untouched. Cards
   become a single-row, horizontally snap-scrolling strip instead of a
   wrapped grid. The attire <select> stays mounted and bound to the same
   change handler as desktop; it's just visually collapsed behind a small
   disclosure toggle until tapped, so a selected-but-collapsed attire still
   serializes into the generate payload. */
@media (max-width: 640px) {
  .as-bg-grid {
    display: flex;
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .as-bg-grid::-webkit-scrollbar { display: none; }

  .as-bg-card {
    flex: 0 0 132px;
    scroll-snap-align: start;
  }

  .as-bg-attire-toggle {
    background: var(--aif-surface-2);
    border: none;
    border-radius: 3px;
    color: var(--aif-text);
    cursor: pointer;
    display: block;
    font-size: 10px;
    margin-bottom: 3px;
    /* a11y round 2 (4d): 22px was well under the 44px tap-target guideline;
       32px is a compromise that fits the card's compact footprint. */
    min-height: 32px;
    padding: 6px 5px;
    width: 100%;
  }
  .as-bg-attire-toggle:focus-visible { outline: 2px solid var(--aif-accent); }

  .as-bg-attire.as-bg-attire--open .as-bg-attire-select { display: none; }
  .as-bg-attire.as-bg-attire--open.as-bg-attire--disclosed .as-bg-attire-select { display: block; }
}

/* ── Actions ─────────────────────────────────────────────────────────────── */
.as-actions {
  margin-top: 20px;
}

.as-actions .button-primary {
  background: var(--aif-accent);
  border-color: var(--aif-accent);
  font-size: 15px;
  height: auto;
  padding: 10px 28px;
}

.as-actions .button-primary:hover {
  background: #2f6fdb;
  border-color: #2f6fdb;
}

/* ── Status bar ──────────────────────────────────────────────────────────── */
.as-status {
  align-items: center;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid var(--aif-accent);
  border-radius: 4px;
  color: var(--aif-text);
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.as-spinner {
  animation: as-spin 0.8s linear infinite;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--aif-accent);
  border-radius: 50%;
  flex-shrink: 0;
  height: 20px;
  width: 20px;
}

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

/* ── Model info ──────────────────────────────────────────────────────────── */
#as-model-info p { margin: 4px 0; font-size: 14px; }

/* ── Results grid ────────────────────────────────────────────────────────── */
.as-results-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.as-result-card {
  border: 2px solid var(--aif-border);
  border-radius: 6px;
  overflow: hidden;
  position: relative; /* PR: Portfolio — anchors the heart/remove overlay button */
  transition: border-color 0.15s, transform 0.1s;
}

.as-result-card:hover {
  border-color: var(--as-gold, #c8a96e);
  transform: scale(1.02);
}

.as-result-img {
  cursor: zoom-in;
  display: block;
  height: auto;
  width: 100%;
}

/* -- PR: Portfolio (merged Favourites + Portfolio, P2+P4+P5) --------------- */

/* Heart/save toggle -- overlaid top-right on every Results-grid card, and as a
   labelled button in the lightbox actions row (same class, context styles it). */
.as-portfolio-heart-btn {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  color: #999;
  cursor: pointer;
  display: flex;
  font-size: 16px;
  justify-content: center;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s, transform 0.1s;
}
.as-portfolio-heart-btn:hover { transform: scale(1.08); }
.as-portfolio-heart-btn--active { color: #d9376e; border-color: #d9376e; }

.as-portfolio-heart-btn--card {
  height: 32px;
  width: 32px;
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
}

/* FEAT (print-upsell, gallery CTA): per-thumbnail "Order a Print" button on
   every results-grid card. Reuses .as-order-print-btn's gold styling (defined
   below under FEAT-4/Lane C) with a --card modifier for absolute positioning
   bottom-left, mirroring the heart button's top-right placement. */
.as-order-print-btn--card {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

/* User-facing background removal (custom_background entitlement) — per-card
   button on the results grid, bottom-right (mirrors the heart's top-right and
   Order a Print's bottom-left placement). Reuses .as-card border/radius
   tokens rather than introducing a new visual style. */
.as-remove-bg-btn--card,
.as-upscale-btn--card {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  cursor: pointer;
}
/* User-facing upscale (custom_background entitlement) — stacked directly
   above the "Remove background" button so both can appear on the same card
   without overlapping. */
.as-upscale-btn--card {
  bottom: 44px;
}
.as-remove-bg-btn--card:hover,
.as-upscale-btn--card:hover { border-color: var(--as-gold, #c8a96e); }
.as-remove-bg-btn--card:disabled,
.as-upscale-btn--card:disabled { cursor: default; opacity: 0.6; }

/* Locked variant (custom_background not entitled) — still a real, focusable
   button (not `disabled`) that opens the upgrade sheet, so this deliberately
   avoids `opacity` on the whole control (per #394's contrast fix for the
   catalogue tile's own locked state) and only dims the crown badge. */
.as-image-action-btn--locked {
  background: rgba(255, 255, 255, 0.75);
  border-style: dashed;
}
.as-image-action-btn--locked .as-catalogue-tile__lock-badge {
  opacity: 0.7;
  margin-left: 4px;
}

/* Non-blocking status line for addImageUtilAction() (ai-studio.js) — replaces
   a blocking alert() with an on-card, aria-live message banner. Shared
   between the remove-background/upscale actions on a card. */
.as-image-action-status {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.3;
  color: #fff;
  background: rgba(20, 20, 20, 0.85);
}
.as-image-action-status--visible { display: block; }
.as-image-action-status--error { background: rgba(158, 27, 27, 0.92); }

/* Download link for the latest successful remove-background/upscale result —
   stacked above Replace background (bottom: 80px) so all four per-card
   controls can coexist without overlapping. */
.as-image-action-download {
  display: none;
  position: absolute;
  right: 8px;
  bottom: 116px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  text-decoration: none;
  color: inherit;
}
.as-image-action-download:hover { border-color: var(--as-gold, #c8a96e); }

/* Custom-background APPLY (main studio slice) — stacked above Remove
   background/Upscale so all three can appear on the same card without
   overlapping. Reuses the same --card button visual style. */
.as-replace-bg-btn--card {
  position: absolute;
  right: 8px;
  bottom: 80px;
  z-index: 2;
  padding: 6px 10px;
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  cursor: pointer;
}
.as-replace-bg-btn--card:hover { border-color: var(--as-gold, #c8a96e); }
.as-replace-bg-btn--card:disabled { cursor: default; opacity: 0.6; }

/* Inline library picker — opened by .as-replace-bg-btn--card, positioned
   as an overlay panel covering most of the card so its thumbnail grid has
   room without growing the grid layout. */
.as-bg-picker {
  position: absolute;
  inset: 8px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  padding: 8px;
  overflow-y: auto;
}
.as-bg-picker-status {
  font-size: 12px;
  color: #555;
  min-height: 16px;
  margin-bottom: 6px;
}
.as-bg-picker-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}
.as-bg-picker-thumb {
  border: 2px solid var(--aif-border);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  background: none;
}
.as-bg-picker-thumb:hover { border-color: var(--as-gold, #c8a96e); }
.as-bg-picker-thumb:disabled { cursor: default; opacity: 0.6; }
.as-bg-picker-thumb img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
}

/* Lightbox variant renders as a normal labelled button, matching the other
   .as-lightbox-actions buttons (Order a Print / Download Hi-Res). */
#as-lightbox-portfolio-toggle.as-portfolio-heart-btn {
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  gap: 4px;
  padding: 8px 14px;
  width: auto;
}
#as-lightbox-portfolio-toggle.as-portfolio-heart-btn--active {
  background: #fdecf1;
}

/* Portfolio tab toolbar (Export PDF / Get Share Link). */
.as-portfolio-toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
  margin: 12px 0 18px;
}

.as-portfolio-grid { margin-top: 4px; }

.as-portfolio-card { cursor: grab; }
.as-portfolio-card.as-dragging { opacity: 0.4; }
.as-portfolio-card.as-drag-over { border-color: var(--aif-accent); box-shadow: 0 0 0 2px rgba(59,130,246,0.25); }

.as-portfolio-remove-btn {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 13px;
  height: 26px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 8px;
  top: 8px;
  transition: background 0.15s;
  width: 26px;
  z-index: 2;
}
.as-portfolio-remove-btn:hover { background: #c0392b; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.as-lightbox {
  align-items: center;
  background: rgba(0,0,0,0.85);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 999999;
}

.as-lightbox-bg {
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.as-lightbox-content {
  background: var(--aif-surface);
  border-radius: 8px;
  max-height: 90vh;
  max-width: 900px;
  overflow: hidden;
  padding: 12px;
  position: relative;
  width: 90vw;
}

.as-lightbox-close {
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  height: 32px;
  line-height: 30px;
  position: absolute;
  right: 12px;
  text-align: center;
  top: 12px;
  width: 32px;
  z-index: 1;
}

.as-lightbox-content img {
  border-radius: 4px;
  display: block;
  max-height: calc(90vh - 80px);
  object-fit: contain;
  width: 100%;
}

.as-lightbox-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.as-lightbox-actions .button {
  background: var(--aif-accent);
  border-color: var(--aif-accent);
  color: #fff;
}

.as-lightbox-actions .button:hover {
  background: #c8a96e;
  border-color: #c8a96e;
  color: #fff;
}

/* ── Face photo items ───────────────────────────────────────────────────────── */

/* Wrapper for each face thumbnail + badge + remove button */
.as-face-item {
  position: relative;
  display: inline-block;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.as-face-item img.as-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 6px;
}

/* Colour-coded badge in the bottom-left corner */
.as-face-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}

.as-face-badge.trained {
  background: #166534;   /* dark green */
  color: #dcfce7;
}

.as-face-badge.new {
  background: #92400e;   /* dark amber */
  color: #fef3c7;
}

/* × remove button — appears on hover */
.as-face-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.as-face-item:hover .as-face-remove {
  opacity: 1;
}

.as-face-remove:hover {
  background: #dc2626;
}

/* ── Saved photo reuse notice ─────────────────────────────────────────────── */
.as-reuse-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(22, 101, 52, 0.16);
  border: 1px solid #2f7d4f;
  border-radius: 6px;
  color: #86efac;
  font-size: 13px;
  padding: 8px 14px;
  margin-bottom: 10px;
}
.as-reuse-notice .as-reuse-icon {
  font-size: 16px;
  line-height: 1.2;
  flex-shrink: 0;
}
.as-reuse-notice .as-reuse-icon--off { color: var(--aif-muted); }
.as-reuse-notice strong { font-weight: 700; }
.as-reuse-notice .as-link {
  margin-left: 8px;
  color: var(--aif-accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.as-reuse-notice .as-link:hover { color: #c8a96e; }

/* Stale-model warning banner — dark amber tint, matching .as-face-badge.new. */
.as-stale-banner {
  background: rgba(146, 64, 14, 0.2);
  border: 1px solid #b45309;
  border-radius: 6px;
  color: #fcd34d;
  font-size: 13px;
  padding: 8px 14px;
  margin-bottom: 10px;
}

/* Make the face-thumbs row wrap nicely when items have variable structure */
#as-face-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

/* ── Face slim slider ────────────────────────────────────────────────────────── */
.as-slim-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 280px;
}

.as-slim-range {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--aif-accent) 0%, var(--aif-accent) var(--pct, 0%), var(--aif-border) var(--pct, 0%), var(--aif-border) 100%);
  outline: none;
  cursor: pointer;
  accent-color: var(--aif-accent);
}

.as-slim-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--aif-accent);
  cursor: pointer;
  border: 2px solid var(--aif-surface);
  box-shadow: 0 0 0 1px var(--aif-accent);
}

.as-slim-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--aif-muted);
}

.as-slim-value {
  margin: 0;
  font-weight: 600;
  color: var(--aif-text);
}

/* ── Custom prompt toggle ────────────────────────────────────────────────── */
.as-prompt-mode-row {
  margin: 16px 0 12px;
}

.as-switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.as-switch-label input[type="checkbox"] {
  display: none;
}

.as-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  background: #ccc;
  border-radius: 11px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.as-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
}

.as-switch-label input:checked + .as-switch {
  background: #2563eb;
}

.as-switch-label input:checked + .as-switch::after {
  left: 21px;
}

.as-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
  color: var(--aif-text);
  background: var(--aif-surface-2);
  margin-top: 8px;
}

.as-textarea:focus {
  outline: none;
  border-color: var(--aif-accent);
  background: var(--aif-surface-2);
}

/* ── Spinner wrap (for loading states) ───────────────────────────────────────── */
.as-spinner-wrap {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}

/* ── Past jobs list ──────────────────────────────────────────────────────────── */
#as-past-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.as-job-card {
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  overflow: hidden;
}

.as-job-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--aif-surface);
}

.as-job-preview {
  width: 80px;
  height: 106px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--aif-border);
  flex-shrink: 0;
  background: var(--aif-surface-2);
}

.as-job-meta {
  flex: 1;
  min-width: 0;
}

.as-job-date {
  font-size: 13px;
  color: var(--aif-text);
  font-weight: 600;
}

.as-job-info {
  font-size: 12px;
  color: var(--aif-muted);
  margin: 4px 0 12px;
}

.as-job-btns {
  display: flex;
  gap: 8px;
}

.as-job-delete-btn {
  color: #c00 !important;
  border-color: #c00 !important;
}

.as-job-delete-btn:hover {
  background: #c00 !important;
  color: #fff !important;
}

.as-job-gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  padding: 16px;
  border-top: 1px solid var(--aif-border);
  background: var(--aif-surface);
}

.as-job-img-wrap {
  position: relative;
}

.as-job-img-dl {
  display: block;
  margin-top: 6px;
  text-align: center;
  background: var(--aif-accent) !important;
  border-color: var(--aif-accent) !important;
  color: #fff !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  height: auto !important;
  width: 100%;
  text-decoration: none;
}

.as-job-img-dl:hover {
  background: #c8a96e !important;
  border-color: #c8a96e !important;
}

/* ── Trained model cards (Train tab) ─────────────────────────────────────────── */
#as-models-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.as-model-card {
  background: var(--aif-surface);
  border: 2px solid var(--aif-border);
  border-radius: 8px;
  color: var(--aif-text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  max-width: 220px;
  padding: 14px 16px;
  position: relative;
  flex: 1;
}

.as-model-card--training {
  border-color: #c8a96e;
  background: rgba(200, 169, 110, 0.1);
}

.as-model-card--completed {
  border-color: var(--aif-accent);
}

.as-model-card--failed {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.as-model-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.as-model-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aif-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.as-model-type-badge {
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.as-model-type-badge--flux {
  background: var(--aif-accent);
  color: #fff;
}

.as-model-type-badge--sdxl {
  background: var(--aif-border);
  color: var(--aif-muted);
}

.as-model-card__meta {
  font-size: 12px;
  color: var(--aif-muted);
  line-height: 1.5;
}

.as-model-card__status {
  font-size: 12px;
  font-weight: 600;
}

.as-model-card__status--training { color: #f0b869; }
.as-model-card__status--completed { color: #4ade80; }
.as-model-card__status--failed   { color: #f87171; }

.as-model-card__delete {
  align-self: flex-start;
  background: none;
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  color: #f87171;
  cursor: pointer;
  font-size: 11px;
  margin-top: 4px;
  padding: 3px 8px;
  transition: background 0.15s, color 0.15s;
}

.as-model-card__delete:hover {
  background: #c00;
  color: #fff;
  border-color: #c00;
}

.as-models-empty {
  color: var(--aif-muted);
  font-size: 13px;
  padding: 8px 0;
}

/* ── Model selector (Generate tab) ──────────────────────────────────────────── */
.as-model-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.as-model-sel-card {
  align-items: flex-start;
  background: var(--aif-surface);
  border: 2px solid var(--aif-border);
  border-radius: 8px;
  color: var(--aif-text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  max-width: 200px;
  padding: 12px 14px;
  transition: border-color 0.15s, background 0.15s;
  flex: 1;
}

.as-model-sel-card:hover {
  border-color: var(--as-gold, #c8a96e);
  background: var(--aif-surface-2);
}

.as-model-sel-card.selected {
  border-color: var(--aif-accent);
  background: rgba(59, 130, 246, 0.12);
}

.as-model-sel-card.selected::after {
  content: '✓';
  position: absolute;
  right: 8px;
  top: 8px;
  background: var(--aif-accent);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.as-model-sel-card {
  position: relative;
}

.as-model-sel-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--aif-text);
}

.as-model-sel-card__meta {
  font-size: 11px;
  color: var(--aif-muted);
}

.as-model-sel-card--none .as-model-sel-card__name {
  color: var(--aif-muted);
}

/* ── Models count chip ───────────────────────────────────────────────────────── */
.as-models-count {
  font-weight: 400;
  margin-left: 6px;
}

/* ── Model card — expandable training photo section ─────────────────────────── */
.as-model-card__summary {
  display: contents; /* keep existing grid/flex layout unchanged */
}

.as-model-card__expand-hint {
  color: #c8a96e;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  padding-left: 8px;
  white-space: nowrap;
  user-select: none;
}

.as-model-card__photos {
  /* Spanning full card width — sits below the summary row */
  border-top: 1px solid var(--aif-border);
  margin-top: 10px;
  padding-top: 10px;
}

.as-model-card__photos-title {
  color: var(--aif-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.as-model-photos-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
}

.as-model-photo-thumb {
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  object-fit: cover;
  transition: opacity 0.15s, transform 0.15s;
  width: 100%;
}

.as-model-photo-thumb:hover {
  opacity: 0.82;
  transform: scale(1.04);
}

/* Lightbox download button — hidden in training-photo mode */
#as-lightbox-download[style*="display: none"],
#as-lightbox-download[style*="display:none"] {
  display: none !important;
}

/* ── Frontend shortcode wrapper — replicate WP admin button styles ───────────── */
/* On the frontend WP admin CSS is not loaded; we provide minimal button styles   */
/* scoped to our own wrapper so we don't pollute theme CSS.                       */

/* DEC032-11: Public frontend wrapper — self-contained dark aesthetic.
 * Must not rely on WP admin's .wrap class or the active theme for background/colour.
 * The dark bg (#0d0f14) is set explicitly here so the studio looks correct under
 * any light theme (e.g. Astra default). Admin context uses .wrap for its spacing;
 * public context uses this class alone. */
.ppcp-ai-studio-wrap {
  max-width: 1100px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--aif-text);
  background: var(--aif-base);
  padding: 24px;
  box-sizing: border-box;
}

/* Map WP .button class used throughout the plugin HTML — dark-token neutral
   button. Lightbox action row (close/download/order-print) inherits this too. */
.ppcp-ai-studio-wrap .button,
.ppcp-ai-studio-wrap a.button {
  display: inline-block;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  background: var(--aif-surface-2);
  color: var(--aif-text);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  vertical-align: middle;
  white-space: nowrap;
}

.ppcp-ai-studio-wrap .button:hover,
.ppcp-ai-studio-wrap a.button:hover {
  background: var(--aif-surface);
  border-color: var(--aif-muted);
  color: var(--aif-text);
}

/* Primary/CTA variant — accent-filled per dark-only spec. */
.ppcp-ai-studio-wrap .button-primary {
  background: var(--aif-accent);
  border-color: var(--aif-accent);
  color: #fff;
}

.ppcp-ai-studio-wrap .button-primary:hover {
  background: #2f6fdb;
  border-color: #2f6fdb;
  color: #fff;
}

.ppcp-ai-studio-wrap .button-large {
  font-size: 15px;
  padding: 10px 20px;
}

.ppcp-ai-studio-wrap .button[disabled],
.ppcp-ai-studio-wrap .button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* On frontend the .wrap class may interfere with themes — neutralise it */
.ppcp-ai-studio-wrap.wrap {
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE-FIRST + CAPTURE LAYER  (feat/studio-mobile-camera)
   Appended last so it overrides desktop defaults where needed. Desktop layout
   is preserved above the @media breakpoints; phones get large tap targets, a
   sticky primary action, smooth scrolling, and no hover dependence.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --as-gold: #c8a96e;
  --as-navy: #1e3a5f;
  --as-tap: 44px;               /* min touch target (WCAG / Apple HIG) */
  --as-radius: 8px;
}

/* ── On-device guidance (tips + count hint) ───────────────────────────────── */
.as-tips {
  list-style: none;
  margin: 6px 0 12px;
  padding: 10px 12px;
  background: var(--aif-surface-2);
  border-left: 3px solid var(--as-gold);
  border-radius: 4px;
  font-size: 13px;
  color: var(--aif-text);
}
.as-tips li { margin: 2px 0; padding-left: 16px; position: relative; }
.as-tips li::before { content: "•"; color: var(--as-gold); position: absolute; left: 4px; }

.as-count-hint {
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 10px;
  color: var(--aif-muted);
}
.as-count-hint--warn { color: #92400e; }
.as-count-hint--ok   { color: #166534; }

/* ── Capture bar (library / camera buttons) ───────────────────────────────── */
.as-capture-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.as-capture-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 auto;
  min-height: var(--as-tap);
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--aif-text);
  background: var(--aif-surface-2);
  border: 2px solid var(--as-gold);
  border-radius: var(--as-radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}
.as-capture-btn:hover { background: var(--aif-surface); }
.as-capture-btn:active { transform: scale(0.98); }
.as-capture-btn:focus-visible { outline: 3px solid var(--aif-accent); outline-offset: 2px; }
.as-capture-btn .dashicons { font-size: 20px; width: 20px; height: 20px; }
.as-capture-camera { background: var(--aif-accent); color: #fff; border-color: var(--aif-accent); }
.as-capture-camera:hover { background: #2f6fdb; }

/* ── Upload progress ──────────────────────────────────────────────────────── */
.as-upload-progress {
  display: none;
  margin: 12px 0;
}
.as-up-track {
  height: 8px;
  background: var(--aif-surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.as-up-fill {
  height: 100%;
  background: var(--as-gold);
  width: 0;
  transition: width 0.2s ease;
}
.as-up-label { font-size: 13px; margin: 6px 0 0; color: var(--aif-muted); }
.as-up-warnings {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  font-size: 12px;
  color: #92400e;
}
.as-up-warnings li { padding: 2px 0; }

/* ── In-page camera capture overlay (getUserMedia) ────────────────────────── */
.as-cam-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #000;
  display: flex;
  flex-direction: column;
}
.as-cam-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.as-cam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Mirror the selfie preview so it feels like a mirror. */
  transform: scaleX(-1);
}
.as-cam-frame {
  position: absolute;
  width: min(70vw, 60vh);
  aspect-ratio: 3 / 4;
  border: 3px dashed rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  pointer-events: none;
}
.as-cam-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom, 0px));
  background: #000;
}
.as-cam-cancel, .as-cam-spacer {
  color: #fff;
  background: none;
  border: none;
  font-size: 16px;
  min-width: 72px;
  min-height: var(--as-tap);
  cursor: pointer;
}
.as-cam-spacer { visibility: hidden; }
.as-cam-shoot {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.5);
  cursor: pointer;
}
.as-cam-shoot:active { transform: scale(0.94); }
.as-cam-shoot:focus-visible { outline: 3px solid var(--as-gold); outline-offset: 3px; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — phones (<= 640px, aligned with the carousel/attire breakpoint)
   ═══════════════════════════════════════════════════════════════════════════ */
/* a11y round 2 (4d): aligned to 640px (was 782px) so the whole mobile
   treatment — this shell/step-nav/stacked-columns/sticky-actions layer AND
   the background carousel + attire-collapse layer (@media (max-width: 640px)
   above) — switches at the same breakpoint. 641-782px now renders the full
   desktop layout consistently instead of a half-mobile/half-desktop mix. */
@media (max-width: 640px) {
  #ppcp-ai-studio { max-width: 100%; }
  html { scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }

  /* Shell (4a): tighter side padding so narrow phones (360-414px) get more
     usable content width; box-sizing on .ppcp-ai-studio-wrap (line ~1544)
     already keeps this padding from causing overflow. */
  .ppcp-ai-studio-wrap { padding: 16px; }

  /* Shell (4a): let the balance pill drop to its own row instead of
     squeezing/overlapping the tab row on narrow viewports. .as-tabs' own
     hypothetical (unshrunk) width is always wider than a phone screen, so
     this wraps reliably whenever there isn't room for both on one line. */
  .as-studio-chrome {
    flex-wrap: wrap;
  }
  .as-credits-badge {
    margin-left: auto;
  }

  /* Tabs: horizontally scrollable, never wrap/overflow off-screen. Overrides
     the base .as-tabs flex-wrap:wrap (desktop-only safety net for the label
     text) back to nowrap here — mobile's design is a single scrollable row,
     not a wrapped multi-row tab bar. */
  .as-tabs {
    flex-wrap: nowrap;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom-width: 2px;
  }
  .as-tabs::-webkit-scrollbar { display: none; }
  .as-tab {
    flex: 0 0 auto;
    font-size: 13px;
    padding: 12px 14px;
    min-height: var(--as-tap);
    white-space: nowrap;
  }

  .as-panel { padding: 14px 0; }
  .as-card { padding: 14px; border-radius: var(--as-radius); }

  /* Stack the generate-tab two-column row. */
  .as-row { display: block; }
  .as-col { width: 100%; }

  /* Shot types: 2-up grid of big tappable cards (no hover reliance). */
  .as-shot-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .as-shot-type { min-height: var(--as-tap); padding: 12px; }

  /* Bigger thumbnails for fat-finger removal. */
  .as-thumb, .as-face-item { width: 84px; height: 84px; }
  /* Touch devices can't hover — always show the remove control. */
  .as-face-remove { opacity: 1; width: 24px; height: 24px; line-height: 22px; font-size: 15px; }

  /* Inputs / selects sized to avoid iOS zoom-on-focus (>=16px). */
  .as-select, .as-textarea, .as-input { font-size: 16px; min-height: var(--as-tap); }
  .as-bg-attire-select { font-size: 16px; }

  .as-capture-btn { flex: 1 1 100%; }

  /* Sticky primary action — keep "Train" / "Generate" reachable while scrolling. */
  .as-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, var(--aif-base) 70%, rgba(13, 15, 20, 0));
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    margin: 0 -14px;
    padding-left: 14px;
    padding-right: 14px;
    z-index: 10;
  }
  .as-actions .button-primary,
  .ppcp-ai-studio-wrap .button-large {
    width: 100%;
    min-height: 50px;
    font-size: 17px;
  }

  /* Results grid: 2 columns on phones. */
  .as-results-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Extra-small phones. */
@media (max-width: 380px) {
  .ppcp-ai-studio-wrap { padding: 12px; }
  .as-shot-types { grid-template-columns: 1fr; }
  .as-tab { padding: 12px 10px; }
}

/* ── Accessibility: respect reduced-motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .as-up-fill, .as-capture-btn, .as-cam-shoot, .as-tab { transition: none !important; }
  .as-spinner { animation-duration: 1.5s; }
}

/* Visible keyboard focus everywhere (no hover-only affordances). */
.as-tab:focus-visible,
.as-subtab:focus-visible,
.as-shot-type:focus-within,
.as-face-remove:focus-visible,
.as-link:focus-visible,
.as-catalogue-tile:focus-visible,
.as-upgrade-sheet__close:focus-visible,
.as-upgrade-sheet__cta:focus-visible {
  outline: 3px solid var(--aif-accent);
  outline-offset: 2px;
}

/* FEAT-2 (T6): 18+ age-gate confirmation on the training submit step. */
.as-age-gate {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 4px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.as-age-gate input[type="checkbox"] {
  margin-top: 3px;
  flex: 0 0 auto;
}

/* Pre-training consent modal — condensed T&C summary block. Reuses the
   .as-print-modal chrome for the modal shell; this styles only the inner
   summary text + the placeholder marker (T&C copy is not final — Rik/legal
   sign-off pending, see change-notes/PR-studio-consent-modal.md).
   Fix (PR-342): the shared .as-print-modal-content panel is hardcoded dark,
   but nothing here declared its own color on the design tokens, so contrast
   wasn't guaranteed — pin it explicitly, scoped to #as-train-consent-modal
   only so the shared print modal (and the unrelated .as-age-gate blocks used
   elsewhere in Advanced) are untouched. */
#as-train-consent-modal .as-print-modal-content {
  background: var(--aif-surface);
  color: var(--aif-text);
}
#as-train-consent-modal .as-age-gate span {
  color: var(--aif-text);
}
.as-consent-tos-summary {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--aif-surface-2);
  color: var(--aif-text);
  border: 1px solid var(--aif-border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.as-consent-tos-summary ul {
  margin: 6px 0 8px;
  padding-left: 18px;
}
.as-consent-tos-summary li { margin: 4px 0; }
.as-consent-draft-marker {
  margin: 0 0 8px;
  color: var(--as-gold, #c8a96e);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Studio rebuild PHASE 0: the #as-onboarding-panel shell and its
   initOnboarding() renderer were removed from ai-studio.js/AdminPage.php
   (orphaned — never read by TrainEndpoint/GenerateEndpoint); the
   .as-onboarding-* rules that styled it were removed here with it. */

/* ── FEAT-4 (T7 Lane C): "Order a Print" button + dark-theme print modal ─────── */

/* Lightbox "Order a Print" button — gold accent to stand out from the secondary
   download/hires buttons. */
.as-order-print-btn {
  background: #c8a96e !important;
  border-color: #c8a96e !important;
  color: #1a1a1a !important;
  font-weight: 600;
}
.as-order-print-btn:hover { background: #b8995e !important; }

/* Modal shell — full-viewport dark overlay, centred panel. */
.as-print-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.as-print-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
}
.as-print-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: #18181b;          /* dark theme */
  color: #e7e7ea;
  border: 1px solid #2c2c31;
  border-radius: 12px;
  padding: 24px 24px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.as-print-modal-content h3 {
  margin: 0 0 4px;
  color: #c8a96e;              /* brand gold heading */
  font-size: 20px;
}
.as-print-modal-content .as-hint { color: #9a9aa2; }

.as-print-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #9a9aa2;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.as-print-modal-close:hover { color: #fff; }

.as-print-preview {
  text-align: center;
  margin: 14px 0;
}
.as-print-preview-img,
#as-print-preview-img {
  max-width: 140px;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid #2c2c31;
}

.as-print-field { margin: 14px 0; }
.as-print-field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #c9c9d1;
}
.as-print-field .as-input,
#as-print-modal select.as-input {
  width: 100%;
  padding: 9px 10px;
  background: #232327;
  color: #e7e7ea;
  border: 1px solid #3a3a42;
  border-radius: 7px;
  font-size: 14px;
}

/* Size/finish radio cards. */
.as-print-variations {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.as-print-var {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #232327;
  border: 1px solid #3a3a42;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}
.as-print-var:hover { border-color: #c8a96e; }
.as-print-var input:checked + span { color: #fff; }
.as-print-var.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.as-print-price { color: #c8a96e; font-weight: 600; }
.as-print-lock  { color: #e0a04a; font-size: 11px; }

/* FEAT (print-upsell): "Generate upscaled version" button shown next to a
   locked A3+ print-size card (requires_upscale && !hasUpscale). Additive to
   the existing lock/disabled state -- does not replace it. */
.as-print-upscale-btn {
  margin-left: auto;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid #e0a04a;
  border-radius: 6px;
  color: #e0a04a;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.as-print-upscale-btn:hover { background: rgba(224, 160, 74, 0.12); }
.as-print-upscale-btn:disabled { opacity: 0.6; cursor: default; }

/* Live quote panel. */
.as-print-quote {
  margin: 14px 0;
  padding: 12px 14px;
  background: #1f1f23;
  border: 1px solid #2c2c31;
  border-radius: 8px;
  font-size: 14px;
  min-height: 44px;
}
.as-print-quote-placeholder,
.as-print-quote-loading { color: #8c8c94; }
.as-print-quote-warn    { color: #e0a04a; }
.as-print-quote-line,
.as-print-quote-total {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.as-print-quote-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #2c2c31;
  font-weight: 700;
  color: #fff;
}
.as-print-quote-total span,
.as-print-quote-line span { color: #c8a96e; }

/* 18+ confirmation. */
.as-print-18plus {
  margin: 14px 0;
  font-size: 13px;
  color: #c9c9d1;
}
.as-print-18plus label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
}
.as-print-18plus input[type="checkbox"] { margin-top: 2px; flex: 0 0 auto; }

.as-print-error {
  margin: 10px 0;
  padding: 9px 12px;
  background: #3a1f1f;
  border: 1px solid #6b2e2e;
  border-radius: 7px;
  color: #f2b8b8;
  font-size: 13px;
}

.as-print-add {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  background: #c8a96e !important;
  border-color: #c8a96e !important;
  color: #1a1a1a !important;
  font-weight: 700;
  font-size: 15px;
}
.as-print-add:hover:not(:disabled) { background: #b8995e !important; }
.as-print-add:disabled { opacity: 0.55; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════════════════════
   FEAT-10 Groups / Teams tab — corporate/team headshot-day flow.
   Mirrors the .as-model-card / .as-model-badge / .as-job-card visual language
   used elsewhere in the studio (navy #1e3a5f primary, muted greys, small
   uppercase pills for role/status) rather than introducing a new palette.
   ═══════════════════════════════════════════════════════════════════════════ */

.as-group-create-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 16px;
}

.as-group-create-form .as-input {
  flex: 1;
  min-width: 220px;
}

.as-groups-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.as-group-card {
  background: var(--aif-surface);
  border: 2px solid var(--aif-border);
  border-radius: 8px;
  color: var(--aif-text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  max-width: 240px;
  padding: 14px 16px;
  flex: 1;
  transition: border-color 0.15s, background 0.15s;
}

.as-group-card:hover { border-color: var(--as-gold, #c8a96e); }

.as-group-card.selected {
  border-color: var(--aif-accent);
  background: rgba(59, 130, 246, 0.12);
}

.as-group-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--aif-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.as-group-card__meta {
  font-size: 12px;
  color: var(--aif-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Small uppercase rounded pill — reused for BOTH membership role
   (owner/admin/member) and membership status (invited/active/removed),
   modelled directly on .as-model-badge's shape. */
.as-group-pill {
  display: inline-block;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  text-transform: uppercase;
}

.as-group-pill--role-owner  { background: var(--aif-accent); color: #fff; }
.as-group-pill--role-admin  { background: #c8a96e; color: #1a1a1a; }
.as-group-pill--role-member { background: var(--aif-border); color: var(--aif-muted); }

.as-group-pill--status-active  { background: #166534; color: #fff; }
.as-group-pill--status-invited { background: #b45309; color: #fff; }
.as-group-pill--status-removed { background: #dc2626; color: #fff; }

.as-group-invite-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(200, 169, 110, 0.12);
  border: 1px solid #c8a96e;
  border-radius: 6px;
  color: var(--aif-text);
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 13px;
}

.as-group-invite-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.as-group-invite-form .as-input {
  flex: 1;
  min-width: 220px;
}

.as-group-members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 16px;
}

.as-group-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--aif-surface);
  border: 1px solid var(--aif-border);
  border-radius: 6px;
  font-size: 13px;
}

.as-group-member-row__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--aif-text);
}

.as-group-member-row__remove {
  background: none;
  border: 1px solid var(--aif-border);
  border-radius: 4px;
  color: #f87171;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 8px;
  transition: background 0.15s, color 0.15s;
}

.as-group-member-row__remove:hover {
  background: #c00;
  color: #fff;
  border-color: #c00;
}

.as-group-identity-card,
.as-group-style-card,
.as-group-generate-card {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--aif-border);
}

.as-group-generate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.as-group-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.as-group-job-row {
  font-size: 13px;
  padding: 4px 0;
  color: var(--aif-text);
}

.as-group-job-row--failed { color: #f87171; }

.as-group-job-row__label { font-weight: 600; color: var(--aif-text); }

.as-group-composite-result { margin-top: 12px; }

.as-group-composite-img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--aif-border);
}

/* Shared-style modal reuses the .as-print-modal chrome; only the inner form
   fields below are Groups-specific. */
.as-group-style-bg-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  max-height: 220px;
  overflow-y: auto;
}

.as-group-style-bg-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #ddd;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 4px 8px;
}

.as-group-style-field {
  display: block;
  margin: 12px 0;
  font-size: 13px;
  color: #ddd;
}

.as-group-style-field .as-select,
.as-group-style-field .as-textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
}

/* ── E-3b: entitlement lock states (initEntitlements in ai-studio.js) ─────────
 * .as-locked greys a capability surface the user's package does not include
 * (locked-tease); .as-lock-badge / the JS-set "Locked" badges reuse the
 * existing .as-model-badge chip. UX only — E-2 server seams enforce for real. */
#ppcp-ai-studio .as-locked {
  opacity: 0.55;
}
#ppcp-ai-studio .as-locked .as-tier-upgrade,
#ppcp-ai-studio .as-locked-note .as-tier-upgrade {
  opacity: 1; /* the upgrade CTA inside a locked card stays fully visible */
}
#ppcp-ai-studio .as-entitlement-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 12px 16px;
  font-size: 14px;
  color: #ddd;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}
#ppcp-ai-studio .as-model-slots {
  font-weight: 400;
  margin-left: 6px;
}
#ppcp-ai-studio .as-signature-styles,
#ppcp-ai-studio #as-gen-tier-wrap {
  margin: 18px 0 0;
}

/* ── E-4 (Executive enablement): training-quality selector ─────────────────────
 * Vertical radio group inside the Advanced train form. Each option is a card;
 * DoRA / DreamBooth are shown as a locked/upsell tease (.as-locked) and their
 * radio disabled by initEntitlements() until the user's package entitles them.
 * Mirrors the .as-model-opt / .as-locked visual language already in use. */
.as-quality-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.as-quality-opt {
  align-items: center;
  background: var(--aif-surface-2);
  border: 2px solid var(--aif-border);
  border-radius: 6px;
  color: var(--aif-text);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
  padding: 8px 14px;
  transition: border-color 0.15s, background 0.15s;
}
.as-quality-opt input[type="radio"] { margin-right: 4px; }
.as-quality-opt:not(.as-locked):hover { border-color: var(--as-gold, #c8a96e); background: var(--aif-surface); }
/* Opaque for the same reason as .as-model-opt.active — an alpha-blended
 * background here let a lighter ancestor bg wash the selected card's text
 * to near-illegible white-on-white. */
.as-quality-opt.active { background: #21304C; border-color: var(--aif-accent); }
.as-quality-desc {
  color: var(--aif-muted);
  flex-basis: 100%;
  font-size: 12px;
  font-weight: 400;
}
.as-quality-lock-badge {
  color: var(--aif-muted);
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}
.as-quality-opt.as-locked {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Model card: full-width title on its own line (no truncation), badges beneath.
   Fixes the old flex header that clipped the model name to a few chars. */
.as-model-card__title { display: block; width: 100%; margin-bottom: 4px; }
.as-model-card__badges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.as-model-card__name { font-size: 14px; font-weight: 600; color: var(--aif-text); display: block; white-space: normal; overflow-wrap: anywhere; overflow: visible; text-overflow: clip; }
.as-model-type-badge--dreambooth { background: #3b2a63; color: #e9deff; }
.as-model-type-badge--dreamo { background: #123a2e; color: #b8f0dc; }
.as-model-type-badge--dora { background: #4a2f10; color: #ffe0b8; }
