:root {
  color-scheme: light;
  --ink: #0f172a;
  --body: #334155;
  --muted: #5e6876;
  --canvas: #ffffff;
  --surface: #f8fafb;
  --surface-strong: #f1f5f9;
  --line: #e2e8f0;
  --accent: #3b82f6;
  --accent-soft: #dbeafe;
  --accent-strong: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
a,
select {
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

button {
  cursor: pointer;
}

a {
  color: var(--accent-strong);
  font-weight: 750;
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

.brand-logo {
  display: block;
  width: min(250px, 58vw);
  height: auto;
}

.simple-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px 20px;
  background: var(--canvas);
}

.simple-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(28px, 6vw, 48px);
  background: var(--surface);
}

.simple-card-wide {
  width: min(840px, 100%);
}

.simple-card .brand-logo {
  margin-bottom: 34px;
}

.simple-card code {
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--canvas);
  color: var(--body);
  overflow-x: auto;
}

.hero {
  width: min(1150px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 32px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
}

.topbar .brand-logo {
  width: min(210px, 48vw);
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

nav a,
nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

nav button {
  padding: 0;
}

nav a:hover,
nav button:hover {
  color: var(--accent-strong);
}

.auth-shell {
  width: min(720px, calc(100vw - 40px));
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 48px 0;
}

.auth-card {
  width: 100%;
}

.auth-logo {
  width: min(260px, 62vw);
  margin-bottom: 40px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(44px, 8vw, 88px);
  line-height: 0.94;
  letter-spacing: -0.035em;
  font-weight: 900;
}

.page-title h1 {
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.04;
}

h2 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 900;
}

h3 {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 900;
}

h4 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 850;
}

p {
  max-width: 720px;
  color: var(--body);
  font-size: 18px;
  line-height: 1.7;
}

.hero-copy {
  margin-top: 20px;
}

.shell {
  width: min(1150px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.14fr);
  gap: 24px;
  margin: 0 auto 64px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  background: var(--canvas);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.card:last-child {
  grid-column: 1 / -1;
}

.section-heading,
.campaign-topline,
.inline-actions,
.protected-page-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.campaign-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.campaign-form label:nth-child(1),
.protected-pages,
.deadline-preview,
.campaign-form button {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  color: var(--body);
  font-size: 13px;
  font-weight: 750;
}

label.is-hidden,
.is-hidden {
  display: none !important;
}

small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

fieldset {
  display: grid;
  gap: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface);
}

.form-help {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.page-config {
  display: grid;
  grid-template-columns: 1fr 0.78fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--canvas);
}

.page-config label:first-child,
.page-redirect-field {
  grid-column: 1 / -1;
}

legend {
  padding: 0 8px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--canvas);
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 96px;
  padding: 13px;
  resize: vertical;
  color: #565656;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent-strong);
  color: white;
}

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

.secondary-button {
  border: 1px solid var(--accent-strong);
  background: var(--accent-strong);
  color: white;
}

.secondary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--canvas);
  color: var(--body);
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.danger-button {
  border: 1px solid var(--danger-soft);
  background: var(--canvas);
  color: var(--danger);
}

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

.compact-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.status-pill {
  display: inline-grid;
  min-height: 32px;
  place-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.campaign-list,
.subscriber-list {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.campaign-selector-label {
  margin-top: 18px;
}

.campaign-item,
.subscriber-row {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: var(--canvas);
}

.campaign-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.deadline-preview {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 750;
}

.campaign-meta div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  background: var(--surface);
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

dd {
  margin: 6px 0 0;
  color: #565656;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
}

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

.copy-field {
  position: relative;
}

.copy-field .compact-button {
  position: absolute;
  top: 29px;
  right: 8px;
}

.copy-field textarea {
  padding-right: 78px;
}

.install-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
}

.install-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.install-panel.has-no-webhook .snippet-grid {
  grid-template-columns: 1fr;
}

.protected-summary,
.email-link-summary {
  display: grid;
  gap: 10px;
}

.protected-page-row {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--canvas);
}

.protected-page-topline {
  align-items: flex-start;
}

.protected-page-row span {
  overflow-wrap: anywhere;
  color: #565656;
  font-weight: 500;
}

.page-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.email-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.email-link-label {
  display: grid;
  gap: 7px;
}

.email-link-row textarea {
  min-height: 70px;
}

.inline-actions {
  justify-content: flex-start;
  margin-top: 14px;
}

.subscriber-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr auto;
  gap: 14px;
  align-items: center;
}

.subscriber-row strong {
  display: block;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.pagination button:disabled {
  cursor: default;
  opacity: 0.5;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: var(--surface);
}

@media (max-width: 880px) {
  .hero,
  .shell,
  .auth-shell {
    width: min(100% - 40px, 1150px);
  }

  .topbar,
  nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .shell,
  .campaign-form,
  .snippet-grid,
  .email-link-row,
  .subscriber-row {
    grid-template-columns: 1fr;
  }

  .copy-field .compact-button {
    position: static;
    width: max-content;
  }

  .copy-field textarea {
    padding-right: 13px;
  }
}
