:root {
  color-scheme: light;
  --bg: oklch(98% 0.004 238);
  --surface: oklch(99.5% 0.002 238);
  --surface-soft: oklch(96.6% 0.006 238);
  --surface-muted: oklch(93.5% 0.008 238);
  --ink: oklch(22% 0.018 238);
  --text: oklch(34% 0.018 238);
  --muted: oklch(55% 0.018 238);
  --faint: oklch(68% 0.014 238);
  --line: oklch(90% 0.011 238);
  --line-strong: oklch(82% 0.014 238);
  --accent: oklch(24% 0.018 238);
  --accent-hover: oklch(18% 0.018 238);
  --green: oklch(46% 0.12 164);
  --green-soft: #edf8f2;
  --red: oklch(52% 0.15 30);
  --red-soft: #fff1ef;
  --blue: oklch(54% 0.15 252);
  --blue-soft: #eef4ff;
  --shadow: 0 1px 2px rgba(27, 33, 38, 0.035);
  --shadow-raised: 0 10px 24px rgba(27, 33, 38, 0.08);
  --radius: 7px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: var(--bg);
}

.auth-panel {
  display: grid;
  gap: 12px;
  width: min(100%, 380px);
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

.auth-panel h1 {
  margin: 6px 0 6px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.18;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-tab {
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.auth-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 1px 4px rgba(27, 33, 38, 0.06);
}

.auth-form {
  display: grid;
  gap: 0;
}

.auth-steps {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-steps div {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--text);
  font-size: 13px;
}

.auth-steps strong {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--surface);
  background: var(--accent);
  border-radius: 50%;
  font-size: 12px;
}

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

.auth-links a {
  min-height: 36px;
  padding: 0 10px;
}

.auth-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.auth-code-row .secondary-button {
  min-height: 36px;
  margin-bottom: 10px;
  padding: 0 10px;
  white-space: nowrap;
}

.account-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 230px;
  padding: 8px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.account-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-strip strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.account-compact .secondary-button,
.account-compact .ghost-button {
  min-height: 32px;
  padding: 0 10px;
}

@media (max-width: 520px) {
  .auth-links {
    grid-template-columns: 1fr;
  }

  .account-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .account-actions {
    justify-content: flex-start;
  }
}

body::-webkit-scrollbar,
.sidebar-scroll::-webkit-scrollbar,
.gallery-shell::-webkit-scrollbar {
  display: none;
}

body,
.sidebar-scroll,
.gallery-shell {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.panel {
  background: var(--surface);
}

.controls {
  display: flex;
  flex: 0 0 304px;
  flex-direction: column;
  width: 304px;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--line);
  box-shadow: none;
  z-index: 2;
}

.model-select-row {
  margin-bottom: 16px;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 16px;
}

.sidebar-footer {
  flex: 0 0 auto;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.form-block {
  margin: 0 0 16px;
}

.form-block:last-child {
  margin-bottom: 0;
}

.api-form {
  margin-bottom: 14px;
}

.api-details,
.compact-details {
  background: transparent;
}

.api-details summary,
.compact-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  outline: none;
}

.api-details summary::-webkit-details-marker,
.compact-details summary::-webkit-details-marker {
  display: none;
}

.api-details summary span:first-child,
.compact-details summary span:first-child,
.section-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

.api-details summary span:last-child,
.compact-details summary span:last-child,
.section-title span {
  color: var(--faint);
  font-size: 14px;
  white-space: nowrap;
}

.api-details summary::after,
.compact-details summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.api-details[open] summary::after,
.compact-details[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.api-body,
.favorite-body,
.advanced-body {
  padding-top: 10px;
}

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

.compact-title {
  margin-bottom: 8px;
}

.api-routing-modal {
  position: fixed;
  inset: 0;
  z-index: 46;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 20, 23, 0.38);
}

.api-routing-dialog {
  display: grid;
  gap: 0;
  width: min(430px, 100%);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(27, 33, 38, 0.16);
}

.api-routing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.api-routing-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.api-routing-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
}

.api-routing-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-routing-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.api-routing-body .model-select-row {
  margin-bottom: 0;
}

.api-routing-body select {
  background: var(--surface);
}

#clientApiKeySummary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.client-api-key-status {
  min-height: 17px;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.client-api-key-status.is-error {
  color: var(--red);
}

label {
  display: grid;
  gap: 5px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

label > span:first-child {
  color: var(--muted);
}

label small {
  color: var(--faint);
  font-size: 12px;
  font-weight: 520;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  outline: none;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

input,
select {
  height: 36px;
  padding: 0 10px;
}

textarea {
  min-height: 84px;
  padding: 9px 10px;
  resize: vertical;
}

#prompt {
  min-height: 118px;
}

#negativePrompt {
  min-height: 64px;
}

input::placeholder,
textarea::placeholder {
  color: #b6bdc3;
}

input:focus,
select:focus,
textarea:focus {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 2px rgba(29, 34, 38, 0.055);
}

select {
  cursor: pointer;
}

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

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.mode-option {
  margin: 0;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mode-option span {
  display: grid;
  place-items: center;
  min-height: 32px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 720;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.mode-option input:checked + span {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(27, 33, 38, 0.08);
}

.favorite-panel,
.advanced-details {
  margin-bottom: 12px;
  padding: 0;
}

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

.api-actions {
  grid-template-columns: 1fr 1fr;
}

.reference-panel {
  margin-bottom: 12px;
}

.drop-zone {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 11px;
  cursor: pointer;
  background: var(--surface-soft);
  border: 1px dashed #c4ccd2;
  border-radius: var(--radius);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
  background: var(--blue-soft);
  border-color: #9db6ee;
  box-shadow: 0 0 0 2px rgba(60, 114, 217, 0.08);
}

.drop-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
}

.drop-copy,
.drop-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.reference-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin-top: 10px;
  padding: 8px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.reference-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
}

.reference-preview-item {
  min-width: 0;
  margin: 0;
}

.reference-preview-item img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--surface-muted);
}

.reference-preview-item figcaption {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-preview p {
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-readout {
  margin: -2px 0 12px;
  padding: 7px 10px;
  color: var(--green);
  background: var(--green-soft);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 720;
}

.range-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  align-items: end;
  gap: 8px;
}

.range-grid output {
  display: grid;
  place-items: center;
  height: 36px;
  margin-bottom: 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 720;
}

input[type="range"] {
  height: 28px;
  padding: 0;
  accent-color: var(--accent);
  background: transparent;
}

.count-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.count-control span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.count-control input {
  width: 58px;
  height: 28px;
  padding: 0;
  text-align: right;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button,
.secondary-button,
.workflow-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease, transform 120ms ease;
}

button:active,
.secondary-button:active,
.workflow-launch:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button {
  color: #fafafa;
  background: var(--accent);
}

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

.generate-button {
  width: 100%;
  min-height: 42px;
  color: #fafafa;
  background: var(--accent);
  border-color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.02em;
}

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

.workflow-launch {
  width: 100%;
  min-height: 34px;
  margin-top: 6px;
  color: var(--muted);
  background: transparent;
  border-color: var(--line-strong);
}

.workflow-launch:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.controls button,
.controls .secondary-button,
.controls .workflow-launch {
  font-size: 13px;
}

.ghost-button,
.secondary-button {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.ghost-button:hover,
.secondary-button:hover {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line-strong);
}

.danger-button {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd5d0;
}

.danger-button:hover {
  background: #ffe5e2;
  border-color: #ffc3bc;
}

.message {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.message.error {
  color: var(--red);
}

.message.ok {
  color: var(--green);
}

.gallery-shell {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 14px 20px 28px;
  background: var(--bg);
}

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

.gallery-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 760;
}

.gallery-head p {
  margin: 3px 0 0;
  color: var(--faint);
  font-size: 13px;
}

.gallery-main-head {
  align-items: center;
  margin-top: 0;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.gallery-main-head h2 {
  font-size: 18px;
}

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

.workspace-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.workspace-title-copy {
  min-width: 0;
}

.account-inline {
  min-width: 0;
  padding: 0 0 0 10px;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  justify-content: flex-start;
  flex: 0 1 auto;
}

.account-inline span,
.account-inline strong {
  white-space: nowrap;
}

.workspace-account-actions {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.workspace-account-actions .secondary-button,
.workspace-account-actions .ghost-button {
  min-height: 32px;
  padding: 0 10px;
}

.sidebar-account-cluster {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-account-cluster .account-inline {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  justify-content: space-between;
}

.sidebar-account-cluster .account-inline div {
  min-width: 0;
}

.sidebar-account-cluster .account-inline span,
.sidebar-account-cluster .account-inline strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account-cluster .workspace-account-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.sidebar-account-cluster .workspace-account-actions .secondary-button,
.sidebar-account-cluster .workspace-account-actions .ghost-button {
  min-width: 0;
  justify-content: center;
  padding: 0 8px;
}

.compact-tool-cluster {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.compact-info-chip {
  display: grid;
  min-width: 0;
  min-height: 42px;
  padding: 7px 8px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: default;
  text-align: left;
}

button.compact-info-chip {
  cursor: pointer;
}

.compact-info-chip:hover,
.compact-info-chip:focus-visible {
  background: var(--surface);
  border-color: var(--line-strong);
  outline: none;
}

.compact-info-chip span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-info-chip strong {
  display: block;
  min-width: 0;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-cluster.compact-tool-cluster .account-inline {
  width: auto;
  padding: 7px 8px;
  justify-content: start;
}

.sidebar-account-cluster.compact-tool-cluster .account-inline div {
  min-width: 0;
}

.compact-account-actions {
  grid-column: 1 / -1;
}

.sidebar-account-cluster .compact-account-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.floating-info-tooltip {
  position: fixed;
  z-index: 80;
  max-width: min(320px, calc(100vw - 18px));
  padding: 8px 10px;
  pointer-events: none;
  color: var(--surface);
  background: rgba(29, 34, 38, 0.94);
  border: 1px solid rgba(254, 254, 254, 0.1);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(27, 33, 38, 0.18);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-width: 178px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.view-switch-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.view-switch-button.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 1px 4px rgba(27, 33, 38, 0.06);
}

.workspace-launch {
  min-height: 36px;
  padding: 0 14px;
  text-decoration: none;
}

.task-panel {
  margin-bottom: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.task-panel.collapsed .task-list {
  display: none;
}

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

.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.task-main {
  min-width: 0;
}

.task-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
}

.task-status.running {
  color: var(--blue);
  background: var(--blue-soft);
}

.task-status.queued {
  color: #80611c;
  background: #fff7df;
}

.task-status.completed {
  color: var(--green);
  background: var(--green-soft);
}

.task-status.failed {
  color: var(--red);
  background: var(--red-soft);
}

.task-status.cancelled {
  color: var(--muted);
  background: var(--surface-muted);
}

.task-prompt {
  margin: 7px 0 3px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta,
.task-error {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.task-error {
  margin-top: 5px;
  color: var(--red);
}

.task-progress {
  overflow: hidden;
  height: 7px;
  margin-top: 9px;
  background: var(--surface-muted);
  border-radius: 999px;
}

.task-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 180ms ease;
}

.ecommerce-task-item {
  grid-template-columns: minmax(0, 1fr);
}

.ecommerce-plan {
  margin-top: 10px;
  padding: 10px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.ecommerce-plan-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
}

.ecommerce-plan-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.ecommerce-screen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ecommerce-screen-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ecommerce-screen-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--surface-muted);
  border-radius: 6px;
}

.ecommerce-screen-card p {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 740;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ecommerce-screen-card span {
  display: -webkit-box;
  min-height: 34px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ecommerce-screen-card .secondary-button {
  min-height: 32px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--gallery-thumb-size, 230px)), 1fr));
  gap: 12px;
}

.project-strip {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(116px, auto) minmax(116px, auto) minmax(160px, 0.65fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.project-strip span,
.project-image-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.project-strip strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-folder-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-strip .gallery-main-actions {
  justify-content: flex-end;
}

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -4px 0 12px;
  padding: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gallery-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1 1 auto;
  gap: 6px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.gallery-filter-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 760;
}

.gallery-filter-button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.gallery-filter-button.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 1px 4px rgba(27, 33, 38, 0.06);
}

.gallery-size-control {
  display: grid;
  grid-template-columns: auto 86px 42px;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 30px;
  margin: 0;
  padding: 0 4px 0 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.gallery-size-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.gallery-size-control input {
  height: 24px;
  padding: 0;
  cursor: ew-resize;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.gallery-size-control output {
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  text-align: right;
  white-space: nowrap;
}

.project-pick-button {
  width: 100%;
  margin: -2px 0 8px;
}

.project-image-modal {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 20, 23, 0.48);
}

.project-image-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(27, 33, 38, 0.16);
}

.project-image-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.project-image-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 17px;
}

.project-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 10px;
  min-height: 180px;
  padding: 12px;
  overflow: auto;
}

.project-image-option {
  display: grid;
  gap: 6px;
  padding: 6px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.project-image-option:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.project-image-option img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-muted);
}

.project-image-option span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-marquee {
  position: fixed;
  z-index: 24;
  pointer-events: none;
  border: 1px solid rgba(27, 33, 38, 0.55);
  border-radius: 6px;
  background: rgba(27, 33, 38, 0.08);
  box-shadow: inset 0 0 0 1px rgba(254, 254, 254, 0.35);
}

.batch-menu {
  position: fixed;
  z-index: 25;
  min-width: 148px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(27, 33, 38, 0.08);
}

.batch-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  border-color: transparent;
  border-radius: 7px;
  font-size: 13px;
}

.batch-menu button:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.batch-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.batch-menu button:disabled:hover {
  color: var(--muted);
  background: transparent;
}

.batch-menu .batch-delete {
  color: var(--red);
}

body.is-selecting-images {
  cursor: crosshair;
  user-select: none;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.gallery-grid > .empty-state {
  grid-column: 1 / -1;
}

.wall-task-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  user-select: none;
}

.wall-task-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(27, 33, 38, 0.14);
}

.wall-task-card.is-selected::after {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 9px;
  color: var(--surface);
  background: var(--accent);
  border-radius: 999px;
  content: "已选";
  font-size: 12px;
  font-weight: 760;
  pointer-events: none;
}

.wall-task-visual {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 0;
  aspect-ratio: 3 / 4;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(254, 254, 254, 0.48), rgba(254, 254, 254, 0)),
    var(--surface-muted);
}

.wall-task-loader {
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border: 2px solid #cfd6dc;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: wall-spin 820ms linear infinite;
}

.wall-task-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 14px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #ffd5d0;
  border-radius: 999px;
  font-weight: 800;
}

.wall-task-status {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
}

.wall-task-hint {
  width: min(100%, 180px);
  margin: 6px auto 0;
  color: var(--muted);
  font-size: 12px;
}

.wall-task-meta,
.wall-task-error {
  display: -webkit-box;
  min-height: 34px;
  margin: 0 0 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wall-task-error {
  color: var(--red);
}

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

.wall-task-actions button {
  min-height: 32px;
  padding: 0 8px;
  font-size: 12px;
}

.wall-task-actions .task-apply:only-child {
  grid-column: 1 / -1;
}

.wall-task-card.queued .wall-task-loader {
  animation-duration: 1200ms;
  border-top-color: var(--muted);
}

.wall-task-card.failed .wall-task-visual,
.wall-task-card.cancelled .wall-task-visual {
  background:
    linear-gradient(135deg, rgba(255, 241, 239, 0.75), rgba(255, 255, 255, 0)),
    var(--surface-muted);
}

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

.image-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
  user-select: none;
}

.image-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(27, 33, 38, 0.14);
}

.image-card.is-selected::after {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 9px;
  color: var(--surface);
  background: var(--accent);
  border-radius: 999px;
  content: "已选";
  font-size: 12px;
  font-weight: 760;
  pointer-events: none;
}

.image-frame {
  position: relative;
  overflow: hidden;
  background: var(--surface-muted);
}

.image-link {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--surface-muted);
  -webkit-user-drag: none;
}

.image-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-muted);
  transition: transform 220ms ease;
  -webkit-user-drag: none;
}

.image-card:hover img {
  transform: none;
}

.action-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 160ms ease;
}

.image-card:hover .action-overlay,
.image-card:focus-within .action-overlay {
  opacity: 1;
  pointer-events: none;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  pointer-events: auto;
}

.action-grid button,
.action-grid a {
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
}

.action-grid .ghost-button,
.action-grid .secondary-button {
  color: var(--ink);
  background: rgba(254, 254, 254, 0.92);
  border-color: transparent;
}

.action-grid .ghost-button:hover,
.action-grid .secondary-button:hover {
  background: var(--surface);
}

.action-grid .danger-button {
  background: rgba(255, 241, 239, 0.94);
}

.action-grid .image-delete {
  grid-column: 1 / -1;
}

.image-info {
  padding: 10px;
}

.image-prompt {
  margin: 0 0 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-rating-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 9px;
}

.image-rating-button {
  min-width: 0;
  min-height: 28px;
  padding: 0 6px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.image-rating-button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.image-rating-button[data-rating-value="usable"].is-active {
  color: #1f684b;
  background: #edf8f2;
  border-color: #badfce;
}

.image-rating-button[data-rating-value="favorite"].is-active {
  color: #8a5b0c;
  background: #fff6df;
  border-color: #ead08e;
}

.image-rating-button[data-rating-value="reject"].is-active {
  color: #aa352d;
  background: #fff1ef;
  border-color: #efbbb6;
}

dl {
  display: grid;
  gap: 4px;
  margin: 0;
}

dl div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--faint);
  font-size: 11px;
}

dt,
dd {
  margin: 0;
}

dd {
  max-width: 68%;
  overflow: hidden;
  color: var(--muted);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-size {
  max-width: 76%;
  overflow: visible;
  white-space: normal;
}

.material-list {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
}

.material-empty {
  padding: 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px dashed #c8d2d7;
  border-radius: var(--radius);
  font-size: 12px;
}

.material-chip {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.material-chip img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-muted);
}

.material-chip span {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-chip .material-remove {
  min-height: 32px;
  padding: 0 10px;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  background: #111417;
}

.image-preview-blur {
  position: absolute;
  inset: -40px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  filter: blur(24px) saturate(1.02);
  opacity: 0.68;
  transform: translateZ(0) scale(1.04);
  pointer-events: none;
}

.image-preview-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  padding: 20px;
  contain: layout paint size;
}

.image-preview-stage img {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  object-fit: contain;
  border-radius: 0;
  transform: translate3d(var(--preview-pan-x, 0px), var(--preview-pan-y, 0px), 0) scale(var(--preview-zoom, 1));
  transform-origin: center center;
  will-change: transform;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  contain: paint;
  backface-visibility: hidden;
}

.image-preview-stage img.is-zoomed {
  cursor: grab;
}

.image-preview-overlay.is-panning,
.image-preview-overlay.is-panning .image-preview-stage img {
  cursor: grabbing;
}

.image-preview-nav {
  position: fixed;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 72px;
  padding: 0;
  color: oklch(94% 0.006 238);
  background: oklch(18% 0.018 238 / 0.76);
  border: 1px solid oklch(72% 0.018 238 / 0.28);
  border-radius: 8px;
  font-size: 44px;
  font-weight: 520;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.image-preview-nav:hover {
  background: oklch(24% 0.022 238 / 0.9);
}

.image-preview-nav:disabled {
  opacity: 0.32;
}

.image-preview-prev {
  left: 18px;
}

.image-preview-next {
  right: 18px;
}

.image-preview-rating {
  position: fixed;
  right: 50%;
  bottom: 18px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
  width: min(320px, calc(100vw - 132px));
  margin: 0;
  padding: 8px;
  background: oklch(18% 0.018 238 / 0.78);
  border: 1px solid oklch(72% 0.018 238 / 0.26);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  transform: translateX(50%);
}

.image-preview-rating .image-rating-button {
  min-height: 34px;
  color: oklch(86% 0.008 238);
  background: oklch(24% 0.018 238 / 0.9);
  border-color: oklch(72% 0.018 238 / 0.2);
}

.image-preview-rating .image-rating-button:hover {
  color: oklch(96% 0.006 238);
  background: oklch(30% 0.02 238 / 0.95);
  border-color: oklch(82% 0.018 238 / 0.34);
}

.image-preview-rating .image-rating-button[data-rating-value="usable"].is-active {
  color: oklch(93% 0.05 158);
  background: oklch(36% 0.068 158 / 0.88);
  border-color: oklch(70% 0.075 158 / 0.46);
}

.image-preview-rating .image-rating-button[data-rating-value="favorite"].is-active {
  color: oklch(94% 0.06 86);
  background: oklch(40% 0.075 86 / 0.88);
  border-color: oklch(76% 0.09 86 / 0.46);
}

.image-preview-rating .image-rating-button[data-rating-value="reject"].is-active {
  color: oklch(94% 0.045 28);
  background: oklch(38% 0.078 28 / 0.88);
  border-color: oklch(72% 0.086 28 / 0.46);
}

/* Home UI refinement: compact industrial workspace */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  background: var(--bg);
}

.controls {
  border-right-color: var(--line-strong);
}

.sidebar-scroll {
  padding: 14px 16px 12px;
}

.sidebar-account-cluster.compact-tool-cluster {
  grid-template-columns: repeat(4, 34px) minmax(96px, 1fr);
  align-items: stretch;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom-color: var(--line-strong);
}

.compact-info-chip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  align-content: center;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  border-radius: 6px;
}

.sidebar-account-cluster.compact-tool-cluster .account-inline {
  width: 34px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
  justify-content: center;
}

.sidebar-account-cluster.compact-tool-cluster .account-inline div {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.compact-route-chip > span,
.compact-route-chip > strong {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.badge-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.compact-info-chip:hover .badge-icon,
.compact-info-chip:focus-visible .badge-icon {
  color: var(--ink);
}

.sidebar-account-cluster .compact-account-actions {
  display: contents;
  grid-column: auto;
}

.sidebar-account-cluster .compact-account-actions .sidebar-action-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
}

.sidebar-account-cluster.compact-tool-cluster .top-workflow-launch {
  width: auto;
  min-width: 104px;
  min-height: 34px;
  height: 34px;
  margin: 0;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.sidebar-account-cluster.compact-tool-cluster .top-workflow-launch:hover,
.sidebar-account-cluster.compact-tool-cluster .top-workflow-launch:focus-visible {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line-strong);
  outline: none;
}

.icon-button,
.project-action-icon,
.sidebar-action-icon,
.image-action-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
}

.icon-button svg,
.workflow-launch svg,
.image-action-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sidebar-action-icon {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.sidebar-action-icon:hover,
.sidebar-action-icon:focus-visible,
.project-action-icon:hover,
.project-action-icon:focus-visible {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line-strong);
  outline: none;
}

.section-title {
  min-height: 30px;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.section-title h2,
.compact-details summary span:first-child {
  font-size: 12px;
  letter-spacing: 0;
}

.section-title span,
.compact-details summary span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 680;
  text-overflow: ellipsis;
}

.compact-details {
  border: 1px solid transparent;
  border-radius: 6px;
}

.compact-details summary {
  min-height: 34px;
  padding: 0 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compact-details[open] summary {
  border-color: var(--line-strong);
}

.favorite-body,
.advanced-body {
  padding: 9px 0 0;
}

.favorite-actions {
  gap: 6px;
}

.mode-tabs {
  margin-bottom: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mode-option span {
  min-height: 31px;
  border-radius: 5px;
}

label {
  margin-bottom: 9px;
  font-size: 12px;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: 6px;
}

input,
select {
  height: 34px;
}

textarea {
  line-height: 1.45;
}

.drop-zone {
  border-radius: 6px;
}

.dimension-readout {
  border-color: oklch(84% 0.036 164);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.sidebar-footer {
  border-top-color: var(--line-strong);
}

.count-control {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.generate-button {
  border-radius: 6px;
}

.workflow-launch {
  gap: 7px;
  border-radius: 6px;
}

.gallery-shell {
  padding: 14px 18px 28px;
  background:
    linear-gradient(oklch(45% 0.01 238 / 0.025) 1px, transparent 1px),
    linear-gradient(90deg, oklch(45% 0.01 238 / 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px;
}

.project-strip {
  grid-template-columns: minmax(220px, 280px) 34px 34px minmax(240px, 0.65fr) auto;
  gap: 7px;
  padding: 7px;
  border-color: var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-raised);
}

.project-strip span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.select-wrapper {
  display: inline-flex;
  min-width: 0;
}

.project-select-wrapper,
.project-select-wrapper select {
  width: 100%;
}

.project-strip select {
  height: 34px;
  background: var(--surface-soft);
  font-weight: 720;
}

.local-folder-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 9px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1;
}

.project-strip .local-folder-status {
  display: inline-flex;
  align-items: center;
}

.project-strip .gallery-main-actions {
  min-width: 34px;
}

.gallery-main-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.guide-open-button {
  color: var(--text);
}

.gallery-toolbar {
  margin: -2px 0 12px;
  padding: 6px;
  background: var(--surface);
  border-color: var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.gallery-filter-button {
  min-height: 30px;
  border-radius: 5px;
  font-size: 11px;
}

.gallery-size-control {
  border-left-color: var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.gallery-grid {
  gap: 12px;
}

.image-card {
  border-color: var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.image-card:hover {
  border-color: oklch(72% 0.015 238);
  box-shadow: var(--shadow-raised);
}

.image-frame,
.image-link {
  background: var(--surface-muted);
}

.action-overlay {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 8px;
  background: transparent;
  transform: translateY(-2px);
  transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1), transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.image-card:hover .action-overlay,
.image-card:focus-within .action-overlay {
  transform: translateY(0);
}

.compact-action-grid {
  display: inline-flex;
  width: auto;
  gap: 6px;
  padding: 4px;
  background: oklch(98% 0.004 238 / 0.92);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(27, 33, 38, 0.12);
}

.action-grid .image-action-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border-color: transparent;
}

.action-grid .image-action-button:hover,
.action-grid .image-action-button:focus-visible {
  color: oklch(97% 0.004 238);
  background: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.action-grid .image-delete {
  grid-column: auto;
  color: var(--red);
}

.action-grid .image-delete:hover,
.action-grid .image-delete:focus-visible {
  color: oklch(97% 0.004 238);
  background: var(--red);
  border-color: var(--red);
}

.image-info {
  padding: 9px;
}

.image-prompt {
  margin-bottom: 7px;
  font-size: 12px;
}

.image-rating-group {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 8px;
}

.image-rating-button {
  min-height: 26px;
  border-radius: 5px;
  font-size: 11px;
}

.image-info dl div {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.wall-task-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.wall-task-actions .task-icon-button {
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
}

.wall-task-actions .task-icon-button svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.wall-task-actions .task-icon-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Taste minimal polish: preserve layout, refine material and states */
:root {
  --bg: oklch(98.4% 0.003 238);
  --surface: oklch(99.2% 0.002 238);
  --surface-soft: oklch(96.9% 0.004 238);
  --surface-muted: oklch(93.8% 0.006 238);
  --ink: oklch(20.5% 0.012 238);
  --text: oklch(35% 0.012 238);
  --muted: oklch(53% 0.011 238);
  --faint: oklch(68% 0.009 238);
  --line: oklch(89% 0.006 238);
  --line-strong: oklch(81% 0.008 238);
  --accent: oklch(20.5% 0.012 238);
  --accent-hover: oklch(16.5% 0.012 238);
  --shadow: 0 1px 2px oklch(20% 0.012 238 / 0.035);
  --shadow-raised: 0 8px 18px oklch(20% 0.012 238 / 0.075);
  --shadow-soft: 0 6px 16px oklch(20% 0.012 238 / 0.055);
  --focus-ring: 0 0 0 2px oklch(20% 0.012 238 / 0.08);
  --radius: 7px;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.controls {
  background: var(--surface);
  border-right-color: var(--line);
}

.sidebar-scroll {
  padding: 14px 15px 12px;
}

.sidebar-footer {
  background: color-mix(in oklch, var(--surface) 88%, var(--surface-soft));
  border-top-color: var(--line);
}

label {
  color: var(--text);
  font-weight: 680;
}

label > span:first-child {
  color: var(--text);
}

input,
select,
textarea {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.34);
  transition:
    background 150ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 150ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

input::placeholder,
textarea::placeholder {
  color: oklch(70% 0.008 238);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  background: var(--surface);
  border-color: var(--ink);
  box-shadow: var(--focus-ring);
  outline: none;
}

button,
.secondary-button,
.workflow-launch,
.gallery-filter-button,
.image-rating-button {
  transition:
    background 150ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 150ms cubic-bezier(0.22, 1, 0.36, 1),
    color 150ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 150ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 120ms cubic-bezier(0.22, 1, 0.36, 1);
}

button:focus-visible,
.secondary-button:focus-visible,
.workflow-launch:focus-visible,
.gallery-filter-button:focus-visible,
.image-rating-button:focus-visible {
  border-color: var(--ink);
  box-shadow: var(--focus-ring);
  outline: none;
}

.primary-button,
.generate-button {
  color: oklch(98% 0.003 238);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.08);
}

.primary-button:hover,
.generate-button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.generate-button {
  letter-spacing: 0;
}

.ghost-button,
.secondary-button,
.sidebar-action-icon,
.project-action-icon,
.compact-info-chip,
.sidebar-account-cluster.compact-tool-cluster .top-workflow-launch {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

.ghost-button:hover,
.secondary-button:hover,
.sidebar-action-icon:hover,
.sidebar-action-icon:focus-visible,
.project-action-icon:hover,
.project-action-icon:focus-visible,
.compact-info-chip:hover,
.compact-info-chip:focus-visible,
.sidebar-account-cluster.compact-tool-cluster .top-workflow-launch:hover,
.sidebar-account-cluster.compact-tool-cluster .top-workflow-launch:focus-visible {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.section-title {
  border-bottom-color: var(--line);
}

.section-title h2,
.compact-details summary span:first-child {
  color: var(--ink);
  font-weight: 760;
}

.compact-details summary {
  background: var(--surface-soft);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.28);
}

.compact-details summary:hover,
.compact-details summary:focus-visible,
.compact-details[open] summary {
  background: var(--surface);
  border-color: var(--line-strong);
}

.mode-tabs,
.view-switch,
.auth-tabs {
  background: var(--surface-soft);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.32);
}

.mode-option span,
.view-switch-button,
.auth-tab {
  color: var(--muted);
}

.mode-option input:checked + span,
.view-switch-button.is-active,
.auth-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.drop-zone {
  background: var(--surface-soft);
  border-color: oklch(82% 0.011 238);
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  background: var(--surface);
  border-color: var(--ink);
  box-shadow: var(--focus-ring);
  outline: none;
}

.dimension-readout {
  color: oklch(39% 0.095 164);
  background: oklch(96.5% 0.025 164);
  border: 1px solid oklch(85% 0.035 164);
}

.count-control,
.reference-preview,
.task-panel,
.auth-panel,
.api-routing-dialog,
.project-image-panel {
  box-shadow: var(--shadow);
}

.gallery-shell {
  background:
    linear-gradient(oklch(45% 0.006 238 / 0.014) 1px, transparent 1px),
    linear-gradient(90deg, oklch(45% 0.006 238 / 0.014) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
}

.project-strip,
.gallery-toolbar {
  background: color-mix(in oklch, var(--surface) 94%, var(--surface-soft));
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.project-strip:hover,
.gallery-toolbar:hover {
  border-color: var(--line-strong);
}

.project-strip select,
.local-folder-status {
  background: var(--surface-soft);
  border-color: var(--line);
}

.project-strip select:focus-visible {
  background: var(--surface);
}

.gallery-filter-button {
  color: var(--muted);
  border-color: transparent;
}

.gallery-filter-button:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.gallery-filter-button.is-active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.gallery-size-control {
  border-left-color: var(--line);
}

.empty-state {
  min-height: 148px;
  color: var(--muted);
  background: oklch(99% 0.002 238 / 0.72);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.34);
}

.image-card,
.wall-task-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.image-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.image-card.is-selected,
.wall-task-card.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px oklch(20% 0.012 238 / 0.11);
}

.image-card.is-selected::after,
.wall-task-card.is-selected::after {
  color: oklch(98% 0.003 238);
  background: var(--accent);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.compact-action-grid {
  background: oklch(99% 0.002 238 / 0.94);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.action-grid .image-action-button:hover,
.action-grid .image-action-button:focus-visible {
  box-shadow: none;
}

.image-rating-button {
  background: var(--surface-soft);
  border-color: var(--line);
}

.image-rating-button:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.message {
  line-height: 1.35;
}

body.guide-active {
  cursor: default;
}

.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.guide-dim {
  position: absolute;
  inset: 0;
  background: oklch(18% 0.012 238 / 0.34);
}

.guide-spotlight {
  position: fixed;
  z-index: 1;
  border: 1px solid oklch(98% 0.003 238 / 0.9);
  border-radius: 9px;
  box-shadow:
    0 0 0 9999px oklch(18% 0.012 238 / 0.36),
    0 10px 28px oklch(18% 0.012 238 / 0.16);
  pointer-events: none;
  transition:
    top 180ms cubic-bezier(0.22, 1, 0.36, 1),
    left 180ms cubic-bezier(0.22, 1, 0.36, 1),
    width 180ms cubic-bezier(0.22, 1, 0.36, 1),
    height 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.guide-card {
  position: fixed;
  z-index: 2;
  width: min(324px, calc(100vw - 28px));
  padding: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 18px 38px oklch(18% 0.012 238 / 0.18);
  pointer-events: auto;
  transition:
    top 180ms cubic-bezier(0.22, 1, 0.36, 1),
    left 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.guide-card-head,
.guide-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.guide-step-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 760;
}

.guide-close-button {
  min-height: 28px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 720;
}

.guide-close-button:hover,
.guide-close-button:focus-visible {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

.guide-card h2 {
  margin: 12px 0 6px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.guide-card p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.guide-actions {
  margin-top: 14px;
}

.guide-actions .ghost-button,
.guide-actions .primary-button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
}

.guide-actions .ghost-button:disabled {
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.62;
}

.guide-arrow {
  position: fixed;
  z-index: 3;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 18px oklch(18% 0.012 238 / 0.12);
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(45deg);
  transition:
    top 180ms cubic-bezier(0.22, 1, 0.36, 1),
    left 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.guide-arrow[data-placement="right"] {
  border-top: 0;
  border-right: 0;
}

.guide-arrow[data-placement="left"] {
  border-bottom: 0;
  border-left: 0;
}

.guide-arrow[data-placement="bottom"] {
  border-right: 0;
  border-bottom: 0;
}

.guide-arrow[data-placement="top"] {
  border-top: 0;
  border-left: 0;
}

.guide-arrow[data-placement="hidden"] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .controls {
    width: 100%;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .sidebar-scroll {
    max-height: none;
    overflow: visible;
  }

  .sidebar-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    box-shadow: 0 -3px 10px rgba(27, 33, 38, 0.05);
  }

  .image-preview-nav {
    width: 40px;
    height: 58px;
    font-size: 36px;
  }

  .image-preview-prev {
    left: 10px;
  }

  .image-preview-next {
    right: 10px;
  }

  .image-preview-rating {
    bottom: 12px;
    width: min(300px, calc(100vw - 24px));
  }

  .gallery-shell {
    height: auto;
    min-height: 60vh;
    overflow: visible;
    padding: 14px 14px 28px;
  }
}

@media (max-width: 640px) {
  .sidebar-scroll,
  .sidebar-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .split-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .auth-code-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .auth-code-row .secondary-button {
    width: 100%;
    margin-bottom: 14px;
  }

  .favorite-actions,
  .api-actions {
    grid-template-columns: 1fr;
  }

  .gallery-toolbar {
    align-items: stretch;
  }

  .guide-card {
    left: 14px !important;
    right: 14px;
    width: calc(100vw - 28px) !important;
    max-width: none;
  }

  .guide-card h2 {
    font-size: 15px;
  }

  .project-strip {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--gallery-thumb-size, 230px)), 1fr));
  }

  .gallery-size-control {
    border-left: 0;
    padding-left: 0;
  }

  .gallery-head,
  .task-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .gallery-head {
    flex-direction: column;
  }

  .gallery-main-actions,
  .account-strip {
    width: 100%;
  }

  .gallery-main-actions {
    flex-direction: row;
    align-items: stretch;
  }

  .workspace-title-block {
    width: 100%;
    align-items: flex-start;
  }

  .account-inline {
    width: auto;
    padding-left: 0;
    border-left: 0;
  }

  .compact-tool-cluster {
    grid-template-columns: 1fr;
  }

  .workspace-account-actions {
    width: 100%;
  }

  .workspace-account-actions .secondary-button,
  .workspace-account-actions .ghost-button,
  .gallery-main-actions .ghost-button {
    flex: 1 1 auto;
  }

  .view-switch {
    width: 100%;
  }

  .workspace-launch {
    width: 100%;
  }

  .gallery-head .button-row,
  #refreshButton {
    width: 100%;
  }
}
