:root {
  color-scheme: dark;
  font-family: "Manrope", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  color: #f8fafc;
  background: #080c14;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #080c14;
  line-height: 1.55;
  font-weight: 500;
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
img, svg { display: block; }
img { max-width: 100%; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  background:
    radial-gradient(circle at 78% 22%, rgba(103, 58, 238, .22), transparent 24rem),
    linear-gradient(180deg, #0a0f18 0%, #0a101a 52%, #080c14 100%);
}

.app--light {
  color: #111827;
  background: #f8fafc;
  grid-template-columns: 246px minmax(0, 1fr);
}

.app--sidebar-collapsed,
.app--light.app--sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.mobile-placeholder {
  display: none;
}

.sidebar {
  height: 100vh;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: linear-gradient(180deg, rgba(16, 23, 37, .98), rgba(10, 15, 24, .98));
  border-right: 1px solid rgba(148, 163, 184, .12);
  position: sticky;
  top: 0;
  color: #f8fafc;
  overflow: auto;
}

.brand, .create-button, .nav-item, .top-tabs button, .round-button, .recent-item,
.type-card, .template-card, .secondary-action, .action-row, .setup-card button,
.generated-grid button, .selected-file button, .prompt-ideas button, .tool-button {
  color: inherit;
  background: transparent;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #cbd5e1;
  background: rgba(30, 41, 59, .76);
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5b6cff, #a63df5);
  box-shadow: 0 10px 26px rgba(124, 58, 237, .34);
}

.create-button, .generate-button, .big-generate, .open-editor {
  min-height: 46px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, #536dfe, #8b35e8);
  box-shadow: 0 18px 34px rgba(107, 70, 255, .28);
}

.create-button {
  width: 100%;
  justify-content: center;
  padding: 0 18px;
  font-size: 15px;
}

.create-button span { white-space: nowrap; }

.app--sidebar-collapsed .sidebar {
  padding: 22px 10px;
  align-items: center;
}

.app--sidebar-collapsed .sidebar-head,
.app--sidebar-collapsed .main-nav {
  width: 100%;
}

.app--sidebar-collapsed .sidebar-head {
  flex-direction: column;
}

.app--sidebar-collapsed .brand {
  padding: 0;
  justify-content: center;
}

.app--sidebar-collapsed .brand strong,
.app--sidebar-collapsed .create-button span,
.app--sidebar-collapsed .nav-item span,
.app--sidebar-collapsed .nav-title,
.app--sidebar-collapsed .history-block,
.app--sidebar-collapsed .pro-card,
.app--sidebar-collapsed .user-card span,
.app--sidebar-collapsed .user-card b {
  display: none;
}

.app--sidebar-collapsed .sidebar-toggle {
  margin-left: 0;
}

.app--sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.app--sidebar-collapsed .create-button,
.app--sidebar-collapsed .nav-item {
  width: 44px;
  min-height: 44px;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
}

.app--sidebar-collapsed .user-card {
  display: block;
  padding: 0;
}

.main-nav { display: grid; gap: 5px; }

.nav-title {
  color: #8c97ab;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  margin: 4px 8px -6px;
}

.history-block {
  display: grid;
  gap: 10px;
}

.history-search {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 7px;
  color: #8c97ab;
  background: rgba(30, 41, 59, .72);
  border: 1px solid rgba(148, 163, 184, .12);
}

.history-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #dbe4f2;
  background: transparent;
}

.history-list {
  max-height: 360px;
  display: grid;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
}

.history-item {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
  padding: 7px;
  border-radius: 7px;
  color: #dbe4f2;
  background: transparent;
  text-align: left;
}

.history-item:hover,
.history-item.active {
  background: rgba(51, 65, 85, .74);
}

.history-item__open {
  min-width: 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  color: inherit;
  background: transparent;
  text-align: left;
}

.history-item img {
  width: 56px;
  height: 44px;
  object-fit: cover;
  border-radius: 5px;
}

.history-item strong,
.history-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  font-size: 12px;
}

.history-item small {
  margin-top: 4px;
  color: #9aa5b8;
  font-size: 11px;
}

.history-actions {
  position: relative;
  opacity: 0;
  pointer-events: none;
}

.history-item:hover .history-actions,
.history-actions[open] {
  opacity: 1;
  pointer-events: auto;
}

.history-actions summary {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #cbd5e1;
  list-style: none;
  cursor: pointer;
}

.history-actions summary::-webkit-details-marker { display: none; }

.history-actions summary:hover {
  background: rgba(148, 163, 184, .16);
}

.history-actions div {
  position: absolute;
  right: 0;
  top: 30px;
  min-width: 116px;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  background: #111827;
  box-shadow: 0 18px 36px rgba(0, 0, 0, .28);
  z-index: 8;
}

.history-actions button {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: #fecaca;
  background: transparent;
  text-align: left;
}

.history-actions button:hover {
  background: rgba(239, 68, 68, .16);
}

.history-empty {
  padding: 8px 10px;
  color: #8c97ab;
  font-size: 13px;
}

.empty-chat-hint {
  max-width: 560px;
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #667085;
  text-align: center;
}

.empty-chat-hint span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6941c6;
  background: #f4f0ff;
  border: 1px solid #ddd6fe;
}

.empty-chat-hint h2 {
  margin: 0;
  color: #111827;
  font-size: 22px;
}

.empty-chat-hint p {
  margin: 0;
  line-height: 1.45;
}

.nav-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border-radius: 7px;
  color: #bdc6d5;
  text-align: left;
}

.nav-item:hover, .nav-item.active {
  background: rgba(116, 88, 255, .94);
  color: #fff;
}

.sidebar-spacer { flex: 1; }

.pro-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(30, 41, 59, .86);
  border: 1px solid rgba(148, 163, 184, .16);
}

.pro-card span {
  color: #aab5c8;
  font-size: 13px;
  line-height: 1.35;
}

.pro-card button {
  min-height: 38px;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #4f67ff, #d044d6);
}

.user-card {
  min-height: 44px;
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px 2px;
  color: #dbe4f2;
  text-align: left;
  border-radius: 8px;
  background: transparent;
}

.user-card:hover,
.user-card.active {
  background: rgba(255, 255, 255, .07);
}

.user-card .avatar {
  width: 34px;
  height: 34px;
}

.user-card strong,
.user-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card small {
  color: #9aa5b8;
  font-size: 11px;
}

.main-shell {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 244px;
  grid-template-rows: 64px 1fr;
}

.topbar {
  grid-column: 1 / -1;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
  background: rgba(8, 13, 22, .72);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app--light .topbar {
  background: rgba(255, 255, 255, .86);
  border-bottom-color: #e5e7eb;
}

.app--light .main-shell {
  grid-template-columns: minmax(0, 1fr);
}

.app--light .recent-panel {
  display: none;
}

.top-tabs, .top-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-tabs button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 8px;
  color: #cbd5e1;
  font-weight: 600;
}

.app:not(.app--light) .top-tabs { visibility: hidden; }

.app--light .top-tabs button { color: #202839; }
.top-tabs button.active { color: #fff; background: linear-gradient(135deg, #536dfe, #7c3aed); }

.credits {
  height: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  background: rgba(15, 23, 42, .66);
  color: #dbe4f2;
  border: 1px solid rgba(148, 163, 184, .15);
}

.app--light .credits {
  background: #fff;
  color: #111827;
  border-color: #e5e7eb;
}

.credits button,
.credits span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #6d42e8;
}

.credits svg { width: 13px; height: 13px; }

.round-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, .18);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 24%, rgba(255, 255, 255, .58) 0 8%, transparent 9%),
    linear-gradient(135deg, #6d42e8 0%, #2f63f6 52%, #0ea5a4 100%);
  border: 2px solid rgba(255, 255, 255, .42);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .24);
}

.avatar::before {
  content: attr(data-initials);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.avatar-button {
  padding: 0;
  flex: 0 0 auto;
}

.account-menu-wrap {
  position: relative;
}

.avatar-button.active,
.avatar-button:hover {
  border-color: rgba(124, 58, 237, .55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, .12), 0 10px 24px rgba(79, 70, 229, .24);
}

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 292px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .16);
  z-index: 60;
}

.account-menu-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid #eef2f6;
}

.account-menu-head strong,
.account-menu-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-head strong {
  color: #111827;
  font-size: 14px;
}

.account-menu-head small {
  color: #667085;
  font-size: 12px;
}

.account-menu-list {
  padding: 8px 0;
  display: grid;
  gap: 2px;
}

.account-menu-list button,
.account-menu-logout {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 7px;
  color: #344054;
  background: transparent;
  text-align: left;
  font-weight: 600;
}

.account-menu-list button:hover,
.account-menu-logout:hover {
  background: #f5f3ff;
  color: #5b21b6;
}

.account-menu-logout {
  border-top: 1px solid #eef2f6;
  color: #b42318;
}

.landing-page,
.auth-page {
  min-height: 100vh;
  color: #0f172a;
  background: #f7f9fc;
}

.landing-nav {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.landing-nav > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  color: #101828;
  background: transparent;
  font-size: 22px;
  font-weight: 700;
}

.landing-link,
.auth-switch {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  color: #4f46e5;
  background: transparent;
  font-weight: 600;
}

.landing-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #4f67ff, #7c3aed);
  box-shadow: 0 16px 32px rgba(79, 70, 229, .22);
  font-weight: 600;
}

.landing-button--large,
.landing-link--large {
  min-height: 50px;
  padding: 0 20px;
  font-size: 15px;
}

.landing-hero {
  min-height: calc(100vh - 72px);
  padding: 24px clamp(20px, 5vw, 72px) 56px;
  display: grid;
  grid-template-columns: minmax(420px, .78fr) minmax(480px, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.landing-copy {
  max-width: 680px;
}

.landing-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #d9d6fe;
  border-radius: 999px;
  color: #5b21b6;
  background: #f5f3ff;
  font-size: 13px;
  font-weight: 600;
}

.landing-kicker svg {
  width: 15px;
  height: 15px;
}

.landing-copy h1 {
  max-width: 680px;
  margin: 22px 0 18px;
  color: #0b1220;
  font-size: clamp(32px, 3.5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.landing-copy p {
  max-width: 600px;
  margin: 0;
  color: #526070;
  font-size: 18px;
  line-height: 1.55;
}

.landing-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.landing-visual {
  margin: 0;
  min-height: 0;
}

.landing-visual img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .18);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-brand {
  position: fixed;
  top: 24px;
  left: 28px;
}

.auth-card {
  width: min(100%, 460px);
  padding: 30px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
}

.auth-card h1 {
  margin: 18px 0 8px;
  font-size: 28px;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-card p {
  margin: 0 0 22px;
  color: #667085;
  line-height: 1.5;
}

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

.auth-card label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.auth-card input {
  height: 46px;
  padding: 0 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  font: inherit;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  background: #fef2f2;
  font-size: 13px;
  font-weight: 600;
}

.auth-switch {
  width: 100%;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .landing-nav {
    padding: 0 18px;
  }

  .landing-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 18px 18px 40px;
  }

  .landing-copy h1 {
    font-size: 34px;
  }

  .landing-visual img {
    aspect-ratio: 16 / 11;
  }
}

.home-page {
  grid-column: 1;
  grid-row: 2;
  padding: 28px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.app--light .home-page {
  color: #111827;
  background: #f8fafc;
}

.home-start {
  padding: 24px;
  display: grid;
  gap: 22px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .06);
}

.home-start__head {
  display: grid;
  gap: 10px;
}

.home-start__head h1 {
  max-width: 760px;
  margin: 0;
  color: #111827;
  font-size: 34px;
  line-height: 1.08;
}

.home-start__head p {
  max-width: 720px;
  margin: 0;
  color: #566070;
  line-height: 1.55;
}

.home-start__body {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.home-scenarios {
  display: grid;
  gap: 10px;
}

.home-scenario {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  text-align: left;
}

.home-scenario.active {
  border-color: #8b5cf6;
  background: #f5f3ff;
  box-shadow: 0 12px 28px rgba(124, 58, 237, .12);
}

.home-scenario__image {
  width: 76px;
  height: 58px;
  overflow: hidden;
  display: block;
  border-radius: 7px;
  background: #eef2f6;
}

.home-scenario__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-scenario strong,
.home-scenario small {
  display: block;
}

.home-scenario strong {
  font-size: 15px;
  line-height: 1.2;
}

.home-scenario small {
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.home-create-panel {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fbfcff;
}

.home-create-panel__title {
  display: grid;
  gap: 5px;
}

.home-create-panel__title span {
  color: #6941c6;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.home-create-panel__title h2 {
  margin: 0;
  color: #111827;
}

.home-create-panel__title p {
  margin: 0;
  color: #667085;
}

.home-start .prompt-bar {
  border-color: #d0d5dd;
  background: #fff;
  box-shadow: none;
}

.home-start .prompt-bar textarea {
  min-height: 118px;
  color: #111827;
}

.home-start .prompt-bar textarea::placeholder {
  color: #98a2b3;
}

.home-start .prompt-bar > div {
  border-top-color: #eef2f6;
}

.home-start .tool-button {
  color: #344054;
  background: #f2f4f7;
}

.marketplace-hero {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: stretch;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .06);
}

.generation-hero {
  padding: 28px 24px 32px;
  display: grid;
  justify-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .06);
}

.generation-hero__focus {
  width: 100%;
  max-width: 720px;
  display: grid;
  gap: 22px;
}

.generation-hero__intro {
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.generation-hero__intro .home-kicker {
  margin: 0;
}

.generation-hero__lead {
  margin: 0;
  max-width: 48rem;
  color: #475467;
  font-size: 16px;
  line-height: 1.55;
}

.generation-panel__head {
  display: grid;
  gap: 8px;
}

.generation-panel__head h2 {
  margin: 0;
  color: #101828;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}

.generation-panel__hint {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #667085;
}

.generation-panel__mode {
  color: #344054;
  font-weight: 600;
}

.generation-panel {
  min-width: 0;
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  background: #fbfcff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .015);
}

.generation-panel .prompt-bar textarea {
  min-height: 190px;
}

.generation-panel .prompt-bar {
  border-color: #d0d5dd;
  background: #fff;
  box-shadow: none;
}

.generation-panel .prompt-bar textarea {
  color: #111827;
}

.generation-panel .prompt-bar textarea::placeholder {
  color: #98a2b3;
}

.generation-panel .prompt-bar > div {
  border-top-color: #eef2f6;
}

.generation-panel .tool-button {
  color: #344054;
  background: #f2f4f7;
}

.quick-create-section {
  display: grid;
  gap: 12px;
}

.home-scenarios--inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.marketplace-hero__copy {
  display: grid;
  gap: 16px;
  align-content: start;
}

.marketplace-hero h1 {
  max-width: 820px;
  margin: 0;
  color: #111827;
  font-size: 36px;
  line-height: 1.08;
}

.marketplace-hero p {
  max-width: 760px;
  margin: 0;
  color: #566070;
  line-height: 1.55;
}

.home-paths {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.home-path-card {
  min-width: 0;
  min-height: 142px;
  padding: 16px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #111827;
  background: #f8fafc;
  text-align: left;
}

.home-path-card--primary {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.home-path-card > svg {
  width: 44px;
  height: 44px;
  padding: 10px;
  border-radius: 8px;
  color: #6941c6;
  background: #fff;
}

.home-path-card strong,
.home-path-card small {
  display: block;
}

.home-path-card strong {
  color: #111827;
  font-size: 17px;
  line-height: 1.25;
}

.home-path-card small {
  margin-top: 7px;
  color: #667085;
  line-height: 1.4;
}

.marketplace-stats,
.marketplace-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.marketplace-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.marketplace-stats article,
.marketplace-summary article {
  min-width: 0;
  padding: 14px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
}

.marketplace-stats span,
.marketplace-stats small,
.marketplace-summary span,
.marketplace-summary small {
  display: block;
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.marketplace-stats strong,
.marketplace-summary strong {
  display: block;
  margin: 4px 0;
  color: #111827;
  font-size: 26px;
  line-height: 1;
}

.creator-flow,
.bonus-explainer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.creator-flow article,
.bonus-explainer article {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .035);
}

.creator-flow strong,
.bonus-explainer strong {
  display: block;
  color: #111827;
  font-size: 16px;
}

.creator-flow span,
.bonus-explainer p {
  display: block;
  margin: 8px 0 0;
  color: #667085;
  line-height: 1.45;
}

.app--light .home-kicker {
  color: #6941c6;
  background: #f4f0ff;
}

.hero-panel {
  min-height: 0;
  padding: 30px;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(124, 58, 237, .18)),
    #121a2a;
}

.hero-glow {
  position: absolute;
  inset: -25% -10% auto auto;
  height: 360px;
  width: 520px;
  background: radial-gradient(circle, rgba(94, 92, 255, .55), transparent 62%);
  transform: rotate(-18deg);
}

.hero-panel h1, .hero-panel p, .hero-panel .prompt-bar, .home-kicker { position: relative; }

.home-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #d8ccff;
  background: rgba(124, 58, 237, .16);
  font-size: 13px;
  font-weight: 600;
}

.hero-panel h1 {
  margin: 0;
  max-width: 620px;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.hero-panel p {
  max-width: 650px;
  margin: 12px 0 22px;
  color: #c5ccda;
  line-height: 1.55;
}

.prompt-bar {
  max-width: none;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, .2);
  background: rgba(8, 12, 20, .74);
  box-shadow: 0 18px 52px rgba(15, 23, 42, .22);
}

.prompt-bar textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 18px 20px;
  color: #f8fafc;
  background: transparent;
}

.prompt-bar > div {
  min-height: 60px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(148, 163, 184, .14);
}

.tool-button {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(43, 53, 76, .86);
  color: #e2e8f0;
}

.generate-button { margin-left: auto; padding: 0 24px; }

h2 {
  margin: 0 0 14px;
  font-size: 20px;
  letter-spacing: 0;
}

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

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

.type-grid--secondary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.type-card, .template-card {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: rgba(20, 29, 46, .76);
  transition: transform .16s ease, border-color .16s ease;
}

.type-card--featured {
  background: rgba(20, 29, 46, .92);
}

.app--light .type-card,
.app--light .template-card {
  border-color: #e5e7eb;
  background: #fff;
}

.app--light .type-card strong {
  color: #111827;
}

.app--light .type-card small,
.app--light .template-card span {
  color: #667085;
}

.type-card:hover, .template-card:hover {
  transform: translateY(-2px);
  border-color: rgba(125, 90, 255, .72);
}

.type-card__image {
  height: 168px;
  margin-bottom: 0;
  border-radius: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1d2840, #2f1c57);
}

.type-grid--secondary .type-card__image {
  height: 118px;
}

.type-card__image img, .template-card img, .shot, .template-shot, .recent-shot {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot, .template-shot, .recent-shot {
  display: block;
  background-size: 1536px 1024px;
  background-position: calc(0px - var(--x)) calc(0px - var(--y));
  background-repeat: no-repeat;
}

.template-shot {
  height: 124px;
  border-radius: 7px;
  margin-bottom: 10px;
}

.type-card__image em {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #a78bfa;
  border: 2px solid currentColor;
}

.type-card__body {
  display: grid;
  gap: 5px;
  padding: 13px 14px 14px;
}

.type-card strong, .type-card small, .template-card strong, .template-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-card strong {
  color: #f8fafc;
  font-size: 17px;
  line-height: 1.2;
  white-space: normal;
}

.type-card small, .template-card span {
  color: #a7b1c4;
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.section-head--compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-action {
  color: #a78bfa;
  background: transparent;
  font-weight: 600;
}

.template-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.template-card img { height: 124px; border-radius: 7px; margin-bottom: 10px; }

.recent-panel {
  grid-column: 2;
  grid-row: 2;
  margin: 28px 22px 28px 0;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 8px;
  align-self: start;
  background: rgba(15, 23, 42, .78);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-head button {
  color: #b9a8ff;
  background: transparent;
}

.recent-list { display: grid; gap: 12px; }

.recent-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  text-align: left;
}

.recent-item img, .recent-shot {
  width: 76px;
  height: 76px;
  border-radius: 7px;
  object-fit: contain;
  background: rgba(255, 255, 255, .06);
}

.recent-item strong, .recent-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item small {
  margin-top: 8px;
  color: #9aa5b8;
}

.recent-empty {
  padding: 14px;
  border: 1px dashed rgba(148, 163, 184, .28);
  border-radius: 8px;
  color: #9aa5b8;
  font-size: 13px;
}

.workspace-page {
  padding: 22px 28px 34px;
  display: grid;
  grid-template-columns: 306px minmax(520px, 1fr) 230px;
  gap: 18px;
  background: #f8fafc;
}

.chat-workspace {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  background: #f8fafc;
  min-height: calc(100vh - 64px);
  align-items: stretch;
  position: relative;
}

.chat-types, .chat-panel, .chat-side .side-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.chat-types {
  padding: 14px;
  align-self: start;
}

.chat-types h2 {
  color: #0f172a;
  font-size: 17px;
  margin: 0 0 12px;
}

.chat-types > div {
  display: grid;
  gap: 8px;
}

.chat-types button {
  min-width: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #111827;
  background: #fff;
  text-align: left;
}

.chat-types button.active {
  border-color: #6d42e8;
  box-shadow: inset 0 0 0 1px #6d42e8;
}

.chat-types img, .chat-types em {
  width: 58px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: #f3f0ff;
}

.chat-types em {
  display: grid;
  place-items: center;
  color: #6d42e8;
}

.chat-types strong, .chat-types small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-types small {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
}

.chat-panel {
  min-height: calc(100vh - 108px);
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.chat-head {
  grid-row: 1;
  min-height: 68px;
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.chat-head h1 {
  margin: 6px 0 0;
  font-size: 21px;
  color: #0f172a;
}

.chat-head p {
  margin: 5px 0 0;
  color: #667085;
  font-size: 14px;
  line-height: 1.4;
}

.context-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: 999px;
  color: #6941c6;
  background: #f4f0ff;
  border: 1px solid #ddd6fe;
  font-size: 13px;
  font-weight: 600;
}

.context-pill svg {
  width: 15px;
  height: 15px;
}

.chat-messages {
  grid-row: 2;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fbfcff;
}

.chat-messages--empty {
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 16px;
  padding-bottom: 16px;
  background: #fbfcff;
}

.chat-message {
  max-width: min(760px, 100%);
  display: grid;
  gap: 5px;
}

.chat-message span {
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.chat-message p {
  margin: 0;
  padding: 13px 15px;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  border: 1px solid #e5e7eb;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .035);
}

.chat-message--user {
  align-self: flex-end;
  justify-items: end;
}

.chat-message--user p {
  color: #172033;
  background: #f4f0ff;
  border-color: #ddd6fe;
}

.chat-message--assistant {
  align-self: flex-start;
}

.project-reference-gallery {
  max-width: min(780px, 100%);
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .035);
}

.project-reference-gallery__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-reference-gallery__head strong {
  color: #111827;
  font-size: 15px;
}

.project-reference-gallery__head span {
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.project-reference-section {
  display: grid;
  gap: 10px;
}

.project-reference-section > div:first-child {
  display: grid;
  gap: 3px;
}

.project-reference-section > div:first-child strong,
.project-reference-empty strong {
  color: #1d2939;
  font-size: 13px;
}

.project-reference-section > div:first-child small,
.project-reference-empty span {
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.project-reference-section--primary {
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.project-reference-empty {
  padding: 12px;
  display: grid;
  gap: 5px;
  border: 1px dashed #d0d5dd;
  border-radius: 8px;
  background: #fcfcfd;
}

.project-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.project-reference-grid--primary {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.project-reference-grid--references {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}

.project-reference-grid button {
  min-width: 0;
  padding: 8px;
  display: grid;
  gap: 7px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
  color: #111827;
  text-align: left;
}

.project-reference-grid--primary button {
  border-color: #bfdbfe;
  background: #fff;
}

.project-reference-grid--references button {
  background: #f8fafc;
}

.project-reference-grid img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  border-radius: 7px;
  background: #f8fafc;
}

.project-reference-grid--primary img {
  height: 180px;
}

.project-reference-grid--references img {
  height: 108px;
}

.project-reference-grid span,
.project-reference-grid strong,
.project-reference-grid small {
  min-width: 0;
  display: block;
}

.project-reference-grid strong {
  color: #344054;
  font-size: 12px;
}

.project-reference-grid small {
  color: #667085;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-project-guide {
  max-width: min(780px, 100%);
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .035);
}

.chat-messages--empty .template-project-guide {
  width: min(920px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 12px 14px;
  border-color: #e4ddff;
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 36px rgba(15, 23, 42, .055);
}

.template-project-guide > div {
  display: grid;
  gap: 7px;
}

.chat-messages--empty .template-project-guide > div {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
}

.template-project-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-open-link {
  min-height: 32px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #ddd6fe;
  border-radius: 7px;
  color: #6941c6;
  background: #f4f0ff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.template-open-link svg {
  width: 14px;
  height: 14px;
}

.template-project-guide span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6941c6;
  font-size: 12px;
  font-weight: 600;
}

.chat-messages--empty .template-project-guide span {
  grid-column: 1 / -1;
}

.template-project-guide strong {
  color: #111827;
  font-size: 16px;
}

.template-project-guide p {
  margin: 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-messages--empty .template-project-guide p {
  display: none;
}

.template-project-guide em {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.chat-messages--empty .template-project-guide em {
  justify-self: end;
  white-space: nowrap;
}

.template-project-guide ol {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.template-project-guide li {
  padding: 10px;
  display: grid;
  gap: 5px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
}

.template-project-guide li span {
  display: block;
  color: #667085;
  font-weight: 500;
  line-height: 1.4;
}

.chat-composer {
  width: 100%;
  margin: auto 0 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .10);
  z-index: 2;
}

.chat-composer--empty {
  width: 100%;
  margin: 0;
  padding: 14px;
  border-radius: 10px;
  border-color: #d7dce5;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .08);
}

.composer-upload-callout {
  min-height: 78px;
  margin-bottom: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
  border: 1px dashed #b8a6ff;
  border-radius: 9px;
  color: #344054;
  background: #fbfaff;
  cursor: pointer;
}

.composer-upload-callout > span {
  grid-row: 1 / span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #6941c6;
  background: #f4f0ff;
}

.composer-upload-callout strong,
.composer-upload-callout small {
  min-width: 0;
  display: block;
}

.composer-upload-callout strong {
  color: #111827;
  font-size: 15px;
}

.composer-upload-callout small {
  color: #667085;
  font-size: 13px;
  line-height: 1.35;
}

.composer-toolbar {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.composer-toolbar strong {
  margin-right: auto;
  min-width: 0;
  color: #111827;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-composer textarea {
  width: 100%;
  min-height: 54px;
  padding: 12px 4px;
  border: 0;
  border-radius: 0;
  color: #111827;
  background: #fff;
  line-height: 1.35;
  overflow: hidden;
  resize: none;
  outline: none;
}

.chat-composer--empty textarea {
  min-height: 94px;
  padding: 12px 10px;
  font-size: 16px;
  line-height: 1.5;
  overflow: auto;
}

.chat-composer > div {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-composer .composer-toolbar {
  margin-top: 0;
  flex-wrap: nowrap;
}

.composer-controls {
  align-items: center;
}

.chat-composer--empty .composer-controls {
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 220px));
  justify-content: start;
  border: 1px solid #edf0f5;
  border-radius: 10px;
  background: #f8fafc;
}

.composer-controls label {
  min-width: 168px;
  display: grid;
  gap: 5px;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
}

.composer-controls select {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.composer-controls select:disabled {
  color: #667085;
  background: #f8fafc;
}

.improve-button {
  max-width: 100%;
  flex-shrink: 0;
  white-space: nowrap;
}

.composer-attachments {
  margin: 8px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.composer-attachment {
  min-width: 190px;
  max-width: 280px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.composer-attachment.is-edit {
  border-color: #8b5cf6;
  background: #f5f0ff;
}

.composer-attachment img {
  width: 58px;
  height: 46px;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
}

.composer-attachment strong,
.composer-attachment small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-attachment strong {
  color: #344054;
  font-size: 13px;
}

.composer-attachment small {
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
}

.attachment-remove {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #667085;
  background: #f2f4f7;
  font-weight: 600;
}

.composer-line {
  min-height: 54px;
  display: grid !important;
  grid-template-columns: 42px minmax(0, 1fr) 46px;
  align-items: end;
  gap: 8px;
  padding: 4px 4px 4px 6px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
}

.chat-composer--empty .composer-line {
  min-height: 126px;
  grid-template-columns: 46px minmax(0, 1fr) 54px;
  align-items: stretch;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border-color: #cfd6e2;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .015);
}

.icon-button,
.send-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  color: #475467;
  background: #f2f4f7;
}

.send-button {
  color: #fff;
  background: linear-gradient(135deg, #536dfe, #8b35e8);
  box-shadow: 0 12px 26px rgba(107, 70, 255, .26);
}

.chat-composer--empty .icon-button {
  width: 44px;
  height: 44px;
  align-self: end;
}

.chat-composer--empty .send-button {
  width: 54px;
  height: 54px;
  align-self: end;
}

.send-button svg {
  width: 17px;
  height: 17px;
}

.chat-composer .tool-button {
  color: #344054;
  background: #f2f4f7;
}

.chat-composer .generate-button {
  margin-left: auto;
  padding: 0 18px;
}

.chat-context {
  grid-row: 2;
  padding: 10px 18px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.chat-context__item {
  min-width: 190px;
  max-width: 240px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 7px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  text-align: left;
}

.chat-context__item.is-edit {
  border-color: #8b5cf6;
  background: #f5f0ff;
}

.chat-context__item img {
  width: 54px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
}

.chat-context__item strong,
.chat-context__item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-context__item small {
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
}

.chat-result-card {
  width: min(280px, 100%);
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.chat-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  width: min(620px, calc(100vw - 44px));
}

.chat-result-card small {
  display: block;
  margin-top: 8px;
  color: #667085;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 7px;
  background: #f3f4f6;
}

.chat-message--result {
  max-width: min(660px, 100%);
}

.chat-message--result .chat-result-card:hover {
  border-color: #6d42e8;
}

.chat-side {
  display: grid;
  gap: 14px;
  align-content: start;
  padding-right: 2px;
}

.chat-side .side-card {
  padding: 14px;
}

.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.side-card-head h2 {
  margin: 0;
}

.template-picker-card p,
.selected-template-card p {
  margin: 0 0 12px;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.template-picker-list {
  display: grid;
  gap: 8px;
}

.template-picker-list button {
  min-width: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #111827;
  background: #fff;
  text-align: left;
}

.template-picker-list button:hover {
  border-color: #8b5cf6;
  background: #fbfaff;
}

.template-picker-list img {
  width: 58px;
  height: 48px;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.template-picker-list strong,
.template-picker-list small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-picker-list strong {
  color: #111827;
  font-size: 13px;
}

.template-picker-list small {
  margin-top: 3px;
  color: #667085;
  font-size: 12px;
}

.selected-template-card {
  display: grid;
  gap: 10px;
}

.selected-template-card > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #eef2f6;
}

.selected-template-card > strong {
  color: #111827;
  font-size: 16px;
}

.selected-template-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selected-template-facts span {
  min-height: 26px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  color: #5b21b6;
  background: #f5f3ff;
  font-size: 12px;
  font-weight: 600;
}

.selected-template-card ol {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  list-style: none;
}

.selected-template-card li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: #475467;
  font-size: 13px;
}

.selected-template-card li b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6941c6;
  background: #f4f0ff;
  font-size: 12px;
}

.selected-template-card li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-toggle {
  min-height: 38px;
  margin: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-weight: 700;
}

.detail-toggle input {
  width: 42px;
  height: 24px;
  appearance: none;
  border-radius: 999px;
  background: #7c3aed;
  position: relative;
}

.detail-toggle input::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border-radius: 8px;
  background: #f2f4f7;
}

.mode-switch button {
  min-height: 36px;
  border-radius: 7px;
  color: #667085;
  background: transparent;
}

.mode-switch button.active {
  color: #344054;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.chat-side .generated-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

.chat-side .empty-results,
.chat-side .progress-view {
  min-height: 190px;
}

.chat-side .selected-card {
  margin-top: 10px;
  padding: 0;
  border: 0;
  box-shadow: none;
  grid-template-columns: 1fr;
}

.chat-side .selected-file {
  grid-template-columns: 64px minmax(0, 1fr) repeat(2, 34px);
  gap: 7px;
}

.chat-side .selected-file img {
  width: 64px;
  height: 54px;
}

.chat-side .selected-file a,
.chat-side .selected-file button {
  height: 34px;
}

.chat-side .open-editor {
  min-height: 40px;
}

.setup-panel { display: grid; gap: 12px; align-content: start; }

.setup-card, .side-card, .selected-card, .ideas-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.setup-card { padding: 14px; }
.setup-card h2, .side-card h2, .selected-card h2, .prompt-ideas h2 { color: #0f172a; font-size: 17px; margin: 0 0 8px; }
.setup-card p, .side-card p, .selected-card p { margin: 0 0 12px; color: #667085; font-size: 13px; }

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

.mini-type-grid button {
  min-height: 76px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #111827;
  background: #fff;
}

.mini-type-grid button.active {
  border-color: #6d42e8;
  box-shadow: inset 0 0 0 1px #6d42e8;
}

.mini-type-grid img, .mini-type-grid em, .mini-type-grid .shot {
  width: 100%;
  height: 38px;
  border-radius: 5px;
  margin-bottom: 5px;
}

.mini-type-grid em {
  display: grid;
  place-items: center;
  color: #6d42e8;
  background: #f3f0ff;
}

.mini-type-grid span {
  display: block;
  color: #111827;
  font-size: 11px;
  line-height: 1.2;
}

.field-label {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.field-label textarea, .field-label select {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  color: #111827;
  background: #fff;
  font-weight: 500;
  outline: none;
}

.field-label textarea {
  max-width: 100%;
  min-height: 112px;
  padding: 11px;
  resize: vertical;
  line-height: 1.45;
}

.field-label select {
  height: 40px;
  padding: 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.chips button {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  color: #344054;
  background: #f3f4f8;
}

.upload-line {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6941c6;
  font-weight: 500;
  cursor: pointer;
}

.source-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.source-strip button {
  min-width: 0;
  border-radius: 7px;
  overflow: hidden;
  background: #f2f4f7;
  color: #344054;
}

.source-strip img { width: 100%; height: 44px; object-fit: contain; background: #f8fafc; }
.source-strip span { display: block; padding: 4px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.segmented button {
  min-height: 36px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #344054;
  background: #fff;
}

.segmented button.active {
  color: #fff;
  background: #6d42e8;
  border-color: #6d42e8;
}

.big-generate {
  width: 100%;
  margin-top: 10px;
  min-height: 58px;
  font-size: 17px;
}

.results-panel {
  min-width: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}

.results-head {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.results-head h1 { margin: 0; font-size: 20px; letter-spacing: 0; }
.results-head p { margin: 8px 0 0; color: #667085; }

.secondary-action {
  height: 42px;
  padding: 0 14px;
  border: 1px solid #d9d6fe;
  border-radius: 7px;
  color: #6941c6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  white-space: nowrap;
}

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

.generated-grid button {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 3px solid transparent;
  border-radius: 8px;
  background: #111827;
}

.generated-grid button.active { border-color: #6d42e8; }
.generated-grid img { width: 100%; height: 100%; object-fit: cover; }

.empty-results, .progress-view {
  min-height: 430px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed #cfd4dc;
  border-radius: 8px;
  background: #fff;
  color: #667085;
  text-align: center;
  cursor: pointer;
}

.empty-results strong,
.progress-view strong,
.empty-results span,
.progress-view span {
  max-width: min(100%, 420px);
  justify-self: center;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.empty-results strong, .progress-view strong {
  color: #111827;
  line-height: 1.25;
}

.empty-results span, .progress-view span {
  line-height: 1.45;
}

.spinner {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #6d42e8;
  animation: spin 1s linear infinite;
}

.selected-card {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: end;
}

.selected-file {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) repeat(4, 42px);
  gap: 10px;
  align-items: center;
}

.selected-file img {
  width: 92px;
  height: 72px;
  object-fit: cover;
  border-radius: 7px;
}

.selected-file strong, .selected-file small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file small { margin-top: 7px; color: #667085; }

.selected-file a, .selected-file button {
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #344054;
  background: #fff;
  text-decoration: none;
}

.open-editor { min-height: 44px; }

.prompt-ideas {
  display: grid;
  gap: 10px;
}

.prompt-ideas > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.prompt-ideas button {
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #344054;
  background: #fff;
  text-align: left;
  line-height: 1.35;
}

.tools-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.side-card {
  padding: 16px;
}

.action-row {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  color: #344054;
  background: #fff;
  text-align: left;
}

.ideas-card {
  padding: 18px;
  display: grid;
  gap: 10px;
  background: #f5f0ff;
  border-color: #ddd6fe;
}

.ideas-card span {
  color: #5f5a78;
  font-size: 13px;
  line-height: 1.4;
}

.ideas-card button {
  min-height: 38px;
  border-radius: 7px;
  color: #6941c6;
  background: #fff;
  border: 1px solid #ddd6fe;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(17, 24, 39, .46);
  backdrop-filter: blur(4px);
}

.modal section {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  position: relative;
}

.modal section > div {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  background: #f2f4f7;
  color: #111827;
}

.modal button.danger, .danger {
  background: #dc2626;
  color: #fff;
}

.modal--image section { width: min(780px, 100%); }
.modal--image img { width: 100%; max-height: 72vh; object-fit: contain; border-radius: 7px; background: #0f172a; }
.modal-close { position: absolute; right: 12px; top: 12px; }

.modal--editor-debug section {
  width: min(1040px, 100%);
  max-height: 90vh;
  overflow: auto;
}

.modal--editor-debug p {
  margin: 6px 0 16px;
  color: #667085;
  line-height: 1.45;
}

.editor-debug-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 14px !important;
  justify-content: stretch !important;
  margin-bottom: 14px;
}

.editor-debug-grid figure,
.editor-debug-grid article {
  margin: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
}

.editor-debug-grid figcaption,
.editor-debug-grid article strong,
.editor-debug-prompt span {
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.editor-debug-grid img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 7px;
  background: #0f172a;
}

.editor-debug-grid ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.editor-debug-grid li {
  display: grid;
  gap: 3px;
  color: #475467;
  font-size: 13px;
}

.editor-debug-prompt {
  display: grid;
  gap: 8px;
}

.editor-debug-prompt textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  resize: vertical;
  color: #111827;
  background: #fff;
  line-height: 1.45;
}

.modal-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  background: rgba(17, 24, 39, .76);
  color: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, .24);
  transform: translateY(-50%);
}

.modal-nav:disabled {
  display: none;
}

.modal-nav--prev {
  left: 18px;
  transform: translateY(-50%) rotate(180deg);
}

.modal-nav--next {
  right: 318px;
}

.modal--result section {
  width: min(1280px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 10px;
  overflow: auto;
}

.modal--result .result-preview {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
  align-items: stretch;
  justify-content: stretch;
}

.modal--result .result-preview figure {
  min-width: 0;
  height: min(calc(100vh - 56px), 860px);
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f3f4f6;
  overflow: hidden;
}

.modal--result .result-preview img {
  max-width: 100%;
  max-height: min(calc(100vh - 72px), 840px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: #f3f4f6;
}

.result-preview aside {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
  border-left: 1px solid #e5e7eb;
}

.result-preview aside > span {
  color: #667085;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.result-preview aside > small {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.result-preview h2,
.result-preview p {
  margin: 0;
}

.result-preview h2 {
  font-size: 16px;
  line-height: 1.3;
}

.result-preview p {
  color: #667085;
}

.result-preview a,
.result-preview button {
  min-height: 40px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #344054;
  background: #f2f4f7;
  text-decoration: none;
}

.result-preview a {
  color: #fff;
  background: linear-gradient(135deg, #536dfe, #7c3aed);
}

.fatal, .empty-state {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: #111827;
  background: #fff;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
}

.template-builder-page {
  padding: 24px;
  display: grid;
  gap: 18px;
  background: #f8fafc;
}

.templates-page {
  padding: 24px;
  display: grid;
  gap: 18px;
  background: #f8fafc;
}

.templates-page--streamlined {
  gap: 16px;
}

.templates-page__top {
  padding: 20px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .04);
}

.templates-page__top h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
}

.templates-page__lead {
  margin: 0;
  max-width: 42rem;
  color: #667085;
  font-size: 14px;
  line-height: 1.45;
}

.templates-page__top .generate-button {
  flex-shrink: 0;
}

.template-catalog--compact {
  display: grid;
  gap: 12px;
}

.template-search--hero {
  min-width: 100%;
  width: 100%;
  min-height: 44px;
}

.template-builder-head,
.templates-head,
.template-form {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.template-builder-head,
.templates-head {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.template-builder-head h1,
.templates-head h1 {
  margin: 12px 0 8px;
  color: #111827;
  font-size: 28px;
}

.template-builder-head p,
.templates-head p {
  max-width: 760px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.templates-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.template-builder-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.template-builder-steps span {
  min-width: 0;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #344054;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}

.template-builder-steps b {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6941c6;
  background: #f4f0ff;
}

.templates-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.templates-list--market {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.template-catalog-tools {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.template-search {
  min-width: min(420px, 100%);
  flex: 1;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #667085;
}

.template-search svg {
  width: 18px;
  height: 18px;
}

.template-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #111827;
  background: transparent;
  font: inherit;
}

.template-catalog-tools .secondary-action.active {
  color: #5b21b6;
  border-color: #c4b5fd;
  background: #f5f3ff;
}

.template-section-block {
  display: grid;
  gap: 12px;
}

.template-section-block .section-head {
  margin-bottom: 0;
}

.template-section-block .section-head > div {
  display: grid;
  gap: 4px;
}

.template-section-block .section-head h2 {
  color: #111827;
  font-size: 20px;
}

.template-section-block .section-head span {
  color: #667085;
  font-size: 13px;
}

.template-section-block .section-actions {
  gap: 10px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid #eef2f6;
  background: #fafafa;
}

.template-section-block .section-actions .text-action {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  font-weight: 600;
}

.template-section-block .section-actions .text-action:hover {
  background: rgba(105, 65, 198, .08);
  color: #5b21b6;
}

.template-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .035);
}

.template-filter-bar button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #f8fafc;
  color: #344054;
  cursor: pointer;
}

.template-filter-bar button.active {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #5b21b6;
}

.template-filter-bar strong {
  font-size: 13px;
}

.template-filter-bar span {
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff;
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.template-manage-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .04);
}

.template-favorite {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  cursor: pointer;
}

.template-favorite.active {
  background: #7c3aed;
  color: #fff;
}

.template-favorite svg {
  width: 17px;
  height: 17px;
}

.template-like {
  position: absolute;
  top: 60px;
  right: 20px;
  z-index: 2;
  min-width: 44px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #475467;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .12);
}

.template-like.active,
.secondary-action.is-liked {
  color: #be123c;
  border-color: #fecdd3;
  background: #fff1f2;
}

.template-like svg {
  width: 14px;
  height: 14px;
}

.template-manage-cover {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.template-manage-cover img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.template-manage-cover:hover img {
  outline: 2px solid #ddd6fe;
}

.template-manage-subtitle {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.template-manage-info {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.template-manage-title {
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: #111827;
  background: transparent;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.template-manage-title:hover {
  color: #6941c6;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.template-manage-card small {
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.template-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-meta-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  line-height: 1.2;
}

.template-meta-badge.is-private {
  border-color: #d0d5dd;
  background: #f2f4f7;
  color: #344054;
}

.template-meta-badge.is-public {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.template-meta-badge.is-usage {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #5b21b6;
  font-weight: 600;
}

.template-meta-badge.is-earned {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-weight: 700;
}

.template-manage-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  width: 100%;
  min-width: 0;
}

.template-manage-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.template-manage-owner-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.template-manage-card button {
  justify-self: start;
}

.template-action-primary,
.template-action-secondary,
.template-action-icon {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.template-action-primary {
  width: 100%;
  flex: none;
  padding: 0 14px;
  white-space: nowrap;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #536dfe, #8b35e8);
  box-shadow: 0 12px 28px rgba(107, 70, 255, .22);
}

.template-action-primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 14px 32px rgba(107, 70, 255, .28);
}

.template-action-secondary {
  flex: 1 1 auto;
  min-width: min(160px, 100%);
  padding: 0 12px;
  color: #344054;
  border: 1px solid #e5e7eb;
  background: #fff;
  white-space: nowrap;
}

.template-action-secondary:hover {
  border-color: #c4b5fd;
  background: #faf5ff;
  color: #5b21b6;
}

.template-action-secondary.is-saved {
  color: #5b21b6;
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.template-action-detail svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.template-action-icon {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #475467;
  background: #f8fafc;
}

.template-action-icon:hover {
  border-color: #c4b5fd;
  color: #5b21b6;
  background: #fff;
}

.template-action-primary svg,
.template-action-icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.danger-lite {
  color: #b42318;
  border-color: #fecaca;
  background: #fff;
}

.template-action-icon.danger-lite:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.chat-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.secondary-action.is-published {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf3;
}

.feed-page {
  width: min(980px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 30px 0 60px;
}

.feed-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.feed-head h1 {
  margin: 10px 0 8px;
  color: #111827;
  font-size: 34px;
  letter-spacing: 0;
}

.feed-head p {
  max-width: 660px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.feed-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.feed-card {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .05);
}

.feed-card__top,
.feed-card__body,
.feed-card__actions {
  padding: 14px 16px;
}

.feed-card__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.feed-card__top .avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.feed-card__top strong,
.feed-card__top small,
.feed-card__body strong {
  display: block;
}

.feed-card__top small {
  margin-top: 2px;
  color: #667085;
}

.feed-card > img {
  display: block;
  width: 100%;
  max-height: 760px;
  object-fit: contain;
  background: #f8fafc;
}

.feed-card__body {
  border-top: 1px solid #f1f5f9;
}

.feed-card__body p {
  margin: 8px 0 0;
  color: #475467;
  line-height: 1.45;
}

.feed-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid #f1f5f9;
}

.template-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: start;
  padding: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.template-empty--small {
  padding: 16px;
}

.template-empty h2 {
  margin: 0;
  color: #111827;
  font-size: 22px;
}

.template-empty p {
  max-width: 520px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.template-public-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
  background: #f8fafc;
}

.template-public-hero,
.template-public-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.template-public-hero {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: start;
}

.template-public-hero--no-media {
  grid-template-columns: minmax(0, 1fr);
}

.template-public-hero--compact {
  padding: 18px;
  gap: 18px;
}

.template-public-hero > div {
  display: grid;
  gap: 14px;
  align-content: start;
}

.template-public-hero h1 {
  margin: 0;
  color: #111827;
  font-size: 32px;
  line-height: 1.1;
}

.template-public-hero--compact h1 {
  font-size: 26px;
}

.template-public-hero p {
  margin: 0;
  color: #475467;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.template-public-hero--compact p {
  max-width: 720px;
  font-size: 14px;
}

.template-public-hero figure {
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #eef2f6;
  aspect-ratio: 1;
}

.template-public-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.template-public-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.template-public-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.template-public-stats article {
  padding: 10px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
}

.template-public-stats span,
.template-public-stats small {
  display: block;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
}

.template-public-stats strong {
  display: block;
  margin-top: 3px;
  color: #111827;
  font-size: 22px;
}

.template-public-section {
  padding: 20px;
}

.template-public-section .section-head span {
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}

.template-public-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.template-public-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.template-public-fields article,
.template-comments article {
  padding: 14px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
}

.template-public-fields strong,
.template-comments strong {
  display: block;
  color: #111827;
  font-size: 14px;
}

.template-public-fields span {
  display: block;
  margin-top: 4px;
  color: #6941c6;
  font-size: 12px;
  font-weight: 600;
}

.template-public-fields p,
.template-comments p {
  margin: 8px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

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

.template-public-steps article {
  min-height: 150px;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
}

.template-public-steps article > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6941c6;
  background: #f4f0ff;
  font-weight: 600;
}

.template-public-steps strong {
  color: #111827;
}

.template-public-steps p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.template-public-references {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.template-public-references img {
  width: 112px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #eef2f6;
}

.template-public-examples {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.template-public-examples figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.template-public-examples img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: #eef2f6;
}

.template-public-examples figcaption {
  padding: 10px 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.template-public-bottom-action {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.template-public-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.template-public-settings--simple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-public-settings article {
  min-width: 0;
  border: 1px solid rgba(18, 24, 38, .1);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.template-public-settings strong {
  display: block;
  color: #111827;
  font-size: 13px;
  margin-bottom: 8px;
}

.template-public-settings p {
  margin: 0;
  color: #566070;
  font-size: 13px;
  line-height: 1.5;
}

.bonus-ledger {
  display: grid;
  gap: 10px;
}

.bonus-ledger article {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.bonus-ledger img {
  width: 74px;
  height: 58px;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.bonus-ledger strong,
.bonus-ledger span {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bonus-ledger strong {
  color: #111827;
}

.bonus-ledger span {
  margin-top: 4px;
  color: #667085;
  font-size: 13px;
}

.images-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
  background: #f8fafc;
}

.images-head,
.images-album {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.images-head {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.images-head h1 {
  margin: 12px 0 8px;
  color: #111827;
  font-size: 28px;
}

.images-head p {
  max-width: 720px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.images-album {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.album-item {
  min-width: 0;
  padding: 8px;
  display: grid;
  gap: 8px;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
  text-align: left;
  cursor: pointer;
}

.album-item > button:first-child {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.album-item:hover {
  border-color: #c4b5fd;
  box-shadow: 0 12px 28px rgba(105, 65, 198, .12);
}

.album-item img {
  width: 100%;
  height: 190px;
  object-fit: contain;
  border-radius: 7px;
  background: #f8fafc;
}

.album-item span,
.album-item strong,
.album-item small {
  min-width: 0;
  display: block;
}

.album-item strong {
  color: #111827;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-item small {
  color: #667085;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
  background: #f8fafc;
}

.editor-head,
.editor-workspace,
.editor-history {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.editor-head {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.editor-head h1 {
  margin: 12px 0 8px;
  color: #111827;
  font-size: 28px;
}

.editor-head p {
  max-width: 760px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.editor-workspace {
  min-height: 620px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 300px;
  overflow: hidden;
}

.editor-tools,
.editor-settings {
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
  background: #fbfcff;
}

.editor-tools { border-right: 1px solid #e5e7eb; }
.editor-settings { border-left: 1px solid #e5e7eb; }

.editor-tool-group,
.editor-settings-card {
  display: grid;
  gap: 8px;
}

.editor-tool-group span,
.editor-settings-card h2 {
  margin: 0;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.editor-tool-group button,
.editor-settings-card button:not(.editor-footer-button),
.editor-download:not(.editor-footer-button) {
  justify-content: flex-start;
}

.editor-tool-group button {
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-weight: 600;
}

.editor-tool-group button.active,
.editor-tool-group button:hover {
  border-color: #c4b5fd;
  background: #f4f0ff;
}

.editor-tool-group label {
  display: grid;
  gap: 6px;
  color: #667085;
  font-size: 12px;
}

.editor-stage {
  min-width: 0;
  min-height: 0;
  padding: 16px;
  display: grid;
  place-items: center;
  background: #eef2f6;
}

.editor-canvas-wrap {
  position: relative;
  max-width: 100%;
  max-height: 580px;
  display: grid;
  place-items: center;
}

.editor-canvas-wrap img {
  max-width: 100%;
  max-height: 580px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 44px rgba(15, 23, 42, .16);
}

.editor-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  margin: auto;
  touch-action: none;
  cursor: crosshair;
}

/* Курсоры по типу инструмента (SVG hotspot ≈ центр иконки) */
.editor-canvas-wrap canvas[data-tool="cursor"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath fill='%23e9d5ff' stroke='%237c3aed' stroke-width='1.3' d='M8 4l14 10-6 2 3 8-4 1-3-8-4 4z'/%3E%3C/svg%3E") 4 4, default;
}
.editor-canvas-wrap canvas[data-tool="select"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Crect x='5' y='5' width='14' height='14' rx='2' fill='none' stroke='%23c4b5fd' stroke-width='2' stroke-dasharray='4 3'/%3E%3Ccircle cx='22' cy='20' r='3' fill='%23a78bfa'/%3E%3C/svg%3E") 6 6, crosshair;
}
.editor-canvas-wrap canvas[data-tool="brush"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='13' cy='15' r='9' fill='rgba(244,114,182,0.22)' stroke='%23f472b6' stroke-width='2'/%3E%3Ccircle cx='20' cy='8' r='2.5' fill='%23fb7185'/%3E%3C/svg%3E") 13 15, crosshair;
}
.editor-canvas-wrap canvas[data-tool="arrow"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath fill='%23fb7185' d='M5 18L16 7h6v6L11 24l-3-3 7-7z'/%3E%3C/svg%3E") 10 16, crosshair;
}
.editor-canvas-wrap canvas[data-tool="text"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23f0abfc' stroke-width='2' stroke-linecap='round' d='M7 5h10M12 5v16M9 21h6'/%3E%3C/svg%3E") 12 12, text;
}

.editor-before {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 580px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left;
  z-index: 2;
  clip-path: inset(0 calc(100% - var(--compare, 50%)) 0 0);
  pointer-events: none;
}

.editor-canvas-wrap.is-compare canvas {
  pointer-events: none;
}

.editor-compare-handle {
  position: absolute;
  top: 50%;
  left: var(--compare, 50%);
  z-index: 5;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 999px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .32);
  transform: translate(-50%, -50%);
  cursor: ew-resize;
}

.editor-compare-handle::before {
  content: "";
  position: absolute;
  top: -260px;
  bottom: -260px;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, .88);
  transform: translateX(-50%);
}

.editor-compare-handle span {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.editor-compare-handle span::before,
.editor-compare-handle span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  transform: translateY(-50%) rotate(-45deg);
}

.editor-compare-handle span::before {
  left: -7px;
  border-left: 2px solid currentColor;
}

.editor-compare-handle span::after {
  right: -7px;
  border-right: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

#editor-mask { z-index: 3; }

#editor-text-overlays {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 4;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: visible;
  border-radius: 8px;
}

.editor-text-overlay {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 9px 12px;
  resize: none;
  border: none;
  border-radius: 6px;
  background: rgba(255, 250, 235, 0.92);
  color: #c1123f;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.35;
  pointer-events: auto;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.35);
  caret-color: #9f1239;
}

.editor-text-overlay::placeholder {
  color: rgba(193, 18, 63, 0.45);
  font-weight: 500;
}

.editor-text-overlay:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(167, 139, 250, 0.9), 0 0 0 3px rgba(99, 102, 241, 0.22);
  background: rgba(255, 253, 248, 0.97);
}

.editor-canvas-wrap.is-compare .editor-text-overlays {
  pointer-events: none;
  opacity: 0.85;
}

.editor-empty {
  max-width: 420px;
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  color: #667085;
}

.editor-empty svg {
  width: 42px;
  height: 42px;
  color: #7c3aed;
}

.editor-empty h2 {
  margin: 0;
  color: #111827;
}

.editor-empty p {
  margin: 0;
  line-height: 1.5;
}

.editor-settings-card {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.editor-settings-card textarea {
  min-height: 160px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  resize: vertical;
  color: #111827;
  font: inherit;
}

.editor-download {
  text-decoration: none;
}

.editor-history {
  padding: 16px;
}

.editor-version-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.editor-version-strip button:not(.editor-version-delete) {
  width: 128px;
  flex: 0 0 auto;
  padding: 8px;
  display: grid;
  gap: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fbfcff;
  color: #111827;
  text-align: left;
}

.editor-version-strip button.active:not(.editor-version-delete) {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, .12);
}

.editor-version-strip img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  border-radius: 6px;
  background: #f3f4f6;
}

.editor-version-strip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.app--editor .main-shell {
  grid-template-columns: minmax(0, 1fr);
  background:
    radial-gradient(circle at 74% 18%, rgba(124, 58, 237, .14), transparent 30rem),
    linear-gradient(180deg, #0b111b 0%, #0a0f18 100%);
}

.app--editor .topbar {
  background: rgba(9, 14, 23, .88);
  border-bottom-color: rgba(148, 163, 184, .12);
}

.editor-breadcrumb {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 10px;
  background: rgba(15, 23, 42, .78);
  color: #dbe4f2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.editor-breadcrumb button {
  padding: 0;
  color: #f8fafc;
  background: transparent;
  font-weight: 500;
}

.editor-breadcrumb span {
  color: #7c8799;
}

.editor-breadcrumb strong {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.app--editor .editor-page {
  min-height: calc(100vh - 64px);
  padding: 16px clamp(14px, 4vw, 28px) 24px;
  display: grid;
  gap: 16px;
  align-content: stretch;
  justify-items: stretch;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: transparent;
  color: #f8fafc;
}

.app--editor .editor-page--empty {
  min-height: calc(100vh - 64px);
  padding: 32px clamp(14px, 4vw, 28px) 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.editor-start {
  width: min(1040px, 100%);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: grid;
  justify-items: center;
  gap: 18px;
}

.editor-upload-hero {
  width: min(760px, 100%);
  min-height: 390px;
  padding: 42px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  border: 1px dashed rgba(167, 139, 250, .42);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .78), rgba(13, 20, 32, .72)),
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, .2), transparent 22rem);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  text-align: center;
}

.editor-upload-hero h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.editor-upload-hero p {
  max-width: 560px;
  margin: 0;
  color: #9aa7bb;
  line-height: 1.55;
}

.editor-recent {
  width: min(920px, 100%);
  display: grid;
  gap: 12px;
}

.editor-start-panels {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.editor-start-panels .editor-recent {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 14px;
  background: rgba(15, 23, 42, .45);
}

/* Одна панель (только «Старые редакции» или только «Мои изображения») — на всю ширину, иначе сетка миниатюр сжимается в половину main и чаще ломается. */
.editor-start-panels .editor-recent:only-child {
  grid-column: 1 / -1;
}

.editor-recent .section-head {
  flex-wrap: wrap;
  row-gap: 8px;
}

.editor-recent .section-head h2 {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f8fafc;
}

.editor-recent > div:last-child {
  width: 100%;
  min-width: 0;
  display: grid;
  /* Жёсткий потолок ширины трека: иначе при 1–2 элементах 1fr растягивает карточку на всю панель. */
  grid-template-columns: repeat(auto-fill, minmax(min(96px, 100%), 132px));
  justify-content: start;
  gap: 10px;
  align-items: start;
}

.editor-recent button {
  min-width: 0;
  width: 100%;
  max-width: 132px;
  padding: 8px;
  display: grid;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 10px;
  background: rgba(15, 23, 42, .72);
  color: #dbe4f2;
  text-align: left;
  overflow: hidden;
}

.editor-recent img,
.editor-recent-thumb {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 1;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 7px;
  background: #111827;
}

.editor-recent-thumb {
  background-image: var(--thumb);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.editor-recent span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.app--editor .editor-workspace {
  width: 100%;
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: stretch;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.app--editor .editor-tools,
.app--editor .editor-settings {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 12px;
  background: rgba(15, 23, 42, .72);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

.app--editor .editor-tools {
  align-self: start;
  gap: 12px;
}

.app--editor .editor-tool-group {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.app--editor .editor-tool-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.app--editor .editor-tool-group span,
.app--editor .editor-settings-card h2 {
  color: #8f9db2;
  letter-spacing: 0;
}

.app--editor .editor-tool-group button {
  min-height: 40px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-color: transparent;
  background: transparent;
  color: #dbe4f2;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.app--editor .editor-tool-group button svg {
  color: #b8c4d8;
}

.app--editor .editor-tool-group button.active,
.app--editor .editor-tool-group button:hover {
  border-color: rgba(124, 58, 237, .7);
  background: rgba(99, 102, 241, .18);
  color: #fff;
}

.app--editor .editor-stage {
  min-width: 0;
  min-height: 100%;
  padding: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  background: transparent;
}

.editor-markup-bar {
  width: min(100%, 760px);
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 52px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 10px;
  background: rgba(15, 23, 42, .9);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .24);
}

.editor-markup-bar > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-markup-bar button {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(51, 65, 85, 0.55), rgba(30, 41, 59, 0.72));
  color: #e8edf7;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.editor-markup-bar button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.95;
}

.editor-markup-bar button .editor-tool-kbd {
  margin-left: 2px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #c7d2fe;
  line-height: 1.2;
}

.editor-markup-bar button.active .editor-tool-kbd {
  background: rgba(99, 102, 241, 0.38);
  border-color: rgba(196, 181, 253, 0.45);
  color: #eef2ff;
}

.editor-markup-bar button.active,
.editor-markup-bar button:hover {
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.32), rgba(79, 70, 229, 0.26));
  border-color: rgba(167, 139, 250, 0.85);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.25), 0 10px 26px rgba(79, 70, 229, 0.2);
  color: #f8fafc;
}

.editor-markup-bar button.active {
  box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.55), 0 12px 28px rgba(99, 102, 241, 0.28);
}

@media (max-width: 720px) {
  .editor-markup-bar button .editor-tool-kbd {
    display: none;
  }
}

.editor-markup-bar label {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 4px;
  color: #9aa7bb;
  font-size: 12px;
}

.editor-markup-bar label strong {
  color: #dbe4f2;
}

.editor-markup-bar input {
  accent-color: #8b5cf6;
}

.app--editor .editor-canvas-wrap {
  max-width: 100%;
  max-height: min(58vh, 560px);
}

.editor-processing-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border-radius: 6px;
  background: rgba(2, 6, 23, .72);
  color: #f8fafc;
  text-align: center;
  backdrop-filter: blur(3px);
}

.editor-processing-overlay span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #536dfe, #8b35e8);
  animation: spin 1s linear infinite;
}

.editor-processing-overlay strong {
  font-size: 15px;
}

.editor-processing-overlay small {
  max-width: 240px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.4;
}

.app--editor .editor-canvas-wrap img {
  max-width: 100%;
  max-height: min(58vh, 560px);
  border-radius: 6px;
  background: #111827;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .38);
}

.app--editor .editor-canvas-controls {
  min-height: 52px;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: -18px;
  padding: 8px 10px;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 4;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 10px;
  background: rgba(15, 23, 42, .9);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .32);
}

.editor-canvas-controls button,
.editor-canvas-controls span {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: rgba(30, 41, 59, .72);
  color: #dbe4f2;
}

.editor-canvas-controls button:disabled {
  opacity: .48;
  cursor: default;
}

.editor-canvas-controls .editor-nav-button {
  width: 38px;
  justify-content: center;
  padding: 0;
}

.editor-canvas-controls span button {
  width: 24px;
  height: 24px;
  padding: 0;
  justify-content: center;
  background: transparent;
}

.editor-canvas-controls strong {
  min-width: 44px;
  text-align: center;
  font-size: 13px;
}

.app--editor .editor-settings {
  align-self: start;
  position: sticky;
  top: 82px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  z-index: 5;
}

.app--editor .editor-settings-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.app--editor .editor-settings-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f8fafc;
  font-size: 16px;
  text-transform: none;
}

.editor-side-title {
  display: grid;
  gap: 5px;
}

.editor-side-title strong {
  color: #f8fafc;
  font-size: 17px;
}

.editor-side-title span {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.4;
}

.editor-flow-note {
  padding: 11px 12px;
  display: grid;
  gap: 5px;
  border: 1px solid rgba(139, 92, 246, .34);
  border-radius: 10px;
  background: rgba(99, 102, 241, .18);
}

.editor-flow-note strong {
  color: #f8fafc;
  font-size: 13px;
}

.editor-flow-note span {
  color: #c7d2fe;
  font-size: 12px;
  line-height: 1.4;
}

.app--editor .editor-settings-card p:not(.editor-reference-hint) {
  margin: 0;
  color: #99a6bb;
  font-size: 13px;
  line-height: 1.5;
}

.app--editor .editor-settings-card textarea {
  min-height: 132px;
  border-color: rgba(148, 163, 184, .18);
  background: rgba(2, 6, 23, .36);
  color: #f8fafc;
}

.editor-brush-settings {
  padding: 12px;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 10px;
  background: rgba(2, 6, 23, .22);
}

.editor-output-settings {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 10px;
  background: rgba(2, 6, 23, .18);
}

.editor-chat-format {
  display: flex;
  align-items: center;
}

.editor-chat-format label {
  width: min(260px, 100%);
  display: grid;
  gap: 8px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
}

.editor-output-settings label,
.editor-brush-settings label {
  display: grid;
  gap: 8px;
  color: #9aa7bb;
  font-size: 13px;
}

.editor-brush-settings > strong {
  color: #f8fafc;
  font-size: 13px;
}

.editor-brush-settings label strong {
  color: #dbe4f2;
  float: right;
}

.editor-output-settings select,
.editor-chat-format select,
.editor-brush-settings input[type="text"] {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  background: rgba(2, 6, 23, .38);
  color: #f8fafc;
  outline: 0;
}

.editor-brush-settings input[type="range"] {
  accent-color: #8b5cf6;
}

.editor-quick-prompts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.editor-brush-settings button,
.editor-quick-prompts button {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 8px;
  background: rgba(30, 41, 59, .62);
  color: #dbe4f2;
  font-size: 13px;
}

.editor-brush-settings button.active {
  background: rgba(99, 102, 241, .28);
  border-color: rgba(124, 58, 237, .7);
}

.editor-regions,
.editor-reference-files {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.editor-regions > strong,
.editor-reference-files > strong {
  color: #f8fafc;
  font-size: 13px;
}

.editor-regions p,
.editor-reference-files > p:not(.editor-reference-hint) {
  margin: 0;
  color: #8f9db2;
  font-size: 12px;
  line-height: 1.4;
}

.editor-reference-hint {
  margin: 0;
  padding: 10px 11px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, .14);
  background: rgba(15, 23, 42, .5);
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.45;
}

.app--editor .editor-settings ::selection {
  background: rgba(99, 102, 241, .4);
  color: #f8fafc;
}

.editor-region-card {
  min-height: 36px;
  padding: 5px 7px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 24px;
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, .14);
  border-left: 3px solid rgba(239, 23, 77, .76);
  border-radius: 8px;
  background: rgba(30, 41, 59, .62);
  cursor: pointer;
}

.editor-region-card.active {
  border-color: rgba(251, 191, 36, .8);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .18);
}

.editor-region-badge {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: rgba(251, 191, 36, .14);
  color: #fbbf24;
  font-size: 12px;
  font-weight: 600;
}

.editor-region-delete {
  width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: #fecdd3;
  font-size: 18px;
  line-height: 1;
}

.app--editor .editor-region-card textarea {
  width: 100%;
  min-height: 24px;
  max-height: 28px;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  resize: none;
  background: transparent;
  color: #dbe4f2;
  outline: 0;
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
}

.app--editor .editor-region-card textarea:focus {
  min-height: 64px;
  max-height: 96px;
  overflow: auto;
}

.editor-reference-files > label {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed rgba(148, 163, 184, .28);
  border-radius: 8px;
  color: #dbe4f2;
  background: rgba(30, 41, 59, .42);
  cursor: pointer;
}

.editor-reference-files > div {
  display: grid;
  gap: 7px;
}

.editor-reference-files span {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 30px;
  gap: 7px;
  align-items: center;
}

.editor-reference-files img {
  width: 42px;
  height: 34px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(2, 6, 23, .36);
}

.editor-reference-files small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #cbd5e1;
}

.editor-reference-files span button {
  width: 30px;
  min-height: 30px;
  padding: 0;
  justify-content: center;
}

.editor-settings-footer {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.editor-footer-button {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
}

.editor-footer-button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.editor-footer-button--reset {
  border-color: rgba(248, 113, 113, .38);
  background: rgba(69, 10, 10, .35);
  color: #fecdd3;
}

.editor-footer-button--reset:hover {
  background: rgba(127, 29, 29, .35);
  border-color: rgba(252, 165, 165, .5);
}

.editor-footer-button--download {
  border-color: rgba(139, 92, 246, .48);
  background: linear-gradient(135deg, rgba(99, 102, 241, .4), rgba(124, 58, 237, .25));
  color: #f8fafc;
}

.editor-footer-button--download:hover {
  border-color: rgba(167, 139, 250, .65);
  background: linear-gradient(135deg, rgba(99, 102, 241, .5), rgba(124, 58, 237, .34));
}

.editor-settings-card .editor-settings-footer .editor-footer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.app--editor .editor-settings-card .editor-settings-footer .editor-footer-button {
  justify-content: center;
  align-items: center;
}

.editor-chat-panel {
  width: min(100%, 760px);
  max-width: 100%;
  min-width: 0;
  margin-top: 2px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-sizing: border-box;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 10px;
  background: rgba(15, 23, 42, .78);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

.editor-chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.editor-chat-head strong {
  min-width: 0;
  flex: 1 1 140px;
  color: #f8fafc;
  font-size: 14px;
}

.editor-chat-head label {
  flex: 1 1 168px;
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 6px;
  color: #9aa7bb;
  font-size: 12px;
  font-weight: 600;
}

.editor-chat-head select {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  background: rgba(2, 6, 23, .38);
  color: #f8fafc;
  outline: 0;
}

.editor-composer-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: stretch;
}

.editor-chat-panel textarea {
  min-height: 92px;
  max-height: 170px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
  background: rgba(2, 6, 23, .38);
  color: #f8fafc;
  font: inherit;
  line-height: 1.35;
}

.editor-chat-panel textarea::placeholder {
  color: #77849a;
}

.editor-composer-box button {
  width: 46px;
  min-height: 92px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #536dfe, #8b35e8);
  color: #fff;
  box-shadow: 0 12px 26px rgba(107, 70, 255, .24);
}

.editor-debug-button {
  min-height: 34px;
  width: fit-content;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 8px;
  background: rgba(30, 41, 59, .52);
  color: #dbe4f2;
  font-size: 12px;
  font-weight: 600;
}

.editor-debug-button svg {
  width: 14px;
  height: 14px;
}

.editor-chat-panel button:disabled {
  opacity: .5;
  cursor: default;
}

.editor-chat-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-chat-suggestions.hidden {
  display: none;
}

.editor-chat-suggestions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, .15);
  border-radius: 999px;
  background: rgba(30, 41, 59, .62);
  color: #dbe4f2;
  font-size: 12px;
}

.editor-chat-suggestions button:hover {
  border-color: rgba(124, 58, 237, .64);
  background: rgba(99, 102, 241, .18);
}

.app--editor .editor-history {
  width: 100%;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, .12);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.editor-lower-panels {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  grid-template-columns: minmax(0, 1fr);
}

.app--editor .editor-history--versions {
  padding-top: 0;
  border-top: 0;
}

.app--editor .editor-history--previous,
.app--editor .editor-history--sessions {
  padding-top: 0;
}

.app--editor .editor-history--versions .section-head,
.app--editor .editor-history--sessions .section-head,
.app--editor .editor-history--previous .section-head {
  margin-bottom: 10px;
}

.app--editor .editor-history .section-head h2 {
  color: #f8fafc;
  font-size: 15px;
}

.app--editor .editor-version-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  box-sizing: border-box;
}

.editor-version-card,
.app--editor .editor-version-strip button:not(.editor-version-delete),
.editor-session-card,
.editor-session-grid button,
.editor-previous-grid button {
  min-width: 0;
  border-color: rgba(148, 163, 184, .14);
  background: rgba(15, 23, 42, .72);
  color: #dbe4f2;
  text-align: left;
}

.editor-version-card {
  position: relative;
  flex: 0 1 160px;
  width: auto;
  min-width: 0;
  max-width: min(160px, 100%);
  padding: 0;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 10px;
  overflow: hidden;
}

.app--editor .editor-version-strip .editor-version-card > button:first-child {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 0;
  background: transparent;
}

.app--editor .editor-version-strip .editor-version-card > button:first-child span {
  min-width: 0;
}

.editor-version-delete {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(248, 113, 113, .32);
  border-radius: 999px;
  background: rgba(15, 23, 42, .86);
  color: #fecdd3;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, background .15s ease, transform .15s ease;
}

.editor-version-card:hover .editor-version-delete,
.editor-version-card:focus-within .editor-version-delete {
  opacity: 1;
  pointer-events: auto;
}

.editor-version-delete:hover {
  background: rgba(220, 38, 38, .92);
  color: #fff;
  transform: scale(1.04);
}

.editor-version-card.active,
.editor-session-card.active {
  border-color: #7c3aed;
  background: linear-gradient(180deg, rgba(99, 102, 241, .36), rgba(15, 23, 42, .86));
}

.app--editor .editor-version-strip img {
  height: 92px;
  background: #111827;
}

.editor-session-grid,
.editor-previous-grid {
  display: grid;
  gap: 10px;
}

.editor-session-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.editor-previous-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(0, auto);
}

.editor-session-card,
.editor-previous-grid button {
  padding: 8px;
  display: grid;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 10px;
}

.editor-session-card {
  position: relative;
}

.editor-session-grid button {
  min-width: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.editor-session-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 7px;
  background: rgba(15, 23, 42, .78);
  color: #fecdd3;
  font-size: 18px;
  line-height: 1;
}

.editor-session-grid img,
.editor-previous-grid img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: contain;
  border-radius: 7px;
  background: #111827;
}

.editor-session-grid span,
.editor-previous-grid span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.projects-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
  background: #f8fafc;
}

.projects-head,
.projects-workspace {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.projects-head {
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.projects-head h1 {
  margin: 12px 0 8px;
  color: #111827;
  font-size: 28px;
}

.projects-head p {
  max-width: 760px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.projects-head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.projects-workspace {
  min-height: 520px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
}

.project-folders {
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 8px;
  border-right: 1px solid #e5e7eb;
  background: #fbfcff;
}

.project-folder-create {
  margin-bottom: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.project-folder-create label {
  display: grid;
  gap: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.project-folder-create input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fbfcff;
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
}

.project-folder-create button {
  width: 100%;
  justify-content: center;
}

.project-folders p {
  margin: 4px 2px;
  color: #667085;
  font-size: 13px;
}

.project-folders__title {
  margin-top: 8px;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.project-folder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
}

.project-folder-row > button:first-child {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #111827;
  text-align: left;
}

.project-folder-row.active > button:first-child,
.project-folder-row > button:first-child:hover {
  border-color: #ddd6fe;
  background: #f4f0ff;
}

.project-folder-row.drag-over > button:first-child {
  border-color: #7c3aed;
  background: #ede9fe;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .22);
}

.project-folder-row svg {
  width: 17px;
  height: 17px;
}

.project-folder-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-folder-row small {
  color: #667085;
  font-weight: 600;
}

.project-folder-remove {
  width: 36px;
  height: 36px;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  background: #fff;
  color: #b42318;
}

.projects-list-panel {
  padding: 18px;
  background: #f3f6fb;
  overflow: auto;
}

.projects-list {
  display: grid;
  grid-template-columns: minmax(0, 680px);
  justify-content: center;
  gap: 18px;
}

.project-list-card {
  min-width: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.project-list-card:hover {
  border-color: #c4b5fd;
  box-shadow: 0 12px 28px rgba(105, 65, 198, .10);
}

.project-list-card[draggable="true"] {
  cursor: grab;
}

.project-list-card.dragging {
  opacity: .58;
  border-color: #7c3aed;
  cursor: grabbing;
}

.project-list-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #f3f4f6;
}

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

.project-list-info {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px 16px 14px;
}

.project-list-author {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.project-list-author > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #5b21b6;
  background: #f4f0ff;
}

.project-list-author > span svg {
  width: 19px;
  height: 19px;
}

.project-list-title {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list-info p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.4;
}

.project-list-caption {
  padding-left: 53px;
  color: #344054 !important;
  font-size: 14px !important;
}

.project-list-footer {
  padding: 13px 16px 15px;
  display: grid;
  gap: 12px;
  border-top: 1px solid #eef2f6;
}

.project-list-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-list-badges span {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: 11px;
  font-weight: 600;
}

.project-list-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.project-list-actions .secondary-action {
  min-width: 132px;
  justify-content: center;
}

.profile-page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
  background: #f8fafc;
}

.profile-hero,
.profile-metrics,
.profile-section-card {
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.profile-hero {
  padding: 24px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.profile-avatar {
  width: 76px;
  height: 76px;
  border-color: rgba(124, 58, 237, .28);
}

.profile-avatar::before {
  font-size: 24px;
}

.profile-actions {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.profile-hero h1 {
  margin: 12px 0 8px;
  color: #111827;
  font-size: 30px;
}

.profile-hero p {
  max-width: 760px;
  margin: 0;
  color: #667085;
  line-height: 1.5;
}

.profile-metrics {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.profile-metrics article {
  padding: 14px;
  display: grid;
  gap: 3px;
  border-radius: 8px;
  background: #f8fafc;
}

.profile-metrics span,
.profile-metrics small {
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.profile-metrics strong {
  color: #111827;
  font-size: 28px;
  line-height: 1.1;
}

.profile-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-section-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.profile-section-card > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-section-card > div span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #6941c6;
  background: #f4f0ff;
}

.profile-section-card h2,
.profile-section-card p {
  margin: 0;
}

.profile-section-card h2 {
  color: #111827;
  font-size: 18px;
}

.profile-section-card p {
  color: #667085;
  line-height: 1.45;
}

.profile-section-card ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.profile-section-card li {
  padding: 8px 10px;
  border-radius: 7px;
  color: #344054;
  background: #f8fafc;
  font-size: 13px;
}

.profile-section-card .secondary-action {
  width: fit-content;
  margin-top: 2px;
}

.profile-detail-card {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.profile-detail-card article {
  padding: 14px;
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #f8fafc;
}

.profile-detail-card span {
  color: #667085;
  font-size: 12px;
  font-weight: 600;
}

.profile-detail-card strong {
  color: #111827;
  overflow-wrap: anywhere;
}

.api-key-once,
.api-key-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.api-key-once {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.api-key-once strong,
.api-key-once code,
.api-key-once p {
  display: block;
}

.api-key-once code {
  max-width: 100%;
  margin: 10px 0;
  padding: 12px;
  border-radius: 7px;
  color: #064e3b;
  background: #dcfce7;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: pre-wrap;
}

.api-key-once p {
  margin: 0;
  color: #166534;
  font-size: 13px;
}

.api-key-panel {
  display: grid;
  gap: 12px;
}

.api-key-card {
  min-width: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, .75fr) minmax(0, 1fr) minmax(0, auto);
  gap: 12px;
  align-items: end;
  border: 1px solid #eef2f6;
  border-radius: 8px;
  background: #fbfcff;
}

.api-key-card > div strong,
.api-key-card > div code,
.api-key-card > div span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.api-key-card > div strong {
  color: #111827;
}

.api-key-card > div code {
  margin-top: 6px;
  color: #5b21b6;
  font-size: 13px;
  word-break: break-all;
}

.api-key-card > div span {
  margin-top: 6px;
  color: #667085;
  font-size: 12px;
}

.api-key-card label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 600;
}

.api-key-card input,
.api-key-card textarea {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  color: #111827;
  background: #fff;
  resize: vertical;
}

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

.api-key-actions .secondary-action {
  min-width: 0;
  white-space: normal;
}

.template-form {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.05fr) 320px;
  gap: 18px;
}

.template-simple-form {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, .045);
}

.template-column,
.template-preview-panel,
.template-steps {
  display: grid;
  gap: 14px;
  align-content: start;
}

.template-column,
.template-preview-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fbfcff;
}

.template-column h2,
.template-preview-panel h2 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.template-head-actions,
.template-block-head,
.template-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-block-head h3,
.template-preview-panel h3,
.template-variable-panel strong {
  margin: 0;
  color: #111827;
  font-size: 14px;
}

.template-block-head p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.field-label input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  color: #111827;
  background: #fff;
  font-weight: 500;
  outline: none;
}

.template-grid-2,
.template-grid-3,
.template-field-grid {
  display: grid;
  gap: 10px;
}

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

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

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

.template-actions {
  grid-column: 1 / -1;
}

.field-label .template-main-prompt {
  min-height: 210px;
  font-size: 15px;
}

.field-label .template-user-task {
  min-height: 96px;
}

.template-improve-button {
  justify-self: start;
}

.template-improve-button:disabled {
  opacity: .65;
  cursor: wait;
}

.template-file-picker {
  position: relative;
  display: inline-block;
}

.template-file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.template-file-picker span {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid #d6ccff;
  border-radius: 7px;
  color: #6d42e8;
  background: #fff;
  font-weight: 600;
}

.template-file-picker svg {
  width: 17px;
  height: 17px;
}

.template-reference-preview {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.template-reference-preview img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.template-reference-preview p {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.template-upload-zone {
  min-height: 168px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #b8a6ff;
  border-radius: 8px;
  color: #6941c6;
  background: #fbfaff;
  text-align: center;
  cursor: pointer;
}

.template-upload-zone input {
  display: none;
}

.template-upload-zone svg {
  width: 28px;
  height: 28px;
}

.template-upload-zone strong {
  color: #111827;
}

.template-upload-zone span {
  max-width: 260px;
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.template-reference-list,
.template-step-example-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-reference-list p,
.template-step-example-list p {
  grid-column: 1 / -1;
  margin: 0;
  color: #667085;
  font-size: 12px;
}

.template-reference-list span,
.template-step-example-list span {
  position: relative;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.template-reference-list .icon-button,
.template-step-example-list .icon-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, .92);
}

.template-reference-list img,
.template-step-example-list img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.template-reference-list small,
.template-step-example-list small {
  overflow: hidden;
  color: #667085;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-step-examples {
  display: grid;
  gap: 8px;
}

.template-series {
  display: grid;
  gap: 12px;
}

.template-series-list {
  display: grid;
  gap: 10px;
}

.template-fields {
  display: grid;
  gap: 10px;
}

.template-fields .section-head {
  margin-bottom: 0;
}

.template-fields .section-head > div {
  display: grid;
  gap: 4px;
}

.template-fields .section-head span {
  color: #667085;
  font-size: 13px;
}

.template-field-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.template-field-row > span,
.template-step-row > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #6941c6;
  background: #f4f0ff;
  font-weight: 600;
}

.template-required {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 12px;
  white-space: nowrap;
}

.template-field-row .icon-button {
  grid-column: 3;
  grid-row: 1;
}

.template-required input,
.template-step-row label input {
  width: auto;
  height: auto;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #fff;
  color: #475467;
  display: grid;
  place-items: center;
}

.icon-button svg { width: 16px; height: 16px; }

.template-step-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.template-step-fields {
  display: grid;
  gap: 10px;
}

.template-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.template-field-row input,
.template-field-row select,
.template-step-row input,
.template-step-row select,
.template-step-row textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  color: #111827;
  background: #fff;
  outline: none;
}

.template-field-row input,
.template-field-row select,
.template-step-row input {
  height: 38px;
  padding: 0 10px;
}

.template-step-row select { height: 38px; padding: 0 8px; }

.template-step-row textarea {
  min-height: 70px;
  padding: 9px 10px;
  resize: vertical;
}

.template-step-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  color: #475467;
  font-size: 12px;
}

.template-rewards-box {
  margin-top: 16px;
  padding: 14px;
  display: grid;
  gap: 12px;
  border: 1px solid #ddd6fe;
  border-radius: 8px;
  background: #f5f3ff;
}

.template-rewards-box h3 {
  margin: 0;
  color: #111827;
  font-size: 16px;
}

.template-rewards-box p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.template-actions {
  justify-content: flex-end;
}

.template-mini-title {
  margin: 0 0 -6px;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.template-advanced {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.template-advanced summary {
  cursor: pointer;
  color: #111827;
  font-weight: 600;
}

.template-advanced[open] {
  display: grid;
  gap: 12px;
}

.template-variable-panel,
.template-preview-form,
.template-prompt-preview,
.template-example-slots {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

#template-variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#template-variable-chips span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #175cd3;
  background: #eff8ff;
  font-size: 12px;
  font-weight: 600;
}

#template-variable-chips span.missing {
  color: #b42318;
  background: #fef3f2;
}

#template-variable-chips em {
  color: #667085;
  font-size: 12px;
  font-style: normal;
}

.template-preview-card {
  overflow: hidden;
  display: grid;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.template-preview-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 7px;
  background: #eef2f6;
}

.template-preview-card strong {
  color: #111827;
  font-size: 15px;
}

.template-preview-card span,
.template-prompt-preview p {
  color: #667085;
  font-size: 12px;
  line-height: 1.45;
}

.template-preview-form label {
  display: grid;
  gap: 5px;
  color: #475467;
  font-size: 12px;
}

.template-preview-form input {
  width: 100%;
  height: 34px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  background: #f9fafb;
  padding: 0 9px;
}

.template-example-slots > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.template-example-slots span {
  aspect-ratio: 1;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

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

@media (max-width: 1280px) {
  .app { grid-template-columns: 230px minmax(0, 1fr); }
  .main-shell { grid-template-columns: minmax(0, 1fr); }
  .recent-panel { display: none; }
  .type-grid, .template-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .type-grid--featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-page { grid-template-columns: 300px minmax(0, 1fr); }
  .chat-workspace { grid-template-columns: minmax(0, 1fr) 300px; }
  .chat-side { grid-column: auto; grid-template-columns: 1fr; }
  .tools-panel { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-form { grid-template-columns: minmax(0, 1fr) 300px; }
  .template-simple-form { grid-template-columns: minmax(0, 1fr) 300px; }
  .template-preview-panel { grid-column: 2; grid-row: 1 / span 2; }
  .template-actions { grid-column: 1 / -1; }
  .template-field-grid,
  .template-grid-3 { grid-template-columns: 1fr; }
  .template-step-row { grid-template-columns: 30px minmax(0, 1fr) 82px; }
  .template-step-row textarea,
  .template-step-row label {
    grid-column: 2 / -1;
  }
  .editor-session-grid,
  .editor-previous-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .editor-start-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app,
  .app--light,
  .app--editor {
    display: block;
    min-height: 100vh;
    background: #f8fafc;
  }

  .mobile-placeholder { display: none; }
  .app, .app--light { display: block; }

  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: auto;
    min-height: 0;
    padding: 8px;
    display: block;
    border-right: 0;
    border-top: 1px solid rgba(148, 163, 184, .22);
    background: rgba(10, 15, 24, .96);
    overflow: visible;
  }

  .sidebar-head,
  .create-button,
  .history-block,
  .sidebar-spacer,
  .pro-card,
  .user-card {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    overflow-x: auto;
    gap: 4px;
  }

  .nav-title { display: none; }

  .nav-item {
    min-height: 52px;
    padding: 6px 4px;
    display: grid;
    justify-items: center;
    gap: 4px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.1;
    text-align: center;
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .main-shell {
    display: block;
    min-height: 100vh;
    padding-bottom: 78px;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    flex-wrap: nowrap;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
  }

  .top-tabs {
    display: none;
  }

  .top-tools {
    width: 100%;
    justify-content: flex-end;
  }

  .credits {
    min-height: 38px;
    padding: 0 12px;
    font-size: 14px;
  }

  .round-button {
    display: none;
  }

  .home-page, .workspace-page { padding: 14px; display: grid; grid-template-columns: 1fr; }
  .home-page {
    color: #111827;
    background: #f8fafc;
  }
  .marketplace-hero,
  .generation-hero,
  .home-paths,
  .marketplace-summary,
  .creator-flow,
  .bonus-explainer,
  .template-builder-steps,
  .template-comments {
    grid-template-columns: 1fr;
  }
  .marketplace-stats,
  .template-public-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-scenarios--inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-start {
    padding: 18px;
  }
  .home-start__head h1 {
    font-size: 28px;
  }
  .home-start__body {
    grid-template-columns: 1fr;
  }
  .home-create-panel {
    order: -1;
  }
  .home-scenarios {
    grid-template-columns: 1fr 1fr;
  }
  .home-scenario {
    grid-template-columns: 1fr;
    align-content: start;
  }
  .home-scenario__image {
    width: 100%;
    height: 86px;
  }
  .chat-workspace { padding: 16px; display: grid; grid-template-columns: 1fr; }
  .chat-side { grid-template-columns: 1fr; }
  .hero-panel {
    padding: 22px 16px;
    background: #fff;
    border-color: #e5e7eb;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
  }
  .hero-glow { display: none; }
  .home-kicker {
    color: #6941c6;
    background: #f4f0ff;
  }
  .hero-panel h1 {
    color: #111827;
    font-size: 30px;
  }
  .hero-panel p {
    color: #475467;
  }
  .prompt-bar {
    border-color: #e5e7eb;
    background: #fff;
    box-shadow: none;
  }
  .prompt-bar textarea {
    color: #111827;
  }
  .prompt-bar textarea::placeholder {
    color: #98a2b3;
  }
  .prompt-bar > div {
    border-top-color: #eef2f6;
  }
  .tool-button {
    color: #344054;
    background: #f2f4f7;
  }
  .prompt-bar > div { align-items: stretch; }
  .type-grid,
  .type-grid--featured,
  .type-grid--secondary,
  .template-row,
  .generated-grid,
  .prompt-ideas > div { grid-template-columns: 1fr 1fr; }
  .type-card__image { height: 132px; }
  .type-grid--secondary .type-card__image { height: 112px; }
  .type-card__body { padding: 11px 12px 12px; }
  .type-card,
  .template-card {
    background: #fff;
    border-color: #e5e7eb;
  }
  .type-card strong {
    color: #111827;
  }
  .type-card small,
  .template-card span {
    color: #667085;
  }
  .selected-card { grid-template-columns: 1fr; }
  .selected-file { grid-template-columns: 72px minmax(0, 1fr) repeat(2, 38px); }
  .tools-panel { grid-template-columns: 1fr; }
  .template-builder-page { padding: 16px; }
  .template-builder-head,
  .templates-head,
  .projects-head,
  .editor-head { display: grid; }
  .projects-workspace { grid-template-columns: 1fr; }
  .app--editor .editor-workspace { grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
  .editor-session-grid,
  .editor-previous-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .editor-tools,
  .editor-settings { border: 0; border-bottom: 1px solid #e5e7eb; }
  .editor-canvas-wrap,
  .editor-canvas-wrap img { max-height: 460px; }
  .project-folders { border-right: 0; border-bottom: 1px solid #e5e7eb; }
  .project-list-card { grid-template-columns: minmax(0, 1fr); }
  .project-list-actions { grid-column: auto; justify-content: space-between; }
  .template-form,
  .template-simple-form { grid-template-columns: 1fr; }
  .template-preview-panel { grid-column: auto; grid-row: auto; }
  .template-public-settings { grid-template-columns: 1fr; }
  .template-public-hero { grid-template-columns: 1fr; }
  .template-public-page,
  .templates-page,
  .projects-page,
  .profile-page,
  .images-page { padding: 14px; }
  .profile-hero {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .profile-hero .generate-button,
  .profile-hero > button,
  .profile-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .profile-metrics,
  .profile-sections,
  .profile-detail-card,
  .api-key-card {
    grid-template-columns: 1fr;
  }
  .api-key-actions {
    justify-content: flex-start;
  }
  .templates-page__top {
    display: grid;
    gap: 12px;
  }
  .templates-page__top .generate-button {
    width: 100%;
    justify-content: center;
  }
  .template-step-row,
  .template-field-row,
  .template-field-grid,
  .template-grid-2,
  .template-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .prompt-bar > div, .top-tabs, .top-tools { flex-wrap: wrap; }
  .generate-button { width: 100%; margin-left: 0; }
  .type-grid, .template-row, .mini-type-grid, .generated-grid, .prompt-ideas > div, .templates-list, .template-public-fields, .bonus-ledger article { grid-template-columns: 1fr; }
  .marketplace-stats,
  .template-public-stats,
  .home-scenarios--inline {
    grid-template-columns: 1fr;
  }
  .bonus-ledger img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .hero-panel { padding: 30px 18px; }
  .app--editor .editor-workspace { grid-template-columns: 1fr; }
  .app--editor .editor-settings { position: static; max-height: none; }
  .editor-session-grid,
  .editor-previous-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .segmented { grid-template-columns: 1fr 1fr; }
  .composer-controls label { min-width: 100%; }
  .selected-file { grid-template-columns: 64px minmax(0, 1fr); }
  .chat-message { max-width: 100%; }
  .chat-composer .generate-button { width: 100%; margin-left: 0; }
  .profile-hero {
    grid-template-columns: 1fr;
  }
  .profile-avatar {
    width: 58px;
    height: 58px;
  }
  .profile-metrics,
  .api-key-once,
  .api-key-panel {
    padding: 12px;
  }
  .api-key-actions .secondary-action,
  .api-key-actions .template-action-icon {
    flex: 1 1 100%;
    justify-content: center;
  }
}
