/* ═══ Shared components: modal · toast · dropdown · context menu · upgrade ═══ */

/* ── Modal ── */
.modal-veil {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  animation: veil-in var(--dur-med) ease;
}
@keyframes veil-in { from { opacity: 0; } }
.modal {
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius-l);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-2); width: min(480px, 100%); max-height: 92vh;
  display: flex; flex-direction: column; animation: modal-in var(--dur-med) cubic-bezier(.2, 1.4, .5, 1);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal.md-lg { width: min(680px, 100%); }
.modal.md-xl { width: min(980px, 100%); height: 92vh; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px 0; }
.modal-head h3 { font-size: 15.5px; flex: 1; }
.modal-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 0 18px 16px; flex-wrap: wrap; }

/* glass needs backdrop-filter; without it (disabled GPU acceleration,
   reduced-transparency OS settings) fall back to solid panels */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .modal, .ctx-menu, .cp-pop { background: var(--bg-1); }
}

/* ── Media preview (lightbox) ── */
/* true fullscreen: no frame, no glass box — the file floats on a dark veil,
   Close top-left like the editors, actions in a translucent pill at the bottom */
.modal.mv { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal-veil:has(.mv) { padding: 0; background: rgba(8, 8, 11, .94); }
.modal.mv .modal-body { padding: 0; overflow: hidden; display: flex; min-height: 0; }
.mv-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mv-media { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.mv-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 26px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .6), transparent);
  pointer-events: none;
}
.mv-top > * { pointer-events: auto; }
.mv-close {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border: 0; border-radius: 999px; padding: 8px 15px 8px 10px;
  color: #fff; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer;
}
.mv-close:hover { background: rgba(255, 255, 255, .26); }
.mv-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mv-name { font-size: 14px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.mv-meta { font-size: 11.5px; color: rgba(255, 255, 255, .72); font-variant-numeric: tabular-nums; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.mv-actions {
  position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  z-index: 2; display: flex; gap: 4px; padding: 6px;
  border-radius: 18px; background: rgba(18, 18, 22, .55); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none;
}
.mv-act {
  display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none;
  border: 0; border-radius: 13px; padding: 8px 12px; min-width: 60px;
  background: none; color: #fff; cursor: pointer;
}
.mv-act span { font-size: 10px; opacity: .85; white-space: nowrap; }
.mv-act:hover { background: rgba(255, 255, 255, .12); }
.mv-act.danger { color: #ff8078; }
.mv-audio-face { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px; max-width: 100%; color: #fff; }
.mv-audio-face svg { color: var(--track-audio); }
.mv-audio-face b { font-size: 13.5px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-audio { width: min(420px, 74vw); }
.mv-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 40px; height: 40px; border: 0; color: #fff; background: var(--scrim);
  opacity: .55; transition: opacity var(--dur-fast);
}
.mv-nav:hover { opacity: 1; }
.mv-prev { left: 10px; }
.mv-next { right: 10px; }

/* ── Toast ── */
.toast-rack { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--bg-3); color: var(--text-1); border: 1px solid var(--stroke);
  border-radius: var(--radius-m); padding: 9px 16px; font-size: 13px; box-shadow: var(--shadow-2);
  animation: toast-in var(--dur-med) ease; max-width: 420px; text-align: center; pointer-events: auto;
}
.toast.err { border-color: var(--bad); }
.toast.ok { border-color: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Context / dropdown menu ── */
.ctx-menu {
  position: fixed; z-index: calc(var(--z-modal) + 10); min-width: 168px;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius-m);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--shadow-2); padding: 5px; animation: modal-in var(--dur-fast) ease;
}
.ctx-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--text-1); padding: 8px 10px;
  border-radius: var(--radius-s); cursor: pointer; font-size: 13px;
}
.ctx-menu button svg { width: 15px; height: 15px; color: var(--text-2); }
.ctx-menu button:hover { background: var(--bg-3); }
.ctx-menu button.danger, .ctx-menu button.danger svg { color: var(--bad); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--stroke-soft); margin: 5px 3px; }

/* ── Color field (swatch + native picker + hex) ── */
.color-field { display: inline-flex; align-items: center; gap: 7px; }
.color-field .well {
  width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--stroke); cursor: pointer;
  position: relative; overflow: hidden; flex: none;
}
.color-field .well input[type="color"] { position: absolute; inset: -6px; width: 40px; height: 40px; border: 0; padding: 0; cursor: pointer; }
.color-field .hex { width: 74px; font-size: 12px; padding: 5px 7px; font-variant-numeric: tabular-nums; text-transform: uppercase; }

/* ── Color picker popover ── */
.cp-pop {
  position: fixed; z-index: calc(var(--z-modal) + 20); width: 272px;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 12px;
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: var(--shadow-2); padding: 12px; display: flex; flex-direction: column; gap: 10px;
  animation: modal-in var(--dur-fast) ease;
}
.cp-pop .cp-cap { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .07em; margin: 2px 0 -4px; }
/* loupe eyedropper: full-screen catch veil + magnified pixel grid that follows
   the cursor over the editor canvas */
.cp-loupe-veil { position: fixed; inset: 0; z-index: calc(var(--z-modal) + 40); cursor: crosshair; }
.cp-loupe-wrap {
  position: fixed; pointer-events: none; border-radius: 16px; overflow: hidden;
  border: 2px solid #fff; box-shadow: var(--shadow-2); width: 132px;
}
.cp-loupe { display: block; }
.cp-loupe-hex {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  font-size: 11px; font-weight: 600; color: #fff; padding: 3px 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8); background: rgba(0, 0, 0, .35);
}
.cp-pop .sw-add { display: grid; place-items: center; background: var(--bg-2); color: var(--text-2); font-size: 14px; line-height: 1; border: 1.5px dashed var(--stroke); }
.cp-pop .sw-add:hover { border-color: var(--accent); color: var(--text-1); }
.cp-sv { position: relative; height: 148px; border-radius: 9px; cursor: crosshair; touch-action: none; }
.cp-dot {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 1px 4px rgba(0,0,0,.4);
  transform: translate(-50%, -50%); pointer-events: none;
}
.cp-hue {
  position: relative; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-thumb {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 1px solid rgba(0,0,0,.25); box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transform: translate(-50%, -50%); pointer-events: none;
}
.cp-io { display: flex; align-items: center; gap: 8px; }
.cp-preview { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--stroke); flex: none; }
.cp-hex { flex: 1; font-size: 13px; padding: 6px 9px; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.cp-eye { flex: none; }
.cp-eye-ico { font-size: 14px; line-height: 1; }
.cp-rgb { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.cp-lab { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); }
.cp-num { width: 100%; padding: 5px 6px; font-size: 12.5px; text-align: center; appearance: textfield; -moz-appearance: textfield; }
.cp-num::-webkit-inner-spin-button, .cp-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* swatch rows */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches .sw { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--stroke); cursor: pointer; transition: transform var(--dur-fast); }
.swatches .sw:hover { transform: scale(1.15); }
.swatches .sw.on { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── Upgrade modal ── */
.upgrade-hero { text-align: center; padding: 8px 4px 2px; }
.upgrade-hero .ico { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 15px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 6px 20px rgba(139, 92, 246, .4); }
.upgrade-hero .ico svg { width: 26px; height: 26px; }
.upgrade-hero h3 { font-size: 17px; }
.upgrade-hero p { color: var(--text-2); font-size: 13px; margin-top: 5px; }
.upgrade-list { margin: 15px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.upgrade-list .it { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; padding: 5px 8px; border-radius: var(--radius-s); }
.upgrade-list .it svg { width: 16px; height: 16px; color: var(--good); flex: none; margin-top: 1px; }
/* the feature the user just bumped into: tinted so the modal answers "why am I
   seeing this" before it asks for money */
.upgrade-list .it.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.upgrade-list .it.on span { font-weight: 600; }

.up-plans { margin-bottom: 2px; }
.up-note { margin-top: 10px; font-size: 12px; text-align: center; }

/* ── Progress bar ── */
.prog { height: 7px; border-radius: 4px; background: var(--bg-3); overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent-grad); transition: width .18s ease; }

/* ── Keyboard hint ── */
kbd { background: var(--bg-3); border: 1px solid var(--stroke); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: inherit; color: var(--text-2); }

/* ── AI Studio: dashboard tool cards + the studio modal ── */
.ai-tools-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
  margin-bottom: 26px;
}
.ai-tool-card {
  position: relative;
  border: 1px solid var(--stroke); border-radius: var(--radius-m); background: var(--bg-1);
  padding: 13px 12px; cursor: pointer; text-align: left; transition: all var(--dur-fast);
  display: flex; flex-direction: column; gap: 3px;
}
.ai-tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-1); }
.ai-tool-card .em { font-size: 22px; margin-bottom: 3px; }
.ai-tool-card b { font-size: 13px; }
.ai-tool-card > span:last-child { font-size: 11px; color: var(--text-2); line-height: 1.35; }
.ai-tool-cost {
  position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 600;
  color: var(--text-2); background: var(--bg-2); border: 1px solid var(--stroke-soft);
  border-radius: 999px; padding: 2px 7px; line-height: 1.4;
}

/* the studio takes the whole screen: form rail left, big result canvas right.
   SOLID background — a work surface this big must never be glass: machines
   without backdrop-filter (GPU off, reduced transparency) render glass as
   fully see-through */
.modal.md-xl:has(.ai-studio) {
  width: calc(100vw - 28px); max-width: 1500px; height: 96vh;
  background: var(--bg-1); backdrop-filter: none; -webkit-backdrop-filter: none;
}
.modal.md-xl:has(.ai-studio) .modal-body { display: flex; }
/* live generation jobs above the tool cards: skeleton while running, failure
   card with the reason and a retry */
.ai-jobs-strip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.ai-job-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--stroke); border-radius: var(--radius-m); background: var(--bg-1);
}
.ai-job-card.failed { border-color: color-mix(in srgb, var(--bad) 45%, var(--stroke)); }
.ai-job-thumb {
  width: 46px; height: 46px; border-radius: var(--radius-s); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px; background: var(--bg-2);
}
.shimmer {
  background: linear-gradient(100deg, var(--bg-2) 40%, var(--bg-3) 50%, var(--bg-2) 60%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.ai-job-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ai-job-meta b { font-size: 13px; }
.ai-job-meta > span { font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ai-studio { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 18px; flex: 1; min-height: 0; }
@media (max-width: 820px) { .ai-studio { grid-template-columns: 1fr; overflow-y: auto; } }
/* single-column studio: the tool is a focused form, results land in My media.
   Full screen on purpose: the tool IS the screen while it is open. The form
   stays centered at a readable width; the media picker soaks up the height. */
.ai-studio.solo { display: flex; flex-direction: column; }
/* an AI tool is a full-screen PAGE like the editors, not a floating card:
   no veil frame, no radius, structural top and bottom bars */
.modal-veil:has(.ai-studio) { padding: 0; }
.modal.md-lg:has(.ai-studio) {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  border: 0; border-radius: 0; animation: none;
  background: var(--bg-1); backdrop-filter: none; -webkit-backdrop-filter: none;
}
.modal.md-lg:has(.ai-studio) .modal-head { padding: 12px 20px; border-bottom: 1px solid var(--stroke); }
/* back navigates from the left like every other page; the default ✕ goes away */
.modal.md-lg:has(.ai-studio) .modal-head > button:last-of-type { display: none; }
.ais-modal-head { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.ais-modal-head h3 { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal.md-lg:has(.ai-studio) .modal-foot { padding: 12px 20px; border-top: 1px solid var(--stroke); align-items: center; }
.modal.md-lg:has(.ai-studio) .modal-body { display: flex; overflow-y: auto; padding: 16px 24px; }
.ai-studio.solo .ais-left { width: 100%; }
.ai-studio.solo .ais-pick { max-height: 42vh; }
/* phones: compact grids, same full-screen page */
@media (max-width: 640px) {
  .modal.md-lg:has(.ai-studio) .modal-head { padding: 10px 14px; }
  .modal.md-lg:has(.ai-studio) .modal-body { padding: 12px 14px; }
  .ais-formats { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .ais-swatches { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  .ais-style-cards { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  .ai-studio.solo .ais-pick { max-height: 34vh; }
}
.ais-cost-note { align-self: center; }
/* platform format cards: brand mark, name, native size */
.ais-formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.ais-fmt {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 7px;
  border: 2px solid var(--stroke); border-radius: var(--radius-s); background: var(--bg-2);
  cursor: pointer; transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.ais-fmt:hover { transform: translateY(-1px); }
.ais-fmt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ais-fmt .fic { width: 22px; height: 22px; color: var(--text-2); }
.ais-fmt .fic svg { width: 100%; height: 100%; display: block; }
.ais-fmt .fname { font-size: 11px; font-weight: 600; line-height: 1.25; text-align: center; }
.ais-fmt .fdims { font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* backdrop pickers show the surface itself: tiny painted previews, no assets */
.ais-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.ais-swatch {
  display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 6px;
  border: 2px solid var(--stroke); border-radius: var(--radius-s); background: var(--bg-2);
  cursor: pointer; transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.ais-swatch:hover { transform: translateY(-1px); }
.ais-swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ais-swatch .sw-pic { display: block; position: relative; height: 44px; border-radius: 7px; border: 1px solid var(--stroke-soft); overflow: hidden; }
.ais-swatch .sw-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ais-swatch .sw-name { font-size: 11px; font-weight: 600; text-align: center; line-height: 1.2; }
.bs-studio { background: linear-gradient(180deg, #ffffff 0%, #f0f2f5 55%, #d9dde3 100%); }
.bs-marble {
  background:
    linear-gradient(115deg, transparent 42%, rgba(150, 152, 165, .5) 44%, transparent 47%),
    linear-gradient(100deg, transparent 68%, rgba(150, 152, 165, .35) 70%, transparent 73%),
    linear-gradient(135deg, #f7f7f8 0%, #e9e9ec 45%, #f4f3f1 60%, #dfdfe3 100%);
}
.bs-wood {
  background:
    repeating-linear-gradient(93deg, rgba(60, 34, 12, .25) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, #a5713f 0%, #8a5a30 60%, #74491f 100%);
}
.bs-gradient { background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 48%, #ff375f 100%); }
.bs-dark { background: linear-gradient(180deg, #33343a 0%, #17181c 70%, #0b0b0e 100%); }
.bs-nature {
  background:
    radial-gradient(circle at 28% 26%, rgba(255, 244, 179, .55), transparent 42%),
    radial-gradient(circle at 70% 65%, #7cb56a, transparent 68%),
    linear-gradient(180deg, #9ccc84 0%, #4f8a48 60%, #2f6335 100%);
}
.bs-concrete {
  background:
    radial-gradient(circle at 62% 30%, rgba(255, 255, 255, .1), transparent 45%),
    radial-gradient(circle at 25% 70%, rgba(0, 0, 0, .12), transparent 50%),
    linear-gradient(180deg, #9c9ea3 0%, #82848a 60%, #6d6f75 100%);
}
.bs-silk {
  background:
    linear-gradient(112deg, transparent 30%, rgba(255, 255, 255, .5) 38%, transparent 46%),
    linear-gradient(112deg, transparent 58%, rgba(255, 255, 255, .35) 66%, transparent 74%),
    linear-gradient(135deg, #e8cfd8 0%, #cba7b8 50%, #b98da3 100%);
}
.bs-beach {
  background: linear-gradient(180deg, #8ed0e8 0%, #5fb7d4 44%, #f0dcae 46%, #e3c689 100%);
}
.bs-neon {
  background:
    radial-gradient(circle at 22% 35%, rgba(255, 45, 146, .8), transparent 55%),
    radial-gradient(circle at 78% 40%, rgba(10, 200, 255, .7), transparent 55%),
    linear-gradient(180deg, #17131f 0%, #0b0a12 100%);
}
.bs-flowers {
  background:
    radial-gradient(circle at 25% 30%, #f2a9c4 0 14%, transparent 15%),
    radial-gradient(circle at 68% 24%, #f6c9d8 0 11%, transparent 12%),
    radial-gradient(circle at 45% 68%, #eb8fb2 0 13%, transparent 14%),
    radial-gradient(circle at 82% 70%, #f2a9c4 0 10%, transparent 11%),
    linear-gradient(180deg, #fbeef3 0%, #f3d8e2 100%);
}
/* poster styles */
.bs-modern {
  background:
    linear-gradient(300deg, transparent 55%, rgba(255, 255, 255, .22) 55% 70%, transparent 70%),
    linear-gradient(135deg, #0a84ff 0%, #5e5ce6 55%, #b039d3 100%);
}
.bs-retro {
  background: repeating-linear-gradient(180deg, #e8dcc0 0 9px, #d9743c 9px 18px, #a53f2b 18px 27px, #5f3b2a 27px 36px);
}
.bs-elegant {
  background:
    linear-gradient(115deg, transparent 40%, rgba(212, 175, 55, .5) 48%, transparent 56%),
    linear-gradient(180deg, #23242b 0%, #101116 100%);
}
.bs-grunge {
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 255, 255, .14), transparent 30%),
    radial-gradient(circle at 70% 60%, rgba(0, 0, 0, .5), transparent 45%),
    radial-gradient(circle at 55% 25%, rgba(255, 255, 255, .08), transparent 25%),
    linear-gradient(180deg, #4c4a48 0%, #2a2927 100%);
}
/* social visual styles */
.bs-photo {
  background: linear-gradient(180deg, #ffd089 0%, #ff9d5c 45%, #b8623c 46%, #7c4229 100%);
}
.bs-3d {
  background:
    radial-gradient(circle at 38% 32%, #ffffff 0 6%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 50% 45%, #7f7bff 0 38%, transparent 40%),
    linear-gradient(180deg, #2a2f45 0%, #171a28 100%);
}
.bs-illustration {
  background:
    radial-gradient(circle at 68% 38%, #ffd60a 0 18%, transparent 19%),
    linear-gradient(115deg, #ff5c8a 0 52%, #4aa8ff 52% 100%);
}
.bs-minimal {
  background:
    radial-gradient(circle at 72% 45%, #111318 0 7%, transparent 8%),
    linear-gradient(180deg, #fafafa 0%, #ececef 100%);
}
/* ad moods */
.bs-energetic { background: linear-gradient(115deg, #ff375f 0%, #ff8a00 55%, #ffd60a 100%); }
.bs-premium {
  background:
    linear-gradient(115deg, transparent 42%, rgba(212, 175, 55, .55) 50%, transparent 58%),
    linear-gradient(180deg, #17181d 0%, #060608 100%);
}
.bs-friendly { background: linear-gradient(135deg, #ffd9c4 0%, #ffb8b1 45%, #9ad0f5 100%); }
.bs-urgent { background: repeating-linear-gradient(135deg, #ffd60a 0 10px, #16171c 10px 20px); }
/* photo-fix goals */
.bs-enhance {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .35) 0 30%, transparent 30%),
    linear-gradient(135deg, #24c8db 0%, #0a84ff 60%, #5e5ce6 100%);
}
.bs-brighten { background: radial-gradient(circle at 50% 42%, #fff7d6 0 22%, #ffd60a 45%, #ff9d0a 100%); }
.bs-colors { background: linear-gradient(115deg, #ff375f 0%, #ff8a00 25%, #ffd60a 45%, #34c759 65%, #0a84ff 85%, #5e5ce6 100%); }
.bs-portrait {
  background:
    radial-gradient(circle at 45% 38%, #f2c9a8 0 26%, transparent 42%),
    linear-gradient(180deg, #b98a63 0%, #7c563a 100%);
}
/* headshot styles: the lighting/backdrop each portrait style produces */
.bs-corporate { background: linear-gradient(180deg, #b9bcc2 0%, #8f939b 60%, #767a83 100%); }
.bs-linkedin {
  background:
    radial-gradient(circle at 70% 35%, rgba(255, 255, 255, .35), transparent 50%),
    linear-gradient(135deg, #7f96ad 0%, #55677c 55%, #3c4a5c 100%);
}
.bs-creative {
  background:
    radial-gradient(circle at 25% 30%, rgba(255, 45, 146, .75), transparent 55%),
    radial-gradient(circle at 75% 65%, rgba(90, 200, 250, .65), transparent 55%),
    linear-gradient(180deg, #2b2140 0%, #1a1430 100%);
}
.bs-outdoor {
  background:
    radial-gradient(circle at 30% 35%, rgba(255, 214, 140, .85), transparent 45%),
    radial-gradient(circle at 72% 60%, rgba(255, 170, 90, .5), transparent 40%),
    linear-gradient(180deg, #e8b878 0%, #b97f45 60%, #8a5a30 100%);
}
.bs-kitchen {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .65) 0 34%, transparent 34%),
    repeating-linear-gradient(0deg, rgba(160, 165, 175, .3) 0 1px, transparent 1px 12px),
    linear-gradient(180deg, #eef1f4 0%, #d7dce2 55%, #c5cbd3 100%);
}
/* connection form helpers: key page shortcut, folded advanced fields, warning */
.ai-key-link { align-self: flex-start; margin: -2px 0 2px; }
.ai-advanced summary { font-size: 12px; color: var(--text-2); cursor: pointer; padding: 2px 0; }
.ai-advanced { border-top: 1px solid var(--stroke); padding-top: 6px; margin-top: 4px; }
.ai-warn-note { color: #e6a23c; }
.ais-left { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; padding-right: 6px; }
.ais-form { display: flex; flex-direction: column; gap: 7px; }
.ais-label { font-size: 12px; color: var(--text-2); font-weight: 600; margin-top: 5px; }
.ais-label .opt { font-weight: 400; color: var(--text-3); }
.ais-pick-tools { display: flex; gap: 6px; }
.ais-pick-tools .ais-search { flex: 1; min-width: 0; font-size: 12px; padding: 6px 9px; }
.ais-pick-tools .select { width: auto; font-size: 12px; padding: 5px 26px 5px 8px; }
.ais-pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 7px;
  padding: 2px; max-height: 252px; overflow-y: auto;
}
.ais-cell {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-s); overflow: hidden;
  border: 2px solid var(--stroke); background: var(--thumb-bg); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; color: var(--text-3);
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}
.ais-cell:hover { transform: scale(1.04); }
.ais-cell img { width: 100%; height: 100%; object-fit: cover; }
.ais-cell.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ais-cell.on::after {
  content: "✓"; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
.ais-cell.ais-up { border-style: dashed; }

/* logo brief: palette swatch chips + inspire dice */
.ais-palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.ais-pal {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border: 1.5px solid var(--stroke); border-radius: var(--radius-s); background: var(--bg-2);
  color: var(--text-2); font-size: 11.5px; cursor: pointer; transition: all var(--dur-fast);
}
.ais-pal:hover { border-color: var(--text-3); color: var(--text-1); }
.ais-pal.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text-1); }
.ais-pal .dots { display: flex; gap: 3px; flex: none; }
.ais-pal .dots i { width: 14px; height: 14px; border-radius: 999px; border: 1px solid rgba(0, 0, 0, .18); }
.ais-pal .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ais-dice { align-self: flex-start; }
.ais-custom-colors { display: flex; gap: 8px; padding: 2px; }

/* device-code sign-in (ChatGPT / Grok): status line sits under a centered
   row of actions, so it reads as part of the same centered block */
.ai-signin-status { text-align: center; margin-top: 8px; }

/* account forms (sign in / register / reset) */
.acct-form { display: flex; flex-direction: column; gap: 9px; min-width: 300px; }
.acct-form .acct-err { color: #ff6b6b; min-height: 1em; margin: 0; }
.acct-form a { font-size: 12.5px; }

/* auth modal: Google leads, email hides behind a quiet link. The Google
   button stays white in both themes, per Google's own branding sheet. */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; border-radius: 12px; cursor: pointer;
  background: #fff; color: #1f1f1f; border: 1px solid rgba(0, 0, 0, .18);
  font: inherit; font-size: 14px; font-weight: 700;
  transition: filter var(--dur-fast, .15s), transform var(--dur-fast, .15s);
}
.btn-google:hover { filter: brightness(.96); }
.btn-google:active { transform: scale(.985); }
.btn-google svg { flex: 0 0 auto; }
.auth-divider {
  display: flex; align-items: center; gap: 10px; margin: 2px 0;
  color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--stroke, rgba(128, 128, 128, .25)); }
.auth-email-toggle {
  background: none; border: 0; cursor: pointer; align-self: center; padding: 4px;
  font: inherit; font-size: 12.5px; color: var(--text-2);
  text-decoration: underline; text-underline-offset: 3px;
}
.auth-email-toggle:hover { color: var(--text-1); }

/* the lone sign-in button on the account card gets a bit more presence */
.btn-signin { padding: 10px 22px; font-size: 13.5px; }

/* layout / brand-text picks: little schematic drawings instead of word chips */
.ais-diag-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.ais-diag-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 6px 7px; border: 1.5px solid var(--stroke); border-radius: var(--radius-s);
  background: var(--bg-2); cursor: pointer; transition: all var(--dur-fast); min-width: 0;
}
.ais-diag-card:hover { transform: translateY(-1px); border-color: var(--text-3); }
.ais-diag-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.ais-diag-card .diag { width: 72px; height: 48px; display: block; }
.ais-diag-card .diag svg { width: 100%; height: 100%; display: block; }
.ais-diag-card .mk { fill: var(--accent); }
.ais-diag-card .tx { fill: var(--text-3); }
.ais-diag-card .tx.dim { opacity: .55; }
.ais-diag-card .sel { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.ais-diag-card .hd { fill: var(--bg-1); stroke: var(--accent); stroke-width: 1.5; }
.ais-diag-card .ring { fill: none; stroke: var(--text-3); stroke-width: 2; }
.ais-diag-card .frame { fill: none; stroke: var(--text-3); stroke-width: 2; }
.ais-diag-card .dname { font-size: 10.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ais-diag-card.on .dname { color: var(--text-1); }

/* style cards: the brand name rendered in each style's real typography.
   Compact grid: in the wide solo modal two columns became huge slabs */
.ais-style-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; }
.ais-style-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 8px 6px; border: 1.5px solid var(--stroke); border-radius: var(--radius-s);
  background: #ffffff; cursor: pointer; transition: all var(--dur-fast); min-width: 0;
}
.ais-style-card:hover { transform: translateY(-1px); border-color: var(--text-3); }
.ais-style-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ais-style-card .sample {
  font-size: 17px; line-height: 1.15; color: #16181d; max-width: 100%;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ais-style-card .sname { font-size: 10px; color: #6a7080; }
.sample.ss-auto { font-size: 20px; }
.sample.ss-minimal { font-family: "Montserrat", sans-serif; font-weight: 800; letter-spacing: -.02em; }
.sample.ss-geometric { font-family: "Poppins", sans-serif; font-weight: 800; }
.sample.ss-abstract {
  font-family: "Sora", sans-serif; font-weight: 800;
  background: linear-gradient(90deg, #5e5ce6, #0a84ff); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sample.ss-mascot { font-family: "Fredoka", sans-serif; font-weight: 600; color: #ff8a00; }
.sample.ss-emblem { font-family: "Playfair Display", serif; font-weight: 700; }
.sample.ss-handdrawn { font-family: "Pacifico", cursive; font-weight: 400; color: #d81b60; }
.sample.ss-tech {
  font-family: "Space Grotesk", sans-serif; font-weight: 700;
  background: linear-gradient(90deg, #22d3ee, #5e5ce6); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sample.ss-luxury { font-family: "Cormorant Garamond", serif; font-weight: 700; color: #b8912f; letter-spacing: .1em; }
.sample.ss-retro { font-family: "Abril Fatface", serif; font-weight: 400; color: #d7263d; }
.sample.ss-organic { font-family: "Quicksand", sans-serif; font-weight: 700; color: #2f855a; }
.sample.ss-playful { font-family: "Luckiest Guy", cursive; font-weight: 400; color: #ff8a00; }
.sample.ss-sport { font-family: "Archivo Black", sans-serif; font-weight: 400; font-style: italic; color: #d7263d; }
.sample.ss-eco { font-family: "Comfortaa", sans-serif; font-weight: 700; color: #2f855a; }
.sample.ss-gaming { font-family: "Orbitron", sans-serif; font-weight: 800; color: #7c5cff; }
.sample.ss-artdeco { font-family: "Cinzel", serif; font-weight: 700; color: #b8912f; letter-spacing: .08em; }
.sample.ss-pixel { font-family: "Silkscreen", cursive; font-weight: 700; font-size: 12px; color: #34c759; }

.ais-result {
  border: 1px solid var(--stroke-soft); border-radius: var(--radius-m); background: var(--bg-canvas);
  display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
  padding: 16px; min-height: 260px;
}
.ais-result .row { width: 100%; align-items: center; flex: none; }
.ais-hint { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; text-align: center; max-width: 280px; }
.ais-busy { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }
.ais-img { max-width: 100%; min-height: 0; flex: 1; object-fit: contain; border-radius: var(--radius-s); box-shadow: var(--shadow-2); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--stroke); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── AI Studio: per-tool prompt editor ── */
.ais-modal-head { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ais-modal-head h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the dot is the only signal that results come from a custom prompt */
.ais-cog { position: relative; flex: none; }
.ais-cog.on { color: var(--accent); }
.ais-cog.on::after {
  content: ""; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px;
  border-radius: 999px; background: var(--accent); border: 1.5px solid var(--bg-1);
}
.ais-prompt-ta { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; resize: vertical; }
.ais-prompt-status { color: var(--text-3); margin: 2px 0 6px; }
.ais-prompt-status.on { color: var(--accent); font-weight: 600; }
.ais-prompt-keys { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.ais-prompt-keys .chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.ais-prompt-previewLabel { color: var(--text-3); margin: 12px 0 4px; }
.ais-prompt-preview {
  font-size: 12.5px; line-height: 1.55; color: var(--text-2); background: var(--bg-2);
  border: 1px solid var(--stroke-soft); border-radius: var(--radius-s);
  padding: 9px 11px; max-height: 150px; overflow-y: auto; white-space: pre-wrap;
}

/* ── AI settings: provider connect tiles ── */
.ai-connect-heading {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin: 14px 0 8px;
}
/* fixed 2 columns: four providers land as a tidy 2x2 instead of 3 + a lone one */
.ai-connect-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
@media (max-width: 520px) { .ai-connect-grid { grid-template-columns: 1fr; } }
.ai-connect-tile {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-width: 0; text-align: left;
  border: 1.5px solid var(--stroke); border-radius: var(--radius-m); background: var(--bg-2);
  color: var(--text-1); cursor: pointer; transition: all var(--dur-fast);
}
.ai-connect-tile:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.ai-connect-tile .mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
}
.ai-connect-tile .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ai-connect-tile .meta b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-connect-tile .how { font-size: 11.5px; color: var(--text-3); }
.ai-connect-tile.p-chatgpt .mark { background: #10a37f; }
.ai-connect-tile.p-grok    .mark { background: #1a1a1a; border: 1px solid var(--stroke); }
.ai-connect-tile.p-claude  .mark { background: #d97757; }
.ai-connect-tile.p-gemini  .mark { background: linear-gradient(135deg, #4285f4, #9b72cb); }
.ai-connect-other { margin-top: 10px; }

/* ── AI job progress ── */
.ai-job-bar { height: 4px; border-radius: 2px; background: var(--bg-3); overflow: hidden; margin-top: 7px; }
.ai-job-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent-grad); width: 0; transition: width .4s linear; }
.ai-job-pct { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-3); flex: none; margin-left: 10px; }

/* ── compact connection rows (user + admin panels share this look) ── */
.ai-row {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 8px 11px; border: 1px solid var(--stroke);
  border-radius: var(--radius-m); background: var(--bg-2);
}
.ai-row.active { border-color: var(--accent); }
.ai-row b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 40%; }
.ai-row .st { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.ai-row .st.ok { color: var(--good); }
.ai-row .acts { display: flex; gap: 1px; flex: none; margin-left: auto; }
.ai-row .is-on { color: var(--accent); }
.p-mark {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; background: var(--bg-3);
}
.p-mark.p-chatgpt, .p-mark.p-openai { background: #10a37f; }
.p-mark.p-grok   { background: #1a1a1a; border: 1px solid var(--stroke); }
.p-mark.p-claude { background: #d97757; }
.p-mark.p-gemini { background: linear-gradient(135deg, #4285f4, #9b72cb); }
.p-mark.p-fal    { background: #7c3aed; }
.p-mark.p-other  { background: var(--bg-3); color: var(--text-2); }

/* ── auto-loaded model suggestion chips (user + admin edit forms) ── */
.model-field { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.model-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.model-chips .chip { font-size: 11px; padding: 3px 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Tooltip: appears after a short beat instead of the browser's near-second
   wait, and instantly while you sweep along a row. Small, dark and rounded. */
.tip {
  position: fixed; z-index: var(--z-toast); pointer-events: none;
  max-width: 280px; padding: 5px 9px; border-radius: 7px;
  font-size: 11.5px; line-height: 1.35; letter-spacing: .01em;
  color: #fff; background: rgba(28, 28, 32, .94);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .34);
  backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  opacity: 0; transform: translateY(-3px) scale(.97);
  transition: opacity .1s ease, transform .1s ease;
}
.tip.on { opacity: 1; transform: none; }
@media (pointer: coarse) { .tip { display: none; } }
