:root {
  --bg: #f3efe6;
  --bg-accent: #efe3ca;
  --surface: rgba(255, 252, 246, 0.82);
  --surface-strong: #fff9ef;
  --ink: #1b120b;
  --muted: #5f4c3f;
  --line: rgba(58, 39, 23, 0.14);
  --primary: #b44f25;
  --primary-deep: #7b3418;
  --success: #166534;
  --danger: #a61b1b;
  --shadow: 0 24px 60px rgba(68, 41, 13, 0.14);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(180, 79, 37, 0.18), transparent 28%),
    radial-gradient(circle at bottom left, rgba(94, 133, 104, 0.16), transparent 25%),
    linear-gradient(180deg, var(--bg), #f8f4eb);
  font-family: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

.page-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0 40px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.68);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.minimal-header {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.58);
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.site-nav a,
.ghost-button {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
}

.header-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(180, 79, 37, 0.1);
  color: var(--primary-deep);
  font-weight: 700;
}

.nav-cta,
.primary-button {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 14px 28px rgba(123, 52, 24, 0.22);
}

.primary-button,
.secondary-button,
.small-button,
.ghost-button {
  cursor: pointer;
}

.secondary-button {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
}

.small-button {
  padding: 8px 14px;
}

.inline-form {
  margin: 0;
}

.flash {
  margin: 20px 0;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 249, 239, 0.9);
}

.flash-success {
  border-color: rgba(22, 101, 52, 0.25);
  color: var(--success);
}

.flash-error {
  border-color: rgba(166, 27, 27, 0.24);
  color: var(--danger);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 26px;
  margin-top: 30px;
  align-items: stretch;
}

.hero-copy,
.hero-card,
.panel,
.feature-card,
.price-card,
.auth-card,
.job-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 48px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.9rem);
}

h2 {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
}

.hero-text,
.muted-text,
.feature-card p,
.price-card p,
.helper-text,
.form-tip,
.log-item p {
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.hero-card {
  padding: 28px;
  display: grid;
  gap: 14px;
  align-content: center;
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.96), rgba(241, 228, 201, 0.8));
}

.metric-tile {
  padding: 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(58, 39, 23, 0.08);
}

.metric-tile span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.metric-tile strong {
  font-size: 1.1rem;
}

.feature-grid,
.pricing-grid,
.jobs-grid,
.admin-stats {
  display: grid;
  gap: 18px;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 24px;
}

.feature-card,
.price-card {
  padding: 24px;
}

.pricing {
  margin-top: 28px;
}

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

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

.price-card strong {
  display: block;
  margin: 14px 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
}

.featured {
  background: linear-gradient(180deg, rgba(180, 79, 37, 0.09), rgba(255, 250, 242, 0.96));
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding: 54px 0;
}

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

.auth-card label,
.generate-form label {
  display: block;
  margin-top: 16px;
}

.auth-card span,
.generate-form span {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(58, 39, 23, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

textarea {
  resize: vertical;
}

select {
  appearance: none;
}

input[type="file"] {
  padding: 12px;
}

.full-width {
  width: 100%;
  margin-top: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 18px;
  margin-top: 30px;
}

.panel,
.job-card {
  padding: 26px;
}

.panel-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.panel-header,
.form-row,
.inline-heading,
.job-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.credit-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(180, 79, 37, 0.12);
  color: var(--primary-deep);
  font-weight: 700;
}

.jobs-section {
  margin-top: 24px;
}

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

.job-prompt {
  min-height: 72px;
  line-height: 1.65;
}

.job-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 760px);
  margin-top: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.95);
}

.status {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  text-transform: uppercase;
  background: rgba(58, 39, 23, 0.08);
}

.status-completed {
  color: var(--success);
  background: rgba(22, 101, 52, 0.12);
}

.status-failed,
.status-blocked {
  color: var(--danger);
  background: rgba(166, 27, 27, 0.12);
}

.status-queued,
.status-processing {
  color: #7a4f12;
  background: rgba(194, 130, 27, 0.14);
}

.error-text {
  color: var(--danger);
  line-height: 1.6;
}

.clean-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.9;
}

.empty-state {
  padding: 34px;
  border: 1px dashed rgba(58, 39, 23, 0.24);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
}

.admin-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 28px;
}

.stat-card {
  padding: 24px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 2rem;
  font-family: Georgia, "Times New Roman", serif;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(58, 39, 23, 0.1);
  text-align: left;
}

.log-list {
  display: grid;
  gap: 12px;
}

.log-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(58, 39, 23, 0.08);
}

.log-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .hero,
  .dashboard-grid,
  .admin-grid,
  .feature-grid,
  .pricing-grid,
  .jobs-grid,
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .site-header,
  .panel-header,
  .inline-heading,
  .job-meta,
  .form-row {
    align-items: flex-start;
    flex-direction: column;
  }

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

.chat-home,
.chat-workspace {
  min-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
}

.chat-home {
  justify-content: center;
  align-items: center;
}

.chat-home-inner {
  width: min(960px, 100%);
  text-align: center;
}

.chat-title {
  margin: 0 0 26px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  line-height: 1.08;
}

.chat-subtitle {
  max-width: 820px;
  margin: 18px auto 0;
  color: var(--muted);
  line-height: 1.75;
}

.chat-thread {
  width: min(960px, 100%);
  margin: 28px auto 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.thread-empty {
  margin: auto 0;
  text-align: center;
}

.inline-notice {
  width: min(960px, 100%);
  margin: 0 auto 12px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid rgba(58, 39, 23, 0.1);
  background: rgba(255, 255, 255, 0.78);
}

.inline-notice-error {
  color: var(--danger);
  border-color: rgba(166, 27, 27, 0.2);
}

.message-row {
  display: flex;
}

.user-row {
  justify-content: flex-end;
}

.assistant-row {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(860px, 100%);
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow);
}

.user-bubble {
  background: linear-gradient(135deg, rgba(180, 79, 37, 0.16), rgba(255, 255, 255, 0.74));
}

.assistant-bubble {
  background: rgba(255, 255, 255, 0.78);
}

.message-bubble p {
  margin: 0;
  line-height: 1.75;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.message-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.composer-shell {
  width: min(960px, 100%);
  margin: 0 auto 10px;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.composer-shell-disabled {
  cursor: pointer;
}

.composer-input {
  width: 100%;
  min-height: 84px;
  border: none;
  background: transparent;
  box-shadow: none;
  resize: none;
  padding: 4px 8px 12px;
  font-size: 1.1rem;
}

.composer-input:focus {
  outline: none;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-pill,
.file-pill,
.tool-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(58, 39, 23, 0.12);
  border-radius: 999px;
  background: rgba(247, 244, 236, 0.92);
  color: var(--ink);
}

.tool-select {
  width: auto;
  padding-right: 36px;
}

.file-pill {
  cursor: pointer;
}

.submit-circle {
  margin-left: auto;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 14px 28px rgba(123, 52, 24, 0.22);
  cursor: pointer;
}

.submit-circle:disabled {
  opacity: 0.6;
  cursor: wait;
}

.redeem-panel {
  width: min(960px, 100%);
  margin: 16px auto 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.compact-redeem {
  padding: 14px 16px;
}

.redeem-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.redeem-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.redeem-form input {
  min-width: 220px;
}

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

.admin-code-form label {
  display: block;
}

.admin-code-form span {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

.generated-codes {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.generated-codes code {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(247, 244, 236, 0.92);
  border: 1px solid rgba(58, 39, 23, 0.12);
}

.package-presets form {
  margin: 0;
}

.admin-codes-table {
  margin-top: 18px;
}

@media (max-width: 980px) {
.chat-thread,
.composer-shell,
.chat-home-inner {
    width: 100%;
  }

  .message-bubble {
    max-width: 100%;
  }

  .submit-circle {
    margin-left: 0;
  }

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

  .redeem-panel,
  .redeem-form {
    flex-direction: column;
    align-items: stretch;
  }

  .package-grid,
  .admin-code-form {
    grid-template-columns: 1fr;
  }
}
