/* LedgerLens: "the margin and the ledger".
   Ledger-paper greens, ink-navy text, royal-ink blue for actions and data,
   margin red for money going out. One family (Archivo) used across its width axis:
   expanded for headings and totals, condensed for dense grid rows. */

@font-face {
  font-family: 'Archivo Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/fonts/archivo-latin-variable.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/fonts/archivo-latin-ext-variable.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --paper: #edf1e8;
  --sheet: #fafbf6;
  --sheet-2: #f2f5ee;
  --rule: #d3ddcd;
  --rule-strong: #aebda8;
  --ink: #17243a;
  --ink-2: #44526a;
  --ink-3: #5f6c7a;
  --blue: #2f4fb5;
  --blue-text: #2a47a6;
  --blue-wash: #e2e8f7;
  --blue-mark: #2f4fb5;
  --red: #b9322c;
  --red-text: #a62c27;
  --red-wash: #f8e3e0;
  --red-mark: #c2362f;
  --fee-mark: #9aa69c;
  --good: #2b7349;
  --good-wash: #e0efe4;
  --warn: #8a5a08;
  --warn-wash: #f6ebd2;
  --focus: #2f4fb5;
  --shadow: 0 1px 0 rgba(23, 36, 58, 0.04), 0 8px 24px -12px rgba(23, 36, 58, 0.18);
  --font: 'Archivo Variable', 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: #0f1714;
    --sheet: #151f1b;
    --sheet-2: #1b2722;
    --rule: #2a3831;
    --rule-strong: #3d5046;
    --ink: #e3eae4;
    --ink-2: #b5c2b9;
    --ink-3: #93a198;
    --blue: #6c84e4;
    --blue-text: #9db0f6;
    --blue-wash: #1f2b4a;
    --blue-mark: #6c84e4;
    --red: #e0605a;
    --red-text: #f08a82;
    --red-wash: #3a1f1d;
    --red-mark: #e0605a;
    --fee-mark: #5d6b63;
    --good: #67c08a;
    --good-wash: #183326;
    --warn: #e2b04f;
    --warn-wash: #33290f;
    --focus: #9db0f6;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #0f1714;
  --sheet: #151f1b;
  --sheet-2: #1b2722;
  --rule: #2a3831;
  --rule-strong: #3d5046;
  --ink: #e3eae4;
  --ink-2: #b5c2b9;
  --ink-3: #93a198;
  --blue: #6c84e4;
  --blue-text: #9db0f6;
  --blue-wash: #1f2b4a;
  --blue-mark: #6c84e4;
  --red: #e0605a;
  --red-text: #f08a82;
  --red-wash: #3a1f1d;
  --red-mark: #e0605a;
  --fee-mark: #5d6b63;
  --good: #67c08a;
  --good-wash: #183326;
  --warn: #e2b04f;
  --warn-wash: #33290f;
  --focus: #9db0f6;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Top bar ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-stretch: 125%;
  font-weight: 760;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.wordmark svg {
  width: 26px;
  height: 26px;
  flex: none;
}
.source {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  min-width: 0;
}
.source .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}
.source[data-mode='sandbox'] .dot,
.source[data-mode='live'] .dot {
  background: var(--good);
}
.source .detail {
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .spacer {
  flex: 1;
}
.topbar .controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.select,
.btn-quiet {
  height: 34px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  color: var(--ink);
}
.select {
  padding-right: 28px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.btn-quiet:hover {
  background: var(--sheet-2);
}
.btn-quiet {
  white-space: nowrap;
}
.topbar .controls,
.topbar .period-ctl {
  flex: none;
}
.icon-btn {
  width: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Desk: margin | ledger ---------- */
.desk {
  height: calc(100% - 56px);
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
}
.margin {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 2px solid var(--red);
  box-shadow: 4px 0 0 var(--paper), 5px 0 0 var(--red);
  margin-right: 5px;
}
.ledger {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--sheet);
}

/* ---------- Thread (margin notes) ---------- */
.thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px var(--gutter) 12px;
  scroll-behavior: smooth;
}
.intro h1 {
  font-stretch: 118%;
  font-weight: 680;
  font-size: 29px;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 6px 0 10px;
  max-width: 15ch;
}
.intro p {
  margin: 0 0 18px;
  color: var(--ink-2);
  max-width: 44ch;
}
.asks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.ask {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--blue);
  border-radius: 4px 10px 10px 4px;
  background: var(--sheet);
}
.ask:hover {
  border-color: var(--rule-strong);
  border-left-color: var(--blue);
  background: var(--blue-wash);
}
.ask strong {
  font-weight: 600;
}
.ask span {
  font-size: 13px;
  color: var(--ink-3);
}

.note {
  margin: 0 0 18px;
}
.note-user {
  display: flex;
  justify-content: flex-end;
}
.note-user p {
  margin: 0;
  max-width: 85%;
  background: var(--ink);
  color: var(--sheet);
  padding: 8px 12px;
  border-radius: 12px 12px 2px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-agent .who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.note-agent .who svg {
  width: 16px;
  height: 16px;
}
.answer {
  color: var(--ink);
}
.answer p {
  margin: 0 0 8px;
}
.answer ul {
  margin: 0 0 8px;
  padding-left: 18px;
}
.answer li {
  margin: 0 0 4px;
}
.answer li::marker {
  color: var(--ink-3);
}
.receipt {
  border: 0;
  padding: 0 2px;
  margin: 0 -1px;
  background: var(--blue-wash);
  color: var(--blue-text);
  border-radius: 3px;
  font-weight: 600;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  font-variant-numeric: tabular-nums;
}
.receipt:hover {
  background: var(--blue);
  color: var(--sheet);
  text-decoration: none;
}
.receipt.quiet {
  background: none;
  color: inherit;
  font-weight: inherit;
  padding: 0;
  margin: 0;
  text-decoration-color: var(--ink-3);
}
.nowrap {
  white-space: nowrap;
}
.receipt.quiet:hover {
  background: none;
  color: var(--blue-text);
  text-decoration: underline;
}
.grounding {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.grounding .ok {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--good);
}
.grounding .ok svg {
  width: 14px;
  height: 14px;
}
.grounding .warn {
  color: var(--warn);
}
.linkish {
  border: 0;
  background: none;
  padding: 0;
  color: var(--blue-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: inherit;
}

/* Agent steps (how the answer was produced) */
.steps {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule-strong);
}
.steps li {
  position: relative;
  padding: 2px 0 6px 14px;
  font-size: 13px;
  color: var(--ink-2);
}
.steps li::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
}
.steps li[data-status='running']::before {
  background: var(--blue);
  border-color: var(--blue);
  animation: pulse 1s ease-in-out infinite;
}
.steps li[data-status='done']::before {
  background: var(--rule-strong);
}
.steps li[data-status='error']::before {
  background: var(--red);
  border-color: var(--red);
}
.steps .title {
  color: var(--ink);
}
.steps .detail {
  display: block;
  color: var(--ink-3);
}
.steps .calls {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
  font-stretch: 92%;
}
.steps .by {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-left: 6px;
}
details.how {
  margin-top: 8px;
  font-size: 13px;
}
details.how summary {
  cursor: pointer;
  color: var(--ink-3);
  list-style: none;
}
details.how summary::-webkit-details-marker {
  display: none;
}
details.how summary::before {
  content: '+ ';
}
details.how[open] summary::before {
  content: '− ';
}
details.how .steps {
  margin-top: 8px;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
.error-box {
  border: 1px solid var(--red);
  background: var(--red-wash);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.error-box .hint {
  display: block;
  margin-top: 4px;
  color: var(--ink-2);
}
.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.chip {
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--ink);
}
.chip:hover {
  border-color: var(--blue);
  color: var(--blue-text);
}

/* ---------- Voucher (approval card) ---------- */
.voucher {
  position: relative;
  margin: 12px 0 4px;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.voucher::before {
  /* perforated stub edge */
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: -1px;
  border-top: 2px dashed var(--rule-strong);
}
.voucher .kind {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.voucher .state {
  color: var(--warn);
  white-space: nowrap;
}
.voucher h3 {
  margin: 4px 0 10px;
  font-size: 16px;
  font-weight: 620;
  line-height: 1.3;
}
.voucher .amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 10px;
  border-top: 1px solid var(--rule);
  border-bottom: 3px double var(--rule-strong);
  margin-bottom: 10px;
}
.voucher .amount span {
  font-size: 13px;
  color: var(--ink-2);
}
.voucher .amount strong {
  font-stretch: 116%;
  font-weight: 680;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.voucher[data-kind='refund'] .amount strong,
.voucher[data-kind='accept_claim'] .amount strong {
  color: var(--red-text);
}
.voucher dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 0 0 10px;
  font-size: 13.5px;
}
.voucher dt {
  color: var(--ink-3);
}
.voucher dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.voucher table.lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 0 0 10px;
  font-variant-numeric: tabular-nums;
}
.voucher table.lines th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
  padding: 2px 0;
}
.voucher table.lines td {
  padding: 4px 0;
  border-bottom: 1px solid var(--rule);
}
.voucher table.lines .num {
  text-align: right;
  white-space: nowrap;
}
.voucher label.field {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 8px;
}
.voucher label.field input,
.voucher label.field textarea {
  display: block;
  width: 100%;
  margin-top: 3px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet-2);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}
.voucher label.field textarea {
  min-height: 92px;
}
.voucher .warnings {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--warn);
  background: var(--warn-wash);
  font-size: 13.5px;
  border-radius: 0 6px 6px 0;
}
.voucher .warnings p {
  margin: 0;
}
.voucher .wire {
  font-size: 12px;
  color: var(--ink-3);
  font-stretch: 90%;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.voucher .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.btn-primary {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
:root[data-theme='dark'] .btn-primary {
  color: #0d1430;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .btn-primary {
    color: #0d1430;
  }
}
.btn-primary:hover {
  filter: brightness(1.08);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: progress;
}
.voucher[data-kind='refund'] .btn-primary,
.voucher[data-kind='accept_claim'] .btn-primary {
  background: var(--red);
}
.btn-text {
  height: 40px;
  border: 0;
  background: none;
  color: var(--ink-2);
  padding: 0 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.voucher .result {
  font-size: 13.5px;
  color: var(--ink-2);
}
.voucher .result .err {
  color: var(--red-text);
}
.voucher[data-status='done'],
.voucher[data-status='cancelled'] {
  box-shadow: none;
}
.voucher[data-status='cancelled'] {
  opacity: 0.72;
}
.voucher[data-status='done'] .field input,
.voucher[data-status='done'] .field textarea,
.voucher[data-status='cancelled'] .field input,
.voucher[data-status='cancelled'] .field textarea {
  background: transparent;
  border-color: var(--rule);
}

/* The stamp: the one bold moment. */
.voucher .result {
  position: relative;
}
.voucher[data-status='done'] .result,
.voucher[data-status='cancelled'] .result {
  min-height: 54px;
  padding-right: 150px;
}
.stamp {
  position: absolute;
  right: 4px;
  bottom: 2px;
  padding: 4px 12px;
  border: 3px double currentColor;
  border-radius: 6px;
  color: var(--blue);
  font-stretch: 125%;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.02em;
  transform: rotate(-8deg);
  background: color-mix(in srgb, var(--sheet) 70%, transparent);
  pointer-events: none;
  animation: stamp 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
.voucher[data-kind='refund'] .stamp,
.voucher[data-kind='accept_claim'] .stamp {
  color: var(--red);
}
.voucher[data-status='cancelled'] .stamp {
  color: var(--ink-3);
}
@keyframes stamp {
  0% {
    opacity: 0;
    transform: rotate(-8deg) scale(1.8);
  }
  60% {
    opacity: 1;
    transform: rotate(-8deg) scale(0.94);
  }
  100% {
    transform: rotate(-8deg) scale(1);
  }
}
.voucher.flash {
  animation: flash 1.2s ease-out;
}
@keyframes flash {
  0% {
    box-shadow: 0 0 0 4px var(--blue);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

/* ---------- Composer ---------- */
.composer {
  border-top: 1px solid var(--rule);
  padding: 10px var(--gutter) 12px;
  background: var(--paper);
}
.composer .row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--sheet);
  padding: 10px 12px;
  line-height: 1.4;
}
.composer textarea:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-wash);
}
.composer .btn-primary {
  height: 44px;
}
.selection-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--blue-wash);
  border-radius: 8px;
  padding: 4px 4px 4px 10px;
}

/* ---------- Ledger ---------- */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 calc(var(--gutter) + 4px);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  overflow-x: auto;
  scrollbar-width: none;
  flex: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  position: relative;
  border: 0;
  background: none;
  padding: 14px 12px 12px;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover {
  color: var(--ink);
}
.tab[aria-selected='true'] {
  color: var(--ink);
  font-weight: 650;
}
.tab[aria-selected='true']::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 3px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
}
.tab .count {
  display: inline-block;
  min-width: 20px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red-wash);
  color: var(--red-text);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}
.tab .count:empty {
  display: none;
}

.views {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px calc(var(--gutter) + 8px) 24px;
}
.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}
.view-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.view-head h2 {
  margin: 0;
  font-stretch: 112%;
  font-weight: 660;
  font-size: 23px;
  letter-spacing: -0.01em;
}
.view-head .sub {
  color: var(--ink-3);
  font-size: 13px;
}

/* Totals line: ledger columns, the bottom line double-ruled. */
.totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.total {
  padding: 10px 14px 12px;
  border-left: 1px solid var(--rule);
  min-width: 0;
}
.total:first-child {
  border-left: 0;
  padding-left: 0;
}
.total .label {
  font-size: 13px;
  color: var(--ink-2);
}
.total .value {
  display: inline-block;
  font-stretch: 114%;
  font-weight: 660;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-top: 2px;
  white-space: nowrap;
}
.total.bottom-line .value {
  border-bottom: 4px double var(--ink);
  padding-bottom: 1px;
}
.total.out .value {
  color: var(--red-text);
}
.total .delta {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}
.total .delta.up {
  color: var(--good);
}
.total .delta.down {
  color: var(--red-text);
}
.total.lensed {
  background: var(--blue-wash);
  box-shadow: inset 0 -3px 0 var(--blue);
}

/* Where the money went: one stacked bar, labelled */
.split {
  display: grid;
  gap: 6px;
}
.split .bar {
  display: flex;
  height: 12px;
  gap: 2px;
}
.split .seg {
  min-width: 2px;
  height: 100%;
}
.split .seg:first-child {
  border-radius: 4px 0 0 4px;
}
.split .seg:last-child {
  border-radius: 0 4px 4px 0;
}
.split .legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 13px;
  color: var(--ink-2);
}
.split .legend span::before,
.aging .key::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
  background: var(--c);
}

.panel {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
}
.chart-panel {
  margin: 0;
  padding: 12px 14px 6px;
}
.chart-panel h3,
.panel-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 620;
}
.chart-panel .caption {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 4px;
}
.chart {
  position: relative;
  height: 220px;
  overflow: hidden;
}

.grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.seg-control {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--sheet);
}
.seg-control button {
  border: 0;
  background: none;
  padding: 6px 11px;
  font-size: 13.5px;
  color: var(--ink-2);
  border-left: 1px solid var(--rule);
  white-space: nowrap;
}
.seg-control button:first-child {
  border-left: 0;
}
.seg-control button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--sheet);
}
.search {
  height: 34px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--sheet);
  padding: 0 10px;
  min-width: 0;
  width: 200px;
}
.grid-toolbar .grow {
  flex: 1;
}
.grid {
  height: 460px;
  min-height: 280px;
}
.grid.short {
  height: auto;
  min-height: 0;
}

.lensbar {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--blue);
  background: var(--blue-wash);
  border-radius: 8px;
  font-size: 14px;
}
.lensbar svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
  flex: none;
}
.lensbar .grow {
  flex: 1;
  min-width: 0;
}

/* Overdue aging */
.aging {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}
.aging .row {
  display: grid;
  grid-template-columns: 96px 1fr 92px;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.aging .track {
  height: 12px;
  border-radius: 0 4px 4px 0;
  background: var(--sheet-2);
}
.aging .fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--c);
  min-width: 2px;
}
.aging .amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Disputes: case brief */
.cases {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}
.brief {
  padding: 14px 16px;
}
.brief h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 640;
}
.brief .meta {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0 0 10px;
}
.brief blockquote {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-left: 3px solid var(--rule-strong);
  background: var(--sheet-2);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
}
.brief .deadline {
  font-weight: 600;
}
.brief .deadline.urgent {
  color: var(--red-text);
}
.checklist {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 4px;
}
.checklist label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
}
.checklist input {
  margin-top: 4px;
  accent-color: var(--blue);
}

/* Checks: findings */
.findings {
  display: grid;
  gap: 8px;
}
.finding {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 12px;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
}
.finding:hover,
.finding[aria-pressed='true'] {
  border-color: var(--blue);
}
.finding[aria-pressed='true'] {
  background: var(--blue-wash);
}
.finding .sev {
  font-size: 12px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.sev-high {
  background: var(--red-wash);
  color: var(--red-text);
}
.sev-medium {
  background: var(--warn-wash);
  color: var(--warn);
}
.sev-low {
  background: var(--sheet-2);
  color: var(--ink-2);
}
.finding strong {
  font-weight: 620;
}
.finding p {
  grid-column: 2 / 4;
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
}
.finding .rows {
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.empty {
  padding: 18px;
  color: var(--ink-2);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}
.footnote {
  font-size: 12.5px;
  color: var(--ink-3);
}
.loading-veil {
  opacity: 0.5;
  transition: opacity 0.2s;
}

/* ---------- Grid cell renderers ---------- */
.ag-root-wrapper {
  font-stretch: 94%;
}
.ag-right-aligned-cell,
.ag-right-aligned-header,
.ag-cell .n {
  font-variant-numeric: tabular-nums;
}
.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  font-stretch: 100%;
}
.pill-neutral {
  background: var(--sheet-2);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.pill-good {
  background: var(--good-wash);
  color: var(--good);
}
.pill-warn {
  background: var(--warn-wash);
  color: var(--warn);
}
.pill-bad {
  background: var(--red-wash);
  color: var(--red-text);
}
.pill-blue {
  background: var(--blue-wash);
  color: var(--blue-text);
}
.cell-two {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.25;
  height: 100%;
  min-width: 0;
}
.cell-two .main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-two .sub {
  font-size: 11.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.amt-neg {
  color: var(--red-text);
}
.agebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}
.agebar .track {
  flex: 1;
  height: 6px;
  background: var(--sheet-2);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.agebar .fill {
  height: 100%;
  background: var(--red-mark);
  border-radius: 3px;
}
.agebar .n {
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sharebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}
.sharebar .fill {
  height: 6px;
  border-radius: 0 3px 3px 0;
  background: var(--blue-mark);
}
.sharebar .n {
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.row-action {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--sheet);
  font-size: 12.5px;
  color: var(--blue-text);
  white-space: nowrap;
}
.row-action:hover {
  border-color: var(--blue);
  background: var(--blue-wash);
}
.ag-row.ll-lens {
  box-shadow: inset 3px 0 0 var(--blue);
}
.ag-row.ll-flagged .ag-cell:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}
.ag-row-pinned .ag-cell {
  font-weight: 650;
}

/* ---------- Today: the brief on the start screen ---------- */
.eyebrow {
  margin: 0 0 2px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.intro .lede {
  margin: 0 0 14px;
  font-size: 14px;
}
.today {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.today-row {
  width: 100%;
  display: grid;
  grid-template-columns: 108px 1fr 16px;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-3);
  border-radius: 4px 10px 10px 4px;
  background: var(--sheet);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.today-row:hover {
  background: var(--blue-wash);
  border-color: var(--rule-strong);
}
.today-row:active {
  transform: translateY(1px);
}
.today-row[data-tone='bad'] {
  border-left-color: var(--red);
}
.today-row[data-tone='warn'] {
  border-left-color: var(--warn);
}
.today-row[data-tone='good'] {
  border-left-color: var(--good);
}
.today-row .fig {
  font-stretch: 112%;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.today-row[data-tone='bad'] .fig {
  color: var(--red-text);
}
.today-row[data-tone='good'] .fig {
  color: var(--good);
}
.today-row .what {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}
.today-row .what strong {
  font-weight: 560;
  font-size: 14px;
}
.today-row .what span {
  font-size: 12.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.today-row svg {
  width: 16px;
  height: 16px;
  color: var(--ink-3);
}
.today-row.skeleton {
  height: 52px;
  border-left-color: var(--rule);
  background: linear-gradient(90deg, var(--sheet) 0%, var(--sheet-2) 50%, var(--sheet) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.hero {
  margin: 0 0 18px;
}
.btn-hero {
  width: 100%;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  font-stretch: 108%;
  letter-spacing: 0.005em;
  border-radius: 10px;
  box-shadow: 0 6px 18px -10px var(--blue);
}
.btn-hero svg {
  width: 20px;
  height: 20px;
}
.hero p {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}
.asks-title {
  margin: 0 0 6px !important;
  font-size: 12.5px !important;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3) !important;
}
.intro .asks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.intro .ask {
  width: auto;
  display: inline-flex;
  padding: 5px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: 13.5px;
  line-height: 1.35;
}
.intro .ask:hover {
  border-color: var(--blue);
  color: var(--blue-text);
}
.intro .ask strong {
  font-weight: 520;
}
.intro .ask span {
  display: none;
}

/* ---------- Standing approval ---------- */
.mandate-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 4px 4px 4px 10px;
  border-radius: 8px;
  background: var(--good-wash);
  color: var(--ink);
  font-size: 13px;
}
.mandate-chip svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--good);
}
.mandate-chip .grow {
  flex: 1;
  min-width: 0;
}
.mandate-chip .btn-text {
  height: 30px;
}
.note-system {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 10px 12px;
  border: 1px dashed var(--good);
  border-radius: 10px;
  background: var(--good-wash);
  font-size: 13.5px;
}
.note-system p {
  margin: 0;
}
.note-mcp {
  padding: 10px 12px 4px;
  border: 1px dashed var(--blue);
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue-wash) 50%, transparent);
}
.note-mcp .body p {
  margin: 0;
  font-size: 14px;
}
.voucher[data-mandate='true'] {
  border-left: 3px solid var(--good);
}
.voucher[data-mandate='true'] .stamp {
  color: var(--good);
}
.voucher[data-mandate='true'] .state {
  color: var(--good);
}
.by-mandate {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ink-2);
}
.by-mandate svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  color: var(--good);
}
.offer-line {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px dashed var(--good);
  border-radius: 8px;
  background: var(--good-wash);
  font-size: 13.5px;
}
.offer-line .linkish {
  font-weight: 560;
}

/* Several vouchers in one answer: an approval queue, details folded under "Review". */
.vouchers.queue {
  margin-top: 12px;
  padding-top: 2px;
}
.queue-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 6px 2px;
  border-bottom: 2px solid var(--ink);
  font-size: 13px;
}
.queue-head strong {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.queue-head .q-count {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.queue-head[data-complete='true'] .q-count {
  color: var(--good);
}
.review-toggle {
  display: none;
}
.vouchers.queue .review-toggle {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}
.vouchers.queue .voucher {
  padding: 12px 14px 12px;
}
.vouchers.queue .voucher h3 {
  font-size: 15px;
  margin-bottom: 6px;
}
.vouchers.queue .voucher .amount {
  padding: 4px 0 6px;
}
.vouchers.queue .voucher .amount strong {
  font-size: 21px;
}
.vouchers.queue .voucher:not(.expanded) .more {
  display: none;
}
.vouchers.queue .voucher .btn-primary {
  height: 36px;
}

/* ---------- Dialog ---------- */
.sheet-dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--sheet);
  color: var(--ink);
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 20, 0.55);
}
.sheet-dialog::backdrop {
  background: rgba(15, 23, 20, 0.45);
}
.sheet-dialog h2 {
  margin: 0 0 6px;
  font-stretch: 112%;
  font-weight: 680;
  font-size: 22px;
  line-height: 1.2;
}
.sheet-dialog .lede {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 14px;
}
.limits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-bottom: 14px;
}
.limits label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-2);
}
.input-unit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}
.input-unit input {
  width: 96px;
  height: 36px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--sheet-2);
  padding: 0 10px;
  font-variant-numeric: tabular-nums;
}
.never {
  padding: 8px 10px;
  border-left: 3px solid var(--red);
  background: var(--red-wash);
  border-radius: 0 6px 6px 0;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.mandate-error {
  margin: 0 0 10px;
  color: var(--red-text);
  font-size: 13.5px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Drill-down: the PayPal record under a transaction ---------- */
.ag-row.ll-expanded {
  background: color-mix(in srgb, var(--blue-wash) 60%, transparent);
}
.txn-detail {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1.15fr) minmax(0, 0.9fr);
  gap: 18px;
  padding: 12px 18px 12px 50px;
  background: var(--sheet-2);
  border-top: 1px solid var(--rule);
  border-bottom: 3px double var(--rule-strong);
  font-size: 13px;
  line-height: 1.45;
  font-stretch: 96%;
  white-space: normal;
  overflow: hidden;
}
.txn-detail .label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.txn-detail dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 10px;
  margin: 0;
}
.txn-detail dt {
  color: var(--ink-3);
}
.txn-detail dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.txn-detail code,
.wire-cell .method,
.voucher .wire {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.txn-detail code {
  font-size: 12px;
}
.txn-detail table.mini {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.txn-detail table.mini td {
  padding: 1px 6px 1px 0;
  vertical-align: top;
}
.txn-detail table.mini td.num {
  text-align: right;
  white-space: nowrap;
}
.txn-detail .sums {
  font-variant-numeric: tabular-nums;
}
.txn-detail .sums dd {
  text-align: right;
}
.txn-detail .sums .net {
  font-weight: 700;
  border-top: 1px solid var(--rule-strong);
  padding-top: 2px;
}
.txn-detail .related {
  margin: 6px 0 0;
  color: var(--red-text);
}
.detail-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.muted {
  color: var(--ink-3);
}

/* ---------- Activity ---------- */
.tab .count.neutral {
  background: var(--sheet-2);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.wire-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 100%;
}
.wire-cell .method {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--blue-wash);
  color: var(--blue-text);
}
.wire-cell .method-post,
.wire-cell .method-patch,
.wire-cell .method-delete {
  background: var(--warn-wash);
  color: var(--warn);
}
.wire-cell .wire-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.view .footnote code {
  font-size: 0.95em;
}

/* ---------- Studio link ---------- */
.studio-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.studio-link svg {
  width: 17px;
  height: 17px;
  color: var(--blue);
}

/* ---------- Data source switch ---------- */
.source-switch button {
  padding: 4px 10px;
  font-size: 12.5px;
}
.fallback-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
}

/* ---------- Mobile pane switch ---------- */
.pane-switch {
  display: none;
}

@media (max-width: 1100px) {
  .desk {
    grid-template-columns: minmax(320px, 360px) 1fr;
  }
  .totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .total:nth-child(3) {
    border-left: 0;
    padding-left: 0;
  }
  .total:nth-child(n + 3) {
    border-top: 1px solid var(--rule);
  }
  .cases {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }
  .topbar {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px var(--gutter);
    gap: 6px 8px;
  }
  .wordmark {
    font-size: 17px;
  }
  .topbar .spacer {
    display: none;
  }
  .wordmark {
    order: 1;
  }
  .topbar .controls {
    order: 2;
    margin-left: auto;
    gap: 6px;
  }
  .source {
    order: 3;
    flex: 1 1 160px;
    min-width: 0;
    font-size: 12.5px;
    margin: 0;
  }
  .source .detail {
    white-space: nowrap;
  }
  .period-ctl {
    order: 4;
  }
  .control .label-text {
    display: none;
  }
  .select {
    height: 32px;
    font-size: 13px;
    padding-left: 8px;
  }
  .btn-quiet {
    height: 32px;
  }
  .icon-btn {
    width: 32px;
  }
  #reset-btn .label-long,
  .studio-link .label-long {
    display: none;
  }
  .pane-switch {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0;
    padding: 8px var(--gutter);
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .pane-switch button {
    flex: 1;
    height: 36px;
    border: 1px solid var(--rule-strong);
    background: var(--sheet);
    color: var(--ink-2);
    font-weight: 550;
  }
  .pane-switch button:first-child {
    border-radius: 8px 0 0 8px;
  }
  .pane-switch button:last-child {
    border-radius: 0 8px 8px 0;
    border-left: 0;
  }
  .pane-switch button[aria-selected='true'] {
    background: var(--ink);
    color: var(--sheet);
    border-color: var(--ink);
  }
  .pane-switch .badge {
    display: inline-block;
    margin-left: 6px;
    min-width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--blue);
    vertical-align: 2px;
  }
  .desk {
    display: block;
    height: auto;
  }
  .margin {
    border-right: 0;
    box-shadow: none;
    margin-right: 0;
    min-height: calc(100dvh - 160px);
  }
  .thread {
    overflow: visible;
    padding-bottom: 8px;
  }
  .composer {
    position: sticky;
    bottom: 0;
    z-index: 4;
    border-top: 2px solid var(--red);
  }
  .desk[data-pane='ask'] .ledger,
  .desk[data-pane='ledger'] .margin {
    display: none;
  }
  .views {
    overflow: visible;
    padding: 14px var(--gutter) 24px;
  }
  .tabs {
    padding: 0 8px;
  }
  .intro h1 {
    font-size: 26px;
  }
  .total .value {
    font-size: 22px;
  }
  .total {
    padding: 8px 10px 10px;
  }
  .chart {
    height: 190px;
  }
  .grid {
    height: 420px;
  }
  .search {
    flex: 1 1 160px;
    width: auto;
  }
  .grid-toolbar .grow {
    display: none;
  }
  .seg-control {
    max-width: 100%;
    overflow-x: auto;
  }
  .aging .row {
    grid-template-columns: 98px 1fr 84px;
    font-size: 13px;
  }
  .aging .key {
    white-space: nowrap;
  }
  .stamp {
    font-size: 19px;
  }
  .source-switch {
    order: 5;
    width: 100%;
  }
  .source-switch button {
    flex: 1;
  }
  .txn-detail {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 14px;
  }
  .limits {
    grid-template-columns: 1fr;
  }
  .today-row .fig {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .split .seg,
  .aging .fill,
  .agebar .fill,
  .sharebar .fill {
    forced-color-adjust: none;
  }
}

/* ---------- Studio page (/studio.html) ---------- */
body.studio-page {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.studio-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px var(--gutter) var(--gutter);
  gap: 8px;
}
.studio-host {
  flex: 1;
  min-height: 600px;
}
.studio-note {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  font-size: 13.5px;
  color: var(--ink-2);
}
.studio-note[data-tone='bad'] {
  border-color: var(--red);
  background: var(--red-wash);
  color: var(--ink);
}
@media (max-width: 860px) {
  body.studio-page {
    height: auto;
  }
  .studio-host {
    min-height: 900px;
  }
}

/* ---------- Setup page (/admin.html) ---------- */
body.admin-page {
  overflow: auto;
  height: auto;
}
.admin-sub {
  font-size: 14px;
  color: var(--ink-2);
  padding-left: 10px;
  border-left: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.admin-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.admin {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}
.admin h1 {
  font-stretch: 118%;
  font-weight: 680;
  font-size: 31px;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.admin .lede {
  color: var(--ink-2);
  margin: 0 0 22px;
  max-width: 62ch;
}
.admin code {
  font-size: 0.92em;
  background: var(--sheet-2);
  padding: 1px 5px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.admin-card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  margin-bottom: 16px;
}
.admin-card h2 {
  font-size: 18px;
  font-weight: 640;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 640;
}
.step-no {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  color: var(--blue-text);
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin .hint {
  color: var(--ink-2);
  font-size: 14px;
  margin: 8px 0 12px;
  max-width: 64ch;
}
.key-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-input {
  flex: 1 1 220px;
  height: 40px;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--sheet-2);
  padding: 0 12px;
}
.key-status {
  margin: 8px 0 0;
  font-size: 14px;
}
.key-status[data-tone='ok'] {
  color: var(--good);
}
.key-status[data-tone='bad'] {
  color: var(--red-text);
}
.checks {
  list-style: none;
  margin: 0;
  padding: 0;
}
.check {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}
.check .badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--sheet-2);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.check[data-status='ok'] .badge {
  background: var(--good-wash);
  color: var(--good);
  box-shadow: none;
}
.check[data-status='warn'] .badge {
  background: var(--warn-wash);
  color: var(--warn);
  box-shadow: none;
}
.check[data-status='fail'] .badge {
  background: var(--red-wash);
  color: var(--red-text);
  box-shadow: none;
}
.check .title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.check .state {
  font-size: 12.5px;
  color: var(--ink-3);
}
.check p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-2);
}
.check .fix {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 3px solid var(--warn);
  background: var(--warn-wash);
  color: var(--ink);
  border-radius: 0 6px 6px 0;
}
.check[data-status='fail'] .fix {
  border-left-color: var(--red);
  background: var(--red-wash);
}
.check-summary {
  list-style: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 6px;
}
.check-summary.good {
  background: var(--good-wash);
  color: var(--good);
}
.check-summary.bad {
  background: var(--red-wash);
  color: var(--red-text);
}
.seed-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.seed-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}
.check-label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}
.check-label input {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}
.progress-wrap {
  margin-top: 16px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.progress-label span:last-child {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.progress {
  height: 10px;
  background: var(--sheet-2);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--rule);
}
.progress .bar {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 5px;
  transition: width 0.25s ease-out;
}
.seed-log {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 380px;
  overflow-y: auto;
}
.seed-log li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--rule);
  font-size: 14px;
}
.seed-log .mark {
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
}
.seed-log li[data-status='done'] .mark {
  color: var(--good);
}
.seed-log li[data-status='failed'] .mark {
  color: var(--red-text);
}
.seed-log li[data-status='waiting'] .mark {
  color: var(--warn);
}
.seed-log strong {
  font-weight: 600;
}
.seed-log p {
  margin: 1px 0 0;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.next-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--blue);
  background: var(--blue-wash);
  border-radius: 8px;
}
.next-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}
.next-box li {
  margin-bottom: 4px;
}
.dispute-help {
  margin: 0 0 12px;
  padding-left: 22px;
}
.dispute-help li {
  margin: 0 0 8px;
  font-size: 14px;
  max-width: 66ch;
}
.approve-list {
  margin: 10px 0;
  padding-left: 18px;
  font-size: 14px;
}
.approve-list a {
  color: var(--blue-text);
  overflow-wrap: anywhere;
}
@media (max-width: 860px) {
  .admin-sub {
    order: 1;
  }
}
@media (max-width: 520px) {
  .admin-link {
    display: none !important;
  }
  .admin h1 {
    font-size: 26px;
  }
  .admin-card {
    padding: 16px 14px 18px;
  }
  .card-head .btn-primary,
  .seed-buttons,
  .seed-buttons .btn-primary {
    width: 100%;
  }
}
