:root {
  --ink: #1f2f28;
  --muted: #5b665d;
  --green: #2f5c46;
  --green-dark: #244a38;
  --paper: #f7f7f2;
  --line: #dfe3d8;
  --line-soft: #ecefe6;
  --panel: #fff;
  --tint: #eef2e6;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); line-height: 1.5; -webkit-text-size-adjust: 100%; }
/* Links in text are underlined so they never rely on color alone; nav items, buttons and the brand are not. */
a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
h1:focus, h1:focus-visible { outline: none; }
h1, h2, h3, p, dl { margin-top: 0; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1.2; letter-spacing: -.5px; margin-bottom: 6px; }
h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: 12px; }
h3, .h3 { font-size: 1rem; font-weight: 600; margin: 24px 0 8px; }
p { margin-bottom: 12px; }
small { font-size: .8125rem; color: var(--muted); }
code { font-size: .9375em; background: var(--tint); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Brand */
.brand { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; color: var(--ink); letter-spacing: -.3px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--green); color: #eaf0d8; font-family: var(--serif); font-style: italic; font-size: 1.5rem; font-weight: 400; flex-shrink: 0; }
.demo-pill { display: inline-block; font-size: .8125rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--panel); }

/* App shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: #f0f2ea; border-right: 1px solid var(--line); padding: 28px 20px 20px; display: flex; flex-direction: column; gap: 20px; }
.program { font-weight: 600; padding: 0 4px; }
.program small { display: block; font-weight: 400; }
nav { display: grid; gap: 4px; }
nav a, .nav-button { text-decoration: none; display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 6px; background: none; font-size: .9375rem; color: var(--ink); }
nav a:hover, .nav-button:hover { background: #e4e8da; text-decoration: none; }
nav a.active { background: #dde4cf; font-weight: 600; }
nav form { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-button { color: var(--muted); }
.sidebar .demo-pill { margin-top: auto; text-align: center; }
main { margin-left: 240px; padding: 36px 40px 28px; max-width: 1360px; }
main.embedded { margin-left: 0; padding: 24px 28px 24px; max-width: 1400px; }
s-app-nav { display: none; }
.public-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 6%; border-bottom: 1px solid var(--line); }
.public-main { margin: 0; max-width: 100%; padding: 40px 6% 28px; }
footer { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 16px; font-size: .8125rem; color: var(--muted); }

/* Page heading */
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading p { color: var(--muted); margin: 0; max-width: 60ch; }
.page-heading .button { flex-shrink: 0; margin-top: 4px; }

/* Buttons */
.button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; background: var(--green); color: #fff; border: 1px solid var(--green); border-radius: 6px; font-size: .9375rem; font-weight: 500; line-height: 1.3; white-space: nowrap; }
.button:hover { background: var(--green-dark); text-decoration: none; }
.button.secondary { background: var(--panel); color: var(--ink); border-color: #cbd2c0; }
.button.secondary:hover { background: var(--tint); }
.button.compact { padding: 8px 12px; font-size: .875rem; }
.button.full { width: 100%; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.metric > span { display: block; font-size: .9375rem; color: var(--muted); }
.metric > strong { display: block; font-size: 1.75rem; font-weight: 500; letter-spacing: -.5px; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.metric small { display: block; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 24px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; }
.panel-heading h2 { margin: 0; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: .9375rem; }
.panel-heading a { white-space: nowrap; }
.panel-foot { padding: 14px 20px; font-size: .875rem; color: var(--muted); border-top: 1px solid var(--line-soft); background: #fbfbf8; }
.form-panel { padding: 24px; }
.form-panel > h2:first-child, .form-panel form > h2:first-child { margin-bottom: 20px; }
.narrow { max-width: 720px; }
.count { font-size: .8125rem; font-weight: 500; color: var(--muted); background: var(--tint); padding: 2px 7px; border-radius: 4px; margin-left: 6px; vertical-align: middle; }
details.expandable > summary { padding: 16px 20px; font-weight: 500; list-style-position: inside; }
details.expandable > summary:hover { background: #fbfbf8; }
details.expandable > div { border-top: 1px solid var(--line-soft); }
details.expandable p:last-child { margin-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .9375rem; white-space: nowrap; }
th { font-size: .8125rem; font-weight: 600; color: var(--muted); background: #fbfbf8; padding: 10px 20px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td strong { font-weight: 600; }
td small { display: block; margin-top: 2px; max-width: 42ch; white-space: normal; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; padding: 32px 20px; color: var(--muted); }
.badge { display: inline-block; font-size: .8125rem; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: #e3ecd8; color: #35573f; text-transform: capitalize; white-space: nowrap; }
.badge.pending, .badge.invited { background: #f5eed6; color: #7a6524; }
.badge.paused, .badge.reversed, .badge.held { background: #f3e4de; color: #8a4f3b; }
.badge.removed { background: #e8e8e4; color: #5b665d; }
details.rules { margin-bottom: 18px; }
details.rules > summary { margin-bottom: 12px; }

/* Notices and help */
.notice { background: #e6efd8; color: #2f4a35; border: 1px solid #cfdfb9; border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; }
.notice p { margin: 0 0 6px; }
.notice a { text-decoration: underline; }
.notice.warn { background: #fbf3dc; color: #5c4a14; border-color: #ecdca9; }
.help { font-size: .875rem; color: var(--muted); line-height: 1.5; margin: -8px 0 20px; }
p.help + p.help { margin-top: -10px; }
.disclosure { font-size: .875rem; color: var(--muted); margin: 8px 0 0; }

/* Forms */
label { display: block; font-size: .9375rem; font-weight: 500; margin-bottom: 18px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #7c8671; border-radius: 6px; background: #fff; font-size: 1rem; min-width: 0; }
textarea { line-height: 1.5; resize: vertical; }
label[for] { margin-bottom: 0; }
label[for] + textarea { margin-bottom: 18px; }
input::placeholder, textarea::placeholder { color: #9aa393; }
input[readonly] { background: #f3f5ee; color: var(--muted); }
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; line-height: 1.5; }
input[type=checkbox] { width: 18px; height: 18px; margin: 3px 0 0; flex-shrink: 0; accent-color: var(--green); }
.inline-form { min-width: 240px; white-space: normal; padding: 12px 0 4px; }
.inline-form label { margin-bottom: 12px; }
.inline-form .help { margin: 0 0 12px; }
details > summary { color: var(--green); font-weight: 500; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: .9375rem; margin-bottom: 20px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.terms { white-space: pre-line; background: #f6f7f1; padding: 16px; border-radius: 6px; font-size: .9375rem; }

/* Affiliate links */
.link-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 20px 20px; }
.link-card { border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.link-card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.link-card-heading strong { font-weight: 600; }
.rate { font-weight: 600; font-size: 1.125rem; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { margin: 0; padding: 9px 12px; font-size: .9375rem; }
.copy-field button { flex-shrink: 0; background: var(--tint); border: 1px solid transparent; border-radius: 6px; padding: 0 14px; color: var(--green); font-weight: 500; font-size: .9375rem; }
.copy-field button:hover { border-color: #cbd2c0; }
.deal-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.deal-row strong { font-weight: 600; }

/* API docs and small inline forms */
.docs pre { background: #f3f5ee; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: .875rem; overflow-x: auto; white-space: pre; }
.docs table { font-size: .875rem; white-space: normal; }
.docs td small { white-space: normal; }
.docs pre.prompt { white-space: pre-wrap; }
form.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.deal-row > span:last-child { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Connecting shell: stay blank unless the load is actually slow */

/* Public pages */
.join-wrap { max-width: 680px; margin: 0 auto; }
.join-wrap > p { color: var(--muted); font-size: 1.0625rem; margin-bottom: 24px; }
.points { padding-left: 20px; display: grid; gap: 10px; margin: 0 0 20px; }
.join-wrap form + .help { margin-top: 12px; }
.welcome { max-width: 640px; padding: 24px 0 40px; }
.welcome h1 { font-size: 2.75rem; }
.welcome p { font-size: 1.125rem; color: var(--muted); }
.welcome-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 16px; }

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 28px 24px 24px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 14px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); gap: 8px; }
  .program { display: none; }
  .sidebar .demo-pill { display: none; }
  nav { display: flex; gap: 2px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  nav a, .nav-button { white-space: nowrap; padding: 10px 12px; border-radius: 6px 6px 0 0; }
  nav a.active { background: var(--paper); border: 1px solid var(--line); border-bottom-color: var(--paper); margin-bottom: -1px; }
  nav form { margin: 0; border: 0; padding: 0; }
  main, main.embedded { margin: 0; padding: 22px 16px 20px; }
  h1 { font-size: 1.75rem; }
  .page-heading { flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 14px; }
  .metric > strong { font-size: 1.5rem; }
  .panel-heading { padding: 16px; flex-wrap: wrap; }
  .form-panel { padding: 18px 16px; }
  th, td { padding-left: 14px; padding-right: 14px; }
  .link-cards { grid-template-columns: 1fr; }
  .link-cards { padding: 0 16px 16px; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 10px; }
  .public-header { padding: 16px; }
  .public-main { padding: 28px 16px 20px; }
  .welcome h1 { font-size: 2.25rem; }
  .button-row { flex-direction: column; align-items: stretch; }
}

.help.spaced { margin-top: 10px; }
