:root {
  --bg: #f5f6f8;
  --paper: #ffffff;
  --paper-soft: #f9fafb;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --blue: #1768e8;
  --blue-dark: #0f55c7;
  --blue-soft: #eaf2ff;
  --green: #16845f;
  --rose: #cf3f5f;
  --sand: #ebe4d8;
  --shadow: 0 16px 36px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 8px 22px rgba(16, 24, 40, 0.06);
}

textarea#promptInput {
  min-height: 220px;
  line-height: 1.55;
}

textarea#iterationPrompt {
  min-height: 136px;
}

.prompt-assist-panel {
  gap: 8px;
}

.prompt-assist-panel.hidden-simple {
  display: none;
}

.prompt-assist-panel.compact-assist {
  padding: 0;
  border: 0;
  background: transparent;
}

.prompt-assist-toggle {
  width: 100%;
  min-height: 42px;
}

.prompt-assist-panel.compact-assist:not(.expanded) .prompt-assist-header,
.prompt-assist-panel.compact-assist:not(.expanded) .prompt-assist-controls,
.prompt-assist-panel.compact-assist:not(.expanded) .prompt-assist-result,
.prompt-assist-panel.compact-assist:not(.expanded) #applyPromptAssistButton {
  display: none;
}

.prompt-assist-panel.compact-assist.expanded {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.prompt-assist-result {
  min-height: 48px;
  max-height: 132px;
  overflow: auto;
}

.generation-path-guide {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfd;
}

.generation-path-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.generation-path-title strong,
.iteration-path-hint strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.generation-path-title span,
.iteration-path-hint span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.generation-path-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.generation-path-card {
  display: grid;
  gap: 3px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.generation-path-card:hover {
  border-color: #c7d7ff;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.06);
  transform: translateY(-1px);
}

.generation-path-card.active {
  border-color: rgba(37, 99, 235, 0.45);
  background: #eef4ff;
}

.generation-path-card:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.generation-path-card strong {
  font-size: 13px;
  font-weight: 900;
}

.generation-path-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.generation-path-link {
  min-height: 34px;
  border: 1px dashed #c7d7ff;
  border-radius: 10px;
  background: #fff;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 850;
}

.iteration-path-hint {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid #dbe7ff;
  border-radius: 12px;
  background: #f7faff;
}

.project-stage {
  flex-basis: 96px;
  min-width: 96px;
}

.project-stage small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.project-stage.active small {
  color: #1d4ed8;
}

.stage-folder-bar {
  margin: 12px 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.stage-folder-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.stage-folder-title div {
  min-width: 0;
}

.stage-folder-title strong,
.stage-folder-title span {
  display: block;
}

.stage-folder-title strong {
  color: var(--ink);
  font-size: 14px;
}

.stage-folder-title span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.stage-folder-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.stage-chain-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.stage-folder-chip,
.stage-filter-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.stage-folder-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
}

.stage-folder-chip span {
  font-weight: 700;
}

.stage-folder-chip strong {
  color: var(--muted);
  font-size: 12px;
}

.stage-folder-chip.active {
  border-color: rgba(37, 99, 235, 0.42);
  background: #eef4ff;
  color: #1d4ed8;
}

.stage-filter-toggle {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  color: var(--muted);
}

.stage-filter-toggle.active {
  border-color: rgba(37, 99, 235, 0.28);
  color: #1d4ed8;
  background: #f7faff;
}

.meta-list strong[title] {
  line-height: 1.35;
}

@media (max-width: 720px) {
  .stage-folder-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .stage-filter-toggle {
    width: 100%;
    justify-content: center;
  }

  .generation-path-title {
    flex-direction: column;
    gap: 4px;
  }

  .generation-path-options {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 42%, #eef1f4 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

.auth-screen {
  position: relative;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: clamp(20px, 4vw, 52px);
  background:
    radial-gradient(circle at 12% 18%, rgba(37, 99, 235, 0.12), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(15, 23, 42, 0.09), transparent 32%),
    #f3f6fa;
}

.auth-screen::before,
.auth-screen::after {
  position: absolute;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.auth-screen::before {
  top: -230px;
  right: -90px;
}

.auth-screen::after {
  bottom: -250px;
  left: -110px;
  border-color: rgba(15, 23, 42, 0.08);
}

.auth-screen.hidden,
.auth-form .hidden,
.app-shell.auth-hidden {
  display: none;
}

.auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, 0.92fr);
  width: min(100%, 1040px);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid rgba(208, 213, 221, 0.82);
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.16);
}

.auth-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 54px;
  background:
    radial-gradient(circle at 78% 20%, rgba(96, 165, 250, 0.34), transparent 28%),
    radial-gradient(circle at 18% 88%, rgba(37, 99, 235, 0.32), transparent 30%),
    linear-gradient(145deg, #111c33 0%, #0f2852 55%, #123c78 100%);
  color: #fff;
}

.auth-showcase::before {
  position: absolute;
  right: -130px;
  bottom: -150px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 52px rgba(255, 255, 255, 0.035),
    0 0 0 104px rgba(255, 255, 255, 0.02);
  content: "";
}

.auth-showcase-brand,
.auth-card-mobile-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
}

.auth-brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.auth-brand-mark svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.auth-showcase-brand strong,
.auth-showcase-brand small {
  display: block;
}

.auth-showcase-brand strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.auth-showcase-brand small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-showcase-copy {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #bfdbfe;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.auth-showcase-copy h2 {
  margin: 20px 0 18px;
  color: #fff;
  font-size: clamp(36px, 4vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.055em;
}

.auth-showcase-copy p {
  max-width: 420px;
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  font-size: 15px;
  line-height: 1.8;
}

.auth-benefits {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: flex;
  align-items: center;
  gap: 11px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 700;
}

.auth-benefits svg {
  width: 20px;
  height: 20px;
  padding: 3px;
  border-radius: 50%;
  background: rgba(96, 165, 250, 0.18);
  fill: none;
  stroke: #bfdbfe;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 54px;
  background: #fff;
}

.auth-card-mobile-brand {
  display: none;
  margin-bottom: 30px;
  color: var(--ink);
}

.auth-card-mobile-brand .auth-brand-mark {
  background: #14213a;
}

.auth-card-mobile-brand strong {
  font-size: 16px;
}

.auth-eyebrow {
  margin: 0 0 8px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.auth-card h1 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(30px, 4vw, 40px);
  letter-spacing: -0.045em;
}

.auth-subtitle {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 26px;
  padding: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.auth-tab.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.auth-tab:focus-visible,
.auth-submit:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-form input::placeholder {
  color: #94a3b8;
}

.auth-form input:hover {
  border-color: #94a3b8;
}

.auth-form input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

.auth-message {
  min-height: 20px;
  margin: -4px 0 0;
  color: #dc2626;
  font-size: 12px;
  line-height: 1.5;
}

.auth-submit {
  min-height: 52px;
  border: 0;
  border-radius: 11px;
  background: #1d4ed8;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.auth-submit:hover {
  background: #1e40af;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.27);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.62;
  box-shadow: none;
}

.auth-privacy {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 25px 0 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.auth-privacy svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #2563eb;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    width: min(100%, 470px);
    min-height: 0;
  }

  .auth-showcase {
    display: none;
  }

  .auth-card-mobile-brand {
    display: flex;
  }
}

@media (max-width: 520px) {
  .auth-screen {
    align-items: start;
    padding: 14px;
  }

  .auth-shell {
    margin: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom));
    border-radius: 22px;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .auth-card-mobile-brand {
    margin-bottom: 26px;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  --control-width: 340px;
  --inspector-width: 320px;
  --saved-height: 320px;
  --log-height: 210px;
  display: grid;
  grid-template-columns: 68px minmax(0, var(--control-width)) 8px minmax(360px, 1fr) 8px minmax(0, var(--inspector-width));
  align-items: start;
  min-height: 100dvh;
  overflow: visible;
  background: rgba(255, 255, 255, 0.34);
  transition: grid-template-columns 0.2s ease;
}

.app-shell.control-collapsed {
  --control-width: 0px;
}

.app-shell.inspector-collapsed {
  --inspector-width: 0px;
}

.rail,
.control-panel,
.main-stage,
.iteration-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.rail {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-height: 100dvh;
  padding: 18px 10px;
}

.rail-logo,
.rail-button,
.toolbar-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
}

.rail-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #101828;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.rail-button {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: transparent;
  color: #475467;
  font-size: 18px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}

.rail-button:hover,
.rail-button.active {
  border-color: #dbe7ff;
  background: var(--blue-soft);
  color: var(--blue);
}

.rail-spacer {
  flex: 1 1 0;
}

.rail-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #d7dde5;
  background: #ecf0f3;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.rail-avatar:hover {
  border-color: #b8c7de;
  background: var(--blue-soft);
  color: var(--blue);
}

.control-panel,
.iteration-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100dvh;
  padding: 22px;
  overflow: auto;
}

.control-panel,
.iteration-panel {
  transition:
    opacity 0.18s ease,
    padding 0.18s ease;
}

.panel-resizer {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 8px;
  background: linear-gradient(180deg, rgba(232, 238, 247, 0.7), rgba(255, 255, 255, 0.9));
  border-right: 1px solid var(--line);
  cursor: col-resize;
  user-select: none;
}

.panel-resizer::before {
  width: 2px;
  height: 52px;
  border-radius: 999px;
  background: #c9d5e5;
  content: "";
}

.panel-resizer:hover::before,
.resizing-panels .panel-resizer::before {
  background: var(--blue);
}

.panel-toggle {
  position: absolute;
  top: 14px;
  width: 26px;
  height: 34px;
  border: 1px solid #d9e2ee;
  border-radius: 8px;
  background: #fff;
  color: #35435b;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(44, 58, 89, 0.12);
  cursor: pointer;
}

.control-resizer .panel-toggle {
  left: -13px;
}

.inspector-resizer .panel-toggle {
  right: -13px;
}

.resizing-panels {
  cursor: col-resize;
}

.app-shell.control-collapsed .control-panel,
.app-shell.inspector-collapsed .iteration-panel {
  padding: 0;
  border-right: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.main-stage {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100dvh;
  background: #fbfcfd;
}

.brand-row,
.workspace-topbar,
.inspector-header,
.saved-library-header,
.button-row,
.gallery-actions,
.tile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row,
.inspector-header,
.saved-library-header {
  justify-content: space-between;
}

.workspace-topbar {
  min-height: 72px;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.12;
}

h1 {
  font-size: 27px;
}

h2 {
  font-size: 21px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 5px rgba(207, 63, 95, 0.12);
}

.status-dot.ready {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 132, 95, 0.12);
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.field-label,
.saved-library-header span {
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-label strong {
  color: var(--subtle);
  font-size: 12px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

textarea {
  min-height: 230px;
  padding: 16px;
  line-height: 1.52;
  resize: vertical;
}

input,
select {
  height: 48px;
  padding: 0 13px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(23, 104, 232, 0.72);
  box-shadow: 0 0 0 4px rgba(23, 104, 232, 0.11);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
}

.segmented button {
  min-width: 0;
  height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
}

.segmented button:nth-child(4n) {
  border-right: 0;
}

.segmented button:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.segmented button.active {
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(23, 104, 232, 0.5);
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 156px);
  gap: 12px;
}

.stepper {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
}

.stepper button,
.stepper input {
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.stepper button {
  color: #344054;
  font-size: 22px;
}

.stepper input {
  padding: 0;
  text-align: center;
  font-weight: 850;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 850;
  white-space: nowrap;
}

.primary-button {
  width: 100%;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 26px rgba(23, 104, 232, 0.22);
}

.primary-button:hover {
  background: var(--blue-dark);
}

.primary-button.disabled,
.primary-button:disabled {
  cursor: not-allowed;
  background: #a9b7ce;
  box-shadow: none;
}

.ghost-button.disabled,
.ghost-button:disabled,
.secondary-button.disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
}

.secondary-button {
  flex: 1;
  background: #111827;
  color: #fff;
}

.ghost-button {
  padding: 0 14px;
  background: #fff;
  border-color: var(--line);
  color: #344054;
}

.ghost-button:hover,
.toolbar-button:hover {
  border-color: #c8d5e7;
  background: #f7faff;
}

.button-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
}

.search-box {
  display: grid;
  grid-template-columns: 28px minmax(160px, 1fr);
  align-items: center;
  width: min(320px, 28vw);
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
}

.search-box input {
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.usage-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d9e6fb;
  border-radius: 14px;
  background: linear-gradient(145deg, #f7faff 0%, #eef5ff 100%);
}

.usage-card-header,
.usage-amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.usage-card-header h2 {
  font-size: 17px;
}

.usage-refresh {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #c8d8f3;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--blue);
  font-size: 17px;
  font-weight: 850;
}

.usage-refresh:hover {
  border-color: #9fbae7;
  background: #fff;
}

.usage-amount-row {
  align-items: flex-end;
  padding: 12px 0;
  border-top: 1px solid #dce7f7;
  border-bottom: 1px solid #dce7f7;
  color: var(--muted);
  font-size: 12px;
}

.usage-amount-row strong {
  color: #0c4fb4;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.usage-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.usage-metrics div {
  display: grid;
  gap: 3px;
}

.usage-metrics strong {
  color: var(--ink);
  font-size: 16px;
}

.usage-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.usage-billing-note {
  margin: 0;
  color: #61728e;
  font-size: 11px;
  line-height: 1.5;
}

.project-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.project-panel-header,
.project-header-actions,
.project-create-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-panel-header h2 {
  font-size: 18px;
}

.project-header-actions {
  justify-content: flex-end;
  gap: 6px;
}

.smart-project-trigger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #b9cff4;
  border-radius: 10px;
  background: #eef4ff;
  color: #1554b7;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.smart-project-trigger svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.smart-project-trigger:hover,
.smart-project-trigger[aria-expanded="true"] {
  border-color: #7fa8e8;
  background: #e2ecff;
  box-shadow: 0 7px 18px rgba(23, 104, 232, 0.12);
}

.smart-project-trigger:focus-visible,
.smart-project-form textarea:focus,
.smart-project-form select:focus {
  outline: 3px solid rgba(23, 104, 232, 0.18);
  outline-offset: 2px;
}

.smart-project-form {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid #cbdcf7;
  border-radius: 13px;
  background: linear-gradient(145deg, #f8faff 0%, #eef4ff 100%);
  box-shadow: 0 12px 28px rgba(23, 79, 157, 0.08);
}

.smart-project-form.hidden {
  display: none;
}

.smart-project-heading strong,
.smart-project-heading span {
  display: block;
}

.smart-project-heading strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.smart-project-heading span {
  margin-top: 3px;
  color: #61728e;
  font-size: 11px;
  line-height: 1.45;
}

.smart-project-form label {
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.smart-project-form textarea,
.smart-project-form select {
  width: 100%;
  border: 1px solid #cfd9e8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.smart-project-form textarea {
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.55;
}

.smart-project-form select {
  height: 40px;
  padding: 0 10px;
}

.smart-project-status {
  min-height: 18px;
  margin: 0;
  color: #61728e;
  font-size: 11px;
  line-height: 1.5;
}

.smart-project-status.error {
  color: #b42318;
}

.smart-project-status.success {
  color: #067647;
}

.smart-project-actions {
  display: flex;
  gap: 8px;
}

.smart-project-actions button {
  min-height: 42px;
}

#createSmartProjectButton.is-loading::before {
  width: 14px;
  height: 14px;
  margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  content: "";
  display: inline-block;
  vertical-align: -2px;
  animation: smart-project-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .smart-project-trigger {
    transition: none;
  }

  #createSmartProjectButton.is-loading::before {
    animation: none;
  }
}

.project-panel-header .ghost-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.project-create-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
}

.project-create-form.hidden {
  display: none;
}

.project-create-form input {
  height: 42px;
  font-size: 13px;
}

.project-create-intro {
  display: grid;
  gap: 3px;
}

.project-create-intro strong {
  color: var(--ink);
  font-size: 15px;
}

.project-create-intro span,
.project-create-helper {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.project-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.project-type-card {
  min-height: 74px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.project-type-card strong,
.project-type-card span {
  display: block;
}

.project-type-card strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.project-type-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.project-type-card.active {
  border-color: rgba(37, 99, 235, 0.46);
  background: #eef4ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.project-template-field {
  gap: 6px;
}

.project-template-field select {
  height: 42px;
  font-size: 12px;
}

.project-panel.creating .project-pipeline,
.project-panel.creating .project-summary,
.project-panel.creating .workflow-editor {
  display: none;
}

.project-create-actions .secondary-button,
.project-create-actions .ghost-button {
  min-height: 40px;
  font-size: 12px;
}

.project-pipeline {
  display: flex;
  gap: 6px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.project-stage {
  display: grid;
  place-items: center;
  gap: 4px;
  flex: 0 0 76px;
  min-width: 76px;
  min-height: 54px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #475467;
  scroll-snap-align: start;
}

.project-stage:disabled {
  cursor: default;
  opacity: 0.58;
}

.project-stage span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #eef2f7;
  color: #667085;
  font-size: 11px;
  font-weight: 900;
}

.project-stage strong {
  overflow: hidden;
  max-width: 100%;
  color: inherit;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-stage.done {
  border-color: rgba(22, 132, 95, 0.24);
  background: #f0faf6;
  color: var(--green);
}

.project-stage.active {
  border-color: rgba(23, 104, 232, 0.55);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 104, 232, 0.1);
}

.project-stage.active span {
  background: var(--blue);
  color: #fff;
}

.project-summary {
  display: grid;
  gap: 3px;
  min-height: 50px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.project-summary strong,
.project-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-summary strong {
  color: var(--ink);
  font-size: 13px;
}

.project-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-manage-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.project-manage-panel > header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-manage-panel > header div,
.project-manage-panel > header strong,
.project-manage-panel > header span {
  display: block;
}

.project-manage-panel > header strong {
  color: var(--ink);
  font-size: 13px;
}

.project-manage-panel > header div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.project-manage-mark {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}

.project-manage-mark svg,
.project-delete-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-manage-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
}

.project-manage-fields label {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 11px;
  font-weight: 850;
}

.project-manage-fields label.wide {
  grid-column: 1 / -1;
}

.project-manage-fields input,
.project-manage-fields select,
.project-manage-fields textarea {
  width: 100%;
  border: 1px solid #cfd9e8;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

.project-manage-fields input,
.project-manage-fields select {
  min-height: 42px;
  padding: 0 10px;
}

.project-manage-fields textarea {
  min-height: 70px;
  padding: 9px 10px;
  line-height: 1.5;
  resize: vertical;
}

.project-manage-fields input:focus,
.project-manage-fields select:focus,
.project-manage-fields textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.14);
  outline-offset: 1px;
}

.project-manage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.project-manage-actions button {
  min-height: 44px;
}

.project-delete-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(220, 38, 38, 0.34);
  border-radius: 10px;
  background: #fff5f5;
  color: #b42318;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  transition: border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.project-delete-button:hover {
  border-color: rgba(220, 38, 38, 0.58);
  background: #feecec;
}

.project-delete-button:focus-visible {
  outline: 3px solid rgba(220, 38, 38, 0.2);
  outline-offset: 2px;
}

.project-delete-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.project-manage-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 520px) {
  .project-manage-fields {
    grid-template-columns: 1fr;
  }

  .project-manage-fields label.wide {
    grid-column: auto;
  }

  .project-manage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .project-manage-actions button {
    width: 100%;
  }
}

.workflow-editor {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.workflow-editor.hidden {
  display: none;
}

.workflow-editor-header,
.workflow-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workflow-editor-header strong {
  color: var(--ink);
  font-size: 13px;
}

.workflow-editor .ghost-button,
.workflow-actions .secondary-button,
.workflow-actions .ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.workflow-stage-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.workflow-stage-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 30px 30px 30px;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.workflow-stage-row span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: #eef2f7;
  color: #667085;
  font-size: 11px;
  font-weight: 900;
}

.workflow-stage-row input {
  height: 36px;
  min-width: 0;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
}

.workflow-stage-row button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  font-weight: 900;
}

.workflow-stage-row button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.prompt-assist-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.prompt-assist-header,
.prompt-assist-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-assist-header {
  justify-content: space-between;
}

.prompt-assist-header div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.prompt-assist-header strong {
  color: var(--ink);
  font-size: 13px;
}

.prompt-assist-header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-assist-header select {
  flex: 0 0 142px;
  height: 38px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.prompt-assist-controls {
  align-items: stretch;
}

.prompt-assist-controls select {
  flex: 1;
  height: 42px;
  min-width: 0;
}

.prompt-assist-controls .secondary-button {
  min-height: 42px;
  padding: 0 14px;
  flex: 0 0 auto;
}

.prompt-assist-result {
  max-height: 132px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
  white-space: pre-wrap;
}

.prompt-assist-result.empty {
  color: var(--muted);
  font-weight: 800;
}

.prompt-assist-panel > .ghost-button {
  min-height: 38px;
  font-size: 12px;
}

.gallery-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toolbar-button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  color: #475467;
  font-size: 18px;
  border-color: var(--line);
}

.toolbar-button.active {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #cadcff;
}

.toolbar-button.star-filter-button.active {
  background: #fff7d6;
  color: #9a6500;
  border-color: #f3d16b;
}

.section-toggle-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #475467;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.section-toggle-button:hover {
  border-color: #c8d5e6;
  background: #f7faff;
  color: var(--blue);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.status-strip div {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 13px 16px;
  background: #fff;
}

.status-strip span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-strip strong {
  overflow: hidden;
  color: #25324a;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 16px;
  align-content: start;
  min-height: 140px;
  flex: 1 1 0;
  padding: 18px;
  overflow: auto;
}

.gallery-grid.list-view {
  grid-template-columns: 1fr;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 50vh;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.94)),
    #eef2f7;
  color: var(--muted);
  font-weight: 850;
}

.empty-state.compact {
  min-height: 34vh;
}

.empty-mark {
  width: 76px;
  height: 76px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(23, 104, 232, 0.14), transparent 48%),
    linear-gradient(315deg, rgba(22, 132, 95, 0.16), transparent 52%),
    #fff;
}

.image-tile,
.loading-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 278px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.image-tile.selected {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px rgba(23, 104, 232, 0.16),
    var(--shadow-soft);
}

.gallery-grid.list-view .image-tile {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  min-height: 168px;
}

.image-frame {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  min-height: 196px;
  background:
    linear-gradient(45deg, #eff2f5 25%, transparent 25%),
    linear-gradient(-45deg, #eff2f5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eff2f5 75%),
    linear-gradient(-45deg, transparent 75%, #eff2f5 75%);
  background-color: #fbfcfd;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}

.gallery-grid.list-view .image-frame {
  aspect-ratio: 16 / 10;
  min-height: 168px;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-preview-button,
.selected-preview-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.image-preview-button img,
.selected-preview-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tile-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-top: 1px solid var(--line);
}

.gallery-grid.list-view .tile-info {
  flex-direction: column;
  justify-content: center;
  border-top: 0;
  border-left: 1px solid var(--line);
  padding: 18px;
}

.tile-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tile-info strong,
.tile-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-info strong {
  color: #344054;
  font-size: 13px;
  white-space: nowrap;
}

.tile-copy em {
  overflow: hidden;
  color: var(--subtle);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-copy p {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.gallery-grid.list-view .tile-copy p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.tile-info span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.tile-actions {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  justify-content: center;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.image-tile:hover .tile-actions,
.image-tile.selected .tile-actions {
  opacity: 1;
  transform: translateY(0);
}

.icon-button {
  width: 42px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #344054;
  font-size: 17px;
  font-weight: 900;
  text-decoration: none;
  border-color: rgba(208, 213, 221, 0.9);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.12);
  backdrop-filter: blur(10px);
}

.star-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(208, 213, 221, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #667085;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.14);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.star-button.active {
  border-color: #f3c74e;
  background: #fff6cf;
  color: #9a6500;
}

.star-button:hover {
  border-color: #efbd37;
  color: #9a6500;
}

.tile-star {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px;
  height: 38px;
}

.image-tile.starred {
  border-color: #f3c74e;
}

.loading-shimmer {
  height: 216px;
  background: linear-gradient(90deg, #eef1f4, #f8fafc, #eef1f4);
  background-size: 200% 100%;
  animation: shimmer 1.25s infinite;
}

.loading-card p {
  margin: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}


.section-resizer {
  position: relative;
  z-index: 2;
  flex: 0 0 8px;
  min-height: 8px;
  background: linear-gradient(90deg, rgba(232, 238, 247, 0.62), rgba(255, 255, 255, 0.95));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: row-resize;
  touch-action: none;
  user-select: none;
}

.section-resizer::before {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 2px;
  border-radius: 999px;
  background: #c9d5e5;
  content: "";
  transform: translate(-50%, -50%);
}

.section-resizer:hover::before,
.resizing-vertical .section-resizer::before {
  background: var(--blue);
}

.resizing-vertical {
  cursor: row-resize;
}

.saved-library {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 0 0 var(--saved-height);
  gap: 12px;
  min-height: 120px;
  max-height: 680px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  background: #f7f9fb;
  overflow: hidden;
}

.saved-library h2 {
  font-size: 17px;
}

.saved-library-header span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-library-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.saved-library-actions span {
  max-width: 190px;
}

.saved-library-actions .ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  grid-auto-rows: minmax(140px, auto);
  align-items: start;
  gap: 10px;
  overflow: auto;
}

.saved-tile {
  position: relative;
  display: grid;
  min-height: 140px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  text-align: left;
}

.saved-tile.starred {
  border-color: #f3c74e;
  box-shadow: 0 0 0 2px rgba(243, 199, 78, 0.18);
}

.saved-preview-button {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(104px, 1fr) auto;
  width: 100%;
  min-height: 138px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.saved-preview-button img {
  display: block;
  width: 100%;
  min-height: 104px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e8edf3;
}

.saved-star {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 32px;
  height: 32px;
  font-size: 15px;
}

.saved-preview-button span,
.saved-empty {
  overflow: hidden;
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fff;
}

.activity-log {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 0 0 var(--log-height);
  gap: 10px;
  min-height: 90px;
  max-height: 520px;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  overflow: hidden;
}

.activity-log-header,
.activity-log-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-log-header {
  justify-content: space-between;
}

.activity-log-actions {
  justify-content: flex-end;
}

.activity-log h2 {
  font-size: 17px;
}

.activity-log-header .ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.activity-log-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.main-stage.results-collapsed .status-strip,
.main-stage.results-collapsed .gallery-grid,
.main-stage.results-collapsed #savedResizeHandle,
.main-stage.saved-collapsed .saved-grid,
.main-stage.saved-collapsed #savedResizeHandle,
.main-stage.log-collapsed .activity-log-list,
.main-stage.log-collapsed #logResizeHandle {
  display: none;
}

.main-stage.saved-collapsed .saved-library,
.main-stage.log-collapsed .activity-log {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  grid-template-rows: auto;
  padding-bottom: 14px;
}

.main-stage.results-collapsed:not(.saved-collapsed) .saved-library,
.main-stage.results-collapsed.saved-collapsed:not(.log-collapsed) .activity-log {
  flex: 1 1 0;
  max-height: none;
}

.log-item,
.log-empty {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.log-item {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.log-item.error {
  border-color: rgba(207, 63, 95, 0.35);
  background: #fff8fa;
}

.log-item div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.log-item strong,
.log-item span,
.log-item p,
.log-empty {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-item strong {
  color: var(--ink);
  font-size: 12px;
}

.log-item span,
.log-item p,
.log-empty {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.log-item p {
  margin: 0;
}

.log-empty {
  padding: 10px;
}

.selected-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f6f8;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.selected-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reference-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.model-note {
  display: block;
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.reference-dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px;
  border: 1px dashed #b8c5d8;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  color: #344054;
  cursor: pointer;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.reference-dropzone:hover,
.reference-dropzone:focus,
.reference-dropzone.dragging {
  border-color: rgba(23, 104, 232, 0.76);
  background: #f3f8ff;
  box-shadow: 0 0 0 4px rgba(23, 104, 232, 0.1);
}

.creation-tool-button:disabled,
.reference-dropzone.is-disabled,
.agent-reference-panel.is-disabled,
.iteration-reference-panel.model-is-disabled {
  opacity: 0.52;
}

.creation-tool-button:disabled,
.reference-dropzone.is-disabled {
  cursor: not-allowed;
}

.reference-dropzone.is-disabled {
  pointer-events: none;
}

.reference-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-icon {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.drop-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.drop-copy strong,
.drop-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-copy strong {
  font-size: 13px;
  font-weight: 850;
}

.drop-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reference-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
}

.reference-slot.has-files {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  min-height: calc(86px + (var(--reference-rows, 1) * 62px));
  overflow: hidden;
}

.reference-slot.empty {
  min-height: 60px;
  align-items: center;
}

.reference-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reference-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.reference-list {
  display: grid;
  gap: 6px;
  max-height: calc(var(--reference-rows, 1) * 62px);
  margin-top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.reference-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 56px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.reference-item img,
.reference-filemark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  object-fit: contain;
}

.reference-filemark {
  display: grid;
  place-items: center;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.reference-item button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(208, 213, 221, 0.88);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  font-size: 17px;
  line-height: 1;
}

.reference-slot strong,
.reference-slot span,
.reference-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-slot strong {
  color: var(--ink);
  font-size: 13px;
}

.reference-slot span {
  color: var(--muted);
  font-size: 12px;
}

.reference-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.reference-slot .ghost-button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
  padding: 78px 28px 20px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(14px);
  overscroll-behavior: contain;
}

.image-modal.open {
  display: grid;
}

.modal-stage {
  position: relative;
  display: grid;
  grid-column: 2;
  grid-row: 1;
  place-items: center;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  border-radius: 14px;
  cursor: zoom-in;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.modal-stage > * {
  grid-area: 1 / 1;
}

.image-modal img {
  max-width: none;
  max-height: none;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  transform-origin: center;
  will-change: transform;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: transform 0.14s ease-out;
}

.modal-stage.can-pan {
  cursor: grab;
}

.modal-stage.is-panning {
  cursor: grabbing;
}

.modal-stage.is-panning img {
  transition: none;
}

.modal-loading {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.modal-close {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}

.modal-zoom-toolbar {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.68);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.modal-zoom-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.modal-zoom-toolbar .modal-fit-button {
  min-width: 120px;
  gap: 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  white-space: nowrap;
}

.modal-zoom-toolbar button:not(:disabled):hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.16);
}

.modal-zoom-toolbar button:not(:disabled):active {
  transform: scale(0.96);
}

.modal-zoom-toolbar button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.modal-close svg,
.modal-nav svg,
.modal-zoom-toolbar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-nav {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    opacity 0.16s ease,
    transform 0.16s ease;
}

.modal-nav-previous {
  grid-column: 1;
  grid-row: 1;
}

.modal-nav-next {
  grid-column: 3;
  grid-row: 1;
}

.modal-nav:not(:disabled):hover,
.modal-close:hover {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.24);
}

.modal-nav:not(:disabled):active {
  transform: scale(0.96);
}

.modal-nav:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.modal-nav:focus-visible,
.modal-close:focus-visible,
.modal-zoom-toolbar button:focus-visible {
  outline: 3px solid #a7c7ff;
  outline-offset: 3px;
}

.modal-footer {
  display: grid;
  grid-column: 1 / -1;
  grid-row: 2;
  justify-items: center;
  gap: 7px;
  min-width: 0;
}

.modal-position {
  min-width: 62px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.52);
  color: #fff;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  text-align: center;
}

.modal-caption {
  max-width: min(86vw, 1320px);
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.modal-gesture-hint {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-align: center;
}

@media (max-width: 720px) {
  .image-modal {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px;
    padding: calc(72px + env(safe-area-inset-top)) 8px calc(12px + env(safe-area-inset-bottom));
  }

  .modal-close {
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
  }

  .modal-zoom-toolbar {
    top: calc(10px + env(safe-area-inset-top));
  }

  .modal-zoom-toolbar .modal-fit-button {
    min-width: 104px;
    padding-inline: 8px;
  }

  .modal-stage {
    grid-column: 1;
  }

  .modal-nav {
    position: fixed;
    top: 50%;
    z-index: 3;
    width: 44px;
    height: 52px;
    border-radius: 12px;
    transform: translateY(-50%);
  }

  .modal-nav:not(:disabled):active {
    transform: translateY(-50%) scale(0.96);
  }

  .modal-nav-previous {
    left: 10px;
    grid-column: unset;
    grid-row: unset;
  }

  .modal-nav-next {
    right: 10px;
    grid-column: unset;
    grid-row: unset;
  }

  .modal-footer {
    grid-column: 1;
  }

  .modal-caption {
    max-width: calc(100vw - 16px);
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .modal-zoom-toolbar {
    left: 10px;
    transform: none;
  }

  .modal-zoom-toolbar .modal-fit-button {
    min-width: 96px;
  }

  .modal-zoom-toolbar .modal-fit-button svg {
    display: none;
  }
}

@media (max-height: 600px) {
  .image-modal {
    padding-top: calc(66px + env(safe-area-inset-top));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .modal-footer {
    gap: 4px;
  }

  .modal-caption {
    padding-block: 6px;
  }

  .modal-gesture-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-nav,
  .modal-zoom-toolbar button,
  .image-modal img {
    transition: none;
  }
}

.meta-list {
  display: grid;
  gap: 8px;
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* Experimental conversational image creation */
.conversation-studio-trigger {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 122px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--theme-accent, var(--blue)) 38%, var(--theme-border, var(--line)));
  border-radius: 14px;
  background: color-mix(in srgb, var(--theme-accent-soft, var(--blue-soft)) 72%, var(--theme-panel, #fff));
  color: var(--theme-text, var(--ink));
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--theme-accent, var(--blue)) 9%, transparent);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.conversation-studio-trigger:hover {
  border-color: var(--theme-accent, var(--blue));
  background: color-mix(in srgb, var(--theme-accent-soft, var(--blue-soft)) 90%, var(--theme-panel, #fff));
  box-shadow: 0 14px 30px color-mix(in srgb, var(--theme-accent, var(--blue)) 14%, transparent);
}

.conversation-studio-trigger:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--theme-accent, var(--blue)) 34%, transparent);
  outline-offset: 3px;
}

.conversation-studio-trigger-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
}

.conversation-studio-trigger-icon svg,
.conversation-studio-trigger-action svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conversation-studio-trigger-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.conversation-studio-trigger-copy small {
  color: var(--theme-accent, var(--blue));
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.conversation-studio-trigger-copy strong {
  color: var(--theme-text, var(--ink));
  font-size: 15px;
  font-weight: 900;
}

.conversation-studio-trigger-copy > span {
  color: var(--theme-text-muted, var(--muted));
  font-size: 11px;
  font-weight: 650;
  line-height: 1.55;
}

.conversation-studio-trigger-action {
  color: var(--theme-accent, var(--blue));
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.conversation-studio-backdrop {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--theme-scrim, rgba(15, 23, 42, 0.64));
  backdrop-filter: blur(12px);
}

/* A preview launched from the conversation thread must remain interactive above the conversation layer. */
.image-modal.open {
  z-index: 120 !important;
}

.conversation-studio-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  width: min(1180px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  min-height: 520px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 22px;
  background: var(--theme-panel, #fff);
  color: var(--theme-text, var(--ink));
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.3);
}

.conversation-studio-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 44px;
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--theme-border, var(--line));
  background: color-mix(in srgb, var(--theme-panel, #fff) 94%, var(--theme-accent-soft, var(--blue-soft)));
}

.conversation-studio-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
}

.conversation-studio-mark svg,
.conversation-studio-close svg,
.conversation-sidebar-heading button svg,
.conversation-reference-row svg,
.conversation-composer-footer button svg,
.conversation-list-cover svg,
.conversation-empty-state svg,
.conversation-assistant-message header svg,
.conversation-reference-preview button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.conversation-studio-header > div {
  min-width: 0;
}

.conversation-studio-header > div > span {
  color: var(--theme-accent, var(--blue));
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.conversation-studio-header h2 {
  margin: 2px 0 0;
  color: var(--theme-text, var(--ink));
  font-size: 21px;
  letter-spacing: -0.025em;
}

.conversation-studio-header p {
  margin: 3px 0 0;
  color: var(--theme-text-muted, var(--muted));
  font-size: 12px;
}

.conversation-studio-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 12px;
  background: var(--theme-panel, #fff);
  color: var(--theme-text-muted, var(--muted));
  cursor: pointer;
}

.conversation-studio-close:hover,
.conversation-studio-close:focus-visible {
  border-color: var(--theme-accent, var(--blue));
  color: var(--theme-accent, var(--blue));
}

.conversation-studio-body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.conversation-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 14px;
  border-right: 1px solid var(--theme-border, var(--line));
  background: var(--theme-panel-soft, var(--paper-soft));
}

.conversation-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 13px;
}

.conversation-sidebar-heading > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.conversation-sidebar-heading strong {
  font-size: 12px;
  font-weight: 900;
}

.conversation-sidebar-heading span {
  overflow: hidden;
  color: var(--theme-text-muted, var(--muted));
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-sidebar-heading button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 92px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--theme-border-strong, var(--line-strong));
  border-radius: 11px;
  background: var(--theme-panel, #fff);
  color: var(--theme-accent, var(--blue));
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.conversation-sidebar-heading button svg {
  width: 17px;
  height: 17px;
}

.conversation-list {
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
  min-height: 0;
  padding-right: 2px;
}

.conversation-list-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 70px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--theme-text, var(--ink));
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.conversation-list-item:hover,
.conversation-list-item.active {
  border-color: var(--theme-border, var(--line));
  background: var(--theme-panel, #fff);
}

.conversation-list-item.active {
  box-shadow: inset 3px 0 var(--theme-accent, var(--blue));
}

.conversation-list-cover {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--theme-accent-soft, var(--blue-soft));
  color: var(--theme-accent, var(--blue));
}

.conversation-list-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-list-item > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.conversation-list-item strong,
.conversation-list-item small,
.conversation-list-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-list-item strong { font-size: 12px; font-weight: 900; }
.conversation-list-item small { color: var(--theme-text-muted, var(--muted)); font-size: 10px; }
.conversation-list-item em { color: var(--theme-text-subtle, var(--subtle)); font-size: 9px; font-style: normal; }

.conversation-list-empty,
.conversation-list-error {
  display: grid;
  gap: 4px;
  padding: 22px 12px;
  color: var(--theme-text-muted, var(--muted));
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.conversation-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  background: var(--theme-canvas, var(--bg));
}

.conversation-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  min-height: 46px;
  padding: 0 18px;
  border-bottom: 1px solid var(--theme-border, var(--line));
  background: color-mix(in srgb, var(--theme-panel, #fff) 92%, transparent);
  color: var(--theme-text-muted, var(--muted));
  font-size: 11px;
  font-weight: 750;
}

.conversation-context-bar > div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.conversation-context-bar > div > span:last-child {
  overflow: hidden;
  color: var(--theme-text, var(--ink));
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-live-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 14%, transparent);
}

.conversation-thread {
  display: grid;
  align-content: start;
  gap: 20px;
  overflow: auto;
  min-width: 0;
  min-height: 0;
  padding: 22px clamp(16px, 4vw, 46px);
  scroll-behavior: smooth;
}

.conversation-empty-state {
  display: grid;
  place-items: center;
  align-self: center;
  gap: 10px;
  max-width: 440px;
  margin: auto;
  padding: 42px 24px;
  color: var(--theme-text-muted, var(--muted));
  text-align: center;
}

.conversation-empty-state > span {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 18px;
  background: var(--theme-panel, #fff);
  color: var(--theme-accent, var(--blue));
  box-shadow: var(--theme-shadow, var(--shadow-soft));
}

.conversation-empty-state strong { color: var(--theme-text, var(--ink)); font-size: 16px; }
.conversation-empty-state p { margin: 0; font-size: 12px; line-height: 1.7; }

.conversation-turn {
  display: grid;
  gap: 12px;
  width: min(780px, 100%);
  margin: 0 auto;
}

.conversation-user-message {
  display: grid;
  justify-self: end;
  gap: 6px;
  max-width: min(640px, 86%);
  padding: 12px 14px;
  border-radius: 15px 15px 4px 15px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
}

.conversation-user-message > span {
  color: color-mix(in srgb, currentColor 72%, transparent);
  font-size: 9px;
  font-weight: 850;
}

.conversation-user-message p,
.conversation-assistant-message > p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.conversation-turn-references {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.conversation-turn-references img {
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, #fff 45%, transparent);
  border-radius: 9px;
  object-fit: cover;
}

.conversation-assistant-message {
  display: grid;
  justify-self: start;
  gap: 10px;
  max-width: min(700px, 92%);
  padding: 14px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 4px 15px 15px 15px;
  background: var(--theme-panel, #fff);
  color: var(--theme-text, var(--ink));
  box-shadow: var(--theme-shadow, var(--shadow-soft));
}

.conversation-assistant-message header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.conversation-assistant-message header > span:first-child {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--theme-accent-soft, var(--blue-soft));
  color: var(--theme-accent, var(--blue));
}

.conversation-assistant-message header svg { width: 16px; height: 16px; }
.conversation-assistant-message header strong { font-size: 11px; font-weight: 900; }

.conversation-turn-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: var(--theme-text-muted, var(--muted));
  font-size: 9px;
  font-weight: 850;
}

.conversation-turn-status.completed { color: var(--green); }
.conversation-turn-status.failed { color: var(--rose); }
.conversation-turn-status.generating i,
.image-critique-loading i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--theme-accent, var(--blue));
  animation: conversation-dot 1.1s infinite ease-in-out;
}

.conversation-turn-status.generating i:nth-child(2),
.image-critique-loading i:nth-child(2) { animation-delay: 0.14s; }
.conversation-turn-status.generating i:nth-child(3),
.image-critique-loading i:nth-child(3) { animation-delay: 0.28s; }

@keyframes conversation-dot {
  0%, 70%, 100% { opacity: 0.28; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

.conversation-assistant-message details {
  border-top: 1px solid var(--theme-border, var(--line));
  padding-top: 8px;
}

.conversation-assistant-message summary {
  color: var(--theme-accent, var(--blue));
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}

.conversation-assistant-message details p {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 9px;
  border-radius: 9px;
  background: var(--theme-panel-soft, var(--paper-soft));
  color: var(--theme-text-muted, var(--muted));
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.conversation-assistant-message > footer {
  color: var(--theme-text-subtle, var(--subtle));
  font-size: 9px;
}

.conversation-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.conversation-output-grid button {
  overflow: hidden;
  min-height: 98px;
  padding: 0;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 10px;
  background: var(--theme-panel-soft, var(--paper-soft));
  cursor: zoom-in;
}

.conversation-output-grid button:hover,
.conversation-output-grid button:focus-visible { border-color: var(--theme-accent, var(--blue)); }
.conversation-output-grid img { display: block; width: 100%; height: 100%; min-height: 98px; object-fit: cover; }

.conversation-composer {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--theme-border, var(--line));
  background: var(--theme-panel, #fff);
}

.conversation-reference-row,
.conversation-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.conversation-reference-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.conversation-reference-row strong { font-size: 11px; font-weight: 900; }
.conversation-reference-row > div span { color: var(--theme-text-muted, var(--muted)); font-size: 9px; line-height: 1.4; }
.conversation-reference-row input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.conversation-reference-row label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 104px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 11px;
  color: var(--theme-accent, var(--blue));
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.conversation-reference-row label svg { width: 17px; height: 17px; }

.conversation-reference-preview {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.conversation-reference-preview figure {
  position: relative;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  margin: 0;
}

.conversation-reference-preview img {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  object-fit: cover;
}

.conversation-reference-preview figcaption {
  position: absolute;
  left: 3px;
  bottom: 3px;
  min-width: 17px;
  padding: 2px 4px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.76);
  color: #fff;
  font-size: 9px;
  text-align: center;
}

.conversation-reference-preview button {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--theme-panel, #fff);
  border-radius: 50%;
  background: #27334a;
  color: #fff;
  cursor: pointer;
}

.conversation-reference-preview button svg { width: 14px; height: 14px; }

.conversation-message-label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--theme-text, var(--ink));
  font-size: 11px;
  font-weight: 850;
}

.conversation-message-label textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 84px;
  max-height: 150px;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid var(--theme-border-strong, var(--line-strong));
  border-radius: 12px;
  background: var(--theme-panel-soft, var(--paper-soft));
  color: var(--theme-text, var(--ink));
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
}

.conversation-message-label textarea:focus {
  border-color: var(--theme-accent, var(--blue));
  outline: 3px solid color-mix(in srgb, var(--theme-accent, var(--blue)) 14%, transparent);
}

.conversation-composer-footer p {
  margin: 0;
  color: var(--theme-text-muted, var(--muted));
  font-size: 10px;
  line-height: 1.4;
}

.conversation-composer-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 136px;
  min-height: 46px;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.conversation-composer-footer button:disabled,
.conversation-sidebar-heading button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.conversation-composer-footer button svg { width: 18px; height: 18px; }

/* AI critique in continue-edit mode */
.iteration-request-field > small {
  margin-top: -3px;
  color: var(--theme-text-muted, var(--muted));
  font-size: 10px;
  line-height: 1.5;
}

.iteration-intent-panel {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--theme-accent, var(--blue)) 26%, var(--theme-border, var(--line)));
  border-radius: 11px;
  background: color-mix(in srgb, var(--theme-accent-soft, var(--blue-soft)) 58%, var(--theme-panel, #fff));
}

.iteration-intent-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
}

.iteration-intent-mark svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.iteration-intent-panel > span:last-child { display: grid; gap: 2px; min-width: 0; }
.iteration-intent-panel strong { font-size: 11px; font-weight: 900; }
.iteration-intent-panel small { color: var(--theme-text-muted, var(--muted)); font-size: 9px; line-height: 1.5; }
.iteration-intent-panel[data-tone="loading"] .iteration-intent-mark { animation: iteration-intent-pulse 1.2s ease-in-out infinite; }
.iteration-intent-panel[data-tone="clarify"] { border-color: color-mix(in srgb, #d97706 42%, var(--theme-border, var(--line))); background: color-mix(in srgb, #fef3c7 62%, var(--theme-panel, #fff)); }
.iteration-intent-panel[data-tone="clarify"] .iteration-intent-mark { background: #b45309; }

@keyframes iteration-intent-pulse {
  50% { opacity: 0.7; transform: scale(0.94); }
}

.iteration-prompt-review {
  display: grid;
  gap: 13px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--theme-accent, var(--blue)) 38%, var(--theme-border, var(--line)));
  border-radius: 14px;
  background: color-mix(in srgb, var(--theme-accent-soft, var(--blue-soft)) 30%, var(--theme-panel, #fff));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--theme-accent, var(--blue)) 8%, transparent);
}

.iteration-prompt-review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.iteration-prompt-review-header > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.iteration-prompt-review-header small {
  color: var(--theme-accent, var(--blue));
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.iteration-prompt-review-header strong {
  color: var(--theme-text, var(--ink));
  font-size: 13px;
  font-weight: 900;
}

.iteration-prompt-review-header em {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--theme-accent, var(--blue)) 22%, var(--theme-border, var(--line)));
  border-radius: 999px;
  background: var(--theme-panel, #fff);
  color: var(--theme-accent, var(--blue));
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.iteration-final-prompt-field {
  display: grid;
  gap: 6px;
}

.iteration-final-prompt-field > span {
  color: var(--theme-text, var(--ink));
  font-size: 11px;
  font-weight: 900;
}

.iteration-final-prompt-field textarea {
  min-height: 220px;
  padding: 12px;
  border-color: color-mix(in srgb, var(--theme-accent, var(--blue)) 20%, var(--theme-border-strong, var(--line-strong)));
  background: var(--theme-panel, #fff);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
}

.iteration-final-prompt-field > small {
  color: var(--theme-text-muted, var(--muted));
  font-size: 9px;
  text-align: right;
}

.iteration-prompt-reviser {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 11px;
  background: var(--theme-panel, #fff);
}

.iteration-prompt-reviser-heading {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.iteration-prompt-reviser-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
}

.iteration-prompt-reviser-mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.iteration-prompt-reviser-heading > span:last-child { display: grid; gap: 2px; }
.iteration-prompt-reviser-heading strong { font-size: 12px; font-weight: 900; }
.iteration-prompt-reviser-heading small { color: var(--theme-text-muted, var(--muted)); font-size: 9px; line-height: 1.45; }
.iteration-prompt-reviser > label { color: var(--theme-text, var(--ink)); font-size: 10px; font-weight: 850; }

.iteration-prompt-reviser textarea {
  min-height: 76px;
  padding: 10px;
  background: var(--theme-panel-soft, var(--paper-soft));
  font-size: 12px;
  line-height: 1.5;
}

.iteration-prompt-reviser > button {
  min-height: 44px;
  border: 1px solid var(--theme-accent, var(--blue));
  border-radius: 10px;
  background: var(--theme-panel, #fff);
  color: var(--theme-accent, var(--blue));
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}

.iteration-prompt-reviser > button:hover:not(:disabled),
.iteration-prompt-reviser > button:focus-visible {
  background: var(--theme-accent-soft, var(--blue-soft));
}

.iteration-prompt-reviser > button:disabled { opacity: 0.42; cursor: not-allowed; }

.iteration-prompt-review-footer {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.iteration-prompt-review-footer .field { gap: 5px; }
.iteration-prompt-review-footer .field > span { font-size: 9px; }
.iteration-prompt-review-footer input { height: 44px; }
.iteration-prompt-review-footer .primary-button { min-height: 44px; }
.iteration-prompt-review-note { margin: -3px 0 0; color: var(--theme-text-muted, var(--muted)); font-size: 9px; line-height: 1.5; }

.image-critique-assistant {
  display: grid;
  gap: 9px;
}

.image-critique-button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 9px 11px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--theme-accent-soft, var(--blue-soft)) 62%, var(--theme-panel, #fff));
  color: var(--theme-text, var(--ink));
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.image-critique-button > span:first-child {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--theme-accent, var(--blue));
  color: var(--theme-on-accent, #fff);
}

.image-critique-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-critique-button > span:last-child { display: grid; gap: 2px; }
.image-critique-button strong { font-size: 12px; font-weight: 900; }
.image-critique-button small { color: var(--theme-text-muted, var(--muted)); font-size: 10px; }
.image-critique-button:hover:not(:disabled),
.image-critique-button:focus-visible { border-color: var(--theme-accent, var(--blue)); }
.image-critique-button:disabled { opacity: 0.48; cursor: not-allowed; }

.image-critique-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--theme-border, var(--line));
  border-radius: 12px;
  background: var(--theme-panel, #fff);
}

.image-critique-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-critique-heading strong { font-size: 11px; font-weight: 900; }
.image-critique-heading span { color: var(--theme-accent, var(--blue)); font-size: 9px; font-weight: 850; }
.image-critique-panel > p { margin: 0; color: var(--theme-text-muted, var(--muted)); font-size: 11px; line-height: 1.55; }

.image-critique-findings { display: grid; gap: 8px; }
.image-critique-findings > div { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 7px; }
.image-critique-findings > div > span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--theme-accent-soft, var(--blue-soft)); color: var(--theme-accent, var(--blue)); font-size: 9px; font-weight: 900; }
.image-critique-findings p { display: grid; gap: 2px; margin: 0; }
.image-critique-findings strong { font-size: 10px; line-height: 1.45; }
.image-critique-findings small { color: var(--theme-text-muted, var(--muted)); font-size: 9px; line-height: 1.5; }
.image-critique-loading { display: flex !important; grid-template-columns: none !important; gap: 5px !important; padding: 10px 0; }

.image-critique-prompt {
  display: grid;
  gap: 5px;
  padding: 9px;
  border-radius: 9px;
  background: var(--theme-panel-soft, var(--paper-soft));
}

.image-critique-prompt span { color: var(--theme-accent, var(--blue)); font-size: 9px; font-weight: 900; }
.image-critique-prompt p { max-height: 130px; overflow: auto; margin: 0; color: var(--theme-text-muted, var(--muted)); font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.image-critique-panel > button { min-height: 44px; border: 1px solid var(--theme-accent, var(--blue)); border-radius: 10px; background: var(--theme-accent, var(--blue)); color: var(--theme-on-accent, #fff); font: inherit; font-size: 11px; font-weight: 900; cursor: pointer; }
.image-critique-panel > button:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 760px) {
  .conversation-studio-backdrop { padding: 0; }
  .conversation-studio-dialog { width: 100vw; height: 100dvh; min-height: 0; border: 0; border-radius: 0; }
  .conversation-studio-header { grid-template-columns: 42px minmax(0, 1fr) 44px; min-height: calc(72px + env(safe-area-inset-top)); padding: calc(10px + env(safe-area-inset-top)) 10px 10px; }
  .conversation-studio-mark { width: 42px; height: 42px; border-radius: 12px; }
  .conversation-studio-header p { display: none; }
  .conversation-studio-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 142px minmax(0, 1fr); }
  .conversation-sidebar { grid-template-rows: auto minmax(0, 1fr); padding: 9px 10px; border-right: 0; border-bottom: 1px solid var(--theme-border, var(--line)); }
  .conversation-sidebar-heading { padding-bottom: 7px; }
  .conversation-list { display: flex; gap: 7px; overflow-x: auto; overflow-y: hidden; }
  .conversation-list-item { flex: 0 0 220px; min-height: 66px; }
  .conversation-context-bar { min-height: 42px; padding-inline: 12px; }
  .conversation-context-bar > span:last-child { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conversation-thread { gap: 16px; padding: 16px 12px; }
  .conversation-user-message { max-width: 92%; }
  .conversation-assistant-message { max-width: 96%; }
  .conversation-composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .conversation-reference-row > div span { max-width: 220px; }
  .conversation-composer-footer { align-items: flex-end; }
  .conversation-composer-footer p { max-width: 54%; }
  .conversation-composer-footer button { min-width: 132px; }
}

@media (max-width: 420px) {
  .conversation-studio-trigger { grid-template-columns: 42px minmax(0, 1fr); }
  .conversation-studio-trigger-action { grid-column: 2; }
  .conversation-reference-row > div span { max-width: 180px; }
  .conversation-message-label textarea { min-height: 74px; }
  .iteration-prompt-review-footer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .conversation-studio-trigger,
  .conversation-thread { transition: none; scroll-behavior: auto; }
  .conversation-turn-status.generating i,
  .image-critique-loading i,
  .iteration-intent-panel[data-tone="loading"] .iteration-intent-mark { animation: none; }
}

.meta-list strong {
  overflow: hidden;
  max-width: 58%;
  color: #344054;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 10;
  max-width: min(520px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 68px minmax(300px, 340px) minmax(360px, 1fr);
  }

  .panel-resizer,
  .section-resizer {
    display: none;
  }

  .iteration-panel {
    grid-column: 2 / -1;
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) minmax(170px, 220px);
    align-items: start;
    border-top: 1px solid var(--line);
  }

  .inspector-header {
    grid-column: 1 / -1;
  }

  .selected-preview {
    grid-row: span 3;
  }

  .meta-list {
    grid-column: 1 / -1;
  }

  .iteration-prompt-review {
    grid-column: 2 / -1;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .panel-resizer,
  .section-resizer {
    display: none;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 5;
    max-height: none;
    flex-direction: row;
    justify-content: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-spacer {
    display: none;
  }

  .auth-card {
    padding: 30px 24px;
    border-radius: 22px;
  }

  .control-panel,
  .main-stage,
  .iteration-panel {
    position: static;
    max-height: none;
    border-right: 0;
  }

  .iteration-panel {
    grid-column: auto;
    display: flex;
  }

  .workspace-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .gallery-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    padding: 12px;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-row {
    grid-template-columns: 1fr;
  }

  .saved-library {
    max-height: 340px;
  }
}
