:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-soft: #fcfbfa;
  --text: #2a2826;
  --text-soft: #6f6a63;
  --muted: #9a948c;
  --line: #ebe7e1;
  --line-strong: #ddd7ce;
  --primary: #a68452;
  --primary-dark: #8b6d42;
  --primary-soft: #f5f0e8;
  --success: #6d8f7a;
  --success-soft: #eef4f0;
  --warning: #b8860b;
  --warning-soft: #faf6ed;
  --danger: #c45c4a;
  --danger-soft: #fdf3f1;
  --shadow: 0 24px 64px rgba(42, 40, 38, 0.07);
  --shadow-soft: 0 10px 32px rgba(42, 40, 38, 0.05);
  --shadow-hover: 0 28px 72px rgba(42, 40, 38, 0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --font-display: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --font-ui: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui, sans-serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --lux-ink: #121110;
  --lux-ink-soft: #5c5650;
  --lux-ink-muted: #8a837a;
  --lux-gold: #9a7b4f;
  --lux-gold-line: rgba(154, 123, 79, 0.55);
  --lux-bg: #f6f4ef;
  --lux-surface: #fdfcfa;
  --lux-line: rgba(18, 17, 16, 0.08);
  --lux-line-strong: rgba(18, 17, 16, 0.14);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -8%, rgba(166, 132, 82, 0.06), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(166, 132, 82, 0.04), transparent 36%),
    var(--bg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

body.has-dialog,
body.is-generating {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

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

button {
  border: 0;
}

button:not(:disabled) {
  cursor: pointer;
}

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

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.app-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 64px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid rgba(223, 231, 226, 0.96);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar-brand {
  min-width: 0;
  width: fit-content;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #c9a962 0%, #a68452 52%, #8b6d42 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(166, 132, 82, 0.22);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  display: block;
}

.brand-mark .icon-frame,
.brand-mark .icon-line,
.brand-mark .icon-dot {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark .ai-spark {
  fill: #b7f7d5;
  stroke: #ffffff;
  stroke-width: 0.6;
}

.brand-mark .ai-spark.small {
  fill: #ffffff;
  stroke: none;
  opacity: 0.92;
}

.brand-copy {
  min-width: 0;
}

.eyebrow,
.brand-copy .eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

h1,
h2 {
  margin: 0;
  color: var(--text);
  line-height: 1.18;
  letter-spacing: 0;
}

h1 {
  overflow: hidden;
  font-size: 24px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 20px;
  font-weight: 750;
}

.topbar-right {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-nav,
.topbar-account {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
}

.topbar-nav a,
.topbar-account .balance,
.topbar-account .nav-redeem,
.topbar-account .logout-link {
  height: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text-soft);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.topbar-nav a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 16px rgba(166, 132, 82, 0.18);
}

.topbar-nav a:not(.active):hover,
.topbar-account .logout-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.topbar-account .balance {
  min-width: 88px;
  background: #fff;
  color: var(--primary);
}

.topbar-account .nav-redeem {
  min-width: 68px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 16px rgba(166, 132, 82, 0.18);
}

.topbar-account .nav-redeem:hover {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.grid {
  display: grid;
  gap: 16px;
}

.two-col {
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  align-items: stretch;
}

.narrow-left {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}

.card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.card {
  padding: 20px;
}

.section-card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  margin-bottom: 16px;
}

.card-head > div {
  min-width: 0;
}

.card-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.form {
  display: grid;
  gap: 14px;
}

.field,
.field-grid {
  display: grid;
  gap: 8px;
}

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

.field span {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9bdcbf;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(66, 184, 131, 0.14);
}

input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.button.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(166, 132, 82, 0.2);
}

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

.button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--text-soft);
}

.button.secondary:hover,
.button.secondary.active {
  border-color: #9bdcbf;
  background: var(--primary-soft);
  color: var(--primary);
}

.button.secondary.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.button.danger {
  border-color: #fecaca;
  background: #fff;
  color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-soft);
}

.button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.badge,
.status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.status.succeeded,
.alert.success,
.inline-message.success {
  background: var(--success-soft);
  color: #166534;
  border-color: #bbf7d0;
}

.status.failed,
.alert.error,
.inline-message.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}

.status.running,
.status.queued,
.alert.warning,
.inline-message.warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: #fed7aa;
}

.status.deleted {
  background: #f2f4f7;
  color: var(--muted);
  border-color: var(--line-strong);
}

.alert,
.inline-message {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
  color: var(--text-soft);
  font-weight: 650;
}

.inline-message {
  margin: 14px 0 0;
}

.generation-notice {
  margin-bottom: 14px;
  border: 1px solid #f6d58b;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff8e6;
  color: #9a6700;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.6;
}

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

.mode-toggle label {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text-soft);
  font-weight: 800;
}

.mode-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-toggle label:has(input:checked) {
  border-color: #9bdcbf;
  background: var(--primary-soft);
  color: var(--primary);
}

.edit-upload-field input {
  height: auto;
  padding: 10px 12px;
}

.edit-upload-box {
  position: relative;
  min-height: 92px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px dashed #98a2b3;
  border-radius: 10px;
  padding: 16px;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.edit-upload-box:hover {
  border-color: var(--primary);
  background: #f3fbf7;
  box-shadow: 0 0 0 3px rgba(22, 160, 109, 0.08);
}

.edit-upload-box input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.edit-upload-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e8f6ef;
  color: var(--primary-dark);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.edit-upload-box strong {
  display: block;
  color: #101828;
  font-size: 14px;
  font-weight: 850;
}

.edit-upload-box small {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.edit-upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.edit-preview-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.edit-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-preview-item button {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border: 0;
  border-radius: 6px;
  padding: 4px 7px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

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

.auth-wrap {
  min-height: 62vh;
  display: grid;
  place-items: center;
}

.simple-auth {
  min-height: calc(100vh - 150px);
}

.auth-dashboard {
  min-height: calc(100vh - 142px);
  width: 100%;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 440px);
  gap: 24px;
  align-items: stretch;
  place-items: stretch;
}

.auth-info,
.auth-form-card {
  min-height: 520px;
}

.auth-info {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: space-between;
  border: 1px solid rgba(208, 213, 221, 0.92);
  border-radius: var(--radius);
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(66, 184, 131, 0.12), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: var(--shadow);
}

.auth-info::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 28px;
  width: min(320px, 46%);
  height: 160px;
  border: 1px solid rgba(66, 184, 131, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(249, 251, 250, 0.8)),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(66, 184, 131, 0.12) 24px);
  opacity: 0.76;
}

.auth-info::before {
  content: "";
  position: absolute;
  inset: 24px 24px auto auto;
  width: min(360px, 42%);
  aspect-ratio: 1;
  border: 1px solid rgba(66, 184, 131, 0.18);
  border-radius: 50%;
  background:
    linear-gradient(90deg, rgba(66, 184, 131, 0.16) 1px, transparent 1px),
    linear-gradient(180deg, rgba(66, 184, 131, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.72;
}

.auth-info-head,
.auth-metrics {
  position: relative;
  z-index: 2;
}

.auth-tag {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #9bdcbf;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.auth-info h2 {
  max-width: 560px;
  margin-top: 22px;
  font-size: 42px;
  line-height: 1.08;
}

.auth-info p {
  max-width: 500px;
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 16px;
  font-weight: 650;
}

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

.auth-metrics div {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 7px;
  border: 1px solid rgba(208, 213, 221, 0.88);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
}

.auth-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.auth-metrics strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-card {
  width: min(440px, 100%);
}

.auth-form-card {
  width: 100%;
  display: grid;
  align-content: center;
  align-self: stretch;
  padding: 30px;
}

.auth-card.wide {
  width: min(640px, 100%);
}

.auth-card h2 {
  margin-bottom: 18px;
}

.auth-card-head {
  margin-bottom: 22px;
}

.auth-card-head h2 {
  margin-bottom: 8px;
  font-size: 26px;
  color: var(--text);
}

.auth-form-card .field input {
  background: #fff;
}

.auth-form-card .field input::placeholder {
  color: #98a2b3;
}

.auth-card-head span,
.auth-switch {
  color: var(--muted);
  font-weight: 650;
}

.auth-form-card .button.primary {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.auth-switch {
  margin: 18px 0 0;
  text-align: center;
}

.setup-card {
  width: min(920px, 100%);
  margin: 0 auto;
}

.setup-form {
  gap: 18px;
}

.setup-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfdfc;
}

.setup-section h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

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

.preview-card {
  display: grid;
  grid-template-rows: auto minmax(390px, 1fr);
}

.preview-stage {
  min-height: 390px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, rgba(208, 213, 221, 0.42) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(208, 213, 221, 0.42) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(208, 213, 221, 0.42) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(208, 213, 221, 0.42) 75%),
    #f9fbff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.preview-stage img {
  width: 100%;
  height: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #fff;
}

.empty-state,
.preview-loading {
  width: min(240px, 90%);
  min-height: 116px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed #b8c7dc;
  border-radius: var(--radius);
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.preview-loading span {
  font-size: 13px;
  font-weight: 600;
}

.preview-error {
  width: min(360px, 92%);
  min-height: 128px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 18px;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
  font-weight: 700;
}

.preview-error span {
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.preview-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

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

.history-list .record-card {
  height: 236px;
  min-height: 236px;
  display: grid;
  grid-template-rows: 128px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: #fff;
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.history-list .record-card:hover {
  border-color: #9bdcbf;
  background: #fbfdfc;
  box-shadow: var(--shadow-soft);
}

.history-list .record-card:focus-visible {
  outline: 3px solid rgba(66, 184, 131, 0.16);
  outline-offset: 2px;
}

.record-image {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #e8f7f0, #f9fbfa);
  color: var(--muted);
  font-weight: 750;
}

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

.record-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
}

.record-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.record-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-meta span:first-child {
  color: var(--primary);
}

.record-body p {
  max-height: 42px;
  margin: 0;
  overflow: hidden;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.record-body time {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.record-delete {
  min-height: 28px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.record-delete:hover {
  background: var(--danger-soft);
}

.history-empty-inline {
  grid-column: 1 / -1;
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed #b8c7dc;
  border-radius: var(--radius);
  color: var(--muted);
  background: #fbfdff;
  font-weight: 750;
}

.records-page-card {
  margin-top: 0;
  max-width: none;
  width: 100%;
}

body.page-records .records-gallery.history-list {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

body.page-records .records-gallery .record-card {
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  grid-template-columns: unset;
  grid-template-rows: unset;
  padding: 0;
}

body.page-records .records-gallery .record-image {
  width: 100%;
  aspect-ratio: 1;
  min-height: 180px;
}

body.page-records .records-gallery .record-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
}

body.page-records .records-gallery .record-body p {
  display: -webkit-box;
  max-height: none;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

body.page-records .records-gallery .record-foot {
  margin-top: auto;
  padding-top: 4px;
}

@media (max-width: 720px) {
  body.page-records .records-gallery.history-list {
    grid-template-columns: 1fr;
  }

  body.page-records .records-gallery .record-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 0;
    padding: 0;
  }

  body.page-records .records-gallery .record-image {
    width: 112px;
    min-height: 112px;
    aspect-ratio: 1;
    border-radius: 0;
  }

  body.page-records .records-gallery .record-body {
    justify-content: center;
    padding: 12px 14px 12px 0;
  }
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.pagination span {
  color: var(--muted);
  font-weight: 750;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

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

.stat-card {
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 30px;
  line-height: 1.1;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

tr.is-deleted td {
  background: #fafafa;
  color: var(--muted);
}

[data-admin-records] {
  min-width: 1180px;
}

[data-admin-records] th:nth-child(1),
[data-admin-records] td:nth-child(1) {
  width: 110px;
}

[data-admin-records] th:nth-child(2),
[data-admin-records] td:nth-child(2) {
  width: 92px;
}

[data-admin-records] th:nth-child(3),
[data-admin-records] td:nth-child(3) {
  width: 130px;
}

[data-admin-records] th:nth-child(4),
[data-admin-records] td:nth-child(4) {
  width: 88px;
}

[data-admin-records] th:nth-child(5),
[data-admin-records] td:nth-child(5) {
  width: 92px;
}

[data-admin-records] th:nth-child(7),
[data-admin-records] td:nth-child(7) {
  width: 176px;
}

[data-admin-records] th:nth-child(8),
[data-admin-records] td:nth-child(8) {
  width: 150px;
}

[data-admin-users] {
  min-width: 1080px;
}

[data-admin-users] th:nth-child(1),
[data-admin-users] td:nth-child(1) {
  width: 260px;
}

[data-admin-users] th:nth-child(2),
[data-admin-users] td:nth-child(2) {
  width: 190px;
}

[data-admin-users] th:nth-child(3),
[data-admin-users] td:nth-child(3),
[data-admin-users] th:nth-child(4),
[data-admin-users] td:nth-child(4),
[data-admin-users] th:nth-child(5),
[data-admin-users] td:nth-child(5) {
  width: 96px;
}

[data-admin-users] th:nth-child(6),
[data-admin-users] td:nth-child(6) {
  width: 340px;
}

[data-admin-codes] {
  min-width: 980px;
}

[data-admin-codes] th:nth-child(1),
[data-admin-codes] td:nth-child(1) {
  width: 190px;
}

[data-admin-codes] th:nth-child(2),
[data-admin-codes] td:nth-child(2),
[data-admin-codes] th:nth-child(3),
[data-admin-codes] td:nth-child(3),
[data-admin-codes] th:nth-child(4),
[data-admin-codes] td:nth-child(4),
[data-admin-codes] th:nth-child(5),
[data-admin-codes] td:nth-child(5) {
  width: 96px;
}

[data-admin-codes] th:nth-child(6),
[data-admin-codes] td:nth-child(6),
[data-admin-codes] th:nth-child(8),
[data-admin-codes] td:nth-child(8) {
  width: 170px;
}

[data-admin-codes] th:nth-child(7),
[data-admin-codes] td:nth-child(7) {
  width: 120px;
}

.admin-prompt-cell {
  color: var(--text-soft);
  max-width: 360px;
}

.admin-record-row td {
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-cell {
  max-width: 130px;
  font-weight: 750;
}

.admin-record-id {
  margin-right: 8px;
  color: var(--text);
  font-weight: 850;
}

.deleted-time {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.table-thumb {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0;
}

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

.inline-delete-form {
  display: inline-flex;
  margin: 0 0 0 6px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.code-create-card .card-head {
  margin-bottom: 12px;
}

.code-create-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.code-create-form .button {
  min-width: 96px;
}

.user-identity {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.user-identity strong,
.user-identity span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong {
  color: var(--text);
  font-weight: 850;
}

.user-identity > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.inline-admin-form,
.table-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  vertical-align: middle;
}

.table-action-group {
  width: 100%;
  flex-wrap: nowrap;
}

.compact-input {
  width: 82px;
  height: 34px;
  border-radius: 8px;
  padding: 0 9px;
  font-size: 13px;
}

.compact-input.password-input {
  width: 132px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.redeem-dialog,
.record-dialog,
.generation-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
}

.generation-overlay {
  z-index: 10002;
  pointer-events: auto;
}

.redeem-panel,
.record-dialog-panel,
.generation-modal {
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(16, 24, 40, 0.3);
}

.record-dialog-panel {
  width: min(920px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  overflow: auto;
}

.generation-modal {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 26px 22px;
  text-align: center;
}

.generation-modal h2 {
  font-size: 22px;
}

.generation-modal p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.generation-loader {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  height: 42px;
}

.generation-loader span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  animation: pulse 0.9s ease-in-out infinite;
}

.generation-loader span:nth-child(2) {
  animation-delay: 0.12s;
}

.generation-loader span:nth-child(3) {
  animation-delay: 0.24s;
}

.generation-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--primary-soft);
}

.generation-progress i {
  width: 42%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #42d392, var(--primary));
  animation: progress 1.3s ease-in-out infinite;
}

.redeem-head,
.record-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.96);
}

.record-dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  backdrop-filter: blur(12px);
}

.redeem-form {
  padding: 20px;
}

.dialog-close {
  min-width: 72px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #fff;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 750;
}

.dialog-close:hover {
  border-color: #9bdcbf;
  background: var(--primary-soft);
  color: var(--primary);
}

.record-dialog-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 20px;
}

.record-dialog-image {
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #e8f7f0, #f9fbfa);
  color: var(--muted);
  font-weight: 750;
}

.record-dialog-image-button {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: transparent;
}

.record-dialog-image-button img,
.record-dialog-image img {
  width: 100%;
  height: 100%;
  max-height: 640px;
  object-fit: contain;
  background: #fff;
}

.record-input-images {
  display: grid;
  gap: 10px;
}

.record-input-images > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.record-input-images [data-dialog-input-list] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.record-input-image-button {
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0;
  cursor: zoom-in;
}

.record-input-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.86);
}

.image-viewer-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.image-viewer-toolbar button,
.image-viewer-toolbar span {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 800;
}

.image-viewer-toolbar span {
  min-width: 72px;
}

.image-viewer-stage {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.48);
  cursor: grab;
}

.image-viewer-canvas {
  min-width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
}

.image-viewer-stage.is-dragging {
  cursor: grabbing;
}

.image-viewer-stage img {
  display: block;
  max-width: none;
  max-height: none;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  user-select: none;
}

.record-detail-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(190px, 1fr) minmax(120px, 0.7fr) minmax(360px, 2fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.record-detail-grid div {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px;
  background: #fbfdff;
}

.record-detail-grid .record-detail-time {
  min-width: 360px;
}

.record-detail-grid .record-detail-status strong {
  width: fit-content;
}

.record-detail-grid span,
.record-full-prompt span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.record-detail-grid strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.record-detail-grid strong.status {
  color: inherit;
  font-size: 13px;
}

.record-full-prompt {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
}

.record-full-prompt p {
  max-height: 132px;
  overflow: auto;
  margin: 0;
  color: #1f2937;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.record-error {
  grid-column: 1 / -1;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px;
  background: var(--danger-soft);
  color: var(--danger);
}

.history-list::-webkit-scrollbar,
.record-full-prompt p::-webkit-scrollbar,
.record-dialog-panel::-webkit-scrollbar,
.admin-nav::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.history-list::-webkit-scrollbar-thumb,
.record-full-prompt p::-webkit-scrollbar-thumb,
.record-dialog-panel::-webkit-scrollbar-thumb,
.admin-nav::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c8d5e6;
}

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

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

@keyframes progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

@media (max-width: 1180px) {
  .history-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-topbar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .topbar-right {
    justify-content: flex-start;
  }

  .two-col,
  .narrow-left,
  .auth-dashboard {
    grid-template-columns: 1fr;
  }

  .auth-info,
  .auth-form-card {
    min-height: auto;
  }

  .auth-info {
    gap: 28px;
  }

  .preview-card {
    grid-template-rows: auto minmax(300px, auto);
  }

  .preview-stage {
    min-height: 300px;
  }

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

  .code-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .code-create-form .button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 16px, 1180px);
    padding-top: 8px;
    padding-bottom: 24px;
  }

  .app-topbar {
    min-height: auto;
    padding: 12px;
  }

  .topbar-brand {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 19px;
  }

  .topbar-right {
    display: grid;
    gap: 8px;
    width: 100%;
  }

  .topbar-nav,
  .topbar-account {
    width: 100%;
    min-height: 40px;
  }

  .topbar-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }

  .topbar-account {
    display: grid;
    grid-template-columns: minmax(78px, 1fr) auto auto auto;
  }

  .topbar-nav a,
  .topbar-account .balance,
  .topbar-account .nav-redeem,
  .topbar-account .logout-link {
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }

  .card {
    padding: 14px;
  }

  .card-head {
    align-items: flex-start;
    min-height: auto;
    gap: 10px;
    margin-bottom: 14px;
  }

  .field-grid,
  .stats-grid,
  .auth-metrics,
  .generate-actions,
  .filter-bar,
  .code-create-form {
    grid-template-columns: 1fr;
  }

  .card-head-actions,
  .filter-actions {
    width: 100%;
  }

  .card-head-actions .button,
  .filter-actions .button {
    flex: 1;
  }

  .auth-dashboard {
    gap: 12px;
  }

  .auth-info,
  .auth-form-card {
    padding: 16px;
  }

  .auth-info h2 {
    font-size: 28px;
  }

  input,
  select {
    height: 42px;
  }

  textarea {
    min-height: 138px;
  }

  .button {
    min-height: 42px;
  }

  .history-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .history-list .record-card {
    height: 108px;
    min-height: 108px;
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: 1fr;
    gap: 10px;
    padding: 8px;
  }

  .history-list .record-image {
    width: 92px;
    height: 92px;
    border-radius: var(--radius);
  }

  .history-list .record-body {
    align-content: center;
    padding: 0;
  }

  .redeem-dialog,
  .record-dialog,
  .generation-overlay {
    align-items: end;
    padding: 10px;
  }

  .redeem-panel,
  .generation-modal {
    width: 100%;
  }

  .record-dialog-panel {
    max-height: calc(100vh - 20px);
  }

  .redeem-head,
  .record-dialog-head,
  .redeem-form {
    padding: 14px;
  }

  .record-dialog-body {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .record-dialog-image {
    min-height: 280px;
  }

  .pagination {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .image-viewer {
    padding: 10px;
  }

  .image-viewer-toolbar {
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .image-viewer-toolbar button,
  .image-viewer-toolbar span {
    width: 100%;
    padding: 0 8px;
    font-size: 13px;
  }

  .record-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .app-shell {
    width: min(100% - 12px, 1180px);
  }

  .topbar-account {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-account .balance {
    grid-column: 1 / -1;
  }
}

/* Enterprise UI refresh */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --text: #172033;
  --text-soft: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --primary: #16a06d;
  --primary-dark: #087f5b;
  --primary-soft: #e8f6ef;
  --success: #16a06d;
  --success-soft: #e8f6ef;
  --warning: #b7791f;
  --warning-soft: #fff7e6;
  --danger: #d92d20;
  --danger-soft: #fff1f0;
  --shadow: 0 18px 44px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 8px 24px rgba(16, 24, 40, 0.05);
  --radius: 8px;
}

html {
  background: var(--bg);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0, rgba(243, 246, 248, 0) 280px),
    linear-gradient(90deg, rgba(22, 160, 109, 0.06) 0, transparent 36%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app-shell {
  width: calc(100% - 36px);
  max-width: 1440px;
  padding-top: 14px;
}

.app-topbar,
.topbar-brand,
.topbar-right,
.topbar-nav,
.topbar-account,
.grid,
.two-col,
.section-card,
.preview-card {
  min-width: 0;
  max-width: 100%;
}

.app-topbar {
  position: sticky;
  top: 12px;
  z-index: 1000;
  min-height: 62px;
  margin-bottom: 18px;
  border-color: rgba(228, 231, 236, 0.92);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.07);
}

.brand-mark {
  border-radius: 8px;
  background: linear-gradient(135deg, #19b37b 0%, #12875f 100%);
  box-shadow: 0 10px 20px rgba(22, 160, 109, 0.22);
}

h1 {
  font-size: 21px;
  font-weight: 850;
}

h2 {
  font-size: 19px;
  font-weight: 800;
}

.eyebrow {
  color: #7a8699;
  font-size: 11px;
  text-transform: uppercase;
}

.topbar-nav,
.topbar-account {
  border-color: #eaecf0;
  border-radius: 8px;
  background: #f8fafc;
}

.topbar-nav a,
.topbar-account .balance,
.topbar-account .nav-redeem,
.topbar-account .logout-link {
  border-radius: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 750;
}

.topbar-nav a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 160, 109, 0.2);
}

.topbar-nav a:not(.active):hover,
.topbar-account .logout-link:hover {
  background: #eef2f6;
  color: var(--text);
}

.topbar-account .balance {
  border: 1px solid #d6f0e4;
  background: #f1fbf6;
  color: var(--primary-dark);
}

.topbar-account .nav-redeem {
  border: 1px solid #087f5b;
  background: #087f5b;
  color: #ffffff;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(8, 127, 91, 0.22);
}

.topbar-account .nav-redeem:hover {
  border-color: #06684b;
  background: #06684b;
  color: #ffffff;
}

.grid {
  gap: 18px;
}

.two-col {
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
}

.card,
.stat-card {
  min-width: 0;
  border-color: #e4e7ec;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.card {
  padding: 18px;
}

.section-card {
  margin-top: 18px;
}

.card-head {
  min-height: 46px;
  margin-bottom: 16px;
}

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

.form {
  gap: 13px;
}

.field span {
  color: #475467;
  font-size: 13px;
  font-weight: 760;
}

input,
select,
textarea {
  border-color: #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #101828;
}

input,
select {
  height: 42px;
}

textarea {
  min-height: 144px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #98a2b3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 160, 109, 0.13);
}

.button {
  min-height: 40px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 780;
  box-shadow: none;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: none;
}

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

.button.secondary {
  border-color: #d0d5dd;
  background: #fff;
  color: #344054;
}

.button.secondary:hover,
.button.secondary.active {
  border-color: #98a2b3;
  background: #f2f4f7;
  color: #101828;
}

.button.online-action {
  border-color: #9bdcbf;
  background: #e8f6ef;
  color: var(--primary-dark);
}

.button.online-action:hover,
.button.online-action:focus-visible {
  border-color: var(--primary);
  background: #d8f3e5;
  color: #06684b;
}

.button.danger {
  border-color: #fecdca;
  background: #fff;
}

.badge,
.status {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.badge {
  border-color: #d0d5dd;
  background: #fff;
}

.alert,
.inline-message,
.generation-notice {
  border-radius: 8px;
  box-shadow: none;
}

.generation-notice {
  border-color: #f6d58b;
  background: #fffaf0;
}

.mode-toggle {
  gap: 10px;
}

.mode-toggle label {
  min-height: 40px;
  border-radius: 8px;
  background: #f8fafc;
}

.mode-toggle label:has(input:checked) {
  border-color: #8de0bb;
  background: #e8f6ef;
  color: var(--primary-dark);
}

.edit-upload-preview {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.preview-card {
  display: grid;
  grid-template-rows: auto minmax(520px, 1fr);
}

.preview-stage {
  min-height: 520px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%),
    #fff;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.preview-stage img {
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(16, 24, 40, 0.14);
}

.history-list {
  gap: 14px;
  padding-bottom: 4px;
}

.history-list .record-card {
  border-color: #e4e7ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.history-list .record-card:hover {
  border-color: #b9c3d0;
  box-shadow: 0 12px 26px rgba(16, 24, 40, 0.08);
}

.history-list .record-image {
  border-radius: 8px;
  background: #f2f4f7;
}

.record-meta span:first-child {
  font-weight: 850;
}

.record-body p,
.admin-prompt-cell {
  color: #475467;
}

.admin-nav {
  gap: 8px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.admin-nav .button {
  min-height: 36px;
  border: 0;
}

.admin-nav .button.secondary.active {
  background: var(--primary);
  color: #fff;
}

.admin-version-footer {
  margin-top: 22px;
  padding: 14px 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

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

.stat-card {
  min-height: 96px;
  padding: 16px;
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}

.stat-card span {
  color: #667085;
  font-size: 12px;
  font-weight: 760;
}

.stat-card strong {
  margin-top: 8px;
  color: #101828;
  font-size: 26px;
  font-weight: 880;
}

.table-wrap {
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom: 1px solid #eaecf0;
  padding: 12px 14px;
}

th {
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover td {
  background: #fbfcfe;
}

tr:last-child td {
  border-bottom: 0;
}

.table-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
}

.inline-admin-form,
.table-action-group {
  gap: 7px;
}

.compact-input {
  height: 34px;
  border-radius: 7px;
}

.filter-bar {
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px) auto;
  padding: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #f8fafc;
}

.code-create-card {
  background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}

.code-create-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
}

.auth-dashboard {
  min-height: calc(100vh - 140px);
  grid-template-columns: minmax(0, 1fr) minmax(380px, 440px);
}

.auth-info,
.auth-form-card {
  min-height: 540px;
  border-radius: 10px;
}

.auth-info {
  background:
    linear-gradient(135deg, rgba(22, 160, 109, 0.12), transparent 42%),
    linear-gradient(180deg, #fff 0%, #f7fafc 100%);
}

.auth-info h2 {
  max-width: 620px;
  color: #101828;
}

.auth-info p {
  max-width: 560px;
  color: #475467;
}

.auth-tag {
  border-color: #b7ebcf;
  background: #edfcf4;
  color: var(--primary-dark);
}

.auth-metrics div {
  border-color: #e4e7ec;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.record-dialog-panel,
.redeem-panel {
  border-radius: 10px;
}

.record-dialog-head,
.redeem-head {
  border-bottom: 1px solid #eaecf0;
  background: #f8fafc;
}

.record-dialog-image {
  border-radius: 10px;
  background: #f8fafc;
}

.record-detail-grid div,
.record-full-prompt,
.record-input-images {
  border-color: #e4e7ec;
  border-radius: 8px;
}

.image-viewer-toolbar button,
.image-viewer-toolbar span {
  border-radius: 8px;
}

@media (max-width: 1180px) {
  .app-shell {
    width: calc(100% - 24px);
    max-width: 1180px;
  }

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

  .code-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-topbar {
    position: static;
  }

  .two-col,
  .auth-dashboard {
    grid-template-columns: 1fr;
  }

  .preview-card {
    grid-template-rows: auto minmax(340px, auto);
  }

  .preview-stage {
    min-height: 340px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: calc(100% - 16px);
    max-width: 720px;
    padding-top: 8px;
  }

  .app-topbar,
  .card,
  .stat-card,
  .admin-nav,
  .table-wrap {
    border-radius: 8px;
  }

  .topbar-account {
    grid-template-columns: minmax(0, 1fr) repeat(3, auto);
  }

  .stats-grid,
  .filter-bar,
  .code-create-form,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .auth-info,
  .auth-form-card {
    min-height: auto;
  }

  .auth-info h2 {
    font-size: 26px;
  }

  .history-list .record-card {
    min-height: 112px;
  }

  th,
  td {
    padding: 10px 12px;
  }
}

@media (max-width: 720px) {
  html,
  body.page-dashboard,
body.page-studio,
body.page-records,
body.page-account,
body.page-redeem,
body.page-admin {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  body.page-dashboard,
body.page-studio,
body.page-records,
body.page-account,
body.page-redeem,
body.page-admin {
    position: relative;
    touch-action: pan-y;
  }

  body.page-app .app-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-right: 8px;
    padding-left: 8px;
  }

  body.page-app main,
  body.page-app section,
  body.page-app form,
  body.page-app label,
  body.page-app input,
  body.page-app select,
  body.page-app textarea,
  body.page-app button {
    max-width: 100%;
    min-width: 0;
  }

  body.page-app .app-topbar,
  body.page-app .card,
  body.page-app .generation-notice,
  body.page-app .preview-stage,
  body.page-app .history-list,
  body.page-app .history-list .record-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body.page-app .topbar-right,
  body.page-app .topbar-nav,
  body.page-app .topbar-account {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.page-app .topbar-account {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.page-app .topbar-nav a,
  body.page-app .topbar-account .balance,
  body.page-app .topbar-account .nav-redeem,
  body.page-app .topbar-account .logout-link {
    min-width: 0;
    padding-right: 6px;
    padding-left: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.page-app .card-head {
    min-width: 0;
    max-width: 100%;
  }

  body.page-app .generation-notice,
  body.page-app textarea {
    overflow-wrap: anywhere;
  }
}

/* Polished motion and depth layer */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --ring: 0 0 0 3px rgba(22, 160, 109, 0.16);
  --shadow-lift: 0 18px 44px rgba(16, 24, 40, 0.1);
}

html {
  scroll-behavior: smooth;
}

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

a,
button,
.button,
.topbar-nav a,
.topbar-account .balance,
.topbar-account .nav-redeem,
.topbar-account .logout-link,
.mode-toggle label,
.record-card,
.stat-card,
.table-thumb,
.record-input-image-button,
.record-dialog-image-button,
.dialog-close {
  transition:
    transform 0.22s var(--ease-out),
    border-color 0.22s var(--ease-out),
    background-color 0.22s var(--ease-out),
    color 0.22s var(--ease-out),
    box-shadow 0.22s var(--ease-out),
    opacity 0.22s var(--ease-out);
}

input,
select,
textarea {
  transition:
    border-color 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out),
    background-color 0.2s var(--ease-out);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.record-card:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.app-topbar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9));
  backdrop-filter: blur(18px) saturate(1.18);
}

.topbar-brand:hover .brand-mark {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 14px 26px rgba(22, 160, 109, 0.26);
}

.topbar-nav a.active,
.topbar-account .nav-redeem,
.button.primary {
  background: linear-gradient(135deg, #1dbf82 0%, var(--primary) 58%, #0d7f5b 100%);
}

.topbar-nav a:not(.active):hover,
.topbar-account .logout-link:hover,
.button.secondary:hover,
.dialog-close:hover {
  transform: translateY(-1px);
}

.button:not(:disabled):active,
.topbar-nav a:active,
.topbar-account .nav-redeem:active,
.dialog-close:active,
.mode-toggle label:active {
  transform: translateY(0) scale(0.985);
}

.button.primary:hover,
.topbar-account .nav-redeem:hover {
  box-shadow: 0 12px 24px rgba(8, 127, 91, 0.22);
}

.card,
.stat-card,
.auth-info,
.auth-form-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.94)),
    var(--surface);
}

.card,
.stat-card {
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.03), var(--shadow-soft);
}

.card-head {
  position: relative;
}

.card-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -9px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(22, 160, 109, 0.2), rgba(228, 231, 236, 0.72), transparent);
}

.badge {
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.generation-notice {
  position: relative;
  overflow: hidden;
}

.generation-notice::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: #d99a18;
}

.mode-toggle label {
  position: relative;
  overflow: hidden;
}

.mode-toggle label:has(input:checked) {
  box-shadow: inset 0 0 0 1px rgba(22, 160, 109, 0.12), 0 8px 20px rgba(22, 160, 109, 0.1);
}

.mode-toggle label:has(input:checked)::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(22, 160, 109, 0.12);
}

select {
  appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, #667085 50%),
    linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

textarea::placeholder,
input::placeholder {
  color: #98a2b3;
}

.edit-upload-box {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 250, 252, 0.92)),
    #f8fafc;
}

.edit-upload-box:hover {
  transform: translateY(-1px);
}

.edit-preview-item,
.table-thumb,
.record-input-image-button {
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.preview-stage {
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.preview-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 34%),
    radial-gradient(circle at 50% 0%, rgba(22, 160, 109, 0.08), transparent 46%);
}

.preview-stage > * {
  position: relative;
  z-index: 1;
}

.preview-stage img {
  animation: fadeLift 0.42s var(--ease-soft);
}

.empty-state,
.preview-loading,
.preview-error,
.history-empty-inline {
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.06);
}

.preview-spinner {
  border-color: rgba(22, 160, 109, 0.14);
  border-top-color: var(--primary);
}

.history-list .record-card {
  transform: translateZ(0);
}

.history-list .record-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.history-list .record-card:hover .record-image img,
.table-thumb:hover img,
.record-input-image-button:hover img {
  transform: scale(1.035);
}

.record-image img,
.table-thumb img,
.record-input-image-button img,
.record-dialog-image img {
  transition: transform 0.42s var(--ease-soft);
}

.record-delete:hover,
.button.danger:hover {
  transform: translateY(-1px);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: #d0d5dd;
  box-shadow: var(--shadow-lift);
}

tbody tr td {
  transition: background-color 0.18s var(--ease-out);
}

.redeem-dialog,
.record-dialog,
.generation-overlay,
.image-viewer {
  animation: overlayIn 0.22s var(--ease-out);
}

.redeem-panel,
.record-dialog-panel,
.generation-modal {
  animation: panelIn 0.28s var(--ease-soft);
}

.image-viewer-stage img {
  animation: viewerIn 0.28s var(--ease-soft);
}

.jpt-layer-root {
  position: relative;
  z-index: 10040;
}

.jpt-toast-stack {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 10060;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.jpt-toast {
  min-height: 46px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(228, 231, 236, 0.94);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-soft);
  box-shadow: 0 18px 44px rgba(16, 24, 40, 0.14);
  backdrop-filter: blur(18px) saturate(1.12);
  cursor: pointer;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.45;
  overflow-wrap: anywhere;
  pointer-events: auto;
  animation: toastIn 0.28s var(--ease-soft);
}

.jpt-toast.is-leaving {
  animation: toastOut 0.18s var(--ease-out) forwards;
}

.jpt-toast-icon,
.jpt-layer-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
}

.jpt-toast-icon {
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 4px rgba(22, 160, 109, 0.11);
}

.jpt-toast-icon::after,
.jpt-layer-icon::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: inherit;
  background: #fff;
}

.jpt-toast.success {
  border-color: #b7ebcf;
  color: #166534;
}

.jpt-toast.error {
  border-color: #fecdca;
  color: var(--danger);
}

.jpt-toast.warning {
  border-color: #fed7aa;
  color: var(--warning);
}

.jpt-toast.info {
  border-color: #d0d5dd;
}

.jpt-toast.success .jpt-toast-icon {
  background: var(--success);
}

.jpt-toast.error .jpt-toast-icon {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.1);
}

.jpt-toast.warning .jpt-toast-icon {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(183, 121, 31, 0.12);
}

.jpt-toast.info .jpt-toast-icon {
  background: #475467;
  box-shadow: 0 0 0 4px rgba(71, 84, 103, 0.1);
}

.jpt-layer-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(10px);
  animation: overlayIn 0.22s var(--ease-out);
}

.jpt-layer-overlay.is-leaving {
  animation: overlayOut 0.18s var(--ease-out) forwards;
}

.jpt-layer-panel {
  width: min(420px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(16, 24, 40, 0.3);
  animation: panelIn 0.28s var(--ease-soft);
}

.jpt-layer-overlay.is-leaving .jpt-layer-panel {
  animation: panelOut 0.18s var(--ease-out) forwards;
}

.jpt-layer-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  padding: 22px 22px 18px;
}

.jpt-layer-icon {
  width: 40px;
  height: 40px;
  margin-top: 2px;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(22, 160, 109, 0.1);
}

.jpt-layer-panel.warning .jpt-layer-icon {
  background: var(--warning);
  box-shadow: 0 0 0 6px rgba(183, 121, 31, 0.12);
}

.jpt-layer-panel.error .jpt-layer-icon {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(217, 45, 32, 0.1);
}

.jpt-layer-panel.info .jpt-layer-icon {
  background: #475467;
  box-shadow: 0 0 0 6px rgba(71, 84, 103, 0.1);
}

.jpt-layer-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 850;
}

.jpt-layer-head p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.jpt-layer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #eaecf0;
  padding: 14px 18px;
  background: #f8fafc;
}

.jpt-layer-actions .button {
  min-width: 88px;
}

@keyframes fadeLift {
  from {
    transform: translateY(8px) scale(0.985);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes panelIn {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes viewerIn {
  from {
    transform: scale(0.985);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes overlayOut {
  to {
    opacity: 0;
  }
}

@keyframes panelOut {
  to {
    transform: translateY(10px) scale(0.985);
    opacity: 0;
  }
}

@keyframes toastIn {
  from {
    transform: translateX(18px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  to {
    transform: translateX(18px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 720px) {
  .card-head::after {
    bottom: -8px;
  }

  .jpt-toast-stack {
    top: 12px;
    right: 10px;
    left: 10px;
    width: auto;
  }

  .jpt-layer-overlay {
    align-items: end;
    padding: 10px;
  }

  .jpt-layer-panel {
    width: 100%;
    border-radius: 12px;
  }

  .jpt-layer-head {
    padding: 20px 18px 16px;
  }

  .jpt-layer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .jpt-layer-actions .button:only-child {
    grid-column: 1 / -1;
  }

  .mode-toggle label:has(input:checked)::after {
    right: 10px;
  }

  .history-list .record-card:hover,
  .stat-card:hover,
  .edit-upload-box:hover {
    transform: none;
  }
}

body.page-auth:has(.center-auth-page) {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0%, rgba(248, 250, 252, 0) 260px),
    #f6f8fb;
}

body.page-auth:has(.center-auth-page) .app-shell {
  width: min(100% - 36px, 430px);
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 28px 0 34px;
}

body.page-auth:has(.center-auth-register) .app-shell {
  width: min(100% - 36px, 450px);
}

.center-auth-page {
  width: 100%;
  align-self: center;
  display: grid;
  place-items: center;
  padding: 0;
}

.center-auth-panel {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.center-auth-top {
  margin-bottom: 26px;
  padding: 0;
  background: transparent;
}

.center-auth-brand {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto 28px;
  color: #101828;
  text-align: center;
  text-decoration: none;
}

.center-auth-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #19b37b 0%, #12875f 100%);
  color: #fff;
  font-size: 19px;
  font-weight: 850;
  box-shadow: 0 14px 28px rgba(22, 160, 109, 0.22);
}

.center-auth-mark svg {
  width: 37px;
  height: 37px;
  display: block;
}

.center-auth-mark .icon-frame,
.center-auth-mark .icon-line,
.center-auth-mark .icon-dot {
  fill: none;
  stroke: #fff;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.center-auth-mark .ai-spark {
  fill: #b7f7d5;
  stroke: #fff;
  stroke-width: 0.6;
}

.center-auth-mark .ai-spark.small {
  fill: #fff;
  stroke: none;
  opacity: 0.92;
}

.center-auth-brand strong {
  display: block;
  color: #101828;
  font-size: 28px;
  font-weight: 850;
  line-height: 1.08;
}

.center-auth-brand small {
  display: block;
  margin-top: 5px;
  color: #667085;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.center-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-height: 42px;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  padding: 4px;
  background: #edf1f5;
}

.center-auth-tabs a {
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #667085;
  font-size: 14px;
  font-weight: 780;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.center-auth-tabs a.active {
  background: #fff;
  color: #101828;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.center-auth-tabs a:not(.active):hover {
  color: #344054;
}

.center-auth-body {
  padding: 0;
}

.center-auth-form {
  display: grid;
  gap: 13px;
}

.center-auth-register .center-auth-form {
  gap: 12px;
}

.center-auth-field {
  display: grid;
  gap: 8px;
}

.center-auth-register .center-auth-field {
  gap: 7px;
}

.center-auth-field span {
  color: #344054;
  font-size: 13px;
  font-weight: 740;
}

.center-auth-field input {
  width: 100%;
  height: 48px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: #101828;
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.center-auth-register .center-auth-field input {
  height: 46px;
}

.center-auth-field input::placeholder {
  color: #98a2b3;
}

.center-auth-field input:hover {
  border-color: #98a2b3;
}

.center-auth-field input:focus {
  border-color: #16a06d;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 160, 109, 0.12);
}

.center-auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #19b37b 0%, #12875f 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(22, 160, 109, 0.2);
  transition: box-shadow 0.15s ease, filter 0.15s ease, transform 0.15s ease;
}

.center-auth-submit:hover {
  filter: brightness(0.98);
  box-shadow: 0 14px 26px rgba(22, 160, 109, 0.24);
}

.center-auth-submit:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  body.page-auth:has(.center-auth-page) .app-shell {
    width: min(100% - 32px, 390px);
    padding: 14px 0 20px;
  }

  body.page-auth:has(.center-auth-register) .app-shell {
    width: min(100% - 32px, 390px);
  }

  .center-auth-page {
    padding: 0;
    align-self: start;
    padding-top: clamp(18px, 8vh, 54px);
  }

  .center-auth-top {
    margin-bottom: 20px;
  }

  .center-auth-brand {
    gap: 9px;
    margin-bottom: 24px;
  }

  .center-auth-mark {
    width: 42px;
    height: 42px;
  }

  .center-auth-mark svg {
    width: 30px;
    height: 30px;
  }

  .center-auth-brand strong {
    font-size: 22px;
  }

  .center-auth-brand small {
    margin-top: 3px;
    font-size: 11px;
  }

  .center-auth-tabs {
    min-height: 40px;
    border-radius: 8px;
  }

  .center-auth-tabs a {
    font-size: 13px;
  }

  .center-auth-form {
    gap: 12px;
  }

  .center-auth-field {
    gap: 6px;
  }

  .center-auth-field span {
    font-size: 12px;
  }

  .center-auth-field input {
    height: 46px;
    border-radius: 8px;
    font-size: 14px;
  }

  .center-auth-submit {
    min-height: 46px;
    margin-top: 6px;
    font-size: 14px;
  }
}

/* ── E-commerce Studio (首页工作台) ── */
body.page-dashboard,
body.page-studio,
body.page-records,
body.page-account,
body.page-redeem,
body.page-admin {
  --studio-accent: #a68452;
  --studio-accent-soft: #f5f0e8;
  --studio-accent-dark: #8b6d42;
  --studio-amber: #b8860b;
  --studio-amber-soft: #faf6ed;
  background: var(--bg);
}

body.page-dashboard .app-shell {
  width: min(1320px, calc(100% - 28px));
  padding-top: 14px;
}

body.page-dashboard .app-topbar {
  margin-bottom: 20px;
  border-color: rgba(226, 232, 240, 0.95);
}

.studio-page {
  display: grid;
  gap: 20px;
}

.studio-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #ffffff 0%, #faf8f5 55%, var(--primary-soft) 100%);
  box-shadow: var(--shadow-soft);
}

.studio-hero-kicker {
  margin: 0 0 6px;
  color: var(--studio-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.studio-hero-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.studio-hero-desc {
  margin: 0;
  max-width: 640px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.65;
}

.studio-hero-stats {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.studio-stat {
  min-width: 108px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.studio-stat span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.studio-stat strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.studio-records-link {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
}

.studio-notice {
  padding: 12px 16px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: var(--studio-amber-soft);
  color: #92400e;
  font-size: 13px;
  line-height: 1.55;
}

.studio-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  align-items: start;
}

.studio-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.studio-panel-form {
  padding: 0 0 8px;
}

.studio-panel-preview {
  position: sticky;
  top: 14px;
  padding-bottom: 8px;
}

.studio-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
}

.studio-panel-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
}

.studio-form {
  padding: 0 22px 18px;
}

.studio-section {
  margin-bottom: 18px;
}

.studio-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.studio-section-label em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.studio-section-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.studio-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.studio-mode-toggle label {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 12px;
}

.studio-mode-toggle .mode-title {
  font-size: 14px;
  font-weight: 700;
}

.studio-mode-toggle small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.studio-mode-toggle label:has(input:checked) {
  border-color: rgba(166, 132, 82, 0.35);
  background: var(--studio-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(166, 132, 82, 0.12);
}

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

.studio-template {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: inherit;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.studio-template strong {
  font-size: 13px;
  font-weight: 700;
}

.studio-template span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.studio-template:hover {
  border-color: rgba(166, 132, 82, 0.35);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.studio-template.is-active {
  border-color: var(--studio-accent);
  background: var(--studio-accent-soft);
}

.studio-template:active {
  transform: scale(0.98);
}

.studio-upload-field .studio-section-label {
  margin-bottom: 8px;
}

.studio-upload-box {
  border-style: dashed;
  border-color: var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
}

.studio-upload-icon {
  color: var(--studio-accent);
  font-size: inherit;
  line-height: 1;
}

.studio-prompt-field textarea {
  min-height: 132px;
  border-radius: 12px;
  line-height: 1.6;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.studio-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.studio-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 4px;
}

.studio-btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 12px;
  background: var(--primary);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

body.page-dashboard .button.primary {
  background: var(--primary);
  box-shadow: 0 8px 20px rgba(166, 132, 82, 0.18);
}

body.page-dashboard .button.primary:hover {
  background: var(--primary-dark);
}

.studio-preview-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-preview-tag {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.studio-canvas {
  padding: 16px 22px 0;
}

.studio-canvas-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(166, 132, 82, 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(166, 132, 82, 0.05) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(180deg, var(--surface-soft), #fff);
}

.studio-canvas-frame[data-ratio="1:1"] .studio-preview-stage {
  aspect-ratio: 1 / 1;
  max-width: 360px;
}

.studio-canvas-frame[data-ratio="3:4"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="2:3"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="4:5"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="9:16"] .studio-preview-stage {
  aspect-ratio: 3 / 4;
  max-width: 300px;
}

.studio-canvas-frame[data-ratio="16:9"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="3:2"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="4:3"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="2:1"] .studio-preview-stage,
.studio-canvas-frame[data-ratio="21:9"] .studio-preview-stage {
  aspect-ratio: 16 / 9;
  max-width: 100%;
}

.studio-preview-stage {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(42, 40, 38, 0.08);
  overflow: hidden;
}

.studio-empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  height: 100%;
  min-height: 240px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.studio-empty-state strong {
  color: var(--text-soft);
  font-size: 15px;
}

.studio-empty-state span {
  max-width: 240px;
  font-size: 12px;
  line-height: 1.55;
}

.studio-empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 4px;
  border-radius: 16px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  color: var(--primary-dark);
}

.studio-preview-tips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 22px 18px;
}

.studio-tip {
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
}

.studio-tip strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.studio-tip span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.studio-recent {
  padding: 22px 24px 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: none;
}

.studio-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.studio-recent-head .eyebrow {
  color: var(--primary-dark);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.studio-recent-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
}

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

.studio-gallery-empty {
  grid-column: 1 / -1;
  padding: 36px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 14px;
  text-align: center;
}

.studio-gallery .record-card,
.studio-gallery-card {
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  grid-template-rows: unset;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
}

.studio-gallery .record-card:hover,
.studio-gallery-card:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transform: none;
}

.studio-gallery-card .record-image {
  aspect-ratio: 1 / 1;
  min-height: 0;
  background: var(--surface-soft);
}

.studio-gallery-card .record-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
  min-height: 0;
}

.studio-gallery .record-meta {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.studio-gallery .record-meta span:last-child {
  color: var(--text-soft);
  font-weight: 500;
}

.studio-gallery .record-body p {
  display: -webkit-box;
  margin: 0;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  max-height: none;
}

.studio-gallery .record-body time {
  color: var(--text-soft);
  font-size: 12px;
}

.studio-gallery .record-foot {
  margin-top: auto;
  padding-top: 4px;
}

.studio-gallery .record-delete {
  border-radius: 4px;
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.studio-gallery .status-pill {
  flex-shrink: 0;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.studio-gallery .status-pill.status-succeeded {
  background: var(--success-soft);
  color: #3d5c4a;
}

.studio-gallery .status-pill.status-running,
.studio-gallery .status-pill.status-queued {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.studio-gallery .status-pill.status-failed {
  background: var(--danger-soft);
  color: #8b3a32;
}

.studio-gallery .record-status-badge {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1080px) {
  .studio-workspace {
    grid-template-columns: 1fr;
  }

  .studio-panel-preview {
    position: static;
  }

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

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

  .studio-preview-tips {
    grid-template-columns: 1fr;
  }

  .studio-spec-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .studio-hero {
    flex-direction: column;
    padding: 18px;
  }

  .studio-hero-title {
    font-size: 22px;
  }

  .studio-hero-stats {
    width: 100%;
  }

  .studio-stat {
    flex: 1;
    min-width: 0;
  }

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

  .studio-templates {
    grid-template-columns: 1fr 1fr;
  }

  .studio-gallery {
    grid-template-columns: 1fr;
  }

  .studio-canvas-frame {
    min-height: 320px;
    padding: 12px;
  }
}

/* ── Dashboard sidebar layout ── */
body.page-dashboard {
  background: var(--bg);
}

.dash-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.dash-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  color: var(--text);
  z-index: 40;
}

.dash-sidebar-brand {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 4px 8px 24px;
  color: inherit;
  text-decoration: none;
}

.dash-sidebar-brand .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #c9a962, #a68452);
  box-shadow: 0 8px 20px rgba(166, 132, 82, 0.18);
}

.dash-sidebar-brand-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.dash-sidebar-brand-text small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.dash-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 0 4px;
}

.dash-nav-group {
  margin: 18px 10px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
}

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

.dash-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: inset 0 0 0 1px rgba(166, 132, 82, 0.14);
}

.dash-nav-icon {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--line-strong);
}

.dash-nav-item.active .dash-nav-icon {
  background: var(--primary);
}

.dash-nav-section {
  display: grid;
  gap: 2px;
}

.dash-nav-section-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.dash-nav-section-toggle:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.dash-nav-section.is-open .dash-nav-section-toggle {
  color: var(--text);
}

.dash-nav-chevron {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.dash-nav-section.is-open .dash-nav-chevron {
  transform: rotate(-135deg) translateY(2px);
}

.dash-nav-sub {
  display: none;
  padding: 2px 0 8px 8px;
}

.dash-nav-section.is-open .dash-nav-sub {
  display: block;
}

.dash-nav-subgroup {
  margin-bottom: 10px;
}

.dash-nav-subgroup:last-child {
  margin-bottom: 0;
}

.dash-nav-subgroup-label {
  margin: 8px 10px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.dash-nav-subitem {
  display: block;
  padding: 8px 12px 8px 22px;
  border-radius: 4px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
}

.dash-nav-subitem:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.dash-nav-subitem.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: inset 2px 0 0 var(--primary);
}

.dash-sidebar-foot {
  padding: 16px 8px 4px;
  border-top: 1px solid var(--line);
}

.dash-balance-card {
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.dash-balance-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.dash-balance-card strong {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.dash-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 10px;
  font-size: 13px;
}

.dash-username {
  color: var(--text);
  font-weight: 600;
}

.dash-logout {
  color: var(--muted);
  font-size: 12px;
}

.dash-back-home {
  display: block;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 12px;
}

.dash-main {
  min-width: 0;
  padding: 28px 32px 40px;
}

.dash-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.dash-page-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.dash-page-desc {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.dash-card {
  max-width: 560px;
  border-radius: 18px;
}

.studio-page-compact {
  gap: 18px;
}

.studio-page-compact .studio-hero {
  display: none;
}

.dash-mobile-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.dash-overlay {
  display: none;
}


@media (max-width: 960px) {
  .dash-shell {
    grid-template-columns: 1fr;
  }

  .dash-mobile-toggle {
    display: block;
  }

  .dash-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(288px, 88vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  .dash-shell.sidebar-open .dash-sidebar {
    transform: translateX(0);
  }

  .dash-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(42, 40, 38, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
    z-index: 35;
  }

  .dash-shell.sidebar-open .dash-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .dash-main {
    padding: 60px 18px 28px;
  }
}

/* ── Premium dashboard polish ── */
body.page-dashboard {
  --text: var(--lux-ink);
  --text-soft: var(--lux-ink-soft);
  --muted: var(--lux-ink-muted);
  background: var(--lux-bg);
}

.dash-sidebar {
  background: var(--lux-surface);
  border-right: 1px solid var(--lux-line);
}

.dash-sidebar-brand .brand-mark {
  border-radius: 4px;
  background: var(--lux-ink);
  box-shadow: none;
}

.dash-sidebar-brand-text strong {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.06em;
}

.dash-balance-card {
  background: var(--lux-surface);
  border: 1px solid var(--lux-line);
  border-radius: 4px;
}

.dash-balance-card strong {
  font-family: var(--font-display);
  font-weight: 500;
}

.dash-nav-item {
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.dash-nav-item.active {
  background: transparent;
  box-shadow: inset 3px 0 0 var(--lux-gold);
  border-radius: 0;
  color: var(--lux-ink);
}

.dash-nav-item.active .dash-nav-icon {
  background: var(--lux-gold);
}

.dash-nav-section-toggle {
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.dash-nav-subitem.active {
  background: transparent;
  box-shadow: inset 3px 0 0 var(--lux-gold);
  color: var(--lux-ink);
}

.dash-page-head .eyebrow {
  font-family: var(--font-ui);
  color: var(--lux-gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 11px;
}

.dash-page-head h2 {
  font-weight: 500;
}

body.page-dashboard .field input,
body.page-dashboard .field select,
body.page-dashboard .field textarea {
  border-color: var(--lux-line-strong);
  border-radius: 4px;
  background: var(--lux-surface);
}

body.page-dashboard .field input:focus,
body.page-dashboard .field select:focus,
body.page-dashboard .field textarea:focus {
  border-color: var(--lux-ink);
  box-shadow: none;
}

.studio-panel {
  border-color: var(--lux-line);
  border-radius: 4px;
  box-shadow: none;
}

.studio-panel-head {
  border-bottom-color: var(--lux-line);
  background: var(--lux-surface);
}

.studio-panel-head h3 {
  font-weight: 500;
}

.studio-panel-head .eyebrow {
  font-family: var(--font-ui);
  color: var(--lux-gold);
  letter-spacing: 0.18em;
}

.studio-template {
  border-radius: 4px;
  border-color: var(--lux-line);
}

.studio-template.is-active {
  border-color: var(--lux-ink);
  background: var(--lux-surface);
  box-shadow: inset 0 0 0 1px var(--lux-ink);
}

.studio-mode-toggle label {
  border-radius: 4px;
}

body.page-dashboard .button.primary,
.studio-btn-main {
  border-radius: 2px;
  background: var(--lux-ink) !important;
  box-shadow: none !important;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body.page-dashboard .button.primary:hover,
.studio-btn-main:hover {
  background: #2a2826 !important;
}

body.page-dashboard .button.secondary {
  border-radius: 2px;
  border-color: var(--lux-line-strong);
}

.studio-notice {
  border-radius: 4px;
  border-color: var(--lux-line-strong);
  background: var(--lux-surface);
  color: var(--lux-ink-soft);
}

.studio-canvas-frame {
  border-radius: 4px;
  border-color: var(--lux-line);
}

/* Studio recent works — override global history-list card layout */
body.page-dashboard .studio-recent {
  border-color: var(--lux-line);
}

body.page-dashboard .studio-gallery.history-list .record-card {
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  grid-template-columns: unset;
  grid-template-rows: unset;
  gap: 0;
  padding: 0;
  transform: none;
}

body.page-dashboard .studio-gallery .record-image {
  width: 100%;
  height: auto;
}

body.page-dashboard .studio-gallery .record-meta span:first-child {
  color: inherit;
}

body.page-dashboard .studio-gallery .record-body p {
  color: var(--lux-ink);
}

@media (max-width: 720px) {
  body.page-dashboard .studio-gallery.history-list .record-card {
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    padding: 0;
  }

  body.page-dashboard .studio-gallery .record-image {
    width: 100%;
    height: auto;
    border-radius: 0;
  }

  body.page-dashboard .studio-gallery .record-body {
    padding: 12px 14px 14px;
  }
}

.form-section-title {
  margin: 28px 0 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.field-checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

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

.inline-form {
  display: inline;
}

.muted.small,
.small.muted {
  font-size: 12px;
}

.article-edit-card {
  max-width: none;
}

.article-editor-toolbar {
  border: 1px solid var(--line);
  border-bottom: none;
}

.article-editor-body {
  min-height: 360px;
  border: 1px solid var(--line);
  background: #fff;
}

.article-edit-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.table-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 4px;
}

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

.inspiration-tag-check {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

@media (max-width: 720px) {
  .inspiration-tag-checkboxes {
    grid-template-columns: 1fr;
  }
}

.dash-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ── Credits purchase page ── */
body.page-credits .dash-main {
  width: 100%;
  max-width: none;
}

.credits-page {
  display: grid;
  gap: 28px;
  width: 100%;
}

.credits-page-head {
  margin-bottom: 0;
}

.credits-page-actions .button.secondary {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.credits-balance-banner {
  display: grid;
  gap: 20px;
  width: 100%;
  padding: 28px 32px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: linear-gradient(135deg, var(--lux-surface) 0%, #faf8f5 100%);
  box-shadow: var(--shadow-soft);
}

.credits-balance-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--lux-line);
}

.credits-balance-label {
  display: block;
  width: 100%;
  margin-bottom: 0;
  color: var(--lux-ink-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.credits-balance-value {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--lux-ink);
}

.credits-trust-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--lux-ink-soft);
  font-size: 13px;
}

.credits-trust-list li {
  position: relative;
  padding: 10px 12px 10px 28px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
}

.credits-trust-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lux-gold);
  transform: translateY(-50%);
}

.credits-section-head {
  margin-bottom: 18px;
}

.credits-section-head h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--lux-ink);
}

.credits-section-head p {
  margin: 0;
  color: var(--lux-ink-soft);
  font-size: 14px;
}

.credits-packages-section {
  width: 100%;
  padding-top: 0;
}

.credit-packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
  align-items: stretch;
}

.credit-package-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100%;
  padding: 0;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.credit-package-card:hover {
  border-color: var(--lux-line-strong);
  box-shadow: 0 16px 36px rgba(42, 40, 38, 0.08);
  transform: translateY(-2px);
}

.credit-package-card.is-featured {
  border-color: var(--lux-gold-line);
  box-shadow: 0 12px 32px rgba(166, 132, 82, 0.12);
}

.credit-package-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--lux-gold);
  color: var(--lux-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.credit-package-top {
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--lux-line);
  background: linear-gradient(180deg, #fff 0%, #faf9f7 100%);
}

.credit-package-name {
  margin: 0 0 16px;
  padding-right: 56px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--lux-ink);
}

.credit-package-credits {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.credit-package-num {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--lux-ink);
}

.credit-package-unit {
  color: var(--lux-ink-soft);
  font-size: 15px;
  font-weight: 600;
}

.credit-package-desc {
  flex: 1;
  display: grid;
  gap: 8px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--lux-line);
}

.credit-package-desc p {
  position: relative;
  margin: 0;
  padding-left: 14px;
  color: var(--lux-ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.credit-package-desc p::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lux-gold-line);
}

.credit-package-foot {
  display: grid;
  gap: 16px;
  margin-top: auto;
  padding: 20px 24px 24px;
}

.credit-package-price-block {
  display: grid;
  gap: 4px;
}

.credit-package-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
}

.credit-package-price {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  color: var(--lux-ink);
}

.credit-package-original {
  color: var(--lux-ink-muted);
  font-size: 14px;
}

.credit-package-unit-price {
  color: var(--lux-ink-muted);
  font-size: 12px;
}

.credit-package-form {
  margin: 0;
}

.credit-package-buy {
  width: 100%;
  min-height: 44px;
  border-radius: 4px;
  background: var(--lux-ink);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.credit-package-buy:hover {
  background: #3d3a36;
}

.credit-package-card.is-featured .credit-package-buy {
  background: var(--lux-gold);
  color: var(--lux-ink);
}

.credit-package-card.is-featured .credit-package-buy:hover {
  background: #c4a574;
}

.credits-empty-card {
  display: grid;
  gap: 12px;
  justify-items: start;
  max-width: 520px;
  padding: 28px 32px;
  border: 1px dashed var(--lux-line-strong);
  border-radius: 4px;
  background: var(--lux-surface);
}

.credits-empty-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

@media (max-width: 980px) {
  .credits-trust-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .credits-balance-banner {
    padding: 20px;
  }

  .credits-balance-main {
    padding-bottom: 16px;
  }

  .credit-packages-grid {
    grid-template-columns: 1fr;
  }

  .credits-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .credits-page-actions {
    width: 100%;
  }

  .credits-page-actions .button.secondary {
    flex: 1;
    justify-content: center;
  }

  .credits-balance-value {
    font-size: 34px;
  }
}

body.page-credits .credit-packages-grid .dash-card {
  max-width: none;
}

/* ── Account pages (ledger / redeem / password) ── */
body.page-credits-ledger .dash-main,
body.page-redeem .dash-main,
body.page-account .dash-main {
  width: 100%;
  max-width: none;
}

.account-page {
  display: grid;
  gap: 24px;
  width: 100%;
}

.account-page-head {
  margin-bottom: 0;
}

.account-balance-banner,
.credits-balance-banner {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 24px 28px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: linear-gradient(135deg, var(--lux-surface) 0%, #faf8f5 100%);
  box-shadow: var(--shadow-soft);
}

.account-balance-main,
.credits-balance-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.account-balance-label,
.credits-balance-label {
  display: block;
  width: 100%;
  margin-bottom: 0;
  color: var(--lux-ink-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-balance-value,
.credits-balance-value {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--lux-ink);
}

.account-balance-note {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--lux-line);
  color: var(--lux-ink-soft);
  font-size: 13px;
}

.account-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 20px;
  align-items: start;
  width: 100%;
}

.account-form-card,
.account-aside-card,
.account-table-panel {
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.account-form-card {
  padding: 28px 32px;
}

.account-form-head {
  margin-bottom: 22px;
}

.account-form-head h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--lux-ink);
}

.account-form-head p {
  margin: 0;
  color: var(--lux-ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.account-form .field input {
  min-height: 44px;
}

.account-form-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border-radius: 4px;
  background: var(--lux-ink);
  letter-spacing: 0.04em;
}

.account-form-submit:hover {
  background: #3d3a36;
}

.account-aside-card {
  padding: 24px 24px 28px;
}

.account-aside-card h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--lux-ink);
}

.account-tip-list {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.account-tip-list li {
  position: relative;
  padding-left: 16px;
  color: var(--lux-ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.account-tip-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lux-gold);
}

.account-aside-link {
  width: 100%;
  justify-content: center;
}

.account-aside-meta {
  display: grid;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--lux-line);
}

.account-aside-meta strong {
  font-size: 14px;
  color: var(--lux-ink);
  word-break: break-all;
}

.account-table-section {
  display: grid;
  gap: 16px;
  width: 100%;
}

.account-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-filter-tab {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  color: var(--lux-ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.account-filter-tab:hover {
  border-color: var(--lux-line-strong);
  color: var(--lux-ink);
}

.account-filter-tab.active {
  border-color: var(--lux-ink);
  background: var(--lux-ink);
  color: #fff;
}

.account-table-panel {
  padding: 0;
  overflow: hidden;
}

.account-table-panel .table-wrap {
  border: none;
  border-radius: 0;
}

.account-data-table th {
  background: #faf9f7;
  color: var(--lux-ink-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
}

.account-data-table td {
  vertical-align: middle;
}

.account-table-time {
  white-space: nowrap;
  color: var(--lux-ink-soft);
  font-size: 13px;
}

.account-table-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.account-table-desc {
  color: var(--lux-ink-soft);
  font-size: 13px;
}

.ledger-type-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f3f4f6;
  color: var(--lux-ink-soft);
}

.ledger-type-purchase {
  background: #e8f5ee;
  color: #1f6b45;
}

.ledger-type-consume {
  background: #fef3e2;
  color: #9a6700;
}

.ledger-type-redeem {
  background: #eef4ff;
  color: #175cd3;
}

.ledger-type-refund {
  background: #fdecec;
  color: #9b2c2c;
}

.ledger-type-admin_adjust {
  background: #f4f0ff;
  color: #6941c6;
}

.account-empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 48px 32px;
}

.account-empty-state h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

.account-pagination {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--lux-line);
}

@media (max-width: 900px) {
  .account-form-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .account-balance-value,
  .credits-balance-value {
    font-size: 34px;
  }

  .account-form-card {
    padding: 22px 20px;
  }

  .account-filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-filter-tab {
    justify-content: center;
    padding: 0 8px;
    font-size: 12px;
  }

  .account-data-table {
    min-width: 640px;
  }

  .account-table-panel .table-wrap {
    overflow-x: auto;
  }

  .account-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .account-page-head .dash-page-actions {
    width: 100%;
  }

  .account-page-head .dash-page-actions .button.secondary {
    flex: 1;
    justify-content: center;
  }
}

.admin-desc-cell {
  max-width: 280px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.text-positive {
  color: #1f6b45;
}

.text-negative {
  color: #9b2c2c;
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-muted, #f3f3f3);
}

.status-pill.status-credited {
  background: #e8f5ee;
  color: #1f6b45;
}

.status-pill.status-failed,
.status-pill.status-expired,
.status-pill.status-cancelled {
  background: #fdecec;
  color: #9b2c2c;
}

.credit-pay-card {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.credit-pay-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
  text-align: center;
}

.credit-pay-summary div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.credit-pay-package-desc {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.credit-pay-amount {
  font-size: 1.25rem;
}

.credit-pay-qrcode-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0 8px;
}

.credit-pay-qrcode {
  width: 240px;
  height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.credit-pay-tip {
  margin: 0;
  font-size: 15px;
}

.credit-pay-status.is-success {
  color: #1f6b45;
}

.credit-pay-status.is-error {
  color: #9b2c2c;
}

.credit-pay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 560px) {
  .credit-pay-summary {
    grid-template-columns: 1fr;
  }
}

/* ── Admin inspiration management ── */
body.page-admin-inspiration .dash-main {
  width: 100%;
  max-width: none;
}

.admin-inspiration-page {
  display: grid;
  gap: 20px;
  width: 100%;
}

.admin-page-head {
  margin-bottom: 0;
}

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

.admin-stat-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.admin-stat-card span {
  color: var(--lux-ink-muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.admin-stat-card strong {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  color: var(--lux-ink);
}

.admin-filter-card,
.admin-table-panel,
.admin-form-card.admin-inspiration-form-card,
.admin-aside-card.admin-inspiration-preview-card {
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.admin-filter-card {
  padding: 18px 20px;
}

.admin-filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
}

.admin-filter-form .field {
  margin: 0;
}

.admin-table-panel {
  padding: 0;
  overflow: hidden;
}

.admin-table-panel .table-wrap {
  border: none;
  border-radius: 0;
}

.admin-inspiration-table th {
  background: #faf9f7;
  color: var(--lux-ink-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.admin-inspiration-table td {
  vertical-align: middle;
}

.admin-inspiration-thumb {
  display: block;
  width: 72px;
  height: 72px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  overflow: hidden;
  background: #f5f3f0;
}

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

.admin-inspiration-title-cell {
  min-width: 180px;
}

.admin-inspiration-title-cell strong {
  display: block;
  margin-bottom: 4px;
}

.admin-inspiration-title-cell .small {
  display: block;
}

.admin-inspiration-metrics {
  white-space: nowrap;
  line-height: 1.6;
}

.admin-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--lux-ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.admin-badge-featured {
  margin-top: 6px;
  background: #faf6ed;
  color: #9a6700;
}

.admin-badge-success {
  background: #e8f5ee;
  color: #1f6b45;
}

.admin-badge-muted {
  background: #f3f4f6;
  color: var(--lux-ink-muted);
}

.admin-empty-state {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 48px 32px;
}

.admin-empty-state h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

.admin-inspiration-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 20px;
  align-items: start;
}

.admin-inspiration-form-card {
  padding: 28px 32px;
}

.admin-form-section {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--lux-line);
}

.admin-form-section:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.admin-form-section h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--lux-ink);
}

.admin-inspiration-form .field-grid {
  gap: 14px;
}

.admin-inspiration-publish-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-inspiration-tags {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-inspiration-preview-card {
  position: sticky;
  top: 24px;
  padding: 24px;
}

.admin-inspiration-preview-card h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.admin-inspiration-preview {
  display: grid;
  place-items: center;
  min-height: 180px;
  margin-bottom: 20px;
  padding: 12px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: #faf9f7;
}

.admin-inspiration-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 4px;
}

.admin-inspiration-preview-large img {
  max-height: 360px;
}

.admin-form-actions {
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .admin-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .admin-inspiration-edit-layout {
    grid-template-columns: 1fr;
  }

  .admin-inspiration-preview-card {
    position: static;
  }

  .admin-inspiration-tags {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .admin-filter-form {
    grid-template-columns: 1fr;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-inspiration-form-card {
    padding: 22px 18px;
  }

  .admin-inspiration-table {
    min-width: 860px;
  }

  .admin-inspiration-publish-grid {
    grid-template-columns: 1fr;
  }

  .admin-inspiration-tags {
    grid-template-columns: 1fr;
  }
}

/* ── Admin credit packages ── */
body.page-admin-credit-packages .dash-main {
  width: 100%;
  max-width: none;
}

.admin-credit-packages-page {
  display: grid;
  gap: 20px;
  width: 100%;
}

.admin-stat-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--lux-ink);
}

.admin-credit-packages-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 20px;
  align-items: start;
}

.admin-form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--lux-line);
}

.admin-form-section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

.admin-credit-package-form .admin-form-section h4 {
  margin: 0 0 14px;
  color: var(--lux-ink-soft);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-form-section-last {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.admin-credit-package-preview-card {
  position: sticky;
  top: 24px;
  padding: 24px;
}

.admin-credit-package-preview-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.admin-credit-package-preview {
  margin-top: 16px;
  pointer-events: none;
}

.admin-credit-preview-status {
  margin: 14px 0 0;
}

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

.admin-table-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.admin-credit-packages-table th {
  background: #faf9f7;
  color: var(--lux-ink-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.admin-credit-packages-table tr.is-editing td {
  background: #faf8f5;
}

@media (max-width: 900px) {
  .admin-credit-packages-form-layout {
    grid-template-columns: 1fr;
  }

  .admin-credit-package-preview-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .admin-credit-packages-table {
    min-width: 920px;
  }
}

/* ── Admin shared resource pages (articles, orders, settings) ── */
body.page-admin-articles .dash-main,
body.page-admin-orders .dash-main,
body.page-admin-settings .dash-main {
  width: 100%;
  max-width: none;
}

.admin-resource-page {
  display: grid;
  gap: 20px;
  width: 100%;
}

.admin-filter-form-wide {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
}

.admin-articles-table th,
.admin-orders-table th {
  background: #faf9f7;
  color: var(--lux-ink-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.admin-articles-table td,
.admin-orders-table td {
  vertical-align: middle;
}

.admin-article-title-cell {
  min-width: 200px;
}

.admin-article-title-cell strong {
  display: block;
  margin-bottom: 4px;
}

.admin-slug-hint {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f5f3f0;
  color: var(--lux-ink-muted);
  font-size: 11px;
}

.admin-table-time {
  white-space: nowrap;
}

.admin-order-no {
  font-size: 12px;
}

.admin-order-time {
  display: grid;
  gap: 2px;
  min-width: 140px;
  white-space: nowrap;
}

.admin-order-status-credited {
  background: #e8f5ee;
  color: #1f6b45;
}

.admin-order-status-pending,
.admin-order-status-paying,
.admin-order-status-paid {
  background: #fff7e6;
  color: #9a6700;
}

.admin-order-status-failed,
.admin-order-status-expired,
.admin-order-status-cancelled {
  background: #fce8e8;
  color: #9b2c2c;
}

.admin-order-status-refunded {
  background: #eef2ff;
  color: #4338ca;
}

.admin-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 20px;
  align-items: start;
}

.admin-settings-form {
  display: grid;
  gap: 20px;
}

.admin-form-card.admin-settings-section {
  padding: 28px 32px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.admin-settings-section-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--lux-line);
}

.admin-settings-section-head h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--lux-ink);
}

.admin-settings-section-head p {
  margin: 0;
  color: var(--lux-ink-muted);
  font-size: 13px;
}

.admin-settings-note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.admin-settings-submit {
  position: sticky;
  bottom: 16px;
  z-index: 2;
  padding: 16px 20px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.admin-aside-card.admin-settings-aside {
  position: sticky;
  top: 24px;
  padding: 24px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.admin-settings-aside h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.admin-settings-status-list {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.admin-settings-status-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lux-line);
}

.admin-settings-status-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.admin-settings-status-list span {
  color: var(--lux-ink-muted);
  font-size: 13px;
}

.admin-settings-status-list strong {
  color: var(--lux-ink);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.admin-settings-status-list strong.is-ok {
  color: #1f6b45;
}

.admin-settings-status-list strong.is-warn {
  color: #9a6700;
}

.admin-settings-status-url {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-aside-meta {
  display: grid;
  gap: 10px;
}

.admin-aside-link {
  width: 100%;
  justify-content: center;
}

@media (max-width: 1100px) {
  .admin-filter-form-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .admin-settings-layout {
    grid-template-columns: 1fr;
  }

  .admin-aside-card.admin-settings-aside {
    position: static;
  }
}

@media (max-width: 720px) {
  .admin-form-card.admin-settings-section {
    padding: 22px 18px;
  }

  .admin-articles-table {
    min-width: 880px;
  }

  .admin-orders-table {
    min-width: 980px;
  }
}

/* ── User center: templates page ── */
body.page-templates .dash-main {
  width: 100%;
  max-width: none;
}

.templates-page {
  display: grid;
  gap: 20px;
  width: 100%;
}

.templates-filters,
.templates-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.templates-filter-chip,
.templates-tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--lux-line);
  border-radius: 999px;
  background: var(--lux-surface);
  color: var(--lux-ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.templates-filter-chip:hover,
.templates-tag-chip:hover,
.templates-filter-chip.active,
.templates-tag-chip.active {
  border-color: var(--lux-ink);
  color: var(--lux-ink);
  background: #faf9f7;
}

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

.templates-card {
  overflow: hidden;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.templates-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.templates-card-media {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f5f3f0;
}

.templates-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.templates-card:hover .templates-card-media img {
  transform: scale(1.03);
}

.templates-card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f5f3f0, #ece8e2);
}

.templates-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #9a6700;
  font-size: 11px;
  font-weight: 700;
}

.templates-card-body {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.templates-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--lux-ink-muted);
  font-size: 12px;
}

.templates-card-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
}

.templates-card-body h3 a {
  color: inherit;
  text-decoration: none;
}

.templates-card-prompt {
  margin: 0;
  color: var(--lux-ink-soft);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.templates-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.templates-empty {
  padding: 56px 24px;
  border: 1px dashed var(--lux-line);
  border-radius: 4px;
  text-align: center;
}

.templates-empty h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}

@media (max-width: 720px) {
  .templates-grid {
    grid-template-columns: 1fr;
  }
}

/* ── User center: tools page ── */
body.page-tools .dash-main {
  width: 100%;
  max-width: none;
}

.tools-page {
  display: grid;
  gap: 32px;
  width: 100%;
}

.tools-section {
  display: grid;
  gap: 16px;
}

.tools-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lux-line);
}

.tools-section-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--lux-ink);
}

.tools-section-head p {
  margin: 0;
  font-size: 14px;
}

.tools-section-count {
  white-space: nowrap;
}

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

.tools-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tools-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tool-accent) 50%, var(--lux-line));
  box-shadow: var(--shadow);
}

.tools-card-thumb {
  display: grid;
  place-items: center;
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tool-accent) 22%, white), #f5f3f0);
}

.tools-card-icon {
  width: 36px;
  height: 36px;
  background: var(--tool-accent);
}

.tools-card-thumb-product {
  background: linear-gradient(135deg, #f5f0e8 0%, #e8dfd3 55%, #d9cbb8 100%);
}

.tools-card-thumb-wear {
  background: linear-gradient(135deg, #f3ece4 0%, #e5d5c8 55%, #cdb8a8 100%);
}

.tools-card-thumb-process {
  background: linear-gradient(135deg, #eceae6 0%, #ddd8d0 55%, #c8c0b4 100%);
}

.tools-card-body {
  display: grid;
  gap: 6px;
  padding: 14px 16px 16px;
}

.tools-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tools-card-mode,
.tools-card-layout {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f3f0;
  color: var(--lux-ink-muted);
  font-size: 11px;
  font-weight: 700;
}

.tools-card-layout {
  background: var(--tool-accent-soft, #f5f3f0);
  text-transform: capitalize;
}

.tools-card-body h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--lux-ink);
}

.tools-card-body p {
  margin: 0;
  color: var(--lux-ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .tools-section-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

/* ── Individual tool page ── */
body.page-tool .dash-main {
  width: 100%;
  max-width: none;
  padding-top: 20px;
}

.tool-page {
  display: grid;
  gap: 22px;
  --tool-accent-soft: color-mix(in srgb, var(--tool-accent) 16%, white);
}

.tool-notice {
  margin: 0;
}

.tool-hero {
  display: grid;
  gap: 20px;
  padding: 28px 32px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background:
    linear-gradient(135deg, var(--tool-accent-soft) 0%, transparent 55%),
    var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.tool-hero-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.tool-hero-icon-wrap {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--tool-accent);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--tool-accent) 35%, transparent);
}

.tool-hero-icon {
  display: block;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.92);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.tool-hero-icon-product,
.tool-hero-icon-grid,
.tool-hero-icon-stack { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M8 14l3-3 2 2 3-4'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M8 14l3-3 2 2 3-4'/%3E%3C/svg%3E"); }
.tool-hero-icon-scroll { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='7' y='3' width='10' height='18' rx='2'/%3E%3Cpath d='M9 8h6M9 12h6'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='7' y='3' width='10' height='18' rx='2'/%3E%3Cpath d='M9 8h6M9 12h6'/%3E%3C/svg%3E"); }
.tool-hero-icon-clone { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Crect x='4' y='4' width='12' height='12' rx='2'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Crect x='4' y='4' width='12' height='12' rx='2'/%3E%3C/svg%3E"); }
.tool-hero-icon-sparkle { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3z'/%3E%3C/svg%3E"); }
.tool-hero-icon-model,
.tool-hero-icon-outfit,
.tool-hero-icon-hanger { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='7' r='3'/%3E%3Cpath d='M6 21l6-8 6 8'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Ccircle cx='12' cy='7' r='3'/%3E%3Cpath d='M6 21l6-8 6 8'/%3E%3C/svg%3E"); }
.tool-hero-icon-portrait { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3Ccircle cx='12' cy='11' r='2.5'/%3E%3Cpath d='M8 17c.8-1.6 2.2-2.5 4-2.5s3.2.9 4 2.5'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3Ccircle cx='12' cy='11' r='2.5'/%3E%3Cpath d='M8 17c.8-1.6 2.2-2.5 4-2.5s3.2.9 4 2.5'/%3E%3C/svg%3E"); }
.tool-hero-icon-shoe { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 15c2-1 4-1 6 0l2 2h8v2H4v-4z'/%3E%3Cpath d='M8 13l2-4h6l2 4'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 15c2-1 4-1 6 0l2 2h8v2H4v-4z'/%3E%3Cpath d='M8 13l2-4h6l2 4'/%3E%3C/svg%3E"); }
.tool-hero-icon-palette,
.tool-hero-icon-smooth { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3c-4 0-7 2.5-7 6.5S8 16 12 16c1 0 2 .5 2 1.5 0 1.2-1 2.5-2.5 2.5-1.2 0-2-.5-2.5-1'/%3E%3Ccircle cx='8' cy='8.5' r='1'/%3E%3Ccircle cx='12' cy='6.5' r='1'/%3E%3Ccircle cx='16' cy='8.5' r='1'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 3c-4 0-7 2.5-7 6.5S8 16 12 16c1 0 2 .5 2 1.5 0 1.2-1 2.5-2.5 2.5-1.2 0-2-.5-2.5-1'/%3E%3Ccircle cx='8' cy='8.5' r='1'/%3E%3Ccircle cx='12' cy='6.5' r='1'/%3E%3Ccircle cx='16' cy='8.5' r='1'/%3E%3C/svg%3E"); }
.tool-hero-icon-edit,
.tool-hero-icon-cutout,
.tool-hero-icon-erase,
.tool-hero-icon-sharpen,
.tool-hero-icon-resize,
.tool-hero-icon-expand { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 20l7-7M14 6l4-4 4 4-4 4'/%3E%3Cpath d='M14 6h4v4'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M4 20l7-7M14 6l4-4 4 4-4 4'/%3E%3Cpath d='M14 6h4v4'/%3E%3C/svg%3E"); }
.tool-hero-icon-translate { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M5 8h8M9 4v8'/%3E%3Cpath d='M13 16h6M16 13v6'/%3E%3Cpath d='M3 18h6'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M5 8h8M9 4v8'/%3E%3Cpath d='M13 16h6M16 13v6'/%3E%3Cpath d='M3 18h6'/%3E%3C/svg%3E"); }
.tool-hero-icon-collage { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='3' width='8' height='8'/%3E%3Crect x='13' y='3' width='8' height='8'/%3E%3Crect x='3' y='13' width='8' height='8'/%3E%3Crect x='13' y='13' width='8' height='8'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Crect x='3' y='3' width='8' height='8'/%3E%3Crect x='13' y='3' width='8' height='8'/%3E%3Crect x='3' y='13' width='8' height='8'/%3E%3Crect x='13' y='13' width='8' height='8'/%3E%3C/svg%3E"); }

.tool-hero-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--lux-ink-muted);
  font-size: 12px;
}

.tool-hero-breadcrumb a {
  color: inherit;
  text-decoration: none;
}

.tool-hero-breadcrumb a:hover {
  color: var(--lux-ink);
}

.tool-hero-copy h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 500;
  line-height: 1.15;
  color: var(--lux-ink);
}

.tool-hero-tagline {
  margin: 0 0 14px;
  color: var(--lux-ink-soft);
  font-size: 15px;
  line-height: 1.6;
  max-width: 640px;
}

.tool-hero-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-hero-features li {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid color-mix(in srgb, var(--tool-accent) 30%, var(--lux-line));
  color: var(--lux-ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.tool-hero-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-hero-steps li {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
}

.tool-step-no {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--tool-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.tool-hero-steps strong {
  font-size: 14px;
  color: var(--lux-ink);
}

.tool-hero-steps small {
  color: var(--lux-ink-muted);
  font-size: 12px;
  line-height: 1.45;
}

.tool-workspace {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.tool-layout-upload .tool-workspace,
.tool-layout-translate .tool-workspace {
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
}

.tool-form-panel {
  padding: 24px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.tool-form-block {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--lux-line);
}

.tool-form-block:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.tool-form-block-primary {
  padding: 18px;
  margin-bottom: 22px;
  border: 1px dashed color-mix(in srgb, var(--tool-accent) 40%, var(--lux-line));
  border-radius: 4px;
  background: var(--tool-accent-soft);
}

.tool-form-block-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
}

.tool-form-block-head p {
  margin: 0 0 12px;
  color: var(--lux-ink-muted);
  font-size: 13px;
  line-height: 1.5;
}

.tool-upload-box {
  min-height: 160px;
  border-color: color-mix(in srgb, var(--tool-accent) 35%, var(--lux-line));
  background: #fff;
}

.tool-upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  background: var(--tool-accent-soft);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 16V4m0 0L8 8m4-4 4 4'/%3E%3Crect x='3' y='14' width='18' height='6' rx='2'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'%3E%3Cpath d='M12 16V4m0 0L8 8m4-4 4 4'/%3E%3Crect x='3' y='14' width='18' height='6' rx='2'/%3E%3C/svg%3E");
  mask-size: 28px;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: 28px;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

.tool-examples {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.tool-examples-label {
  color: var(--lux-ink-muted);
  font-size: 12px;
  font-weight: 700;
}

.tool-examples-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-example-chip {
  padding: 6px 10px;
  border: 1px solid var(--lux-line);
  border-radius: 999px;
  background: #faf9f7;
  color: var(--lux-ink-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.tool-example-chip:hover {
  border-color: var(--tool-accent);
  color: var(--lux-ink);
  background: var(--tool-accent-soft);
}

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

.tool-chip-grid-compact .tool-chip-body {
  padding: 10px 12px;
}

.tool-chip {
  display: block;
  cursor: pointer;
}

.tool-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tool-chip-body {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 12px 14px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.tool-chip-body strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--lux-ink);
}

.tool-chip-body small {
  color: var(--lux-ink-muted);
  font-size: 12px;
  line-height: 1.45;
}

.tool-chip input:checked + .tool-chip-body,
.tool-chip:hover .tool-chip-body {
  border-color: var(--tool-accent);
  background: var(--tool-accent-soft);
}

.tool-chip input:checked + .tool-chip-body {
  box-shadow: inset 0 0 0 1px var(--tool-accent);
}

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

.tool-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.tool-submit {
  flex: 1 1 auto;
}

.tool-preview-panel {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 24px;
}

.tool-preview-mock {
  padding: 24px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background:
    linear-gradient(160deg, var(--tool-accent-soft), transparent 70%),
    #faf9f7;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.tool-preview-mock.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: none;
}

.tool-mock-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 120px;
}

.tool-mock-before,
.tool-mock-after,
.tool-mock-output {
  display: grid;
  place-items: center;
  min-width: 100px;
  min-height: 100px;
  border: 1px dashed color-mix(in srgb, var(--tool-accent) 45%, var(--lux-line));
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--lux-ink-muted);
  font-size: 12px;
  font-weight: 700;
}

.tool-mock-after {
  border-style: solid;
  background: color-mix(in srgb, var(--tool-accent) 18%, white);
  color: var(--lux-ink);
}

.tool-mock-output {
  width: min(100%, 220px);
  min-height: 140px;
}

.tool-mock-arrow {
  color: var(--tool-accent);
  font-size: 22px;
  font-weight: 700;
}

.tool-preview-live {
  padding: 20px;
  border: 1px solid var(--lux-line);
  border-radius: 4px;
  background: var(--lux-surface);
  box-shadow: var(--shadow-soft);
}

.tool-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tool-preview-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.tool-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tool-canvas .studio-canvas-frame {
  min-height: 320px;
}

.tool-preview-empty {
  display: grid;
  gap: 6px;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--lux-ink-muted);
}

.tool-preview-empty strong {
  color: var(--lux-ink-soft);
  font-size: 15px;
}

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

@media (max-width: 960px) {
  .tool-workspace {
    grid-template-columns: 1fr;
  }

  .tool-preview-panel {
    position: static;
  }

  .tool-hero-main {
    grid-template-columns: 1fr;
  }

  .tool-hero-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .tool-hero {
    padding: 22px 18px;
  }

  .tool-form-panel {
    padding: 18px;
  }

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

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