﻿:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-strong: #fbfdff;
  --text: #151a2d;
  --muted: #6b7280;
  --muted-2: #96a0b5;
  --line: #dfe5ef;
  --line-strong: #c9d3e4;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --red: #ef2b2d;
  --shadow: 0 14px 40px rgba(31, 41, 55, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 370px;
  --topbar-height: 86px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.08), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100%;
}

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 300px;
  min-width: 0;
  max-width: 520px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: block;
  filter: drop-shadow(0 14px 22px rgba(37, 99, 235, 0.24));
}

.brand-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 42px;
  min-width: 0;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted-2);
  letter-spacing: 0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-support {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 5px;
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid #d5e1f5;
  color: #1d4ed8;
  background: linear-gradient(180deg, #ffffff, #eef4ff);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.06);
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.support-link:hover {
  border-color: #b9cbee;
  background: #f8fbff;
}

.customer-top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: 999px;
  border-color: rgba(37, 99, 235, 0.35);
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
  appearance: none;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.customer-top-link:hover {
  border-color: rgba(29, 78, 216, 0.55);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.customer-top-link small {
  font-size: 9px;
  font-weight: 760;
  opacity: 0.9;
}

.support-note {
  min-width: 0;
  color: #7d8698;
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 34px;
  flex: 0 0 auto;
  height: 100%;
  min-width: max-content;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  color: #4b5563;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 650;
  text-decoration: none;
  min-width: max-content;
  white-space: nowrap !important;
}

.nav-link.active {
  color: var(--blue);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 10px 10px 0 0;
  background: var(--blue);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
  max-width: 100%;
}

.top-actions .small {
  white-space: nowrap;
}

html[lang="en"] .topbar {
  gap: 20px;
}

html[lang="en"] .brand {
  flex-basis: 280px;
  max-width: 480px;
}

html[lang="en"] .brand-subtitle {
  max-width: 440px;
}

html[lang="en"] .support-note {
  font-size: 9.5px;
}

html[lang="en"] .nav-links {
  gap: 28px;
}

html[lang="en"] .primary.small,
html[lang="en"] .secondary.small {
  padding-inline: 14px;
}

html[lang="en"] .user-chip {
  flex-basis: 190px;
  max-width: 190px;
}

html[lang="en"] .user-copy small {
  max-width: 146px;
}

.locale-switch {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  background: #eef3ff;
  border: 1px solid #d7e3fb;
}

.locale-btn {
  min-width: 42px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4b5563;
  font-weight: 700;
}

.locale-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.primary,
.secondary,
.icon-btn,
.tool,
.history-empty,
.thumb-card {
  border: 0;
  border-radius: var(--radius-sm);
}

.primary {
  color: #fff;
  background: var(--blue);
  font-weight: 760;
  padding: 13px 18px;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.18);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.primary:hover {
  background: var(--blue-dark);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.25);
}

.primary:disabled,
.secondary:disabled,
.tool:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.primary.small {
  padding: 9px 16px;
}

.secondary.small {
  padding: 9px 16px;
}

.primary.wide {
  width: 100%;
  margin-top: 18px;
  font-size: 16px;
}

.wide-secondary {
  width: 100%;
}

.control-card .wide-secondary {
  margin: 2px 0 10px;
}

.secondary {
  color: #293145;
  background: #fff;
  border: 1px solid var(--line-strong);
  font-weight: 700;
  padding: 13px 16px;
}

.secondary:hover {
  border-color: #b7c2d6;
  background: #f9fbff;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #111827;
  background: transparent;
  font-size: 22px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #1f2937;
  min-width: 0;
  flex: 0 1 220px;
  max-width: 220px;
}

.user-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.user-copy strong {
  font-size: 14px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  background: radial-gradient(circle at 40% 35%, #f59e0b, #334155 58%, #111827 100%);
}

.chevron {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "history canvas"
    "history composer";
  gap: 12px 18px;
  height: calc(100dvh - var(--topbar-height));
  min-height: 0;
  overflow: hidden;
  padding: 14px 22px;
  transition: grid-template-columns 0.18s ease;
}

.workspace.history-collapsed {
  grid-template-columns: 52px minmax(0, 1fr);
}

.sidebar {
  grid-area: composer;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(223, 229, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.control-card {
  padding: 22px;
}

.unified-control-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  grid-template-rows: auto auto;
  gap: 6px 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 28px;
  border-color: #d8e1ef;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.1);
}

.unified-control-card .section-heading {
  display: none;
}

.unified-control-card > .field-label {
  grid-column: 1 / -1;
  margin: 0;
}

.unified-control-card .prompt-box {
  grid-column: 1 / -1;
  grid-row: 1;
}

.unified-control-card .compact-controls {
  grid-column: 1;
  grid-row: 2;
}

.unified-control-card #generateBtn {
  grid-column: 2;
  grid-row: 2;
}

.unified-control-card .custom-size,
.unified-control-card .reference-list {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.step-index,
.section-heading h2,
.canvas-header h2,
.history-title-row h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  font-size: 13px;
  color: #505b70;
  font-weight: 700;
}

.textarea-wrap {
  position: relative;
}

.prompt-box textarea {
  min-height: 26px;
  max-height: 118px;
  overflow-y: hidden;
}

textarea,
select,
.text-input {
  width: 100%;
  color: #263040;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  min-height: 112px;
  padding: 14px 14px 28px;
  resize: none;
  line-height: 1.52;
}

.prompt-box textarea {
  padding: 0 4px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.45;
}

.textarea-wrap.tall textarea {
  min-height: 136px;
}

textarea::placeholder {
  color: #9aa4b5;
}

textarea:focus,
select:focus,
.text-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.prompt-box textarea:focus {
  box-shadow: none;
}

.counter {
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: #8a94a8;
  font-size: 12px;
}

.prompt-box .counter {
  display: none;
}

.composer-send {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #0f172a;
  background: #eef1f6;
  box-shadow: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.composer-send:hover {
  background: #e3e8f0;
  transform: translateY(-1px);
}

.composer-send:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.composer-send svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.composer-send.is-editing svg {
  transform: rotate(-45deg);
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-52%);
  color: #8a94a8;
  pointer-events: none;
}

select {
  appearance: none;
  height: 44px;
  padding: 0 38px 0 14px;
  font-weight: 650;
}

.text-input {
  height: 44px;
  padding: 0 14px;
  font-weight: 600;
}

.custom-size {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #dbe6f6;
}

.compact-controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 2px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.icon-pill,
.select-chip {
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid #d4deee;
  background: rgba(255, 255, 255, 0.92);
  color: #243047;
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.04);
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 820;
}

.attach-pill {
  width: 34px;
  flex: 0 0 34px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: #8a94a8;
  font-size: 27px;
  font-weight: 360;
  line-height: 1;
}

.icon-pill:hover,
.select-chip:hover {
  border-color: #b9c8df;
  background: #f8fbff;
}

.attach-pill:hover {
  border-color: transparent;
  background: #f2f5f9;
  color: #5d687a;
}

.icon-pill.subtle {
  color: #64748b;
}

.select-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  width: auto;
  min-width: max-content;
  padding: 0 9px 0 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.select-chip[for="sizeSelect"] {
  min-width: max-content;
}

.select-chip[for="outputFormatSelect"] {
  min-width: max-content;
}

.select-chip::after {
  content: "⌄";
  color: #7f8ba0;
  font-size: 12px;
}

.select-chip .chip-label {
  color: #5d687a;
}

.select-chip .chip-value {
  max-width: 88px;
  overflow: hidden;
  color: #10233f;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-chip select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: transparent;
  cursor: pointer;
  opacity: 1;
}

.select-chip select option {
  color: #0f172a;
  background: #fff;
  font-weight: 700;
}

.select-chip select:focus {
  box-shadow: none;
}

.select-chip select::-ms-expand {
  display: none;
}

.custom-size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.custom-size-grid .field-label {
  margin-top: 0;
}

.settings-grid .field-label {
  margin-top: 0;
}

.size-note {
  margin: 10px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

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

.reference-uploader {
  padding: 12px;
  border: 1px dashed #cbd7e8;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(245, 158, 11, 0.05)),
    #fbfdff;
}

.reference-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.reference-help {
  margin: 9px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.reference-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.reference-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid #dbe6f6;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
}

.reference-thumb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  color: #1d4ed8;
  background: #eaf1ff;
  font-size: 11px;
  font-weight: 850;
}

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

.reference-meta {
  min-width: 0;
}

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

.reference-meta strong {
  color: #1f2937;
  font-size: 13px;
}

.reference-meta small {
  margin-top: 3px;
  color: #7b879a;
  font-size: 12px;
}

.reference-remove {
  min-width: 58px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.helper-copy {
  margin: 0 0 12px;
  color: #3f4a5f;
  line-height: 1.58;
  font-weight: 600;
}

.selection-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 30px;
  margin: 8px 0 6px;
  padding: 6px 10px;
  border-radius: 10px;
  color: #485266;
  background: #f6f8fc;
  border: 1px dashed var(--line-strong);
  font-size: 13px;
  line-height: 1.42;
  min-width: 0;
}

.selection-status span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.canvas-selection-status {
  margin: -2px 0 8px;
}

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 99px;
  background: #aeb7c8;
}

.selection-status.has-selection {
  color: #7f1d1d;
  border-color: rgba(239, 43, 45, 0.25);
  background: #fff6f6;
}

.selection-status.has-selection .status-dot {
  background: var(--red);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.auth-tab.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(12px);
}

.modal-card {
  width: min(100%, 520px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(223, 229, 239, 0.96);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

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

.payment-modal-card {
  width: min(100%, 560px);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.modal-subtitle {
  margin: 10px 0 0;
  color: #5e6a81;
  line-height: 1.6;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #eef3fb;
  color: #334155;
  font-size: 26px;
  line-height: 1;
}

.modal-close:hover {
  background: #e1e9f7;
}

.inline-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.inline-field-main .field-label {
  margin-top: 14px;
}

.inline-action-btn {
  min-width: 128px;
  height: 44px;
}

.inline-help {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.55;
}

.payment-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff, #f8fbff);
  border: 1px solid #d7e7ff;
}

.payment-summary-card strong {
  font-size: 18px;
}

.payment-summary-card p {
  margin: 6px 0 0;
  color: #5b677c;
  line-height: 1.6;
}

.payment-price {
  font-size: 34px;
  font-weight: 850;
  color: #1d4ed8;
  letter-spacing: -0.03em;
}

.topup-field {
  display: grid;
  gap: 7px;
  margin: -4px 0 18px;
}

.topup-field span {
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
}

.topup-field small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.payment-method.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.payment-preview {
  display: grid;
  place-items: center;
  min-height: 300px;
  margin-top: 16px;
  padding: 22px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.02)),
    repeating-conic-gradient(from 45deg, #edf1f7 0 25%, #f7f9fc 0 50%) 0 / 20px 20px;
  border: 1px solid #dfe7f5;
}

.payment-preview-empty {
  text-align: center;
  color: #536079;
}

.payment-preview-empty strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.payment-preview-empty p {
  margin: 0;
  max-width: 320px;
  line-height: 1.6;
}

#paymentQrImage {
  display: block;
  width: min(100%, 320px);
  border-radius: 16px;
  background: #fff;
  border: 1px solid #d6e3fb;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.12);
}

.payment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: #4f5c73;
  font-size: 13px;
  font-weight: 700;
}

.payment-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.payment-link {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.payment-link:hover {
  text-decoration: underline;
}

.demo-payment-card {
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff7ed, #fff);
  border: 1px solid #fed7aa;
}

.demo-payment-card strong {
  display: block;
  margin-bottom: 8px;
}

.demo-payment-card p {
  margin: 0;
  color: #7c4a03;
  line-height: 1.65;
}

.status-banner {
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: start;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid rgba(239, 43, 45, 0.18);
  background: linear-gradient(180deg, #fff5f5, #fff);
}

.status-banner strong {
  display: block;
  margin-bottom: 4px;
}

.status-banner p {
  margin: 0;
  color: #6b3b3b;
}

.main-area {
  min-width: 0;
  display: contents;
}

.canvas-panel {
  grid-area: canvas;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 14px 14px;
}

.canvas-header,
.history-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 8px;
}

.canvas-header {
  min-height: 34px;
}

.canvas-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.project-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #e8f0ff;
  font-size: 13px;
  font-weight: 800;
}

.project-badge.draft {
  color: #6b7280;
  background: #edf1f7;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  overflow: hidden;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  color: #3e4657;
  background: transparent;
  font-weight: 720;
  white-space: nowrap;
}

.tool:hover,
.tool.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d7e3fb;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #3e4657;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.zoom-control input {
  width: clamp(92px, 11vw, 150px);
  accent-color: var(--blue);
  cursor: pointer;
}

html[lang="en"] .toolbar {
  gap: 2px;
}

html[lang="en"] .tool {
  padding-inline: 9px;
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

.stage-outer {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: auto;
  border-radius: 14px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.stage-frame {
  position: relative;
  min-height: 100%;
  height: 100%;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.04)),
    repeating-conic-gradient(from 45deg, #edf1f7 0 25%, #f7f9fc 0 50%) 0 / 26px 26px;
  transform-origin: top left;
}

.stage-frame.is-zoomed {
  min-height: 0;
}

#previewImage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  background: #0f172a;
  user-select: none;
  -webkit-user-drag: none;
}

.stage-frame.has-image #previewImage {
  display: block;
}

#overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.stage-frame:not(.has-image) #overlayCanvas {
  display: none;
}

.stage-frame.select-mode #overlayCanvas {
  cursor: crosshair;
}

.stage-frame.is-panning #overlayCanvas {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 36px;
  text-align: center;
  color: #4b5563;
}

.empty-state h3 {
  margin: 0;
  font-size: 20px;
}

.empty-state p {
  max-width: 460px;
  margin: 0;
  line-height: 1.65;
  color: #687385;
}

.stage-frame.has-image .empty-state {
  display: none;
}

.canvas-tip {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: none;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
  font-size: 13px;
}

.stage-frame.has-image .canvas-tip {
  display: block;
}

.stage-frame.select-mode .canvas-tip {
  background: rgba(239, 43, 45, 0.82);
}

.loading-mask {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: #fff;
  background: rgba(12, 18, 32, 0.58);
  backdrop-filter: blur(7px);
  font-weight: 780;
}

.stage-frame.is-loading .loading-mask {
  display: grid;
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}

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

.history-panel {
  grid-area: history;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
  transition: padding 0.18s ease, border-radius 0.18s ease;
}

.history-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  margin-bottom: 10px;
  justify-content: normal;
}

.history-title-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  padding-left: 31px;
  white-space: nowrap;
}

.history-toggle {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #111827;
  font-weight: 850;
  font-size: 16px;
}

.history-toggle-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  border-radius: 999px;
  color: #1d4ed8;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  transition: transform 0.18s ease;
}

.history-toggle-icon::before {
  content: none;
}

.history-toggle-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace.history-collapsed .history-panel {
  padding: 10px 8px;
  border-radius: 999px;
}

.workspace.history-collapsed .history-title-row {
  display: flex;
  justify-content: center;
  height: 100%;
  margin: 0;
}

.workspace.history-collapsed .history-toggle {
  width: 100%;
  height: 100%;
  justify-content: center;
}

.workspace.history-collapsed .history-toggle-icon {
  transform: rotate(180deg);
}

.workspace.history-collapsed .history-toggle-text,
.workspace.history-collapsed #historyMeta,
.workspace.history-collapsed .history-list {
  display: none;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - 156px);
  overflow-y: auto;
  padding: 3px 2px 8px;
}

.thumb-card,
.history-empty {
  flex: 0 0 auto;
  width: 100%;
  height: 118px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 7px 18px rgba(31, 41, 55, 0.04);
}

.thumb-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15), 0 12px 24px rgba(37, 99, 235, 0.08);
}

.thumb-card img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
  background: #111827;
}

.thumb-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  color: #263040;
  font-weight: 800;
  background: #fff;
}

.thumb-caption small {
  color: var(--muted-2);
  font-weight: 650;
}

.history-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  color: #64748b;
  background: linear-gradient(180deg, #fff, #fbfcff);
  border: 1px dashed var(--line-strong);
}

.history-empty span {
  font-size: 30px;
  color: #64748b;
}

.history-empty small {
  color: #9aa4b5;
}

.history-continue-card {
  padding: 14px;
}

.history-continue-card small {
  display: block;
  max-width: 170px;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  text-align: center;
}

.tips-bar {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  justify-self: start;
  z-index: 3;
  max-width: min(720px, calc(100% - 24px));
  margin: 0 0 12px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 12px;
  color: #586275;
  background: rgba(234, 241, 255, 0.78);
  border: 1px solid #d5e3ff;
  border-radius: 12px;
}

.tips-bar p {
  margin: 0;
  line-height: 1.5;
  font-size: 13px;
}

.works-shell {
  padding: 22px 26px 30px;
}

.works-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
}

.works-header-copy h2 {
  margin: 0;
  font-size: 24px;
}

.works-header-copy p {
  margin: 8px 0 0;
  max-width: 720px;
  color: #5b677c;
  line-height: 1.65;
}

.works-empty {
  padding: 34px 28px;
  text-align: center;
}

.works-empty strong {
  display: block;
  font-size: 22px;
}

.works-empty p {
  margin: 10px auto 0;
  max-width: 580px;
  color: #667085;
  line-height: 1.65;
}

.favorites-panel {
  margin-top: 18px;
  padding: 18px;
}

.favorites-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.favorites-heading h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.favorites-heading p {
  margin: 6px 0 0;
  color: #64748b;
  line-height: 1.55;
}

.favorites-empty {
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed #cbd7ea;
  border-radius: 18px;
  background: #f8fbff;
  text-align: center;
}

.favorites-empty strong {
  display: block;
  color: #172033;
  font-size: 16px;
}

.favorites-empty p {
  margin: 6px 0 0;
  color: #64748b;
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.favorite-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.05);
}

.favorite-cover {
  height: 140px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.04)),
    repeating-conic-gradient(from 45deg, #edf1f7 0 25%, #f7f9fc 0 50%) 0 / 22px 22px;
}

.favorite-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111827;
}

.favorite-cover-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800;
}

.favorite-card-body {
  padding: 14px;
}

.favorite-card-top {
  display: grid;
  gap: 4px;
}

.favorite-card-top strong {
  color: #172033;
  font-size: 15px;
  line-height: 1.35;
}

.favorite-card-top span {
  color: #8190a5;
  font-size: 12px;
  font-weight: 700;
}

.favorite-card-body p {
  margin: 10px 0 0;
  min-height: 64px;
  color: #4f5c73;
  font-size: 13px;
  line-height: 1.55;
}

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

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

.project-card {
  overflow: hidden;
}

.project-card.active {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12), var(--shadow);
}

.project-cover {
  height: 196px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.04)),
    repeating-conic-gradient(from 45deg, #edf1f7 0 25%, #f7f9fc 0 50%) 0 / 24px 24px;
}

.project-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111827;
}

.project-cover-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800;
}

.project-card-body {
  padding: 16px;
}

.project-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.project-card-top strong {
  font-size: 16px;
  line-height: 1.4;
}

.project-card-top span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.project-card-body p {
  margin: 10px 0 0;
  min-height: 46px;
  color: #4f5c73;
  line-height: 1.55;
}

.project-meta {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.project-actions {
  margin-top: 16px;
}

kbd {
  padding: 2px 7px;
  border-radius: 7px;
  border: 1px solid #c6d1e2;
  background: #fff;
  color: #364152;
  font-size: 12px;
  box-shadow: inset 0 -1px 0 #dce3ef;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 50;
  transform: translateX(-50%) translateY(20px);
  min-width: 260px;
  max-width: min(680px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 14px;
  color: #fff;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

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

.toast.error {
  background: rgba(127, 29, 29, 0.96);
}

.customer-fab {
  position: fixed;
  right: 24px;
  bottom: 104px;
  z-index: 45;
  display: grid;
  gap: 2px;
  min-width: 176px;
  padding: 14px 18px 14px 54px;
  border: 0;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8 54%, #172554);
  box-shadow: 0 20px 44px rgba(37, 99, 235, 0.28);
  text-align: left;
}

.customer-fab strong {
  font-size: 18px;
  line-height: 1.1;
}

.customer-fab small {
  opacity: 0.92;
  font-size: 12px;
}

.customer-fab-pulse {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
}

.customer-fab-pulse::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: customerPulse 1.5s ease-out infinite;
}

@keyframes customerPulse {
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

.feedback-modal-card {
  width: min(560px, 100%);
  padding: 22px;
}

.feedback-modal-card .field-label {
  margin-top: 14px;
}

.feedback-textarea {
  min-height: 150px;
  padding-top: 12px;
  resize: vertical;
  line-height: 1.6;
}

html.free-mode #navWorksBtn,
html.free-mode #openLoginBtn,
html.free-mode #openRegisterBtn,
html.free-mode #headerUpgradeBtn,
html.free-mode #headerLogoutBtn,
html.free-mode #paywallBanner,
html.free-mode #authModal,
html.free-mode #paymentModal {
  display: none !important;
}

.admin-body {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), transparent 36%),
    linear-gradient(180deg, #f8fbff 0%, #eef3f9 100%);
}

.admin-shell {
  width: min(1180px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.admin-topbar p,
.admin-panel-heading p,
.admin-login-panel p {
  margin: 7px 0 0;
  color: #667085;
  line-height: 1.55;
}

.admin-top-actions,
.admin-actions-row,
.generated-codes-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-login-panel,
.admin-panel {
  padding: 22px;
}

.admin-login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 22px;
  align-items: end;
}

.admin-login-panel h2,
.admin-panel-heading h2 {
  margin: 0;
  font-size: 22px;
}

.admin-login-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.admin-dashboard {
  display: grid;
  gap: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.admin-panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

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

.admin-form-grid label span {
  display: block;
  margin-bottom: 7px;
  color: #3f4a5f;
  font-size: 13px;
  font-weight: 760;
}

.admin-actions-row {
  margin-top: 16px;
}

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

.generated-codes {
  margin-top: 18px;
  border: 1px solid #d7e3fb;
  border-radius: 12px;
  background: #f8fbff;
  overflow: hidden;
}

.generated-codes-header {
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #d7e3fb;
}

.generated-codes pre {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  color: #10233f;
  font-weight: 800;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5eaf3;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

.admin-table th {
  color: #4b5563;
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table code {
  color: #10233f;
  background: #eef3ff;
  border-radius: 7px;
  padding: 4px 7px;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok {
  color: #166534;
  background: #dcfce7;
}

.status-pill.muted {
  color: #475569;
  background: #e2e8f0;
}

.admin-empty-cell {
  color: #667085;
  text-align: center !important;
}

@media (max-width: 1180px) {
  :root { --sidebar: 330px; }
  :root { --topbar-height: 90px; }
  .topbar { gap: 18px; padding: 0 18px; }
  .brand { min-width: 200px; max-width: 360px; }
  html[lang="en"] .brand { max-width: 310px; }
  html[lang="en"] .user-chip { flex-basis: 156px; max-width: 156px; }
  html[lang="en"] .user-copy small { max-width: 112px; }
  html[lang="en"] .primary.small,
  html[lang="en"] .secondary.small { padding-inline: 12px; }
  .support-note { font-size: 9px; }
  .nav-links { gap: 22px; }
  .workspace { padding: 12px 16px; gap: 12px; }
  .works-shell { padding: 18px; }
}

@media (max-width: 940px) {
  .topbar { height: auto; min-height: 72px; flex-wrap: wrap; padding: 12px 16px; }
  .brand { min-width: 0; flex: 1 1 240px; }
  .nav-links { order: 3; flex-basis: 100%; height: 42px; }
  .top-actions { flex: 0 0 auto; }
  .user-chip { max-width: 180px; }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "canvas"
      "history"
      "composer";
    height: auto;
    min-height: 0;
    overflow: visible;
  }
  .history-list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .thumb-card,
  .history-empty {
    flex-basis: 196px;
    width: auto;
  }
  .history-panel.history-collapsed-mobile #historyMeta,
  .history-panel.history-collapsed-mobile .history-list {
    display: none;
  }
  .history-panel.history-collapsed-mobile .history-title-row {
    margin-bottom: 0;
  }
  .history-panel.history-collapsed-mobile .history-toggle-icon {
    transform: rotate(180deg);
  }
  .tips-bar {
    grid-column: 1;
    grid-row: 1;
  }
  .stage-outer { height: 52vh; min-height: 360px; flex: 0 0 auto; }
  .stage-frame { height: 100%; min-height: 100%; }
  .works-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  body { background-attachment: fixed; }
  .topbar {
    gap: 12px;
    padding: 12px 12px 14px;
    align-items: stretch;
  }
  .brand {
    flex: 1 1 100%;
    align-items: flex-start;
    gap: 10px;
  }
  .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .brand-title {
    font-size: 19px;
  }
  .brand-subtitle {
    max-width: none;
    font-size: 9.5px;
    line-height: 1.25;
  }
  .brand-support {
    flex-wrap: wrap;
    row-gap: 5px;
  }
  .support-link {
    min-height: 24px;
    padding-inline: 9px;
    font-size: 11px;
  }
  .customer-top-link small {
    display: none;
  }
  .support-note {
    flex: 1 1 100%;
    white-space: normal;
    font-size: 8.5px;
    line-height: 1.2;
  }
  .nav-links {
    order: 2;
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    height: auto;
    padding: 4px;
    border: 1px solid #d9e4f4;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
  }
  .nav-link {
    justify-content: center;
    flex: none;
    min-height: 40px;
    border-radius: 12px;
    color: #59657a;
    font-size: 15px;
  }
  .nav-link.active {
    background: #edf3ff;
    color: var(--blue);
  }
  .nav-link.active::after {
    display: none;
  }
  .top-actions {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }
  .top-actions .small {
    width: 100%;
    padding: 9px 8px;
    font-size: 13px;
  }
  .customer-top-link {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }
  .customer-top-link small {
    display: inline;
  }
  .locale-switch {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .locale-btn {
    min-width: 34px;
  }
  #newProjectBtn {
    grid-column: 1 / -1;
  }
  .user-chip {
    display: none;
  }
  .workspace {
    padding: 10px;
    gap: 10px;
  }
  .sidebar {
    gap: 10px;
  }
  .top-actions .icon-btn,
  .user-copy { display: none; }
  .control-card { padding: 16px; }
  .unified-control-card {
    grid-template-columns: minmax(0, 1fr) 44px;
    padding: 12px 12px 10px;
    border-radius: 20px;
    gap: 8px 10px;
  }
  .unified-control-card .prompt-box {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .unified-control-card .compact-controls {
    grid-column: 1;
    grid-row: 2;
  }
  .unified-control-card #generateBtn {
    grid-column: 2;
    grid-row: 2;
  }
  .compact-controls {
    gap: 6px;
  }
  .icon-pill {
    min-height: 34px;
    padding: 0 10px;
  }
  .select-chip {
    flex: 0 0 auto;
    justify-content: center;
    min-width: max-content !important;
    min-height: 34px;
    padding-inline: 9px;
    font-size: 11.5px;
  }
  .select-chip .chip-value {
    max-width: 62px;
  }
  .button-row { grid-template-columns: 1fr; }
  .inline-field-row { grid-template-columns: 1fr; }
  .inline-action-btn { width: 100%; }
  .reference-item {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 48px;
  }
  .reference-thumb {
    width: 36px;
    height: 36px;
  }
  .reference-remove { min-width: 48px; }
  .modal-backdrop { padding: 14px; }
  .auth-modal-card { padding: 18px; }
  .payment-modal-card { padding: 18px; }
  .modal-header h2 { font-size: 24px; }
  .custom-size-grid,
  .settings-grid { grid-template-columns: 1fr; }
  .payment-summary-card,
  .payment-meta { align-items: flex-start; flex-direction: column; }
  .payment-actions,
  .payment-methods { grid-template-columns: 1fr; }
  .canvas-panel { padding: 10px; }
  .canvas-header {
    position: relative;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }
  .canvas-header::before {
    content: "";
    position: absolute;
    top: 1px;
    right: 0;
    z-index: 2;
    width: 42px;
    height: 38px;
    pointer-events: none;
    border-radius: 0 18px 18px 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.96) 72%);
  }
  .canvas-header::after {
    content: "左右滑动查看更多工具 →";
    align-self: flex-end;
    margin-top: -4px;
    padding: 3px 9px;
    border: 1px solid #d7e3fb;
    border-radius: 999px;
    color: #4e5b72;
    background: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 760;
    line-height: 1.2;
  }
  html[lang="en"] .canvas-header::after {
    content: "Swipe for more tools →";
  }
  .toolbar {
    width: calc(100% + 4px);
    margin-right: -4px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 38px 5px 2px;
    border: 1px solid #e0e8f5;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    -webkit-overflow-scrolling: touch;
    scrollbar-color: #aac0df transparent;
    scrollbar-width: thin;
  }
  .toolbar::-webkit-scrollbar {
    display: block;
    height: 4px;
  }
  .toolbar::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #aac0df;
  }
  .toolbar::-webkit-scrollbar-track {
    background: transparent;
  }
  .tool {
    flex: 0 0 auto;
    justify-content: center;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .zoom-control {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 11.5px;
  }
  .zoom-control input {
    width: 92px;
  }
  .selection-status {
    gap: 6px;
    padding: 6px 8px;
    font-size: 12px;
  }
  .divider { display: none; }
  .stage-outer {
    height: 41vh;
    min-height: 260px;
    flex: 0 0 auto;
    overflow: auto;
  }
  .stage-frame {
    min-height: 100%;
    height: 100%;
  }
  .canvas-tip {
    left: 10px;
    right: 10px;
    bottom: 10px;
    text-align: center;
  }
  .empty-state {
    padding: 20px 16px;
  }
  .empty-state h3 {
    font-size: 17px;
  }
  .empty-state p {
    font-size: 13px;
    line-height: 1.55;
  }
  .history-panel {
    padding: 10px 12px 12px;
    border-radius: 18px;
    overflow: hidden;
  }
  .history-title-row {
    gap: 6px;
    margin-bottom: 8px;
  }
  .history-toggle {
    font-size: 15px;
  }
  .history-title-row span {
    font-size: 11px;
    padding-left: 28px;
  }
  .history-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(146px, 74vw);
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 1px 2px;
    scrollbar-width: none;
  }
  .history-list::-webkit-scrollbar {
    display: none;
  }
  .history-panel.history-collapsed-mobile {
    padding-bottom: 10px;
  }
  .history-panel.history-collapsed-mobile .history-title-row {
    margin-bottom: 0;
  }
  .history-panel.history-collapsed-mobile #historyMeta,
  .history-panel.history-collapsed-mobile .history-list {
    display: none;
  }
  .history-panel.history-collapsed-mobile .history-toggle-text {
    white-space: nowrap;
  }
  .history-panel.history-collapsed-mobile .history-toggle-icon {
    transform: rotate(180deg);
  }
  .thumb-card,
  .history-empty {
    flex-basis: auto;
    width: 100%;
    height: 116px;
  }
  .works-grid { grid-template-columns: 1fr; }
  .customer-fab {
    right: 14px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    min-width: 124px;
    max-width: calc(100vw - 28px);
    padding: 11px 12px 11px 44px;
    border-radius: 20px;
  }
  .customer-fab strong {
    font-size: 16px;
  }
  .customer-fab small {
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }
  .customer-fab-pulse {
    left: 13px;
    width: 22px;
    height: 22px;
  }
  .admin-shell { width: min(100vw - 24px, 1180px); padding-top: 18px; }
  .admin-topbar,
  .admin-login-panel { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .admin-login-form,
  .admin-form-grid { grid-template-columns: 1fr; }
}

