:root {
  --ink: #171412;
  --muted: #766f66;
  --line: rgba(40, 32, 23, 0.12);
  --panel: rgba(255, 252, 245, 0.86);
  --accent: #0f766e;
  --accent-2: #f59e0b;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "SF Pro Display", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(20, 184, 166, 0.24), transparent 28rem),
    radial-gradient(circle at 85% 15%, rgba(245, 158, 11, 0.2), transparent 24rem),
    linear-gradient(135deg, #f8f1e7 0%, #ede7dc 45%, #f7f4ec 100%);
}

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

button {
  border: 0;
  border-radius: 999px;
  padding: 0.82rem 1.2rem;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #12100e, #2c2924);
  box-shadow: 0 14px 30px rgba(23, 20, 18, 0.16);
}

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

button.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  box-shadow: none;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.88rem 1rem;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.65;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 26px 0 60px;
}

.nav,
.section-title,
.row,
.nav-actions,
.admin-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav {
  margin-bottom: 38px;
}

.eyebrow,
.tag {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav h1 {
  margin-top: 0.35rem;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  letter-spacing: -0.05em;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 0.55fr;
  gap: 1rem;
  margin-bottom: 20px;
}

.hero h2 {
  max-width: 860px;
  margin: 0.7rem 0;
  font-size: clamp(2.4rem, 5vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: -0.07em;
}

.muted,
.hint {
  color: var(--muted);
  line-height: 1.75;
}

.hero-card,
.card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 34px;
  background: var(--panel);
  box-shadow: 0 26px 70px rgba(46, 39, 28, 0.12);
  backdrop-filter: blur(18px);
}

.hero-card {
  display: grid;
  align-content: center;
  gap: 0.6rem;
  min-height: 180px;
  padding: 1.6rem;
}

.hero-card span,
.hero-card small {
  color: var(--muted);
}

.hero-card strong {
  font-size: 3rem;
}

.grid,
.studio {
  display: grid;
  gap: 1rem;
}

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

.card {
  padding: 1.55rem;
}

.card h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

form.card {
  display: grid;
  gap: 1rem;
}

.composer {
  display: grid;
  gap: 1rem;
}

.result-card img {
  width: 100%;
  max-height: 680px;
  object-fit: contain;
  border-radius: 28px;
  background: #fff;
}

.empty {
  display: grid;
  min-height: 420px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 28px;
  color: var(--muted);
}

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

#history-panel,
#admin-panel {
  margin-top: 1rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.shot {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
}

.shot img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.shot .meta {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
  font-size: 0.86rem;
}

.pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  color: var(--accent);
  background: rgba(15, 118, 110, 0.1);
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.2rem;
}

.card-ops {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.45);
}

.card-maker {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(110px, 0.5fr) minmax(180px, 1fr) auto;
  gap: 0.75rem;
}

.created-cards {
  display: grid;
  gap: 0.8rem;
}

.created-cards textarea {
  min-height: 130px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  resize: vertical;
}

.wide-panel {
  grid-column: 1 / -1;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-top: 1rem;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.58);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.65rem;
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.82rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.52);
}

.mini-btn {
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 50;
  transform: translateX(-50%) translateY(-20px);
  max-width: min(560px, calc(100vw - 30px));
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  opacity: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 20px 50px rgba(30, 25, 20, 0.16);
  pointer-events: none;
  transition: 0.25s ease;
}

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

.toast.error {
  color: var(--danger);
}

@media (max-width: 920px) {
  .hero,
  .auth-grid,
  .studio,
  .admin-layout,
  .admin-summary,
  .card-maker {
    grid-template-columns: 1fr;
  }

  .nav,
  .section-title,
  .row,
  .admin-key-row {
    align-items: stretch;
    flex-direction: column;
  }

  .shell {
    width: min(100vw - 24px, 1440px);
    padding-top: 16px;
  }
}

/* Admin console aligned with the user-facing SaaS workbench. */
.admin-page {
  --admin-ink: #111827;
  --admin-muted: #6b7280;
  --admin-line: #e5e7eb;
  --admin-surface: #f6f8fb;
  --admin-panel: #ffffff;
  --admin-panel-soft: #f8fafc;
  --admin-primary: #2563eb;
  --admin-primary-hover: #1d4ed8;
  --admin-primary-soft: #eff6ff;
  --admin-success: #059669;
  --admin-success-soft: #ecfdf5;
  --admin-warn: #b45309;
  --admin-warn-soft: #fffbeb;
  --admin-danger: #b91c1c;
  --admin-danger-soft: #fef2f2;
  min-height: 100vh;
  color: var(--admin-ink);
  background: linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
}

.admin-page button {
  border: 1px solid transparent;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  background: var(--admin-primary);
  box-shadow: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.admin-page button:hover:not(:disabled) {
  background: var(--admin-primary-hover);
  transform: translateY(-1px);
}

.admin-page button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
}

.admin-page .ghost,
.admin-page .mini-btn,
.admin-page .admin-head-btn {
  color: var(--admin-ink);
  border-color: var(--admin-line);
  background: #fff;
}

.admin-page .ghost:hover:not(:disabled),
.admin-page .mini-btn:hover:not(:disabled),
.admin-page .admin-head-btn:hover:not(:disabled) {
  color: var(--admin-primary);
  border-color: #bfdbfe;
  background: var(--admin-primary-soft);
}

.admin-page input,
.admin-page textarea,
.admin-page select {
  width: 100%;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  padding: 0.82rem 0.92rem;
  color: var(--admin-ink);
  background: #fff;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

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

.admin-page textarea {
  resize: vertical;
  line-height: 1.7;
}

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

.admin-page .tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--admin-primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--admin-primary-soft);
}

.admin-shell {
  width: min(1480px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.admin-topbar {
  position: sticky;
  top: 14px;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  margin-bottom: 18px;
  border: 1px solid var(--admin-line);
  border-radius: 20px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
}

.admin-brand-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  object-fit: contain;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--admin-ink);
  background: #fff;
}

.admin-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.admin-login {
  display: grid;
  min-height: calc(100vh - 120px);
  place-items: center;
  padding: clamp(36px, 9vh, 96px) 0;
}

.admin-login-card {
  display: grid;
  gap: 18px;
  width: min(430px, 100%);
  border: 1px solid var(--admin-line);
  border-radius: 22px;
  padding: 30px;
  text-align: center;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.admin-login-card h1 {
  font-size: clamp(1.8rem, 4vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.admin-login-card button {
  min-height: 48px;
}

.admin-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--admin-line);
  border-radius: 20px;
  padding: 16px;
  background: var(--admin-panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.admin-sidebar-head {
  display: grid;
  gap: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--admin-line);
}

.admin-sidebar-head span {
  color: var(--admin-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-sidebar-head strong {
  font-size: 1rem;
  letter-spacing: -0.03em;
}

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

.admin-nav-item {
  width: 100%;
  min-height: 46px;
  border-color: transparent;
  border-radius: 14px;
  padding: 0 14px;
  color: #374151;
  text-align: left;
  font-weight: 700;
  background: #fff;
}

.admin-nav-item:hover {
  color: var(--admin-ink);
  border-color: #dbeafe;
  background: var(--admin-panel-soft);
}

.admin-nav-item.active {
  color: var(--admin-primary);
  border-color: #bfdbfe;
  background: var(--admin-primary-soft);
}

.admin-content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-view {
  display: none;
}

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

.admin-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 0;
}

.admin-section-head h2 {
  margin: 10px 0 0;
  font-size: clamp(1.7rem, 3vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.admin-copy {
  margin: 8px 0 0;
  max-width: 720px;
  color: var(--admin-muted);
  line-height: 1.65;
}

.admin-head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.admin-page .summary-card,
.admin-card {
  border: 1px solid var(--admin-line);
  border-radius: 18px;
  background: var(--admin-panel);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.admin-page .summary-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 156px;
  padding: 18px;
}

.summary-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.summary-card-label {
  color: var(--admin-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-page .summary-card strong {
  display: block;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.summary-card-meta {
  margin: 0;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.6;
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.panel-title-row,
.panel-title-row > div {
  display: flex;
  align-items: center;
}

.panel-title-row {
  justify-content: space-between;
  gap: 14px;
}

.panel-title-row > div {
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title-row h3,
.admin-card h3 {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: -0.03em;
}

.panel-title-row .muted {
  max-width: 360px;
  text-align: right;
}

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

.admin-health-list,
.admin-activity-list {
  display: grid;
  gap: 10px;
}

.admin-health-item,
.admin-activity-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--admin-panel-soft);
}

.admin-health-copy,
.admin-activity-copy,
.admin-activity-section {
  display: grid;
  gap: 4px;
}

.admin-health-copy,
.admin-activity-copy {
  min-width: 0;
}

.admin-health-copy strong,
.admin-activity-copy strong {
  font-size: 0.96rem;
  line-height: 1.45;
}

.admin-health-copy span,
.admin-activity-copy span {
  color: var(--admin-muted);
  font-size: 0.83rem;
  line-height: 1.55;
}

.admin-activity-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-activity-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  flex: 0 0 auto;
}

.admin-empty-state {
  padding: 18px;
  border: 1px dashed var(--admin-line);
  border-radius: 14px;
  color: var(--admin-muted);
  text-align: center;
  background: var(--admin-panel-soft);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.admin-badge.good {
  color: var(--admin-success);
  border-color: #a7f3d0;
  background: var(--admin-success-soft);
}

.admin-badge.info {
  color: var(--admin-primary);
  border-color: #bfdbfe;
  background: var(--admin-primary-soft);
}

.admin-badge.warn {
  color: var(--admin-warn);
  border-color: #fde68a;
  background: var(--admin-warn-soft);
}

.admin-badge.danger {
  color: var(--admin-danger);
  border-color: #fecaca;
  background: var(--admin-danger-soft);
}

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

.admin-shortcut {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 8px;
  min-height: 122px;
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  padding: 14px;
  color: var(--admin-ink);
  text-align: left;
  background: var(--admin-panel-soft);
}

.admin-shortcut:hover:not(:disabled) {
  color: var(--admin-ink);
  border-color: #bfdbfe;
  background: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.admin-shortcut strong {
  font-size: 1rem;
  line-height: 1.4;
}

.admin-shortcut span {
  color: var(--admin-muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.admin-shortcut em {
  color: var(--admin-primary);
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-page .card-ops {
  margin-top: 0;
  border-radius: 18px;
}

.admin-page .card-maker {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(120px, 0.52fr) minmax(180px, 1fr) auto;
  gap: 10px;
}

.channel-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr) minmax(220px, 1fr);
  gap: 10px;
}

.channel-form input[type="hidden"] {
  display: none;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  padding: 0 0.92rem;
  color: #374151;
  background: #fff;
}

.check-row input {
  width: auto;
}

.channel-actions {
  display: flex;
  gap: 10px;
}

.admin-page .created-cards textarea {
  min-height: 120px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.admin-page .table-wrap {
  overflow: auto;
  max-height: calc(100vh - 240px);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  background: #fff;
}

.admin-page table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-page th,
.admin-page td {
  border-bottom: 1px solid var(--admin-line);
  padding: 0.88rem 0.9rem;
  text-align: left;
  vertical-align: top;
}

.admin-page th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--admin-muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--admin-panel-soft);
}

.admin-page tbody tr:hover td {
  background: #f8fafc;
}

.admin-page code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
}

.admin-page .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--admin-primary);
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--admin-primary-soft);
}

@media (max-width: 1280px) {
  .admin-page .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-overview-grid,
  .admin-activity-grid,
  .admin-shortcut-grid,
  .channel-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .admin-shell {
    width: min(100vw - 22px, 1480px);
    padding-top: 10px;
  }

  .admin-topbar,
  .admin-actions,
  .admin-section-head,
  .panel-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-title-row .muted {
    max-width: none;
    text-align: left;
  }

  .admin-workspace,
  .admin-page .admin-summary,
  .admin-page .card-maker,
  .channel-form {
    grid-template-columns: 1fr;
  }

  .channel-actions {
    flex-direction: column;
  }

  .admin-sidebar {
    position: static;
  }

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

  .admin-nav-item {
    text-align: center;
  }

  .admin-login-card {
    padding: 24px;
  }
}

/* User image studio layout. Scoped so the separate admin console keeps its own simple layout. */
.user-page {
  min-height: 100vh;
  color: #15130f;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 205, 132, 0.34), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(88, 179, 255, 0.22), transparent 28rem),
    linear-gradient(135deg, #fbf3e5 0%, #f4eadb 38%, #eef5f1 100%);
}

.user-page button {
  box-shadow: none;
}

.vision-shell {
  width: min(1720px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.vision-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  margin-bottom: 14px;
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 28px;
  padding: 10px 12px 10px 14px;
  background: rgba(255, 252, 244, 0.78);
  box-shadow: 0 24px 70px rgba(76, 63, 42, 0.1);
  backdrop-filter: blur(22px);
}

.brand-lockup,
.nav-meta,
.user-pill,
.field-head,
.tray-head,
.credit-line {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #2dd4bf, #0f766e);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.22);
}

.brand-lockup strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
}

.brand-lockup span,
.user-pill span,
.queue-kicker,
.field-head small,
.tray-head small {
  color: #8a8173;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-meta {
  gap: 12px;
}

.nav-meta a {
  color: #087ea4;
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.user-pill {
  gap: 10px;
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 999px;
  padding: 7px 12px 7px 8px;
  color: #15130f;
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  box-shadow: none;
}

.user-pill:hover {
  border-color: rgba(15, 118, 110, 0.28);
  background: rgba(255, 255, 255, 0.9);
}

.user-pill strong {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #7c2d12;
  font-size: 0.76rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fed7aa, #fdba74);
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  color: #1d1a15;
  border: 1px solid rgba(45, 37, 24, 0.1);
  background: rgba(255, 255, 255, 0.72);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 20, 18, 0.24);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 30px;
  padding: 28px;
  background: rgba(255, 252, 244, 0.95);
  box-shadow: 0 30px 90px rgba(40, 32, 23, 0.2);
}

.modal-card h3 {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: #6d6358;
  background: rgba(255, 255, 255, 0.72);
}

.login-stage {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  min-height: calc(100vh - 118px);
  padding: clamp(36px, 9vh, 96px) 0;
}

.user-page .auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  place-items: center;
}

.glass-card {
  border: 1px solid rgba(45, 37, 24, 0.1);
  background: rgba(255, 252, 244, 0.78);
  box-shadow: 0 24px 70px rgba(76, 63, 42, 0.1);
  backdrop-filter: blur(22px);
}

.auth-card {
  display: grid;
  gap: 22px;
  width: 100%;
  max-width: 430px;
  justify-self: center;
  border-radius: 30px;
  padding: 34px;
}

.auth-shell {
  border-color: rgba(45, 37, 24, 0.11);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(255, 250, 241, 0.86)),
    radial-gradient(circle at 50% 0%, rgba(20, 184, 166, 0.08), transparent 16rem);
  box-shadow: 0 28px 80px rgba(76, 63, 42, 0.13);
}

.auth-head {
  display: block;
  text-align: center;
}

.auth-head h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 999px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.54);
}

.auth-tab {
  border: 0;
  border-radius: 999px;
  padding: 0.76rem 0.9rem;
  color: #6d6358;
  font-size: 0.92rem;
  font-weight: 900;
  background: transparent;
}

.auth-tab.active {
  color: white;
  background: linear-gradient(135deg, #14110f, #2a241f);
}

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

.auth-form input {
  min-height: 52px;
  border-radius: 18px;
}

.auth-form button {
  margin-top: 4px;
  min-height: 52px;
  font-weight: 900;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(310px, 0.78fr) minmax(440px, 1.06fr) minmax(340px, 0.78fr);
  gap: 16px;
  min-height: calc(100vh - 98px);
}

.order-panel,
.queue-column,
.side-stack {
  min-height: 0;
}

.order-panel {
  position: sticky;
  top: 18px;
  display: grid;
  align-content: start;
  gap: 18px;
  height: calc(100vh - 98px);
  overflow: auto;
  border-radius: 34px;
  padding: 24px;
}

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

.field-head {
  justify-content: space-between;
  gap: 12px;
  color: #5f574d;
  font-weight: 800;
}

.user-page select,
.user-page input,
.user-page textarea {
  border-color: rgba(45, 37, 24, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.order-panel textarea {
  min-height: 168px;
  border-radius: 24px;
  resize: vertical;
}

.upload-box {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 1px dashed rgba(45, 37, 24, 0.22);
  border-radius: 22px;
  padding: 0;
  color: #8a8173;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.46);
  box-shadow: none;
}

.upload-box span {
  font-size: 1.5rem;
}

.upload-box small {
  width: 70px;
  text-align: center;
  font-size: 0.68rem;
}

.upload-box:hover {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.38);
  background: rgba(20, 184, 166, 0.08);
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(3, 86px);
  gap: 8px;
}

.reference-item {
  position: relative;
  overflow: hidden;
  width: 86px;
  height: 86px;
  border: 1px solid rgba(45, 37, 24, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
}

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

.reference-item button {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  color: white;
  font-size: 1rem;
  line-height: 1;
  background: rgba(23, 20, 18, 0.7);
}

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

.ratio {
  border: 1px solid rgba(45, 37, 24, 0.1);
  padding: 0.74rem 0.5rem;
  color: #3a332c;
  font-size: 0.86rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.6);
}

.ratio.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.credit-line {
  justify-content: space-between;
  gap: 10px;
  color: #7a7166;
  font-size: 0.86rem;
  font-weight: 700;
}

.order-btn {
  width: 100%;
  border-radius: 20px;
  padding: 1rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, #b45309, #ea580c);
  box-shadow: 0 18px 42px rgba(180, 83, 9, 0.22);
}

.queue-column {
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: auto;
  height: calc(100vh - 98px);
  padding-right: 2px;
}

.queue-card {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 30px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.68), rgba(255, 250, 241, 0.84)),
    radial-gradient(circle at 92% 50%, rgba(20, 184, 166, 0.08), transparent 18rem);
  box-shadow: 0 18px 52px rgba(76, 63, 42, 0.08);
}

.preview-slot {
  position: relative;
  display: grid;
  min-height: 132px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(45, 37, 24, 0.18);
  border-radius: 24px;
  color: #5e574d;
  font-weight: 900;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.92), rgba(225, 216, 200, 0.36)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.44), rgba(246, 238, 225, 0.58));
}

.preview-slot img,
.result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-content {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 132px;
  border: 1px solid rgba(45, 37, 24, 0.08);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.46);
}

.queue-content strong {
  font-size: 1rem;
}

.queue-content p {
  color: #7a7166;
  line-height: 1.65;
}

.side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
  height: calc(100vh - 98px);
  overflow: auto;
}

.tray {
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 32px;
  padding: 18px;
  background: rgba(255, 252, 244, 0.78);
  box-shadow: 0 18px 52px rgba(76, 63, 42, 0.08);
}

.tray-primary {
  min-height: 280px;
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.86), rgba(255, 237, 213, 0.54)),
    radial-gradient(circle at 85% 85%, rgba(251, 146, 60, 0.16), transparent 18rem);
}

.tray-blue {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.86), rgba(224, 242, 254, 0.64)),
    radial-gradient(circle at 85% 85%, rgba(14, 165, 233, 0.14), transparent 18rem);
}

.tray-rose {
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.86), rgba(255, 228, 230, 0.56)),
    radial-gradient(circle at 85% 85%, rgba(244, 63, 94, 0.12), transparent 18rem);
}

.tray-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.tray-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.amber {
  background: #f59e0b;
}

.dot.blue {
  background: #0284c7;
}

.dot.rose {
  background: #e11d48;
}

.small {
  padding: 0.42rem 0.72rem;
  font-size: 0.8rem;
}

.empty.compact {
  min-height: 94px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.36);
}

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

.user-page .shot {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  min-width: 0;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
}

.shot-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
}

.user-page .shot img,
.shot-placeholder {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.shot-placeholder {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(45, 37, 24, 0.16);
  color: #8a8173;
  font-size: 0.84rem;
  font-weight: 800;
}

.shot-caption {
  display: grid;
  gap: 6px;
  padding: 8px 0 0;
  font-size: 0.72rem;
}

.shot-caption-meta {
  display: grid;
  gap: 4px;
}

.shot-caption .pill {
  max-width: 100%;
  padding: 0.18rem 0.46rem;
  font-size: 0.68rem;
}

.pill.danger {
  color: #be123c;
  background: rgba(225, 29, 72, 0.1);
}

.shot-caption small {
  overflow: hidden;
  color: #8a8173;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.shot-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.shot-card-actions button {
  min-height: 26px;
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 999px;
  padding: 0.28rem 0.2rem;
  color: #433b33;
  font-size: 0.68rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.66);
}

.shot-card-actions button:hover {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.22);
  background: rgba(255, 255, 255, 0.9);
}

.shot-card-actions button.danger {
  color: #be123c;
  background: rgba(225, 29, 72, 0.08);
}

.shot-card-actions button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.job-modal-card {
  width: min(780px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.job-detail,
.job-viewer {
  display: grid;
  gap: 16px;
}

.job-detail h3 {
  margin-top: 8px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -0.06em;
}

.job-modal-image,
.job-modal-empty,
.job-viewer img {
  width: 100%;
  max-height: 68vh;
  object-fit: contain;
  border: 1px solid rgba(45, 37, 24, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.job-modal-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: #8a8173;
}

.job-detail dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.job-detail dl div,
.job-detail section {
  border: 1px solid rgba(45, 37, 24, 0.09);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.48);
}

.job-detail dt {
  color: #8a8173;
  font-size: 0.75rem;
  font-weight: 800;
}

.job-detail dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.job-detail p {
  margin-top: 8px;
  color: #5f574d;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.job-detail .error {
  color: #be123c;
}

.job-viewer-title {
  overflow: hidden;
  color: #5f574d;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 1280px) {
  .workbench {
    grid-template-columns: minmax(300px, 0.88fr) minmax(420px, 1.12fr);
  }

  .side-stack {
    grid-column: 1 / -1;
    height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .vision-shell {
    width: min(100vw - 22px, 1720px);
    padding-top: 10px;
  }

  .vision-nav,
  .nav-meta,
  .login-stage,
  .workbench,
  .queue-card,
  .side-stack {
    grid-template-columns: 1fr;
  }

  .vision-nav,
  .nav-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .login-stage {
    min-height: auto;
  }

  .auth-card {
    max-width: none;
    border-radius: 28px;
    padding: 22px;
  }

  .order-panel,
  .queue-column,
  .side-stack {
    position: static;
    height: auto;
    overflow: visible;
  }

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

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

/* Replacement SaaS workbench for the user-facing image site. */
.saas-page {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #f7f8fa;
  --panel: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --radius: 16px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
}

.saas-page button {
  border: 0;
  border-radius: 10px;
  padding: 0;
  color: inherit;
  cursor: pointer;
  background: transparent;
  box-shadow: none;
}

.saas-page button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.saas-page input,
.saas-page textarea,
.saas-page select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.78rem 0.9rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

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

.saas-page textarea {
  min-height: 138px;
  resize: vertical;
  line-height: 1.7;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(320px, 1fr);
  align-items: center;
  height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.brand,
.header-actions,
.top-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-icon {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 1.08rem;
  letter-spacing: -0.03em;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.top-nav {
  gap: 40px;
  height: 100%;
}

.top-nav button {
  position: relative;
  height: 100%;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 600;
}

.top-nav button:hover,
.top-nav button.active {
  color: var(--primary);
}

.top-nav button.active::after {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 34px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
  transform: translateX(-50%);
}

.header-actions {
  justify-content: flex-end;
  gap: 12px;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  border: 1px solid var(--line) !important;
  padding: 0 13px !important;
  background: #fff !important;
}

.credit-pill span {
  color: var(--muted);
  font-size: 0.86rem;
}

.credit-pill strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.upgrade-btn {
  min-height: 40px;
  padding: 0 18px !important;
  color: #fff !important;
  font-weight: 700;
  background: var(--primary) !important;
}

.upgrade-btn:hover,
.generate-btn:hover {
  background: var(--primary-hover) !important;
}

.header-actions .icon-btn {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px !important;
}

.avatar-btn img {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
}

.avatar-btn span {
  color: var(--muted);
  font-size: 0.82rem;
}

.page-shell {
  width: min(1480px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.auth-stage {
  display: grid;
  min-height: calc(100vh - 118px);
  place-items: center;
}

.auth-card-v2 {
  display: grid;
  gap: 20px;
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.05);
}

.auth-title {
  text-align: center;
}

.auth-title h1 {
  font-size: 1.65rem;
  letter-spacing: -0.05em;
}

.auth-title p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.saas-page .auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  background: #f9fafb;
}

.saas-page .auth-tab {
  min-height: 38px;
  color: var(--muted);
  font-weight: 700;
}

.saas-page .auth-tab.active {
  color: #fff;
  background: var(--primary);
}

.saas-page .auth-form {
  display: grid;
  gap: 14px;
}

.saas-page .auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.saas-page .auth-form button,
.recharge-card > button:not(.modal-close) {
  min-height: 46px;
  color: #fff;
  font-weight: 700;
  background: var(--primary);
}

.workspace {
  display: grid;
  grid-template-columns: 398px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.config-panel,
.result-panel,
.history-panel {
  scroll-margin-top: 92px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.02);
}

.config-panel {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 22px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 20px;
}

.config-section {
  display: grid;
  gap: 12px;
}

.section-head,
.section-head > div,
.section-actions,
.panel-head,
.template-head {
  display: flex;
  align-items: center;
}

.section-head,
.panel-head,
.template-head {
  justify-content: space-between;
  gap: 14px;
}

.section-head > div {
  gap: 11px;
}

.section-head span:first-child {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.section-head h2,
.template-head h2,
.panel-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.section-actions {
  gap: 16px;
}

.section-actions button,
.reset-btn,
.template-head button,
.text-btn {
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 650;
}

.section-actions small {
  color: var(--muted);
}

.prompt-wrap {
  position: relative;
}

.clear-prompt {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  color: #9ca3af !important;
}

.helper {
  color: var(--muted);
  font-size: 0.85rem;
}

.helper span {
  color: var(--primary);
  font-weight: 650;
}

.reference-upload {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

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

.reference-head strong {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.reference-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.saas-page .reference-grid {
  display: grid;
  grid-template-columns: repeat(5, 62px);
  gap: 8px;
}

.saas-page .reference-grid.is-dragging .upload-box,
.saas-page .upload-box:hover {
  border-color: rgba(37, 99, 235, 0.42) !important;
  color: var(--primary) !important;
  background: var(--primary-soft) !important;
}

.saas-page .upload-box,
.saas-page .reference-item {
  width: 62px;
  height: 62px;
  border: 1px dashed var(--line) !important;
  border-radius: 12px;
  background: #fff !important;
  box-shadow: none !important;
}

.saas-page .upload-box {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 0 !important;
  color: var(--muted) !important;
}

.saas-page .upload-box span {
  font-size: 1.25rem;
  line-height: 1;
}

.saas-page .upload-box small {
  width: auto;
  font-size: 0.68rem;
  line-height: 1.2;
}

.saas-page .reference-item {
  position: relative;
  overflow: hidden;
  border-style: solid !important;
}

.saas-page .reference-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.saas-page .reference-item button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  width: 20px;
  height: 20px;
  min-height: 20px;
  place-items: center;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0 !important;
  color: #fff !important;
  font-size: 0.88rem;
  line-height: 1;
  background: rgba(17, 24, 39, 0.72) !important;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.style-card {
  position: relative;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  padding: 4px !important;
  background: #fff !important;
}

.style-card:hover,
.style-card.active {
  border-color: var(--primary) !important;
}

.style-card.active {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.style-card img {
  width: 100%;
  height: 68px;
  border-radius: 8px;
  object-fit: cover;
}

.style-card span {
  display: block;
  padding: 8px 2px 4px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 650;
}

.style-card i {
  position: absolute;
  right: 7px;
  bottom: 28px;
  display: none;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 0.7rem;
  font-style: normal;
  background: var(--primary);
}

.style-card.active i {
  display: grid;
}

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

.params-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.advanced-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border: 1px solid #dbe4f0 !important;
  border-radius: 14px !important;
  padding: 9px 10px !important;
  color: var(--ink) !important;
  text-align: left;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.advanced-toggle:hover {
  border-color: #bfdbfe !important;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%) !important;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
}

.advanced-toggle:focus-visible {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.advanced-toggle[aria-expanded="true"] {
  border-color: #bfdbfe !important;
  background:
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%) !important;
}

.advanced-toggle-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.advanced-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--primary);
  font-size: 0.9rem;
  background: var(--primary-soft);
}

.advanced-toggle strong {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.2;
}

.advanced-toggle small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advanced-arrow {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  background: #fff;
}

.advanced-toggle[aria-expanded="true"] .advanced-arrow {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.advanced-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.advanced-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.advanced-panel input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--ink);
  font-size: 0.9rem;
  background: #fff;
  outline: none;
}

.advanced-panel input:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.generate-section {
  display: grid;
  gap: 8px;
}

.generate-btn {
  min-height: 52px;
  color: #fff !important;
  font-size: 0.98rem;
  font-weight: 800;
  background: var(--primary) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
}

.generate-section p,
.generate-section .status {
  text-align: center;
  color: var(--muted);
  font-size: 0.83rem;
}

.template-section {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.template-card {
  overflow: hidden;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  background: #fff !important;
}

.template-card:hover {
  border-color: rgba(37, 99, 235, 0.45) !important;
}

.template-card img {
  width: 100%;
  height: 74px;
  object-fit: cover;
}

.template-card span {
  display: block;
  padding: 8px 4px 10px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
  text-align: center;
}

.content-panel {
  display: grid;
  gap: 16px;
}

.result-panel,
.history-panel {
  padding: 18px;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head > div {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.panel-head h2 {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.panel-head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.ghost-btn {
  border: 1px solid var(--line) !important;
  min-height: 38px;
  padding: 0 12px !important;
  color: var(--muted) !important;
  font-size: 0.84rem;
  background: #fff !important;
}

.ghost-btn:hover {
  color: #dc2626 !important;
  background: #fef2f2 !important;
}

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

.result-card {
  display: grid;
  grid-template-rows: auto 38px;
  gap: 8px;
  min-width: 0;
}

.result-card > img,
.skeleton-card > div,
.pending-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  object-fit: cover;
  background: #f3f4f6;
}

.loading-preview {
  display: grid !important;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(243, 244, 246, 0.92)),
    #f3f4f6;
}

.loading-preview span {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.loading-preview small {
  max-width: 150px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.pending-preview {
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.result-card footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0;
}

.result-card footer button {
  min-height: 36px;
  border: 1px solid var(--line) !important;
  padding: 0 8px !important;
  color: var(--ink) !important;
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
  background: #fff !important;
}

.result-card footer button:hover {
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: var(--primary) !important;
  background: var(--primary-soft) !important;
}

.skeleton-card > div {
  animation: pulse 1.2s ease-in-out infinite;
}

.skeleton-card footer button {
  cursor: wait;
  opacity: 0.58;
  color: var(--muted) !important;
  background: #f9fafb !important;
}

.skeleton-card footer {
  grid-template-columns: 1fr;
}

.skeleton-card footer .loading-action {
  color: var(--muted) !important;
  font-weight: 600;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 236px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #f9fafb;
}

.empty-state.compact {
  min-height: 120px;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 274px;
  overflow-y: auto;
  padding-right: 6px;
  outline: none;
  scrollbar-gutter: stable;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.history-list.is-focused {
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.history-list::-webkit-scrollbar {
  width: 8px;
}

.history-list::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 999px;
}

.history-list::-webkit-scrollbar-thumb {
  border: 2px solid #f3f4f6;
  border-radius: 999px;
  background: #cbd5e1;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.history-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 110px 38px;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.history-item:hover {
  border-color: rgba(37, 99, 235, 0.28);
  background: #fbfdff;
}

.history-thumbs {
  display: block;
}

.history-thumbs img,
.history-placeholder {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
}

.history-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

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

.history-main h3 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-main p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.history-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.history-meta button {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.delete-history {
  width: 34px;
  height: 34px;
  color: var(--muted) !important;
}

.delete-history:hover {
  color: #dc2626 !important;
  background: #fef2f2 !important;
}

.saas-page .modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(8px);
}

.saas-page .modal-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.18);
}

.saas-page .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  background: #f9fafb;
}

.preview-card {
  width: min(960px, calc(100vw - 40px)) !important;
  height: min(860px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  padding: 0 !important;
  justify-items: stretch;
  align-items: stretch;
  text-align: center;
}

.preview-card.is-zoomed {
  justify-items: stretch;
}

.preview-stage {
  display: grid;
  width: 100%;
  min-height: 0;
  overflow: auto;
  place-items: center;
  background: #fff;
}

.preview-card.is-zoomed .preview-stage {
  place-items: start center;
}

.preview-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 3;
  display: inline-flex;
  transform: translateX(-50%);
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
  backdrop-filter: blur(8px);
}

.preview-toolbar button {
  min-height: 30px;
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  padding: 0 11px !important;
  color: var(--ink) !important;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  background: #fff !important;
}

.preview-toolbar button:hover {
  border-color: rgba(37, 99, 235, 0.32) !important;
  color: var(--primary) !important;
  background: var(--primary-soft) !important;
}

.preview-toolbar span {
  min-width: 52px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.preview-card .modal-close {
  top: 14px;
  right: 14px;
  z-index: 4;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(17, 24, 39, 0.08);
  backdrop-filter: blur(8px);
}

.preview-card img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  border-radius: 0;
  object-fit: contain;
  background: #f9fafb;
  cursor: zoom-in;
  transition: width 0.14s ease, max-width 0.14s ease, max-height 0.14s ease;
}

.preview-card img.is-zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.preview-card p {
  justify-self: center;
  width: 100%;
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 12px 24px 16px;
  color: var(--muted);
  background: #fff;
  line-height: 1.6;
}

.job-modal-card {
  width: min(780px, calc(100vw - 40px)) !important;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.saas-page .toast {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 70;
  transform: translateX(-50%) translateY(-12px);
  max-width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  opacity: 0;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 14px 32px rgba(17, 24, 39, 0.12);
  pointer-events: none;
  transition: 0.18s ease;
}

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

.saas-page .toast.error {
  color: #dc2626;
}

@media (max-width: 1280px) {
  .app-header {
    grid-template-columns: 240px 1fr auto;
  }

  .top-nav {
    gap: 26px;
  }

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

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

  .history-item {
    grid-template-columns: 96px minmax(0, 1fr) 110px 38px;
  }
}

@media (max-width: 980px) {
  .app-header {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
    gap: 14px;
    padding: 16px;
  }

  .top-nav,
  .header-actions {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .page-shell {
    width: min(100vw - 22px, 1600px);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .config-panel {
    position: static;
    max-height: none;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .history-meta {
    justify-items: start;
  }
}

@media (max-width: 640px) {
  .style-grid,
  .template-grid,
  .params-grid,
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-head,
  .panel-head > div {
    align-items: flex-start;
    flex-direction: column;
  }
}
