:root {
  color-scheme: dark;
  --bg: #130d0a;
  --panel: rgba(255, 245, 236, 0.055);
  --panel-strong: rgba(255, 245, 236, 0.09);
  --line: rgba(255, 198, 143, 0.18);
  --text: rgba(255, 245, 236, 0.94);
  --muted: rgba(255, 230, 214, 0.66);
  --soft: rgba(255, 230, 214, 0.42);
  --accent: #ff9d57;
  --accent-2: #ffd3a3;
  --ink: #17110d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 16%, rgba(255, 157, 87, 0.16), transparent 34%),
    radial-gradient(circle at 78% 8%, rgba(255, 211, 163, 0.1), transparent 30%),
    linear-gradient(180deg, #17100c 0%, #100b08 48%, #090706 100%);
}

a {
  color: inherit;
}

.site-shell {
  min-height: 100vh;
  padding: 0 24px 32px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 18px;
  max-width: 1180px;
  min-height: 56px;
  margin: 0 auto;
  padding: 0 0 12px;
  backdrop-filter: blur(18px);
}

.brand,
.main-nav,
.header-action {
  border: 1px solid var(--line);
  background: rgba(19, 13, 10, 0.78);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.24);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}

.brand-logo {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 157, 87, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 245, 236, 0.16);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  padding: 4px;
  border-radius: 8px;
}

.main-nav a {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.is-active {
  color: var(--text);
  background: rgba(255, 245, 236, 0.08);
}

.header-action {
  justify-self: end;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

main {
  max-width: 1180px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
  gap: 44px;
  align-items: center;
  padding: 96px 0 72px;
}

.hero-copy,
.page-hero,
.section-head,
.builder-shell,
.content-page,
.auth-shell,
.admin-shell {
  position: relative;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(2.7rem, 7vw, 5.8rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.lede,
.page-hero p {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.button-primary {
  border-color: rgba(255, 157, 87, 0.76);
  background: var(--accent);
  color: var(--ink);
}

.button-secondary {
  background: rgba(255, 245, 236, 0.065);
  color: var(--text);
}

.hero-preview,
.builder-preview-panel,
.builder-panel,
.template-card,
.install-grid > div,
.auth-panel,
.settings-form,
.metric-card,
.control-card,
.control-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-preview {
  padding: 28px;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats-strip div {
  padding: 26px;
  background: rgba(19, 13, 10, 0.72);
}

.stats-strip strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
}

.stats-strip span {
  color: var(--muted);
}

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

.section-head h2 {
  max-width: 620px;
  margin-bottom: 0;
}

.section-head a,
.text-link {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: none;
}

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

.template-card {
  overflow: hidden;
}

.template-preview-wrap {
  display: grid;
  min-height: 230px;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 245, 236, 0.055), rgba(255, 157, 87, 0.06)),
    rgba(255, 245, 236, 0.02);
}

.template-card-body {
  padding: 22px;
}

.template-card-body p {
  color: var(--muted);
  line-height: 1.55;
}

.template-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 12px;
}

.template-meta span {
  min-height: 24px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 198, 143, 0.14);
  border-radius: 6px;
  background: rgba(255, 245, 236, 0.055);
  color: var(--soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  line-height: 1.1;
  text-transform: uppercase;
}

.template-palette {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
}

.template-palette span {
  width: 28px;
  height: 18px;
  border: 1px solid rgba(255, 245, 236, 0.22);
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.template-category {
  margin-bottom: 8px;
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.signature-preview {
  width: min(100%, 360px);
  min-height: 160px;
  padding: 18px;
  border: 1px solid;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
  line-height: 1.38;
}

.sig-line {
  margin: 3px 0;
  overflow-wrap: anywhere;
}

.sig-name {
  margin-bottom: 4px;
}

.sig-line a {
  color: inherit;
  text-decoration: none;
}

.sig-logo {
  display: block;
  max-width: 100%;
  height: auto;
}

.page-hero.compact {
  padding: 80px 0 44px;
}

.builder-shell {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 22px;
  min-height: calc(100vh - 132px);
  padding: 42px 0 72px;
}

.builder-panel,
.builder-preview-panel {
  padding: 22px;
}

.builder-panel {
  align-self: start;
}

.builder-panel h1 {
  font-size: 2rem;
  line-height: 1.1;
}

.builder-panel label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 132px);
  place-items: center;
  padding: 56px 0 80px;
}

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

.auth-panel h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
}

.auth-panel p,
.admin-heading p,
.control-card p {
  color: var(--muted);
  line-height: 1.6;
}

.auth-panel label,
.settings-form label {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.auth-panel input,
.settings-form input,
.settings-form select,
.settings-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 245, 236, 0.08);
  color: var(--text);
  font: inherit;
}

.settings-form select option {
  color: #17110d;
}

.form-status {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--accent-2);
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

.admin-shell {
  padding: 72px 0 96px;
}

.admin-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.admin-heading h1 {
  font-size: clamp(2.3rem, 6vw, 4.8rem);
}

.admin-grid,
.control-grid,
.saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 24px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 2.4rem;
  line-height: 1;
}

.control-card {
  display: block;
  min-height: 170px;
  padding: 22px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.control-card h2 {
  font-size: 1.35rem;
}

.control-card.as-button {
  width: 100%;
  cursor: pointer;
  font: inherit;
}

.saved-list {
  margin-top: 24px;
}

.saved-item {
  min-height: 190px;
}

.settings-form {
  max-width: 760px;
  padding: 24px;
}

.billing-admin-panel {
  max-width: none;
  margin-bottom: 18px;
}

.admin-status-panel {
  max-width: none;
  margin-top: 6px;
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 1.5rem;
}

.billing-plan-list {
  display: grid;
  gap: 16px;
}

.billing-plan-editor {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 245, 236, 0.04);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px 16px;
}

.field-grid label {
  margin: 0;
}

.toggle-row {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px !important;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.control-output {
  min-height: 220px;
  overflow: auto;
  padding: 18px;
  color: var(--accent-2);
  white-space: pre-wrap;
}

.control-output.compact {
  min-height: 150px;
}

.builder-panel input,
.builder-panel select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 245, 236, 0.08);
  color: var(--text);
  font: inherit;
}

.builder-panel select option {
  color: #1f2937;
}

.builder-preview-panel {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 26px;
  min-height: 540px;
}

.preview-toolbar {
  display: flex;
  width: 100%;
  justify-content: space-between;
  color: var(--soft);
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

.content-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 64px 0 96px;
  color: rgba(255, 245, 236, 0.9);
  line-height: 1.72;
}

.content-page :is(h1, h2, h3) {
  color: var(--text);
}

.content-page h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.08;
}

.content-page a {
  color: var(--accent-2);
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.install-grid > div {
  padding: 22px;
}

.install-grid p {
  color: var(--muted);
  line-height: 1.58;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 32px auto 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 900px) {
  .site-shell {
    padding-inline: 16px;
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .brand,
  .header-action {
    justify-self: stretch;
    justify-content: center;
  }

  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
  }

  .main-nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .hero,
  .builder-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-shell {
    min-height: auto;
    place-items: start stretch;
    padding: 38px 0 72px;
  }

  .auth-panel {
    width: 100%;
    padding: 22px;
  }

  .stats-strip,
  .template-grid,
  .install-grid,
  .admin-grid,
  .control-grid,
  .saved-list {
    grid-template-columns: 1fr;
  }

  .section-head,
  .site-footer {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(2.35rem, 14vw, 4.2rem);
  }
}
