:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, 0.94);
  --text: #101828;
  --muted: #667085;
  --line: #d8e1ed;
  --soft-line: rgba(112, 132, 158, 0.24);
  --accent: #1677ff;
  --accent-dark: #0f55bd;
  --accent-soft: #e8f2ff;
  --success: #12b76a;
  --danger: #f04438;
  --warm: #fff4f2;
  --shadow: 0 18px 48px rgba(20, 42, 72, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

button {
  border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(300px, 22vw, 320px) minmax(0, 1fr);
  height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
  border-right: 1px solid var(--soft-line);
  background: rgba(244, 248, 252, 0.92);
  font-size: 12px;
}

.sidebar select {
  min-height: 38px;
  padding: 9px 11px;
  font-size: 12px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 4px;
}

.mobile-share-button {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 72px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.customer-service-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(22, 119, 255, 0.35);
  border-radius: 7px;
  color: var(--accent-dark);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.customer-service-button:hover,
.customer-service-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.share-symbol {
  font-size: 18px;
  line-height: 1;
}

.image-host-key-field { margin-top: 10px; }
.image-host-key-field input { min-height: 34px; font-size: 11px; }
.notice-dialog { width: min(420px, calc(100vw - 24px)); }
.notice-dialog form, .share-dialog form { display: grid; gap: 16px; }
.notice-dialog .authorization-dialog-head p, .share-dialog .authorization-dialog-head p { line-height: 1.65; }
.share-dialog { width: min(460px, calc(100vw - 24px)); }
.share-dialog img { width: 100%; aspect-ratio: 5 / 4; object-fit: cover; border: 1px solid var(--soft-line); border-radius: 8px; }
.customer-service-dialog { width: min(440px, calc(100vw - 24px)); }
.customer-service-dialog form { display: grid; gap: 16px; }
.customer-service-hours { padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.customer-service-list { display: grid; gap: 10px; }
.customer-service-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); text-decoration: none; background: #fff; }
.customer-service-item:hover, .customer-service-item:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.customer-service-icon { display: grid; place-items: center; min-height: 30px; border-radius: 5px; color: var(--accent-dark); background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.customer-service-item strong, .customer-service-item small { display: block; }
.customer-service-item strong { font-size: 13px; }
.customer-service-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: visible;
  border-radius: 12px 12px 12px 4px;
  background: linear-gradient(135deg, #1677ff, #13b8a6);
  transform: rotate(-8deg);
  box-shadow: 0 8px 16px rgba(22, 119, 255, 0.22);
}

.brand-orbit {
  position: absolute;
  width: 23px;
  height: 15px;
  border: 3px solid #fff;
  border-radius: 50%;
  transform: rotate(-12deg);
}

.brand-eye {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
}

.brand-tail {
  position: absolute;
  right: -8px;
  top: 13px;
  width: 15px;
  height: 16px;
  border: 3px solid #ff5b68;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  transform: rotate(-22deg);
}

.brand-dot {
  position: absolute;
  left: 7px;
  bottom: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffcf5a;
}

.brand-block h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
}

.brand-block p,
.section-head p,
.hint,
.history-empty,
.dock-empty {
  color: var(--muted);
}

.brand-block p {
  margin: 4px 0 0;
  font-size: 13px;
}

.panel {
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(20, 42, 72, 0.08);
}

.mode-panel,
.primary-panel {
  border-color: rgba(22, 119, 255, 0.24);
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.section-head > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  color: var(--accent-dark);
  font-weight: 800;
  background: var(--accent-soft);
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.section-head p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.field {
  display: block;
  margin-top: 12px;
}

.prompt-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

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

.prompt-tool-button,
.quality-option {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.prompt-tool-button {
  padding: 6px 8px;
}

.prompt-tool-button:hover,
.quality-option:hover {
  color: var(--accent-dark);
  border-color: rgba(22, 119, 255, 0.4);
}

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

.channel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-height: 28px;
  margin-top: 9px;
  padding: 7px 9px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: #f8fafc;
  font-size: 11px;
  line-height: 1.4;
}

.channel-meta strong {
  color: var(--text);
}

.quality-option {
  min-height: 46px;
  padding: 8px 6px;
}

.quality-option span,
.quality-option small {
  display: block;
}

.quality-option small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

.quality-option.active {
  color: var(--accent-dark);
  border-color: rgba(22, 119, 255, 0.58);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(22, 119, 255, 0.14);
}

.quality-option.locked {
  color: #98a2b3;
  border-color: #d7dce3;
  background: #f3f5f7;
  cursor: not-allowed;
}

.quality-option.locked::after {
  content: " · 需升级";
  display: block;
  font-size: 10px;
}

.prompt-label-row > span {
  font-size: 13px;
  font-weight: 800;
}

.prompt-expand-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(22, 119, 255, 0.28);
  border-radius: 7px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.prompt-expand-button:hover {
  border-color: var(--accent);
  background: #dbeaff;
}

.prompt-expand-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(22, 119, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.12);
}

.secret-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.icon-button,
.mini-actions button,
.toolbar-actions button,
.prompt-chips button,
.mode-button,
.secondary-button,
.history-actions button,
.history-actions a,
.latest-preview-actions button,
.latest-preview-actions a,
.history-tile button,
.history-tile a,
.drag-handle,
.image-node-toolbar button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
}

.key-visibility-button {
  display: grid;
  place-items: center;
  min-width: 44px;
}

.eye-icon {
  position: relative;
  display: block;
  width: 21px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 75% 15%;
  transform: rotate(45deg);
}

.eye-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.eye-closed {
  width: 22px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 50% 50% 0 0;
  transform: rotate(0deg);
}

.eye-closed::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -2px;
  width: 24px;
  border-top: 2px solid currentColor;
  transform: rotate(-28deg);
}

.eye-closed::after {
  display: none;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-button {
  padding: 11px 12px;
  font-weight: 800;
  color: var(--muted);
  background: #f9fbff;
}

.mode-button.active {
  color: var(--accent-dark);
  border-color: rgba(22, 119, 255, 0.4);
  background: var(--accent-soft);
}

.secondary-button {
  padding: 11px 14px;
  font-weight: 800;
}

.authorization-state-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
}

.authorization-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.authorization-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.primary-panel .authorization-actions {
  flex: 1 1 auto;
  margin-top: 0;
}

.primary-panel .authorization-actions button {
  min-width: 0;
}

.section-head .authorization-state-row p {
  margin: 0;
}

.authorization-state-row p:not(.authorized) {
  flex-basis: 100%;
}

.authorization-button {
  flex-basis: 100%;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.authorization-button.authorized {
  flex: 0 0 auto;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.authorization-button.authorized:hover {
  color: var(--accent-dark);
}

#authorizationStatus.authorized {
  color: #067647;
  font-weight: 800;
}

.authorization-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
}

.authorization-dialog::backdrop {
  background: rgba(16, 24, 40, 0.48);
}

.authorization-dialog form {
  max-height: calc(100vh - 24px);
  padding: 20px;
  overflow-y: auto;
}

.user-entry-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 1px solid rgba(112, 132, 158, 0.22);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 72px rgba(20, 42, 72, 0.24);
}

.user-entry-form {
  position: relative;
  padding: 34px 34px 28px !important;
  background:
    radial-gradient(circle at 16% 0%, rgba(22, 119, 255, 0.08), transparent 34%),
    linear-gradient(155deg, #ffffff 0%, #f7fbff 58%, #ffffff 100%);
}

.user-entry-form,
.user-entry-form * {
  min-width: 0;
}

.user-entry-head {
  justify-content: center;
  text-align: center;
}

.user-entry-head > div {
  width: 100%;
}

.user-entry-head h2 {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.user-entry-head p {
  margin-top: 8px;
  color: var(--text);
  font-size: 15px;
}

.user-entry-head .dialog-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
}

.registration-entry-dialog .trial-subsection {
  margin-top: 28px;
  padding: 0;
  border: 0;
  background: transparent;
}

.entry-section-title {
  color: var(--muted);
  font-size: 12px !important;
  font-weight: 700;
}

.registration-entry-dialog .field-grid {
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 4px;
}

.entry-field {
  margin-top: 12px;
}

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

.user-entry-form .entry-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  font-size: inherit;
  font-weight: inherit;
  box-shadow: 0 3px 12px rgba(20, 42, 72, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.entry-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.14);
}

.entry-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  flex: 0 0 46px;
  color: #7c8798;
  font-size: 23px;
  font-weight: 500;
}

.entry-input-wrap input {
  width: auto;
  flex: 1 1 auto;
  min-height: 50px;
  padding: 0 14px 0 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
}

.registration-entry-dialog .trial-sms-row {
  display: block;
  margin-top: 0;
}

.verification-control input {
  min-width: 80px;
}

.verification-send-button {
  min-height: 34px;
  flex: 0 0 auto;
  margin-right: 8px;
  padding: 0 10px;
  border-left: 1px solid var(--soft-line);
  color: var(--accent-dark);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.verification-send-button:disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

.user-entry-primary,
.entry-primary-actions #saveAuthorization {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #1694ff, var(--accent));
  box-shadow: 0 10px 22px rgba(22, 119, 255, 0.24);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.user-entry-primary:disabled,
.entry-primary-actions #saveAuthorization:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.entry-status {
  margin-top: 10px !important;
  overflow-wrap: anywhere;
  text-align: center;
}

.entry-status:empty {
  display: none;
}

.entry-switch-actions {
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
}

.entry-switch-actions::before,
.entry-switch-actions::after {
  width: 34px;
  height: 1px;
  flex: 0 0 34px;
  background: var(--soft-line);
  content: "";
}

.entry-switch-actions .text-button {
  color: var(--accent-dark);
}

.access-entry-dialog .user-entry-form {
  padding-top: 52px !important;
}

.access-code-field {
  margin-top: 34px;
}

.access-code-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  font-size: 15px;
  font-weight: 800;
}

.entry-help {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: #aab4c2;
  font-size: 12px;
}

.access-code-input-wrap input {
  padding: 0 14px;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.access-code-example {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.access-entry-dialog .entry-primary-actions {
  display: grid;
  justify-content: stretch;
  gap: 6px;
  margin-top: 0;
}

.access-entry-dialog .entry-primary-actions #saveAuthorization {
  width: 100%;
  margin-top: 22px;
}

.access-entry-dialog .entry-primary-actions #cancelAuthorization {
  justify-self: center;
}

.access-entry-links {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 36px;
}

.access-register-link {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.access-register-link::before {
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--accent-dark);
  content: "↩";
  font-size: 28px;
}

.access-register-link strong {
  font-size: 15px;
}

.access-register-link span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.access-entry-links .purchase-link {
  margin: 0;
}

.compact-dialog {
  width: min(420px, calc(100vw - 24px));
}

.member-dialog {
  width: min(520px, calc(100vw - 24px));
}

.payment-dialog {
  width: min(560px, calc(100vw - 24px));
}

.clean-section {
  margin-top: 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

.dialog-link-actions,
.member-dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.member-dialog-actions {
  justify-content: flex-end;
}

.text-button {
  padding: 4px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  color: var(--accent-dark);
  background: transparent;
}

.purchase-link {
  display: block;
  margin: 12px auto 0;
}

.trial-code-result {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.trial-code-result > span,
.trial-limit-note {
  color: var(--muted);
  font-size: 12px;
}

.trial-code-result code {
  display: block;
  padding: 13px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #f8fafc;
  font-size: 14px;
  line-height: 1.5;
}

.trial-code-result .secondary-button,
.primary-dialog-button {
  width: 100%;
}

.trial-limit-note {
  margin: 12px 0;
  line-height: 1.6;
}

.authorization-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.authorization-dialog-head h2,
.authorization-dialog-head p {
  margin: 0;
}

.authorization-dialog-head h2 {
  font-size: 18px;
}

.authorization-dialog-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-close-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.authorization-error {
  margin: 12px 0 0;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

.authorization-subsection {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--soft-line);
}

.authorization-subsection h3,
.authorization-subsection p {
  margin: 0;
}

.authorization-subsection h3 {
  font-size: 14px;
}

.authorization-subsection p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.authorization-subsection .field-grid {
  margin-top: 0;
}

.trial-subsection {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f8fafc;
}

.trial-subsection h3,
.trial-subsection p {
  margin: 0;
}

.trial-subsection h3 {
  font-size: 14px;
}

.trial-subsection > p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.trial-subsection .field-grid {
  margin-top: 10px;
}

.trial-sms-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.trial-sms-row .field {
  min-width: 0;
}

.trial-subsection .trial-sms-row .secondary-button {
  width: 148px;
  margin-top: 0;
  white-space: nowrap;
}

.trial-subsection .secondary-button {
  width: 100%;
  margin-top: 10px;
}

.member-center {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.member-center-head,
.member-summary,
.record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.member-center h3,
.member-center h4,
.member-center p {
  margin: 0;
}

.member-center-head h3 {
  font-size: 15px;
}

.member-center-head p,
.member-center > p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

#memberBadge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid #a6f4c5;
  border-radius: 999px;
  color: #067647;
  background: #ecfdf3;
  font-size: 12px;
}

.member-summary {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: #fff;
}

.member-summary div {
  min-width: 0;
}

.member-summary span,
.member-code-button {
  display: block;
}

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

.member-code-button {
  max-width: 260px;
  margin-top: 3px;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-code-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.member-summary .secondary-button {
  width: auto;
  flex: 0 0 auto;
}

.member-records {
  margin-top: 14px;
}

.member-records h4 {
  margin-top: 12px;
  font-size: 13px;
}

.record-list {
  margin-top: 6px;
  border-top: 1px solid var(--soft-line);
}

.record-row {
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft-line);
  font-size: 11px;
}

.record-row strong {
  max-width: 36%;
}

.record-row span {
  flex: 1;
  color: var(--muted);
}

.record-row time {
  color: var(--muted);
  white-space: nowrap;
}

.record-empty {
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.access-detail-content { margin-top: 14px; }
.access-detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.access-detail-summary div { padding: 10px; border: 1px solid var(--soft-line); border-radius: 6px; background: #f8fafc; }
.access-detail-summary span { display: block; color: var(--muted); font-size: 11px; }
.access-detail-summary strong { display: block; margin-top: 4px; font-size: 16px; }
.access-detail-section { margin-top: 16px; }
.access-detail-section h3 { margin: 0 0 6px; font-size: 13px; }

.upgrade-button {
  width: 100%;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid #f79009;
  border-radius: 8px;
  color: #9c2c00;
  background: #fff7ed;
  font-weight: 800;
  cursor: pointer;
}

.upgrade-button:hover {
  background: #ffedd5;
}

.payment-subsection {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--soft-line);
}

.payment-subsection h3,
.payment-subsection p {
  margin: 0;
}

.payment-subsection h3 {
  font-size: 15px;
}

.upgrade-benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.upgrade-benefits span {
  padding: 8px 6px;
  border: 1px solid #b2ddff;
  border-radius: 6px;
  color: #175cd3;
  background: #eff8ff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.payment-subsection > p,
.payment-status {
  margin-top: 5px !important;
  color: var(--muted);
  font-size: 12px;
}

.payment-method-field {
  margin-top: 12px;
}

.payment-coupon-field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.payment-coupon-field strong {
  font-size: 12px;
}

.payment-coupon-field p {
  color: var(--muted);
  font-size: 12px;
}

.payment-coupon-row {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 8px;
}

.payment-coupon-row input,
.payment-coupon-row button {
  min-width: 0;
  min-height: 42px;
}

.payment-coupon-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

.payment-coupon-row button {
  padding: 10px 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.payment-plan-summary {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid #b2ddff;
  border-radius: 6px;
  color: #175cd3;
  background: #eff8ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

#paymentAmount[readonly] {
  color: var(--text);
  background: #f2f4f7;
  cursor: default;
}

.payment-qr-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.payment-qr-card img {
  display: block;
  width: min(230px, 100%);
  max-height: 230px;
  object-fit: contain;
}

.payment-qr-card strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

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

.payment-form-grid .payment-wide {
  grid-column: 1 / -1;
}

.payment-form-grid .payment-new-code {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.payment-form-grid .payment-new-code input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 18px;
}

#submitPaymentOrder {
  width: 100%;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.payment-status.error {
  color: #b42318;
  font-weight: 700;
}

.payment-lookup {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--soft-line);
}

.payment-lookup h4 {
  margin: 0;
  font-size: 13px;
}

.payment-lookup .payment-form-grid {
  margin-top: 10px;
}

.payment-lookup .secondary-button {
  width: 100%;
  margin-top: 10px;
}

.records-dialog {
  width: min(680px, calc(100vw - 24px));
}

.records-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #f8fafc;
}

.records-tab {
  min-height: 36px;
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.records-tab.active {
  color: var(--accent-dark);
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1);
}

.records-panel {
  min-height: 180px;
  margin-top: 14px;
}

.records-panel .record-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1.6fr) auto;
}

.prompt-advisor-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
}

.prompt-advisor-dialog::backdrop {
  background: rgba(16, 24, 40, 0.48);
}

.prompt-advisor-shell {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto auto;
  max-height: calc(100vh - 24px);
  padding: 20px;
}

.prompt-advisor-messages {
  min-height: 180px;
  max-height: 360px;
  margin-top: 16px;
  padding: 14px;
  overflow-y: auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f8fafc;
}

.prompt-advisor-message {
  width: fit-content;
  max-width: 86%;
  margin: 0 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.prompt-advisor-message.user {
  margin-left: auto;
  border-color: rgba(22, 119, 255, 0.24);
  background: var(--accent-soft);
}

.prompt-advisor-message:last-child {
  margin-bottom: 0;
}

.prompt-advisor-input {
  display: block;
  margin-top: 14px;
}

.prompt-advisor-input span {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 800;
}

.prompt-advisor-input textarea {
  min-height: 82px;
  resize: vertical;
}

.prompt-advisor-actions,
.prompt-advisor-actions > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-advisor-actions {
  justify-content: space-between;
  margin-top: 14px;
}

#finishPromptAdvisor {
  padding: 11px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.authorization-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.authorization-actions #saveAuthorization {
  padding: 11px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.destructive-button {
  border-color: rgba(240, 68, 56, 0.28) !important;
  color: #b42318 !important;
  background: #fff4f2 !important;
}

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

.advanced-block {
  margin-top: 14px;
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
}

.advanced-block summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 13px;
}

.mini-actions,
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.model-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.model-pill {
  padding: 10px;
  border-radius: 8px;
  background: #f7faff;
  border: 1px solid var(--soft-line);
}

.model-pill span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.model-pill strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.prompt-chips button {
  padding: 8px 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: transparent;
  font-size: 12px;
  font-weight: 800;
}

.prompt-library-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  margin-top: 12px;
  padding: 10px 12px;
  color: #fff;
  background: linear-gradient(135deg, #172033 0%, #263b5b 100%);
  border: 1px solid #d7a84b;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(23, 32, 51, .18);
  text-decoration: none;
}

.prompt-library-button:hover {
  color: #fff;
  border-color: #f0c96a;
  box-shadow: 0 6px 16px rgba(23, 32, 51, .28);
}

.prompt-library-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #172033;
  background: #f0c96a;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 900;
}

.prompt-library-button strong,
.prompt-library-button small {
  display: block;
}

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

.prompt-library-button small {
  margin-top: 2px;
  color: #c8d3e6;
  font-size: 11px;
}

.prompt-library-arrow {
  margin-left: auto;
  color: #f0c96a;
  font-size: 20px;
}

.action-row,
.host-upload-row,
.history-actions-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.generate-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 15px 16px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #21a6ff);
  box-shadow: 0 16px 34px rgba(22, 119, 255, 0.26);
  cursor: pointer;
}

.generate-button span {
  font-size: 17px;
  font-weight: 900;
}

.generate-button small {
  opacity: 0.9;
}

.reference-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #f8fbff;
}

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

.reference-preview-image {
  position: relative;
}

.reference-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  background: #edf3fa;
}

.reference-preview strong {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(10, 23, 39, 0.84);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
}

.reference-preview-image button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: rgba(10, 23, 39, 0.84);
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
}

.reference-preview span {
  display: block;
  min-width: 0;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
}

.workspace-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--soft-line);
  background: rgba(255, 255, 255, 0.86);
}

.workspace-toolbar strong {
  display: block;
  font-size: 15px;
}

.workspace-toolbar span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-actions button {
  min-width: 40px;
  padding: 9px 11px;
  font-size: 13px;
}

.novice-board {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 24px;
  background: #f7fafc;
}

.novice-card {
  width: min(560px, 100%);
  padding: 26px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.novice-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.novice-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.canvas-viewport {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: #f8f6f1;
  cursor: grab;
  touch-action: none;
  padding-top: 56px;
  padding-right: 18px;
  padding-bottom: 18px;
  padding-left: 18px;
}

.canvas-hidden {
  display: none;
}

.canvas-viewport.dragging {
  cursor: grabbing;
}

.canvas-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 110, 95, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 110, 95, 0.09) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.9;
}

.canvas-content {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  transform-origin: 0 0;
  z-index: 2;
}

.empty-state {
  position: absolute;
  left: 50%;
  top: 47%;
  width: min(460px, calc(100% - 48px));
  padding: 28px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.image-node {
  position: absolute;
  width: 320px;
  border: 1px solid rgba(255, 100, 100, 0.25);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(20, 42, 72, 0.14);
  overflow: visible;
  user-select: none;
  cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.image-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 100, 100, 0.2);
  background: #fffafa;
}

.drag-handle {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}

.image-node-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent-dark);
  font-size: 13px;
}

.image-node-toolbar {
  display: flex;
  gap: 6px;
}

.image-node-toolbar button,
.image-node-toolbar .download-button {
  padding: 6px 7px;
  font-size: 12px;
}

.image-node-toolbar .download-button {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: inherit;
  background: #fff;
  text-decoration: none;
  cursor: pointer;
}

.image-node-canvas {
  display: grid;
  place-items: center;
  min-height: 190px;
  margin: 12px;
  border: 1px dashed rgba(255, 100, 100, 0.35);
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
}

.image-node-canvas img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  cursor: zoom-in;
}

.image-edit-result.is-running {
  border-color: rgba(22, 119, 255, 0.55);
}

.image-edit-result.is-error {
  border-color: rgba(220, 38, 38, 0.55);
}

.upscale-result.is-running {
  border-color: rgba(22, 119, 255, 0.55);
}

.upscale-progress {
  display: block;
  width: min(180px, 100%);
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #d9dee8;
}

.upscale-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: #1677ff;
  transition: width 180ms ease;
}

.upscale-hardware-note {
  max-width: 220px;
  color: #667085;
  font-size: 11px;
  line-height: 1.5;
}

.terminal-node .image-node-canvas {
  border-color: rgba(22, 119, 255, 0.28);
}

.image-edit-error {
  display: grid;
  width: 100%;
  min-height: 188px;
  padding: 18px;
  place-content: center;
  gap: 10px;
  color: var(--danger);
  text-align: left;
}

.image-edit-error span {
  max-height: 88px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.image-edit-error button {
  justify-self: start;
  padding: 8px 12px;
  border-color: rgba(22, 119, 255, 0.35);
  color: var(--accent-dark);
  background: #fff;
}

.image-node-note {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  min-height: 48px;
  margin: 0 12px 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.connection-dot {
  position: absolute;
  right: 8px;
  top: calc(50% - 9px);
  width: 18px;
  height: 18px;
  border: 2px solid #ff6464;
  border-radius: 50%;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
  z-index: 4;
}

.connection-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.connection-line path {
  fill: none;
  stroke: rgba(22, 119, 255, 0.62);
  stroke-width: 3px;
  stroke-linecap: round;
}

.connection-preview path {
  stroke: rgba(22, 119, 255, 0.46);
  stroke-dasharray: 8 8;
}

.workflow-step-menu {
  position: absolute;
  z-index: 20;
  display: grid;
  width: 164px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(20, 42, 72, 0.16);
}

.workflow-step-menu strong {
  padding: 6px 8px 8px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-step-menu .upscale-menu-title {
  margin-top: 5px;
  border-top: 1px solid var(--soft-line);
  padding-top: 10px;
}

.workflow-step-menu button {
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.workflow-step-menu button[data-upscale-target] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workflow-step-menu button[data-upscale-target] small {
  color: var(--muted);
  font-size: 10px;
}

.workflow-step-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.workflow-step-menu .local-engine-download {
  margin: 5px 4px 2px;
  padding: 7px 6px 3px;
  border-top: 1px solid var(--soft-line);
  color: var(--accent-dark);
  font-size: 11px;
  text-decoration: none;
}

.workflow-step-menu button:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.image-edit-node {
  width: 300px;
  padding-bottom: 12px;
}

.image-edit-source {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(42px, auto);
  align-items: center;
  gap: 10px;
  margin: 12px;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbff;
  font-size: 12px;
}

.image-edit-source img {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 6px;
  object-fit: cover;
}

.image-edit-reference-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  background: #fff;
  cursor: pointer;
  font-size: 22px;
}

.image-edit-references {
  display: flex;
  gap: 5px;
}

.image-edit-reference {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.image-edit-reference img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-edit-reference button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(17, 24, 39, 0.78);
  font-size: 14px;
  line-height: 18px;
}

.image-edit-field {
  display: block;
  margin: 0 12px 10px;
}

.image-edit-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.image-edit-field textarea,
.image-edit-field input,
.image-edit-field select {
  width: 100%;
}

.image-edit-field textarea {
  min-height: 92px;
  resize: vertical;
}

.image-edit-submit {
  width: calc(100% - 24px);
  margin: 0 12px;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.loading-box,
.error-box {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 190px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.generation-loading {
  gap: 10px;
  align-content: center;
  background: linear-gradient(135deg, #f5f9ff, #fff);
}

.generation-loading strong {
  color: var(--text);
  font-size: 14px;
}

.generation-loading small {
  color: var(--muted);
}

.generation-percent {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.generation-progress {
  width: min(220px, 88%);
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(22, 119, 255, 0.14);
}

.generation-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.45s ease;
}

.generation-elapsed {
  color: var(--muted);
  font-size: 12px;
}

.generation-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(22, 119, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: generation-spin 0.8s linear infinite;
}

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

.error-box {
  color: #b42318;
  background: #fff4f2;
}

.latest-preview {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfdff;
}

.latest-preview img,
.history-item img,
.history-tile img {
  object-fit: cover;
  background: #edf3fa;
}

.latest-preview img {
  width: 120px;
  height: 120px;
  border-radius: 6px;
}

.latest-preview-image,
.history-row-image {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.latest-preview-image {
  width: 120px;
  height: 120px;
}

.history-row-image {
  width: 76px;
  height: 76px;
}

.latest-preview-body {
  min-width: 0;
}

.latest-preview-body strong,
.history-body strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.latest-preview-body p,
.history-body p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 7px 0 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.latest-preview-actions,
.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.latest-preview-actions button,
.latest-preview-actions a,
.history-actions button,
.history-actions a {
  padding: 7px 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.empty-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--muted);
  text-align: center;
}

.image-host-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

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

.history-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfdff;
}

.history-item img {
  width: 76px;
  height: 76px;
  border-radius: 6px;
}

.history-body {
  min-width: 0;
}

.history-body > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
}

.history-empty {
  margin: 8px 0 0;
  font-size: 12px;
}

.history-dock {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  min-height: 150px;
  padding: 12px;
  border-top: 1px solid rgba(240, 68, 56, 0.24);
  background: var(--warm);
}

.history-dock-label h3 {
  margin: 0 0 6px;
  color: #b42318;
  font-size: 14px;
}

.history-dock-label p {
  margin: 0 0 10px;
  color: #b42318;
  font-size: 12px;
  line-height: 1.6;
}

.history-dock-label .secondary-button {
  width: 100%;
  padding: 9px 10px;
  font-size: 12px;
}

.history-dock-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 120px;
  gap: 8px;
  overflow-x: auto;
  align-items: start;
}

.history-tile {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(240, 68, 56, 0.26);
  border-radius: 8px;
  background: #fff;
}

.history-delete-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(20, 24, 28, 0.78);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.history-delete-button:hover {
  background: #b42318;
}

.history-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
}

.history-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.history-image-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.image-preview-dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 13, 18, 0.96);
  overflow: hidden;
}

.image-preview-dialog::backdrop {
  background: rgba(10, 13, 18, 0.82);
}

.image-preview-stage {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 64px 56px;
  overscroll-behavior: contain;
}

.image-preview-stage img {
  display: block;
  max-width: calc(100vw - 112px);
  max-height: calc(100vh - 128px);
  object-fit: contain;
  transform-origin: center;
  transition: transform 90ms ease-out;
  cursor: zoom-in;
  user-select: none;
}

.image-preview-close {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(20, 24, 28, 0.86);
  color: #fff;
  font-size: 30px;
  line-height: 38px;
  cursor: pointer;
}

.image-preview-download-tip {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 7px;
  background: rgba(20, 24, 28, 0.9);
  color: #fff;
  font-size: 14px;
}

.image-preview-download-tip button {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #9fcbff;
  font-weight: 700;
  cursor: pointer;
}

.history-image-dialog {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
}

.history-image-dialog::backdrop {
  background: rgba(16, 24, 40, 0.38);
}

.history-image-dialog strong {
  display: block;
  margin-bottom: 14px;
}

.history-image-dialog div {
  display: flex;
  gap: 8px;
}

.history-image-dialog button {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

.uploaded-image-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}


.history-tile div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.history-tile button,
.history-tile a {
  display: grid;
  place-items: center;
  min-height: 28px;
  padding: 5px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.dock-empty {
  align-self: center;
  margin: 0;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 940px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--soft-line);
  }

  .workspace {
    height: 78vh;
  }

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

  .image-node {
    width: 300px;
  }

  .workflow-step-menu .upscale-menu-title,
  .workflow-step-menu button[data-upscale-target],
  .workflow-step-menu .local-engine-download {
    display: none;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 12px;
  }

  .brand-block {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .brand-block h1 {
    font-size: 17px;
    line-height: 1.3;
  }

  .mobile-share-button {
    display: inline-flex;
  }

  .field-grid,
  .mini-actions,
  .action-row,
  .host-upload-row,
  .history-actions-head,
  .history-dock {
    grid-template-columns: 1fr;
  }

  .model-meta {
    grid-template-columns: 1fr;
  }

  .workspace {
    height: 74vh;
  }

  .history-dock-grid {
    grid-auto-columns: 108px;
  }

  .history-image-dialog {
    width: calc(100vw - 24px);
    max-width: none;
  }

  .image-preview-stage {
    padding: 58px 16px 84px;
  }

  .image-preview-stage img {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 142px);
  }

  .image-preview-close {
    top: 10px;
    right: 10px;
  }

  .image-preview-download-tip {
    right: 12px;
    bottom: 12px;
    left: 12px;
    justify-content: space-between;
  }

  .authorization-dialog {
    width: calc(100% - 24px);
  }

  .prompt-advisor-dialog {
    width: calc(100% - 24px);
  }

  .prompt-advisor-shell {
    padding: 16px;
  }

  .prompt-advisor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .prompt-advisor-actions > div,
  .prompt-advisor-actions button {
    width: 100%;
  }

  .authorization-dialog form {
    padding: 16px;
  }

  .user-entry-dialog {
    width: calc(100% - 24px);
    border-radius: 18px;
  }

  .user-entry-form,
  .access-entry-dialog .user-entry-form {
    padding: 42px 18px 22px !important;
  }

  .user-entry-head h2 {
    padding: 0 34px;
    font-size: 24px;
  }

  .user-entry-head p {
    font-size: 14px;
  }

  .user-entry-head .dialog-close-button {
    top: 12px;
    right: 12px;
  }

  .registration-entry-dialog .trial-subsection {
    margin-top: 22px;
  }

  .entry-input-wrap {
    min-height: 50px;
  }

  .entry-input-wrap input {
    min-height: 48px;
    font-size: 15px;
  }

  .entry-icon {
    width: 42px;
    flex-basis: 42px;
    font-size: 20px;
  }

  .verification-send-button {
    padding: 0 8px;
    font-size: 11px;
  }

  .entry-switch-actions {
    gap: 5px;
    margin-top: 20px;
  }

  .entry-switch-actions::before,
  .entry-switch-actions::after {
    width: 18px;
    flex-basis: 18px;
  }

  .access-code-field {
    margin-top: 30px;
  }

  .access-code-input-wrap input {
    font-size: 18px;
  }

  .access-entry-links {
    margin-top: 24px;
  }

  .history-image-dialog div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .history-image-dialog button,
  .uploaded-image-link {
    justify-content: center;
    min-width: 0;
  }
}
.canvas-action-bar {
  position: absolute;
  left: 50%;
  top: 14px;
  z-index: 4;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(15, 85, 189, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 30px rgba(20, 42, 72, 0.1);
  backdrop-filter: blur(14px);
}

.canvas-action-bar button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}
.image-node.selected {
  border-color: rgba(22, 119, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.16), 0 18px 40px rgba(20, 42, 72, 0.16);
}

.image-node:focus-visible {
  outline: 2px solid rgba(22, 119, 255, 0.85);
  outline-offset: 2px;
}

.icp-link {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.icp-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

@media (max-width: 560px) {
  .access-detail-summary { grid-template-columns: repeat(2, 1fr); }
  .member-dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .member-dialog-actions button {
    width: 100%;
  }

  .records-panel .record-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .records-panel .record-row strong {
    max-width: none;
  }

  .trial-sms-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .trial-subsection .trial-sms-row .secondary-button {
    width: 100%;
  }

  .payment-form-grid {
    grid-template-columns: 1fr;
  }

  .upgrade-benefits {
    grid-template-columns: 1fr;
  }

  .payment-form-grid .payment-wide {
    grid-column: auto;
  }

  .payment-qr-card img {
    max-height: 130px;
  }
}
