:root {
  --ink: #14202b;
  --muted: #4d5b68;
  --paper: #f7f4ee;
  --card: #ffffff;
  --line: #d7d1c6;
  --teal: #1F6B5A;
  --teal-dark: #155446;
  --navy: #12202C;
  --cream: #F6F3EC;
  --danger: #8b2e2e;
  --ok: #1F6B5A;
  --error: #8b2e2e;
  --shadow: 0 12px 32px rgba(18, 32, 44, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, sans-serif;
  font-size: 1.125rem;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

.wrap {
  width: min(1120px, calc(100% - 2.5rem));
  max-width: calc(100vw - 2.5rem);
  min-width: 0;
  margin: 0 auto;
}

.narrow {
  width: min(28rem, calc(100% - 2.5rem));
}

.site-header,
.site-footer {
  background: var(--navy);
  color: var(--cream);
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.15rem 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--cream);
  text-decoration: none;
}

.wordmark-mark {
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.1rem;
}

.nav a,
.nav-logout button {
  color: var(--cream);
  text-decoration: none;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.nav a:hover,
.nav-logout button:hover {
  text-decoration: underline;
}

.nav-cta {
  border: 1px solid var(--cream);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}

.nav-logout {
  display: inline;
  margin: 0;
}

.hero {
  background: linear-gradient(180deg, #e8efe9 0%, var(--paper) 100%);
  padding: 4.5rem 0 3.5rem;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  max-width: 16ch;
  margin: 0 0 1.75rem;
}

.lede,
.hero p {
  max-width: 38rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.page {
  padding: 3rem 0 5rem;
}

.card,
.form,
.table,
.add-to-site,
.empty-state {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.card {
  padding: 1.5rem 1.6rem;
}

.card h2 {
  margin-top: 0;
}

.button,
.button-ghost,
.button-danger {
  display: inline-block;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.button:hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.button-ghost {
  background: transparent;
  color: var(--teal-dark);
}

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

.flash {
  margin: 1.25rem 0 0;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
}

.flash-ok {
  background: #e5f2ed;
  color: var(--ok);
}

.flash-error {
  background: #f6e6e6;
  color: var(--error);
}

.form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.1rem;
  padding: 1.5rem;
  margin: 1.25rem 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.form > * {
  min-width: 0;
  max-width: 100%;
}

.form label:not(.check),
.form fieldset {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
}

.form .check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form textarea,
.form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.form input[type="color"] {
  width: 3.4rem;
  height: 2.4rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.colour-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
}

.table th,
.table td {
  text-align: left;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0.3rem 0.4rem 0.3rem 0;
}

pre {
  overflow: auto;
  max-width: 100%;
  background: var(--navy);
  color: var(--cream);
  padding: 1.1rem;
  border-radius: 12px;
}

pre code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.prose :where(p, ul, ol) {
  max-width: 42rem;
}

.add-to-site {
  padding: 1.5rem 1.6rem;
  margin: 0.25rem 0 0.5rem;
  border-radius: 16px;
}

.add-to-site h2 {
  margin-top: 0;
}

.empty-state {
  padding: 1.6rem 1.7rem;
  border-radius: 16px;
  border-style: dashed;
}

.empty-state h2 {
  margin-top: 0;
}

.empty-state .form {
  box-shadow: none;
  border: 0;
  padding: 0;
  margin: 0;
}

.site-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.site-card h2 {
  margin-bottom: 0.35rem;
}

.site-card-status,
.site-card-choice,
.site-status {
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.manage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
  overflow-x: hidden;
}

.manage-layout > * {
  min-width: 0;
  max-width: 100%;
}

.manage-main,
.manage-preview {
  min-width: 0;
  max-width: 100%;
}

.manage-main {
  overflow-x: hidden;
}

.manage-preview {
  overflow: hidden;
  isolation: isolate;
}

.form,
pre,
.add-to-site,
.banner-preview,
.banner-preview-frame {
  max-width: 100%;
}

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

.manage-preview h2 {
  margin-top: 0;
}

.banner-preview-frame {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  isolation: isolate;
  border-radius: 16px;
}

.banner-preview {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 28rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #e8efe9;
  overflow: hidden;
  isolation: isolate;
  position: relative;
}

.sticky-save {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--paper);
  padding: 0.85rem 0 0.2rem;
}

.advanced {
  margin: 1.25rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.advanced summary {
  cursor: pointer;
  font-weight: 700;
}

.banner-still {
  max-width: 28rem;
}

.banner-still-card {
  background: var(--navy);
  color: var(--cream);
  border-radius: 16px;
  padding: 1.35rem 1.4rem 1.2rem;
  box-shadow: var(--shadow);
}

.banner-still-card p {
  margin: 0 0 1rem;
}

.banner-still-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.banner-still-btn {
  display: inline-block;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  background: var(--teal);
  color: #fff;
}

.banner-still-btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal);
}

.site-footer a {
  color: var(--cream);
  margin-left: 1rem;
}

@media (max-width: 900px) {
  .manage-layout,
  .colour-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .header-inner,
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
