:root {
  --bg: #f7f8f5;
  --text: #151713;
  --muted: #666d5f;
  --line: #d9ded2;
  --surface: #ffffff;
  --accent: #1f6f54;
  --accent-dark: #164b3a;
  --danger: #a33a2b;
  --shadow: 0 16px 40px rgba(33, 37, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

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

.site-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 245, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--text);
  color: white;
  border-radius: 7px;
}

.nav {
  display: flex;
  gap: 14px;
  margin-left: auto;
}

.nav a,
.ghost-button,
.danger-link {
  color: var(--muted);
  text-decoration: none;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
}

.logout-form {
  margin: 0;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.dashboard-hero,
.form-layout,
.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, auto);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
}

.form-page {
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  align-items: start;
  gap: 36px;
}

.form-intro {
  display: grid;
  gap: 18px;
  align-self: start;
  padding-top: 6px;
  min-width: 0;
}

.dashboard-hero h1,
.form-layout h1,
.auth-shell h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.02;
  margin: 0 0 10px;
  letter-spacing: 0;
}

.form-layout.form-page h1 {
  font-size: clamp(36px, 4vw, 54px);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.dashboard-hero p,
.form-layout p,
.auth-shell p {
  margin: 0;
  color: var(--muted);
  max-width: 620px;
}

.eyebrow {
  margin-bottom: 8px !important;
  color: var(--accent-dark) !important;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-side {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.hero-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hero-stats span,
.builder-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.hero-stats strong,
.builder-count strong {
  color: var(--text);
}

.hero-actions,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 10px 14px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: #ecf1e9;
  border-color: var(--line);
  color: var(--text);
}

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

.danger-link {
  color: var(--danger);
}

.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 14px;
}

.panel,
.prompt-card,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hint-box {
  border-left: 4px solid var(--accent);
  background: #eef5ef;
  padding: 16px;
  border-radius: 8px;
}

.hint-box h2,
.copy-spec h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.hint-box p {
  margin: 0;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

label span,
small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 400;
}

textarea.mono {
  min-height: 260px;
  line-height: 1.55;
  font-weight: 400;
}

textarea {
  resize: vertical;
}

.mono,
.prompt-preview {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

.prompt-card {
  padding: 14px;
}

.prompt-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.prompt-summary {
  min-width: 0;
}

.prompt-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prompt-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.prompt-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.builder-check {
  display: inline-flex;
  align-items: center;
  margin: 0;
  flex: 0 0 auto;
}

.builder-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0;
}

.compact-meta {
  margin: 0;
}

.meta-row span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #f8faf6;
  font-size: 13px;
}

.prompt-preview {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  background: #f8faf6;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  margin: 0 0 14px;
}

.fill-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fill-fields p {
  margin: 0;
}

.compact-fill-fields {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0 0;
}

.compact-fill-fields input {
  padding: 8px 10px;
}

.prompt-details {
  margin: 10px 0 0;
}

.fill-details {
  margin-top: 8px;
}

.prompt-details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.compact-preview {
  max-height: 180px;
  margin: 8px 0 0;
  padding: 12px;
  font-size: 13px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-actions {
  justify-content: flex-end;
  min-width: 300px;
}

.builder-workspace {
  padding: 18px;
  margin-bottom: 18px;
}

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

.builder-workspace h2,
.export-box h3 {
  margin: 0 0 8px;
}

.builder-workspace p {
  color: var(--muted);
  margin: 0;
  max-width: 780px;
}

.builder-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.builder-output {
  min-height: 220px;
}

.export-box {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 16px;
  display: grid;
  gap: 7px;
}

.compact-export {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
}

.compact-export h3 {
  margin: 0;
}

.stacked-form,
.panel {
  padding: 20px;
}

.stacked-form {
  display: grid;
  gap: 16px;
  width: 100%;
}

.stacked-form > label {
  min-width: 0;
}

.stacked-form textarea[name="body"],
.stacked-form textarea[name="markdown"] {
  min-height: 420px;
}

.copy-spec {
  padding: 16px;
  min-width: 0;
}

.copy-spec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.copy-block {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px;
  margin: 0;
  background: #f8faf6;
  font-size: 13px;
  line-height: 1.55;
}

.large-copy-block {
  max-height: 720px;
}

.kickoff-panel {
  min-width: 0;
}

.import-hero {
  margin-bottom: 22px;
}

.import-panel {
  margin-bottom: 18px;
}

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

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

.section-head h3 {
  margin: 0 0 8px;
  font-size: 19px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
}

.import-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 20px;
  align-items: start;
}

.import-panel .copy-spec {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
  min-width: 0;
}

.import-form.stacked-form {
  padding: 0;
}

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

.converter-inputs {
  display: grid;
  gap: 12px;
}

.converter-options {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.compact-textarea {
  min-height: 320px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 10px;
  align-items: end;
}

.share-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.share-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.empty-state {
  padding: 34px;
}

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

.message {
  padding: 12px 14px;
  border-radius: 7px;
  background: #e7f3eb;
  color: #17472e;
  border: 1px solid #bed8c8;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
}

.auth-shell {
  min-height: 70vh;
  align-items: center;
}

.auth-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}

@media (max-width: 1100px) {
  .site-header,
  .dashboard-hero,
  .form-layout,
  .form-page,
  .auth-shell,
  .filters {
    grid-template-columns: 1fr;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .nav {
    grid-column: 1 / -1;
    margin-left: 0;
    flex-wrap: wrap;
    gap: 8px;
  }

  .logout-form {
    justify-self: end;
  }

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

  .section-head,
  .import-panel-grid,
  .converter-options {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
  }

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

  .hero-side {
    justify-items: start;
  }

  .hero-stats {
    justify-content: flex-start;
  }

  .prompt-card-main,
  .builder-workspace-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .compact-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .compact-fill-fields,
  .prompt-details {
    margin-left: 0;
  }
}
