/* ============================================================
   Studio Practice — Invoice & Pay Prototype
   Extends prototype-v2 tokens. Single shared sheet for all
   four surfaces: composer, pay-lookup, pay-detail, dashboard.
   ============================================================ */

:root {
  color-scheme: dark;

  /* Surface */
  --bg:           oklch(15% 0.008 80);
  --bg-raised:    oklch(19% 0.006 80);
  --bg-warm:      oklch(22% 0.009 80);
  --bg-deep:      oklch(11% 0.008 80);

  /* Ink */
  --ink:          oklch(96% 0.003 80);
  --ink-2:        oklch(82% 0.004 80);
  --muted:        oklch(62% 0.006 80);
  --subtle:       oklch(42% 0.005 80);

  /* Lines */
  --line:         oklch(28% 0.005 80);
  --line-soft:    oklch(22% 0.005 80);

  /* Accent */
  --accent:       oklch(72% 0.12 248);
  --accent-soft:  oklch(82% 0.08 248);
  --accent-tint:  oklch(24% 0.05 248);

  /* Status — dim text on dim tinted bg */
  --status-open:    oklch(78% 0.12 60);
  --status-open-bg: oklch(24% 0.04 60);
  --status-paid:    oklch(78% 0.13 155);
  --status-paid-bg: oklch(22% 0.04 155);
  --status-due:     oklch(74% 0.15 25);
  --status-due-bg:  oklch(24% 0.05 25);
  --status-draft:   oklch(70% 0.005 80);
  --status-draft-bg:oklch(22% 0.003 80);

  /* Layout */
  --inner:        1180px;
  --pad-x:        clamp(20px, 4vw, 56px);
  --bar-h:        56px;

  /* Motion */
  --ease:         cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast:       180ms;
  --t-base:       360ms;

  /* Type */
  --serif:        "Fraunces", "Times New Roman", serif;
  --sans:         "DM Sans", -apple-system, system-ui, sans-serif;
  --mono:         "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  min-height: 100dvh;
}
body::before {
  content: "";
  position: fixed;
  inset: -10% -5%;
  background:
    radial-gradient(60% 70% at 80% 8%,
      color-mix(in oklch, var(--accent) 14%, transparent) 0%,
      transparent 60%),
    radial-gradient(50% 60% at 6% 92%,
      color-mix(in oklch, var(--accent-soft) 8%, transparent) 0%,
      transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }
::selection { background: var(--accent); color: #fff; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 350;
  margin: 0;
  letter-spacing: -0.018em;
  line-height: 1.04;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  text-wrap: balance;
}
p { text-wrap: pretty; margin: 0; }

.inner {
  max-width: var(--inner);
  margin: 0 auto;
  padding-inline: var(--pad-x);
}

/* ============================================================
   Admin shell — top bar with brand + log out
   ============================================================ */
.adm-bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--pad-x);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.adm-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.adm-brand img {
  width: 26px;
  height: 26px;
  filter: invert(1) brightness(2);
}
.adm-brand-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 12px;
  margin-left: 10px;
  border-left: 1px solid var(--line);
}
.adm-actions {
  display: flex; align-items: center; gap: 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.adm-actions a { transition: color var(--t-fast); }
.adm-actions a:hover { color: var(--ink); }

/* Hamburger toggle — visible on mobile only */
.adm-toggle {
  display: none;
  width: 44px; height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 11;
}
.adm-toggle span {
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 280ms var(--ease-out), opacity 200ms var(--ease-out);
}
.adm-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
.adm-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.adm-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ============================================================
   Pay shell — public-facing, lighter nav
   ============================================================ */
.pay-bar {
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--pad-x);
  background: transparent;
}
.pay-bar .adm-brand { color: var(--ink); }
.pay-bar-links {
  display: flex; gap: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.pay-bar-links a { transition: color var(--t-fast); }
.pay-bar-links a:hover { color: var(--ink); }

/* ============================================================
   Page header
   ============================================================ */
.page-head {
  padding-block: clamp(48px, 7vw, 88px) clamp(28px, 4vw, 48px);
}
.page-head h1 {
  font-size: clamp(40px, 5.4vw, 64px);
  line-height: 1.02;
}
.page-head h1 em { font-style: italic; color: var(--muted); font-weight: 400; }
.page-head-sub {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  max-width: 560px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   Section heading rule
   ============================================================ */
.sec {
  margin-top: 40px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.sec-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.sec-aside {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}

/* ============================================================
   Composer — form
   ============================================================ */
.composer-card {
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  padding: clamp(28px, 4vw, 48px);
  box-shadow: 0 1px 0 oklch(28% 0.005 80 / 0.5) inset;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  margin-top: 18px;
}
.field-grid-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-input,
.field-select,
.field-textarea {
  font: inherit;
  font-size: 15px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  border-radius: 10px;
  color: var(--ink);
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 12%, transparent);
}
.field-textarea { resize: vertical; min-height: 100px; }
.field-mono { font-family: var(--mono); font-size: 14px; letter-spacing: 0.02em; }

.field-input-prefix {
  position: relative;
}
.field-input-prefix input {
  padding-left: 44px;
}
.field-input-prefix::before {
  content: "SP-";
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.05em;
  color: var(--muted);
  pointer-events: none;
}

.field-input-money {
  position: relative;
}
.field-input-money input {
  padding-left: 28px;
  font-family: var(--mono);
  text-align: right;
}
.field-input-money::before {
  content: "$";
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* Line items */
.lines-head {
  display: grid;
  grid-template-columns: 1fr 140px 36px;
  gap: 12px;
  margin-top: 20px;
  padding-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
  border-bottom: 1px dashed var(--line);
}
.lines-head span:nth-child(2) { text-align: right; }

.line-row {
  display: grid;
  grid-template-columns: 1fr 140px 36px;
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}
.line-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.line-row-remove {
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-inline: auto;
  margin-top: 11px;
}
.line-row-remove:hover { background: var(--line-soft); color: var(--ink); }
.line-row.is-removing {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.line-row.is-entering {
  animation: rowIn 360ms var(--ease-out) both;
}
@keyframes rowIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.form-error {
  margin-top: 18px;
  padding: 12px 16px;
  background: color-mix(in oklch, var(--status-due) 14%, var(--bg-raised));
  border: 1px solid color-mix(in oklch, var(--status-due) 36%, transparent);
  border-radius: 10px;
  color: var(--status-due);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
}
.field-error {
  outline: 1px solid var(--status-due);
  outline-offset: 0;
}

/* ============================================================
   Pay-detail lifecycle state banner (paid / overdue / void)
   ============================================================ */
.state-banner {
  margin-top: 18px;
  margin-bottom: 28px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 12px;
  border: 1px solid currentColor;
  font-size: 14px;
}
.state-banner-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 100px;
  white-space: nowrap;
}
.state-banner-body { color: var(--ink-2); }
.state-banner.is-paid {
  color: var(--status-paid);
  background: color-mix(in oklch, var(--status-paid) 10%, var(--bg-raised));
}
.state-banner.is-overdue {
  color: var(--status-due);
  background: color-mix(in oklch, var(--status-due) 10%, var(--bg-raised));
}
.state-banner.is-void {
  color: var(--muted);
  background: var(--bg-warm);
}

/* ============================================================
   Walkthrough hint on the prototype landing
   ============================================================ */
.walkthrough-row {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 860px) {
  .walkthrough-row { grid-template-columns: 1fr; }
}
.walkthrough {
  padding: 28px 32px;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
}
.walkthrough-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.walkthrough-steps {
  margin: 16px 0 0;
  padding-left: 24px;
  list-style: decimal;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.7;
}
.walkthrough-steps li::marker {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.walkthrough-steps strong {
  color: var(--ink);
  font-weight: 500;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* ============================================================
   Email preview — inbox-style mock of the invoice send
   ============================================================ */
.email-stage {
  max-width: var(--inner);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 80px) var(--pad-x);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: start;
}
.email-window {
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px -32px color-mix(in oklch, var(--accent) 40%, transparent);
}
.email-header {
  padding: 18px 24px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line-soft);
}
.email-header-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 14px;
  align-items: baseline;
  padding-block: 4px;
}
.email-header-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.email-header-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  word-break: break-word;
}
.email-header-meta .email-header-value { color: var(--muted); font-size: 12px; }

.email-body {
  padding: 44px clamp(28px, 5vw, 56px) 48px;
  background: var(--bg-raised);
  color: var(--ink-2);
}
.email-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 30px;
}
.email-brand img {
  width: 28px; height: 28px;
  filter: invert(1) brightness(2);
}
.email-brand-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.email-id-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}
.email-id {
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 48px);
  font-weight: 350;
  letter-spacing: -0.018em;
  color: var(--ink);
}
.email-id-meta {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.email-copy p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
}
.email-copy a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.email-copy strong {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.email-cta-wrap {
  margin: 36px 0 36px;
  display: flex;
  justify-content: center;
}
.email-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 36px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 280ms var(--ease-out),
              background 360ms var(--ease-out),
              transform 360ms var(--ease-out),
              letter-spacing 360ms var(--ease-out),
              box-shadow 360ms var(--ease-out);
}
.email-cta:hover {
  color: var(--ink);
  background: transparent;
  transform: translateY(-1px);
  letter-spacing: 0.22em;
  box-shadow: 0 14px 28px -14px color-mix(in oklch, var(--accent) 50%, transparent);
}

.email-sig p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
}
.email-foot {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
}

.email-aside {
  padding: 24px 26px;
  background: var(--bg-warm);
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  position: sticky;
  top: 80px;
}
.email-aside-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}
.email-aside p {
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.email-aside strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  font-weight: 500;
}

@media (max-width: 860px) {
  .email-stage { grid-template-columns: 1fr; }
  .email-aside { position: static; }
}

/* ============================================================
   Payee walkthrough demo banner (used on email-preview)
   ============================================================ */
.email-demo-banner {
  background: var(--bg-deep);
  color: var(--ink);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border-bottom: 1px solid var(--accent);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}
.email-demo-banner-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}
.email-demo-banner-label::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: emailPulse 2.4s ease-in-out infinite;
}
@keyframes emailPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.25); }
}
.email-demo-banner-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-2);
}
.email-demo-banner-text strong {
  color: var(--ink);
  font-weight: 500;
}
@media (max-width: 760px) {
  .email-demo-banner { padding: 14px 18px; gap: 10px; flex-wrap: wrap; }
  .email-demo-banner-text { font-size: 12px; }
}

/* ============================================================
   Receipt email — table + metadata block
   ============================================================ */
.email-id-em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}
.email-receipt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0 28px;
  font-size: 14.5px;
}
.email-receipt-table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
}
.email-receipt-table td.amount {
  text-align: right;
  font-family: var(--mono);
  color: var(--ink);
  white-space: nowrap;
}
.email-receipt-table .totals-row td {
  border-bottom: none;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.email-receipt-table .totals-row td.amount {
  letter-spacing: 0;
  text-transform: none;
  font-size: 20px;
}

.receipt-meta {
  margin: 0 0 32px;
  padding: 18px 20px;
  background: var(--bg-warm);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.receipt-meta-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: baseline;
}
.receipt-meta dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.receipt-meta dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* Shared payee toast (used on both home-snapshot inline and email-preview) */
.pp-toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-deep);
  color: var(--ink);
  padding: 14px 24px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-out), transform 360ms var(--ease-out);
  z-index: 199;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.pp-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.line-add {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 10px 0;
  transition: gap var(--t-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.line-add:hover { gap: 12px; }

.lines-total {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 24px;
}
.lines-total-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.lines-total-value {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.preset-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}
.preset-select {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--bg-raised);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.preset-select:hover { border-color: var(--ink); color: var(--ink); }

/* Composer footer bar */
.composer-footer {
  position: sticky;
  bottom: 0;
  margin-top: 40px;
  padding: 18px 0;
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line-soft);
}
.composer-footer-inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

/* ============================================================
   Pill CTA — mono uppercase, invert on hover
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 280ms var(--ease-out),
              background 360ms var(--ease-out),
              border-color 280ms var(--ease-out),
              transform 360ms var(--ease-out),
              box-shadow 360ms var(--ease-out),
              letter-spacing 360ms var(--ease-out);
}
.pill:hover {
  color: var(--ink);
  background: transparent;
  transform: translateY(-1px);
  letter-spacing: 0.22em;
  box-shadow: 0 14px 28px -14px color-mix(in oklch, var(--ink) 45%, transparent);
}
.pill:active { transform: translateY(0); }

.pill-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.pill-ghost:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.pill-wide { padding-inline: 44px; }

/* ============================================================
   Pay — lookup state
   ============================================================ */
.pay-stage {
  min-height: calc(100dvh - var(--bar-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px var(--pad-x) 96px;
}
.pay-lookup {
  width: 100%;
  max-width: 440px;
  text-align: center;
}
.pay-lookup h1 {
  font-size: clamp(48px, 7vw, 76px);
}
.pay-lookup-sub {
  margin-top: 16px;
  color: var(--muted);
  font-size: 16px;
}
.pay-lookup-form {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}
.pay-lookup-footnote {
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}
.pay-lookup-footnote a { color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.pay-lookup-footnote a:hover { color: var(--ink); border-color: var(--ink); }
.pay-lookup .pill { align-self: stretch; margin-top: 10px; }

/* ============================================================
   Pay — detail state
   ============================================================ */
.pay-detail {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px var(--pad-x) 96px;
}
.pay-detail h1 {
  font-size: clamp(40px, 5.2vw, 60px);
  margin-bottom: 18px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--bg-warm);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
}
.chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.bill-block {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 15px;
  color: var(--ink-2);
}
.bill-block .bill-name { color: var(--ink); font-weight: 500; }

.line-table {
  margin-top: 18px;
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.line-table td {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.line-table td.amount {
  text-align: right;
  font-family: var(--mono);
  white-space: nowrap;
  color: var(--ink);
}
.line-table .totals-row td {
  border-bottom: none;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.line-table .totals-row td.amount {
  letter-spacing: 0;
  text-transform: none;
  font-size: 15px;
  color: var(--ink);
}
.line-table .grand-row td {
  border-top: none;
  padding-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.line-table .grand-row td.amount {
  letter-spacing: 0;
  text-transform: none;
  font-size: 22px;
}

.note-card {
  margin-top: 32px;
  padding: 22px 24px;
  background: var(--bg-warm);
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
}
.note-card-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.pay-cta-row {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.pay-cta-row .pill { min-width: 280px; }
.pay-cta-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
}

/* Payment drawer — collapsed by default */
.drawer {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-raised);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 520ms var(--ease-out), opacity 360ms var(--ease-out);
}
.drawer.is-open {
  max-height: 720px;
  opacity: 1;
}
.drawer-inner { padding: 28px; }
.drawer-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
}
.drawer-tab {
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.drawer-tab.is-active {
  color: var(--bg);
  background: var(--ink);
  border-color: var(--ink);
}
.drawer-field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.drawer-field-row.duo {
  grid-template-columns: 1fr 1fr;
}
.drawer-field-row.trio {
  grid-template-columns: 1fr 96px 80px;
}
.drawer-pay-btn {
  margin-top: 22px;
  width: 100%;
}

/* ============================================================
   Dashboard
   ============================================================ */
.dash-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.dash-tabs {
  margin-top: 28px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.dash-tab {
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.dash-tab:hover { color: var(--ink); }
.dash-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.dash-tab-count {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--subtle);
  margin-left: 8px;
}
.dash-tab.is-active .dash-tab-count { color: var(--muted); }

.dash-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
}
.dash-row {
  display: grid;
  grid-template-columns: 120px 1fr 160px 140px;
  align-items: center;
  gap: 20px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t-fast);
  cursor: pointer;
}
.dash-row:hover { background: var(--bg-warm); }
.dash-row-id {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.dash-row-who {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dash-row-name { font-size: 15px; color: var(--ink); }
.dash-row-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.dash-row-meta .due-warn {
  color: var(--status-due);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-left: 8px;
}
.dash-row-amount {
  text-align: right;
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink);
}
.dash-row-status { display: flex; justify-content: flex-end; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.status-pill-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-open  { color: var(--status-open);   background: var(--status-open-bg); }
.status-paid  { color: var(--status-paid);   background: var(--status-paid-bg); }
.status-due   { color: var(--status-due);    background: var(--status-due-bg); }
.status-draft { color: var(--status-draft);  background: var(--status-draft-bg); }

/* ============================================================
   Picker (index)
   ============================================================ */
.picker {
  max-width: var(--inner);
  margin: 0 auto;
  padding: 80px var(--pad-x) 96px;
}
.picker-head h1 {
  font-size: clamp(48px, 6vw, 76px);
}
.picker-head p {
  margin-top: 18px;
  color: var(--muted);
  max-width: 520px;
  font-size: 16px;
}
.picker-grid {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* Two-column picker — Admin (Wilfredo) · Payee (Alma) user profiles */
.picker-cols {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  align-items: start;
}
.picker-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.picker-col-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}
.picker-col-sub {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin: -4px 0 8px;
}
.picker-col .picker-card {
  min-height: 0;
  padding: 24px 24px 22px;
}
.picker-col .picker-card h2 {
  font-size: 22px;
}
@media (max-width: 980px) {
  .picker-cols { grid-template-columns: 1fr; gap: 32px; }
}
.picker-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 36px 32px 32px;
  background: var(--bg-raised);
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  min-height: 220px;
  transition: transform var(--t-base) var(--ease),
              box-shadow var(--t-base) var(--ease),
              border-color var(--t-fast);
}
.picker-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px -28px color-mix(in oklch, var(--accent) 30%, transparent);
  border-color: var(--line);
}
.picker-card-num {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.picker-card h2 {
  font-size: 30px;
}
.picker-card-route {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.picker-card-desc {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.55;
  margin-top: auto;
}
.picker-card-arrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap var(--t-fast);
}
.picker-card:hover .picker-card-arrow { gap: 12px; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 720px) {
  .field-grid { grid-template-columns: 1fr; }
  .lines-head, .line-row {
    grid-template-columns: 1fr 110px 32px;
    gap: 8px;
  }
  .dash-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 18px 0;
  }
  .dash-row-id { font-size: 12px; }
  .dash-row-amount, .dash-row-status {
    text-align: left;
    justify-content: flex-start;
  }
  .picker-grid { grid-template-columns: 1fr; }
  .composer-footer-inner { justify-content: stretch; }
  .composer-footer .pill { flex: 1; }
  .adm-brand-tag { display: none; }
  .pay-bar-links { gap: 14px; }

  /* Admin bar collapses links behind hamburger */
  .adm-bar {
    height: auto;
    min-height: var(--bar-h);
    flex-wrap: wrap;
    padding-block: 12px;
  }
  .adm-brand {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
    flex: 1;
  }
  .adm-toggle { display: flex; }
  .adm-actions {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--line-soft);
    order: 3;
  }
  .adm-actions.is-open { display: flex; }
  .adm-actions a {
    padding: 14px 0;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line-soft);
  }
  .adm-actions a:last-child { border-bottom: none; }

  /* Page-head row drops the +New Invoice pill below the title */
  .dash-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
  .dash-head-row .pill { align-self: stretch; text-align: center; }

  /* Dashboard tabs scroll horizontally on narrow widths */
  .dash-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .dash-tabs::-webkit-scrollbar { display: none; }
  .dash-tab {
    padding: 14px 14px;
    flex-shrink: 0;
    font-size: 10.5px;
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   Focus rings
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ============================================================
   Utilities
   ============================================================ */
.optional {
  text-transform: none;
  letter-spacing: 0;
  color: var(--subtle);
  font-family: var(--sans);
  font-size: 11px;
}
.spacer-lg { height: 80px; }

/* ============================================================
   Toast — momentary action confirmation
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 14px 22px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-out), transform 360ms var(--ease-out);
  z-index: 80;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.6);
}
.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Overlay — full-screen confirmation card
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: color-mix(in oklch, var(--bg-deep) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 360ms var(--ease-out);
}
.overlay.is-on {
  opacity: 1;
  pointer-events: auto;
}
.overlay-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 48px 44px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  transform: translateY(12px) scale(0.98);
  transition: transform 420ms var(--ease-out);
}
.overlay.is-on .overlay-card {
  transform: translateY(0) scale(1);
}
.overlay-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: color-mix(in oklch, var(--status-paid) 18%, var(--bg-raised));
  border: 1px solid color-mix(in oklch, var(--status-paid) 36%, transparent);
  color: var(--status-paid);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 24px;
}
.overlay-card h2 {
  font-size: 36px;
  margin-bottom: 10px;
}
.overlay-card h2 em { font-style: italic; color: var(--muted); font-weight: 400; }
.overlay-card-id {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 18px 0 6px;
}
.overlay-card-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.overlay-card-desc {
  margin: 20px auto 32px;
  color: var(--ink-2);
  font-size: 15px;
  max-width: 340px;
  line-height: 1.55;
}
.overlay-card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.overlay-card-actions .pill { width: 100%; }

/* ============================================================
   Preview modal — renders the invoice as the client will see it
   ============================================================ */
.overlay-card-wide {
  max-width: 720px;
  padding: 0;
  text-align: left;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(86dvh, 880px);
}
.preview-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-deep);
}
.preview-modal-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.preview-modal-label-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.preview-modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.preview-modal-close:hover { background: var(--bg-warm); color: var(--ink); }

.preview-modal-body {
  padding: 36px 40px 40px;
  overflow-y: auto;
  flex: 1;
}
.preview-modal-body h2 {
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -0.018em;
  line-height: 1.04;
  margin-bottom: 14px;
}
.preview-modal-body h2 em { font-style: italic; color: var(--muted); font-weight: 400; }

.preview-modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg);
}
.preview-modal-foot-note {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
}

@media (max-width: 720px) {
  .preview-modal-body { padding: 24px 22px 28px; }
}

/* ============================================================
   Stat strip (dashboard top + reports headline row)
   ============================================================ */
.stat-strip {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  overflow: hidden;
}
.stat-card {
  background: var(--bg-raised);
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-card-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-card-value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.012em;
  color: var(--ink);
  line-height: 1.05;
}
.stat-card-value-mono {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: -0.01em;
}
.stat-card-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stat-card-meta-up { color: var(--status-paid); }
.stat-card-meta-down { color: var(--status-due); }
.stat-card-sub { color: var(--ink-2); font-size: 14px; }

@media (max-width: 860px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stat-strip { grid-template-columns: 1fr; }
}

/* ============================================================
   Range pills (time-range filter)
   ============================================================ */
.range-pills {
  margin-top: 24px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 100px;
}
.range-pill {
  padding: 9px 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: 100px;
  transition: color var(--t-fast), background var(--t-fast);
}
.range-pill:hover { color: var(--ink); }
.range-pill.is-active {
  background: var(--ink);
  color: var(--bg);
}

/* ============================================================
   Rank list — best-selling categories / top clients
   ============================================================ */
.rank-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rank-row {
  display: grid;
  grid-template-columns: 24px minmax(160px, 1fr) 110px 110px;
  align-items: center;
  gap: 18px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.rank-row:last-child { border-bottom: none; }
.rank-row-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--subtle);
}
.rank-row-name {
  font-size: 15px;
  color: var(--ink);
}
.rank-row-name-meta {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 3px;
}
.rank-bar-track {
  height: 6px;
  background: var(--bg-warm);
  border-radius: 100px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width var(--t-base) var(--ease-out);
}
.rank-row-amount {
  text-align: right;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
}

@media (max-width: 720px) {
  .rank-row {
    grid-template-columns: 22px 1fr 90px;
    gap: 12px;
  }
  .rank-bar-track { display: none; }
}

/* ============================================================
   Bar chart — revenue over time
   ============================================================ */
.chart-bars {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  align-items: end;
  min-height: 220px;
  padding: 8px 4px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.chart-col-bar {
  width: 100%;
  max-width: 56px;
  background: linear-gradient(
    180deg,
    color-mix(in oklch, var(--accent) 78%, transparent) 0%,
    color-mix(in oklch, var(--accent) 30%, transparent) 100%
  );
  border-radius: 6px 6px 0 0;
  transition: transform var(--t-base) var(--ease-out);
}
.chart-col:hover .chart-col-bar { transform: scaleY(1.03); }
.chart-col-value {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
}
.chart-col-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

/* ============================================================
   Two-column reports row
   ============================================================ */
.reports-row {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
@media (max-width: 860px) {
  .reports-row { grid-template-columns: 1fr; gap: 32px; }
}

/* ============================================================
   Category chip on composer line items (preset tag)
   ============================================================ */
.line-row-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, var(--bg-raised));
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  border-radius: 100px;
  align-self: flex-start;
}
.line-row-tag-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================================
   Bar widths & heights — utility classes for rank lists + chart
   (kept here so the markup stays free of inline style attributes)
   ============================================================ */
.bar-10  { width: 10%; }   .bar-h-10  { height: 10%; }
.bar-13  { width: 13%; }   .bar-h-13  { height: 13%; }
.bar-17  { width: 17%; }   .bar-h-17  { height: 17%; }
.bar-18  { width: 18%; }   .bar-h-18  { height: 18%; }
.bar-19  { width: 19%; }   .bar-h-22  { height: 22%; }
.bar-24  { width: 24%; }   .bar-h-32  { height: 32%; }
.bar-32  { width: 32%; }   .bar-h-38  { height: 38%; }
.bar-36  { width: 36%; }   .bar-h-45  { height: 45%; }
.bar-39  { width: 39%; }   .bar-h-52  { height: 52%; }
.bar-41  { width: 41%; }   .bar-h-58  { height: 58%; }
.bar-44  { width: 44%; }   .bar-h-65  { height: 65%; }
.bar-45  { width: 45%; }   .bar-h-68  { height: 68%; }
.bar-73  { width: 73%; }   .bar-h-72  { height: 72%; }
.bar-75  { width: 75%; }   .bar-h-78  { height: 78%; }
.bar-84  { width: 84%; }   .bar-h-85  { height: 85%; }
.bar-90  { width: 90%; }   .bar-h-92  { height: 92%; }
.bar-100 { width: 100%; }  .bar-h-100 { height: 100%; }

/* ============================================================
   Ledger table (line-item ledger on reports)
   ============================================================ */
.line-table.ledger {
  font-size: 14px;
}
.line-table.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--line);
}
.line-table.ledger th.amount { text-align: right; padding-right: 0; }
.line-table.ledger td {
  padding: 14px 14px 14px 0;
  vertical-align: top;
}
.line-table.ledger td.amount { padding-right: 0; }
.line-table.ledger tbody tr:hover td { background: var(--bg-warm); }
.ledger-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.ledger-id {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.ledger-cat {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.ledger-foot {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.reports-note {
  margin-top: 56px;
  padding: 20px 22px;
  background: var(--bg-warm);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 720px;
}
.reports-note code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-deep);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink-2);
}

@media (max-width: 720px) {
  /* Ledger: drop invoice ID + category columns on phone, leave date/client/desc/amount */
  .line-table.ledger {
    font-size: 12.5px;
  }
  .line-table.ledger th,
  .line-table.ledger td { padding: 12px 8px 12px 0; }
  .line-table.ledger th:nth-child(2),
  .line-table.ledger td:nth-child(2),
  .line-table.ledger th:nth-child(5),
  .line-table.ledger td:nth-child(5) { display: none; }
  .ledger-date { font-size: 11px; }

  /* Range pills — let them scroll horizontally instead of wrapping */
  .range-pills {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
    flex-wrap: nowrap;
  }
  .range-pills::-webkit-scrollbar { display: none; }
  .range-pill {
    flex-shrink: 0;
    padding: 8px 14px;
  }

  /* Chart bars — drop to 6 narrower columns, smaller labels */
  .chart-bars {
    gap: 6px;
    min-height: 180px;
  }
  .chart-col-bar { max-width: 36px; }
  .chart-col-value { font-size: 10.5px; }
  .chart-col-label { font-size: 9px; letter-spacing: 0.1em; }

  /* Rank rows — already drop the bar track at 720; tighten the rest */
  .rank-row {
    padding: 14px 0;
  }
  .rank-row-name { font-size: 14px; }
  .rank-row-name-meta { font-size: 10px; }
  .rank-row-amount { font-size: 14px; }
}

/* ============================================================
   Pay-detail success state
   ============================================================ */
.pay-success {
  margin-top: 36px;
  padding: 48px 36px 40px;
  background: var(--bg-raised);
  border: 1px solid color-mix(in oklch, var(--status-paid) 28%, var(--line));
  border-radius: 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: paySuccessIn 700ms var(--ease-out) both;
}

/* After payment: success card takes over the viewport. Invoice details
   collapse away so the thank-you moment is the whole page. */
.pay-detail.is-paid {
  min-height: calc(100dvh - var(--bar-h) - 200px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pay-detail.is-paid > :not(.pay-success):not(.preview-banner) { display: none; }
.pay-detail.is-paid .pay-success { margin-top: 0; }
.pay-success::before {
  /* Quiet ambient wash behind the success card. */
  content: "";
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 220px;
  background:
    radial-gradient(60% 80% at 50% 0%,
      color-mix(in oklch, var(--status-paid) 18%, transparent) 0%,
      transparent 70%);
  pointer-events: none;
}
.pay-success > * { position: relative; }

@keyframes paySuccessIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.pay-success .overlay-check {
  margin: 0 auto 28px;
  width: 64px; height: 64px;
  font-size: 28px;
  position: relative;
}
.overlay-check-bloom .overlay-check-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  animation: bloomCheck 520ms cubic-bezier(0.34, 1.56, 0.64, 1) 200ms both;
}
.overlay-check-bloom .overlay-check-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid color-mix(in oklch, var(--status-paid) 60%, transparent);
  animation: bloomRing 1400ms ease-out 200ms both;
}
@keyframes bloomCheck {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes bloomRing {
  from { transform: scale(0.7); opacity: 1; }
  to   { transform: scale(2.4); opacity: 0; }
}

.pay-success-headline {
  font-family: var(--serif);
  font-size: clamp(32px, 4.2vw, 44px);
  font-weight: 350;
  letter-spacing: -0.018em;
  line-height: 1.05;
  margin-bottom: 18px;
  color: var(--ink);
}
.pay-success-headline em {
  font-style: italic;
  color: var(--muted);
  font-weight: 400;
}

.pay-success-lead {
  max-width: 480px;
  margin: 0 auto 24px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
}

.pay-success-receipt {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.pay-success-receipt-link {
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.pay-success-receipt-link:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.pay-success-sig {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 32px;
  font-weight: 350;
}

.pay-success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  .pay-success,
  .overlay-check-bloom .overlay-check-mark,
  .overlay-check-bloom .overlay-check-ring {
    animation: none !important;
  }
}
.is-hidden { display: none !important; }

/* ============================================================
   Admin preview banner — shown on /pay when opened via dashboard
   ============================================================ */
.preview-banner {
  margin-top: 18px;
  margin-bottom: 28px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--accent-tint);
  border: 1px solid color-mix(in oklch, var(--accent) 28%, transparent);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.preview-banner-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid color-mix(in oklch, var(--accent) 50%, transparent);
  border-radius: 100px;
}
.preview-banner a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  margin-left: 4px;
}
.preview-banner a:hover { color: var(--ink); }

/* ============================================================
   Canonical SP v2 footer — re-tinted for dark prototype.
   Markup matches <sp-footer> from /assets/sp-shell.js.
   ============================================================ */
.site-footer {
  /* White footer on dark pay subdomain pages — contrast rest beat.
     Scoped token overrides keep the footer light while the rest of
     the page stays dark. */
  --bg: oklch(99% 0.002 80);
  --ink: oklch(20% 0.005 80);
  --ink-2: oklch(38% 0.005 80);
  --muted: oklch(55% 0.006 80);
  --line: oklch(88% 0.004 80);
  --line-soft: oklch(94% 0.003 80);
  background: var(--bg);
  color: var(--ink);
  border-top: 1px solid var(--line);
  padding: 72px 0 56px;
  margin-top: auto;
}
.site-footer .footer-brand .footer-wordmark span { color: var(--ink); }
.site-footer .inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
}
.footer-col h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px;
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-col a {
  font-size: 14px;
  color: var(--ink-2);
  position: relative;
  display: inline-block;
  padding-block: 2px;
  letter-spacing: 0;
  transition: color 280ms var(--ease-out), letter-spacing 420ms var(--ease-out);
}
.footer-col a::after {
  content: "";
  position: absolute;
  left: 50%; right: 50%; bottom: 0;
  height: 1px;
  background: currentColor;
  transition: left 460ms var(--ease-out), right 460ms var(--ease-out);
}
.footer-col a:hover { color: var(--ink); letter-spacing: -0.01em; }
.footer-col a:hover::after { left: 0; right: 0; }
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 340px;
}
.footer-brand .footer-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-brand .footer-wordmark img {
  width: 32px;
  height: 32px;
  /* No invert filter — logo renders in its natural dark color on the white footer. */
}
.footer-brand .footer-wordmark span {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}
.footer-brand p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-meta a {
  color: var(--muted);
  position: relative;
  display: inline-block;
  padding-block: 2px;
  transition: color 280ms var(--ease-out);
}
.footer-meta a::after {
  content: "";
  position: absolute;
  left: 50%; right: 50%; bottom: 0;
  height: 1px;
  background: currentColor;
  transition: left 460ms var(--ease-out), right 460ms var(--ease-out);
}
.footer-meta a:hover { color: var(--ink); }
.footer-meta a:hover::after { left: 0; right: 0; }

@media (max-width: 860px) {
  .site-footer .inner {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .footer-brand { grid-column: 1 / -1; }
}

/* Page layout — footer sticks to bottom on short pages */
body {
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }

/* ============================================================
   Stripe mount placeholder (honest stand-in for Payment Element)
   ============================================================ */
.stripe-mount {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 28px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: color-mix(in oklch, var(--bg-warm) 70%, var(--bg-raised));
  margin-bottom: 22px;
}
.stripe-mount-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.stripe-mount-desc {
  font-size: 13px;
  color: var(--subtle);
}
.drawer-foot {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--subtle);
  text-align: center;
}

/* ============================================================
   Admin gate — login screen
   ============================================================ */
.gate-stage {
  min-height: calc(100dvh - var(--bar-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px var(--pad-x) 96px;
}
.gate-lockup {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  margin-bottom: 56px;
}
.gate-lockup img {
  width: 44px; height: 44px;
  filter: invert(1) brightness(2);
}
.gate-lockup-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.gate {
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.gate-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.gate-title {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(36px, 5vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.018em;
  font-weight: 350;
}
.gate-title em { font-style: italic; color: var(--muted); font-weight: 400; }
.gate-form {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  text-align: left;
}
.gate-input {
  font: inherit;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.04em;
  padding: 14px 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  width: 100%;
  text-align: center;
  transition: border-color var(--t-fast);
}
.gate-input::placeholder { color: var(--subtle); letter-spacing: 0.04em; }
.gate-input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.gate-submit {
  align-self: center;
  margin-top: 8px;
  padding: 14px 36px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 280ms var(--ease-out),
              background 360ms var(--ease-out),
              letter-spacing 360ms var(--ease-out),
              transform 360ms var(--ease-out);
}
.gate-submit:hover {
  background: var(--ink);
  color: var(--bg);
  letter-spacing: 0.22em;
  transform: translateY(-1px);
}
.gate-foot {
  margin-top: 36px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
}
