/* praniSheba API console: one stylesheet for the client portal and the staff console.
   Quiet, document-like, tables first. Plain CSS custom properties, no build step. */

@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-600.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Design tokens */
  --paper: #F4F8F6;
  --surface: #FFFFFF;
  --ink: #0B1F17;
  --muted: #4F6358;
  --rule: #E1ECE5;
  --field: #047857;
  --amber: #B45309;
  --red: #BE123C;

  /* Derived values (contrast checked against Paper and Surface) */
  --control: #78897F;        /* input and secondary button borders */
  --focus: #10B981;          /* focus ring, drawn 2px outside */
  --field-hover: #064E3B;
  --red-hover: #9F0F31;
  --wash: #EDF3F0;           /* table header, hover, read-only fields */
  --tint-field: #E3F3EA;
  --tint-amber: #FDF1E0;
  --tint-red: #FDE8EC;
  --tint-neutral: #E9EFEC;
  --ok: #047857;
  --tint-ok: #E3F3EA;
  --border-ok: #A7D8BF;
  --border-field: #B5DCC8;
  --border-amber: #F0CF9A;
  --border-red: #F5B9C6;
  --chart-refunded: #34A37E;
  --row-hover: #F8FBF9;
  --on-dark: var(--surface);  /* text on Field and Red buttons */
  --print-ink: #000000;
  --shadow-hairline: 0 1px 2px rgba(11, 31, 23, 0.06);
  --shadow-card: 0 1px 2px rgba(11, 31, 23, 0.04), 0 4px 16px rgba(11, 31, 23, 0.05);
  --shadow-pop: 0 8px 28px rgba(11, 31, 23, 0.14);

  /* Sidebar and brand */
  --nav-bg: #052E22;
  --nav-ink: #A9C4B5;
  --nav-ink-strong: #FFFFFF;
  --nav-hover: rgba(255, 255, 255, 0.07);
  --nav-active: rgba(16, 185, 129, 0.18);
  --nav-rule: rgba(255, 255, 255, 0.09);
  --nav-accent: #6EE7B7;
  --grad: linear-gradient(135deg, #065F46 0%, #047857 100%);
  --grad-soft: linear-gradient(135deg, #E3F3EA 0%, #F2F9F5 100%);
  --hero-bg: radial-gradient(60rem 28rem at 12% -10%, rgba(16, 185, 129, 0.2), transparent 60%), radial-gradient(44rem 24rem at 92% 0%, rgba(4, 120, 87, 0.14), transparent 60%);
  --scrim: rgba(5, 46, 34, 0.55);

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --text-xl: 2rem;           /* 32px display figures (balance band) */
  --radius: 8px;
  --radius-lg: 12px;
  --target: 2.75rem;         /* 44px */
  --content: 72rem;          /* 1152px */
  --rail-w: 15.5rem;
  --rail-w-collapsed: 4.5rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

[hidden] { display: none !important; }

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.4; }

/* 32px step of the 20/24/32 scale, for large plain figures such as the balance band. */
.display {
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }

.prose { font-size: 1rem; }
.prose p, .prose li { max-width: 68ch; }

a {
  color: var(--field);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

code, kbd, pre, samp, .mono {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-ligatures: none;
}
code {
  padding: 0.0625rem 0.25rem;
  border-radius: var(--radius);
  background: var(--wash);
  overflow-wrap: anywhere;
}
pre {
  margin: 0 0 1rem;
  padding: 1rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  line-height: 1.6;
}
pre code { padding: 0; background: none; }

hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.gap-top { margin-top: 1.5rem; }
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

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

.icon {
  width: 1rem;
  height: 1rem;
  flex: none;
}

/* Focus: visible on everything, never removed */

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

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--field);
  color: var(--on-dark);
  font-weight: 600;
  border-radius: var(--radius);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Shell: dark collapsible sidebar and a content column */

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.22s var(--ease);
}
html[data-rail="collapsed"] .layout-console .shell { grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr); }

.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden auto;
  padding: 1rem 0.75rem;
  background: var(--nav-bg);
  background-image: radial-gradient(18rem 14rem at 0% 0%, rgba(16, 185, 129, 0.2), transparent 70%);
  color: var(--nav-ink);
  scrollbar-width: thin;
}

.rail-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.rail-brand {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.25rem 0.375rem;
}
.rail-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: var(--grad);
  color: var(--on-dark);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(4, 120, 87, 0.45);
}
.rail-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.rail-name {
  overflow: hidden;
  color: var(--nav-ink-strong);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-note {
  color: var(--nav-accent);
  font-size: 0.75rem;
  font-weight: 500;
}

.rail-toggle,
.topbar-menu {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--nav-ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rail-toggle:hover { background: var(--nav-hover); color: var(--nav-ink-strong); }
.rail-toggle .icon { transition: transform 0.22s var(--ease); }
html[data-rail="collapsed"] .rail-toggle .icon { transform: rotate(180deg); }
.rail-toggle:focus-visible { outline-color: var(--nav-accent); }

.rail-nav ul {
  display: grid;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rail-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--target);
  padding: 0 0.75rem;
  border-radius: var(--radius);
  color: var(--nav-ink);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.rail-nav a .icon { width: 1.125rem; height: 1.125rem; }
.rail-nav a:hover { background: var(--nav-hover); color: var(--nav-ink-strong); }
.rail-nav a[aria-current="page"] {
  background: var(--nav-active);
  color: var(--nav-ink-strong);
  font-weight: 600;
}
.rail-nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--nav-accent);
}
.rail-nav a:focus-visible { outline-color: var(--nav-accent); outline-offset: -2px; }
.rail-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rail-account {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0 0.75rem;
  margin-top: auto;
  padding: 1rem 0.375rem 0;
  border-top: 1px solid var(--nav-rule);
}
.rail-avatar {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--nav-active);
  color: var(--nav-ink-strong);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
}
.rail-account-name {
  margin: 0;
  overflow: hidden;
  color: var(--nav-ink-strong);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-account form { grid-column: 1 / -1; margin: 0.5rem 0 0; }
.rail-account .button-quiet {
  position: relative;
  width: 100%;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0 0.375rem;
  color: var(--nav-ink);
}
.rail-account .button-quiet:hover { background: var(--nav-hover); color: var(--nav-ink-strong); }

/* Collapsed: icons only, with a tooltip from the link's own label */
html[data-rail="collapsed"] .rail-brand-text,
html[data-rail="collapsed"] .rail-label,
html[data-rail="collapsed"] .rail-account-name { display: none; }
html[data-rail="collapsed"] .rail { padding-left: 0.625rem; padding-right: 0.625rem; }
html[data-rail="collapsed"] .rail-top { flex-direction: column; gap: 0.5rem; }
html[data-rail="collapsed"] .rail-brand { flex: none; padding: 0; }
html[data-rail="collapsed"] .rail-nav a,
html[data-rail="collapsed"] .rail-account .button-quiet { justify-content: center; padding: 0; }
html[data-rail="collapsed"] .rail-account { grid-template-columns: 1fr; justify-items: center; padding-left: 0; padding-right: 0; }
html[data-rail="collapsed"] .rail-nav a[aria-current="page"]::before { left: -0.625rem; }
html[data-rail="collapsed"] .rail-nav a::after,
html[data-rail="collapsed"] .rail-account .button-quiet::after {
  content: attr(data-label);
  position: fixed;
  left: calc(var(--rail-w-collapsed) - 0.25rem);
  z-index: 40;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  background: var(--ink);
  color: var(--on-dark);
  font-size: 0.8125rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.12s, transform 0.12s;
}
html[data-rail="collapsed"] .rail-nav a:hover::after,
html[data-rail="collapsed"] .rail-nav a:focus-visible::after,
html[data-rail="collapsed"] .rail-account .button-quiet:hover::after,
html[data-rail="collapsed"] .rail-account .button-quiet:focus-visible::after { opacity: 1; transform: none; }

.topbar, .rail-scrim { display: none; }

.shell-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 2.5rem 3rem 2rem;
}
.shell-body > main,
.page-footer {
  width: 100%;
  max-width: var(--content);
}
.shell-body > main {
  flex: 1;
  min-width: 0;
}

.page-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}
.page-footer p { margin: 0 0 0.25rem; }

/* Sign-in pages: one narrow column, no rail */

.layout-auth .shell {
  display: block;
  max-width: 26rem;
  margin: 0 auto;
  padding: 4rem 1rem 2rem;
}
.layout-auth .auth-brand { margin-bottom: 2.5rem; }
.layout-auth .shell-body { padding: 0; }
.layout-auth .page-footer { margin-top: 3rem; }

/* Page header and sections */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 2rem;
}
.page-subtitle {
  margin: 0.375rem 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 1rem;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section { margin-top: 3rem; }
.section:first-child { margin-top: 0; }
.section + .section {
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1rem;
}
.section-head p { margin: 0; color: var(--muted); }
.section > h2 { margin-bottom: 1rem; }

/* Data tables: the main object. Caption, sticky header, no radius. */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.table-wrap.table-scroll {
  max-height: min(70vh, 45rem);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data caption {
  caption-side: top;
  padding: 0.875rem 1rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  font-size: 0.9375rem;
  font-weight: 600;
}
.caption-note {
  display: block;
  margin-top: 0.125rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.data th,
.data td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: middle;
}
.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
  background: var(--wash);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.data thead th.num,
.data td.num { text-align: right; }
.data tbody th { font-weight: 500; }
.data tbody tr:last-child > * { border-bottom: 0; }
.data tbody tr:hover > * { background: var(--row-hover); }
.data .cell-detail {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Status pills: colour, a word and a small shape, always together */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
  background: var(--tint-neutral);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}
.pill::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  background: currentColor;
}
.pill-ok { background: var(--tint-field); color: var(--field); }
.pill-ok::before { border-radius: 50%; }
.pill-neutral::before { width: 0.4375rem; height: 0.4375rem; }
.pill-muted { color: var(--muted); }
.pill-muted::before {
  background: none;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.pill-warn { background: var(--tint-amber); color: var(--amber); }
.pill-warn::before {
  width: 0.4375rem;
  height: 0.4375rem;
  transform: rotate(45deg);
}
.pill-bad { background: var(--tint-red); color: var(--red); }
.pill-bad::before {
  width: 0.5625rem;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

/* Buttons */

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--target);
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--field);
  color: var(--on-dark);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { background: var(--field-hover); }
.button-secondary {
  background: var(--surface);
  border-color: var(--control);
  color: var(--ink);
}
.button-secondary:hover { background: var(--wash); }
.button-danger { background: var(--red); }
.button-danger:hover { background: var(--red-hover); }
.button-quiet {
  padding: 0 0.75rem;
  background: transparent;
  color: var(--ink);
}
.button-quiet:hover { background: var(--wash); }
.button[aria-disabled="true"] {
  background: transparent;
  border-color: var(--rule);
  color: var(--muted);
  cursor: default;
}

/* Forms: 16px, visible labels, help above the control, errors in words */

form { font-size: 1rem; }
.rail form, .pagination { font-size: 0.875rem; }

.field {
  max-width: 32rem;
  margin-bottom: 1.5rem;
}
.field label,
.copy-field label,
legend {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.field-optional {
  color: var(--muted);
  font-weight: 400;
}
.field-help {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.field-error {
  margin: 0 0 0.5rem;
  color: var(--red);
  font-weight: 500;
}
.field-error p {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
}
.field-error p::before {
  content: "";
  flex: none;
  width: 0.5625rem;
  height: 0.5rem;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: var(--target);
  padding: 0.5625rem 0.75rem;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
}
textarea {
  min-height: 6rem;
  resize: vertical;
}
input[readonly] { background: var(--wash); }
input.mono,
.copy-field input { font-size: 1rem; }
input[type="checkbox"],
input[type="radio"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--field);
}
.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border: 2px solid var(--red);
  padding: 0.5rem 0.6875rem;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible { border-color: var(--field); }

fieldset {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Notices */

.notice {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  max-width: 52rem;
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.9375rem;
}
.notice::before {
  content: "";
  flex: none;
  position: relative;
  top: -0.0625rem;
  width: 0.5rem;
  height: 0.5rem;
  border: 1.5px solid var(--field);
  border-radius: 50%;
}

.notice-success { background: var(--tint-field); border-color: var(--border-field); }
.notice-success::before { background: var(--field); }
.notice-warn { background: var(--tint-amber); border-color: var(--border-amber); }
.notice-warn::before {
  width: 0.4375rem;
  height: 0.4375rem;
  border: 0;
  border-radius: 0;
  background: var(--amber);
  transform: rotate(45deg);
}
.notice-error { background: var(--tint-red); border-color: var(--border-red); }
.notice-error::before {
  width: 0.5625rem;
  border: 0;
  border-radius: 0;
  background: var(--red);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

/* Copy field */

.copy-field {
  max-width: 40rem;
  margin-bottom: 1.5rem;
}
.copy-field-row {
  display: flex;
  gap: 0.5rem;
}
.copy-field-row input {
  flex: 1;
  min-width: 0;
}
.copy-field-row .button { min-width: 6.5rem; }

/* Empty state */

.empty-state {
  padding: 2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-size: 1rem;
}
.empty-state p { max-width: 60ch; }
.empty-state p + p { margin-top: 1rem; }

/* Confirm panel: the one raised surface */

.confirm-panel {
  max-width: 36rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-red);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hairline);
  font-size: 1rem;
}
.confirm-panel h2 { margin-bottom: 0.5rem; }
.confirm-panel > p {
  max-width: 60ch;
  margin-bottom: 1.25rem;
}
.confirm-panel .field { margin-bottom: 1.25rem; }
.confirm-panel label code { font-size: 0.875rem; }
/* Approvals: each row action opens its own confirm panel in place */
.row-confirm { display: inline-block; vertical-align: top; }
.row-confirm + .row-confirm { margin-left: 0.5rem; }
.row-confirm > summary { list-style: none; cursor: pointer; }
.row-confirm > summary::-webkit-details-marker { display: none; }
.row-confirm[open] { display: block; }
.row-confirm[open] + .row-confirm { margin: 0.5rem 0 0; }
.row-confirm .confirm-panel { min-width: 18rem; margin-top: 0.5rem; white-space: normal; }

/* Pagination */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}
.pagination-status {
  margin: 0;
  text-align: center;
}
.pagination-range {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Bar chart (server-rendered SVG with a hidden table alternative) */

.bars {
  margin: 0;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.bars figcaption {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.bars svg {
  display: block;
  width: 100%;
  height: 10rem;
  overflow: visible;
}
.bar-charged { fill: var(--field); }
.bar-refunded {
  fill: var(--chart-refunded);
  stroke: var(--surface);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.bars-grid {
  stroke: var(--rule);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.bars-axis {
  stroke: var(--control);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.bars-max {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.8125rem;
}
.bars-range {
  display: flex;
  justify-content: space-between;
  margin: 0.375rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
.bars-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}
.bars-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.bars-legend span::before {
  content: "";
  width: 0.625rem;
  height: 0.625rem;
}
.legend-charged::before { background: var(--field); }
.legend-refunded::before { background: var(--chart-refunded); }
.bars-table { margin-top: 1rem; }
.bars-table summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  color: var(--field);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.bars-table summary::-webkit-details-marker { display: none; }
.bars-table summary::before {
  content: "";
  margin-right: 0.5rem;
  border-top: 0.3125rem solid transparent;
  border-bottom: 0.3125rem solid transparent;
  border-left: 0.375rem solid currentColor;
}
.bars-table[open] > summary::before { transform: rotate(90deg); }
.bars-table .table-wrap { margin-top: 0.5rem; }
.bars-table thead th { white-space: normal; }
.bars-empty {
  margin: 0;
  padding: 2rem 0;
  color: var(--muted);
}

/* Balance band: the one memorable element of the Overview. Two large plain figures,
   one rule between them, the runway beneath each, and a plain Buy tokens link. */

.balance-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 52rem;
  margin: 0;
}
.balance { padding: 0.25rem 2.5rem 0.25rem 0; }
.balance + .balance {
  padding-left: 2.5rem;
  border-left: 1px solid var(--rule);
}
.balance dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  min-height: 1.5rem;
  font-size: 1rem;
  font-weight: 500;
}
.balance dd { margin: 0; }
.balance .display { margin-top: 0.5rem; }
.balance-low .display { color: var(--amber); }
.balance-runway {
  margin-top: 0.375rem;
  color: var(--muted);
  font-size: 1rem;
}
.balance-buy {
  margin: 1.25rem 0 0;
  font-size: 1rem;
  font-weight: 500;
}
.balance-buy a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}
.balance-section + .section {
  margin-top: 2rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
}

.chart-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
.key-line { font-size: 1rem; }
.page-notices .notice { max-width: none; }

/* Sign-in page */

.auth-intro {
  margin: 0.5rem 0 2rem;
  color: var(--muted);
  font-size: 1rem;
}
.auth-help { margin-top: 2rem; font-size: 1rem; }

@media (max-width: 64em) {
  .chart-pair { grid-template-columns: minmax(0, 1fr); }
}

/* Under 900px the sidebar becomes a drawer opened from a top bar.
   Without script it stays a plain block above the page. */

@media (max-width: 56.25em) {
  .shell,
  html[data-rail="collapsed"] .shell { display: block; }

  .rail {
    position: static;
    height: auto;
    overflow: visible;
  }
  .rail-nav ul { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }

  .js .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
  }
  .topbar-menu { color: var(--ink); }
  .topbar-menu:hover { background: var(--wash); }
  .topbar-title { font-weight: 600; letter-spacing: -0.01em; }

  .js .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(18rem, 86vw);
    height: 100%;
    overflow: hidden auto;
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 0.24s var(--ease), visibility 0s linear 0.24s;
  }
  .js .rail-nav ul { grid-template-columns: 1fr; }
  html[data-drawer="open"] .rail {
    transform: none;
    visibility: visible;
    transition-delay: 0s;
    box-shadow: var(--shadow-pop);
  }
  .js .rail-toggle { display: none; }
  .js .rail-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s;
  }
  html[data-drawer="open"] .rail-scrim { opacity: 1; pointer-events: auto; }

  /* The drawer is always full width, whatever the desktop collapse state */
  html[data-rail="collapsed"] .rail-brand-text,
  html[data-rail="collapsed"] .rail-label,
  html[data-rail="collapsed"] .rail-account-name { display: revert; }
  html[data-rail="collapsed"] .rail-top { flex-direction: row; }
  html[data-rail="collapsed"] .rail-brand { flex: 1; padding: 0.25rem 0.375rem; }
  html[data-rail="collapsed"] .rail-nav a { justify-content: flex-start; padding: 0 0.75rem; }
  html[data-rail="collapsed"] .rail-nav a::after,
  html[data-rail="collapsed"] .rail-account .button-quiet::after { display: none; }

  .shell-body { padding: 1.75rem 1.5rem 1.5rem; }
}

@media (max-width: 40em) {
  .shell-body { padding: 1.5rem 1rem 1rem; }
  .page-header { margin-bottom: 1.5rem; }
  .page-actions,
  .page-actions .button { width: 100%; }
  .section { margin-top: 2.25rem; }
  .section + .section { padding-top: 2rem; }
  .data th,
  .data td { padding-left: 0.75rem; padding-right: 0.75rem; }
  .copy-field-row { flex-wrap: wrap; }
  .copy-field-row input { flex-basis: 100%; }
  .confirm-panel { padding: 1.25rem 1rem; }
  .balance-band { grid-template-columns: minmax(0, 1fr); }
  .balance { padding: 0; }
  .balance + .balance {
    margin-top: 1.25rem;
    padding: 1.25rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
  }
  .balance-section + .section { padding-top: 2rem; }
  .pagination-status { order: -1; flex-basis: 100%; text-align: left; }
}

/* Call rows reflow until the four columns fit beside the rail with the request id on one line:
   time and endpoint, then the outcome, then the request id. */
@media (min-width: 72.0625em) {
  .data-reflow td.mono { white-space: nowrap; }
}
@media (max-width: 72em) {
  .data-reflow thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .data-reflow tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--rule);
  }
  .data-reflow tbody tr:last-child { border-bottom: 0; }
  .data-reflow tbody td {
    padding: 0;
    border: 0;
  }
  .data-reflow tbody td:nth-child(n+3) { grid-column: 1 / -1; }
  .data-reflow td.mono {
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  .health-table tbody th {
    padding: 0;
    border: 0;
    align-self: center;
  }
}

/* Usage: filter bar, two-line rows and the call detail list */

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.75rem 1rem;
  align-items: start;
  margin-bottom: 2rem;
}
.filter-bar .field { margin: 0; }
.filter-bar .field-check { align-self: end; }
.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.usage-table .row-main,
.usage-table .row-sub { display: block; }
.usage-table td[data-label]::before { content: none; }
.detail-list {
  max-width: 40rem;
  margin: 0;
  border-top: 1px solid var(--rule);
}
.detail-list > div {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 72em) {
  .usage-table tbody td.num { grid-column: auto; }
  .usage-table tbody td.num { text-align: left; }
  .usage-table tbody td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
  }
  .usage-table td[data-label="Outcome"] .row-main { display: inline; }
}
@media (max-width: 40em) {
  .detail-list > div { grid-template-columns: minmax(0, 1fr); }
}

/* Links inside dense table rows get a 44px tall hit area on touch screens
   without changing the row height. */
@media (pointer: coarse) {
  .data td a {
    display: inline-block;
    padding: 0.75rem 0;
    margin: -0.75rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Buy tokens and receipts */

.buy-grid {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 2rem 3rem;
  align-items: start;
}
.buy-form .field { max-width: none; }
.buy-quote .quote-total {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}
.buy-quote .quote-message {
  margin: 0 0 1.5rem;
  color: var(--muted);
}
.buy-quote .quote-message-error {
  color: var(--red);
  font-weight: 500;
}
.tier-table { max-width: 36rem; }
.tier-table caption {
  padding: 0.625rem 1rem;
  text-align: left;
  font-weight: 500;
}
.buy-preview { margin-top: 2rem; }
.pack-form-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 22rem));
  gap: 0 1.5rem;
}
.pack-form-fields .field { max-width: none; }
.receipt-back { margin: 0 0 1.5rem; }
.receipt .detail-list { margin-bottom: 2rem; }
.receipt-lines { max-width: 40rem; }
.receipt-lines tfoot th,
.receipt-lines tfoot td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 600; }
.receipt-support { margin-top: 1.5rem; color: var(--muted); }
@media (max-width: 56em) {
  .buy-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Alerts */

.alert-level + .alert-level {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.alert-level h3 { margin: 0 0 0.5rem; }
.alert-level .detail-list { margin-bottom: 1.5rem; }
.alerts-form .field { max-width: 32rem; }
.alerts-form > .button { margin-top: 2rem; }

/* Print: receipts and reports. No rail, no controls, black on white. */

@media print {
  @page { margin: 18mm 16mm; }

  body {
    background: var(--surface);
    color: var(--print-ink);
    font-size: 10.5pt;
  }
  .rail,
  .topbar,
  .rail-scrim,
  .public-bar,
  .skip-link,
  .page-actions,
  .pagination,
  .button,
  [data-print],
  [data-copy-target],
  .bars-table,
  .receipt-back,
  .footer-extra { display: none !important; }
  .shell { display: block; }
  .shell-body { padding: 0; }
  .shell-body > main,
  .page-footer { max-width: none; }
  .table-wrap,
  .table-wrap.table-scroll {
    max-height: none;
    overflow: visible;
    border: 0;
  }
  .data thead th {
    position: static;
    background: none;
    color: var(--print-ink);
    border-bottom: 1px solid var(--print-ink);
  }
  .data tr { break-inside: avoid; }
  a {
    color: inherit;
    text-decoration: none;
  }
  .pill,
  .notice,
  .bars,
  .empty-state,
  .confirm-panel {
    background: none;
    box-shadow: none;
  }
  .page-footer { margin-top: 2rem; }
}

/* API access: example calls, each with its own copy button */

.code-example { max-width: 52rem; margin-bottom: 1.5rem; }
.code-example-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.code-example-head h3 { margin: 0; }
.code-example-note { margin: 0.125rem 0 0.5rem; color: var(--muted); }
.code-example pre { margin: 0; }
@media (max-width: 72em) {
  .keys-table tbody td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
  }
}

/* Staff Today: a band of plain figures, then the attention list */

.summary-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.75rem 2.5rem;
  max-width: 72rem;
  margin: 0;
}
.summary-figure dt {
  min-height: 1.5rem;
  font-size: 1rem;
  font-weight: 500;
}
.summary-figure dd { margin: 0; }
.summary-figure .display { margin-top: 0.5rem; }
.summary-figure .summary-none {
  font-size: var(--text-lg, 1.25rem);
  letter-spacing: 0;
  color: var(--muted);
}
.summary-note {
  margin-top: 0.375rem;
  color: var(--muted);
  font-size: 1rem;
}
.summary-section + .section {
  margin-top: 2rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
}
.attention-list {
  max-width: 52rem;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}
.attention-list li {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0 0.75rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
}
.attention-list a {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: var(--target);
  font-weight: 500;
}
.attention-detail { color: var(--muted); }

/* Staff client pages: a back link, the client header, a row of tabs */

.crumb { margin: 0 0 0.25rem; font-size: 0.9375rem; }
.crumb a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}
.client-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.page-actions form { margin: 0; }
.tabs { margin: -0.5rem 0 2rem; border-bottom: 1px solid var(--rule); }
.tabs ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}
.tabs a {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 0.75rem;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a:hover { background: var(--wash); }
.tabs a:focus-visible { outline-offset: -3px; }
.tabs a[aria-current="page"] {
  border-bottom-color: var(--field);
  color: var(--field);
  font-weight: 600;
}
.clients-table th a,
.approvals-table th a { font-weight: 600; }
@media (max-width: 72em) {
  .clients-table tbody td[data-label]::before,
  .approvals-table tbody td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
  }
  .clients-table tbody td.num { text-align: left; }
  .clients-table tbody th,
  .approvals-table tbody th {
    padding: 0;
    border: 0;
  }
}
@media (max-width: 40em) {
  .tabs { margin-bottom: 1.5rem; }
  .tabs ul { flex-wrap: wrap; }
  .page-actions form { width: 100%; }
}

/* Staff price editor */

.price-table input:not([type="checkbox"]) { min-width: 8rem; }
.price-table td { vertical-align: top; }
.price-table .check,
.filter-bar .check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--target);
  font-weight: 400;
}
.price-table .field-error { margin: 0.375rem 0 0; font-size: 0.875rem; }
.preview-table td.num, .preview-table th.num { white-space: nowrap; }
@media (max-width: 40em) {
  .price-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .price-table, .price-table tbody, .price-table tr, .price-table th, .price-table td { display: block; }
  .price-table tr { padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); }
  .price-table tbody tr:last-child { border-bottom: 0; }
  .price-table th, .price-table td { padding: 0.25rem 0; border: 0; }
  .price-table caption { display: block; }
  .price-table th::before { content: "Tier "; }
  .price-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
  }
}

/* Public pages: a top bar instead of the rail, a centred column, the landing page and pack cards */

.layout-public .shell { display: block; }
.public-bar {
  --gutter: max(1.5rem, calc((100% - var(--content)) / 2));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding: 0.5rem var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.public-brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.public-nav ul {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.public-nav a {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 0.75rem;
  border-radius: var(--radius);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.public-nav a:hover { background: var(--wash); }
.public-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.public-account form { margin: 0; font-size: 0.875rem; }
.layout-public .shell-body { padding: 3.5rem max(1.5rem, calc((100% - var(--content)) / 2)) 2rem; }
.layout-public .page-footer { margin-top: 5rem; }

.public-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}
.public-footer-name { margin: 0; color: var(--ink); font-weight: 600; }
.public-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.public-footer-links li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: var(--target);
}
.public-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 2rem 4rem;
  align-items: center;
  padding-bottom: 3.5rem;
}
.hero h1 {
  max-width: 22ch;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hero-lead {
  max-width: 52ch;
  margin: 1rem 0 1.75rem;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.55;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.hero-note {
  max-width: 52ch;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.hero-example-label { margin: 0 0 0.5rem; font-weight: 600; }
.hero-example pre {
  margin: 0;
  border-left: 3px solid var(--field);
  font-size: 0.875rem;
}
.hero-example-note {
  margin: 0.625rem 0 0;
  color: var(--muted);
}
.hero + .section {
  margin-top: 0;
  padding-top: 3rem;
  border-top: 1px solid var(--rule);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  font-size: 1rem;
}
.steps li {
  padding-top: 1rem;
  border-top: 2px solid var(--field);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  display: block;
  margin-bottom: 0.75rem;
  color: var(--field);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1;
}
.steps h3 { margin-bottom: 0.375rem; }
.steps p { max-width: 40ch; }

.token-rules {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 2rem 3rem;
  align-items: start;
}
.token-table caption { text-align: left; }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pack {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.pack-best {
  padding-top: calc(1.25rem - 2px);
  border-color: var(--field);
  border-top-width: 3px;
}
.pack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  min-height: 1.5rem;
  margin-bottom: 1rem;
}
.pack-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
  background: var(--tint-field);
  color: var(--field);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}
.pack-tag-best { background: var(--field); color: var(--on-dark); }
.pack-size { margin: 0; color: var(--muted); font-size: 1rem; }
.pack-tokens {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
}
.pack-cost { margin: 0.25rem 0 1.5rem; }
.pack-price {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.pack-rate { margin: 0.25rem 0 0; color: var(--muted); }
.pack-cta { margin-top: auto; width: 100%; }
.pack-footnote { margin-top: 1rem; }

@media (max-width: 64em) {
  .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .token-rules { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 56.25em) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-bottom: 2.5rem; }
  .layout-public .shell-body { padding-top: 2.5rem; }
}
@media (max-width: 40em) {
  .public-bar { --gutter: 1rem; gap: 0 0.5rem; }
  .public-nav { order: 3; flex-basis: 100%; margin: 0 -0.75rem; }
  .layout-public .shell-body { padding: 2rem 1rem 1rem; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .pack-grid { grid-template-columns: minmax(0, 1fr); }
  .pack-tags:empty { display: none; }
  .hero-actions .button { flex: 1; }
  .layout-public .page-footer { margin-top: 3rem; }
}

.docs-layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: 2rem 3rem;
  align-items: start;
}
.docs-nav ul { margin: 0; padding: 0; list-style: none; }
.docs-nav a {
  display: flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 0.75rem;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.docs-nav a:hover { background: var(--wash); }
.docs-nav a[aria-current="page"] { background: var(--wash); font-weight: 600; }
.docs-body { min-width: 0; }
.docs-lead { max-width: 60ch; margin: 0.5rem 0 0; color: var(--muted); font-size: 1.125rem; }
.docs-body .code-example { margin-top: 1rem; }
.docs-body .table-wrap { margin: 1rem 0; }
.docs-body .prose { margin: 0.75rem 0; }
.docs-body ul.prose, .docs-body ol.prose { padding-left: 1.25rem; }
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem; }
}

/* Polish: depth, brand colour, loading feedback. Screen only, so receipts still print plain. */

@media screen {
  body {
    background-image: radial-gradient(50rem 18rem at 70% -6rem, rgba(16, 185, 129, 0.07), transparent 70%);
    background-repeat: no-repeat;
  }
  h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
  .page-header { padding-bottom: 1.25rem; border-bottom: 1px solid var(--rule); }

  /* Surfaces */
  .table-wrap,
  .confirm-panel,
  .pack,
  .hero-example,
  .steps li,
  .notice {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
  }
  .table-wrap { overflow-y: hidden; }
  .table-wrap.table-scroll { overflow: auto; }
  .notice { box-shadow: none; }
  .data thead th { font-size: 0.8125rem; letter-spacing: 0.01em; }
  .data tbody tr { transition: background 0.12s; }

  pre {
    background: var(--nav-bg);
    border-color: var(--nav-rule);
    border-radius: var(--radius-lg);
    color: var(--nav-ink-strong);
  }
  pre code { color: inherit; }

  /* Buttons and fields */
  .button {
    box-shadow: var(--shadow-hairline);
    transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, color 0.15s;
  }
  .button:not(.button-secondary, .button-quiet, .button-danger, [aria-disabled="true"]) {
    background: var(--grad);
    box-shadow: 0 1px 2px rgba(4, 120, 87, 0.3), 0 4px 12px rgba(4, 120, 87, 0.22);
  }
  .button:not(.button-secondary, .button-quiet, .button-danger, [aria-disabled="true"]):hover {
    background: var(--grad);
    box-shadow: 0 1px 2px rgba(4, 120, 87, 0.4), 0 6px 18px rgba(4, 120, 87, 0.34);
    filter: brightness(1.06);
  }
  .button-quiet { box-shadow: none; }
  .button-secondary:hover { border-color: var(--field); color: var(--field); }
  input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"]),
  select,
  textarea { transition: border-color 0.15s, box-shadow 0.15s; }
  input:not([type="checkbox"], [type="radio"]):focus-visible,
  select:focus-visible,
  textarea:focus-visible { box-shadow: 0 0 0 4px var(--tint-field); outline-offset: 0; }

  /* Status colours: success is green, brand indigo is for actions only */
  .pill { border-radius: 999px; padding-left: 0.625rem; padding-right: 0.625rem; }
  .pill-ok { background: var(--tint-ok); color: var(--ok); }
  .notice-success { background: var(--tint-ok); border-color: var(--border-ok); }
  .notice-success::before { background: var(--ok); border-color: var(--ok); }

  /* Overview balances as cards */
  .balance-band { gap: 1rem; max-width: 52rem; }
  .balance,
  .balance + .balance {
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
  }
  .balance:first-child { background: var(--grad-soft); border-color: var(--border-field); }
  .balance .display {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
  .balance-low .display { background: none; -webkit-text-fill-color: currentColor; color: var(--amber); }

  /* Public pages */
  .public-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
  }
  .public-brand::before {
    content: "";
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.625rem;
    border-radius: 7px;
    background: var(--grad);
  }
  .hero {
    padding: 3rem;
    border: 1px solid var(--rule);
    border-radius: 20px;
    background: var(--hero-bg), var(--surface);
  }
  .hero h1 { font-size: clamp(2.125rem, 4.4vw, 3.125rem); letter-spacing: -0.03em; }
  .hero-example pre { margin: 0; }
  .steps li { padding: 1.25rem; border-top: 1px solid var(--rule); background: var(--surface); }
  .steps li::before { color: var(--field); }
  .pack { transition: box-shadow 0.18s, border-color 0.18s; }
  .pack:hover { box-shadow: var(--shadow-pop); border-color: var(--border-field); }
  .pack-best {
    border-color: var(--field);
    border-top-width: 1px;
    padding-top: 1.25rem;
    background: var(--grad-soft);
  }
  .pack-tag { border-radius: 999px; }
  .pack-tag-best { background: var(--grad); }

  /* Loading: a bar across the top while a page loads, a spinner on the pressed button */
  .load-bar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    height: 3px;
    background: var(--grad);
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    pointer-events: none;
  }
  html[data-loading] .load-bar {
    opacity: 1;
    animation: load-grow 8s cubic-bezier(0.1, 0.6, 0.2, 1) forwards;
  }
  @keyframes load-grow { to { transform: scaleX(0.92); } }

  button[data-busy],
  .button[data-busy] { position: relative; color: transparent !important; cursor: progress; }
  button[data-busy]::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--on-dark);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }
  .button-secondary[data-busy]::after,
  .button-quiet[data-busy]::after { border-color: var(--field); border-right-color: transparent; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* Content that is being refetched shows a shimmer instead of jumping */
  [aria-busy="true"] { position: relative; pointer-events: none; }
  [aria-busy="true"] > * { opacity: 0.45; transition: opacity 0.15s; }
  [aria-busy="true"]::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background: linear-gradient(100deg, transparent 30%, var(--tint-field) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 1.1s linear infinite;
  }
  @keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
}

@media (max-width: 40em) {
  .hero { padding: 1.5rem; }
}

/* Sign-in and register: brand panel beside the form */

.layout-auth .shell {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  padding: 2.5rem 3rem;
  overflow: hidden;
  background-color: var(--nav-bg);
  background-image:
    radial-gradient(30rem 24rem at 100% 100%, rgba(16, 185, 129, 0.35), transparent 70%),
    radial-gradient(24rem 20rem at 0% 0%, rgba(4, 120, 87, 0.5), transparent 70%);
  color: var(--nav-ink);
}
/* Concentric rings: the ridge pattern of a muzzle print */
.auth-aside::before {
  content: "";
  position: absolute;
  right: -14rem;
  bottom: -14rem;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 1.1rem, rgba(110, 231, 183, 0.16) 1.1rem 1.18rem);
  -webkit-mask-image: radial-gradient(circle, black 30%, transparent 72%);
  mask-image: radial-gradient(circle, black 30%, transparent 72%);
  pointer-events: none;
}
.auth-aside > * { position: relative; }
.auth-aside .auth-brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.75rem;
  text-decoration: none;
}
.auth-aside .rail-name { color: var(--nav-ink-strong); font-size: 1.0625rem; }
.auth-pitch-title {
  max-width: 14ch;
  margin: 0 0 1.5rem;
  color: var(--nav-ink-strong);
  font-size: clamp(1.875rem, 3vw, 2.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.035em;
}
.auth-points {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.auth-points li { display: flex; align-items: center; gap: 0.75rem; }
.auth-points li::before {
  content: "";
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--nav-active);
  box-shadow: inset 0 0 0 1px var(--nav-accent);
}
.auth-match {
  align-self: flex-start;
  min-width: 15rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--nav-rule);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.auth-match-label { margin: 0 0 0.25rem; color: var(--nav-ink); font-size: 0.8125rem; }
.auth-match-id { margin: 0; color: var(--nav-ink-strong); font-family: var(--mono); font-size: 1.125rem; font-weight: 500; }
.auth-match-bar { height: 6px; margin: 0.75rem 0 0.375rem; border-radius: 3px; background: var(--nav-rule); overflow: hidden; }
.auth-match-bar::after { content: ""; display: block; width: 97%; height: 100%; border-radius: 3px; background: var(--nav-accent); }
.auth-match-score { margin: 0; color: var(--nav-accent); font-size: 0.8125rem; font-weight: 600; }

.layout-auth .shell-body {
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: var(--surface);
}
.layout-auth .shell-body > main,
.layout-auth .page-footer { max-width: 25rem; }
.layout-auth main h1 { font-size: 1.875rem; }
.auth-intro { margin: 0.5rem 0 1.5rem; font-size: 0.9375rem; }
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  margin: 0 0 2rem;
  padding: 0.25rem;
  border-radius: 10px;
  background: var(--wash);
}
.auth-switch a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.auth-switch a:hover { color: var(--ink); }
.auth-switch a[aria-current="page"] { background: var(--surface); color: var(--field); font-weight: 600; box-shadow: var(--shadow-hairline); }
.auth-form .field { max-width: none; margin-bottom: 1.25rem; }
.auth-form .button { width: 100%; min-height: 3rem; }
.layout-auth .page-footer { margin-top: 2.5rem; border-top: 0; }
.layout-auth .body-note { display: none; }

@media (max-width: 56.25em) {
  .layout-auth .shell { display: block; }
  .auth-aside { padding: 1.25rem 1.5rem; gap: 0; }
  .auth-pitch, .auth-match { display: none; }
  .layout-auth .shell-body { padding: 2rem 1.25rem; align-items: stretch; }
  .layout-auth .shell-body > main,
  .layout-auth .page-footer { max-width: none; }
}
