:root {
  --green: #16a34a;
  --green-700: #087a34;
  --green-50: #ecfdf5;
  --gold: #f59e0b;
  --gold-50: #fffbeb;
  --paper: #fffdf7;
  --ink: #111827;
  --text: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --surface: #ffffff;
  --wash: #f8faf9;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(229, 231, 235, 0.86);
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1200px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.logo-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 20px rgba(22, 163, 74, 0.18);
  font-weight: 900;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.site-nav a.active,
.site-nav a:hover {
  color: var(--green-700);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 800;
  white-space: nowrap;
}

.btn-primary {
  color: #fff;
  background: var(--green);
}

.btn-primary:hover {
  background: var(--green-700);
}

.btn-secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}

.btn-secondary:hover {
  border-color: var(--line-strong);
}

.btn-ghost {
  color: var(--muted);
  background: transparent;
}

.btn-danger {
  color: #fff;
  background: var(--danger);
}

.btn-icon {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}

.btn-icon:hover {
  color: var(--green-700);
  border-color: rgba(22, 163, 74, 0.34);
}

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 0.98) 0%, rgba(255, 253, 247, 0.9) 48%, rgba(255, 253, 247, 0.7) 100%),
    url("https://images.unsplash.com/photo-1455390582262-044cdead277a?auto=format&fit=crop&w=1800&q=82");
  background-position: center;
  background-size: cover;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1fr);
  gap: 48px;
  align-items: center;
  max-width: 1200px;
  min-height: 690px;
  margin: 0 auto;
  padding: 56px 24px 44px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: 999px;
  color: #92400e;
  background: rgba(255, 251, 235, 0.92);
  font-size: 13px;
  font-weight: 900;
}

.hero h1 {
  max-width: 760px;
  margin: 22px 0 16px;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.04;
}

.hero p {
  max-width: 650px;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.85;
}

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

.product-preview {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview-dots {
  display: flex;
  gap: 6px;
}

.preview-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line-strong);
}

.preview-grid {
  display: grid;
  grid-template-columns: 0.82fr 1fr;
  gap: 14px;
}

.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.preview-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-panel-head strong {
  font-size: 14px;
}

.preview-form {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.fake-field {
  display: grid;
  gap: 6px;
}

.fake-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fake-input {
  min-height: 38px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fafafa;
  font-size: 13px;
}

.letter-card {
  padding: 18px;
  line-height: 1.8;
}

.letter-card h2 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.35;
}

.letter-card p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
}

.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0;
  font-size: 30px;
}

.section-head p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

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

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

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

.feature-card,
.template-card,
.metric-card,
.stat-card,
.panel,
.auth-card,
.project-row,
.history-card,
.setting-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.feature-card,
.template-card,
.metric-card {
  padding: 20px;
}

.feature-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--green-700);
  background: var(--green-50);
}

.feature-card h3,
.template-card h3 {
  margin: 16px 0 8px;
  font-size: 18px;
}

.feature-card p,
.template-card p,
.metric-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.template-card.active {
  border-color: rgba(22, 163, 74, 0.44);
  background: var(--green-50);
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100vh;
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #4b5563;
  font-weight: 800;
}

.side-link.active,
.side-link:hover {
  color: var(--green-700);
  background: var(--green-50);
}

.side-quota {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(22, 163, 74, 0.18);
  border-radius: var(--radius);
  background: var(--green-50);
}

.quota-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--green-700);
  font-size: 13px;
  font-weight: 900;
}

.quota-number {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 900;
}

.progress {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.14);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}

.app-main {
  min-width: 0;
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 30px;
}

.page-header p,
.small-muted {
  margin: 0;
  color: var(--muted);
}

.small-muted {
  font-size: 13px;
  line-height: 1.6;
}

.stat-card {
  padding: 18px;
}

.stat-card .label,
.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-card .value,
.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 900;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-body {
  padding: 18px;
}

.project-list,
.history-list,
.tip-list,
.form-stack,
.template-options,
.score-list {
  display: grid;
  gap: 12px;
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px 108px 112px;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.project-title {
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge-green {
  color: var(--green-700);
  background: var(--green-50);
}

.badge-gold {
  color: #92400e;
  background: var(--gold-50);
}

.tip {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text);
  line-height: 1.7;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 42px;
  align-items: center;
  max-width: 1100px;
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 56px 24px;
}

.auth-copy h1 {
  max-width: 620px;
  margin: 20px 0 14px;
  font-size: 52px;
  line-height: 1.1;
}

.auth-copy p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.auth-points {
  display: grid;
  gap: 12px;
  max-width: 540px;
  margin-top: 28px;
}

.auth-point {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
}

.auth-card {
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

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

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

.field label {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

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

.ai-write-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(22, 163, 74, 0.22);
  border-radius: 999px;
  color: var(--green-700);
  background: var(--green-50);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.ai-write-btn:hover {
  border-color: rgba(22, 163, 74, 0.42);
  background: #dcfce7;
}

.ai-write-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.ai-write-btn svg {
  width: 15px;
  height: 15px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.75;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.13);
}

.helper {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.generator-grid,
.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.form-flow {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.form-section {
  scroll-margin-top: 24px;
}

.form-section .panel-head {
  align-items: flex-start;
}

.generator-aside {
  position: sticky;
  top: 24px;
  display: grid;
  align-self: start;
  gap: 18px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.step {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.step:hover {
  border-color: rgba(22, 163, 74, 0.38);
  transform: translateY(-1px);
}

.step.active {
  border-color: rgba(22, 163, 74, 0.42);
  background: var(--green-50);
}

.step.done {
  border-color: rgba(22, 163, 74, 0.28);
  background: #ffffff;
}

.step.done .step-number,
.step.unlocked .step-number {
  background: var(--green);
}

.step.locked {
  color: #9ca3af;
  background: #f9fafb;
  cursor: not-allowed;
}

.step.locked .step-number {
  background: #d1d5db;
}

.step-number {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #9ca3af;
  font-size: 12px;
  font-weight: 900;
}

.step.active .step-number {
  background: var(--green);
}

.step strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
}

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

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

.choice-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.choice-card.active,
.choice-card:has(input:checked) {
  border-color: rgba(22, 163, 74, 0.46);
  background: var(--green-50);
}

.choice-card input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--green);
}

.choice-card span {
  display: grid;
  gap: 5px;
}

.choice-card small {
  color: var(--muted);
  line-height: 1.5;
}

.field.full {
  grid-column: 1 / -1;
}

.field-invalid input,
.field-invalid textarea,
.field-invalid select {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-error {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.lock-notice {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(245, 158, 11, 0.36);
  border-radius: var(--radius);
  color: #78350f;
  background: var(--gold-50);
}

.lock-notice p {
  margin: 4px 0 0;
  color: #92400e;
  line-height: 1.55;
}

.step-page-locked .generator-grid {
  opacity: 0.66;
}

.step-page-locked .generator-grid input,
.step-page-locked .generator-grid textarea,
.step-page-locked .generator-grid select {
  background: #f9fafb;
}

.template-option {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.template-option.active {
  border-color: rgba(22, 163, 74, 0.46);
  background: var(--green-50);
}

.template-option h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.template-option p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.completion-list {
  display: grid;
  gap: 10px;
}

.completion-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.completion-item:last-child {
  border-bottom: 0;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  align-items: center;
  margin: 24px -18px -18px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.icon-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.letter-editor {
  min-height: 690px;
  padding: 30px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  line-height: 1.9;
}

.letter-editor h2 {
  margin-top: 0;
  font-size: 28px;
  line-height: 1.35;
}

.letter-editor p {
  color: var(--text);
}

.score-row {
  display: grid;
  gap: 7px;
}

.score-top {
  display: flex;
  justify-content: space-between;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

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

.mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
  font-weight: 900;
}

.history-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 160px;
  gap: 12px;
  margin-bottom: 16px;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 116px 132px;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.history-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.history-empty {
  display: none;
  gap: 8px;
  place-items: center;
  padding: 44px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: #f9fafb;
  text-align: center;
}

.history-empty > i {
  color: var(--green-700);
}

.setting-card {
  padding: 18px;
}

.setting-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.danger-zone {
  border-color: rgba(220, 38, 38, 0.24);
  background: #fff7f7;
}

.admin-shell {
  background: #f6f7f9;
}

.admin-sidebar {
  background: #fbfcfd;
}

.admin-role {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-role strong {
  font-size: 16px;
}

.admin-main {
  max-width: 1440px;
  width: 100%;
}

.admin-page-header {
  align-items: flex-start;
}

.admin-kicker {
  margin: 0 0 6px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-header-actions,
.admin-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-alert {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(245, 158, 11, 0.34);
  border-radius: var(--radius);
  background: #fffaf0;
}

.admin-alert-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  color: #92400e;
  background: var(--gold-50);
}

.admin-stats {
  margin-bottom: 18px;
}

.admin-trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-trend.up {
  color: var(--green-700);
}

.admin-trend.warn {
  color: #92400e;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.admin-ai-config {
  margin-bottom: 18px;
  scroll-margin-top: 22px;
}

.admin-ai-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.admin-ai-form {
  min-width: 0;
}

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

.config-entry-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

.config-entry-card:hover {
  border-color: rgba(22, 163, 74, 0.38);
  background: var(--green-50);
}

.config-entry-card > i,
.config-entry-card > svg {
  flex: 0 0 auto;
  color: var(--green-700);
}

.config-entry-card span {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.config-entry-card small {
  color: var(--muted);
  line-height: 1.45;
}

.form-status {
  min-height: 24px;
  color: var(--green-700);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

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

.template-prompt-editor {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fafb;
}

.template-prompt-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.template-prompt-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

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

.template-prompt-grid textarea {
  min-height: 320px;
  font-size: 12px;
  line-height: 1.6;
}

.admin-ai-test {
  display: grid;
  gap: 14px;
}

.admin-flow {
  display: grid;
  gap: 10px;
}

.admin-flow div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fafb;
}

.admin-flow span {
  display: grid;
  grid-row: span 2;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.admin-flow strong,
.admin-flow small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-flow small {
  color: var(--muted);
  line-height: 1.45;
}

.full-button {
  width: 100%;
}

.result-box {
  min-height: 280px;
  max-height: 460px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #f9fafb;
  background: #111827;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
}

.generation-loading {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.48);
  backdrop-filter: blur(10px);
}

.generation-loading.active {
  display: grid;
}

.generation-loading-card {
  display: grid;
  gap: 18px;
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  color: #f9fafb;
  background: #111827;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
}

.generation-loading-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 22px;
}

.generation-loading-card p {
  margin: 0;
  color: #d1d5db;
  line-height: 1.7;
}

.generation-orbit {
  position: relative;
  width: 72px;
  height: 72px;
}

.generation-orbit::before {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--green);
  border-radius: 999px;
  content: "";
  animation: generation-spin 1.2s linear infinite;
}

.generation-orbit span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  animation: generation-pulse 1.4s ease-in-out infinite;
}

.generation-orbit span:nth-child(1) {
  top: 9px;
  left: 31px;
}

.generation-orbit span:nth-child(2) {
  right: 11px;
  bottom: 18px;
  animation-delay: 0.18s;
}

.generation-orbit span:nth-child(3) {
  bottom: 18px;
  left: 11px;
  animation-delay: 0.36s;
}

.generation-steps {
  display: grid;
  gap: 8px;
}

.generation-steps span {
  position: relative;
  min-height: 34px;
  padding: 8px 10px 8px 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-weight: 800;
}

.generation-steps span::before {
  position: absolute;
  top: 11px;
  left: 12px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #6b7280;
  content: "";
}

.generation-steps span.active::before,
.generation-steps span:nth-child(2)::before {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.18);
}

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

@keyframes generation-pulse {
  0%,
  100% {
    transform: scale(0.72);
    opacity: 0.56;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

.admin-wide {
  grid-column: 1 / 2;
}

.admin-side-panel {
  align-self: start;
}

.admin-table {
  display: grid;
  gap: 10px;
}

.admin-table-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.35fr) minmax(135px, 0.95fr) 92px 80px 80px 120px;
  gap: 10px;
  align-items: center;
  min-width: 720px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-table-row > * {
  min-width: 0;
}

.admin-table-row span,
.admin-table-row p,
.admin-table-row strong {
  overflow-wrap: anywhere;
}

.admin-table-head {
  min-height: 42px;
  padding-top: 10px;
  padding-bottom: 10px;
  color: var(--muted);
  background: #f9fafb;
  font-size: 12px;
  font-weight: 900;
}

.user-table .admin-table-row {
  grid-template-columns: minmax(178px, 1.25fr) 88px 78px 104px 76px 110px;
}

.admin-table > .admin-table-row:not(.admin-table-head) {
  color: var(--text);
}

.admin-table > .admin-table-row:not(.admin-table-head) strong {
  color: var(--ink);
}

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

.admin-table .icon-group {
  gap: 6px;
}

.admin-table .btn-icon {
  width: 36px;
  height: 36px;
}

.mini-action.active {
  color: var(--green-700);
  border-color: rgba(22, 163, 74, 0.34);
  background: var(--green-50);
}

.admin-queue {
  display: grid;
  gap: 16px;
}

.queue-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.queue-dot {
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
}

.queue-dot.review {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.14);
}

.queue-dot.failed {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.1);
}

.admin-user-tools {
  grid-template-columns: minmax(220px, 1fr) 150px;
  width: min(430px, 100%);
  margin-bottom: 0;
}

.admin-mix,
.admin-card-list,
.audit-list {
  display: grid;
  gap: 12px;
}

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

.mix-row .progress {
  grid-column: 1 / -1;
  margin-top: 0;
}

.progress.blue span {
  background: #2563eb;
}

.progress.gold span {
  background: var(--gold);
}

.template-admin-card,
.audit-item {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.template-admin-card h3 {
  margin: 10px 0 6px;
  font-size: 17px;
}

.audit-item {
  align-items: flex-start;
}

.audit-item > i {
  flex: 0 0 auto;
  color: #2563eb;
}

.audit-item.high > i {
  color: #92400e;
}

.audit-item.ok > i {
  color: var(--green-700);
}

.mobile-bottom {
  display: none;
}

[data-tip] {
  position: relative;
}

[data-tip]:hover::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 20;
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  content: attr(data-tip);
  font-size: 12px;
  transform: translateX(-50%);
}

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

  .hero-inner,
  .auth-page,
  .app-shell,
  .content-grid,
  .admin-ai-layout,
  .admin-layout,
  .generator-grid,
  .result-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .generator-aside {
    position: static;
  }

  .hero-inner {
    min-height: auto;
  }

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

  .sidebar {
    display: none;
  }

  .app-main {
    padding: 22px 16px 86px;
  }

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

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

  .project-row,
  .history-card {
    grid-template-columns: 1fr;
  }

  .admin-side-panel,
  .admin-wide {
    grid-column: auto;
  }

  .mobile-bottom {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-bottom a {
    display: grid;
    gap: 4px;
    min-height: 60px;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
  }

  .mobile-bottom a.active {
    color: var(--green-700);
  }
}

@media (max-width: 680px) {
  .site-header-inner {
    min-height: 64px;
    padding: 0 16px;
  }

  .site-actions .btn-secondary,
  .site-actions .btn-ghost {
    display: none;
  }

  .hero-inner,
  .section,
  .auth-page {
    padding-right: 16px;
    padding-left: 16px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero p,
  .auth-copy p {
    font-size: 16px;
  }

  .auth-copy h1 {
    font-size: 40px;
  }

  .section-head {
    display: grid;
  }

  .feature-grid,
  .template-grid,
  .stats-grid,
  .admin-preset-row,
  .form-grid,
  .channel-row,
  .history-tools,
  .rewrite-grid,
  .stepper {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .sticky-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .field-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .lock-notice {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-alert {
    grid-template-columns: 1fr;
  }

  .admin-header-actions,
  .admin-filter-row,
  .admin-ai-actions {
    justify-content: flex-start;
  }

  .template-prompt-head {
    display: grid;
  }

  .admin-user-tools {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .template-admin-card,
  .audit-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .letter-editor,
  .panel-body {
    padding: 18px;
  }
}
