:root {
  --bg: #f7f0e4;
  --bg-accent: #f2c66d;
  --panel: rgba(255, 250, 243, 0.86);
  --panel-strong: #fff8ef;
  --ink: #1e1d1a;
  --ink-soft: #5a5248;
  --line: rgba(30, 29, 26, 0.12);
  --brand: #cf4c2f;
  --brand-deep: #8f2c18;
  --ok: #1d7c52;
  --warn: #925700;
  --shadow: 0 20px 60px rgba(59, 36, 21, 0.12);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-sans: "Avenir Next", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 28%),
    radial-gradient(circle at bottom right, rgba(207, 76, 47, 0.16), transparent 24%),
    linear-gradient(135deg, var(--bg) 0%, #f4e6d5 46%, #efd2ba 100%);
  color: var(--ink);
  font-family: var(--font-sans);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(30, 29, 26, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 29, 26, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent);
}

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

.auth-panel {
  padding: 32px;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 24px;
  align-items: center;
}

.auth-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 239, 0.92);
  border: 1px solid rgba(30, 29, 26, 0.08);
}

.hero-panel,
.panel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -46px;
  top: -54px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 198, 109, 0.75), rgba(242, 198, 109, 0));
}

.hero-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--brand-deep);
}

.hero-panel h1,
.auth-title,
.panel-head h2 {
  margin: 0;
  line-height: 1.05;
}

.hero-panel h1,
.auth-title {
  max-width: 760px;
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 700;
}

.hero-copy {
  max-width: 720px;
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-soft);
}

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

.point-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 239, 0.88);
  border: 1px solid rgba(30, 29, 26, 0.08);
  transform: translateY(12px);
  opacity: 0;
  animation: rise-in 0.6s ease forwards;
}

.point-card:nth-child(2) {
  animation-delay: 0.08s;
}

.point-card:nth-child(3) {
  animation-delay: 0.16s;
}

.point-card strong,
.summary-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.point-card span,
.summary-card span {
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 14px;
}

.workspace-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 20px;
  margin-top: 20px;
}

.manager-panel {
  margin-top: 20px;
}

.panel-card {
  padding: 24px;
}

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

.panel-head h2 {
  font-size: 28px;
}

.panel-head.compact h2 {
  font-size: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(207, 76, 47, 0.14);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 700;
}

.badge.muted {
  background: rgba(30, 29, 26, 0.08);
  color: var(--ink-soft);
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field span {
  font-size: 14px;
  font-weight: 700;
}

input[type="file"],
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid rgba(30, 29, 26, 0.12);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

input[type="file"],
input[type="text"],
input[type="password"] {
  min-height: 50px;
  padding: 0 14px;
}

textarea {
  min-height: 260px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

#payload-preview {
  min-height: 160px;
}

.actions {
  display: flex;
  gap: 12px;
}

.form-note {
  margin: 14px 2px 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

button {
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand) 0%, #de6c3b 100%);
  color: #fffaf4;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 14px 24px rgba(207, 76, 47, 0.24);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.ghost-button {
  background: rgba(30, 29, 26, 0.08);
  color: var(--ink);
  box-shadow: none;
}

.danger-button {
  background: linear-gradient(135deg, #8f2c18 0%, #bc3c22 100%);
  box-shadow: 0 14px 24px rgba(143, 44, 24, 0.2);
}

.message-box {
  min-height: 64px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 239, 0.92);
  border: 1px solid rgba(30, 29, 26, 0.08);
  color: var(--ink-soft);
  line-height: 1.6;
}

.message-box.success {
  border-color: rgba(29, 124, 82, 0.24);
  background: rgba(222, 246, 233, 0.9);
  color: #13563a;
}

.message-box.error {
  border-color: rgba(207, 76, 47, 0.24);
  background: rgba(253, 230, 225, 0.92);
  color: #7a2411;
}

.summary-grid,
.link-list,
.template-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

.summary-card,
.link-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 239, 0.9);
  border: 1px solid rgba(30, 29, 26, 0.08);
}

.summary-card code,
.link-card code {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}

.link-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.manager-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.template-item,
.config-preview-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 248, 239, 0.9);
  border: 1px solid rgba(30, 29, 26, 0.08);
}

.template-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.template-item.active {
  border-color: rgba(207, 76, 47, 0.35);
  box-shadow: inset 0 0 0 1px rgba(207, 76, 47, 0.15);
}

.template-meta {
  display: grid;
  gap: 8px;
}

.template-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.template-meta code,
.config-preview {
  font-size: 13px;
  line-height: 1.7;
  word-break: break-word;
}

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

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

.preview-head h3 {
  margin: 0;
  font-size: 20px;
}

.config-preview {
  margin: 0;
  min-height: 420px;
  max-height: 620px;
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(30, 29, 26, 0.06);
  border: 1px solid rgba(30, 29, 26, 0.08);
  white-space: pre-wrap;
}

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

.method-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(146, 87, 0, 0.12);
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
}

.hidden {
  display: none;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .page-shell {
    width: min(100vw - 24px, 1240px);
    padding-top: 24px;
  }

  .workspace-panel,
  .auth-grid,
  .hero-points,
  .summary-grid,
  .manager-layout {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .panel-card {
    padding: 20px;
  }

  .panel-head {
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }

  .panel-tools,
  .hero-topbar,
  .session-bar,
  .template-item,
  .template-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
