/*
 * Quilt: plain CSS with the Patchwork palette. No build step, no web fonts and no inline
 * styles, because the CSP allows only this stylesheet.
 *
 * Sections: tokens, base, layout, components, pages, small screens.
 * Components use the role tokens (--surface, --text, --accent...), never the palette directly,
 * so dark mode only redefines the roles.
 */

/* Tokens ---------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* The Patchwork palette. */
  --ink: #2a2050;
  --grape: #6c3ec1;
  --deep-purple: #4b006e;
  --lavender: #c7b7e2;
  --quilt: #f7f5fb;

  /* Roles. Text pairs here are at least 4.5:1 (WCAG AA). */
  --bg: var(--quilt);
  --surface: #ffffff;
  --surface-sunken: #f3f0f9;
  --surface-hover: #faf8fd;
  --border: #e6dff1;
  --border-strong: #d3c7e8;
  --text: var(--ink);
  --text-muted: #5d5580;
  --heading: var(--ink);
  --accent: var(--grape);
  --accent-hover: var(--deep-purple);
  --accent-soft: #efe9fa;
  --on-accent: #ffffff;
  --link: var(--grape);
  --link-hover: var(--deep-purple);
  --focus: var(--grape);
  --header-bg: rgb(255 255 255 / 0.88);
  --quilt-1: var(--grape);
  --quilt-2: var(--lavender);
  --quilt-3: var(--deep-purple);
  --quilt-4: #9b7ad9;

  --good: #1d6b47;
  --good-soft: #e3f4ea;
  --info: #1f5a96;
  --info-soft: #e5effa;
  --warn: #8a4b00;
  --warn-soft: #fdf0dc;
  --bad: #a3243f;
  --bad-soft: #fce8ec;
  --neutral: #575170;
  --neutral-soft: #efedf3;

  --shadow-sm: 0 1px 2px rgb(42 32 80 / 0.06);

  /* Type. System fonts only. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;

  /* Space, radius, width. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --content-width: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131020;
    --surface: #1c1729;
    --surface-sunken: #171324;
    --surface-hover: #221c33;
    --border: #2f2745;
    --border-strong: #42385f;
    --text: #ece8f6;
    --text-muted: #a8a0c4;
    --heading: #f4f1fb;
    --accent: #7d52d6;
    --accent-hover: #6c3ec1;
    --accent-soft: #2a2145;
    --on-accent: #ffffff;
    --link: #b79cf2;
    --link-hover: #d4c4f7;
    --focus: #b79cf2;
    --header-bg: rgb(28 23 41 / 0.88);
    --quilt-1: #7d52d6;
    --quilt-2: #c7b7e2;
    --quilt-3: #9b7ad9;
    --quilt-4: #4b2a8a;

    --good: #7fd6a6;
    --good-soft: #15301f;
    --info: #8ec0f2;
    --info-soft: #142740;
    --warn: #f2bd6d;
    --warn-soft: #36260d;
    --bad: #f39aae;
    --bad-soft: #3a1621;
    --neutral: #bdb6d4;
    --neutral-soft: #29233a;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  }
}

/* Base ------------------------------------------------------------------ */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-base) / 1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

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

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

h1,
h2,
h3 {
  margin: 0;
  color: var(--heading);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

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

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

h3 {
  font-size: var(--text-base);
  font-weight: 650;
}

p {
  margin: 0 0 var(--space-3);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

ul {
  padding-left: 1.25rem;
}

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

.error-text {
  color: var(--bad);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Layout ---------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  z-index: 20;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
}

.skip-link:focus {
  top: var(--space-2);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--heading);
  font-size: var(--text-lg);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  color: var(--heading);
}

.brand-mark {
  display: block;
  flex: none;
  width: 28px;
  height: 28px;
}

.brand-mark .q1 { fill: var(--quilt-1); }
.brand-mark .q2 { fill: var(--quilt-2); }
.brand-mark .q3 { fill: var(--quilt-3); }
.brand-mark .q4 { fill: var(--quilt-4); }

.brand-mark .stitch {
  fill: none;
  stroke: var(--surface);
  stroke-dasharray: 2 2;
  stroke-width: 1;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.nav-link {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 550;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--link);
  font-weight: 650;
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  font-size: var(--text-sm);
}

.who {
  font-weight: 600;
}

.roles {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-7);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
}

.page-head h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.page-subtitle {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  max-width: 50rem;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.section {
  margin-top: var(--space-6);
}

.section-head {
  margin-bottom: var(--space-3);
}

.section-head p {
  margin: var(--space-1) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 60rem;
}

.section-note {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 60rem;
}

.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.back-link {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
}

/* Components ------------------------------------------------------------ */

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.card > :last-child {
  margin-bottom: 0;
}

.card-title {
  margin-bottom: var(--space-3);
}

.narrow {
  max-width: 30rem;
  margin: var(--space-6) auto;
}

/* Stat cards */

.stats {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  margin: 0 0 var(--space-4);
}

.stat {
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat dt {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat dd {
  margin: 0;
}

.stat .stat-value {
  margin-top: var(--space-1);
  font-size: var(--text-xl);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat .stat-value code {
  font-size: 0.75em;
  overflow-wrap: normal;
}

.stat .stat-hint {
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.stat-accent {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface));
}

/* Detail lists */

.details {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) 1fr;
  gap: var(--space-2) var(--space-5);
  margin: 0;
}

.details dt {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding-top: 0.1em;
}

.details dd {
  margin: 0;
  min-width: 0;
}

/* Tables: the wrapper scrolls on small screens, never the page. */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
}

td {
  overflow-wrap: break-word;
}

th:first-child,
td:first-child {
  padding-left: var(--space-4);
}

th:last-child,
td:last-child {
  padding-right: var(--space-4);
}

thead th {
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr + tr td {
  border-top: 1px solid var(--border);
}

tbody tr:hover td {
  background: var(--surface-hover);
}

.nowrap {
  white-space: nowrap;
}

/* Codes and keys in a table stay on one line. The table wrapper scrolls instead. */
td code {
  overflow-wrap: normal;
  white-space: nowrap;
}

/* Prose cells keep a readable width on small screens. */
td.prose {
  min-width: 15rem;
}

.num-inline {
  font-variant-numeric: tabular-nums;
}

.cell-sub {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.cell-sub.error-text {
  color: var(--bad);
}

/* Ledger entries inside a table cell: one row per entry, the account key on the left and the
   amount on the right. A long key ends in an ellipsis (its title has the full key), so it never
   covers the amount. */

td.entries-cell {
  min-width: 20rem;
}

.entries {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.entries li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
}

.entries code {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entries .num {
  flex: none;
}

.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Badges and chips */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.05rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: currentColor;
}

.badge-good { background: var(--good-soft); color: var(--good); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--link); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }

.chip {
  display: inline-block;
  padding: 0 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
}

.code-chip {
  display: inline-block;
  padding: 0 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text);
  font-size: 0.8125em;
  line-height: 1.7;
  white-space: nowrap;
}

.code-link {
  text-decoration: none;
}

.code-link .code-chip {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--link);
}

.code-link:hover .code-chip {
  border-color: var(--link);
  color: var(--link-hover);
}

h1 .code-chip {
  padding: 0.1rem 0.6rem;
  font-size: 0.7em;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Money with a tone: drift and overspend. The number itself carries the meaning. */

.amount-good {
  color: var(--good);
}

.amount-bad {
  color: var(--bad);
  font-weight: 650;
}

/* Buttons */

.button,
input[type="submit"],
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.button:hover,
input[type="submit"]:hover,
button:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.button.button-secondary,
input[type="submit"].button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.button.button-secondary:hover,
input[type="submit"].button-secondary:hover {
  background: var(--surface-sunken);
}

.button.button-danger,
input[type="submit"].button-danger {
  background: var(--surface);
  border-color: var(--bad);
  color: var(--bad);
}

.button.button-danger:hover,
input[type="submit"].button-danger:hover {
  background: var(--bad-soft);
}

.button.button-small,
input[type="submit"].button-small {
  min-height: 1.875rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

input[type="submit"].button-link,
button.button-link {
  min-height: 0;
  padding: var(--space-1) var(--space-2);
  background: transparent;
  color: var(--text-muted);
  font-weight: 550;
}

input[type="submit"].button-link:hover,
button.button-link:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

/* Forms */

form {
  margin: 0;
}

.field {
  margin-bottom: var(--space-4);
}

label,
.label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

label.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 var(--space-4) var(--space-1) 0;
  font-weight: 500;
}

.hint {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

input[type="text"],
input[type="number"],
textarea,
select {
  display: block;
  width: 100%;
  max-width: 32rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--accent);
  outline-offset: 0;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

fieldset {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

legend {
  padding: 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
}

.form-card {
  max-width: 40rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* A form in a table cell or a card: label, input and button in a small stack. */
.compact-form {
  display: grid;
  gap: var(--space-1);
  min-width: 13rem;
}

.compact-form + .compact-form {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border-strong);
}

.compact-form label {
  margin: 0;
  font-size: var(--text-xs);
}

.compact-form input[type="text"] {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

.compact-form input[type="submit"] {
  justify-self: start;
  margin-top: var(--space-1);
}

/* Flash messages */

.flash {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius);
  background: var(--surface);
}

.flash p,
.flash ul {
  margin: 0;
}

.flash ul {
  margin-top: var(--space-1);
}

.flash-notice {
  border-color: var(--good-soft);
  border-left-color: var(--good);
  background: var(--good-soft);
}

.flash-alert {
  border-color: var(--bad-soft);
  border-left-color: var(--bad);
  background: var(--bad-soft);
}

.card + .flash,
.flash + .card {
  margin-top: var(--space-4);
}

/* Disclosure: an admin form that stays closed until a person opens it. No JavaScript. */

.disclosure summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.disclosure summary::-webkit-details-marker {
  display: none;
}

.disclosure summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.1em) rotate(45deg);
}

.disclosure[open] summary {
  margin-bottom: var(--space-3);
}

.disclosure[open] summary::after {
  transform: translateY(0.1em) rotate(-135deg);
}

/* Empty states */

.empty {
  margin: 0;
  padding: var(--space-5) var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  text-align: center;
}

/* Pages ----------------------------------------------------------------- */

/* Sign-in */

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 12rem);
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  padding: var(--space-6) var(--space-5);
  text-align: center;
}

.auth-card .brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
}

.auth-card h1 {
  margin-bottom: var(--space-2);
}

.auth-card form .button,
.auth-card form input[type="submit"] {
  width: 100%;
  margin-top: var(--space-3);
}

.auth-foot {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
}

.dev-card {
  max-width: 36rem;
  margin: 0 auto;
}

.dev-card h2 {
  margin: var(--space-5) 0 var(--space-3);
}

.presets {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}

.presets input[type="submit"] {
  width: 100%;
  justify-content: flex-start;
}

/* Approval cards on /topups */

.approval-list {
  display: grid;
  gap: var(--space-4);
}

.approval-card {
  border-color: var(--border-strong);
  border-left: 4px solid var(--warn);
}

.approval-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.approval-head h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.approval-amount {
  font-size: var(--text-2xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: right;
}

.approval-body {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  margin-top: var(--space-4);
}

.breakdown {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
}

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

.breakdown dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.breakdown .total {
  padding-top: var(--space-1);
  border-top: 1px solid var(--border);
  color: var(--text);
  font-weight: 650;
}

.approval-actions {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  align-content: start;
}

.approval-actions .compact-form + .compact-form {
  margin: 0;
  padding: 0;
  border: 0;
}

.approval-actions input[type="text"] {
  max-width: none;
}

.eyebrow {
  margin: 0 0 var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Mercury accounts */

.account-card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.account-card .details {
  grid-template-columns: 1fr auto;
  gap: var(--space-2) 0;
  margin-top: var(--space-3);
}

.account-card .details dd {
  margin: 0;
  padding-left: var(--space-4);
  text-align: right;
}

.account-card .drift {
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

/* Audit list */

.audit {
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit li {
  padding: var(--space-3) 0;
}

.audit li:first-child {
  padding-top: 0;
}

.audit li:last-child {
  padding-bottom: 0;
}

.audit li + li {
  border-top: 1px solid var(--border);
}

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

@media (max-width: 40rem) {
  main {
    padding-top: var(--space-5);
  }

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

  .site-header {
    position: static;
  }

  .site-header-inner {
    gap: var(--space-2) var(--space-3);
  }

  .site-nav {
    order: 3;
    width: 100%;
  }

  .card {
    padding: var(--space-4);
  }

  .details {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .details dd {
    margin-bottom: var(--space-3);
  }

  .account-card .details {
    grid-template-columns: 1fr auto;
    gap: var(--space-2) 0;
  }

  .account-card .details dd {
    margin: 0;
  }

  .approval-amount {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
