* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --sidebar: #fbfbfb;
  --surface: #ffffff;
  --surface-soft: #f6f6f6;
  --surface-strong: #ededed;
  --text: #111111;
  --text-soft: #3f3f3f;
  --muted: #666666;
  --faint: #858585;
  --line: #dedede;
  --line-strong: #bdbdbd;
  --accent: #111111;
  --accent-hover: #292929;
  --accent-ink: #ffffff;
  --accent-soft: #ededed;
  --danger: #b42318;
  --success: #2f9e55;
  --unread: #2563eb;
  --backdrop: rgba(0, 0, 0, 0.52);
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.12);
  --shadow-modal: 0 24px 72px rgba(0, 0, 0, 0.16);
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --type-display: clamp(34px, 3.3vw, 40px);
  --type-page-title: 28px;
  --type-section-title: 20px;
  --type-card-title: 16px;
  --type-body: 14px;
  --type-control: 13px;
  --type-meta: 12px;
  --type-caption: 11px;
  --leading-tight: 1.25;
  --leading-heading: 1.35;
  --leading-body: 1.6;
  --leading-meta: 1.45;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --topbar-height: 64px;
  --sidebar-default-width: 232px;
  --sidebar-collapsed-width: 64px;
  --sidebar-width: var(--sidebar-default-width);
  --sidebar-resizer-width: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --motion-fast: 120ms;
  --motion-control: 180ms;
  --motion-panel: 240ms;
  --motion-exit: 140ms;
  --ease-enter: cubic-bezier(.16, 1, .3, 1);
  --ease-exit: cubic-bezier(.4, 0, 1, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0c;
  --sidebar: #0e0e0f;
  --surface: #111214;
  --surface-soft: #17181a;
  --surface-strong: #222326;
  --text: #f5f5f5;
  --text-soft: #d1d1d1;
  --muted: #a3a3a3;
  --faint: #7f7f82;
  --line: #2b2c2f;
  --line-strong: #48494d;
  --accent: #f5f5f5;
  --accent-hover: #ffffff;
  --accent-ink: #111111;
  --accent-soft: #222326;
  --danger: #ffb4ab;
  --success: #75c98d;
  --unread: #7ea6ff;
  --backdrop: rgba(0, 0, 0, 0.72);
  --shadow-popover: 0 16px 36px rgba(0, 0, 0, 0.42);
  --shadow-modal: 0 28px 80px rgba(0, 0, 0, 0.5);
}

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

body {
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .56;
}

button,
input,
textarea,
select {
  transition: color 180ms var(--ease), background-color 180ms var(--ease), border-color 180ms var(--ease), opacity 180ms var(--ease), box-shadow 180ms var(--ease);
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

textarea::placeholder,
input::placeholder {
  color: var(--faint);
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Authentication */
.auth-screen {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, min(64.7vw, calc(100dvh * .909))) minmax(0, 1fr);
  min-width: 0;
  min-height: 100dvh;
  overflow: hidden;
  color: #111111;
  background: #ffffff;
}

:root[data-auth="signed-in"] .auth-screen,
:root[data-auth="signed-out"] .app-shell,
:root[data-auth="loading"] .auth-screen,
:root[data-auth="loading"] .app-shell {
  display: none;
}

.auth-hero {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.auth-hero-media {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.auth-hero img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  user-select: none;
}

.auth-panel {
  --auth-form-width: clamp(352px, 21vw, 520px);
  --auth-title-size: clamp(29px, calc(1vw + 14px), 38px);
  --auth-tab-size: clamp(18px, calc(.8vw + 6px), 24px);
  --auth-body-size: clamp(15px, calc(.4vw + 9px), 19px);
  --auth-option-size: clamp(14px, calc(.4vw + 8px), 17px);
  --auth-button-size: clamp(16px, calc(.45vw + 9px), 19px);
  --auth-caption-size: clamp(12px, calc(.3vw + 8px), 14px);
  --auth-control-height: clamp(58px, calc(3vh + 26px), 68px);
  display: grid;
  min-width: 0;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(42px, 6.5vh, 74px) 48px;
  background: #ffffff;
}

.auth-form-shell {
  display: grid;
  width: min(var(--auth-form-width), 100%);
  color: #111111;
}

.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: clamp(50px, 7vh, 70px);
  border-bottom: 1px solid #d7d7d7;
}

.auth-tab {
  position: relative;
  min-height: 48px;
  padding: 0 8px 18px;
  color: #777777;
  background: transparent;
  font-size: var(--auth-tab-size);
  font-weight: 500;
}

.auth-tab:hover {
  color: #111111;
}

.auth-tab.active {
  color: #111111;
  font-weight: 700;
}

.auth-tab.active::before,
.auth-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  margin: auto;
}

.auth-tab.active::before {
  bottom: -1px;
  width: 100%;
  height: 2px;
  background: #111111;
}

.auth-tab.active::after {
  bottom: 0;
  width: 0;
  height: 0;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #111111;
  border-left: 7px solid transparent;
}

.auth-form {
  display: grid;
}

.auth-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 38px;
}

.auth-heading h1 {
  margin: 0;
  color: #111111;
  font-size: var(--auth-title-size);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.28;
}

.auth-heading p {
  margin: 0;
  color: #777777;
  font-size: var(--auth-body-size);
  line-height: 1.6;
}

.auth-fields {
  display: grid;
  gap: 20px;
}

.auth-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  min-height: var(--auth-control-height);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  color: #555555;
  background: #ffffff;
  border: 1px solid #d2d2d2;
  border-radius: 6px;
}

.auth-field:hover {
  border-color: #a8a8a8;
}

.auth-field:focus-within {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, .08);
}

.auth-field > .icon {
  width: 20px;
  height: 20px;
  color: #222222;
  stroke-width: 1.65;
}

.auth-field input {
  width: 100%;
  min-width: 0;
  height: calc(var(--auth-control-height) - 2px);
  padding: 0;
  color: #111111;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: var(--auth-body-size);
}

.auth-field input::placeholder {
  color: #929292;
}

.auth-password-toggle {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: #333333;
  background: transparent;
  border-radius: 6px;
}

.auth-password-toggle:hover,
.auth-password-toggle[aria-pressed="true"] {
  background: #f2f2f2;
}

.auth-password-toggle .icon {
  width: 20px;
  height: 20px;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #333333;
  font-size: var(--auth-option-size);
  cursor: pointer;
}

.auth-checkbox input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #111111;
}

.auth-text-button,
.auth-switch-copy button {
  padding: 0;
  color: #111111;
  background: transparent;
  font-weight: 600;
}

.auth-text-button:hover,
.auth-switch-copy button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.auth-feedback {
  min-height: 21px;
  margin: 10px 0 6px;
  color: #b42318;
  font-size: var(--auth-caption-size);
  line-height: 1.6;
}

.auth-feedback[data-type="info"] {
  color: #555555;
}

.auth-primary,
.auth-secondary,
.auth-code-row > button {
  min-height: var(--auth-control-height);
  border-radius: 6px;
  font-size: var(--auth-button-size);
  font-weight: 600;
}

.auth-primary {
  color: #ffffff;
  background: #0d0d0d;
  border: 1px solid #0d0d0d;
}

.auth-primary:hover {
  background: #272727;
}

.auth-secondary {
  margin-top: 18px;
  color: #111111;
  background: #ffffff;
  border: 1px solid #d2d2d2;
}

.auth-secondary:hover {
  background: #f7f7f7;
  border-color: #a8a8a8;
}

.auth-switch-copy {
  margin: 24px 0 0;
  color: #777777;
  text-align: center;
  font-size: var(--auth-option-size);
}

.auth-legal {
  margin: clamp(42px, 6vh, 62px) 0 0;
  color: #858585;
  text-align: center;
  font-size: var(--auth-caption-size);
  line-height: 1.6;
}

.auth-legal a {
  color: inherit;
  text-underline-offset: 2px;
}

.auth-register-form .auth-heading {
  margin-bottom: 26px;
}

.auth-register-fields {
  gap: 13px;
}

.auth-register-form .auth-field {
  min-height: clamp(52px, calc(var(--auth-control-height) - 6px), 62px);
}

.auth-register-form .auth-field input {
  height: clamp(50px, calc(var(--auth-control-height) - 8px), 60px);
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
}

.auth-code-row > button {
  min-height: clamp(52px, calc(var(--auth-control-height) - 6px), 62px);
  padding: 0 12px;
  color: #111111;
  background: #ffffff;
  border: 1px solid #d2d2d2;
  font-size: clamp(13px, calc(.35vw + 8px), 16px);
}

.auth-code-row > button:hover {
  background: #f7f7f7;
  border-color: #a8a8a8;
}

.auth-agreement {
  align-items: flex-start;
  margin-top: 17px;
  color: #666666;
  font-size: var(--auth-caption-size);
  line-height: 1.55;
}

.auth-register-form .auth-feedback {
  margin-top: 7px;
}

.auth-register-success {
  display: grid;
  gap: 14px;
  padding: 22px 22px 24px;
  background: #fafafa;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
}

.auth-register-success-kicker {
  color: #666666;
  font-size: var(--auth-caption-size);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-register-success h2 {
  margin: 0;
  color: #111111;
  font-size: clamp(22px, calc(.95vw + 14px), 30px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.3;
}

.auth-register-success p {
  margin: 0;
  color: #555555;
  font-size: var(--auth-body-size);
  line-height: 1.7;
}

.auth-register-success strong {
  color: #111111;
}

.auth-register-success .auth-primary {
  margin-top: 6px;
}

.auth-register-form + .auth-legal {
  margin-top: 32px;
}

.auth-screen[data-mode="login"] .auth-form-shell {
  transform: translateY(37px);
}

.auth-screen[data-mode="login"] #login-form .auth-feedback {
  margin-top: 30px;
}

.auth-screen[data-mode="login"] #login-form .auth-secondary {
  margin-top: 25px;
}

.auth-screen[data-mode="login"] #login-form .auth-switch-copy {
  margin-top: 58px;
}

.auth-screen[data-mode="login"] .auth-legal {
  margin-top: 46px;
}

.auth-screen[data-mode="register"] .auth-legal {
  margin-top: 32px;
}

@media (max-width: 1100px) {
  .auth-screen {
    grid-template-columns: minmax(0, 58fr) minmax(410px, 42fr);
  }

  .auth-panel {
    padding-right: 30px;
    padding-left: 30px;
  }

}

@media (max-width: 820px) {
  .auth-screen {
    position: absolute;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 42dvh) auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .auth-hero-media {
    width: 100%;
  }

  .auth-hero img {
    width: 154.4%;
    height: 100%;
    object-fit: cover;
    object-position: left 54%;
  }

  .auth-panel {
    min-height: 58dvh;
    padding: 42px 24px 36px;
  }

  .auth-form-shell {
    width: min(420px, 100%);
  }

  .auth-screen[data-mode="login"] .auth-form-shell {
    transform: none;
  }

  .auth-screen[data-mode="login"] #login-form .auth-feedback {
    margin-top: 10px;
  }

  .auth-screen[data-mode="login"] #login-form .auth-secondary {
    margin-top: 18px;
  }

  .auth-screen[data-mode="login"] #login-form .auth-switch-copy {
    margin-top: 24px;
  }

  .auth-tabs {
    margin-bottom: 38px;
  }

  .auth-legal {
    margin-top: 36px;
  }
}

@media (max-width: 480px) {
  .auth-screen {
    grid-template-rows: 260px auto;
  }

  .auth-panel {
    padding: 34px 18px 30px;
  }

  .auth-heading {
    margin-bottom: 28px;
  }

  .auth-heading h1 {
    font-size: 24px;
  }

  .auth-field,
  .auth-primary,
  .auth-secondary {
    min-height: 54px;
  }

  .auth-code-row {
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .auth-switch-copy {
    margin-top: 20px;
  }
}

/* 我的设计：参考稿完整交互与关联弹窗 */
.design-library-nav-indicator {
  position: absolute;
  z-index: 2;
  top: 0;
  left: -14px;
  width: 3px;
  height: 52px;
  background: var(--text);
  border-radius: 0 3px 3px 0;
  pointer-events: none;
  transition: transform 280ms cubic-bezier(.2, .7, .3, 1);
}

.design-library-nav-list:has([data-library-section="projects"].active) .design-library-nav-indicator {
  transform: translateY(58px);
}

.design-library-nav-list:has([data-library-section="brands"].active) .design-library-nav-indicator {
  transform: translateY(116px);
}

.design-library-nav-list:has([data-library-section="materials"].active) .design-library-nav-indicator {
  transform: translateY(174px);
}

.design-library-nav-item::before {
  display: none;
}

.library-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.library-skeleton-grid[hidden] {
  display: none;
}

.library-skeleton-card {
  display: grid;
  gap: 10px;
}

.library-skeleton-card i {
  display: block;
  aspect-ratio: 1;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-soft) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  animation: library-shimmer 1.3s linear infinite;
}

.library-skeleton-card b {
  display: block;
  width: 64%;
  height: 11px;
  background: var(--surface-soft);
  border-radius: 6px;
}

.library-grid-ready .library-asset-card {
  animation: library-rise 420ms cubic-bezier(.2, .7, .3, 1) both;
}

.library-grid-ready .library-asset-card:nth-child(2) { animation-delay: 45ms; }
.library-grid-ready .library-asset-card:nth-child(3) { animation-delay: 90ms; }
.library-grid-ready .library-asset-card:nth-child(4) { animation-delay: 135ms; }
.library-grid-ready .library-asset-card:nth-child(5) { animation-delay: 180ms; }
.library-grid-ready .library-asset-card:nth-child(6) { animation-delay: 225ms; }
.library-grid-ready .library-asset-card:nth-child(7) { animation-delay: 270ms; }
.library-grid-ready .library-asset-card:nth-child(8) { animation-delay: 315ms; }
.library-grid-ready .library-asset-card:nth-child(n+9) { animation: none; }

.history-library-page {
  transition: box-shadow 180ms ease, background-color 180ms ease;
}

.history-library-page.library-drag-active {
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 2px var(--text);
}

.library-quick-look img {
  transition: transform 200ms cubic-bezier(.2, .7, .3, 1);
  animation: library-reveal 320ms ease;
}

#library-upload-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

#library-upload-preview[hidden] {
  display: none;
}

.library-upload-error {
  color: var(--danger);
  font-size: 12px;
}

.library-upload-error[hidden] {
  display: none;
}

.library-history-overlay {
  position: fixed;
  z-index: 160;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, .5);
  animation: library-fade-in 160ms ease both;
}

.library-history-overlay[hidden] {
  display: none;
}

.library-history-dialog {
  display: flex;
  width: min(1180px, 100%);
  height: min(760px, 100%);
  overflow: hidden;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
  animation: library-scale-in 200ms cubic-bezier(.2, .7, .3, 1) both;
}

.library-history-header {
  display: flex;
  min-height: 64px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.library-history-heading {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.library-history-heading > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.library-history-heading h1 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-history-heading > div > span {
  flex: none;
  padding: 3px 8px;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.library-history-heading small {
  color: var(--muted);
  font-size: 12px;
}

.library-history-heading b {
  color: inherit;
  font-weight: 500;
}

.library-history-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

.library-history-actions button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
}

.library-history-actions button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.library-history-actions button:last-child {
  width: 36px;
  padding: 0;
  color: var(--text-soft);
}

.library-history-actions .icon {
  width: 14px;
  height: 14px;
}

.library-history-actions button:last-child .icon {
  width: 16px;
  height: 16px;
}

.library-history-body {
  display: flex;
  min-height: 0;
  flex: 1;
  gap: 16px;
  overflow: hidden;
  padding: 16px;
}

.library-history-stage {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1.35 1 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.library-history-stage img {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1643 / 957;
  object-fit: contain;
  border-radius: 6px;
}

.library-history-stage img.history-image-reveal {
  animation: library-reveal 400ms cubic-bezier(.2, .7, .3, 1) both;
}

.library-history-rail {
  width: clamp(320px, 32vw, 420px);
  height: 100%;
  flex: none;
  overflow-y: auto;
  padding: 18px 16px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.library-history-rail > strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.library-history-rail > p {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.library-history-step {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 16px;
  animation: library-rise 400ms cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: var(--history-delay);
}

.library-history-step.branch .library-history-card {
  margin-left: 18px;
}

.library-history-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.library-history-marker i {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 5px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  transition: background 220ms ease, border-color 220ms ease;
}

.library-history-marker b {
  position: absolute;
  top: 16px;
  bottom: -16px;
  width: 1px;
  background: var(--line-strong);
  transform-origin: top;
  animation: library-grow 500ms ease both;
  animation-delay: var(--history-delay);
}

.library-history-step.active .library-history-marker i {
  background: var(--text);
  border-color: var(--text);
}

.library-history-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}

.library-history-card:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.library-history-step.active .library-history-card {
  border-color: var(--text);
}

.library-history-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.library-history-card-top > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.library-history-card-top strong {
  font-size: 13px;
  font-weight: 700;
}

.library-history-card-top small {
  color: var(--muted);
  font-size: 11px;
}

.library-history-card-top time {
  flex: none;
  color: var(--faint);
  font-size: 11px;
}

.library-history-lineage {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.library-history-lineage > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.library-history-step.branch .library-history-lineage > span {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.library-history-lineage .icon {
  width: 12px;
  height: 12px;
}

.library-history-lineage > small {
  color: var(--muted);
  font-size: 11px;
}

.library-history-prompts {
  display: grid;
  gap: 5px;
}

.library-history-prompts > span {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.library-history-model {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.library-history-model .icon {
  width: 13px;
  height: 13px;
}

@keyframes library-scale-in {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@keyframes library-rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes library-reveal {
  from { opacity: 0; filter: blur(14px); transform: scale(1.03); }
  to { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes library-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes library-shimmer {
  from { background-position: -180% 0; }
  to { background-position: 180% 0; }
}

@media (max-width: 1023px) {
  .library-history-body {
    flex-direction: column;
    overflow-y: auto;
  }

  .library-history-stage {
    min-height: max(360px, 46vh);
    flex: none;
  }

  .library-history-rail {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 760px) {
  .design-library-nav-indicator {
    top: auto;
    right: auto;
    bottom: -1px;
    left: 0;
    width: calc((100% - 24px) / 4);
    height: 2px;
    border-radius: 2px 2px 0 0;
  }

  .design-library-nav-list:has([data-library-section="projects"].active) .design-library-nav-indicator {
    transform: translateX(calc(100% + 8px));
  }

  .design-library-nav-list:has([data-library-section="brands"].active) .design-library-nav-indicator {
    transform: translateX(calc(200% + 16px));
  }

  .design-library-nav-list:has([data-library-section="materials"].active) .design-library-nav-indicator {
    transform: translateX(calc(300% + 24px));
  }

  .library-skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .library-history-overlay {
    padding: 12px;
  }

  .library-history-dialog {
    height: 100%;
  }

  .library-history-header {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .library-history-actions {
    gap: 6px;
  }

  .library-history-actions button:first-child {
    width: 36px;
    padding: 0;
  }

  .library-history-actions button:first-child span {
    display: none;
  }

  .library-history-body {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .library-skeleton-grid {
    grid-template-columns: 1fr;
  }

  .library-history-stage {
    min-height: 280px;
  }

  .library-history-step.branch .library-history-card {
    margin-left: 8px;
  }
}

@media (max-height: 800px) and (min-width: 821px) {
  .auth-panel {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .auth-screen[data-mode="login"] .auth-form-shell {
    transform: none;
  }

  .auth-screen[data-mode="login"] #login-form .auth-feedback {
    margin-top: 10px;
  }

  .auth-screen[data-mode="login"] #login-form .auth-secondary {
    margin-top: 18px;
  }

  .auth-screen[data-mode="login"] #login-form .auth-switch-copy {
    margin-top: 24px;
  }

  .auth-tabs {
    margin-bottom: 34px;
  }

  .auth-heading {
    margin-bottom: 24px;
  }

  .auth-fields {
    gap: 14px;
  }

  .auth-field {
    min-height: 52px;
  }

  .auth-field input {
    height: 50px;
  }

  .auth-primary,
  .auth-secondary {
    min-height: 52px;
  }

  .auth-legal {
    margin-top: 24px;
  }
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) var(--sidebar-resizer-width) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  padding-top: var(--topbar-height);
  background: var(--bg);
}

.main-shell {
  grid-column: 3;
  min-width: 0;
  min-height: 0;
  height: calc(100dvh - var(--topbar-height));
  background: var(--bg);
}

.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto 0;
  display: grid;
  grid-template-columns: calc(var(--sidebar-width) + var(--sidebar-resizer-width)) minmax(0, 1fr) auto;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 20px 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-wordmark {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  color: var(--text);
  font-family: var(--font);
  line-height: 1;
  white-space: nowrap;
}

.brand-wordmark-name {
  flex: none;
  font-size: 20px;
  font-weight: var(--weight-bold);
  letter-spacing: -.055em;
}

.brand-wordmark-descriptor {
  overflow: hidden;
  margin-left: 11px;
  padding-left: 11px;
  color: var(--muted);
  border-left: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: .06em;
  text-overflow: ellipsis;
}

.module-switch {
  display: flex;
  min-width: 0;
  align-self: stretch;
  gap: 36px;
  justify-self: start;
}

.module-button {
  position: relative;
  height: 100%;
  padding: 0 0;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  transition: color var(--motion-control) var(--ease), background-color var(--motion-control) var(--ease), border-color var(--motion-control) var(--ease), transform var(--motion-fast) var(--ease);
}

.module-button:hover {
  color: var(--text);
}

.module-button.active {
  color: var(--text);
}

.module-button:active {
  transform: translateY(1px) scale(.985);
}

.module-button.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--text);
  border-radius: 3px 3px 0 0;
}

.topbar-module-indicator {
  position: absolute;
  z-index: 3;
  bottom: -1px;
  left: 0;
  width: 1px;
  height: 3px;
  opacity: 0;
  background: var(--text);
  border-radius: 3px 3px 0 0;
  pointer-events: none;
  transform: translate3d(var(--module-indicator-x, 0), 0, 0) scaleX(var(--module-indicator-scale, 1));
  transform-origin: left center;
  transition: transform var(--motion-panel) var(--ease-enter), opacity var(--motion-control) var(--ease);
}

.topbar-module-indicator.is-visible {
  opacity: 1;
}

.topbar-module-indicator.is-instant {
  transition: none;
}

.topbar.module-indicator-ready .module-button.active::after {
  opacity: 0;
}

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

.gallery-button,
.credits-button,
.theme-switch,
.mobile-new-conversation,
.top-avatar {
  border: 1px solid var(--line);
}

.gallery-button,
.credits-button {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--text-soft);
  background: var(--surface);
  border-radius: 8px;
}

.gallery-button:hover,
.gallery-button.active,
.credits-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.gallery-button.active::after {
  content: none;
}

.gallery-button .icon,
.credits-button .icon {
  width: 15px;
  height: 15px;
}

.credits-button strong {
  font-size: 13px;
}

.credits-button small {
  color: var(--muted);
  font-size: 11px;
}

.theme-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-soft);
  border-radius: 9px;
}

.theme-switch button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
}

.theme-switch button:hover,
.theme-switch button[aria-pressed="true"] {
  color: var(--text);
  background: var(--surface);
}

.theme-switch .icon {
  width: 16px;
  height: 16px;
}

.mobile-new-conversation {
  display: none;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border-radius: 9px;
}

.mobile-new-conversation:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.mobile-new-conversation .icon {
  width: 18px;
  height: 18px;
}

.top-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
  border-radius: 50%;
  font-size: 12px;
}

.top-avatar:hover,
.top-avatar[aria-expanded="true"] {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--line-strong);
}

.profile-menu-shell {
  position: relative;
  flex: none;
}

.profile-popover-backdrop,
.profile-sheet-handle,
.profile-theme-row {
  display: none;
}

.avatar-image,
.profile-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-image {
  border-radius: inherit;
}

.profile-popover {
  position: absolute;
  z-index: 110;
  top: calc(100% + 14px);
  right: 0;
  display: none;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--topbar-height) - 24px);
  overflow-y: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  opacity: 0;
  transform: translateY(-6px);
}

.profile-popover.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: profile-popover-in 180ms var(--ease);
}

.profile-popover form {
  display: grid;
  padding: 24px;
}

.profile-popover h2 {
  margin: 0;
  font-size: 18px;
  font-weight: var(--weight-bold);
  line-height: var(--leading-heading);
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0 22px;
  border-bottom: 1px solid var(--line);
}

.profile-avatar-wrap {
  position: relative;
  flex: none;
}

.profile-avatar {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  overflow: hidden;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 50%;
  font-size: 26px;
}

.profile-photo-button {
  position: absolute;
  right: -4px;
  bottom: -2px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.profile-photo-button:hover {
  background: var(--surface-soft);
}

.profile-photo-button .icon {
  width: 15px;
  height: 15px;
}

.profile-identity-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.profile-identity-copy > strong {
  overflow: hidden;
  font-size: 18px;
  font-weight: var(--weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-identity-copy > span {
  color: var(--muted);
  font-size: 13px;
}

.profile-identity-copy > small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--success);
  font-size: 12px;
}

.profile-identity-copy > small i {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.profile-fields {
  display: grid;
  gap: 12px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.profile-edit-row,
.profile-info-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 32px;
  min-height: 40px;
  align-items: center;
  gap: 10px;
}

.profile-edit-row > label,
.profile-info-row > span {
  color: var(--muted);
  font-size: 13px;
}

.profile-edit-row input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  font-size: 13px;
}

.profile-edit-row input:hover {
  border-color: var(--line-strong);
}

.profile-edit-row input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent);
}

.profile-edit-row > button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 7px;
}

.profile-edit-row > button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.profile-edit-row > button .icon {
  width: 15px;
  height: 15px;
}

.profile-info-row {
  min-height: 30px;
}

.profile-info-row strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: var(--weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-role-row {
  grid-template-columns: 96px minmax(0, 1fr) auto;
}

.profile-role-row small {
  color: var(--faint);
  font-size: 11px;
  white-space: nowrap;
}

.profile-usage {
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.profile-usage .icon {
  width: 16px;
  height: 16px;
  margin-right: 1px;
  color: var(--text);
}

.profile-usage strong {
  color: var(--text);
  font-size: 15px;
}

.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
}

.profile-actions button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.profile-actions > div {
  display: flex;
  gap: 8px;
}

.profile-logout {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 0 !important;
  color: var(--text-soft);
  background: transparent;
  border-color: transparent !important;
}

.profile-logout:hover {
  color: var(--danger);
  background: transparent;
}

.profile-logout .icon {
  width: 16px;
  height: 16px;
}

#profile-cancel {
  color: var(--text-soft);
  background: var(--surface);
}

#profile-cancel:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.profile-actions .profile-save {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.profile-actions .profile-save:hover {
  background: var(--accent-hover);
}

@keyframes profile-popover-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes profile-sheet-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

.mobile-sidebar-toggle {
  display: none;
}

/* Conversation navigation */
.sidebar {
  grid-column: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
  height: calc(100dvh - var(--topbar-height));
  flex-direction: column;
  overflow: hidden;
  padding: 20px 14px 16px;
  background: var(--sidebar);
  transition: opacity 180ms var(--ease), transform 200ms var(--ease);
}

.sidebar-module-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.sidebar-primary-action {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.new-chat {
  min-width: 0;
  flex: 1;
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 650;
}

.new-chat:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.sidebar-collapse-toggle {
  display: none;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: color var(--motion-control) var(--ease), background-color var(--motion-control) var(--ease), border-color var(--motion-control) var(--ease);
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible {
  color: var(--text);
  background: var(--surface-strong);
  border-color: var(--line);
}

.sidebar-collapse-toggle:active {
  transform: scale(.97);
}

.sidebar-collapse-toggle .icon {
  width: 18px;
  height: 18px;
  transition: transform var(--motion-control) var(--ease);
}

.sidebar-resizer {
  position: relative;
  z-index: 12;
  grid-column: 2;
  display: grid;
  width: var(--sidebar-resizer-width);
  min-height: 0;
  place-items: center;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.sidebar-resizer::before {
  position: absolute;
  inset: 0 5px;
  background: var(--line);
  content: "";
  transition: background 160ms var(--ease), box-shadow 160ms var(--ease);
}

.sidebar-resizer span {
  position: relative;
  width: 5px;
  height: 42px;
  background: var(--line-strong);
  border: 1px solid var(--surface);
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
  opacity: .72;
  transition: height 160ms var(--ease), background 160ms var(--ease), opacity 160ms var(--ease), transform 160ms var(--ease);
}

.sidebar-resizer:hover::before,
.sidebar-resizer:focus-visible::before,
.app-shell.is-sidebar-resizing .sidebar-resizer::before {
  background: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 9%, transparent);
}

.sidebar-resizer:hover span,
.sidebar-resizer:focus-visible span,
.app-shell.is-sidebar-resizing .sidebar-resizer span {
  height: 56px;
  background: var(--text);
  opacity: 1;
  transform: scaleX(1.12);
}

.sidebar-resizer:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.app-shell.is-sidebar-resizing,
.app-shell.is-sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.conversation-nav {
  flex: 1;
  min-height: 0;
  margin-top: 24px;
  padding-right: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-color: color-mix(in srgb, var(--text) 34%, var(--line)) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
}

.conversation-nav::-webkit-scrollbar {
  width: 8px;
}

.conversation-nav::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 999px;
}

.conversation-nav::-webkit-scrollbar-thumb {
  min-height: 42px;
  background: color-mix(in srgb, var(--text) 30%, var(--line));
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

.conversation-nav:hover::-webkit-scrollbar-thumb,
.conversation-nav:focus-within::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 52%, var(--line));
  background-clip: content-box;
}

.conversation-group + .conversation-group {
  margin-top: 20px;
}

.conversation-group > h2 {
  margin: 0 0 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  line-height: 28px;
}

.conversation-row {
  position: relative;
}

.conversation-row[data-sortable="true"] {
  cursor: grab;
  transition: opacity 140ms var(--ease), transform 180ms var(--ease);
}

.conversation-row[data-sortable="true"] .conversation-item {
  cursor: grab;
}

.conversation-row[data-sortable="true"] .conversation-item:active {
  cursor: grabbing;
}

.conversation-row.is-dragging {
  z-index: 2;
  opacity: .32;
  transform: scale(.985);
}

.conversation-row.is-drop-target::before,
.conversation-row.is-drop-after::after {
  position: absolute;
  z-index: 3;
  right: 10px;
  left: 10px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  content: '';
  pointer-events: none;
}

.conversation-row.is-drop-target::before {
  top: -2px;
}

.conversation-row.is-drop-after::after {
  bottom: 2px;
}

.conversation-row.menu-open {
  z-index: 12;
}

.conversation-item {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 9px 42px 9px 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
}

.conversation-item:hover,
.conversation-item.active {
  color: var(--text);
  background: var(--surface-strong);
}

.conversation-item.active {
  border-color: var(--line);
}

.conversation-icon {
  position: relative;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  flex: none;
  color: var(--text);
}

.conversation-icon .icon {
  width: 18px;
  height: 18px;
  overflow: visible;
  transform-origin: center;
}

.conversation-icon[data-status='running'] .icon {
  filter: url('#conversation-liquid-filter');
  animation: conversation-icon-liquid-drift 1.8s cubic-bezier(.45, 0, .25, 1) infinite;
  will-change: filter, transform;
}

.conversation-icon[data-status='unread'] {
  color: var(--unread);
}

.conversation-icon[data-status='unread'] .icon {
  fill: color-mix(in srgb, var(--unread) 6%, transparent);
}

.conversation-icon[data-status='unread']::after {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--unread);
  content: '';
}

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

.conversation-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 630;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item small {
  color: var(--muted);
  font-size: 11px;
}

@keyframes conversation-icon-liquid-drift {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }

  24% {
    transform: translate(-.8px, .6px) scale(1.14, .92);
  }

  52% {
    transform: translate(.7px, -.8px) scale(.92, 1.16);
  }

  76% {
    transform: translate(.7px, .8px) scale(1.12, .94);
  }
}

@media (prefers-reduced-motion: reduce) {
  .conversation-row[data-sortable="true"] {
    transition: none;
  }

  .conversation-icon[data-status='running'] .icon {
    filter: url('#conversation-liquid-filter-static');
    animation: none;
    will-change: auto;
  }
}

.conversation-more {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  transform: translateY(-50%);
}

.conversation-more:hover,
.conversation-more:focus-visible {
  color: var(--text);
  background: var(--surface);
}

.conversation-more .icon {
  width: 17px;
  height: 17px;
  stroke-width: 3;
}

.conversation-menu {
  position: fixed;
  z-index: 96;
  display: grid;
  width: 152px;
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-popover);
}

.conversation-menu[hidden] {
  display: none;
}

.conversation-menu button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: var(--text-soft);
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  text-align: left;
}

.conversation-menu button:hover,
.conversation-menu button:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
}

.conversation-menu button .icon {
  width: 16px;
  height: 16px;
}

.conversation-row.pinned .conversation-item strong::after {
  content: "置顶";
  margin-left: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: var(--weight-medium);
}

.sidebar-footer {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-icp-link {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
  text-underline-offset: 2px;
}

.sidebar-icp-link:hover,
.sidebar-icp-link:focus-visible {
  color: var(--text);
}

.support-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  text-align: left;
}

.support-button:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.support-button strong {
  font-size: 12px;
  font-weight: 600;
}

.support-button em {
  min-width: 20px;
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-align: right;
}

@media (min-width: 1041px) {
  .sidebar-collapse-toggle {
    display: grid;
  }

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) var(--sidebar-resizer-width) minmax(0, 1fr);
  }

  .app-shell.is-sidebar-collapsed .topbar {
    grid-template-columns: calc(var(--sidebar-collapsed-width) + var(--sidebar-resizer-width)) minmax(0, 1fr) auto;
  }

  .app-shell.is-sidebar-collapsed .brand-wordmark-descriptor {
    display: none;
  }

  .app-shell.is-sidebar-collapsed .sidebar {
    padding-inline: 12px;
  }

  .app-shell.is-sidebar-collapsed .sidebar-primary-action {
    flex-direction: column;
    align-items: center;
  }

  .app-shell.is-sidebar-collapsed .sidebar-primary-action .new-chat {
    width: 40px;
    height: 40px;
    flex: none;
    justify-content: center;
    gap: 0;
    padding: 0;
    font-size: 0;
  }

  .app-shell.is-sidebar-collapsed .sidebar-primary-action .new-chat .icon {
    width: 18px;
    height: 18px;
  }

  .app-shell.is-sidebar-collapsed .sidebar-module-panel > :not(.sidebar-primary-action) {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .app-shell.is-sidebar-collapsed .sidebar-collapse-toggle .icon {
    transform: rotate(180deg);
  }
}

/* Conversation navigation belongs only to the inspiration-design module. */
.app-shell.non-discussion-mode {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell.non-discussion-mode .sidebar,
.app-shell.non-discussion-mode .sidebar-resizer {
  display: none;
}

.app-shell.non-discussion-mode .main-shell {
  grid-column: 1;
}

.app-shell.non-discussion-mode .mobile-sidebar-toggle {
  display: none;
}

@media (min-width: 1041px) {
  .app-shell.non-discussion-mode .topbar {
    grid-template-columns: calc(var(--sidebar-default-width) + var(--sidebar-resizer-width)) minmax(0, 1fr) auto;
  }
}

/* Shared module shell */
.module-panel {
  display: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.module-panel.active {
  display: block;
}

.module-panel-enter-forward {
  animation: module-panel-enter-forward var(--motion-panel) var(--ease-enter) both;
}

.module-panel-enter-backward {
  animation: module-panel-enter-backward var(--motion-panel) var(--ease-enter) both;
}

@keyframes module-panel-enter-forward {
  from { opacity: .01; transform: translate3d(8px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes module-panel-enter-backward {
  from { opacity: .01; transform: translate3d(-8px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Free discussion */
.discussion-layout,
.discussion-workspace {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.discussion-workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.message-stream {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 42px clamp(24px, 5vw, 80px) 40px;
  scrollbar-width: thin;
}

.message-stream:empty {
  display: none;
}

.discussion-workspace.conversation-active .message-stream {
  padding-right: clamp(104px, 8vw, 132px);
}

.conversation-version-rail {
  position: absolute;
  z-index: 9;
  top: 24px;
  right: 20px;
  bottom: var(--conversation-version-rail-bottom, 128px);
  display: flex;
  width: 74px;
  min-height: 180px;
  padding: 10px 7px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgb(0 0 0 / 7%);
  backdrop-filter: blur(16px);
  transition: width 180ms var(--ease), box-shadow 180ms var(--ease);
}

.conversation-version-rail:hover,
.conversation-version-rail:focus-within {
  width: 80px;
  box-shadow: 0 16px 34px rgb(0 0 0 / 10%);
}

.conversation-version-rail-list {
  display: flex;
  width: 100%;
  min-height: 0;
  align-items: center;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 5px;
  outline: 0;
  scrollbar-color: color-mix(in srgb, var(--text) 24%, transparent) transparent;
  scrollbar-width: thin;
}

.conversation-version-rail-list::-webkit-scrollbar {
  width: 3px;
}

.conversation-version-rail-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 24%, transparent);
  border-radius: 999px;
}

.conversation-version-rail-row {
  display: grid;
  width: 100%;
  flex: none;
  place-items: center;
}

.conversation-version-rail-item {
  position: relative;
  display: block;
  width: 50px;
  min-height: 50px;
  aspect-ratio: 1;
  flex: none;
  overflow: visible;
  padding: 0;
  background: var(--surface-soft);
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 10px;
  opacity: .68;
  transition: width 180ms var(--ease), min-height 180ms var(--ease), border-color 180ms var(--ease), opacity 180ms var(--ease), transform 180ms var(--ease);
}

.conversation-version-rail-item.is-near {
  width: 56px;
  min-height: 56px;
  opacity: .86;
}

.conversation-version-rail-item.active {
  width: 64px;
  min-height: 64px;
  border: 2px solid var(--text);
  opacity: 1;
}

.conversation-version-rail:hover .conversation-version-rail-item:hover,
.conversation-version-rail-item:focus-visible {
  width: 66px;
  min-height: 66px;
  border-color: var(--text);
  opacity: 1;
  transform: translateX(-2px);
}

.conversation-version-rail-item:focus-visible {
  outline: 2px solid var(--surface);
  box-shadow: 0 0 0 4px var(--text);
}

.conversation-version-rail-item img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  border-radius: inherit;
}

.conversation-version-rail-item > span {
  position: absolute;
  bottom: 4px;
  left: 4px;
  min-width: 25px;
  padding: 2px 4px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border-radius: 5px;
  backdrop-filter: blur(7px);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .02em;
  text-align: center;
}

.conversation-version-rail-item.active > span {
  color: var(--accent-ink);
  background: var(--accent);
}

.conversation-version-rail-item > i {
  position: absolute;
  top: 50%;
  left: -14px;
  display: none;
  width: 12px;
  height: 12px;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transform: translateY(-50%);
}

.conversation-version-rail-item.active > i {
  display: flex;
}

.conversation-version-rail-item > i .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}

.discussion-start {
  display: flex;
  width: 100%;
  max-width: 1080px;
  min-height: 0;
  flex: 1;
  align-self: center;
  align-items: center;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(72px, 10vh, 112px) 32px 48px;
}

.discussion-start > h1 {
  margin: 0;
  font-size: clamp(38px, 4vw, 52px);
  font-weight: 760;
  letter-spacing: -.045em;
  line-height: 1.14;
  text-align: center;
}

.discussion-start > h1 span {
  color: inherit;
}

.discussion-start > p {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  text-align: center;
}

.composer-wrap {
  width: 100%;
  max-width: 900px;
  margin-top: 34px;
}

.composer {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto auto auto;
  min-height: 64px;
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  box-shadow: 0 2px 12px rgb(0 0 0 / 4%);
}

.composer:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.composer textarea {
  grid-row: 1;
  grid-column: 2;
  width: 100%;
  min-height: 26px;
  max-height: 160px;
  align-self: center;
  overflow-y: hidden;
  resize: none;
  padding: 2px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
  line-height: 1.65;
}

.composer textarea.is-scrollable {
  overflow-y: auto;
}

.composer-model-picker {
  position: relative;
  grid-row: 1;
  grid-column: 4;
  align-self: center;
}

.composer-aspect-picker {
  position: relative;
  grid-row: 1;
  grid-column: 5;
  align-self: center;
}

.composer-reasoning-picker {
  position: relative;
  grid-row: 1;
  grid-column: 3;
  align-self: center;
}

.composer-reasoning-trigger {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 21px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.composer-reasoning-trigger:hover:not(:disabled),
.composer-reasoning-trigger[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--line-strong);
}

.composer-reasoning-trigger:disabled {
  cursor: default;
  opacity: .55;
}

.composer-reasoning-trigger > .icon:first-child {
  width: 16px;
  height: 16px;
  color: #9a6e1e;
}

.composer-reasoning-chevron {
  width: 14px;
  height: 14px;
  transition: transform .16s ease;
}

.composer-reasoning-trigger[aria-expanded="true"] .composer-reasoning-chevron {
  transform: rotate(180deg);
}

.composer-reasoning-menu {
  position: absolute;
  z-index: 46;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(330px, calc(100vw - 32px));
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
}

.composer-reasoning-menu[hidden] {
  display: none;
}

.composer-reasoning-menu > strong {
  display: block;
  margin-bottom: 13px;
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.composer-reasoning-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.composer-reasoning-options button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: var(--weight-medium);
}

.composer-reasoning-options button:hover,
.composer-reasoning-options button:focus-visible {
  color: var(--text);
  background: var(--surface);
}

.composer-reasoning-options button[aria-checked="true"] {
  color: #fff;
  background: var(--text);
  box-shadow: 0 2px 7px rgb(0 0 0 / 15%);
}

.composer-reasoning-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.composer-reasoning-menu > p {
  min-height: 40px;
  margin: 15px 0 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.65;
}

.composer-reasoning-menu > small {
  display: block;
  margin: 14px -18px -18px;
  padding: 12px 18px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 0 0 18px 18px;
  font-size: 10px;
  line-height: 1.5;
}

.composer-model-trigger {
  display: flex;
  max-width: 190px;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 21px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.composer-model-trigger:hover:not(:disabled),
.composer-model-trigger[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--line-strong);
}

.composer-model-trigger:disabled {
  cursor: default;
  opacity: 1;
}

.composer-model-trigger > .icon:first-child {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--muted);
}

.composer-model-trigger > span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer-model-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform .16s ease;
}

.composer-model-trigger[aria-expanded="true"] .composer-model-chevron {
  transform: rotate(180deg);
}

.composer-model-picker.is-single .composer-model-chevron,
.composer-model-picker.is-empty .composer-model-chevron {
  display: none;
}

.composer-model-picker.is-empty .composer-model-trigger {
  color: var(--muted);
}

.composer-model-menu {
  position: absolute;
  z-index: 45;
  top: calc(100% + 10px);
  right: 0;
  width: min(310px, calc(100vw - 32px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: var(--shadow-modal);
}

.composer-model-menu[hidden] {
  display: none;
}

.composer-model-menu > strong {
  display: block;
  padding: 15px 16px 10px;
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.composer-model-options {
  display: grid;
  padding: 0 8px 8px;
}

.composer-model-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 8px;
  color: var(--text);
  background: transparent;
  border-radius: 9px;
  text-align: left;
}

.composer-model-option + .composer-model-option {
  border-top: 1px solid var(--line);
  border-radius: 0 0 9px 9px;
}

.composer-model-option:hover,
.composer-model-option:focus-visible {
  background: var(--surface-soft);
}

.composer-model-option > span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.composer-model-option strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: var(--weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-model-option small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.composer-model-option > .icon {
  width: 18px;
  height: 18px;
}

.composer-aspect-trigger {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 21px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.composer-aspect-trigger:hover:not(:disabled),
.composer-aspect-trigger[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--line-strong);
}

.composer-aspect-trigger:disabled {
  cursor: default;
  opacity: .5;
}

.composer-aspect-trigger-shape,
.composer-aspect-option-shape {
  display: block;
  width: calc(17px * var(--ratio-w, 1) / max(var(--ratio-w, 1), var(--ratio-h, 1)));
  height: calc(17px * var(--ratio-h, 1) / max(var(--ratio-w, 1), var(--ratio-h, 1)));
  min-width: 8px;
  min-height: 8px;
  max-width: 24px;
  max-height: 24px;
  flex: none;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.composer-aspect-trigger-shape.is-auto,
.composer-aspect-option-shape.is-auto {
  width: 17px;
  height: 17px;
  border-style: dashed;
  border-radius: 4px;
}

.composer-aspect-chevron {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform .16s ease;
}

.composer-aspect-trigger[aria-expanded="true"] .composer-aspect-chevron {
  transform: rotate(180deg);
}

.composer-aspect-menu {
  position: absolute;
  z-index: 47;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: var(--shadow-modal);
}

.composer-aspect-menu.is-top {
  top: auto;
  bottom: calc(100% + 10px);
}

.composer-aspect-menu[hidden] {
  display: none;
}

.composer-aspect-menu > strong {
  display: block;
  padding: 16px 18px 10px;
  font-size: 15px;
  font-weight: var(--weight-semibold);
}

.composer-aspect-model {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.composer-aspect-model > span:first-child {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.composer-aspect-model .icon {
  width: 21px;
  height: 21px;
}

.composer-aspect-model > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.composer-aspect-model strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: var(--weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-aspect-model small {
  color: var(--muted);
  font-size: 10px;
}

.composer-aspect-section {
  padding: 14px 18px 16px;
}

.composer-aspect-section > strong {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

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

.composer-aspect-option {
  display: grid;
  min-height: 76px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 8px 4px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 11px;
}

.composer-aspect-option:hover:not(:disabled),
.composer-aspect-option:focus-visible:not(:disabled) {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.composer-aspect-option[aria-checked="true"] {
  background: var(--surface);
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
}

.composer-aspect-option:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-soft);
  opacity: .62;
}

.composer-aspect-option small {
  margin-top: -4px;
  font-size: 9px;
}

.composer-aspect-menu > p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 18px;
  padding: 12px 0 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.5;
}

.composer-footer {
  display: contents;
}

.composer-footer > div {
  display: contents;
}

.composer-footer small {
  display: none;
}

.composer-tool,
.send-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: none;
  padding: 0;
  border-radius: 50%;
}

#upload-button {
  grid-row: 1;
  grid-column: 1;
}

.composer-tool {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.composer-tool:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.composer-tool[aria-expanded="true"] {
  background: var(--surface-soft);
  border-color: var(--text);
}

.composer-source-menu {
  position: absolute;
  z-index: 40;
  bottom: calc(100% + 10px);
  left: 0;
  display: grid;
  width: min(292px, calc(100vw - 32px));
  gap: 4px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
}

.composer-source-menu[hidden] {
  display: none;
}

.composer-source-menu > button {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border-radius: 8px;
  text-align: left;
}

.composer-source-menu > button:hover,
.composer-source-menu > button:focus-visible {
  background: var(--surface-soft);
}

.composer-source-menu > button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.composer-source-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: none;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.composer-source-icon .icon {
  width: 17px;
  height: 17px;
}

.composer-source-menu > button > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.composer-source-menu strong {
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.composer-source-menu small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.send-button {
  grid-row: 1;
  grid-column: 5;
  color: var(--accent-ink);
  background: var(--accent);
}

.send-button:hover {
  background: var(--accent-hover);
}

.composer-note {
  margin: 12px auto 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.upload-tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.upload-tray:empty {
  display: none;
}

.upload-chip {
  display: flex;
  max-width: 220px;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 5px 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11px;
}

.upload-chip i {
  width: 26px;
  height: 26px;
  flex: none;
  background-position: center;
  background-size: cover;
  border-radius: 4px;
}

.upload-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-chip button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 5px;
}

.upload-chip.uploading i {
  position: relative;
}

.upload-chip.uploading i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  border-radius: inherit;
}

.upload-chip.uploading span {
  color: var(--muted);
}

.upload-chip-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: upload-chip-spin 0.7s linear infinite;
}

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

.text-upload-chip {
  max-width: 260px;
}

.text-upload-chip .text-file-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
}

.text-upload-chip .text-file-icon .icon {
  width: 15px;
  height: 15px;
}

.text-upload-chip .text-file-download {
  display: grid;
  width: auto;
  height: auto;
  min-width: 0;
  place-items: initial;
  flex: 1;
  gap: 2px;
  padding: 0;
  color: var(--text);
  text-align: left;
}

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

.text-file-download strong {
  font-size: 11px;
}

.text-file-download small {
  color: var(--muted);
  font-size: 9px;
}

.prompt-keywords {
  display: flex;
  width: 100%;
  max-width: 760px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.prompt-keywords > span {
  margin-right: 2px;
  color: var(--faint);
  font-size: 12px;
}

.prompt-keywords button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface);
  font-size: 12px;
  transition: border-color .18s var(--ease), background .18s var(--ease), color .18s var(--ease);
}

.prompt-keywords button:hover,
.prompt-keywords button:focus-visible {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-soft);
}

.message {
  display: flex;
  max-width: 980px;
  gap: 12px;
  margin: 0 auto 32px;
}

.message-content {
  min-width: 0;
  flex: 1;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.message-meta strong {
  font-size: 12px;
}

.message-meta span {
  color: var(--faint);
  font-size: 10px;
}

.message-process {
  width: min(100%, 620px);
  margin-top: 9px;
}

.message-process-summary {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.message-process-summary::-webkit-details-marker {
  display: none;
}

.message-thinking-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  line-height: 1.4;
}

.message-process-chevron {
  width: 6px;
  height: 6px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms var(--ease);
}

.message-process[open] .message-process-chevron {
  transform: rotate(135deg) translate(-1px, -1px);
}

.message-process-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 2px 3px;
  padding: 0 0 0 15px;
  border-left: 1px solid var(--line);
  list-style: none;
}

.message-process-step {
  position: relative;
  min-height: 17px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
}

.message-process-marker {
  position: absolute;
  top: 5px;
  left: -19px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.message-process-step.is-active {
  color: var(--text-soft);
}

.message-process-step.is-active .message-process-marker {
  border-color: var(--text);
  background: var(--text);
  animation: message-process-pulse 1.4s ease-in-out infinite;
}

.message-process-step.is-complete .message-process-marker {
  border-color: var(--success);
  background: var(--success);
}

.message-process-step.is-failed,
.message-process-step.is-canceled {
  color: var(--danger);
}

.message-process-step.is-failed .message-process-marker,
.message-process-step.is-canceled .message-process-marker {
  border-color: var(--danger);
}

@keyframes message-process-pulse {
  50% {
    opacity: 0.38;
    transform: scale(0.72);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message-process-chevron {
    transition: none;
  }

  .message-process-step.is-active .message-process-marker {
    animation: none;
  }
}

.message p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
}

.message-markdown {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.message-markdown > :first-child {
  margin-top: 0;
}

.message-markdown > :last-child {
  margin-bottom: 0;
}

.message-markdown p,
.message-markdown ul,
.message-markdown ol,
.message-markdown blockquote,
.message-markdown pre,
.message-markdown h2,
.message-markdown h3,
.message-markdown h4 {
  margin: 10px 0 0;
}

.message-markdown ul,
.message-markdown ol {
  padding-left: 1.45em;
}

.message-markdown li {
  margin-top: 3px;
  padding-left: 2px;
}

.message-markdown li::marker {
  color: var(--muted);
}

.message-markdown strong {
  color: var(--text);
  font-weight: 650;
}

.message-markdown h2,
.message-markdown h3,
.message-markdown h4 {
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.message-markdown blockquote {
  padding-left: 12px;
  color: var(--muted);
  border-left: 3px solid var(--line-strong, var(--line));
}

.message-markdown code {
  padding: 2px 5px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.message-markdown pre {
  max-width: 100%;
  padding: 12px 14px;
  overflow-x: auto;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-markdown pre code {
  padding: 0;
  background: transparent;
  border: 0;
  white-space: pre;
}

.message-table-scroll {
  max-width: 100%;
  margin: 12px 0 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.message-markdown table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.message-markdown th,
.message-markdown td {
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.message-markdown th:last-child,
.message-markdown td:last-child {
  border-right: 0;
}

.message-markdown tbody tr:last-child td {
  border-bottom: 0;
}

.message-markdown th {
  color: var(--text);
  background: var(--surface-soft);
  font-weight: 650;
}

.message-markdown li > input[type='checkbox'] {
  margin: 0 7px 0 0;
  accent-color: var(--text);
}

.message-math {
  max-width: 100%;
  color: var(--text);
}

.message-math.is-inline {
  display: inline-block;
  padding: 0 2px;
  vertical-align: -0.12em;
}

.message-math.is-display {
  display: block;
  margin: 12px 0 0;
  padding: 10px 12px;
  overflow-x: auto;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
  border-radius: 8px;
  text-align: center;
}

.message-math.is-invalid {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  text-align: left;
  white-space: pre-wrap;
}

.message-raw-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  white-space: pre-wrap;
}

.message-markdown a {
  color: var(--text);
  font-weight: 550;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.message-markdown hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.message-markdown.is-streaming::after {
  display: inline-block;
  width: 5px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -2px;
  background: currentColor;
  border-radius: 2px;
  content: '';
  animation: markdown-caret 0.9s steps(1, end) infinite;
}

@keyframes markdown-caret {
  50% {
    opacity: 0;
  }
}

.chat-source-list {
  display: grid;
  gap: 10px;
  width: min(100%, 560px);
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.chat-source-list > strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
}

.chat-source-items {
  display: grid;
  gap: 8px;
}

.chat-source-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-soft);
  text-decoration: none;
}

.chat-source-item span {
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
}

.chat-source-item small {
  flex: none;
  color: var(--muted);
  font-size: 10px;
}

.chat-source-item:hover span,
.chat-source-item:focus-visible span {
  color: var(--text);
  text-decoration: underline;
}

.chat-search-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.chat-generation-preview {
  display: grid;
  width: min(100%, 540px);
  gap: 12px;
  margin-top: 14px;
}

.chat-generation-title {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 520;
  line-height: 1.5;
}

.chat-generation-canvas {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 42% 46%, color-mix(in srgb, var(--surface-strong) 48%, transparent) 0, transparent 48%),
    var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.chat-generation-pixel-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.chat-generation-directions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.chat-generation-directions li {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 10px;
}

.chat-generation-directions b {
  color: var(--text);
  font-weight: 620;
}

.chat-generation-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
}

.chat-generation-meta > .icon {
  width: 17px;
  height: 17px;
  color: var(--text);
  animation: chat-generation-spark 2.4s ease-in-out infinite;
}

.chat-generation-meta > span {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 2px;
  gap: 10px;
}

.chat-generation-meta strong {
  font-size: 11px;
  font-weight: 620;
}

.chat-generation-meta small {
  color: var(--muted);
  font-size: 10px;
}

@keyframes chat-generation-spark {
  0%, 100% { opacity: .45; transform: scale(.92) rotate(-8deg); }
  50% { opacity: 1; transform: scale(1.05) rotate(8deg); }
}

.chat-message-error {
  color: var(--danger, #b42318) !important;
}

.chat-reference-image {
  display: inline-grid;
  max-width: 180px;
  gap: 5px;
  margin-top: 10px;
}

.chat-reference-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.chat-reference-image small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: none;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 8px;
}

.assistant-avatar .icon {
  width: 16px;
  height: 16px;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-content {
  max-width: 720px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.user-text-file {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  width: min(320px, 100%);
  min-height: 58px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
}

.user-text-file:hover {
  border-color: var(--line-strong);
}

.user-text-file > i {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--surface-soft);
  border-radius: 7px;
}

.user-text-file > i .icon,
.user-text-file > .icon {
  width: 16px;
  height: 16px;
}

.user-text-file > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

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

.user-text-file strong {
  font-size: 12px;
}

.user-text-file small {
  color: var(--muted);
  font-size: 10px;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.message-actions button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 6px;
}

.typing-dots i {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  animation: typing 800ms infinite alternate;
}

.typing-dots i:nth-child(2) { animation-delay: 120ms; }
.typing-dots i:nth-child(3) { animation-delay: 240ms; }

@keyframes typing {
  to { opacity: .3; }
}

.chat-design-result {
  position: relative;
  display: block;
  width: min(100%, 540px);
  overflow: hidden;
  margin-top: 16px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 28px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .1);
  text-align: left;
  transition: box-shadow 180ms ease, transform 180ms ease;
  animation: chat-result-reveal 380ms ease-out both;
}

.chat-design-results {
  display: grid;
  width: 100%;
  max-width: 900px;
  align-items: start;
  gap: 12px;
  margin-top: 16px;
}

.chat-design-results-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chat-design-results-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chat-design-results .chat-design-result {
  width: 100%;
  margin-top: 0;
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .09);
}

.chat-design-results .chat-result-refine,
.chat-design-results .chat-result-zoom {
  min-height: 36px;
  padding-inline: 11px;
}

.chat-design-results .chat-result-refine {
  bottom: 8px;
  left: 8px;
}

.chat-design-results .chat-result-zoom {
  right: 8px;
  bottom: 8px;
}

.chat-design-result-single {
  width: fit-content;
  max-width: min(100%, 540px);
}

.chat-design-result-single .chat-result-image {
  width: fit-content;
  max-width: 100%;
}

.chat-design-result-single .chat-result-image img {
  width: auto;
  max-width: 100%;
  max-height: min(58dvh, 640px);
}

.transparent-preview-image {
  background-color: #fff !important;
  background-image: none !important;
  background-position: 0 0;
  background-size: 24px 24px;
  transition: background-color 140ms ease, background-image 140ms ease;
}

.transparent-preview-image:hover,
.chat-result-image:hover .transparent-preview-image,
.chat-result-image:focus-visible .transparent-preview-image,
#mask-canvas:hover .transparent-preview-image,
#mask-canvas:focus-within .transparent-preview-image,
.image-workbench-stage:hover .transparent-preview-image,
.image-workbench-stage:focus-within .transparent-preview-image,
.version-node:hover .transparent-preview-image,
.version-node:focus-visible .transparent-preview-image,
.image-workbench-thumbnail:hover .transparent-preview-image,
.image-workbench-thumbnail:focus-visible .transparent-preview-image {
  background-color: #fff !important;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%) !important;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.image-workbench-stage .transparent-preview-image {
  background-color: #fff !important;
  background-image:
    linear-gradient(45deg, #ececec 25%, transparent 25%),
    linear-gradient(-45deg, #ececec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ececec 75%),
    linear-gradient(-45deg, transparent 75%, #ececec 75%) !important;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px !important;
}

.version-thumb .transparent-preview-image,
.image-workbench-thumbnail .transparent-preview-image {
  background-size: 12px 12px;
}

.version-node:hover .transparent-preview-image,
.version-node:focus-visible .transparent-preview-image,
.image-workbench-thumbnail:hover .transparent-preview-image,
.image-workbench-thumbnail:focus-visible .transparent-preview-image {
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

@keyframes chat-result-reveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-design-result:hover,
.chat-design-result:focus-within {
  box-shadow: 0 18px 44px rgba(0, 0, 0, .14);
}

.chat-result-caption {
  margin: 0 0 6px;
  padding: 0 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 620;
  letter-spacing: .02em;
}

.chat-result-image {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  background: var(--surface-soft);
  border: 0;
  border-radius: inherit;
  cursor: zoom-in;
}

.chat-result-image img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 180ms ease;
}

.chat-result-image:hover img {
  transform: scale(1.008);
}

.chat-result-zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  z-index: 2;
  min-height: 40px;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  color: #fff;
  background: rgba(17, 17, 17, .72);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .18);
  font-size: 12px;
  opacity: .92;
  transition: opacity 160ms ease, transform 160ms ease;
}

.chat-result-image:hover .chat-result-zoom,
.chat-result-image:focus-visible .chat-result-zoom {
  opacity: 1;
}

.chat-result-zoom .icon {
  width: 14px;
  height: 14px;
}

.chat-result-refine {
  position: absolute;
  z-index: 3;
  bottom: 12px;
  left: 12px;
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  color: #fff;
  background: rgba(17, 17, 17, .72);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .18);
  font-size: 12px;
  font-weight: 650;
  transition: background 160ms ease, transform 160ms ease;
}

.chat-result-refine:hover {
  background: rgba(17, 17, 17, .88);
  transform: translateY(-1px);
}

.chat-result-refine .icon {
  width: 14px;
  height: 14px;
}

.result-empty {
  max-width: 620px;
  margin: 80px auto;
  color: var(--muted);
  text-align: center;
}

.result-empty strong {
  color: var(--text);
}

.result-empty p {
  margin: 6px 0 0;
}

.discussion-workspace.conversation-active .discussion-start {
  position: sticky;
  z-index: 10;
  bottom: 0;
  width: 100%;
  max-width: none;
  flex: none;
  padding: 14px clamp(104px, 8vw, 132px) 16px clamp(24px, 5vw, 80px);
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.discussion-workspace.conversation-active .discussion-start > h1,
.discussion-workspace.conversation-active .discussion-start > p,
.discussion-workspace.conversation-active .prompt-keywords {
  display: none;
}

.discussion-workspace.conversation-active .composer-wrap {
  max-width: 980px;
  margin-top: 0;
}

.discussion-workspace.conversation-active .composer {
  min-height: 64px;
}

.discussion-workspace.conversation-active .composer textarea {
  min-height: 26px;
}

.discussion-workspace.conversation-active .composer-model-menu {
  top: auto;
  bottom: calc(100% + 10px);
}

/* Design library */
.design-library-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.design-library-nav {
  min-width: 0;
  overflow-y: auto;
  padding: 34px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.design-library-nav > h1 {
  margin: 0 16px 22px;
  font-size: 18px;
  font-weight: var(--weight-bold);
  letter-spacing: -.025em;
  line-height: var(--leading-tight);
}

.design-library-nav-list {
  display: grid;
  gap: 10px;
}

.design-library-nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 76px;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.design-library-nav-item::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -1px;
  width: 3px;
  background: transparent;
  border-radius: 0 3px 3px 0;
}

.design-library-nav-item:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.design-library-nav-item.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.design-library-nav-item.active::before {
  background: var(--text);
}

.design-library-nav-item .icon {
  width: 22px;
  height: 22px;
}

.design-library-nav-item > span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.design-library-nav-item strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-library-nav-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-library-nav-item em {
  color: var(--text);
  font-size: 14px;
  font-style: normal;
  font-weight: var(--weight-medium);
}

.design-library-panel[hidden] {
  display: none;
}

.history-library-page {
  height: 100%;
  overflow-y: auto;
  padding: 34px clamp(24px, 2.6vw, 42px) 56px;
  scrollbar-width: thin;
}

.tool-page-header {
  display: flex;
  width: 100%;
  max-width: 1600px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
}

.tool-page-header > div:first-child > span {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.tool-page-header > div:first-child > span strong {
  color: var(--text);
}

.tool-page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: var(--weight-bold);
  letter-spacing: -.03em;
}

.tool-page-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.history-header-actions > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.history-header-actions strong {
  color: var(--text);
}

.new-task-secondary {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
}

.new-task-secondary:hover {
  background: var(--accent-hover);
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  width: 100%;
  max-width: 1600px;
  align-items: center;
  gap: 16px;
  margin: 26px auto 0;
}

.history-search {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-search:focus-within {
  border-color: var(--text);
}

.history-search .icon {
  color: var(--muted);
}

.history-search input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.history-filters {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-filter {
  min-width: 76px;
  height: 40px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--surface);
  border-right: 1px solid var(--line);
  font-size: 12px;
}

.history-filter:last-child {
  border-right: 0;
}

.history-filter:hover,
.history-filter.active {
  color: var(--text);
  background: var(--surface-strong);
}

.history-filter.active {
  box-shadow: inset 0 0 0 1px var(--text);
}

.history-sort {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.history-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  max-width: 1600px;
  gap: 18px;
  margin: 20px auto 0;
}

.history-project-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.history-project-card:hover {
  border-color: var(--line-strong);
}

.history-project-summary {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.history-project-summary > div {
  min-width: 0;
}

.history-project-summary h2 {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-project-summary p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.history-status {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  flex: none;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 10px;
}

.history-status i {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.history-status.final {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.history-draft-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.history-draft-card {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.history-result-draft {
  border-color: var(--line-strong);
}

.history-draft-card > figcaption,
.history-draft-caption {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
}

.history-draft-card > figcaption span,
.history-draft-caption > span {
  font-weight: 650;
}

.history-draft-card small {
  color: var(--muted);
}

.history-draft-visual {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-strong);
  border-top: 1px solid var(--line);
}

.history-draft-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms var(--ease);
}

.history-result-draft:hover,
.history-result-draft:focus-visible {
  border-color: var(--text);
}

.history-result-draft:hover img,
.history-result-draft:focus-visible img {
  transform: scale(1.015);
}

.history-open-hint {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 10px;
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 180ms var(--ease);
}

.history-result-draft:hover .history-open-hint,
.history-result-draft:focus-visible .history-open-hint {
  opacity: 1;
}

.history-open-hint .icon {
  width: 14px;
  height: 14px;
}

.history-project-details {
  display: grid;
  grid-template-columns: max-content max-content minmax(max-content, 1fr);
  min-width: 0;
  align-items: flex-end;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.history-project-details > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-project-details span,
.history-project-details time {
  font-size: 11px;
}

.history-project-details span {
  color: var(--muted);
}

.history-project-details time {
  color: var(--text-soft);
  font-weight: 550;
}

.history-version-count {
  grid-column: 3;
  justify-self: end;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .history-project-details {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 10px;
  }

  .history-completion-time {
    grid-column: 1;
  }

  .history-version-count {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
  }
}

.history-empty {
  max-width: 720px;
  margin: 72px auto;
  padding: 44px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  text-align: center;
}

.history-empty strong {
  color: var(--text);
}

.history-empty p {
  margin: 6px 0 0;
}

.asset-toolbar,
.material-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  width: 100%;
  max-width: 1600px;
  align-items: center;
  gap: 16px;
  margin: 26px auto 0;
}

.asset-toolbar > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.brand-asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  max-width: 1600px;
  gap: 18px;
  margin: 20px auto 0;
}

.brand-asset-card {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.brand-asset-card:hover {
  border-color: var(--line-strong);
}

.brand-asset-cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.brand-asset-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-asset-content {
  padding: 18px;
}

.brand-asset-content header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-asset-content header > div {
  min-width: 0;
}

.brand-asset-content header span,
.brand-asset-content header small,
.brand-asset-content p {
  color: var(--muted);
  font-size: 11px;
}

.brand-asset-content h2 {
  margin: 3px 0 0;
  font-size: 17px;
  font-weight: var(--weight-semibold);
  letter-spacing: -.015em;
}

.brand-asset-content p {
  margin: 10px 0 0;
}

.brand-asset-content ul {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.brand-asset-content li {
  padding: 5px 8px;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 10px;
}

.brand-asset-content button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding: 0 11px;
  color: var(--text);
  background: transparent;
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

.brand-asset-content button .icon {
  width: 14px;
  height: 14px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  max-width: 1600px;
  gap: 18px;
  margin: 20px auto 0;
}

.material-card {
  min-width: 0;
  overflow: hidden;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
}

.material-card:hover,
.material-card:focus-visible {
  border-color: var(--text);
}

.material-preview {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.material-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms var(--ease);
}

.material-preview.alternate img {
  object-position: 70% center;
}

.material-preview.detail img {
  object-position: 30% center;
}

.material-card:hover img,
.material-card:focus-visible img {
  transform: scale(1.015);
}

.material-card-copy {
  display: grid;
  padding: 14px 16px 16px;
}

.material-card-copy strong {
  font-size: 13px;
  font-weight: var(--weight-semibold);
}

.material-card-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.material-card-copy em {
  margin-top: 13px;
  padding-top: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10px;
  font-style: normal;
}

/* Dialog and notifications */
.mobile-sidebar-backdrop {
  display: none;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--backdrop);
}

.modal-backdrop.open,
.modal-backdrop.closing {
  display: flex;
}

.modal-backdrop.open {
  animation: modal-backdrop-enter var(--motion-control) var(--ease) both;
}

.modal-backdrop.open .dialog {
  animation: modal-dialog-enter var(--motion-panel) var(--ease-enter) both;
}

.modal-backdrop.closing {
  pointer-events: none;
  animation: modal-backdrop-exit var(--motion-exit) var(--ease-exit) both;
}

.modal-backdrop.closing .dialog {
  animation: modal-dialog-exit var(--motion-exit) var(--ease-exit) both;
}

@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-backdrop-exit {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modal-dialog-enter {
  from { opacity: 0; transform: translate3d(0, 8px, 0) scale(.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes modal-dialog-exit {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: 0; transform: translate3d(0, 5px, 0) scale(.99); }
}

.dialog {
  width: min(920px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
}

.dialog > header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog > header > div {
  display: grid;
  gap: 2px;
}

.dialog > header strong {
  font-size: 16px;
}

.dialog > header span {
  color: var(--muted);
  font-size: 11px;
}

.dialog > header > button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 7px;
}

.dialog > header > button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.composer-asset-picker-dialog {
  display: grid;
  width: min(820px, 100%);
  max-height: min(720px, calc(100dvh - 48px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.composer-asset-picker-body {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(180px, 1fr);
  gap: 16px;
  padding: 18px;
}

.composer-asset-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.composer-asset-picker-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.composer-asset-picker-tabs button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

.composer-asset-picker-tabs button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px rgb(0 0 0 / 7%);
}

.composer-asset-picker-tabs span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.composer-asset-picker-search {
  display: flex;
  width: min(280px, 42%);
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.composer-asset-picker-search:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.composer-asset-picker-search .icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--muted);
}

.composer-asset-picker-search input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11px;
}

.composer-asset-picker-grid {
  display: grid;
  min-height: 0;
  align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding: 1px 3px 3px 1px;
}

.composer-asset-picker-grid[hidden] {
  display: none;
}

.composer-asset-picker-card {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 7px;
  padding: 6px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
}

.composer-asset-picker-card:hover,
.composer-asset-picker-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px rgb(0 0 0 / 7%);
}

.composer-asset-picker-card[aria-selected="true"] {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.composer-asset-picker-card:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.composer-asset-picker-card > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-soft);
  border-radius: 6px;
}

.composer-asset-picker-card[data-asset-kind="brand"] > img {
  object-fit: contain;
  padding: 10px;
}

.composer-asset-picker-card > span:not(.composer-asset-picker-check) {
  display: grid;
  min-width: 0;
  gap: 1px;
  padding: 0 2px 2px;
}

.composer-asset-picker-card strong,
.composer-asset-picker-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-asset-picker-card strong {
  font-size: 11px;
  font-weight: var(--weight-semibold);
}

.composer-asset-picker-card small {
  color: var(--muted);
  font-size: 9px;
}

.composer-asset-picker-check {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--accent-ink);
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.composer-asset-picker-check .icon {
  width: 13px;
  height: 13px;
}

.composer-asset-picker-card[aria-selected="true"] .composer-asset-picker-check {
  display: grid;
}

.composer-asset-picker-empty {
  display: grid;
  min-height: 220px;
  place-content: center;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.composer-asset-picker-empty[hidden] {
  display: none;
}

.composer-asset-picker-empty .icon {
  width: 28px;
  height: 28px;
}

.composer-asset-picker-empty strong {
  color: var(--text);
  font-size: 13px;
}

.composer-asset-picker-empty span {
  max-width: 280px;
  font-size: 10px;
  line-height: 1.5;
}

.composer-asset-picker-footer {
  justify-content: space-between !important;
}

.composer-asset-picker-footer > span {
  color: var(--muted);
  font-size: 10px;
}

.composer-asset-picker-footer > div {
  display: flex;
  gap: 8px;
}

.composer-asset-picker-footer button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

@media (max-width: 760px) {
  .composer-source-menu {
    left: -7px;
  }

  .composer-asset-picker-dialog {
    width: 100%;
    max-height: calc(100dvh - 28px);
  }

  .composer-asset-picker-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-asset-picker-tabs,
  .composer-asset-picker-search {
    width: 100%;
  }

  .composer-asset-picker-tabs button {
    flex: 1;
  }

  .composer-asset-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .composer-asset-picker-footer {
    align-items: stretch !important;
    flex-direction: column;
  }

  .composer-asset-picker-footer > div,
  .composer-asset-picker-footer button {
    flex: 1;
  }
}

.conversation-dialog {
  width: min(460px, 100%);
}

.conversation-rename-body {
  display: grid;
  gap: 8px;
  padding: 22px 20px 24px;
}

.conversation-rename-body label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: var(--weight-semibold);
}

.conversation-rename-body input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  font-size: 13px;
}

.conversation-rename-body input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.conversation-confirmation {
  display: flex;
  min-height: 132px;
  align-items: center;
  gap: 14px;
  padding: 24px 20px;
}

.conversation-confirmation > .icon {
  width: 24px;
  height: 24px;
  flex: none;
}

.conversation-confirmation p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}

.conversation-confirmation strong {
  color: var(--text);
}

.archived-conversation-list {
  display: grid;
  max-height: min(480px, 62dvh);
  gap: 6px;
  overflow-y: auto;
  padding: 12px;
}

.archived-conversation-empty {
  display: grid;
  min-height: 230px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}

.archived-conversation-empty .icon {
  width: 28px;
  height: 28px;
  margin-bottom: 5px;
}

.archived-conversation-empty strong {
  color: var(--text);
  font-size: 13px;
}

.archived-conversation-empty p {
  margin: 0;
  font-size: 11px;
}

.archived-conversation-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.archived-conversation-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.archived-conversation-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archived-conversation-copy small {
  color: var(--muted);
  font-size: 10px;
}

.restore-conversation-button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11px;
}

.task-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, .88fr);
  min-height: 440px;
}

.source-upload {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 36px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
  text-align: center;
}

.source-upload-previewable {
  position: relative;
}

.upload-illustration {
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.upload-illustration .icon {
  width: 32px;
  height: 32px;
}

#task-source-preview {
  width: min(100%, 260px);
  max-height: 220px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

.source-upload > strong {
  margin-top: 18px;
  font-size: 16px;
}

.source-upload > p {
  max-width: 310px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.source-upload > button {
  min-height: 42px;
  margin-top: 18px;
  padding: 0 16px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
}

.source-upload > small {
  margin-top: 8px;
  color: var(--faint);
  font-size: 10px;
}

.task-fields {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 24px;
}

.task-fields label,
.supporting-assets {
  display: grid;
  gap: 7px;
}

.task-fields label > span,
.supporting-assets > span {
  font-size: 12px;
  font-weight: 620;
}

.task-fields label i,
.supporting-assets i {
  color: var(--faint);
  font-size: 10px;
  font-style: normal;
  font-weight: 450;
}

.task-fields input,
.task-fields textarea,
.task-fields select {
  width: 100%;
  padding: 10px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  font-size: 13px;
}

.task-fields textarea {
  min-height: 104px;
  resize: vertical;
}

.task-fields input:focus,
.task-fields textarea:focus,
.task-fields select:focus {
  border-color: var(--text);
}

.task-form-note,
.task-form-error {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.task-form-note {
  color: var(--muted);
}

.task-form-error {
  padding: 10px 12px;
  color: #8f2d2d;
  background: rgba(217, 83, 79, .12);
  border: 1px solid rgba(217, 83, 79, .2);
  border-radius: 8px;
}

.supporting-assets button {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  justify-content: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 11px;
}

.dialog > footer {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.dialog > footer button {
  min-height: 42px;
  padding: 0 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.dialog > footer button:last-child {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 650;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 20px;
  bottom: 20px;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast strong {
  font-size: 12px;
}

@media (max-width: 1320px) {
  .history-project-grid {
    grid-template-columns: 1fr;
  }

  .brand-asset-grid,
  .material-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  :root {
    --topbar-height: 112px;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100dvh;
    padding-top: var(--topbar-height);
  }

  .main-shell {
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 56px 56px;
    height: var(--topbar-height);
    padding: 0 16px;
  }

  .topbar-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .module-switch {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    align-self: stretch;
    justify-content: stretch;
    gap: 0;
  }

  .module-button {
    flex: 1;
    text-align: center;
  }

  .mobile-sidebar-toggle {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    flex: none;
    padding: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .sidebar {
    position: fixed;
    z-index: 80;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100dvh;
    padding: 80px 16px 18px;
    border-right: 1px solid var(--line);
    opacity: 1;
    pointer-events: auto;
    box-shadow: 18px 0 56px rgba(0, 0, 0, .18);
    transform: translateX(-105%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-sidebar-backdrop:not([hidden]) {
    position: fixed;
    z-index: 70;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    background: var(--backdrop);
  }

  .sidebar-resizer {
    display: none;
  }

  .module-panel {
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
  }

  .discussion-workspace {
    min-height: calc(100dvh - var(--topbar-height));
    overflow: visible;
  }

  .message-stream {
    overflow: visible;
  }

  .tool-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .history-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .history-search {
    grid-column: 1 / -1;
  }

  .design-library-shell {
    grid-template-columns: 210px minmax(0, 1fr);
    min-height: calc(100dvh - var(--topbar-height));
  }

  .design-library-nav {
    padding-inline: 12px;
  }

  .design-library-nav > h1 {
    margin-inline: 11px;
  }

  .design-library-nav-item {
    padding-inline: 11px;
  }

  .asset-toolbar,
  .material-toolbar {
    grid-template-columns: 1fr;
  }

  .asset-toolbar > span {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  body.profile-sheet-open {
    overflow: hidden;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar-brand {
    gap: 9px;
  }

  .credits-button,
  .top-actions > .theme-switch {
    display: none;
  }

  .mobile-new-conversation,
  .top-avatar {
    display: grid;
  }

  .profile-menu-shell {
    display: block;
  }

  .top-actions {
    gap: 8px;
  }

  .profile-popover-backdrop:not([hidden]) {
    position: fixed;
    z-index: 108;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    background: var(--backdrop);
  }

  .profile-popover {
    position: fixed;
    z-index: 110;
    inset: auto 0 0;
    width: 100%;
    max-height: min(78dvh, 720px);
    overscroll-behavior: contain;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    opacity: 0;
    transform: translateY(20px);
  }

  .profile-popover.open {
    opacity: 1;
    transform: translateY(0);
    animation: profile-sheet-in 180ms var(--ease);
  }

  .profile-popover form {
    padding: 10px 18px max(16px, env(safe-area-inset-bottom));
  }

  .profile-sheet-handle {
    display: block;
    width: 42px;
    height: 4px;
    justify-self: center;
    margin: 0 0 18px;
    background: var(--line-strong);
    border-radius: 999px;
  }

  .profile-identity {
    gap: 14px;
    padding: 16px 0 18px;
  }

  .profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 22px;
  }

  .profile-fields {
    gap: 8px;
    padding: 14px 0;
  }

  .profile-edit-row,
  .profile-info-row,
  .profile-role-row {
    grid-template-columns: 82px minmax(0, 1fr) 40px;
    min-height: 44px;
    gap: 8px;
  }

  .profile-edit-row > button {
    width: 40px;
    height: 40px;
  }

  .profile-role-row small {
    display: none;
  }

  .profile-usage {
    min-height: 48px;
  }

  .profile-theme-row {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
  }

  .profile-theme-row > div {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 9px;
  }

  .profile-theme-row button {
    min-width: 58px;
    min-height: 38px;
    padding: 0 12px;
    color: var(--muted);
    background: transparent;
    border-radius: 6px;
  }

  .profile-theme-row button[aria-pressed="true"] {
    color: var(--text);
    background: var(--surface);
  }

  .profile-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin: 0 -18px;
    padding: 12px 18px max(12px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

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

  .module-button {
    font-size: 13px;
  }

  .discussion-start {
    padding: 52px 16px 40px;
  }

  .discussion-start > h1 {
    font-size: clamp(32px, 9vw, 40px);
    letter-spacing: -.055em;
  }

  .discussion-start > p {
    margin-top: 14px;
    font-size: 14px;
  }

  .composer-wrap {
    margin-top: 26px;
  }

  .composer {
    grid-template-columns: 40px minmax(48px, 1fr) auto minmax(0, auto) 40px;
    min-height: 60px;
    gap: 6px;
    padding: 8px 10px;
  }

  .composer textarea {
    min-height: 26px;
    font-size: 16px;
  }

  .composer-model-trigger {
    max-width: 108px;
    height: 40px;
    gap: 6px;
    padding: 0 10px;
  }

  .composer-model-trigger > .icon:first-child {
    display: none;
  }

  .composer-reasoning-trigger {
    height: 40px;
    gap: 5px;
    padding: 0 9px;
  }

  .composer-reasoning-trigger > .icon:first-child {
    display: none;
  }

  .composer-reasoning-menu {
    right: -116px;
  }

  .composer-model-menu {
    right: -46px;
  }

  .composer-footer small {
    display: none;
  }

  .prompt-keywords {
    gap: 8px;
    margin-top: 18px;
    padding: 0 8px;
  }

  .prompt-keywords > span {
    width: 100%;
    margin: 0 0 2px;
    text-align: center;
  }

  .message-stream {
    padding: 24px 14px 32px;
  }

  .discussion-workspace.conversation-active .message-stream {
    padding-right: 14px;
  }

  .conversation-version-rail {
    display: none;
  }

  .message {
    gap: 9px;
    margin-bottom: 24px;
  }

  .assistant-avatar {
    width: 30px;
    height: 30px;
  }

  .user-message .message-content {
    max-width: 100%;
    padding: 12px;
  }

  .chat-design-result {
    border-radius: 20px;
  }

  .chat-design-results {
    max-width: none;
    grid-template-columns: none;
    grid-auto-columns: minmax(220px, 72vw);
    grid-auto-flow: column;
    overflow-x: auto;
    padding: 0 2px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .chat-design-results .chat-design-result {
    scroll-snap-align: start;
  }

  .chat-result-refine {
    bottom: 8px;
    left: 8px;
    min-height: 38px;
    padding-inline: 13px;
  }

  .chat-result-zoom {
    right: 8px;
    bottom: 8px;
    min-height: 38px;
    padding-inline: 12px;
  }

  .discussion-workspace.conversation-active .discussion-start {
    padding: 10px 14px 12px;
  }

  .discussion-workspace.conversation-active .composer {
    min-height: 60px;
  }

  .discussion-workspace.conversation-active .composer textarea {
    min-height: 26px;
  }

  .history-library-page {
    padding: 24px 14px 40px;
  }

  .design-library-shell {
    display: block;
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
  }

  .design-library-nav {
    overflow: visible;
    padding: 18px 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .design-library-nav > h1 {
    margin: 0 0 14px;
    font-size: 20px;
  }

  .design-library-nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .design-library-nav-item {
    grid-template-columns: 20px minmax(0, 1fr);
    min-height: 58px;
    gap: 8px;
    padding: 9px 10px;
  }

  .design-library-nav-item::before {
    top: auto;
    right: 8px;
    bottom: -1px;
    left: 8px;
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
  }

  .design-library-nav-item .icon {
    width: 18px;
    height: 18px;
  }

  .design-library-nav-item small,
  .design-library-nav-item em {
    display: none;
  }

  .tool-page-header h1 {
    font-size: 28px;
  }

  .history-header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .new-task-secondary {
    justify-content: center;
  }

  .history-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
  }

  .history-search,
  .history-filters,
  .history-sort {
    grid-column: 1;
    width: 100%;
  }

  .history-filter {
    min-width: 0;
    flex: 1;
  }

  .history-sort {
    justify-content: space-between;
  }

  .history-project-grid {
    gap: 14px;
    margin-top: 14px;
  }

  .asset-toolbar,
  .material-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
  }

  .brand-asset-grid,
  .material-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
  }

  .history-project-card {
    gap: 12px;
    padding: 14px;
  }

  .history-open-hint {
    opacity: 1;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .dialog {
    max-height: calc(100dvh - 24px);
  }

  .task-dialog-body {
    grid-template-columns: 1fr;
  }

  .source-upload {
    min-height: 310px;
    padding: 28px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-fields {
    padding: 18px;
  }

  .dialog > footer {
    flex-wrap: wrap;
  }

  .dialog > footer button {
    min-width: 128px;
    flex: 1;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}

@media (max-width: 420px) {
  .topbar {
    padding-inline: 9px;
  }

  .mobile-sidebar-toggle {
    width: 40px;
    height: 40px;
  }

  .theme-switch button {
    width: 40px;
    height: 40px;
  }

  .module-button {
    font-size: 12px;
  }

  .discussion-start {
    padding-inline: 10px;
  }

  .history-project-summary {
    gap: 10px;
  }

  .design-library-nav-item {
    padding-inline: 8px;
  }

  .design-library-nav-item strong {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Unified typography system — source of truth for the prototype. */
body {
  font-size: var(--type-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
}

.credits-button small,
.conversation-item small {
  font-size: var(--type-caption);
  line-height: var(--leading-meta);
}

.module-button,
.new-chat,
.credits-button strong,
.conversation-item strong,
.support-button strong {
  font-size: var(--type-control);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-meta);
}

.nav-heading {
  font-size: var(--type-meta);
  line-height: var(--leading-meta);
}

.discussion-start > h1 {
  font-size: var(--type-display);
  font-weight: var(--weight-bold);
  letter-spacing: -.035em;
  line-height: var(--leading-tight);
}

.discussion-start > p,
.composer textarea,
.message p {
  font-size: var(--type-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
}

.prompt-keywords button,
.history-search input,
.history-filter,
.history-sort,
.new-task-secondary,
.task-fields input,
.task-fields textarea,
.task-fields select,
.dialog > footer button {
  font-size: var(--type-control);
  font-weight: var(--weight-medium);
  line-height: var(--leading-meta);
}

.composer-footer small,
.composer-note,
.upload-chip,
.message-meta strong,
.message-meta span,
.message-actions button,
.chat-result-refine {
  font-size: var(--type-caption);
  line-height: var(--leading-meta);
}

.message-meta strong {
  font-weight: var(--weight-semibold);
}

.tool-page-header > div:first-child > span,
.history-header-actions > span {
  font-size: var(--type-meta);
  line-height: var(--leading-meta);
}

.tool-page-header h1 {
  font-size: var(--type-page-title);
  font-weight: var(--weight-bold);
  letter-spacing: -.025em;
  line-height: var(--leading-tight);
}

.tool-page-header p {
  font-size: var(--type-body);
  line-height: var(--leading-body);
}

.history-status,
.history-open-hint,
.history-draft-card small,
.history-project-details span,
.history-project-details time {
  font-size: var(--type-caption);
  font-weight: var(--weight-medium);
  line-height: var(--leading-meta);
}

.history-project-summary h2,
.dialog > header strong,
.source-upload > strong {
  font-size: var(--type-card-title);
  font-weight: var(--weight-semibold);
  letter-spacing: -.01em;
  line-height: var(--leading-heading);
}

.history-project-summary p,
.history-draft-card > figcaption,
.history-draft-caption,
.dialog > header span,
.source-upload > p,
.task-fields label > span,
.supporting-assets > span,
.supporting-assets button,
.dialog > footer button,
.toast strong {
  font-size: var(--type-meta);
  line-height: var(--leading-meta);
}

.history-draft-card > figcaption span,
.history-draft-caption > span,
.task-fields label > span,
.supporting-assets > span,
.dialog > footer button:last-child {
  font-weight: var(--weight-semibold);
}

.source-upload > small,
.task-fields label i,
.supporting-assets i {
  font-size: var(--type-caption);
  line-height: var(--leading-meta);
}

@media (max-width: 760px) {
  :root {
    --type-display: 32px;
    --type-page-title: 26px;
    --type-section-title: 19px;
  }

  .brand-wordmark {
    max-width: min(228px, calc(100vw - 112px));
  }

  .brand-wordmark-name {
    font-size: 18px;
  }

  .brand-wordmark-descriptor {
    margin-left: 9px;
    padding-left: 9px;
    font-size: 10px;
    letter-spacing: .04em;
  }

  .module-button {
    font-size: var(--type-control);
  }

  .discussion-start > h1 {
    font-size: var(--type-display);
    letter-spacing: -.04em;
  }

  .discussion-start > p {
    font-size: var(--type-body);
  }

  .composer textarea,
  .task-fields input,
  .task-fields textarea,
  .task-fields select {
    font-size: 16px;
  }

  .tool-page-header h1,
  .history-project-summary h2 {
    font-size: var(--type-page-title);
  }

  .history-project-summary h2 {
    font-size: var(--type-card-title);
  }
}

@media (max-width: 420px) {
  .brand-wordmark-descriptor {
    max-width: 102px;
  }

  .module-button {
    font-size: var(--type-meta);
  }
}

/* My design — matched to the supplied Designer Workbench library module. */
#history-module {
  overflow: hidden;
}

.design-library-shell {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.design-library-nav {
  width: 220px;
  height: 100%;
  flex: none;
  overflow-y: auto;
  padding: 28px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.design-library-nav-list {
  position: relative;
  display: grid;
  gap: 6px;
}

.design-library-nav-item {
  position: relative;
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  text-align: left;
  transition: color var(--motion-control) var(--ease), background-color var(--motion-control) var(--ease), border-color var(--motion-control) var(--ease), transform var(--motion-fast) var(--ease);
}

.design-library-nav-item:active {
  transform: scale(.985);
}

.design-library-nav-item::before {
  content: "";
  position: absolute;
  top: -1px;
  bottom: auto;
  left: -15px;
  width: 3px;
  height: 52px;
  background: transparent;
  border-radius: 0 3px 3px 0;
  transition: background 180ms var(--ease);
}

.design-library-nav-item:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.design-library-nav-item.active {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line);
}

.design-library-nav-item.active::before {
  background: var(--text);
}

.design-library-nav-item .icon {
  width: 19px;
  height: 19px;
  flex: none;
}

.design-library-nav-item > span {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.design-library-nav-item strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-library-nav-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.design-library-nav-item em {
  color: var(--text-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 400;
}

.history-library-page {
  height: 100%;
  min-width: 0;
  flex: 1;
  overflow-y: auto;
  padding: 28px clamp(24px, 4vw, 64px) 40px;
}

.design-library-panel[hidden],
.project-grid-view[hidden],
.project-list-view[hidden] {
  display: none;
}

.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.library-search {
  display: flex;
  width: clamp(200px, 26vw, 320px);
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  transition: border-color 150ms var(--ease);
}

.library-search:focus-within {
  border-color: var(--line-strong);
}

.library-search .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.library-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.library-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.library-segmented,
.library-view-toggle {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.library-segmented button {
  min-width: 64px;
  height: 40px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.library-segmented button:last-child,
.library-view-toggle button:last-child {
  border-right: 0;
}

.library-segmented button:hover,
.library-segmented button.active,
.library-view-toggle button:hover,
.library-view-toggle button.active {
  color: var(--text);
  background: var(--surface-soft);
}

.library-view-toggle button {
  display: grid;
  width: 44px;
  height: 40px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-right: 1px solid var(--line);
}

.library-view-toggle .icon {
  width: 16px;
  height: 16px;
}

.project-list-view {
  display: grid;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.project-list-header,
.project-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 96px 110px;
  align-items: center;
  gap: 16px;
}

.project-list-header {
  padding: 11px 16px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 650;
}

.project-list-header span:last-child {
  text-align: right;
}

.project-list-row {
  width: 100%;
  padding: 12px 16px;
  color: var(--text-soft);
  background: var(--surface);
  border: 0;
  font-size: 12px;
  text-align: left;
  transition: background 140ms var(--ease);
}

.project-list-row:hover,
.project-list-row:focus-visible {
  background: var(--surface-soft);
}

.project-list-row > span:last-child {
  color: var(--muted);
  text-align: right;
}

.project-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.project-identity > img {
  display: block;
  width: 56px;
  height: 38px;
  flex: none;
  object-fit: cover;
  border-radius: 8px;
}

.project-identity > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

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

.project-identity strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.project-identity small {
  color: var(--muted);
  font-size: 11px;
}

.project-status {
  justify-self: start;
  padding: 4px 9px;
  color: #fff;
  background: rgba(20, 20, 20, .55);
  border-radius: 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.project-status.final {
  color: var(--accent-ink);
  background: var(--accent);
}

.project-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.project-grid-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}

.project-grid-card:hover,
.project-grid-card:focus-visible {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-popover);
  transform: translateY(-2px);
}

.project-grid-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-soft);
}

.project-grid-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-grid-image .project-status {
  position: absolute;
  top: 12px;
  left: 12px;
  backdrop-filter: blur(4px);
}

.project-grid-copy {
  display: block;
  padding: 14px 16px 16px;
}

.project-grid-copy > strong,
.project-grid-copy > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-grid-copy > strong {
  font-size: 15px;
  font-weight: 650;
}

.project-grid-copy > small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.project-grid-copy > span {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.project-grid-copy i {
  font-style: normal;
}

.library-primary-action {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 11px;
  font-size: 13px;
  font-weight: 650;
}

.library-primary-action:hover {
  background: var(--accent-hover);
}

.library-primary-action .icon {
  width: 16px;
  height: 16px;
}

.library-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.library-asset-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
}

.library-asset-card > span {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}

.library-asset-card:hover > span,
.library-asset-card:focus-visible > span {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-popover);
  transform: translateY(-2px);
}

.library-asset-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-asset-card > strong {
  overflow: hidden;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 52px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  text-align: center;
}

.library-empty[hidden] {
  display: none;
}

.library-empty strong {
  font-size: 14px;
  font-weight: 650;
}

.library-empty button {
  padding: 0;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}

.generated-library-toolbar {
  align-items: flex-start;
}

.generated-library-filters {
  gap: 12px;
}

.library-filter-select,
.library-filter-date {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 12px;
}

.library-filter-select {
  min-width: 132px;
}

.library-filter-select:focus,
.library-filter-date:focus-within {
  border-color: var(--line-strong);
  outline: 0;
}

.library-filter-date span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.library-filter-select,
.library-filter-date input {
  font: inherit;
}

.library-filter-date input {
  min-width: 112px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.generated-library-summary {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.generated-image-error,
.generated-image-loading {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 0 16px;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
}

.generated-image-error button {
  height: 36px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.generated-image-error[hidden],
.generated-image-loading[hidden] {
  display: none;
}

.generated-image-groups {
  display: grid;
  gap: 28px;
  margin-top: 18px;
}

.generated-image-group {
  display: grid;
  gap: 14px;
}

.generated-image-group > h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.generated-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.generated-image-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
}

.generated-image-card:hover .generated-image-thumb,
.generated-image-card:focus-visible .generated-image-thumb {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-popover);
  transform: translateY(-2px);
}

.generated-image-thumb {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(20, 20, 20, .035) 25%, transparent 25%, transparent 75%, rgba(20, 20, 20, .035) 75%, rgba(20, 20, 20, .035)),
    linear-gradient(45deg, rgba(20, 20, 20, .035) 25%, transparent 25%, transparent 75%, rgba(20, 20, 20, .035) 75%, rgba(20, 20, 20, .035));
  background-color: var(--surface-soft);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}

.generated-image-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.generated-image-thumb-error {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.generated-image-badge-row {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.generated-image-badge,
.generated-image-version-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 650;
}

.generated-image-badge[data-source-type="discussion"] {
  color: #704d00;
  background: rgba(255, 239, 191, .94);
  border-color: rgba(255, 239, 191, .98);
}

.generated-image-badge[data-source-type="workspace"] {
  color: #0d5a7a;
  background: rgba(214, 242, 255, .94);
  border-color: rgba(214, 242, 255, .98);
}

.generated-image-badge[data-source-type="overprint"] {
  color: #0f5132;
  background: rgba(218, 247, 229, .94);
  border-color: rgba(218, 247, 229, .98);
}

.generated-image-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 0 2px;
}

.generated-image-copy strong,
.generated-image-copy small,
.generated-image-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-image-copy strong {
  font-size: 13px;
  font-weight: 650;
}

.generated-image-copy small,
.generated-image-copy span {
  color: var(--muted);
  font-size: 11px;
}

.generated-image-load-more {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.generated-image-load-more[hidden] {
  display: none;
}

.generated-image-load-more button {
  min-width: 132px;
  height: 42px;
  padding: 0 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
}

.library-detail-panel {
  position: fixed;
  z-index: 140;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(420px, 92vw);
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(0, 0, 0, .16);
  animation: library-slide-right 200ms var(--ease) both;
}

.library-detail-panel[hidden] {
  display: none;
}

.library-detail-panel > header {
  display: flex;
  flex: none;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.library-detail-panel > header > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.library-detail-panel > header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.library-detail-panel > header strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-detail-panel > header small {
  color: var(--muted);
  font-size: 12px;
}

.library-detail-panel > header button {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: none;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.library-detail-panel > header .icon {
  width: 15px;
  height: 15px;
}

.library-detail-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.library-detail-preview {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: zoom-in;
}

.library-detail-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.library-detail-preview[data-fit="contain"] {
  min-height: 220px;
  background:
    linear-gradient(45deg, rgba(20, 20, 20, .035) 25%, transparent 25%, transparent 75%, rgba(20, 20, 20, .035) 75%, rgba(20, 20, 20, .035)),
    linear-gradient(45deg, rgba(20, 20, 20, .035) 25%, transparent 25%, transparent 75%, rgba(20, 20, 20, .035) 75%, rgba(20, 20, 20, .035));
  background-color: var(--surface-soft);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.library-detail-preview[data-fit="contain"] img {
  min-height: 220px;
  object-fit: contain;
}

.library-detail-body > p {
  margin: 10px 0 0;
  color: var(--muted-strong);
  font-size: 11px;
  text-align: center;
}

.library-detail-meta {
  display: grid;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.library-detail-meta > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface);
  font-size: 12px;
}

.library-detail-meta span {
  color: var(--muted);
}

.library-detail-meta strong {
  font-weight: 600;
}

.library-detail-panel > footer {
  display: grid;
  flex: none;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.library-detail-panel > footer button {
  min-height: 42px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
}

.library-detail-panel > footer .library-detail-primary {
  min-height: 48px;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

.library-detail-panel > footer button[hidden] {
  display: none;
}

.library-quick-look {
  position: fixed;
  z-index: 175;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 40px;
  overflow: hidden;
  background: rgba(0, 0, 0, .72);
  cursor: zoom-out;
  animation: library-fade-in 140ms ease both;
}

.library-quick-look[hidden] {
  display: none;
}

.library-quick-look img {
  display: block;
  max-width: min(92vw, 1200px);
  max-height: 82%;
  object-fit: contain;
  border-radius: 14px;
  filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .5));
}

.library-quick-look span {
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
}

body.conversation-image-workbench-open {
  overflow: hidden;
}

.conversation-image-workbench {
  position: fixed;
  z-index: 190;
  inset: 0;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  color: var(--text);
  background: var(--bg);
  animation: image-workbench-enter 180ms ease-out both;
}

.conversation-image-workbench[hidden] {
  display: none;
}

@keyframes image-workbench-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.image-workbench-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  min-width: 0;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.image-workbench-back,
.image-workbench-actions a,
.image-workbench-actions button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.image-workbench-back {
  justify-self: start;
}

.image-workbench-back:hover,
.image-workbench-actions a:hover,
.image-workbench-actions button:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line);
}

.image-workbench-back .icon,
.image-workbench-actions .icon {
  width: 16px;
  height: 16px;
}

.image-workbench-heading {
  display: grid;
  min-width: 0;
  gap: 2px;
  text-align: center;
}

.image-workbench-heading strong {
  max-width: min(44vw, 540px);
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-workbench-heading span {
  color: var(--muted);
  font-size: 10px;
}

.image-workbench-actions {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 6px;
}

.image-workbench-actions button {
  color: var(--surface);
  background: var(--text);
  border-color: var(--text);
}

.image-workbench-actions button:hover {
  color: var(--surface);
  background: color-mix(in srgb, var(--text) 88%, var(--surface));
  border-color: transparent;
}

.image-workbench-actions button:disabled {
  opacity: .42;
  pointer-events: none;
}

.image-workbench-download-control {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.image-workbench-actions .image-workbench-download-button {
  min-height: 38px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 11px;
}

.image-workbench-actions .image-workbench-download-button:hover,
.image-workbench-actions .image-workbench-download-button[aria-expanded="true"] {
  color: var(--text);
  background: var(--surface-soft);
  border-color: transparent;
}

.image-workbench-download-menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  width: 310px;
  gap: 4px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
}

.image-workbench-download-menu[hidden] {
  display: none;
}

.image-workbench-actions .image-workbench-download-menu > a,
.image-workbench-actions .image-workbench-download-menu > button,
.workspace-result-actions .image-workbench-download-menu > button {
  display: flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  padding: 9px 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 9px;
  text-align: left;
}

.image-workbench-actions .image-workbench-download-menu > a:hover,
.image-workbench-actions .image-workbench-download-menu > a:focus-visible,
.image-workbench-actions .image-workbench-download-menu > button:hover,
.image-workbench-actions .image-workbench-download-menu > button:focus-visible,
.workspace-result-actions .image-workbench-download-menu > button:hover,
.workspace-result-actions .image-workbench-download-menu > button:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
}

.image-workbench-download-menu > a > span:last-child,
.image-workbench-download-menu > button > span:last-child {
  display: grid;
  gap: 3px;
}

.image-workbench-download-menu strong {
  font-size: 12px;
  font-style: normal;
  font-weight: 680;
}

.image-workbench-download-menu strong i {
  margin-left: 5px;
  padding: 2px 5px;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  border-radius: 999px;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.image-workbench-download-menu small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
}

.image-workbench-download-menu-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: none;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.image-workbench-download-menu-icon.accent {
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.image-workbench-download-menu > button.is-loading {
  cursor: wait;
  opacity: .66;
}

.image-workbench-body {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.image-workbench-rail-shell {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.image-workbench-rail {
  display: flex;
  height: 100%;
  align-items: center;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 18px;
  scrollbar-width: thin;
}

.image-workbench-thumbnail {
  position: relative;
  display: grid;
  width: 94px;
  flex: none;
  gap: 7px;
  padding: 6px;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 15px;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.image-workbench-thumbnail:hover {
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.image-workbench-thumbnail.active {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}

.image-workbench-thumbnail img {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  background: var(--surface-soft);
  border-radius: 10px;
  filter: none;
  opacity: 1;
}

.image-workbench-thumbnail::after {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: var(--surface-soft);
  content: '';
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.image-workbench-thumbnail:not(.active) {
  color: var(--muted);
}

.image-workbench-thumbnail:not(.active)::after {
  opacity: .58;
}

.image-workbench-thumbnail:not(.active):hover::after,
.image-workbench-thumbnail:not(.active):focus-visible::after {
  opacity: .3;
}

.image-workbench-thumbnail > span {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 2px;
}

.image-workbench-thumbnail strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-workbench-thumbnail small {
  flex: none;
  color: var(--muted);
  font-size: 9px;
}

.image-workbench-canvas {
  --image-workbench-space-y: clamp(24px, 4vh, 48px);
  --image-workbench-space-x: clamp(24px, 5vw, 80px);
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  padding: var(--image-workbench-space-y) var(--image-workbench-space-x);
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--surface-strong) 40%, transparent), transparent 58%),
    var(--bg);
}

.image-workbench-stage {
  position: absolute;
  inset: var(--image-workbench-space-y) var(--image-workbench-space-x);
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
}

.image-workbench-stage[hidden] {
  display: none;
}

.image-workbench-stage img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  background: transparent;
  border-radius: 22px;
  filter: drop-shadow(0 24px 35px rgba(0, 0, 0, .14));
}

.image-workbench-empty {
  display: grid;
  max-width: 420px;
  place-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.image-workbench-empty[hidden] {
  display: none;
}

.image-workbench-empty .icon {
  width: 28px;
  height: 28px;
}

.image-workbench-empty strong {
  color: var(--text);
  font-size: 16px;
}

.image-workbench-empty span {
  font-size: 12px;
  line-height: 1.6;
}

.image-workbench-footer {
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 14px 24px 16px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.image-workbench-composer {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 44px;
  width: min(100%, 980px);
  min-height: 62px;
  align-items: center;
  gap: 10px;
  padding: 8px 9px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .08);
}

.image-workbench-composer:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text), 0 8px 30px rgba(0, 0, 0, .08);
}

.image-workbench-version {
  display: grid;
  min-width: 94px;
  gap: 1px;
  padding: 6px 12px;
  background: var(--surface-soft);
  border-radius: 18px;
}

.image-workbench-version span {
  color: var(--muted);
  font-size: 9px;
}

.image-workbench-version strong {
  font-size: 11px;
  font-weight: 700;
}

.image-workbench-composer-content {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.image-workbench-mark-summary {
  display: block;
  padding: 2px;
  font-size: 14px;
  line-height: 1.7;
}

.image-workbench-mark-summary[hidden] {
  display: none;
}

.image-workbench-mark-summary-row {
  display: inline-flex;
  align-items: flex-start;
  max-width: 100%;
  min-width: 0;
  margin-inline-end: 16px;
  vertical-align: middle;
}

.image-workbench-mark-summary-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 20px;
  flex: none;
  margin-inline-end: 8px;
  color: #0867df;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
}

.image-workbench-mark-summary-label b {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  font-size: 11px;
  line-height: 1;
}

.image-workbench-mark-summary-text {
  display: block;
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 20px;
}

.image-workbench-composer-content textarea {
  width: 100%;
  min-height: 26px;
  max-height: 160px;
  padding: 4px 2px;
  resize: none;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.image-workbench-composer-content textarea::placeholder {
  color: var(--muted);
}

.image-workbench-send {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--surface);
  background: var(--text);
  border: 0;
  border-radius: 50%;
}

.image-workbench-send:hover:not(:disabled) {
  transform: translateY(-1px);
}

.image-workbench-send:disabled {
  color: var(--muted);
  background: var(--surface-strong);
  cursor: not-allowed;
}

.image-workbench-send .icon {
  width: 17px;
  height: 17px;
}

.image-workbench-footer > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

@media (max-width: 760px) {
  .conversation-image-workbench {
    grid-template-rows: 60px minmax(0, 1fr) auto;
  }

  .image-workbench-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 10px;
  }

  .image-workbench-back,
  .image-workbench-actions a,
  .image-workbench-actions button {
    min-width: 40px;
    min-height: 40px;
    padding: 0 10px;
  }

  .image-workbench-back span,
  .image-workbench-actions span {
    display: none;
  }

  .image-workbench-download-menu {
    width: min(310px, calc(100vw - 20px));
  }

  .image-workbench-actions .image-workbench-download-menu span,
  .workspace-result-actions .image-workbench-download-menu span {
    display: grid;
  }

  .image-workbench-heading strong {
    max-width: 42vw;
    font-size: 12px;
  }

  .image-workbench-body {
    grid-template-columns: 1fr;
    grid-template-rows: 102px minmax(0, 1fr);
  }

  .image-workbench-rail-shell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .image-workbench-rail {
    height: 102px;
    align-items: center;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px;
  }

  .image-workbench-thumbnail {
    grid-template-columns: 68px;
    width: 80px;
    gap: 0;
    padding: 5px;
  }

  .image-workbench-thumbnail img {
    width: 68px;
    height: 68px;
  }

  .image-workbench-thumbnail::after {
    top: 5px;
    left: 5px;
    width: 68px;
    height: 68px;
  }

  .image-workbench-thumbnail > span {
    display: none;
  }

  .image-workbench-canvas {
    --image-workbench-space-y: 16px;
    --image-workbench-space-x: 16px;
    padding: var(--image-workbench-space-y) var(--image-workbench-space-x);
  }

  .image-workbench-stage img {
    border-radius: 16px;
    filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .13));
  }

  .image-workbench-footer {
    gap: 5px;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom));
  }

  .image-workbench-composer {
    grid-template-columns: auto minmax(60px, 1fr) 42px;
    min-height: 58px;
    gap: 7px;
    padding: 7px 8px;
    border-radius: 23px;
  }

  .image-workbench-version {
    min-width: 58px;
    padding: 6px 9px;
  }

  .image-workbench-version span {
    display: none;
  }

  .image-workbench-composer-content textarea {
    font-size: 16px;
  }

  .image-workbench-mark-summary-label,
  .image-workbench-mark-summary-text {
    font-size: 14px;
  }

  .image-workbench-send {
    width: 42px;
    height: 42px;
  }

  .image-workbench-footer > p {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .conversation-image-workbench,
  .image-workbench-thumbnail {
    animation: none;
    transition: none;
  }
}

.library-upload-dialog {
  width: min(460px, 100%);
  overflow: hidden;
  border-radius: 20px;
}

.library-upload-dialog > header {
  display: flex;
  min-height: auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}

.library-upload-dialog > header > strong {
  font-size: 16px;
  font-weight: 700;
}

.library-upload-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.library-upload-body label,
.library-upload-body > div {
  display: grid;
  gap: 7px;
}

.library-upload-body label > span,
.library-upload-body > div > span {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.library-upload-body i {
  color: var(--muted-strong);
  font-style: normal;
  font-weight: 500;
}

.library-upload-body input,
.library-upload-body textarea {
  padding: 0 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  font: inherit;
}

.library-upload-body input {
  height: 44px;
}

.library-upload-body textarea {
  padding-block: 11px;
  resize: none;
}

#library-upload-file {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--text-soft);
  background: var(--bg);
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  font-size: 13px;
  text-align: left;
}

#library-upload-file .icon {
  width: 16px;
  height: 16px;
}

@keyframes library-slide-right {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes library-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 980px) {
  .design-library-nav {
    width: 200px;
    padding-inline: 12px;
  }

  .history-library-page {
    padding-inline: 24px;
  }
}

@media (max-width: 760px) {
  #history-module {
    overflow: visible;
  }

  .design-library-shell {
    display: block;
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
    overflow: visible;
  }

  .design-library-nav {
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .design-library-nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .design-library-nav-item {
    min-height: 58px;
    gap: 8px;
    padding: 9px 10px;
  }

  .design-library-nav-item::before {
    top: auto;
    right: 8px;
    bottom: -1px;
    left: 8px;
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
  }

  .design-library-nav-item small,
  .design-library-nav-item em {
    display: none;
  }

  .history-library-page {
    height: auto;
    overflow: visible;
    padding: 20px 14px 40px;
  }

  .library-search {
    width: 100%;
  }

  .library-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .generated-library-filters {
    width: 100%;
    justify-content: flex-start;
  }

  .library-filter-select,
  .library-filter-date {
    min-width: 0;
    flex: 1 1 164px;
  }

  .project-list-header {
    display: none;
  }

  .project-list-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .project-list-row > span:nth-child(3),
  .project-list-row > span:nth-child(4) {
    display: none;
  }

  .project-grid-view,
  .library-asset-grid,
  .generated-image-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 480px) {
  .design-library-nav-item .icon {
    display: none;
  }

  .design-library-nav-item {
    justify-content: center;
    padding-inline: 6px;
  }

  .design-library-nav-item > span {
    flex: none;
  }

  .design-library-nav-item strong {
    font-size: 11px;
    text-align: center;
  }

  .library-segmented {
    flex: 1;
  }

  .library-segmented button {
    min-width: 0;
    flex: 1;
  }

  .library-asset-grid,
  .project-grid-view,
  .generated-image-grid {
    grid-template-columns: 1fr;
  }
}

/* 我的设计：参考稿精细交互修复 */
.topbar.library-scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, .10);
}

.library-asset-card[data-detail-crop="auth-hero"] img {
  object-position: left center;
  transform: scale(1.12);
  transform-origin: left center;
}

.library-detail-preview img.library-auth-hero-crop {
  transform: scale(1.55);
  transform-origin: left center;
}

.library-quick-look img.library-auth-hero-crop {
  width: min(70vw, 760px);
  aspect-ratio: 962 / 1058;
  object-fit: cover;
  object-position: left center;
}

.library-command-overlay {
  position: fixed;
  z-index: 185;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh 20px 20px;
  background: rgba(0, 0, 0, .42);
  animation: library-fade-in 140ms ease both;
}

.library-command-overlay[hidden] {
  display: none;
}

.library-command-dialog {
  width: min(620px, 100%);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .34);
  animation: library-command-scale-in 180ms var(--ease) both;
}

.library-command-search {
  display: flex;
  height: 56px;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.library-command-search .icon {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.library-command-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 15px;
}

.library-command-search > span {
  flex: none;
  padding: 3px 7px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.library-command-results {
  max-height: 52vh;
  overflow-y: auto;
  padding: 8px;
}

.library-command-result {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 11px;
  text-align: left;
}

.library-command-result:hover,
.library-command-result:focus-visible {
  background: var(--surface-soft);
}

.library-command-result > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.library-command-result i {
  flex: none;
  padding: 2px 7px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
}

.library-command-result strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-command-result small {
  flex: none;
  color: var(--faint);
  font-size: 11px;
}

.library-command-empty {
  margin: 0;
  padding: 26px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Unified image quality presets */
.quality-preset-control {
  position: relative;
  min-width: 0;
}

.quality-preset-control[hidden],
.quality-preset-panel[hidden] {
  display: none;
}

.quality-preset-trigger {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: left;
}

.quality-preset-trigger:hover,
.quality-preset-trigger[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--line-strong);
}

.quality-preset-trigger > .icon:first-child {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.quality-preset-trigger > span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.quality-preset-trigger strong,
.quality-preset-trigger small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-preset-trigger strong {
  font-size: 12px;
  font-weight: 650;
}

.quality-preset-trigger small {
  color: var(--muted);
  font-size: 10px;
}

.quality-preset-trigger > b {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 10px;
  font-size: 10px;
}

.quality-preset-chevron {
  width: 13px;
  height: 13px;
  flex: none;
  transition: transform .16s ease;
}

.quality-preset-trigger[aria-expanded="true"] .quality-preset-chevron {
  transform: rotate(180deg);
}

.quality-preset-panel {
  position: absolute;
  z-index: 80;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(560px, calc(100vw - 32px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
}

.quality-preset-panel > header,
.quality-preset-panel > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
}

.quality-preset-panel > header {
  border-bottom: 1px solid var(--line);
}

.quality-preset-panel > header > div {
  display: grid;
  gap: 2px;
}

.quality-preset-panel > header strong {
  font-size: 14px;
}

.quality-preset-panel > header small,
.quality-preset-panel > footer {
  color: var(--muted);
  font-size: 10px;
}

.quality-preset-panel > header button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 50%;
}

.quality-preset-panel > header button .icon {
  width: 14px;
  height: 14px;
}

.quality-preset-groups {
  display: grid;
  max-height: min(54vh, 520px);
  gap: 14px;
  overflow-y: auto;
  padding: 14px 15px 16px;
}

.quality-preset-group {
  display: grid;
  gap: 7px;
}

.quality-preset-group > strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
}

.quality-preset-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.quality-preset-options > button {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
}

.quality-preset-options > button:hover {
  border-color: var(--line-strong);
}

.quality-preset-options > button.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.quality-preset-options > button span,
.quality-preset-options > button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-preset-options > button span {
  font-size: 12px;
  font-weight: 650;
}

.quality-preset-options > button small {
  color: var(--muted);
  font-size: 9px;
}

.quality-preset-options > button.active small {
  color: color-mix(in srgb, var(--accent-ink) 74%, transparent);
}

.quality-preset-panel > footer {
  border-top: 1px solid var(--line);
}

.quality-preset-panel > footer button {
  padding: 6px 9px;
  color: var(--text);
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 650;
}

.quality-preset-inline {
  display: grid;
  width: 100%;
  gap: 0;
}

.quality-preset-inline .quality-preset-trigger {
  width: 100%;
  min-height: 54px;
  padding: 8px 11px;
  background: var(--surface-soft);
  border-color: var(--line);
}

.quality-preset-inline .quality-preset-trigger > span {
  flex: 1;
}

.quality-preset-inline .quality-preset-panel {
  position: relative;
  inset: auto;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}

.refinement-quality-control {
  display: block;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quality-preset-inline .refinement-quality-trigger {
  min-height: 58px;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
}

.quality-preset-inline .refinement-quality-trigger:hover,
.quality-preset-inline .refinement-quality-trigger[aria-expanded="true"] {
  background: transparent;
  border-color: transparent;
}

.quality-preset-inline .refinement-quality-trigger:focus {
  outline: 0;
}

.quality-preset-inline .refinement-quality-trigger:focus-visible strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.refinement-quality-trigger > span {
  flex: 1;
}

.refinement-quality-trigger > small {
  flex: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.refinement-quality-trigger strong {
  font-size: inherit;
  font-weight: inherit;
}

.refinement-quality-trigger .quality-preset-chevron {
  width: 15px;
  height: 15px;
}

.refinement-quality-protection {
  margin: 0;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  font-size: 9px;
  line-height: 1.45;
}

.quality-preset-inline .refinement-quality-panel {
  position: relative;
  inset: auto;
  width: 100%;
  min-width: 0;
  margin: 0 0 16px;
  border-radius: 12px;
  box-shadow: none;
}

.refinement-quality-panel > header {
  min-height: 58px;
  padding: 10px 12px;
}

.refinement-quality-panel > header strong {
  font-size: 13px;
}

.refinement-quality-list {
  display: grid;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding: 4px 12px;
}

.refinement-quality-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 7px 2px;
  color: var(--text);
  background: transparent;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.refinement-quality-option:last-child {
  border-bottom: 0;
}

.refinement-quality-option:hover {
  background: var(--surface-soft);
}

.refinement-quality-option > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.refinement-quality-option strong,
.refinement-quality-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refinement-quality-option strong {
  font-size: 11px;
  font-weight: 650;
}

.refinement-quality-option small {
  color: var(--muted);
  font-size: 9px;
}

.refinement-quality-check {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: transparent;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.refinement-quality-check .icon {
  width: 11px;
  height: 11px;
}

.refinement-quality-option.active .refinement-quality-check {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.refinement-quality-show-all {
  display: flex;
  width: calc(100% - 24px);
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  margin: 0 12px;
  padding: 0 2px;
  color: var(--muted);
  background: transparent;
  border-top: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  text-align: left;
}

.refinement-quality-show-all:hover {
  color: var(--text);
}

.refinement-quality-show-all .icon {
  width: 12px;
  height: 12px;
}

.refinement-quality-all[hidden],
.refinement-quality-list[hidden] {
  display: none;
}

.refinement-quality-categories {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.refinement-quality-categories::-webkit-scrollbar {
  display: none;
}

.refinement-quality-categories button {
  min-height: 30px;
  flex: none;
  padding: 0 9px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
}

.refinement-quality-categories button:hover,
.refinement-quality-categories button.active {
  color: var(--text);
  background: var(--surface-soft);
}

.refinement-quality-all-list {
  max-height: min(34vh, 260px);
}

.refinement-quality-panel > footer {
  min-height: 54px;
  padding: 8px 12px;
}

.refinement-quality-panel > footer .refinement-quality-cancel,
.refinement-quality-panel > footer .refinement-quality-apply {
  min-height: 36px;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 11px;
}

.refinement-quality-panel > footer .refinement-quality-cancel {
  background: transparent;
}

.refinement-quality-panel > footer .refinement-quality-apply {
  min-width: 108px;
  color: var(--accent-ink);
  background: var(--accent);
}

.refinement-quality-panel > footer .refinement-quality-apply:disabled {
  color: var(--muted);
  background: var(--surface-soft);
}

.composer {
  grid-template-columns: auto minmax(80px, 1fr) auto;
  grid-template-rows: auto auto;
  row-gap: 8px;
}

.composer-settings-row {
  display: flex;
  min-width: 0;
  grid-row: 1;
  grid-column: 1 / -1;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.composer-settings-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  flex: none;
  gap: 8px;
  margin-left: auto;
}

.composer textarea {
  grid-row: 2;
  grid-column: 2;
}

.send-button {
  grid-row: 2;
  grid-column: 3;
}

.composer #upload-button {
  grid-row: 2;
  grid-column: 1;
}

.composer .inspiration-quality-control {
  min-width: 0;
  flex: 1;
}

.composer .quality-preset-trigger {
  border-radius: 21px;
}

.composer .quality-preset-trigger small {
  display: none;
}

.inspiration-quality-quick-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.inspiration-quality-quick-bar::-webkit-scrollbar {
  display: none;
}

.inspiration-quality-quick,
.inspiration-quality-more {
  display: flex;
  min-height: 34px;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.inspiration-quality-quick:hover,
.inspiration-quality-more:hover,
.inspiration-quality-more[aria-expanded="true"] {
  border-color: var(--line-strong);
}

.inspiration-quality-quick.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.inspiration-quality-quick-check {
  display: none;
  width: 14px;
  height: 14px;
  place-items: center;
}

.inspiration-quality-quick.active .inspiration-quality-quick-check {
  display: grid;
}

.inspiration-quality-quick-check .icon {
  width: 12px;
  height: 12px;
}

.inspiration-quality-more {
  margin-left: 2px;
  padding-inline: 10px;
  background: transparent;
}

.inspiration-quality-more > b {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.inspiration-quality-more .icon {
  width: 12px;
  height: 12px;
  transition: transform .16s ease;
}

.inspiration-quality-more[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.inspiration-quality-panel {
  right: 0;
  bottom: calc(100% + 12px);
  width: min(560px, calc(100vw - 32px));
  border-radius: 15px;
}

.inspiration-quality-panel > header {
  min-height: 48px;
  padding: 0 14px;
}

.inspiration-quality-panel > header > strong {
  font-size: 13px;
  font-weight: 650;
}

.inspiration-quality-panel > header > span {
  color: var(--muted);
  font-size: 10px;
}

.inspiration-quality-panel-body {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  min-height: 282px;
}

.inspiration-quality-categories {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 8px;
  background: var(--surface-soft);
  border-right: 1px solid var(--line);
}

.inspiration-quality-categories button {
  min-height: 38px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.inspiration-quality-categories button:hover,
.inspiration-quality-categories button.active {
  color: var(--text);
  background: var(--surface);
}

.inspiration-quality-list {
  display: grid;
  align-content: start;
  max-height: min(48vh, 360px);
  overflow-y: auto;
  padding: 7px 10px;
}

.inspiration-quality-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.inspiration-quality-option-row:last-child {
  border-bottom: 0;
}

.inspiration-quality-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 6px 7px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.inspiration-quality-option:hover {
  background: var(--surface-soft);
}

.inspiration-quality-option > span:first-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.inspiration-quality-option strong,
.inspiration-quality-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspiration-quality-option strong {
  font-size: 11px;
  font-weight: 650;
}

.inspiration-quality-option small {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.inspiration-quality-check {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: transparent;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.inspiration-quality-check .icon {
  width: 11px;
  height: 11px;
}

.inspiration-quality-option.active .inspiration-quality-check {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.inspiration-quality-pin {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
}

.inspiration-quality-pin:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.inspiration-quality-pin[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
}

.inspiration-quality-pin .icon {
  width: 14px;
  height: 14px;
}

.inspiration-quality-replace-dialog {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.inspiration-quality-replace-dialog[hidden] {
  display: none;
}

.inspiration-quality-replace-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(5px);
}

.inspiration-quality-replace-card {
  position: relative;
  display: grid;
  width: min(390px, 100%);
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-modal);
  animation: inspiration-quick-dialog-in 180ms cubic-bezier(.2, .8, .2, 1) both;
}

.inspiration-quality-replace-card > strong {
  font-size: 14px;
}

.inspiration-quality-replace-card > p {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.inspiration-quality-replace-card > p b {
  color: var(--text);
}

.inspiration-quality-replace-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inspiration-quality-replace-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  min-height: 56px;
  align-content: center;
  gap: 1px 8px;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
}

.inspiration-quality-replace-target:hover,
.inspiration-quality-replace-target:focus-visible {
  background: color-mix(in srgb, var(--accent) 45%, var(--surface));
  border-color: color-mix(in srgb, var(--accent-ink) 30%, var(--line-strong));
  transform: translateY(-1px);
}

.inspiration-quality-replace-target strong,
.inspiration-quality-replace-target small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspiration-quality-replace-target strong {
  font-size: 11px;
}

.inspiration-quality-replace-target small {
  color: var(--muted);
  font-size: 9px;
}

.inspiration-quality-replace-target .icon {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  width: 13px;
  height: 13px;
}

.inspiration-quality-replace-cancel {
  justify-self: end;
  min-height: 32px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 11px;
}

.inspiration-quality-replace-cancel:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.inspiration-quality-replace-target.is-replacing-out {
  pointer-events: none;
  animation: inspiration-quick-replace-out 140ms ease-in forwards;
}

.inspiration-quality-quick.is-replacing-in {
  animation: inspiration-quick-replace-in 260ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes inspiration-quick-dialog-in {
  from { opacity: 0; transform: scale(.96) translateY(5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes inspiration-quick-replace-out {
  to { opacity: 0; transform: scale(.9) translateY(-4px); }
}

@keyframes inspiration-quick-replace-in {
  0% { opacity: 0; transform: scale(.9) translateY(7px); }
  65% { transform: scale(1.04) translateY(-1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.inspiration-quality-panel > footer {
  min-height: 52px;
  padding: 7px 12px;
}

.inspiration-quality-panel > footer .inspiration-quality-clear,
.inspiration-quality-panel > footer .inspiration-quality-quick-reset,
.inspiration-quality-panel > footer .inspiration-quality-done {
  min-height: 34px;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 11px;
}

.inspiration-quality-panel > footer .inspiration-quality-clear {
  padding-left: 4px;
  background: transparent;
}

.inspiration-quality-panel > footer .inspiration-quality-quick-reset {
  margin-right: auto;
}

.inspiration-quality-panel > footer .inspiration-quality-done {
  min-width: 94px;
  color: var(--accent-ink);
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .inspiration-quality-replace-card,
  .inspiration-quality-replace-target.is-replacing-out,
  .inspiration-quality-quick.is-replacing-in {
    animation: none;
    transform: none;
  }
}

@media (max-width: 760px) {
  .composer {
    grid-template-columns: 40px minmax(40px, 1fr) 40px;
  }

  .composer-settings-row {
    gap: 8px;
  }

  .composer-settings-actions {
    gap: 5px;
  }

  .composer-model-trigger {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .composer-model-trigger > .icon:first-child {
    display: block;
  }

  .composer-model-trigger > span,
  .composer-model-chevron,
  .composer-reasoning-chevron,
  .composer-aspect-chevron {
    display: none;
  }

  .composer-aspect-trigger {
    height: 40px;
    gap: 6px;
    padding: 0 8px;
  }

  .composer-aspect-menu {
    right: -48px;
  }

  .composer-aspect-options {
    gap: 6px;
  }

  .composer-aspect-option {
    min-height: 70px;
  }

  .composer .quality-preset-trigger {
    width: 40px;
    height: 40px;
    justify-content: center;
    padding: 0;
  }

  .composer .quality-preset-trigger > span,
  .composer .quality-preset-chevron {
    display: none;
  }

  .composer .quality-preset-trigger > b {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 8px;
  }

  .quality-preset-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inspiration-quality-panel {
    right: auto;
    left: 0;
  }

  .inspiration-quality-panel-body {
    grid-template-columns: 116px minmax(0, 1fr);
  }

  .inspiration-quality-quick,
  .inspiration-quality-more {
    min-height: 32px;
    padding-inline: 10px;
  }

  .image-workbench-composer {
    grid-template-columns: minmax(60px, 1fr) 42px;
  }

  .image-workbench-version {
    display: none;
  }
}

@keyframes library-command-scale-in {
  from { opacity: 0; transform: scale(.98) translateY(-6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 760px) {
  html:has(body.library-module-active),
  body.library-module-active {
    height: auto;
    min-height: 100%;
  }

  body.library-module-active {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.library-module-active .app-shell,
  body.library-module-active .main-shell,
  body.library-module-active #history-module.active {
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
    overflow: visible;
  }

  body.library-module-active .design-library-shell {
    height: auto;
    min-height: calc(100dvh - var(--topbar-height));
    overflow: visible;
  }

  body.library-module-active .history-library-page {
    height: auto;
    overflow: visible;
  }

  .library-command-overlay {
    padding: 96px 12px 12px;
  }

  .library-command-result small {
    max-width: 34%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
