/* ═══════════════════════════════════════════════════════════════════════════
   Alviyora Invoicing — the design system.

   One stylesheet for four surfaces: the marketing homepage, the auth pages,
   the console, and the payer-facing pay/invoice pages. It replaces five
   private <style> blocks that had drifted apart on colour and spacing.

   House rule, and the only one that matters here: NO LITERAL COLOUR OUTSIDE
   THE :root BLOCK. Every rule below reaches for a token. That single
   discipline is what makes dark mode a later one-block addition rather than a
   rewrite of this file.
   ═══════════════════════════════════════════════════════════════════════════ */


/* ─── tokens ──────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces and ink. The greys carry a faint blue cast so they sit with the
     brand rather than fighting it. */
  --c-bg:            #f4f6fb;
  --c-bg-sunk:       #eceff7;
  --c-surface:       #ffffff;
  --c-surface-2:     #f8f9fc;
  --c-ink:           #161c2d;
  --c-ink-soft:      #3d465f;
  --c-ink-muted:     #67718a;
  --c-line:          #e3e6ef;
  --c-line-strong:   #ccd2e2;

  /* Brand. --c-brand is the original #2743a6, kept: the product should still
     look like itself after this change. */
  --c-brand:         #2743a6;
  --c-brand-hover:   #1d3488;
  --c-brand-active:  #16286b;
  --c-brand-ink:     #ffffff;
  --c-brand-soft:    #eaeefb;
  --c-brand-line:    #c6d0f2;

  /* Semantic pairs: ink + its own tint, so pills, toasts and banners all read
     from one source. */
  --c-ok:            #1e7f4f;
  --c-ok-soft:       #e2f3ea;
  --c-warn:          #8a6d00;
  --c-warn-soft:     #f9f0d2;
  --c-bad:           #b3372d;
  --c-bad-soft:      #fae5e2;
  --c-info:          #1f5f9e;
  --c-info-soft:     #e4eefa;
  --c-neutral:       #59627c;
  --c-neutral-soft:  #edeff5;

  --c-focus:         #4d74e8;
  --c-overlay:       rgba(16, 21, 38, .48);
  --c-code-bg:       #161c2d;
  --c-code-ink:      #9fe8c1;

  /* Space — a 4px scale. */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px;  --s-8: 64px;  --s-9: 96px;

  --r-sm: 6px;  --r-md: 10px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(16, 21, 38, .06);
  --sh-2: 0 4px 16px rgba(16, 21, 38, .08);
  --sh-3: 0 18px 48px rgba(16, 21, 38, .16);

  --f-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, monospace;

  --t-xs:   11.5px; --t-sm:  12.5px; --t-base: 14px;  --t-md:  15px;
  --t-lg:   18px;   --t-xl:  22px;   --t-2xl:  28px;  --t-3xl: 40px;
  --t-hero: clamp(32px, 5.2vw, 56px);

  --lh-tight: 1.2;  --lh-snug: 1.4;  --lh-body: 1.6;
  --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;

  --m-fast: 120ms;  --m-base: 200ms;  --m-slow: 380ms;
  --m-ease:     cubic-bezier(.4, 0, .2, 1);
  --m-ease-out: cubic-bezier(.16, 1, .3, 1);

  --w-content: 1080px; --w-narrow: 560px; --w-sheet: 800px;
  --w-site:    1140px; --nav-w:    228px;
}

/* One guard for the whole system. Everything below may animate freely; this
   turns all of it off for anyone who has asked their OS for less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ─── reset & base ────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--f-sans);
  font-size: var(--t-base);
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: var(--fw-semibold); }
h1 { font-size: var(--t-xl);  margin: 0 0 var(--s-4); letter-spacing: -.01em; }
h2 { font-size: var(--t-md);  margin: var(--s-6) 0 var(--s-2); }
h3 { font-size: var(--t-base); margin: var(--s-4) 0 var(--s-2); }

a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, .mono { font-family: var(--f-mono); }

/* A single visible focus treatment, everywhere. Keyboard users get a ring;
   mouse users never see it. */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.muted     { color: var(--c-ink-muted); }
.small     { font-size: var(--t-sm); }
.nowrap    { white-space: nowrap; }
.inline-form { display: inline; }
.stack     { display: flex; flex-direction: column; gap: var(--s-3); }
.row       { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.spacer    { flex: 1; }
.text-right { text-align: right; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}


/* ─── console shell ───────────────────────────────────────────────────────── */

.app { display: flex; min-height: 100vh; }

.app-nav {
  width: var(--nav-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  padding: var(--s-4) 0 var(--s-5);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: var(--s-6) var(--s-6) var(--s-8);
  max-width: var(--w-content);
  min-width: 0;              /* lets wide tables scroll instead of stretching */
}

.nav-brand {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--c-brand); font-weight: var(--fw-semibold);
  padding: 0 var(--s-4) var(--s-3);
  margin-bottom: var(--s-2);
  border-bottom: 1px solid var(--c-line);
}
.nav-brand:hover { text-decoration: none; }
.nav-brand svg { flex-shrink: 0; }

.nav-org {
  padding: 0 var(--s-4) var(--s-3);
  font-size: var(--t-sm);
  color: var(--c-ink-muted);
  line-height: var(--lh-snug);
}
.nav-org strong { color: var(--c-ink); font-weight: var(--fw-semibold); }

.nav-item {
  display: block;
  padding: 7px var(--s-4);
  margin: 1px var(--s-2);
  border-radius: var(--r-sm);
  color: var(--c-ink-soft);
  font-size: var(--t-base);
  transition: background var(--m-fast) var(--m-ease), color var(--m-fast) var(--m-ease);
}
.nav-item:hover { background: var(--c-bg); color: var(--c-ink); text-decoration: none; }
.nav-item.is-active {
  background: var(--c-brand-soft);
  color: var(--c-brand);
  font-weight: var(--fw-medium);
}

.nav-footer { margin-top: auto; padding: var(--s-4) var(--s-4) 0; }
.nav-toggle { display: none; }


/* ─── managed-session banner ──────────────────────────────────────────────── */
/* Deliberately loud and deliberately sticky. A platform user writing into
   somebody else's ledger must never lose sight of whose ledger it is. */

.manage-banner {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  margin: calc(var(--s-6) * -1) calc(var(--s-6) * -1) var(--s-5);
  background: var(--c-warn-soft);
  border-bottom: 1px solid var(--c-warn);
  color: var(--c-warn);
  font-size: var(--t-base);
  animation: slide-down var(--m-base) var(--m-ease-out);
}
.manage-banner strong { color: var(--c-ink); }
.manage-banner__icon { font-size: var(--t-md); }
.manage-banner form { margin-left: auto; }

@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}


/* ─── cards & surfaces ────────────────────────────────────────────────────── */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--sh-1);
}
.card--dashed { border-style: dashed; border-color: var(--c-line-strong); }
.card--flush  { padding: 0; overflow: hidden; }

.card__head {
  display: flex; align-items: center; gap: var(--s-3);
  margin: 0 0 var(--s-3);
}
.card__head h2 { margin: 0; }

.stats { display: flex; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-4); }
.stats .card {
  flex: 1; min-width: 170px; margin-bottom: 0;
  transition: transform var(--m-base) var(--m-ease), box-shadow var(--m-base) var(--m-ease);
}
.stats .card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stats .n {
  font-size: var(--t-2xl); font-weight: var(--fw-bold);
  letter-spacing: -.02em; line-height: 1.1;
}


/* ─── tables ──────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th, td {
  text-align: left; padding: var(--s-2);
  border-bottom: 1px solid var(--c-line);
  vertical-align: top;
}
th {
  color: var(--c-ink-muted); font-weight: var(--fw-medium);
  font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .04em;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--m-fast) var(--m-ease); }
tbody tr:hover { background: var(--c-surface-2); }

td.amount, th.amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.empty {
  padding: var(--s-6) var(--s-4);
  text-align: center; color: var(--c-ink-muted);
}


/* ─── status pills ────────────────────────────────────────────────────────── */
/* Every status any model can emit, mapped to five tones. The neutral set is
   declared rather than left to the default so it cannot silently drift. */

.pill {
  display: inline-block; font-size: var(--t-xs); font-weight: var(--fw-medium);
  padding: 2px var(--s-2); border-radius: var(--r-pill);
  background: var(--c-neutral-soft); color: var(--c-neutral);
  white-space: nowrap;
}

.pill.paid, .pill.active, .pill.delivered, .pill.complete, .pill.completed,
.pill.success {
  background: var(--c-ok-soft); color: var(--c-ok);
}
.pill.issued, .pill.submitted, .pill.processing, .pill.trialing, .pill.sent {
  background: var(--c-info-soft); color: var(--c-info);
}
.pill.part_paid, .pill.pending, .pill.pending_signature, .pill.suspended,
.pill.queued {
  background: var(--c-warn-soft); color: var(--c-warn);
}
.pill.overdue, .pill.failed, .pill.exhausted, .pill.revoked, .pill.past_due,
.pill.disputed {
  background: var(--c-bad-soft); color: var(--c-bad);
}
.pill.draft, .pill.written_off, .pill.closed, .pill.disabled, .pill.cancelled,
.pill.expired, .pill.archived {
  background: var(--c-neutral-soft); color: var(--c-neutral);
}


/* ─── forms ───────────────────────────────────────────────────────────────── */
/* Element selectors on purpose: every console form renders through
   {{ form.as_p }}, which emits <p><label></label><input></p> with no classes.
   Styling the elements is what lets 12 templates stay untouched. */

form p { margin: 0 0 var(--s-3); }

form label {
  display: block; font-size: 13px; font-weight: var(--fw-medium);
  color: var(--c-ink-soft); margin-bottom: var(--s-1);
}

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; max-width: 420px;
  padding: var(--s-2) 10px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  font-size: var(--t-base); font-family: inherit;
  color: var(--c-ink); background: var(--c-surface);
  transition: border-color var(--m-fast) var(--m-ease), box-shadow var(--m-fast) var(--m-ease);
}
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--c-ink-muted);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px var(--c-brand-soft);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--c-bg-sunk); color: var(--c-ink-muted); cursor: not-allowed;
}
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--c-brand); }
textarea { min-height: 62px; resize: vertical; }

.input--inline { width: 90px !important; }

/* Inputs inside a flex row size to content, not to the 420px form default. */
.row > input, .row > select { width: auto; }

.errorlist {
  color: var(--c-bad); font-size: 13px;
  margin: var(--s-1) 0 0; padding-left: 0; list-style: none;
}
.helptext { display: block; color: var(--c-ink-muted); font-size: var(--t-sm); margin-top: var(--s-1); }

.form-actions { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-4); }

/* Password field + eye toggle. The wrapper is injected by alviyora.js, so this
   works on Django-rendered PasswordInput widgets with no template changes. */
.field-password { position: relative; display: inline-block; width: 100%; max-width: 420px; }
.field-password input { width: 100%; padding-right: 42px; }
.eye {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 38px;
  display: grid; place-items: center;
  background: none; border: none; cursor: pointer;
  color: var(--c-ink-muted); border-radius: var(--r-sm);
  transition: color var(--m-fast) var(--m-ease);
}
.eye:hover { color: var(--c-ink); }
.eye svg { width: 18px; height: 18px; }


/* ─── buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  font-size: var(--t-base); font-family: inherit; font-weight: var(--fw-medium);
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--c-brand); color: var(--c-brand-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--m-fast) var(--m-ease),
              transform var(--m-fast) var(--m-ease),
              box-shadow var(--m-fast) var(--m-ease);
}
.btn:hover { background: var(--c-brand-hover); text-decoration: none; box-shadow: var(--sh-1); }
.btn:active { background: var(--c-brand-active); transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.small { padding: 3px 10px; font-size: var(--t-sm); }
.btn.large { padding: var(--s-3) var(--s-5); font-size: var(--t-md); }
.btn.block { width: 100%; }

.btn.danger { background: var(--c-bad); }
.btn.danger:hover { background: var(--c-bad); filter: brightness(.9); }

.btn.ghost {
  background: var(--c-surface); color: var(--c-brand); border-color: var(--c-brand-line);
}
.btn.ghost:hover { background: var(--c-brand-soft); }

.btn.secondary {
  background: var(--c-surface); color: var(--c-bad); border-color: var(--c-bad);
}
.btn.secondary:hover { background: var(--c-bad-soft); }


/* ─── messages, toasts, secrets ───────────────────────────────────────────── */
/* The server always renders .messages. alviyora.js lifts each <li> into the
   toast region; with JS off the list simply stays where it is and reads fine. */

.messages { list-style: none; padding: 0; margin: 0 0 var(--s-4); }
.messages li {
  padding: 10px var(--s-3); border-radius: var(--r-sm);
  margin-bottom: var(--s-2); font-size: var(--t-base);
  background: var(--c-neutral-soft); color: var(--c-neutral);
}
.messages li.success { background: var(--c-ok-soft);   color: var(--c-ok); }
.messages li.error   { background: var(--c-bad-soft);  color: var(--c-bad); }
.messages li.warning { background: var(--c-warn-soft); color: var(--c-warn); }
.messages li.info    { background: var(--c-info-soft); color: var(--c-info); }

/* Public pages have no .app-main to sit inside, so the no-JS message list
   needs its own gutter. */
.messages-wrap { max-width: var(--w-site); margin: 0 auto; padding: var(--s-4) var(--s-5) 0; }

.toast-region {
  position: fixed; z-index: 90; right: var(--s-5); bottom: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-2);
  width: min(380px, calc(100vw - var(--s-6)));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface); color: var(--c-ink);
  border: 1px solid var(--c-line); border-left: 3px solid var(--c-neutral);
  border-radius: var(--r-md); box-shadow: var(--sh-2);
  font-size: var(--t-base); pointer-events: auto;
  animation: toast-in var(--m-slow) var(--m-ease-out);
}
.toast.success { border-left-color: var(--c-ok); }
.toast.error   { border-left-color: var(--c-bad); }
.toast.warning { border-left-color: var(--c-warn); }
.toast.info    { border-left-color: var(--c-info); }
.toast.is-leaving { animation: toast-out var(--m-base) var(--m-ease) forwards; }
.toast__body  { flex: 1; }
.toast__close {
  background: none; border: none; cursor: pointer; padding: 0 var(--s-1);
  color: var(--c-ink-muted); font-size: var(--t-lg); line-height: 1;
}
.toast__close:hover { color: var(--c-ink); }

@keyframes toast-in  { from { opacity: 0; transform: translateY(12px) scale(.98); }
                       to   { opacity: 1; transform: none; } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(16px); } }

.secret-banner {
  background: var(--c-warn-soft); border: 1px solid var(--c-warn);
  border-radius: var(--r-md); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4);
}
.secret-banner code {
  display: block; margin-top: var(--s-2); padding: 10px;
  background: var(--c-code-bg); color: var(--c-code-ink);
  border-radius: var(--r-sm); font-size: 13px; word-break: break-all;
}


/* ─── modal ───────────────────────────────────────────────────────────────── */

dialog.modal {
  border: none; border-radius: var(--r-lg); padding: var(--s-5);
  width: min(420px, calc(100vw - var(--s-6)));
  background: var(--c-surface); color: var(--c-ink);
  box-shadow: var(--sh-3);
  animation: modal-in var(--m-base) var(--m-ease-out);
}
dialog.modal::backdrop { background: var(--c-overlay); animation: fade-in var(--m-base) var(--m-ease); }
.modal__title { margin: 0 0 var(--s-2); font-size: var(--t-lg); }
.modal__body  { margin: 0 0 var(--s-5); color: var(--c-ink-soft); }
.modal__actions { display: flex; justify-content: flex-end; gap: var(--s-2); }

@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); }
                      to   { opacity: 1; transform: none; } }
@keyframes fade-in  { from { opacity: 0; } to { opacity: 1; } }


/* ─── tooltip ─────────────────────────────────────────────────────────────── */

.tip {
  position: fixed; z-index: 95;
  max-width: 260px; padding: var(--s-2) var(--s-3);
  background: var(--c-ink); color: var(--c-surface);
  border-radius: var(--r-sm); font-size: var(--t-sm); line-height: var(--lh-snug);
  box-shadow: var(--sh-2); pointer-events: none;
  animation: fade-in var(--m-fast) var(--m-ease);
}
[data-hint] { border-bottom: 1px dotted var(--c-line-strong); cursor: help; }


/* ─── public shell (homepage + auth) ──────────────────────────────────────── */

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--c-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.site-header__inner {
  max-width: var(--w-site); margin: 0 auto;
  padding: var(--s-3) var(--s-5);
  display: flex; align-items: center; gap: var(--s-4);
}
.site-brand {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--c-brand); font-weight: var(--fw-semibold); font-size: var(--t-md);
}
.site-brand:hover { text-decoration: none; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--s-4); }
.site-nav a:not(.btn) { color: var(--c-ink-soft); font-size: var(--t-base); }

.site-footer {
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
  padding: var(--s-7) var(--s-5) var(--s-6);
  margin-top: var(--s-9);
}
.site-footer__inner {
  max-width: var(--w-site); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: var(--s-6); justify-content: space-between;
  color: var(--c-ink-muted); font-size: var(--t-base);
}

.auth-wrap {
  min-height: calc(100vh - 120px);
  display: grid; place-items: center;
  padding: var(--s-6) var(--s-4);
}
.auth-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: var(--s-6);
  width: 100%; max-width: 400px;
  animation: rise var(--m-slow) var(--m-ease-out);
}
.auth-card h1 { font-size: var(--t-lg); margin-bottom: var(--s-1); }
.auth-card .btn { width: 100%; margin-top: var(--s-4); }
.auth-card input { max-width: none; }
.auth-card .field-password { max-width: none; }
.auth-foot { margin: var(--s-4) 0 0; text-align: center; font-size: var(--t-base); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }


/* ─── marketing homepage ──────────────────────────────────────────────────── */

.section { max-width: var(--w-site); margin: 0 auto; padding: var(--s-9) var(--s-5); }
.section--tight { padding-top: var(--s-7); padding-bottom: var(--s-7); }
.section__head { max-width: 640px; margin-bottom: var(--s-6); }
.section__head h2 { font-size: var(--t-2xl); margin: 0 0 var(--s-3); letter-spacing: -.02em; }
.section__head p  { color: var(--c-ink-muted); font-size: var(--t-md); margin: 0; }

.eyebrow {
  display: inline-block; font-size: var(--t-sm); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-brand); margin-bottom: var(--s-3);
}

.hero {
  max-width: var(--w-site); margin: 0 auto;
  padding: var(--s-8) var(--s-5) var(--s-9);
  display: grid; grid-template-columns: 1.05fr .95fr; gap: var(--s-7); align-items: center;
}
.hero h1 {
  font-size: var(--t-hero); line-height: 1.05; letter-spacing: -.03em;
  margin: 0 0 var(--s-4);
}
.hero p.lede { font-size: var(--t-md); color: var(--c-ink-muted); margin: 0 0 var(--s-5); max-width: 46ch; }
.cta-row { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }

.hero-visual {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-xl); box-shadow: var(--sh-3);
  padding: var(--s-5); overflow: hidden;
}
.hero-visual svg { width: 100%; height: auto; display: block; }

.proof {
  display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-6);
  justify-content: center;
  padding: var(--s-5) var(--s-5);
  border-block: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-ink-muted); font-size: var(--t-base);
}
.proof span { display: flex; align-items: center; gap: var(--s-2); }

.feature-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
}
.feature {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-lg); padding: var(--s-5);
  transition: transform var(--m-base) var(--m-ease), box-shadow var(--m-base) var(--m-ease),
              border-color var(--m-base) var(--m-ease);
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--c-brand-line); }
.feature h3 { margin: 0 0 var(--s-2); font-size: var(--t-md); }
.feature p  { margin: 0; color: var(--c-ink-muted); }
.feature__icon {
  width: 40px; height: 40px; border-radius: var(--r-md);
  background: var(--c-brand-soft); color: var(--c-brand);
  display: grid; place-items: center; margin-bottom: var(--s-3);
}

.steps { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); counter-reset: step; }
.step { position: relative; padding-top: var(--s-5); }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 0; left: 0;
  width: 30px; height: 30px; border-radius: var(--r-pill);
  background: var(--c-brand); color: var(--c-brand-ink);
  display: grid; place-items: center; font-size: var(--t-sm); font-weight: var(--fw-bold);
}
.step h3 { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-md); }
.step p  { margin: 0; color: var(--c-ink-muted); }

.security {
  background: var(--c-ink); color: var(--c-surface);
  border-radius: var(--r-xl); padding: var(--s-7) var(--s-6);
}
.security h2 { color: var(--c-surface); }
.security .section__head p { color: var(--c-line-strong); }
.security-grid { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.security-grid h3 { margin: 0 0 var(--s-2); font-size: var(--t-base); color: var(--c-surface); }
.security-grid p  { margin: 0; color: var(--c-line-strong); font-size: var(--t-base); }

.faq { max-width: 720px; }
.faq details {
  border-bottom: 1px solid var(--c-line);
  padding: var(--s-4) 0;
}
.faq summary {
  cursor: pointer; font-weight: var(--fw-medium); font-size: var(--t-md);
  list-style: none; display: flex; align-items: center; gap: var(--s-3);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; margin-left: auto; color: var(--c-brand);
  font-size: var(--t-xl); line-height: 1;
  transition: transform var(--m-base) var(--m-ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: var(--s-3) 0 0; color: var(--c-ink-muted); }

/* Scroll reveal. The hidden state is added by JS, so with JS off — or with
   reduced motion — the content is simply visible from the start. */
.js [data-reveal].is-hidden { opacity: 0; transform: translateY(20px); }
[data-reveal] { transition: opacity var(--m-slow) var(--m-ease-out), transform var(--m-slow) var(--m-ease-out); }


/* ─── payer-facing pages ──────────────────────────────────────────────────── */

.pay-body { background: var(--c-bg); }
.pay-header {
  background: var(--c-surface); border-bottom: 1px solid var(--c-line);
  padding: var(--s-3) var(--s-5);
}
.pay-header .brand { color: var(--c-brand); font-weight: var(--fw-semibold); font-size: var(--t-md); }
.pay-main { max-width: var(--w-narrow); margin: var(--s-6) auto; padding: 0 var(--s-4); }
.pay-main .card { padding: var(--s-5); border-radius: var(--r-lg); box-shadow: var(--sh-2); }
.pay-main .btn { width: 100%; padding: var(--s-3) var(--s-4); font-size: 16px; border-radius: var(--r-sm); }
.pay-footer { text-align: center; color: var(--c-ink-muted); font-size: var(--t-sm); padding: var(--s-5); }

.total-row td { font-weight: var(--fw-semibold); border-top: 2px solid var(--c-line); }
.due { font-size: var(--t-2xl); font-weight: var(--fw-bold); letter-spacing: -.02em; }
.ok  { color: var(--c-ok); }
.bad { color: var(--c-bad); }


/* ─── hosted invoice document ─────────────────────────────────────────────── */

.doc-toolbar {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--c-surface); border-bottom: 1px solid var(--c-line);
  padding: var(--s-3) var(--s-5);
}
.doc-toolbar .brandmark { color: var(--c-brand); font-weight: var(--fw-semibold); }

.sheet {
  max-width: var(--w-sheet); margin: var(--s-6) auto;
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--r-md); box-shadow: var(--sh-2);
  padding: 44px 48px;
}
.doc-head { display: flex; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; }
.doc-head .merchant { font-size: var(--t-xl); font-weight: var(--fw-bold); }
.doc-title { text-align: right; }
.doc-title h1 {
  font-size: var(--t-2xl); margin: 0 0 2px;
  color: var(--c-brand); letter-spacing: .04em;
}
.doc-status { margin-top: var(--s-1); }
.sheet .muted { font-size: 13px; }
.sheet table { margin: 22px 0 0; font-size: var(--t-base); }
.sheet th { border-bottom: 2px solid var(--c-line); }
.parties { display: flex; gap: 40px; flex-wrap: wrap; margin: var(--s-6) 0 var(--s-2); }
.parties h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-ink-muted); margin: 0 0 var(--s-1); font-weight: var(--fw-semibold);
}
.doc-sheet-note { margin-top: var(--s-5); }
.totals { margin-left: auto; width: 300px; margin-top: var(--s-4); }
.totals > div { display: flex; justify-content: space-between; padding: var(--s-1) 0; }
.totals .grand {
  border-top: 2px solid var(--c-line); padding-top: var(--s-2);
  font-weight: var(--fw-bold); font-size: 16px;
}
.totals .due { color: var(--c-brand); font-weight: var(--fw-bold); font-size: var(--t-lg); }
.paybox {
  background: var(--c-brand-soft); border: 1px solid var(--c-brand-line);
  border-radius: var(--r-md); padding: var(--s-4); margin-top: var(--s-5);
}
.paybox code {
  background: var(--c-surface); border: 1px solid var(--c-brand-line);
  border-radius: var(--r-sm); padding: 2px var(--s-2);
}
.doc-footer { text-align: center; color: var(--c-ink-muted); font-size: var(--t-sm); padding: var(--s-5); }

@media print {
  body { background: var(--c-surface); }
  .no-print, .doc-toolbar, .doc-footer { display: none !important; }
  .sheet { margin: 0; max-width: none; border: none; box-shadow: none; border-radius: 0; padding: 0; }
}


/* ─── responsive ──────────────────────────────────────────────────────────── */
/* Below 900px the sidebar becomes a drawer. Tables are handled by scrolling
   the card rather than restructuring 12 templates' markup. */

@media (max-width: 900px) {
  .app { flex-direction: column; }

  .app-nav {
    width: 100%; border-right: none; border-bottom: 1px solid var(--c-line);
    padding: var(--s-2) 0;
  }
  .nav-brand { border-bottom: none; margin: 0; padding: var(--s-2) var(--s-4); }
  .nav-toggle {
    display: grid; place-items: center;
    position: absolute; top: var(--s-2); right: var(--s-3);
    width: 40px; height: 40px;
    background: none; border: 1px solid var(--c-line); border-radius: var(--r-sm);
    cursor: pointer; color: var(--c-ink);
  }
  .app-nav { position: relative; }

  /* Collapse only when JS is present to reopen it. */
  .js .app-nav .nav-item,
  .js .app-nav .nav-org,
  .js .app-nav .nav-footer { display: none; }
  .js .app-nav.is-open .nav-item,
  .js .app-nav.is-open .nav-org,
  .js .app-nav.is-open .nav-footer { display: block; }

  .app-main { padding: var(--s-4); }
  .manage-banner { margin: calc(var(--s-4) * -1) calc(var(--s-4) * -1) var(--s-4); }

  .card { overflow-x: auto; }
  .stats .card { overflow: visible; }

  .hero { grid-template-columns: 1fr; padding-top: var(--s-6); gap: var(--s-6); }
  .section { padding: var(--s-7) var(--s-4); }
  .sheet { padding: var(--s-5); margin: var(--s-4); }
  .toast-region { right: var(--s-3); left: var(--s-3); bottom: var(--s-3); width: auto; }
}

@media (max-width: 560px) {
  .site-nav { gap: var(--s-3); }
  .doc-head { flex-direction: column; }
  .doc-title { text-align: left; }
  .totals { width: 100%; }
}
