:root {
  --paper: #f6f4f7;
  --surface: #ffffff;
  --ink: #24172b;
  --muted: #6e6276;
  --line: #e4dee8;
  --rose: #c0245e;
  --rose-wash: #fbe9f0;
  --leaf: #1f7a5a;
  --amber: #a5620b;
  --danger: #b3261e;

  --display: "Bricolage Grotesque", "IBM Plex Sans", system-ui, sans-serif;
  --body: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-3: 2.25rem;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0) / 1.55 var(--body);
}

h1,
h2 {
  font-family: var(--display);
  line-height: 1.15;
  margin: 0;
}

h1 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--step-1);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

p {
  margin: 0 0 1rem;
  max-width: 68ch;
}

a {
  color: var(--rose);
  text-underline-offset: 0.18em;
}

code {
  font-size: 0.92em;
  background: var(--line);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 3px solid var(--rose);
  outline-offset: 2px;
}

/* ---- Frame ---- */

body.app {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  background: var(--ink);
  color: #efe8f2;
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  font: 700 var(--step-2) / 1 var(--display);
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.account {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.mode-word {
  color: #b9adc0;
  font-weight: 400;
  font-size: var(--step--1);
  margin-left: 1.1rem;
}

.dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.5rem;
  background: #8b7f92;
}

.dot-live {
  background: #4fd3a1;
}

.dot-test {
  background: #f2b34b;
}

.side nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.side nav a {
  color: #d9cfde;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.side nav a:hover {
  color: #fff;
}

.side nav a[aria-current="page"] {
  background: #3b2945;
  color: #fff;
  font-weight: 600;
}

.signout {
  margin-top: auto;
}

main {
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  max-width: 62rem;
  min-width: 0;
}

main > section,
main > .lede + * {
  margin-top: 2.5rem;
}

.lede {
  color: var(--muted);
  font-size: var(--step-1);
  margin-top: 0.5rem;
}

/* ---- Controls ---- */

button {
  font: 600 var(--step-0) / 1.2 var(--body);
  color: #fff;
  background: var(--rose);
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
}

button:hover {
  background: #a31d4f;
}

button.quiet {
  background: none;
  color: #b9adc0;
  padding: 0.5rem 0.75rem;
  font-weight: 400;
}

button.quiet:hover {
  color: #fff;
  background: none;
}

input,
textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input[type="radio"] {
  width: auto;
  accent-color: var(--rose);
  margin-right: 0.4rem;
}

input.short {
  width: 7rem;
}

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

.saved {
  color: var(--leaf);
  font-weight: 600;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  max-width: none;
}

/* ---- Overview ---- */

.status {
  border-left: 6px solid var(--muted);
  padding-left: 1.25rem;
}

.status-live {
  border-color: var(--leaf);
}

.status-test {
  border-color: var(--amber);
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  max-width: 44rem;
  margin-top: 1.5rem;
}

.modes button {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.8rem 0.9rem;
}

.modes button span {
  font-weight: 400;
  font-size: var(--step--1);
  color: var(--muted);
}

.modes button:hover {
  border-color: var(--ink);
  background: var(--surface);
}

.modes button[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 68ch;
}

.checks li {
  padding: 0.6rem 0 0.6rem 1.75rem;
  border-top: 1px solid var(--line);
  position: relative;
}

.checks li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 1.05rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--amber);
}

.checks li.ok::before {
  background: var(--leaf);
}

.checks li.bad::before {
  background: var(--danger);
}

.funnel {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 44rem;
}

.funnel li {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr) 3.5rem;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 0;
}

.funnel .count {
  font: 600 var(--step-1) / 1 var(--display);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

progress {
  appearance: none;
  width: 100%;
  height: 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: var(--line);
}

progress::-webkit-progress-value {
  background: var(--rose);
  border-radius: 999px;
}

progress::-moz-progress-bar {
  background: var(--rose);
  border-radius: 999px;
}

/* ---- Tables ---- */

.scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

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

tr:last-child td {
  border-bottom: 0;
}

th {
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--muted);
}

td.when {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

tr.outcome-skipped td {
  color: var(--muted);
}

/* ---- Automation: the conversation, in order ---- */

.thread {
  max-width: 40rem;
  counter-reset: step;
  border-left: 2px solid var(--line);
  margin-left: 0.9rem;
  padding-left: 2rem;
}

.step {
  counter-increment: step;
  position: relative;
  padding-bottom: 2.25rem;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: calc(-2rem - 0.9rem - 1px);
  top: -0.15rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font: 600 var(--step--1) / 1.8rem var(--display);
  text-align: center;
}

.hint {
  color: var(--muted);
  font-size: var(--step--1);
}

.bubble {
  border-radius: 18px;
  padding: 1rem 1.1rem 1.15rem;
  display: grid;
  gap: 0.4rem;
}

/* The follower's side of the chat sits left, the account's side right. */
.bubble.them {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  margin-right: 3rem;
}

.bubble.us {
  background: var(--rose-wash);
  border: 1px solid #f3cfdd;
  border-bottom-right-radius: 4px;
  margin-left: 3rem;
}

.field {
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.5rem;
}

.field:first-child {
  margin-top: 0;
}

.choice {
  display: block;
}

input.pill {
  width: auto;
  min-width: 12rem;
  justify-self: start;
  border-radius: 999px;
  border-color: var(--rose);
  color: var(--rose);
  font-weight: 600;
  text-align: center;
}

.actions {
  position: sticky;
  bottom: 0;
  padding: 1rem 0;
  background: linear-gradient(to top, var(--paper) 70%, transparent);
}

/* ---- Sign-in ---- */

body.bare {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login {
  width: min(100%, 24rem);
  padding: 0;
}

.login form {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

.login label {
  font-weight: 500;
}

/* ---- Privacy policy ---- */

.policy {
  width: min(100%, 40rem);
  padding: 2rem 0;
}

.policy h2 {
  margin-top: 2rem;
}

/* ---- Small screens ---- */

@media (max-width: 760px) {
  body.app {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 1rem 1.25rem;
  }

  .side nav {
    flex-direction: row;
    flex-wrap: wrap;
    order: 3;
    width: 100%;
  }

  .signout {
    margin: 0 0 0 auto;
  }

  h1 {
    font-size: var(--step-2);
  }

  .modes {
    grid-template-columns: 1fr;
  }

  .funnel li {
    grid-template-columns: 8rem minmax(0, 1fr) 2.5rem;
    gap: 0.6rem;
  }

  .bubble.them {
    margin-right: 1rem;
  }

  .bubble.us {
    margin-left: 1rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button,
  .side nav a {
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  }
}
