/* studio.css — Clean modern stylesheet for InkedStudio / InkedStudio module.
   Mobile-first, no build step, drop-in for any host page.
   CSS custom properties so the host can theme via :root vars. */

:root {
  /* Brand */
  --studio-accent: #7c3aed;          /* primary action */
  --studio-accent-2: #06b6d4;         /* secondary accent */
  --studio-accent-soft: #f5f3ff;

  /* Surfaces */
  --studio-bg: #f8fafc;
  --studio-surface: #ffffff;
  --studio-surface-2: #f1f5f9;
  --studio-border: #e2e8f0;
  --studio-border-strong: #cbd5e1;

  /* Text */
  --studio-text: #0f172a;
  --studio-text-muted: #64748b;
  --studio-text-soft: #94a3b8;

  /* Status */
  --studio-success: #10b981;
  --studio-warn: #f59e0b;
  --studio-error: #ef4444;

  /* Radius / shadow */
  --studio-radius: 14px;
  --studio-radius-sm: 8px;
  --studio-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --studio-shadow: 0 4px 18px rgba(15, 23, 42, .08);
  --studio-shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);

  /* Layout */
  --studio-max-width: 1320px;
  --studio-header-h: 56px;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

.inked-studio,
.inked-studio * {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
}

.inked-studio {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--studio-max-width);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  box-shadow: var(--studio-shadow);
  overflow: hidden;
  color: var(--studio-text);
}

/* ---------- header ---------- */
.is-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--studio-border);
  background: linear-gradient(135deg, #faf5ff 0%, #eff6ff 100%);
}

.is-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.is-header-title .badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--studio-accent), var(--studio-accent-2));
  color: #fff;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.is-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.is-btn-ghost {
  border-color: var(--studio-border);
  background: transparent;
  color: var(--studio-text-muted);
  font-weight: 600;
}
.is-btn-ghost:hover {
  border-color: var(--studio-accent);
  color: var(--studio-accent);
  background: var(--studio-accent-soft);
}
.is-chat-history .is-caret {
  font-size: 10px;
  transition: transform .15s ease;
}
.is-chat-history[aria-expanded="true"] .is-caret {
  transform: rotate(180deg);
}

.is-chat-menu {
  position: absolute;
  top: 56px;
  right: 16px;
  z-index: 50;
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
}
.is-chat-menu[hidden] { display: none; }
.is-chat-menu-empty {
  padding: 16px;
  font-size: 12px;
  color: var(--studio-text-muted);
  text-align: center;
}
.is-chat-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--studio-radius-sm);
  cursor: pointer;
  transition: background .12s ease;
}
.is-chat-menu-item:hover {
  background: var(--studio-surface-2);
}
.is-chat-menu-item-active {
  background: var(--studio-accent-soft);
  border-left: 3px solid var(--studio-accent);
  padding-left: 7px;
}
.is-chat-menu-item-body {
  flex: 1;
  min-width: 0;
}
.is-chat-menu-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--studio-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-chat-menu-item-meta {
  font-size: 11px;
  color: var(--studio-text-muted);
  margin-top: 2px;
}
.is-chat-menu-item-del {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--studio-text-muted);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: all .12s ease;
}
.is-chat-menu-item:hover .is-chat-menu-item-del {
  opacity: 1;
}
.is-chat-menu-item-del:hover {
  background: var(--studio-error);
  color: #fff;
}

/* Position the header relatively so the absolute-positioned chat menu anchors correctly. */
.is-header { position: relative; }

/* Inline media inside assistant chat bubbles (persisted generations). */
.is-msg-caption {
  font-size: 13px;
  color: var(--studio-text);
}
.is-bubble-assistant img,
.is-bubble-assistant video {
  margin-top: 8px;
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--studio-radius-sm);
  display: block;
}

.is-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--studio-border-strong);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface);
  color: var(--studio-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.is-btn:hover { background: var(--studio-surface-2); border-color: var(--studio-text-muted); }
.is-btn:focus-visible { outline: 2px solid var(--studio-accent); outline-offset: 2px; }

.is-btn-primary {
  background: var(--studio-accent);
  border-color: var(--studio-accent);
  color: #fff;
}
.is-btn-primary:hover { background: #6d28d9; border-color: #6d28d9; }

/* Transient success/error states (used by Copy button feedback) */
.is-btn-success {
  background: rgba(34, 197, 94, 0.18) !important;
  border-color: rgba(34, 197, 94, 0.55) !important;
  color: #86efac !important;
}
.is-btn-error {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.55) !important;
  color: #fca5a5 !important;
}

.is-btn-icon {
  width: 32px;
  padding: 0;
}

/* ---------- credits badge ---------- */
.is-credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}
.is-credits::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--studio-success);
}
.is-credits.is-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.is-credits.is-error::before { background: var(--studio-error); }

/* ---------- help icon + tooltip (shared across the user area) ---------- */
/* A small "?" circle next to a label/button that, on hover or focus,
   reveals a popover with a short explanation of what the thing does.
   Usage:
     <label>Username <button type="button" class="is-help" data-help="..."
       aria-describedby="tip-username">?</button></label>
   The popover is rendered by JS on first hover/focus and positioned
   below/above the icon depending on available space. */
button.is-help,
.is-help,
.login-card .is-help,
.login-card button.is-help {
  /* Reset every default button styling inherited from page-scoped
     button rules. We use all: revert + high-specificity selectors
     so the help icon stays a small inline circle regardless of
     where it lives (login form, admin form, studio composer, etc.).
     The .login-card / .login-card button override below has higher
     specificity than the page-scoped .login-card button { width:100% }
     rule, which would otherwise win. */
  all: revert;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin: 0 0 0 6px;
  border: 1px solid var(--studio-border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--studio-text-muted);
  font: 700 10px/1 -apple-system, system-ui, sans-serif;
  cursor: help;
  vertical-align: middle;
  flex: 0 0 auto;
  transition: all .12s ease;
  text-transform: none;
  letter-spacing: 0;
}
.is-help:hover,
.is-help:focus-visible,
.login-card .is-help:hover,
.login-card .is-help:focus-visible {
  color: var(--studio-accent);
  border-color: var(--studio-accent);
  outline: none;
  filter: none;
  background: transparent;
}
.is-help[aria-expanded="true"] {
  color: #fff;
  background: var(--studio-accent);
  border-color: var(--studio-accent);
}

/* Popover — created on demand by the JS, appended to <body> so it
   escapes any overflow:hidden container the trigger might be inside. */
.is-tooltip {
  position: absolute;
  z-index: 10000;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--studio-border-strong);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface);
  color: var(--studio-text);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: var(--studio-shadow-lg);
  pointer-events: auto;
}
.is-tooltip[hidden] { display: none; }
.is-tooltip::before {
  /* Arrow pointing up at the trigger. Positioned dynamically by JS. */
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--studio-surface);
  border-top: 1px solid var(--studio-border-strong);
  border-left: 1px solid var(--studio-border-strong);
}
.is-tooltip.is-tooltip-above::before {
  top: auto;
  bottom: -6px;
  border-top: 0;
  border-left: 0;
  border-bottom: 1px solid var(--studio-border-strong);
  border-right: 1px solid var(--studio-border-strong);
}

/* Inline help icon — small "?" circle next to a label or button row.
   Sits inline with adjacent buttons; the margin-left pushes it past the
   last button in a flex row. */
.is-help.is-help-inline {
  margin-left: 2px;
  width: 16px;
  height: 16px;
}

/* ---------- body layout (stream + composer | gallery sidebar) ---------- */
.is-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.is-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- gallery sidebar (right column, "Your work") ---------- */
.is-gallery-sidebar {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--studio-border);
  background: var(--studio-surface);
  overflow: hidden;
}
.is-gallery-sidebar.is-gallery-empty {
  display: none;  /* hide the column entirely when there's nothing to show */
}
.is-gallery-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--studio-border);
  background: var(--studio-surface);
  flex: 0 0 auto;
}
.is-gallery-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-text);
  letter-spacing: .02em;
  text-transform: uppercase;
  flex: 1;
  min-width: 0;
}
.is-gallery-head .count {
  font-size: 11px;
  color: var(--studio-text-muted);
}
.is-gallery-head .danger {
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.35);
  color: #b91c1c;
  border-radius: var(--studio-radius-sm);
  cursor: pointer;
  font-weight: 500;
}
.is-gallery-head .danger:hover { background: rgba(239,68,68,.20); }
.is-gallery-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.is-gallery-empty-msg {
  padding: 40px 14px;
  text-align: center;
  color: var(--studio-text-muted);
  font-size: 12px;
  line-height: 1.5;
}
.is-gallery-empty-msg strong {
  display: block;
  color: var(--studio-text);
  font-size: 13px;
  margin-bottom: 4px;
  font-weight: 600;
}
.is-gallery-group {
  margin-bottom: 16px;
}
.is-gallery-group:last-child { margin-bottom: 0; }
.is-gallery-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--studio-border);
}
.is-gallery-group-head h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--studio-text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-gallery-group-head .meta {
  font-size: 10px;
  color: var(--studio-text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 600;
}
.is-gallery-group-head button {
  background: transparent;
  border: 0;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.is-gallery-group-head button:hover { background: rgba(239,68,68,.10); }
.is-gallery-group-head button:disabled { opacity: .5; cursor: not-allowed; }
.is-gallery-group-head .is-gallery-delete-chat {
  flex: 0 0 auto;
}
.is-gallery-group-title {
  /* The chat title — styled like a link, opens the chat in the studio. */
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 4px 6px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--studio-text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .12s ease, color .12s ease;
}
.is-gallery-group-title:hover {
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
}
.is-gallery-group-title:focus-visible {
  outline: 2px solid var(--studio-accent);
  outline-offset: 2px;
}

.is-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.is-gallery-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--studio-radius-sm);
  overflow: hidden;
  background: var(--studio-surface-2);
  border: 1px solid var(--studio-border);
  cursor: zoom-in;
  padding: 0;
}
.is-gallery-thumb:hover { border-color: var(--studio-accent); }
.is-gallery-thumb video,
.is-gallery-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.is-gallery-thumb.is-busy { opacity: .35; pointer-events: none; }

/* Play overlay — only shown on video thumbs so they read as "watch me"
   instead of just "this is a still frame". */
.is-gallery-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.25);
  color: rgba(255,255,255,.95);
  pointer-events: none;
  transition: background .12s ease;
}
.is-gallery-thumb:hover .is-gallery-play {
  background: rgba(0,0,0,.40);
}

/* ---------- lightbox (lives inside the sidebar) ---------- */
.is-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 32px;
}
.is-lightbox.is-lightbox-open { display: flex; }
.is-lightbox img, .is-lightbox video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--studio-radius);
  box-shadow: 0 30px 60px rgba(0,0,0,.5);
}
.is-lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
}
.is-lightbox-body {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: calc(100vh - 180px);
}
.is-lightbox-body img,
.is-lightbox-body video {
  max-height: calc(100vh - 180px);
}
.is-lightbox-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.is-lightbox-actions .is-btn {
  background: var(--studio-surface);
  color: var(--studio-text);
  border-color: var(--studio-border-strong);
}
.is-lightbox-actions .is-btn-primary {
  background: var(--studio-accent);
  color: #fff;
  border-color: var(--studio-accent);
}
.is-lightbox-actions .is-btn:hover {
  filter: brightness(1.05);
}
.is-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}
.is-lightbox-close:hover { background: rgba(255,255,255,.28); }

/* ---------- responsive: stack the sidebar below on small screens ---------- */
@media (max-width: 900px) {
  .is-body { flex-direction: column; }
  .is-gallery-sidebar {
    flex: 0 0 auto;
    border-left: 0;
    border-top: 1px solid var(--studio-border);
    max-height: 280px;
  }
}

/* ---------- stream ---------- */
.is-stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--studio-bg);
  scroll-behavior: smooth;
}

.is-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--studio-radius);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: is-bubble-in .25s ease-out;
}
.is-bubble-user {
  align-self: flex-end;
  background: var(--studio-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.is-bubble-assistant {
  align-self: flex-start;
  background: var(--studio-surface);
  border: 1px solid var(--studio-border);
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  max-width: min(880px, 88%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.is-bubble-assistant:has(.is-plan) {
  /* Let the bubble stretch to contain the plan card full-width */
  max-width: 100%;
}
.is-bubble-assistant > .is-plan {
  margin: 0;
}
/* Chips inside a bubble span the bubble's width instead of being capped at
   92% (the outer-stream rule is for the empty-state at the stream root). */
.is-bubble-assistant .is-suggestions {
  max-width: 100%;
  padding: 0;
}

/* Inline name-input row that appears inside the step-3 bubble when the
   user picks "Type your own". Sits below the chips and matches the
   existing input styling. */
.is-name-input {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.is-name-input .is-input {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--studio-border-strong);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface);
  color: var(--studio-text);
  font: inherit;
  font-size: 13px;
}
.is-name-input .is-input:focus {
  outline: 2px solid var(--studio-accent);
  outline-offset: 1px;
  border-color: var(--studio-accent);
}
.is-name-input .is-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
}

/* Selected chip state for attribute picks. Filled accent + white text so the
   user can see at a glance which attribute they chose. */
.is-chip.is-chip-selected {
  background: var(--studio-accent);
  color: #fff;
  border-color: var(--studio-accent);
}
.is-chip.is-chip-selected:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

/* Attribute form: a labelled row of chips per attribute, with the Continue
   button at the bottom. Sits inside an assistant bubble (column flex). */
.is-attr-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.is-attr-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.is-attr-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--studio-text-muted);
}
.is-attr-form .is-suggestions {
  max-width: 100%;
  padding: 0;
}
.is-attr-continue {
  align-self: flex-start;
  margin-top: 4px;
}
/* The "Type your own" chip is an action, not a value pick — render it
   dashed so it reads as different from the value chips around it. */
.is-chip.is-chip-custom {
  border-style: dashed;
  color: var(--studio-text);
}
.is-chip.is-chip-custom.is-chip-selected {
  /* If the user has entered a custom value we still mark it selected so
     the user gets visual feedback that their custom name is "picked". */
  border-style: solid;
}
/* Inline name-input row that appears inside the basics form when the
   user picks "Type your own". Sits below the chips in the same row. */
.is-name-input {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.is-name-input .is-input {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--studio-border-strong);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface);
  color: var(--studio-text);
  font: inherit;
  font-size: 13px;
}
.is-name-input .is-input:focus {
  outline: 2px solid var(--studio-accent);
  outline-offset: 1px;
  border-color: var(--studio-accent);
}
.is-name-input .is-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 14px;
}

@keyframes is-bubble-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- empty-state suggestion chips ---------- */
.is-suggestions {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px 4px;
  max-width: 92%;
}
.is-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--studio-accent);
  border-radius: 999px;
  background: var(--studio-surface);
  color: var(--studio-accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.is-chip:hover {
  background: var(--studio-accent);
  color: #fff;
  border-color: var(--studio-accent);
}
.is-chip:focus-visible {
  outline: 2px solid var(--studio-accent);
  outline-offset: 2px;
}
/* In-flight state for chips that trigger an async action (Improve, image
   generation, etc.). The chip becomes a spinner so the user sees
   something happening instead of wondering if their click registered. */
.is-chip:disabled,
.is-chip.is-chip-busy {
  cursor: progress;
  position: relative;
  color: var(--studio-accent);
  background: var(--studio-accent-soft);
  border-color: var(--studio-accent);
  opacity: .8;
}
.is-chip.is-chip-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 12px;
  border: 2px solid var(--studio-accent);
  border-top-color: transparent;
  border-radius: 999px;
  animation: is-chip-spin .7s linear infinite;
}
@keyframes is-chip-spin { to { transform: rotate(360deg); } }
.is-chip-primary {
  background: var(--studio-accent);
  color: #fff;
  border-color: var(--studio-accent);
}
.is-chip-primary:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

/* ---------- empty-state welcome ---------- */
.is-empty-sub {
  font-size: 12px;
  color: var(--studio-text-muted);
  line-height: 1.5;
  margin-top: 6px;
}

/* ---------- draft plan card (preset-loaded or in-progress plan) ---------- */
.is-draft-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 8px;
  font-size: 12px;
  color: var(--studio-text-muted);
}
.is-draft-header strong {
  color: var(--studio-text);
  font-weight: 700;
}
.is-draft-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
}
.is-plan-draft {
  margin-top: 0;
}

/* ---------- slash menu (floats above the composer) ---------- */
.is-slash-menu {
  position: fixed;
  z-index: 1080;
  max-height: min(22rem, 55vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(13, 110, 253, .35);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 .75rem 2rem rgba(15, 23, 42, .18);
  font-family: inherit;
}
.is-slash-menu.d-none { display: none !important; }
.is-slash-group {
  padding: 6px 10px 2px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.is-slash-option {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #263246;
  text-align: left;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.is-slash-option:hover,
.is-slash-option.is-selected {
  background: rgba(13, 110, 253, .1);
}
.is-slash-option code {
  color: #7c3aed;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}
.is-slash-option span {
  color: #64748b;
  font-size: 12px;
}

/* ---------- /help inline card ---------- */
.is-help-card {
  align-self: stretch;
  margin: 0 4px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(139, 92, 246, .06), #fff 70%);
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
}
.is-help-card-header {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6d28d9;
}
.is-help-card-body {
  display: grid;
  gap: 12px;
}
.is-help-group {
  display: grid;
  gap: 4px;
}
.is-help-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
}
.is-help-cmd {
  display: grid;
  grid-template-columns: minmax(8rem, auto) 1fr;
  gap: 12px;
  padding: 3px 0;
  line-height: 1.4;
}
.is-help-cmd code {
  color: #7c3aed;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}
.is-help-cmd span {
  color: #475569;
  font-size: 12px;
}

/* ---------- floating status pill (above composer) ---------- */
.is-status-floating {
  display: none;
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--studio-surface-2);
  border: 1px solid var(--studio-border);
  color: var(--studio-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.is-status-floating.is-visible {
  display: block;
  animation: is-bubble-in .2s ease-out;
}

/* ---------- plan card (assistant response with prompt + settings) ---------- */
.is-plan {
  align-self: stretch;
  margin-top: 12px;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  overflow: hidden;
  /* Nested inside assistant bubble — keep visual weight light, no shadow */
  box-shadow: none;
}


.is-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #faf5ff, #eff6ff);
  border-bottom: 1px solid var(--studio-border);
}
.is-plan-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--studio-text);
  letter-spacing: -.005em;
}
.is-plan-header .badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.is-plan-body { padding: 14px 16px; }

.is-prompt-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--studio-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 12px;
  padding: 12px;
  background: var(--studio-surface-2);
  border-radius: var(--studio-radius-sm);
  border: 1px dashed var(--studio-border);
}

.is-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.is-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--studio-accent-soft);
  color: var(--studio-accent);
  letter-spacing: .02em;
}

.is-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- status ---------- */
.is-status {
  align-self: flex-start;
  max-width: 85%;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--studio-surface-2);
  font-size: 12px;
  color: var(--studio-text-muted);
}
.is-status:empty { display: none; }

/* ---------- attachments ---------- */
.is-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-end;
  max-width: 85%;
}
.is-attachment {
  position: relative;
  width: 80px; height: 80px;
  border-radius: var(--studio-radius-sm);
  overflow: hidden;
  background: var(--studio-text);
  border: 1px solid var(--studio-border);
}
.is-attachment img, .is-attachment video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.is-attachment-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* ---------- composer ---------- */
.is-composer {
  flex: 0 0 auto;
  padding: 14px 16px;
  border-top: 1px solid var(--studio-border);
  background: var(--studio-surface);
}

/* ---------- AI-picked pill (primary surface for settings) ---------- */
.is-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface-2);
  color: var(--studio-text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all .15s ease;
}
.is-pick:hover {
  border-color: var(--studio-accent);
  background: var(--studio-accent-soft);
}
.is-pick:focus-visible {
  outline: 2px solid var(--studio-accent);
  outline-offset: 2px;
}
.is-pick-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.is-pick-caret {
  font-size: 11px;
  color: var(--studio-text-muted);
  transition: transform .15s ease;
}
.is-pick[aria-expanded="true"] .is-pick-caret {
  transform: rotate(180deg);
}

.is-composer-settings[hidden] { display: none; }

.is-composer-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  align-items: end;
}
.is-composer-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.is-composer-field[hidden] { display: none; }
.is-composer-field > span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--studio-text-muted);
}
.is-composer-settings .is-pill-cost {
  align-self: end;
  justify-self: end;
}

.is-input-wrap {
  position: relative;
  border: 1px solid var(--studio-border-strong);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.is-input-wrap:focus-within {
  border-color: var(--studio-accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.is-textarea {
  width: 100%;
  min-height: 64px;
  max-height: 400px;
  padding: 12px 90px 12px 14px;
  border: 0;
  background: transparent;
  color: var(--studio-text);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  /* Allow the user to drag the bottom-right corner to make the textarea
     taller for long prompts. Vertical-only — horizontal resize would
     blow out the composer width. Browser default resize grip is good
     enough; no custom handle needed. */
  resize: vertical;
  outline: 0;
}
.is-textarea::placeholder { color: var(--studio-text-soft); }

.is-composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
}

.is-composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.is-send {
  min-width: 90px;
}

/* ---------- spinner ---------- */
.is-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: is-spin .8s linear infinite;
}
.is-btn-primary .is-spinner { display: none; }
.is-btn-primary.is-loading .is-spinner { display: inline-block; }
.is-btn-primary.is-loading .is-label { display: none; }

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

/* ---------- result media ---------- */
.is-result {
  align-self: stretch;
  padding: 14px 16px;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}
.is-result img, .is-result video {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: var(--studio-radius-sm);
  background: var(--studio-text);
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .inked-studio { border-radius: var(--studio-radius-sm); }
  .is-header { padding: 12px 14px; }
  .is-stream { padding: 14px; }
  .is-bubble { max-width: 92%; }
  .is-textarea { min-height: 56px; }
  .is-composer-row { flex-direction: column; align-items: stretch; }
  .is-send { width: 100%; }
  .is-plan-settings { grid-template-columns: 1fr; }
  .is-composer-settings { grid-template-columns: 1fr 1fr; }
}

/* ---------- editable prompt inside plan card ---------- */
.is-prompt-edit {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface-2);
  color: var(--studio-text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
}
.is-prompt-edit:focus {
  outline: none;
  border-color: var(--studio-accent);
  background: var(--studio-surface);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

/* ---------- settings grid inside plan card ---------- */
.is-plan-settings {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.is-plan-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.is-plan-field > span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--studio-text-muted);
}
.is-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--studio-border-strong);
  border-radius: 6px;
  background: var(--studio-surface);
  color: var(--studio-text);
  font: inherit;
  font-size: 13px;
}
.is-select:focus {
  outline: none;
  border-color: var(--studio-accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}
.is-pill-cost {
  align-self: end;
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
}

/* ---------- result media (post-generation) ---------- */
.is-result {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--studio-border);
  border-radius: var(--studio-radius);
  background: var(--studio-surface);
}
.is-result-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--studio-text-muted);
}
.is-result img,
.is-result video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 520px;
  border-radius: var(--studio-radius-sm);
  background: var(--studio-text);
  cursor: zoom-in;
  object-fit: contain;
}

/* ---------- video job placeholder (while polling) ---------- */
.is-result-job {
  min-height: 80px;
}
.is-job-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--studio-border-strong);
  border-radius: var(--studio-radius-sm);
  background: var(--studio-surface-2);
  color: var(--studio-text);
  font-size: 13px;
  font-weight: 500;
}
.is-job-status .is-spinner {
  border-color: rgba(124, 58, 237, .3);
  border-top-color: var(--studio-accent);
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}