:root {
  --bg: #fff8ec;
  --surface: #fffaf0;
  --panel: #ffffff;
  --ink: #2b2318;
  --muted: #806f5d;
  --line: #f1dcc1;
  --primary: #f47b20;
  --primary-strong: #d95f00;
  --accent: #ffc83d;
  --accent-strong: #f3aa16;
  --accent-soft: #fff0bf;
  --peach-soft: #ffe3cc;
  --mint-soft: #eaf7ec;
  --danger: #b84a32;
  --shadow: 0 16px 38px rgba(174, 101, 22, 0.12);
  --shadow-soft: 0 9px 24px rgba(174, 101, 22, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(255, 216, 101, 0.26), transparent 260px),
    linear-gradient(180deg, rgba(255, 239, 196, 0.78), rgba(255, 248, 236, 0) 300px),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

a {
  color: inherit;
}

button {
  cursor: pointer;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 20px;
  border-right: 1px solid rgba(241, 220, 193, 0.9);
  background: rgba(255, 250, 240, 0.94);
  backdrop-filter: blur(10px);
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 123, 32, 0.32) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(244, 123, 32, 0.26);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #5a3300;
  background: linear-gradient(135deg, var(--accent), #ff9f43);
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(244, 123, 32, 0.24);
}

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

.brand h1 {
  font-size: 19px;
  line-height: 1.25;
}

.brand p,
.topbar p,
.download-panel p,
.hint,
.empty-state p {
  color: var(--muted);
  line-height: 1.6;
}

.panel,
.form-panel,
.download-panel,
.workflow-strip,
.ppt-preview-panel,
.status-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.panel h2 {
  margin-bottom: 14px;
  font-size: 17px;
}

.focus-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(244, 123, 32, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, #fff6db, #fffaf0);
}

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

.focus-card span {
  color: var(--muted);
  line-height: 1.6;
}

.output-panel {
  display: grid;
  gap: 9px;
}

.output-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.output-option:has(input:checked) {
  border-color: rgba(244, 123, 32, 0.5);
  background: linear-gradient(135deg, #fffaf0, #fff2d2);
  box-shadow: inset 4px 0 0 var(--primary), 0 8px 18px rgba(244, 123, 32, 0.08);
}

.output-option:hover {
  transform: translateY(-1px);
}

.output-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.output-option span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.output-option strong {
  font-size: 15px;
}

.output-option small {
  color: var(--muted);
  line-height: 1.35;
}

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

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

.topbar h2 {
  margin: 4px 0 7px;
  font-size: 32px;
  line-height: 1.15;
}

.eyebrow {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.primary,
.secondary {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary-strong);
  padding: 4px 8px;
  font-weight: 700;
}

.danger-button {
  min-height: 38px;
  border: 1px solid #b84a32;
  border-radius: 7px;
  background: #fff;
  color: #9d3825;
  padding: 8px 14px;
  font-weight: 700;
}

.danger-button:hover:not(:disabled) {
  background: #fff1ed;
}

.primary {
  color: #4a2700;
  background: linear-gradient(135deg, var(--accent), #ff982f);
  box-shadow: 0 12px 24px rgba(244, 123, 32, 0.25);
}

.primary:hover {
  background: linear-gradient(135deg, #ffd956, var(--primary));
}

.secondary {
  color: var(--primary-strong);
  background: #fffaf2;
  border-color: rgba(244, 123, 32, 0.24);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(244, 123, 32, 0.24);
  border-radius: 999px;
  color: var(--muted);
  background: #fffaf2;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.credit-pill strong {
  color: var(--primary-strong);
  font-size: 16px;
}

.form-panel {
  padding: 22px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff, #fff7e4);
  box-shadow: var(--shadow-soft);
}

.workflow-strip div {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 0 18px;
  border-right: 1px solid var(--line);
}

.workflow-strip div:last-child {
  border-right: 0;
}

.workflow-strip strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #5a3300;
  background: linear-gradient(135deg, var(--accent), #ff9f43);
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(244, 123, 32, 0.2);
}

.workflow-strip span {
  color: #4d3824;
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
  color: #4d3824;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.14);
}

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

textarea {
  min-height: 140px;
  padding: 12px;
  resize: vertical;
  line-height: 1.7;
}

.source-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.tab {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tab.active {
  color: var(--primary);
  border-color: var(--primary);
  background: #fff2d2;
  font-weight: 700;
}

.hidden {
  display: none;
}

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

.template-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.7;
  background: #fffaf0;
}

.download-panel,
.ppt-preview-panel,
.status-panel {
  margin-top: 18px;
  padding: 18px 20px;
}

.download-panel {
  display: grid;
  gap: 16px;
  border-color: rgba(244, 123, 32, 0.32);
  background: linear-gradient(135deg, #ffffff, #fff4d8);
}

.download-current,
.history-heading,
.history-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.download-panel h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.download-actions {
  justify-content: flex-end;
}

.history-section {
  padding-top: 16px;
  border-top: 1px solid rgba(244, 123, 32, 0.24);
}

.history-heading h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.history-heading p,
.history-empty {
  color: var(--muted);
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-summary {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 0.7fr) minmax(150px, auto);
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.history-summary strong,
.history-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-summary span,
.history-summary time {
  color: var(--muted);
  font-size: 13px;
}

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

.history-more {
  width: 100%;
  margin-top: 10px;
}

.compact-button {
  min-height: 36px;
  padding: 7px 12px;
}

.download-actions button,
.history-actions button {
  white-space: nowrap;
}

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

.pricing-page {
  min-height: 100vh;
  padding: 28px 32px 42px;
}

.pricing-hero {
  max-width: 1180px;
  margin: 0 auto;
}

.pricing-nav,
.pricing-hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.pricing-nav {
  margin-bottom: 34px;
}

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

.payment-box {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 18px;
  padding: 16px;
  border: 1px solid rgba(244, 123, 32, 0.26);
  background: #fffaf2;
}

.payment-box img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: #fff;
}

.payment-box p {
  margin: 6px 0 0;
  color: var(--muted);
}

.modal-open {
  overflow: hidden;
}

.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.payment-modal.hidden {
  display: none;
}

.payment-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(43, 35, 24, 0.52);
}

.payment-dialog {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(43, 35, 24, 0.28);
}

.payment-dialog-header,
.payment-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.payment-dialog-header h2 {
  margin-top: 4px;
  font-size: 24px;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 26px;
  line-height: 1;
}

.payment-plan {
  margin: 18px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.payment-plan span {
  color: var(--muted);
}

.payment-plan b {
  color: var(--primary-strong);
  font-size: 20px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f6f8f4;
}

.auth-shell {
  width: min(460px, 100%);
}

.auth-shell > .brand-link {
  margin-bottom: 18px;
}

.auth-panel {
  padding: 28px;
  border: 1px solid rgba(36, 95, 77, 0.15);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.auth-panel h1 {
  margin: 6px 0 8px;
  font-size: 30px;
}

.auth-panel > p {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.auth-panel > #logoutBtn {
  margin-top: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.auth-form .hidden {
  display: none;
}

.auth-status {
  border-left: 4px solid #d9a441;
  min-height: 48px;
}

.auth-status[data-state="success"] {
  border-color: #2f7d59;
  background: #eef8f2;
  color: #1f5e42;
}

.auth-status[data-state="error"] {
  border-color: #c64232;
  background: #fff1ef;
  color: #8d2f25;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  padding: 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.site-footer a:hover {
  color: var(--primary-strong);
}

.page-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.page-header nav,
.account-actions,
.admin-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.account-shell,
.admin-shell,
.legal-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.account-summary,
.admin-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.account-summary h1,
.admin-heading h1,
.legal-shell > header h1 {
  margin: 5px 0 8px;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0;
}

.balance-display {
  min-width: 190px;
  padding-left: 28px;
  border-left: 3px solid var(--accent-strong);
}

.balance-display span,
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.balance-display strong {
  display: block;
  margin-top: 4px;
  color: var(--primary-strong);
  font-size: 44px;
}

.account-section,
.admin-section,
.legal-shell section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.section-heading h2,
.legal-shell h2 {
  margin: 0 0 7px;
}

.section-heading p,
.legal-shell p,
.account-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.danger-zone {
  border-top-color: #e7b3a7;
}

.inline-form,
.search-form {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 20px;
}

.inline-form label {
  flex: 1;
  max-width: 440px;
  color: var(--muted);
  font-size: 13px;
}

.inline-form input,
.search-form input,
.admin-inline input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 8px 11px;
  color: var(--ink);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 26px;
}

.stat-card {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

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

.table-scroll {
  overflow-x: auto;
  margin-top: 18px;
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.admin-table th {
  background: #fff5e5;
  color: #624a32;
}

.admin-inline input {
  width: 84px;
}

.legal-shell {
  max-width: 920px;
}

.legal-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin-top: 28px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.legal-nav a {
  color: var(--primary-strong);
  font-weight: 700;
  text-decoration: none;
}

.legal-shell section {
  scroll-margin-top: 70px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.pricing-hero-content {
  align-items: stretch;
  margin-bottom: 24px;
}

.pricing-hero-content h1 {
  max-width: 780px;
  margin: 6px 0 12px;
  font-size: 42px;
  line-height: 1.12;
}

.pricing-hero-content p {
  max-width: 820px;
  color: var(--muted);
  line-height: 1.8;
}

.pricing-summary {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 245px;
  padding: 22px;
  border: 1px solid rgba(244, 123, 32, 0.32);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.pricing-summary span,
.checkout-status {
  color: var(--muted);
  line-height: 1.6;
}

.pricing-summary strong {
  color: var(--primary-strong);
  font-size: 32px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.pricing-card {
  display: grid;
  gap: 18px;
  align-content: start;
  min-height: 340px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.pricing-card.featured {
  border-color: rgba(244, 123, 32, 0.58);
  background: linear-gradient(180deg, #fff, #fff5dc);
  box-shadow: var(--shadow);
}

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

.plan-heading h2 {
  margin-top: 8px;
  font-size: 22px;
}

.plan-heading strong {
  color: var(--primary-strong);
  font-size: 18px;
  white-space: nowrap;
}

.plan-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: #5a3300;
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.plan-price {
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-size: 42px;
  font-weight: 800;
}

.plan-price span {
  margin-right: 3px;
  font-size: 22px;
}

.plan-price small,
.pricing-card p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
}

.pricing-card button {
  align-self: end;
}

.checkout-status {
  margin: 0 0 14px;
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.preview-heading h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.preview-heading p {
  color: var(--muted);
  line-height: 1.6;
}

.ppt-result-section {
  display: grid;
  gap: 16px;
}

.slide-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.slide-preview {
  position: relative;
  min-height: 132px;
  aspect-ratio: 16 / 9;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.slide-preview::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--primary);
}

.cover-preview {
  color: #4a2700;
  background: linear-gradient(135deg, #ffd34e, #ff8d2b);
}

.cover-preview::before {
  background: var(--accent-soft);
}

.slide-number {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.cover-preview .slide-number {
  color: rgba(74, 39, 0, 0.7);
}

.slide-preview strong {
  display: block;
  padding-right: 28px;
  font-size: 16px;
  line-height: 1.25;
}

.slide-preview p {
  margin-top: 8px;
  color: inherit;
  font-size: 13px;
}

.slide-preview ul {
  display: grid;
  gap: 3px;
  margin: 10px 0 0;
  padding-left: 16px;
}

.slide-preview li {
  color: inherit;
  font-size: 12px;
  line-height: 1.35;
}

.status-panel {
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow-soft);
}

.status-panel strong {
  color: var(--primary);
}

.status-panel.error {
  border-color: #e0b4b4;
  color: var(--danger);
}

.result-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.result-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.result-nav button {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.result-nav button.active {
  color: var(--primary);
  border-color: var(--primary);
  background: #fff2d2;
  font-weight: 700;
}

.result-panel {
  min-height: 370px;
  padding: 24px;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 300px;
  text-align: center;
}

.result-section h3 {
  margin-bottom: 12px;
  font-size: 22px;
}

.result-section h4 {
  margin: 20px 0 8px;
  font-size: 16px;
  color: var(--primary);
}

.result-section p,
.result-section li {
  line-height: 1.75;
}

.result-section ul,
.result-section ol {
  padding-left: 22px;
}

.rubric {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.rubric th,
.rubric td {
  padding: 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.rubric th {
  background: var(--accent-soft);
}

@media (max-width: 980px) {
  .app-shell,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .field-row,
  .url-row,
  .template-toolbar,
  .workflow-strip {
    grid-template-columns: 1fr;
  }

  .workflow-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-strip div:last-child {
    border-bottom: 0;
  }

  .workspace {
    padding: 22px;
  }

  .topbar {
    gap: 16px;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }

  .actions .nav-button,
  .actions .credit-pill {
    flex: 1;
  }

  .topbar,
  .download-current,
  .history-heading,
  .history-item,
  .preview-heading,
  .pricing-hero-content {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .pricing-page {
    padding: 22px;
  }

  .download-actions {
    justify-content: flex-start;
  }

  .history-summary {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .history-summary span {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions button {
    flex: 1;
  }
}

@media (max-width: 620px) {
  .page-header,
  .account-summary,
  .admin-heading,
  .section-heading,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header nav,
  .account-actions {
    width: 100%;
  }

  .balance-display {
    padding: 14px 0 0;
    border-left: 0;
    border-top: 3px solid var(--accent-strong);
  }

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

  .search-form {
    width: 100%;
  }

  .search-form input {
    min-width: 0;
  }

  .workspace,
  .sidebar {
    padding: 18px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .form-panel,
  .download-panel,
  .status-panel,
  .result-panel {
    padding: 16px;
  }

  .source-tabs,
  .download-actions,
  .history-actions,
  .pricing-nav {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .actions #generateBtn {
    grid-column: 1 / -1;
  }

  .actions #grantTestCreditsBtn {
    grid-column: 1 / -1;
  }

  .pricing-nav-actions,
  .payment-box {
    width: 100%;
  }

  .primary,
  .secondary,
  .tab,
  .nav-button {
    width: 100%;
  }

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

  .pricing-hero-content h1 {
    font-size: 32px;
  }

  .pricing-summary,
  .checkout-status {
    width: 100%;
  }

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