/*
 * Design tokens
 *
 * Every value in this file should come from a token below. Scales use
 * t-shirt sizes (3xs … 3xl). Add to a scale rather than writing a one-off.
 *
 * Breakpoints (custom properties can't be used in media queries):
 *   --bp-md: 860px   (sidebar collapses into a drawer)
 *   --bp-sm: 480px   (phone)
 */

:root {
  color-scheme: light;

  /* Palette (primitives — reference only from semantic tokens) */
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f4f4f4;
  --gray-200: #e6e6e6;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #6b6b6b;
  --gray-700: #3d3d3d;
  --gray-800: #262626;
  --black: #000000;
  --green-400: #4ade80;
  --green-700: #15803d;
  --red-600: #dc2626;
  --red-700: #b91c1c;

  /* Color (semantic) */
  --color-bg: var(--white);
  --color-surface-subtle: var(--gray-50);
  --color-surface: var(--gray-100);
  --color-surface-hover: var(--gray-200);
  --color-field: var(--white);
  --color-border: var(--gray-300);
  --color-divider: var(--gray-200);
  --color-border-strong: var(--gray-500);
  --color-text: var(--black);
  --color-text-secondary: var(--gray-700);
  --color-text-muted: var(--gray-500);
  --color-ink: var(--black);
  --color-on-ink: var(--white);
  --color-on-ink-muted: var(--gray-400);
  --color-ink-hover: var(--gray-800);
  --color-on-ink-featured: var(--green-400);
  --color-divider-on-ink: var(--gray-800);
  --color-accent: var(--black);
  --color-accent-hover: var(--gray-700);
  --color-on-accent: var(--white);
  --color-accent-on-ink: var(--white);
  --color-focus: var(--black);
  --color-success: var(--green-700);
  --color-success-tint: color-mix(in srgb, var(--green-700) 12%, var(--white));
  --color-danger: var(--red-600);
  --color-on-danger: var(--white);
  --color-danger-text: var(--red-700);
  --color-danger-tint: color-mix(in srgb, var(--red-600) 10%, var(--white));
  --color-info: var(--gray-700);
  --color-info-tint: var(--gray-100);
  --color-scrim: color-mix(in srgb, var(--black) 50%, transparent);
  --color-email-canvas: var(--white);

  /* Typography */
  --font-sans: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --font-size-xs: 0.9375rem;
  --font-size-sm: 1rem;
  --font-size-md: 1.125rem;
  --font-size-lg: 1.375rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2.25rem;
  /* Homepage hero headline: scales with the viewport between the bounds. */
  --font-size-display: clamp(3rem, 5.5vw, 4.75rem);
  --font-size-display-sm: clamp(2.25rem, 10vw, 3rem);
  --font-size-code: 0.92em;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-none: 1;
  --line-height-tight: 1.25;
  --line-height-snug: 1.4;
  --line-height-normal: 1.6;

  --letter-spacing-tighter: -0.03em;
  --letter-spacing-tight: -0.02em;

  /* Spacing (margin, padding, gap) */
  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3.5rem;
  --space-page-offset: 10vh;

  /* Element sizes (icons, controls, avatars) */
  --size-xs: 0.875rem;
  --size-sm: 1rem;
  --size-md: 1.25rem;
  --size-lg: 2.5rem;
  --size-xl: 2.875rem;
  --size-2xl: 3rem;

  /* Layout measures (widths / heights of blocks) */
  --measure-3xs: 3.5rem;
  --measure-2xs: 10rem;
  --measure-xs: 15rem;
  --measure-sidebar: 18rem;
  --measure-sm: 22rem;
  --measure-md: 26rem;
  --measure-lg: 40rem;
  --measure-prose: 60ch;

  /* Radius */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --radius-full: 999px;

  /* Border / outline widths */
  --border-width-sm: 1px;
  --border-width-md: 2px;

  /* Effects */
  --opacity-disabled: 0.5;
  --duration-fast: 140ms;
  --duration-base: 200ms;
  --duration-slow: 800ms;
  --ease: ease;
  --icon-baseline-offset: -0.15em;
  --shadow-sm: 0 1px 3px color-mix(in srgb, var(--black) 8%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, var(--black) 16%, transparent);

  /* Layering */
  --z-header: 20;
  --z-topbar: 30;
  --z-scrim: 40;
  --z-drawer: 50;
  --z-toast: 60;

  /* Component aliases */
  --sidebar-width: var(--measure-sidebar);
  --sidebar-width-max: 80vw;
  --control-height-sm: var(--size-lg);
  --control-height-md: var(--size-xl);
  --header-height: calc(var(--control-height-md) + var(--space-md) * 2);
  --page-gutter: var(--space-xl);
  --brand-inset: calc(var(--space-sm) * 2);
  --focus-ring-width: var(--border-width-md);
  --focus-ring-offset: var(--space-3xs);
  --underline-offset: var(--space-3xs);
  --transition-fast: var(--duration-fast) var(--ease);
  --transition-base: var(--duration-base) var(--ease);
}

/* Base */

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

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

body {
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
dl,
dd,
pre,
fieldset {
  margin: 0;
}

fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

h1,
h2,
h3 {
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
}

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

h2 {
  font-size: var(--font-size-lg);
}

h3 {
  font-size: var(--font-size-md);
}

strong {
  font-weight: var(--font-weight-semibold);
}

code,
pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-code);
}

code {
  overflow-wrap: anywhere;
}

/* Inline code in running text: a soft pill so snippets read as code. */
:where(p, li, dd) code {
  padding: 0.1em 0.35em;
  background: var(--color-surface);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-divider);
  border-radius: var(--radius-sm);
}

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

.visually-hidden {
  position: fixed;
  width: var(--border-width-sm);
  height: var(--border-width-sm);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.icon {
  display: inline-block;
  flex-shrink: 0;
  fill: currentColor;
  vertical-align: var(--icon-baseline-offset);
}

.icon--xs {
  width: var(--size-xs);
  height: var(--size-xs);
}

.icon--sm {
  width: var(--size-sm);
  height: var(--size-sm);
}

.icon--md {
  width: var(--size-md);
  height: var(--size-md);
}

.brand {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tighter);
}

.brand::after {
  content: ".";
  color: var(--color-accent);
}

/* Logo size shared by the sidebar, the public header, the homepage and the docs, so the mark never moves. */
.brand--lg {
  font-size: var(--font-size-2xl);
}

/* The black surface of the sidebar, topbar, public logo block and homepage intro. */
.ink {
  background: var(--color-ink);
  color: var(--color-on-ink);
}

.ink .brand::after {
  color: var(--color-accent-on-ink);
}

/* One-line text that ends in an ellipsis. */
.sidebar__label,
.sidebar__user-email,
/* A badge after the title (e.g. a campaign's status) keeps its size; the title truncates first. */
.view__title > .status-pill {
  flex: none;
  align-self: center;
}

.view__title h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* App shell */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.topbar {
  display: none;
}

/*
 * Sidebar: the homepage's ink panel, narrowed to a column. The brand keeps the homepage's size
 * and position (top --space-xl, text at --brand-inset), so signing in only shrinks the panel.
 */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  padding: var(--space-xl) var(--space-sm);
  overflow-x: hidden;
  overflow-y: auto;
}

/* Item padding plus this inset puts brand text and item icons on the same --brand-inset line. */
.sidebar__brand {
  align-self: flex-start;
  padding-inline: calc(var(--brand-inset) - var(--space-sm));
}

.sidebar__nav {
  display: grid;
  gap: var(--space-lg);
  align-content: start;
}

.sidebar__list {
  display: grid;
  gap: var(--space-3xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  color: var(--color-on-ink-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar__item:hover {
  background: var(--color-ink-hover);
  color: var(--color-on-ink);
}

/* The most used section stands out in green while inactive. */
.sidebar__item--featured,
.sidebar__item--featured:hover {
  color: var(--color-on-ink-featured);
}

.sidebar__item.is-active {
  background: var(--color-on-ink);
  color: var(--color-ink);
  font-weight: var(--font-weight-semibold);
}

.sidebar__label {
  flex: 1 1 auto;
}

.sidebar__footer {
  /* minmax(0, …) so the unwrapped email can't widen the column past the sidebar padding. */
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-sm);
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: var(--border-width-sm) solid var(--color-divider-on-ink);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding-left: calc(var(--brand-inset) - var(--space-sm));
}

.sidebar__user .avatar {
  background: var(--color-on-ink);
  color: var(--color-ink);
}

.sidebar__user-email {
  flex: 1 1 auto;
  color: var(--color-on-ink-muted);
  font-size: var(--font-size-xs);
}

.app__scrim {
  display: none;
}

.app__main {
  min-width: 0;
  width: 100%;
  padding-bottom: var(--space-3xl);
}

.app__main > :not(.view) {
  margin-inline: var(--page-gutter);
}

/* Page */

.view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
  min-width: 0;
}

/* Everything in a view sits inside the page gutter, except the header bar and full-width tables. */
.view > * {
  margin-inline: var(--page-gutter);
}

/* Page header bar: sticks to the top, full width, under a divider, on one line:
   breadcrumb and title on the left, actions on the right. */
.view__header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: var(--header-height);
  margin-inline: 0;
  padding: var(--space-sm) var(--page-gutter);
  background: var(--color-bg);
  border-bottom: var(--border-width-sm) solid var(--color-divider);
}

.view__title {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  gap: var(--space-xs);
  min-width: 0;
  white-space: nowrap;
}

/* Breadcrumb and title share one type style; only the color sets the crumb apart. */
.view__title h1,
.view__back {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}

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

.view__back::after {
  content: "/";
  margin-left: var(--space-xs);
  color: var(--color-border);
}

.view__back:hover {
  color: var(--color-text);
}

.view [id] {
  scroll-margin-top: calc(var(--header-height) + var(--space-md));
}

.grid {
  display: grid;
  gap: var(--space-md);
}

/* Bordered surface of panels and stat cards. */
.panel,
.kpi-card {
  min-width: 0;
  background: var(--color-bg);
  border: var(--border-width-sm) solid var(--color-divider);
  border-radius: var(--radius-lg);
}

.panel {
  --panel-padding: var(--space-lg);

  padding: var(--panel-padding);
}

.panel > * + * {
  margin-top: var(--space-md);
}

.panel--narrow {
  max-width: var(--measure-lg);
}

/* Centered in the view once it hits its max width; never closer to the edges than the gutter. */
.view > .panel--narrow {
  margin-inline: max(var(--page-gutter), (100% - var(--measure-lg)) / 2);
}

/* Same inside a grid of panels (e.g. the API reference); the grid already keeps the gutter. */
.grid > .panel--narrow {
  width: 100%;
  margin-inline: auto;
}

/* A panel's title with something on its right (e.g. the HTTP method of an endpoint). */
.panel__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

/* List pages: the table runs edge to edge, straight under the header bar. */
.view > .panel--flush {
  --panel-padding: 0;

  margin-inline: 0;
  margin-top: calc(var(--space-lg) * -1);
  border: 0;
  border-radius: 0;
}

.panel--flush > * + * {
  margin-top: 0;
}

.panel--flush .table {
  --table-edge-padding: var(--page-gutter);
}

/* A titled section of a detail page: the title sits on the page and only the content is boxed (a table gets the
   border, stat cards bring their own). Doubled class to beat the small-screen padding. */
.panel.panel--section {
  --panel-padding: 0;

  background: none;
  border: 0;
  border-radius: 0;
}

.panel--section > * + *,
.panel.panel--section > .panel__header + .table-container {
  margin-top: var(--space-sm);
}

.panel--section > .table-container,
.panel--section > .facts {
  border: var(--border-width-sm) solid var(--color-divider);
  border-radius: var(--radius-lg);
}

.panel--section > .facts {
  padding: var(--space-md) var(--space-lg);
}

/* Detail pages: more room between sections than between a title and its box, so each title reads with its own. */
.view:has(> .panel--section) {
  gap: var(--space-xl);
}

/* Toolbar */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--page-gutter);
  border-bottom: var(--border-width-sm) solid var(--color-divider);
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
}

.toolbar select,
.toolbar input[type="date"] {
  width: auto;
  min-width: var(--measure-2xs);
}

.search-field {
  position: relative;
  display: block;
  width: var(--measure-sm);
  max-width: 100%;
  color: var(--color-text-muted);
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: var(--space-sm);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  padding-left: calc(var(--space-sm) + var(--size-sm) + var(--space-xs));
}

/* Flash */

.flash {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-md);
  border: var(--border-width-sm) solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.flash--success {
  border-color: var(--color-success);
  background: var(--color-success-tint);
}

.flash--error {
  border-color: var(--color-danger);
  background: var(--color-danger-tint);
  color: var(--color-danger-text);
}

.flash__message {
  flex: 1 1 auto;
  min-width: 0;
}

/* As tall as one line of message text, so the icon centers on the first line. */
.flash__close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: calc(var(--font-size-sm) * var(--line-height-normal));
  padding: 0 var(--space-3xs);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.flash__close:hover {
  color: var(--color-text);
}

.flashes {
  display: grid;
  gap: var(--space-xs);
}

/* In the app, flashes float over the page as toasts. */
.app .flashes {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: var(--z-toast);
  width: min(var(--measure-sm), calc(100vw - var(--space-md) * 2));
}

.app .flash {
  box-shadow: var(--shadow-lg);
}

/* Stats */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--measure-2xs), 1fr));
  gap: var(--space-md);
}

.kpi-card {
  display: grid;
  align-content: start;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

a.kpi-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.kpi-card__label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.kpi-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--control-height-sm);
  width: var(--control-height-sm);
  height: var(--control-height-sm);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.kpi-card__value {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
}

.kpi-card__note {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

/* Chart */

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: var(--space-xs);
  height: var(--measure-xs);
  padding-top: var(--space-xs);
}

.chart-bars__item {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  gap: var(--space-2xs);
}

.chart-bars__value,
.chart-bars__label {
  font-size: var(--font-size-xs);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.chart-bars__value {
  color: var(--color-text-secondary);
}

.chart-bars__label {
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* Most of the day's width, so the columns read as one series rather than thin, far-apart sticks. */
.chart-bars__bar {
  display: block;
  width: 75%;
  height: 100%;
  justify-self: center;
  fill: var(--color-accent);
}

/* The full-height track behind every bar, so each day shows how far it is from the busiest one. */
.chart-bars__track {
  fill: var(--color-surface);
}

/* A campaign's send progress: the accent fill over a full-width track. */
.progress-bar {
  display: block;
  width: 100%;
  height: var(--space-xs);
  margin-top: var(--space-xs);
  overflow: hidden;
  border-radius: var(--radius-md);
  fill: var(--color-accent);
}

.progress-bar__track {
  fill: var(--color-surface);
}

/* Definition lists */

.facts {
  display: grid;
  grid-template-columns: minmax(0, var(--measure-2xs)) minmax(0, 1fr);
  gap: var(--space-xs) var(--space-md);
}

.facts dt {
  color: var(--color-text-muted);
}

.facts dd {
  min-width: 0;
}

/* Forms */

.form {
  display: grid;
  gap: var(--space-sm);
}

.form > .button,
.form > .action-row {
  margin-top: var(--space-xs);
}

.form > .button {
  justify-self: start;
}

/* Fields are wrapped in their label: the text sits above the control. */
label,
legend {
  display: grid;
  gap: var(--space-2xs);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

/* The display above would otherwise beat the hidden attribute (a form field app.js hides). */
label[hidden] {
  display: none;
}

/* A labelled set of checkboxes or radios. */
.form-group {
  display: grid;
  gap: var(--space-xs);
}

.form-group legend {
  margin-bottom: var(--space-2xs);
}

.form-note {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-height-md);
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--color-field);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-border);
  transition: background-color var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

textarea {
  min-height: var(--measure-2xs);
  resize: vertical;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
}

/* Email bodies: room to read a whole message without dragging the handle. */
textarea.textarea--tall {
  min-height: var(--measure-md);
}

/* Focus is shown by the background alone; the border never changes. */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  background-color: var(--color-surface);
}

input[readonly] {
  background-color: var(--color-surface-subtle);
  color: var(--color-text-secondary);
}

select {
  --chevron-size: var(--space-2xs);

  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--space-xl);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
    linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - var(--space-md) - var(--chevron-size)) 50%,
    calc(100% - var(--space-md)) 50%;
  background-size: var(--chevron-size) var(--chevron-size);
  background-repeat: no-repeat;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: var(--size-sm);
  min-width: var(--size-sm);
  height: var(--size-sm);
  min-height: var(--size-sm);
  margin: 0;
  padding: 0;
  box-shadow: none;
  accent-color: var(--color-accent);
  cursor: pointer;
}

label.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: var(--font-weight-regular);
  font-size: var(--font-size-md);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

/* Buttons: outlined by default, solid ink for the primary action. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--control-height-md);
  padding: 0 var(--space-md);
  margin: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-border);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-none);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.button:hover {
  background: var(--color-surface-subtle);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-border-strong);
}

.button:focus-visible,
a:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
}

.button:disabled {
  opacity: var(--opacity-disabled);
  cursor: not-allowed;
}

.button--primary {
  background: var(--color-ink);
  box-shadow: none;
  color: var(--color-on-ink);
}

.button--primary:hover {
  background: var(--color-ink-hover);
  box-shadow: none;
}

.button--transparent {
  background: transparent;
  box-shadow: none;
  color: var(--color-text-secondary);
}

.button--transparent:hover {
  background: var(--color-surface);
  box-shadow: none;
  color: var(--color-text);
}

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

.button--danger:hover {
  background: var(--color-danger);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-danger);
  color: var(--color-on-danger);
}

.button--block {
  width: 100%;
}

/* Compact size for buttons inside dense rows (tables, pagination, copy). */
.button--sm,
.table__actions .button {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-sm);
}

/* Tables */

.table-container {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Bleed tables to the panel edges. */
.panel > .table-container {
  width: calc(100% + var(--panel-padding) * 2);
  margin-left: calc(var(--panel-padding) * -1);
  margin-right: calc(var(--panel-padding) * -1);
}

.panel > .table-container:first-child {
  margin-top: calc(var(--panel-padding) * -1);
}

/* As much space under a panel's header as above it. */
.panel > .panel__header + .table-container {
  margin-top: var(--panel-padding);
}

.panel > .table-container:last-child {
  margin-bottom: calc(var(--panel-padding) * -1);
}

.table {
  --table-edge-padding: var(--space-lg);

  width: 100%;
  min-width: var(--measure-lg);
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table th,
.table td {
  padding: var(--space-sm);
  text-align: left;
  vertical-align: middle;
  border-bottom: var(--border-width-sm) solid var(--color-divider);
}

.table th:first-child,
.table td:first-child {
  padding-left: var(--table-edge-padding);
}

.table th:last-child,
.table td:last-child {
  padding-right: var(--table-edge-padding);
}

.table th {
  padding-block: var(--space-xs);
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--color-surface-subtle);
}

.table td {
  font-variant-numeric: tabular-nums;
}

.table td > a:not(.button):not(.status-pill),
.facts dd > a:not(.button):not(.status-pill) {
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: var(--underline-offset);
  transition: text-decoration-color var(--transition-fast);
}

.table td > a:not(.button):not(.status-pill):hover,
.facts dd > a:not(.button):not(.status-pill):hover {
  text-decoration-color: currentColor;
}

.table__select {
  width: var(--size-xl);
}

/* Short values (dates, types) that should never wrap. */
.table__tight {
  white-space: nowrap;
}

td.table__tight {
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.table .table__actions {
  text-align: right;
  white-space: nowrap;
}

.table__actions form {
  display: inline;
}

.table__actions .button + .button,
.table__actions > * + * {
  margin-left: var(--space-2xs);
}

.table .table__empty {
  color: var(--color-text-muted);
}

/* Only the empty message (data_table drops the header): no width to keep, so no scrolling on a phone. */
.table:not(:has(thead)) {
  min-width: 0;
}

.table code {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* Pills: soft tint with a darker label of the same hue. */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-3xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--color-info-tint);
  color: var(--color-info);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.status-pill--success {
  background: var(--color-success-tint);
  color: var(--color-success);
}

.status-pill--error {
  background: var(--color-danger-tint);
  color: var(--color-danger-text);
}

a.status-pill {
  transition: background-color var(--transition-fast);
}

a.status-pill:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* Contacts */

.contact-cell {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--size-lg);
  width: var(--size-lg);
  height: var(--size-lg);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
}

/* Code + copy */

.code {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-surface-subtle);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-divider);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
}

.copy {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
}

.copy pre {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Worker logs (admin): newest lines at the bottom, scrolls instead of growing the page. */
.worker-log {
  max-height: var(--measure-md);
  overflow: auto;
  white-space: pre;
}

.copy--inline,
.copy__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
}

.copy--inline pre {
  font-size: var(--font-size-xs);
  line-height: var(--line-height-snug);
}

.copy-button.is-copied {
  color: var(--color-success);
}

.email-preview-frame {
  display: block;
  width: 100%;
  min-height: var(--measure-lg);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-email-canvas);
}

/* Campaign preview: an opened message in an inbox, header above the body. */
.inbox {
  display: grid;
  gap: var(--space-md);
}

.inbox__subject {
  font-size: var(--font-size-lg);
}

.inbox__meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: var(--border-width-sm) solid var(--color-divider);
  font-size: var(--font-size-sm);
  overflow-wrap: anywhere;
}

.inbox__avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--size-lg);
  height: var(--size-lg);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-bold);
}

.inbox__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A short example email in the docs, framed so it reads as a message on the page. */
.email-preview-frame--sample {
  min-height: var(--measure-sm);
  border: var(--border-width-sm) solid var(--color-divider);
}

/* The HTML body field swaps its textarea for this rendered view, at the same height. */
.email-preview-frame--editor {
  min-height: var(--measure-md);
  border: var(--border-width-sm) solid var(--color-divider);
}

.email-preview-frame--editor[hidden] {
  display: none;
}

/* Holds the textarea or its preview, with the toggle floating over its top-right corner. */
.html-field {
  position: relative;
  display: grid;
}

.preview-toggle {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
}

.preview-toggle > span:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Pagination */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding-top: var(--space-md);
  font-size: var(--font-size-sm);
}

.panel--flush > .pagination {
  padding-inline: var(--page-gutter);
}

.panel > .table-container + .pagination {
  margin-top: 0;
}

.pagination__controls {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.pagination__button--disabled {
  opacity: var(--opacity-disabled);
  pointer-events: none;
}

.pagination__page {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
}

/* Auth + public pages */

.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--space-md) var(--space-lg);
}

.auth .site-header {
  align-self: stretch;
  margin-inline: calc(var(--space-md) * -1);
}

.auth__main {
  width: 100%;
  max-width: var(--measure-md);
  margin: var(--space-page-offset) 0 var(--space-3xl);
  display: grid;
  gap: var(--space-md);
}

.auth-card {
  display: grid;
  gap: var(--space-sm);
}

.auth-card .form {
  margin-top: var(--space-sm);
}

.auth-card__alt {
  margin-top: var(--space-xs);
  color: var(--color-text-muted);
}

.auth-card__alt a,
.auth-card .text-muted a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.app__main .auth-card {
  max-width: var(--measure-md);
  margin-top: var(--space-page-offset);
}

/* Public header (auth) */

.logo {
  /* The sidebar's top: same width, brand size and position, so the mark stays put between public pages and the app. */
  display: block;
  width: var(--sidebar-width);
  padding: var(--space-xl) var(--brand-inset);
}

/*
 * Homepage: the product on an ink panel (left), sign-in on white (right).
 * The ink panel becomes the sidebar once signed in: same colors and brand position, only narrower.
 */
.home {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  min-height: 100vh;
}

.home__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xl);
  padding: var(--space-xl) var(--space-3xl) var(--space-xl) var(--brand-inset);
}

.home__pitch {
  display: grid;
  gap: var(--space-lg);
  margin-top: auto;
  max-width: var(--measure-lg);
}

.home__title {
  max-width: 14ch;
  font-size: var(--font-size-display);
  letter-spacing: var(--letter-spacing-tighter);
  line-height: 1.02;
}

.home__lead {
  max-width: 34ch;
  color: var(--color-on-ink-muted);
  font-size: var(--font-size-xl);
  line-height: var(--line-height-snug);
}

.home__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  color: var(--color-on-ink-muted);
}

.home__links a:hover {
  color: var(--color-on-ink);
}

.home__access {
  display: grid;
  place-items: center;
  padding: var(--space-3xl) var(--page-gutter);
}

.home__form {
  display: grid;
  gap: var(--space-lg);
  width: 100%;
  max-width: var(--measure-sm);
}

.home__form h2 {
  font-size: var(--font-size-2xl);
}

.home__form .form {
  gap: var(--space-md);
}

/* Public API docs: the homepage's two columns, with the reference in place of the sign-in form. */

.home__intro--sticky {
  position: sticky;
  top: 0;
  height: 100vh;
}

.home__lead a {
  color: var(--color-on-ink);
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

.docs {
  display: flex;
  justify-content: center;
  padding: var(--space-3xl) var(--page-gutter);
}

.docs__body {
  width: 100%;
  max-width: var(--measure-lg);
  align-content: start;
}

/* Public footer (auth) */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
  padding: var(--space-lg) var(--page-gutter) var(--space-lg) var(--brand-inset);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.site-footer a:hover {
  color: var(--color-text);
}

/* Spinner */

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: var(--space-2xs);
  vertical-align: var(--icon-baseline-offset);
  border: var(--border-width-md) solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin var(--duration-slow) linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Small screens (--bp-md) */

@media (max-width: 860px) {
  .app {
    display: block;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
  }

  .topbar__toggle.button {
    width: var(--control-height-md);
    padding: 0;
    color: var(--color-on-ink);
  }

  .topbar__toggle.button:hover {
    background: var(--color-ink-hover);
    color: var(--color-on-ink);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--z-drawer);
    width: min(var(--sidebar-width), var(--sidebar-width-max));
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  body.is-sidebar-open .sidebar {
    transform: none;
  }

  body.is-sidebar-open .app__scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: var(--z-scrim);
    background: var(--color-scrim);
  }

  :root {
    --page-gutter: var(--space-md);
  }

  /* The topbar is already sticky on small screens. */
  .view__header {
    position: static;
    min-height: 0;
  }

  .toolbar,
  .toolbar__group {
    align-items: stretch;
  }

  .toolbar__group,
  .search-field {
    width: 100%;
  }

  .toolbar__group > select,
  .toolbar__group > input[type="date"] {
    flex: 1 1 auto;
  }

  .panel {
    --panel-padding: var(--space-md);
  }

  .table {
    --table-edge-padding: var(--space-md);
  }

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

  .facts dd + dt {
    margin-top: var(--space-xs);
  }

  .home {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }

  .home__intro {
    gap: var(--space-2xl);
    padding: var(--space-lg) var(--page-gutter) var(--space-2xl);
  }

  .home__title {
    font-size: var(--font-size-display-sm);
  }

  /* On small screens the sign-in form comes right after the pitch. */
  .home__access {
    place-items: start stretch;
    padding-block: var(--space-2xl);
  }

  .home__form {
    max-width: none;
  }

  .home__intro--sticky {
    position: static;
    height: auto;
  }

  .docs {
    padding-block: var(--space-2xl);
  }
}

/* Phones (--bp-sm) */

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card {
    padding: var(--space-sm) var(--space-md);
  }

  .kpi-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* ---------- Properly additions (hipsend's tokens only) ---------- */

/* An attachment link (file_link()): a long file name is cut with an ellipsis, whole in the tooltip. */
.button--file {
  max-width: min(100%, var(--measure-sm));
  justify-content: flex-start;
}

.button--file .button__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The ⋮ menu at the end of a row (row_menu()): a popover in the top layer, placed under its button by app.js. */
.button.row-menu__trigger {
  width: var(--control-height-sm);
  padding: 0;
}

.row-menu__trigger:has(+ .row-menu:popover-open) {
  background: var(--color-surface-subtle);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-border-strong);
}

.row-menu {
  position: fixed;
  inset: auto;
  min-width: var(--measure-2xs);
  max-height: calc(100vh - var(--space-md) * 2);
  overflow-y: auto;
  margin: 0;
  padding: var(--space-2xs);
  border: var(--border-width-sm) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  text-align: left;
  white-space: nowrap;
}

.row-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  width: 100%;
  min-height: var(--control-height-sm);
  padding: 0 var(--space-sm);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.row-menu__item:hover,
.row-menu__item:focus-visible {
  background: var(--color-surface);
  color: var(--color-text);
}

.row-menu__item:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: calc(var(--focus-ring-width) * -1);
}

.row-menu__item--danger,
.row-menu__item--danger:hover,
.row-menu__item--danger:focus-visible {
  color: var(--color-danger);
}

.row-menu__item--danger:hover {
  background: var(--color-danger-tint);
}

/* Money in and out of a property. */
.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.money--in {
  color: var(--color-success);
}

.money--out {
  color: var(--color-danger-text);
}

/* Long free text in a table cell: one line, cut with an ellipsis. */
.table__truncate {
  max-width: var(--measure-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prewrap {
  white-space: pre-wrap;
}

/* A tenant's or property's access code (access_code()): the code, asterisks until revealed, with its tools (show,
   copy, new code) joined on the right. */
.access-code {
  display: inline-flex;
  align-items: stretch;
  border: var(--border-width-sm) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-field);
  box-shadow: var(--shadow-sm);
}

.access-code__digits {
  display: flex;
  align-items: center;
  padding: 0 var(--space-sm);
  background: var(--color-surface-subtle);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.15em;
}

.access-code.is-revealed .access-code__digits {
  color: var(--color-text);
}

.access-code__tools {
  display: flex;
  border-left: var(--border-width-sm) solid var(--color-border);
}

.access-code__tool {
  display: grid;
  place-items: center;
  width: var(--control-height-sm);
  min-height: var(--control-height-sm);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.access-code__tool + .access-code__tool {
  border-left: var(--border-width-sm) solid var(--color-divider);
}

.access-code__tool:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.access-code__tool:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.access-code__tool:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: -2px;
}

.access-code__tool .icon {
  grid-area: 1 / 1;
  transition: transform var(--transition-base);
}

/* Each tool's two states share one cell; the state decides which icon shows. */
.access-code__when-shown,
.access-code__when-copied,
.access-code.is-revealed .access-code__when-hidden,
.access-code__tool.is-copied .access-code__when-idle {
  visibility: hidden;
}

.access-code.is-revealed .access-code__when-shown,
.access-code__tool.is-copied .access-code__when-copied {
  visibility: visible;
}

.access-code__tool.is-copied {
  background: var(--color-success-tint);
  color: var(--color-success);
}

.access-code__tool[aria-pressed="true"] {
  color: var(--color-text);
}

.access-code__tool[data-access-rotate]:hover .icon {
  transform: rotate(120deg);
}

@media (prefers-reduced-motion: reduce) {
  .access-code__tool .icon {
    transition: none;
  }
}

.portal-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  min-width: 0;
}

.portal-link a {
  overflow-wrap: anywhere;
}

.portal-link .is-copied {
  color: var(--color-success);
}

/* The language switch: a sidebar item on ink, a plain link on public pages. */
.locale-switcher {
  margin: 0;
}

.locale-switcher__button {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sidebar__locale .locale-switcher__button {
  color: var(--color-on-ink-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.sidebar__locale .locale-switcher__button:hover {
  background: var(--color-ink-hover);
  color: var(--color-on-ink);
}

.home__locale .locale-switcher__button,
.site-footer__locale .locale-switcher__button {
  padding: 0;
  width: auto;
  color: inherit;
}

/*
 * The dashboard's onboarding guide: a piece of the homepage's pitch (ink, display type) inside the app.
 * Five phases in a row, each an icon circle joined to the next by a line; when the panel is narrow
 * (sidebar open on a small screen, phones) they stack into a vertical timeline.
 */
.view > .onboarding {
  --panel-padding: var(--space-2xl);
  --color-focus: var(--color-on-ink);
  display: grid;
  gap: var(--space-2xl);
  container-type: inline-size;
  background: var(--color-ink);
  color: var(--color-on-ink);
  border: 0;
}

/* The grid's gap spaces the header and the steps, not .panel's margins. */
.onboarding > * + * {
  margin-top: 0;
}

.onboarding__header {
  display: grid;
  gap: var(--space-sm);
  max-width: var(--measure-lg);
}

.onboarding__eyebrow {
  color: var(--color-on-ink-featured);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding__title {
  font-size: var(--font-size-2xl);
  letter-spacing: var(--letter-spacing-tighter);
  line-height: 1.05;
}

.onboarding__lead {
  color: var(--color-on-ink-muted);
  font-size: var(--font-size-md);
  line-height: var(--line-height-snug);
}

.steps {
  --marker: var(--size-xl);
  --line-gap: var(--space-sm);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps__item {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-xs);
  padding-right: var(--space-lg);
}

/* The line from this phase's circle to the next one's, level with their centers. */
.steps__item:not(:last-child)::after {
  position: absolute;
  top: calc(var(--marker) / 2 - var(--border-width-sm) / 2);
  left: calc(var(--marker) + var(--line-gap));
  right: var(--line-gap);
  height: var(--border-width-sm);
  background: var(--color-divider-on-ink);
  content: "";
}

.steps__marker {
  display: grid;
  place-items: center;
  width: var(--marker);
  height: var(--marker);
  margin-bottom: var(--space-xs);
  box-shadow: inset 0 0 0 var(--border-width-sm) var(--color-on-ink-muted);
  border-radius: var(--radius-full);
}

.steps__title {
  font-size: var(--font-size-md);
  line-height: var(--line-height-tight);
}

.steps__title a {
  text-decoration: underline;
  text-underline-offset: var(--underline-offset);
}

/* The arrow stays with the title's last word when it wraps. */
.steps__last {
  white-space: nowrap;
}

.steps__title .icon {
  margin-left: var(--space-2xs);
}

.steps__hint {
  color: var(--color-on-ink-muted);
  font-size: var(--font-size-xs);
  line-height: var(--line-height-snug);
}

@container (max-width: 840px) {
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps__item {
    grid-template-columns: var(--marker) minmax(0, 1fr);
    column-gap: var(--space-lg);
    padding: 0 0 var(--space-xl);
  }

  .steps__item:last-child {
    padding-bottom: 0;
  }

  .steps__marker {
    grid-row: span 2;
    margin: 0;
  }

  .steps__title {
    padding-top: calc((var(--marker) - 1lh) / 2);
  }

  .steps__item:not(:last-child)::after {
    top: calc(var(--marker) + var(--line-gap));
    bottom: var(--line-gap);
    left: calc(var(--marker) / 2 - var(--border-width-sm) / 2);
    right: auto;
    width: var(--border-width-sm);
    height: auto;
  }
}

@media (max-width: 480px) {
  .view > .onboarding {
    --panel-padding: var(--space-lg);
  }

  .onboarding__title {
    font-size: var(--font-size-xl);
  }
}

/* Reports: the browser's print dialog is the PDF export. */
@media print {
  .sidebar,
  .topbar,
  .app__scrim,
  .view__header .button,
  .flashes {
    display: none !important;
  }

  .app {
    display: block;
  }

  .app__main {
    margin: 0;
    padding: 0;
  }

  .panel {
    break-inside: avoid-page;
    border: 0;
  }

  .table-container {
    overflow: visible;
  }
}
