:root {
  --bg: #0d0d0f;
  --ink: #f7f4ee;
  --muted: #aaa7a2;
  --paper: #f2efe8;
  --paper-2: #faf8f4;
  --paper-ink: #211e1b;
  --paper-muted: #6b655e;
  --line: #303034;
  --line-soft: #ddd7cd;
  --card: #1b1b1e;
  --primary: #ff6b43;
  --primary-ink: #160c08;
  --danger: #c43d3d;
  --ok: #1b8f5a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.26);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--paper-ink);
  background: #f7f6f3;
}

html,
body {
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  transform: translateY(-160%);
  background: #fff;
  padding: 10px 14px;
  z-index: 100;
}

.skip-link:focus {
  transform: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand strong {
  color: var(--primary);
  font-weight: 650;
}

.brand.compact {
  font-size: 14px;
}

.brand-mark {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 900;
}

.brand-mark.image-mark {
  background: transparent;
  object-fit: cover;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--primary);
  color: var(--primary-ink);
}

.button.ghost {
  border-color: rgba(128, 128, 128, 0.24);
  background: transparent;
  color: inherit;
}

.button.big {
  min-height: 46px;
  padding: 0 22px;
  font-size: 16px;
}

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

.button.full {
  width: 100%;
}

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

.home-page {
  background: var(--bg);
  color: var(--ink);
}

.home-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  padding: 0 max(24px, calc((100vw - 1280px) / 2));
}

.home-nav {
  margin-left: auto;
  display: flex;
  gap: 28px;
  color: #c7c3bd;
  font-size: 13px;
}

.hero {
  min-height: calc(100svh - 68px);
  display: grid;
  grid-template-columns: minmax(17rem, 0.78fr) minmax(28rem, 1.22fr);
  align-items: center;
  gap: 46px;
  width: min(calc(100% - 64px), 1280px);
  margin: 0 auto;
  padding: 54px 0;
  overflow-x: clip;
}

.hero > *,
.split-section > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hero h1,
.section-heading h2,
.split-section h2,
.final-cta h2,
.admin-hero h1 {
  margin: 0;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(3rem, 5.5vw, 4.85rem);
  overflow-wrap: anywhere;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 500px;
  margin: 24px 0 0;
  color: rgba(247, 244, 238, 0.72);
  line-height: 1.75;
}

.hero-copy .button {
  margin-top: 32px;
}

.capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
  color: var(--muted);
  font-size: 14px;
}

.capabilities span {
  padding-right: 14px;
  border-right: 1px solid var(--line);
}

.capabilities span:last-child {
  border-right: 0;
}

.hero-stage {
  position: relative;
  min-height: 650px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-stage::before {
  position: absolute;
  inset: 16% 8% 8%;
  content: "";
  border-radius: 999px;
  background: radial-gradient(circle, var(--primary), transparent 68%);
  filter: blur(44px);
  opacity: 0.22;
}

.hero-card,
.hero-main {
  position: absolute;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.hero-card {
  top: 16%;
  width: 56%;
  opacity: 0.72;
}

.hero-card img,
.hero-main > img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.hero-card.left {
  left: 3%;
  transform: rotate(-6deg);
}

.hero-card.right {
  right: 3%;
  transform: rotate(6deg);
}

.home-hero-card-left,
.home-hero-card-right {
  transition: transform 0.3s ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .home-hero-stage:hover .home-hero-card-left {
    transform: translate(-0.375rem) rotate(-7deg);
  }

  .home-hero-stage:hover .home-hero-card-right {
    transform: translate(0.375rem) rotate(7deg);
  }
}

.hero-main {
  position: relative;
  width: 64%;
}

.hero-main figcaption {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 126%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(27, 27, 30, 0.68);
  padding: 14px 16px;
  color: rgba(247, 244, 238, 0.85);
  backdrop-filter: blur(18px);
}

.hero-main figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-main figcaption strong {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  font-size: 12px;
}

.hero-main figcaption small {
  color: rgba(247, 244, 238, 0.68);
  white-space: nowrap;
}

.paper {
  background: var(--paper);
  color: var(--paper-ink);
}

.split-section,
.section-inner {
  width: min(calc(100% - 64px), 1280px);
  margin: 0 auto;
}

.split-section {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(28rem, 1.2fr);
  gap: 80px;
  align-items: center;
  padding: 96px max(32px, calc((100% - 1280px) / 2));
}

.split-section h2,
.section-heading h2,
.final-cta h2 {
  font-size: clamp(2.2rem, 4vw, 3.15rem);
}

.split-section p:not(.eyebrow),
.section-heading p:not(.eyebrow) {
  max-width: 520px;
  color: var(--paper-muted);
  line-height: 1.75;
}

.wide-image,
.reference-grid img,
.gallery-grid img {
  border-radius: 18px;
  object-fit: cover;
}

.wide-image {
  width: 100%;
  aspect-ratio: 3 / 2;
}

.gallery-section,
.prompt-section,
.pricing-section {
  padding: 96px 0;
  border-top: 0;
}

.gallery-section {
  background: var(--paper-2);
  color: var(--paper-ink);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px 28px;
  margin-top: 44px;
}

.gallery-grid figure,
.reference-grid figure {
  margin: 0;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 5;
}

.gallery-grid figcaption {
  display: grid;
  gap: 5px;
  padding-top: 12px;
  color: var(--paper-muted);
  font-size: 14px;
}

.gallery-grid figcaption strong {
  color: var(--paper-ink);
}

.reference-section {
  padding: 96px 0;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 44px;
}

.reference-grid img {
  width: 100%;
  aspect-ratio: 3 / 2;
}

.reference-grid figcaption {
  padding-top: 12px;
  color: var(--paper-muted);
}

.prompt-section {
  background: #111113;
  color: var(--ink);
}

.prompt-section .section-heading p {
  color: var(--muted);
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.prompt-grid article,
.pricing-card {
  border: 1px solid #3a3a3e;
  border-radius: 16px;
  background: #202023;
  padding: 22px;
}

.prompt-grid strong {
  display: block;
  margin-bottom: 10px;
  color: #fff;
}

.prompt-grid p {
  margin: 0;
  color: #c7c3bd;
  line-height: 1.75;
}

.final-cta {
  min-height: 70svh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(13, 13, 15, 0.66), rgba(13, 13, 15, 0.8)),
    url("/images/home-v2/prompt-cliff-house-1536.webp") center/cover;
  text-align: center;
}

.final-cta h2 {
  max-width: 680px;
  color: #fff;
}

.final-cta .button {
  margin-top: 28px;
}

.pricing-section {
  background: #171719;
  color: var(--ink);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  gap: 24px;
  margin-top: 36px;
}

.pricing-card {
  position: relative;
  min-height: 184px;
  display: flex;
  flex-direction: column;
}

.pricing-card.featured {
  border-color: rgba(255, 107, 67, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 107, 67, 0.16), rgba(255, 107, 67, 0.04)),
    #202023;
  box-shadow: 0 22px 54px rgba(255, 107, 67, 0.18);
  transform: translateY(-8px);
}

.pricing-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.pricing-card h3 {
  margin: 0;
  font-size: 18px;
}

.pricing-card-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--primary);
  padding: 5px 9px;
  color: var(--primary-ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pricing-card p {
  margin: 8px 0 20px;
  color: #c7c3bd;
}

.pricing-card strong {
  display: block;
  margin-top: auto;
  margin-bottom: 18px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.pricing-card.featured strong {
  color: #fff;
  font-size: clamp(2.6rem, 5vw, 4rem);
}

.pricing-card.featured .button {
  box-shadow: 0 12px 28px rgba(255, 107, 67, 0.24);
}

.skeleton {
  min-height: 160px;
  border-radius: 16px;
  background: linear-gradient(90deg, #202023, #303034, #202023);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite;
}

.site-footer {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding: 0 max(24px, calc((100vw - 1280px) / 2));
  color: var(--muted);
  font-size: 13px;
}

.auth-page {
  min-height: 100svh;
  background: #f7f6f3;
}

.auth-shell {
  width: min(100% - 40px, 1024px);
  min-height: 100svh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.auth-shell header {
  min-height: 72px;
  display: flex;
  align-items: center;
}

.auth-card {
  width: min(100%, 430px);
  margin: auto;
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 18px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(33, 30, 27, 0.08);
}

.auth-card h1 {
  margin: 0;
  font-size: 28px;
}

.auth-card > p {
  margin: 8px 0 24px;
  color: var(--paper-muted);
}

form label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  font-weight: 700;
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(33, 30, 27, 0.16);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  color: var(--paper-ink);
  outline: none;
}

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

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 67, 0.16);
}

small {
  color: var(--paper-muted);
  font-weight: 500;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-field .button {
  min-width: 96px;
  white-space: nowrap;
}

.code-hint.success {
  color: var(--ok);
}

.code-hint.failed {
  color: var(--danger);
}

.form-error {
  margin: -5px 0 14px;
  color: var(--danger);
  font-size: 13px;
}

.auth-switch {
  margin: 20px 0 0;
  text-align: center;
  color: var(--paper-muted);
}

.auth-switch a {
  color: #d4512e;
  font-weight: 800;
}

.workbench-page {
  min-height: 100svh;
  background: #f5f4f0;
}

.workbench-loading {
  min-height: 100svh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--paper-muted);
}

.workbench-loading strong {
  color: var(--paper-ink);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(33, 30, 27, 0.12);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

.app-header,
.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid rgba(33, 30, 27, 0.1);
  background: rgba(247, 246, 243, 0.92);
  padding: 0 max(18px, calc((100vw - 1536px) / 2 + 20px));
  backdrop-filter: blur(16px);
}

.app-title {
  border-left: 1px solid rgba(33, 30, 27, 0.14);
  padding-left: 16px;
  color: var(--paper-muted);
  font-weight: 700;
}

.provider-pill {
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px;
  color: var(--paper-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--paper-muted);
  font-size: 13px;
}

.workbench-main {
  width: min(calc(100% - 32px), 1536px);
  margin: 0 auto;
  padding: 16px 0;
  display: grid;
  grid-template-columns: 352px minmax(0, 1fr);
  gap: 16px;
}

.composer-card,
.result-card,
.history-panel,
.admin-card {
  border: 1px solid rgba(33, 30, 27, 0.11);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(33, 30, 27, 0.06);
}

.composer-card {
  padding: 16px;
}

.balance-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(255, 107, 67, 0.22);
  border-radius: 14px;
  background: #fff6f2;
  padding: 14px;
  margin-bottom: 18px;
}

.balance-card span {
  display: block;
  color: var(--paper-muted);
  font-size: 12px;
}

.balance-card strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--paper-muted);
}

.field-head label,
.field-head h2,
.field-head span:first-child {
  margin: 0;
  color: var(--paper-ink);
  font-size: 14px;
  font-weight: 800;
}

.prompt-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.prompt-library-trigger {
  min-height: 30px;
  border-radius: 9px;
  padding-inline: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}

.segmented button {
  min-height: 34px;
  border: 1px solid rgba(33, 30, 27, 0.12);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.segmented button[aria-pressed="true"] {
  border-color: rgba(255, 107, 67, 0.42);
  background: #fff0ea;
  color: #d4512e;
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 108px;
  border: 1px dashed rgba(33, 30, 27, 0.22);
  border-radius: 14px;
  margin: 0 0 10px;
  background: #fbfaf8;
  cursor: pointer;
  text-align: center;
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-box span {
  font-weight: 900;
}

.file-name {
  margin: 0 0 14px;
  color: var(--paper-muted);
  font-size: 13px;
}

.result-card {
  min-height: 620px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.result-card > header,
.history-panel > header,
.admin-card > header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(33, 30, 27, 0.09);
  padding: 10px 16px;
}

.result-card h1,
.history-panel h2,
.admin-card h2 {
  margin: 0;
  font-size: 18px;
}

.result-card header p {
  margin: 4px 0 0;
  color: var(--paper-muted);
  font-size: 12px;
}

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

.result-stage {
  min-height: 0;
  flex: 1;
  display: grid;
  place-items: center;
  background: #ebe8e1;
  padding: 18px;
}

.empty-state {
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--paper-muted);
}

.empty-state strong {
  color: var(--paper-ink);
}

.result-stage img {
  max-height: calc(100svh - 180px);
  border-radius: 16px;
  box-shadow: 0 16px 45px rgba(33, 30, 27, 0.2);
}

.generation-placeholder {
  width: min(100%, 420px);
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(90deg, #ded8cc, #f8f5ef, #ded8cc);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite;
}

.history-panel {
  width: min(calc(100% - 32px), 1536px);
  margin: 0 auto 18px;
  overflow: hidden;
}

.history-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 14px;
}

.history-item {
  width: 154px;
  flex: 0 0 auto;
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.history-item img,
.history-thumb-empty {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #eee9df;
}

.history-thumb-empty {
  display: grid;
  place-items: center;
  color: var(--paper-muted);
  font-size: 12px;
}

.history-item span {
  display: block;
  padding: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper-muted);
  font-size: 12px;
}

.purchase-dialog {
  width: min(100% - 28px, 540px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--paper-ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.purchase-dialog::backdrop {
  background: rgba(13, 13, 15, 0.58);
}

.prompt-dialog {
  width: min(100% - 28px, 896px);
  height: min(760px, calc(100svh - 32px));
  max-height: calc(100svh - 32px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--paper-ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.prompt-dialog::backdrop {
  background: rgba(13, 13, 15, 0.58);
}

.prompt-dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.prompt-dialog-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(33, 30, 27, 0.1);
  padding: 18px;
}

.prompt-dialog-card h2 {
  margin: 0;
  font-size: 20px;
}

.prompt-dialog-card p {
  margin: 5px 0 0;
  color: var(--paper-muted);
  font-size: 13px;
}

.prompt-dialog-body {
  display: flex;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 14px 18px 18px;
}

.prompt-category-tabs {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  gap: 8px;
  overflow: visible;
}

.prompt-category-tabs button {
  min-height: 32px;
  flex: none;
  border: 1px solid rgba(33, 30, 27, 0.12);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  color: var(--paper-ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.prompt-category-tabs button[aria-pressed="true"] {
  border-color: rgba(255, 107, 67, 0.42);
  background: #ff6b43;
  color: #fff;
}

.prompt-card-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

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

.prompt-template-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(33, 30, 27, 0.12);
  border-radius: 10px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.prompt-template-card:hover {
  border-color: rgba(255, 107, 67, 0.42);
  box-shadow: 0 10px 24px rgba(33, 30, 27, 0.1);
  transform: translateY(-1px);
}

.prompt-template-card img {
  display: block;
  aspect-ratio: 4 / 3;
  width: 100%;
  background: #f1eee8;
  object-fit: cover;
}

.prompt-template-card span {
  display: block;
  padding: 10px 12px;
  color: var(--paper-ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

.prompt-library-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--paper-muted);
  font-size: 13px;
  text-align: center;
}

.prompt-library-state strong {
  color: var(--paper-ink);
}

.dialog-card {
  margin: 0;
  padding: 0;
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.dialog-card header {
  border-bottom: 1px solid rgba(33, 30, 27, 0.1);
}

.dialog-card footer {
  border-top: 1px solid rgba(33, 30, 27, 0.1);
}

.dialog-card h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-card p {
  margin: 5px 0 0;
  color: var(--paper-muted);
  font-size: 13px;
}

.icon-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f1eee8;
  cursor: pointer;
  font-size: 22px;
}

.purchase-options {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.buy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 14px;
  padding: 14px;
}

.buy-row h3 {
  margin: 0;
  font-size: 15px;
}

.buy-row p {
  margin: 4px 0 0;
}

.qr-box {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.qr-box img {
  width: 220px;
  height: 220px;
  border: 12px solid #fff;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(33, 30, 27, 0.12);
}

.manual-recharge {
  padding: 22px;
}

.manual-recharge strong {
  display: block;
  border-radius: 14px;
  background: #fff6f2;
  padding: 16px;
  color: #d4512e;
  font-size: 20px;
}

.manual-recharge p {
  margin-top: 12px;
  line-height: 1.7;
}

.manual-package-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.manual-package-list li {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 12px;
  background: #fbfaf8;
  padding: 12px;
}

.manual-package-list li.featured {
  border-color: rgba(255, 107, 67, 0.55);
  background: #fff2ec;
  box-shadow: 0 10px 24px rgba(255, 107, 67, 0.12);
}

.manual-package-list strong,
.manual-package-list span {
  display: block;
}

.manual-package-list strong {
  color: var(--paper-ink);
}

.manual-package-list em {
  display: inline-flex;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--primary);
  padding: 3px 7px;
  color: var(--primary-ink);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  vertical-align: middle;
}

.manual-package-list span {
  color: var(--paper-muted);
  font-size: 13px;
}

.grant-controls {
  display: grid;
  grid-template-columns: 92px 108px auto;
  gap: 8px;
  align-items: center;
}

.grant-controls input {
  min-width: 0;
  height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

.admin-page {
  background: #f5f4f0;
}

.admin-header nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  color: var(--paper-muted);
  font-size: 13px;
}

.admin-main {
  width: min(calc(100% - 36px), 1380px);
  margin: 0 auto;
  padding: 26px 0 40px;
}

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

.admin-hero h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.admin-hero p:not(.eyebrow) {
  color: var(--paper-muted);
}

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

.metric {
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 16px;
  background: #fff;
  padding: 18px;
}

.metric span {
  color: var(--paper-muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

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

.admin-card {
  overflow: hidden;
}

.admin-main > .admin-card {
  margin-bottom: 14px;
}

.admin-card > div:not(.table-wrap) {
  padding: 16px;
}

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

.admin-section-note {
  margin: 5px 0 0;
  color: var(--paper-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.provider-config-list {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(33, 30, 27, 0.08);
  background: #fbfaf8;
}

.provider-config-row {
  border: 1px solid rgba(33, 30, 27, 0.1);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.provider-config-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.provider-config-head strong,
.provider-config-head span {
  display: block;
}

.provider-config-head strong {
  font-size: 15px;
}

.provider-config-head span {
  margin-top: 4px;
  color: var(--paper-muted);
  font-size: 12px;
}

.provider-config-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  align-items: end;
  gap: 10px;
}

.provider-config-form label {
  min-width: 0;
  margin: 0;
  color: var(--paper-muted);
  font-size: 12px;
}

.provider-config-form input,
.provider-config-form select {
  min-width: 0;
  height: 36px;
  margin-top: 6px;
  padding: 7px 9px;
  font-size: 12px;
}

.provider-config-actions {
  display: flex;
  flex-wrap: wrap;
  grid-column: span 2;
  gap: 7px;
}

.provider-test-prompt {
  grid-column: span 2;
}

.danger-button {
  color: var(--danger);
}

.provider-test-result {
  display: grid;
  grid-template-columns: auto 1fr minmax(80px, 130px);
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  border-radius: 10px;
  background: #f6f3ed;
  padding: 9px 10px;
  color: var(--paper-muted);
  font-size: 12px;
}

.provider-test-result strong {
  color: var(--paper-ink);
}

.provider-test-result.succeeded {
  background: #e8f6ee;
  color: var(--ok);
}

.provider-test-result.failed {
  background: #f8e9e9;
  color: var(--danger);
}

.provider-test-result.running {
  background: #fff6f2;
  color: #d4512e;
}

.provider-test-result img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: min(100%, 410px);
}

.admin-toolbar input {
  width: min(280px, 100%);
  height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

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

.provider-list div {
  border-radius: 12px;
  background: #f6f3ed;
  padding: 12px;
}

.provider-list span {
  display: block;
  color: var(--paper-muted);
  font-size: 12px;
}

.provider-list strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid rgba(33, 30, 27, 0.08);
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

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

th {
  color: var(--paper-muted);
  font-size: 12px;
  font-weight: 800;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f1eee8;
  color: var(--paper-muted);
}

.status.paid,
.status.succeeded {
  background: #e8f6ee;
  color: var(--ok);
}

.status.failed,
.status.closed {
  background: #f8e9e9;
  color: var(--danger);
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

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

@media (max-width: 920px) {
  .home-nav {
    display: none;
  }

  .hero,
  .workbench-main,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .split-section {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero {
    min-height: auto;
  }

  .hero-stage {
    min-height: 520px;
  }

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

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

  .provider-test-prompt,
  .provider-config-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .home-header,
  .site-footer,
  .admin-hero,
  .app-header {
    flex-wrap: wrap;
  }

  .home-header {
    padding: 12px 16px;
  }

  .home-header .button {
    margin-left: auto;
  }

  .hero,
  .section-inner,
  .workbench-main,
  .history-panel,
  .admin-main {
    width: min(calc(100% - 24px), 100%);
  }

  .split-section {
    width: 100%;
    padding-inline: 12px;
  }

  .hero-stage {
    min-height: 420px;
  }

  .hero-card {
    display: none;
  }

  .hero-main {
    width: min(88%, 360px);
  }

  .hero-main figcaption {
    width: 108%;
  }

  .gallery-grid,
  .reference-grid,
  .prompt-grid,
  .prompt-card-grid,
  .metric-grid,
  .provider-list {
    grid-template-columns: 1fr;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .admin-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-toolbar {
    width: 100%;
    min-width: 0;
  }

  .admin-toolbar input {
    flex: 1;
    width: auto;
  }

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

  .provider-test-prompt,
  .provider-config-actions {
    grid-column: auto;
  }

  .provider-test-result {
    grid-template-columns: 1fr;
  }

  .provider-test-result img {
    width: 100%;
    max-width: 120px;
  }

  .prompt-dialog {
    width: calc(100% - 20px);
    height: calc(100svh - 20px);
    max-height: calc(100svh - 20px);
  }

  .prompt-dialog-card header {
    padding: 14px;
  }

  .prompt-dialog-body {
    padding: 10px 12px 12px;
  }

  .grant-controls {
    grid-template-columns: 1fr 1fr;
  }

  .grant-controls button {
    grid-column: 1 / -1;
  }
}
