@font-face {
  font-family: 'Work Sans';
  src: url('/work-sans.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #fafaf8;
  --white: #fff;
  --ink: #181817;
  --muted: #5f605b;
  --line: #e2e2dd;
  --field: #f1f1ed;
  --red: #ce2b20;
  --red-dark: #a71f17;
  --radius: 8px;
  font-family: 'Work Sans', Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 100%;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
[hidden] { display: none !important; }
::selection { background: #f7d0c7; color: var(--ink); }
:focus-visible { outline: 2px solid #1d5fbf; outline-offset: 4px; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }

.frame { width: min(1320px, calc(100% - 112px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip:focus { position: absolute; top: 12px; left: 12px; z-index: 5; padding: 10px; background: var(--white); }

.topbar { min-height: 88px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5rem; align-items: center; }
.wordmark { display: inline-flex; align-items: center; width: fit-content; color: var(--ink); font-size: 1.225rem; font-weight: 650; letter-spacing: -.055em; white-space: nowrap; }
.wordmark > span:last-child { font-weight: 430; }
.wordmark.small { font-size: 1rem; }
.mark { position: relative; width: 1.2em; aspect-ratio: 1; margin-right: .52em; display: inline-block; color: var(--red); }
.mark::before, .mark::after { content: ''; position: absolute; width: 68%; height: 68%; background: currentColor; clip-path: polygon(0 0, 100% 0, 100% 32%, 32% 32%, 32% 100%, 0 100%); }
.mark::before { top: 0; left: 0; }
.mark::after { bottom: 0; right: 0; transform: rotate(180deg); }
.topnav { display: flex; align-items: center; gap: clamp(1.15rem, 3vw, 3rem); font-size: .91rem; }
.topnav a { min-height: 44px; display: flex; align-items: center; }
.topnav a:hover, .text-link:hover, .footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.nav-action, .mode-label { justify-self: end; }
.mode-label { color: var(--muted); font-size: .87rem; text-align: right; }

.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: .6rem 1.05rem; border: 1px solid transparent; border-radius: var(--radius); font-size: .93rem; line-height: 1.25; font-weight: 560; white-space: nowrap; transition: background-color .18s, border-color .18s, color .18s; }
.button.primary { background: var(--red); color: var(--white); }
.button.primary:hover { background: var(--red-dark); }
.button.dark { background: var(--ink); color: var(--white); }
.button.dark:hover:not(:disabled) { background: #363633; }
.button.outline { border-color: #d3d3cd; background: transparent; color: var(--ink); }
.button.outline:hover:not(:disabled) { background: var(--field); border-color: #b8b9b1; }
.button.compact { min-height: 40px; font-size: .86rem; }
.button.full { width: 100%; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr); gap: clamp(24px, 4vw, 80px); min-height: min(600px, 70vw); padding-top: clamp(28px, 4.65vw, 76px); padding-bottom: clamp(38px, 4.5vw, 72px); align-items: center; }
.hero-copy { padding-bottom: 1.75rem; }
.hero h1 { font-weight: 470; font-size: clamp(3rem, 5.8vw, 6rem); line-height: .99; letter-spacing: -.068em; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero-copy p { margin: 1.55rem 0 1.7rem; max-width: 36ch; color: var(--muted); font-size: clamp(1rem, 1.32vw, 1.2rem); line-height: 1.55; }
.hero-copy .button { padding-inline: 1.2rem; min-height: 49px; }
.stage { display: grid; place-items: center; position: relative; isolation: isolate; min-width: 0; min-height: 450px; padding: 42px; overflow: hidden; background: var(--red); clip-path: polygon(0 69px, 69px 0, 100% 0, 100% 100%, 0 100%); }
.stage-rings { position: absolute; z-index: -1; width: 510px; aspect-ratio: 1; right: -188px; bottom: -235px; border: 1px solid #ff9d8d; border-radius: 50%; opacity: .42; }
.stage-rings::before, .stage-rings::after { content: ''; position: absolute; inset: 25px; border: inherit; border-radius: inherit; }
.stage-rings::after { inset: 50px; }
.receipt { width: 100%; background: var(--white); padding: clamp(19px, 3vw, 30px); }
.preview { max-width: 390px; border-radius: 6px 6px 0 0; padding-bottom: clamp(26px, 4vw, 39px); clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), 97.5% 100%, 95% calc(100% - 10px), 92.5% 100%, 90% calc(100% - 10px), 87.5% 100%, 85% calc(100% - 10px), 82.5% 100%, 80% calc(100% - 10px), 77.5% 100%, 75% calc(100% - 10px), 72.5% 100%, 70% calc(100% - 10px), 67.5% 100%, 65% calc(100% - 10px), 62.5% 100%, 60% calc(100% - 10px), 57.5% 100%, 55% calc(100% - 10px), 52.5% 100%, 50% calc(100% - 10px), 47.5% 100%, 45% calc(100% - 10px), 42.5% 100%, 40% calc(100% - 10px), 37.5% 100%, 35% calc(100% - 10px), 32.5% 100%, 30% calc(100% - 10px), 27.5% 100%, 25% calc(100% - 10px), 22.5% 100%, 20% calc(100% - 10px), 17.5% 100%, 15% calc(100% - 10px), 12.5% 100%, 10% calc(100% - 10px), 7.5% 100%, 5% calc(100% - 10px), 2.5% 100%, 0 calc(100% - 10px)); }
.receipt-top, .receipt-items { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.receipt-top { margin-bottom: 1.35rem; }
.receipt-label { font-size: .81rem; color: var(--muted); }
.receipt-amount { display: grid; gap: .22rem; margin-bottom: 1.15rem; }
.receipt-amount > span, .receipt-items > span { color: var(--muted); font-size: .89rem; }
.receipt-amount > strong { font-size: clamp(2.05rem, 3.2vw, 2.8rem); font-weight: 570; line-height: 1.18; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.receipt-items { border-top: 1px solid var(--line); padding: .62rem 0; }
.receipt-items > strong { font-size: .88rem; font-weight: 550; text-align: right; overflow-wrap: anywhere; }
.receipt-editor { display: block; margin: .55rem 0 .35rem; color: var(--muted); font-size: .83rem; }
.money-input { display: flex; align-items: center; border: 1px solid #d6d6ce; border-radius: 6px; }
.money-input span { padding-left: 12px; color: var(--muted); font-size: .9rem; }
.money-input input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: .55rem .65rem; outline-offset: -2px; font-size: .92rem; }

.journey { background: var(--ink); color: var(--white); }
.journey-inner { padding-block: clamp(48px, 6.5vw, 100px); }
.journey h2, .questions h2 { margin-bottom: clamp(22px, 3.5vw, 47px); font-size: clamp(2.05rem, 4.25vw, 3.75rem); line-height: 1.05; font-weight: 440; letter-spacing: -.06em; }
.journey ol { padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
.journey li { background: #242423; padding: clamp(20px, 3vw, 38px); min-height: 184px; }
.journey li:nth-child(2) { background: #2b2a28; }
.journey li:nth-child(3) { background: #33312e; }
.journey h3 { font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 530; letter-spacing: -.045em; }
.journey li p { max-width: 25ch; margin-top: .5rem; color: #dddcd5; }
.questions { display: grid; grid-template-columns: .82fr 1.18fr; gap: clamp(24px, 5.5vw, 92px); padding-block: clamp(3rem, 5.5vw, 5.5rem); }
.questions h2 { margin-bottom: .85rem; font-size: clamp(1.85rem, 3.4vw, 2.8rem); font-weight: 550; }
.questions p { color: var(--muted); max-width: 37ch; }
.text-link { display: inline-block; margin-top: 1rem; color: var(--red-dark); font-weight: 560; }
.question-index details { border-bottom: 1px solid var(--line); padding: .8rem 0; }
.question-index summary { list-style: none; display: flex; gap: 1rem; justify-content: space-between; align-items: center; min-height: 42px; font-weight: 540; cursor: pointer; }
.question-index summary::-webkit-details-marker { display: none; }
.question-index summary::after { content: '+'; color: var(--red-dark); font-size: 1.4rem; line-height: 1; }
.question-index details[open] summary::after { content: '−'; }
.question-index p { margin: .25rem 2rem .75rem 0; max-width: 53ch; }
.footer { display: flex; gap: 1.4rem; flex-wrap: wrap; justify-content: space-between; align-items: center; padding-block: 1rem 2rem; font-size: .87rem; color: var(--muted); }

.app-shell { background: #f8f8f6; min-height: 100vh; }
.app-shell .topbar, .checkout-shell .topbar { min-height: 71px; border-bottom: 1px solid var(--line); }
.app-shell .topnav a { color: var(--muted); }
.app-shell .topnav a[aria-current] { color: var(--ink); font-weight: 600; }
.workspace { max-width: 1130px; padding-block: 2.8rem 5rem; }
.workspace-title { display: flex; gap: 1rem; justify-content: space-between; align-items: center; }
.workspace-title > * { min-width: 0; }
.workspace h1, .docs h1 { font-size: clamp(1.75rem, 3vw, 2.1rem); font-weight: 590; line-height: 1.14; letter-spacing: -.055em; }
.workspace-title p, .ledger-header p { margin-top: .35rem; color: var(--muted); }
.environment { margin-top: 1rem; color: var(--muted); font-size: .91rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin: 1.45rem 0 2.15rem; }
.metrics div { min-width: 0; padding: clamp(.8rem, 2vw, 1.5rem); }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics dt { color: var(--muted); font-size: .87rem; }
.metrics dd { margin-top: .35rem; font-size: clamp(1.35rem, 2.6vw, 1.95rem); font-weight: 570; line-height: 1.2; letter-spacing: -.049em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ledger { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.ledger-header { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: 1.2rem 1.35rem 0; }
.ledger h2, .dialog-header h2 { font-size: 1.19rem; font-weight: 585; letter-spacing: -.03em; }
.ledger-header p { font-size: .85rem; }
.filters { display: flex; gap: .55rem; padding: 1.1rem 1.35rem 1rem; }
.filters .search { width: min(100%, 310px); }
.filters label { min-width: 0; }
.filters select { appearance: none; max-width: 100%; padding-right: 1.8rem; }
.filters label:has(select) { position: relative; }
.filters label:has(select)::after { content: ''; position: absolute; right: .72rem; top: 43%; width: .42rem; height: .42rem; border: solid var(--muted); border-width: 0 1px 1px 0; transform: rotate(45deg); pointer-events: none; }
.filters input, .filters select, .form-stack input, .link-field input { background: var(--white); border: 1px solid #d6d6d0; border-radius: 6px; color: var(--ink); padding: .59rem .68rem; min-height: 42px; width: 100%; }
.filters input, .filters select { font-size: .88rem; }
.ledger > .notice { margin: 0 1.35rem 1rem; }
.ledger-empty { min-height: 182px; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 1.2rem; border-top: 1px solid var(--line); }
.ledger-empty strong { display: block; margin-bottom: .28rem; color: var(--ink); font-weight: 560; }
.table-scroll { position: relative; min-width: 0; max-width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 555px; border-collapse: collapse; text-align: left; }
th, td { border-top: 1px solid var(--line); padding: .65rem .85rem; font-size: .87rem; }
th { color: var(--muted); font-weight: 510; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 1.35rem; }
th:last-child, td:last-child { padding-right: 1.35rem; text-align: right; }
td:first-child { width: 37%; overflow-wrap: anywhere; }
td:nth-child(2) { white-space: nowrap; }
.table-title, .table-subtitle { display: block; }
.table-title { font-weight: 560; }
.table-subtitle { color: var(--muted); font-size: .79rem; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-action { min-height: 38px; background: transparent; border: 0; padding: .375rem .12rem; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }
.status { width: fit-content; display: inline-flex; gap: .42rem; align-items: center; border-radius: 5px; background: #eeefed; color: #525550; padding: .16rem .45rem; font-size: .78rem; white-space: nowrap; font-weight: 530; }
.status::before { content: ''; width: .4rem; height: .4rem; background: currentColor; border-radius: 50%; }
.status[data-status='paid'] { background: #e4f2e9; color: #15613e; }
.status:is([data-status='pending'], [data-status='processing']) { background: #fcf1da; color: #704e14; }
.status[data-status='failed'] { background: #fae8e4; color: #8d2419; }

dialog { width: min(470px, calc(100% - 26px)); max-height: calc(100% - 40px); overflow: auto; border-radius: 12px; padding: 1.3rem; background: var(--white); border: 1px solid var(--line); color: var(--ink); box-shadow: 0 12px 35px #0003; }
dialog::backdrop { background: #1c1c1c70; }
.dialog-header { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: .8rem; }
.close { width: 41px; height: 41px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; }
.close:hover { background: var(--field); }
.form-stack { display: grid; gap: .9rem; }
.form-stack label, .link-field { display: grid; gap: .3rem; font-size: .88rem; font-weight: 520; }
.form-stack input, .link-field input { font-size: 1rem; font-weight: 400; }
.form-note { color: var(--muted); font-size: .87rem; }
.form-note:empty { display: none; }
.notice { padding: .7rem .8rem; border-radius: 6px; }
.notice.error { color: #8b231a; background: #fbe9e5; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.detail-head p { overflow-wrap: anywhere; }
.detail-list { margin-block: .9rem; }
.detail-list div { display: flex; justify-content: space-between; gap: .75rem; font-size: .86rem; border-top: 1px solid var(--line); padding-block: .48rem; }
.detail-list dt { color: var(--muted); }
.detail-list dd { text-align: right; overflow-wrap: anywhere; max-width: 65%; font-variant-numeric: tabular-nums; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-block: .8rem .45rem; }

.checkout-shell { background: #f4f4ef; min-height: 100vh; }
.checkout-shell .topbar { grid-template-columns: 1fr 1fr; }
.checkout-wrap { display: grid; grid-template-columns: .9fr 1fr; gap: clamp(18px, 6vw, 88px); align-items: start; max-width: 1000px; padding-block: clamp(42px, 9vw, 114px); }
.checkout-copy h1 { font-size: clamp(2.7rem, 6.4vw, 4.65rem); font-weight: 470; line-height: 1.03; letter-spacing: -.072em; }
.checkout-copy p { margin-top: .75rem; color: var(--muted); max-width: 36ch; }
.checkout-receipt { border: 1px solid var(--line); border-radius: 8px; }
.checkout-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; color: var(--ink); font-weight: 650; }
.checkout-brand strong { min-width: 0; overflow-wrap: anywhere; }
.checkout-brand-logo { width: 40px; height: 40px; flex-shrink: 0; object-fit: contain; border-radius: 5px; }
.checkout-panel { min-width: 0; }
.qris-box { display: grid; justify-items: center; gap: .65rem; border-top: 1px solid var(--line); padding: 1rem 0 .35rem; text-align: center; }
.qris-box img { width: min(230px, 100%); aspect-ratio: 1; padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 6px; object-fit: contain; }
.checkout-actions { display: grid; gap: .6rem; margin: .85rem 0; }
.checkout-panel > .notice { margin-bottom: .8rem; }

.docs { max-width: 850px; padding-block: 3.2rem 5rem; }
.docs h1 { margin-bottom: .8rem; }
.docs p { color: var(--muted); }
.docs section { margin-top: 2rem; }
.docs h2 { font-size: 1.35rem; font-weight: 580; margin-bottom: .5rem; }
.docs p + p { margin-top: .68rem; }
code { font-size: .9em; overflow-wrap: anywhere; }
pre { border-radius: var(--radius); padding: 1rem; overflow-x: auto; color: var(--white); background: var(--ink); tab-size: 2; }

@media (max-width: 1000px) {
  .frame { width: calc(100% - 64px); }
  .stage { min-height: 405px; padding: 32px; }
  .hero { min-height: auto; }
}

@media (max-width: 780px) {
  .frame { width: calc(100% - 40px); }
  .topbar { min-height: 68px; column-gap: .75rem; }
  .topnav { justify-content: center; }
  .hero { grid-template-columns: 1fr; gap: 16px; padding-top: 34px; }
  .hero h1 { font-size: clamp(3.05rem, 9.8vw, 4.6rem); }
  .hero-copy { padding-bottom: 8px; }
  .hero-copy p { margin: 1rem 0 1.15rem; }
  .stage { min-height: 374px; padding: 28px; clip-path: polygon(0 48px, 48px 0, 100% 0, 100% 100%, 0 100%); }
  .questions { grid-template-columns: 1fr; }
  .workspace { padding-top: 1.8rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics div:nth-child(3) { border-left: 0; }
  .metrics div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .checkout-wrap { grid-template-columns: 1fr; max-width: 520px; }
}

@media (max-width: 540px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topnav:not(.app-nav) { grid-row: 2; grid-column: 1 / -1; justify-content: start; gap: 1.5rem; }
  body[data-page='home'] .topbar { padding-top: 12px; row-gap: 2px; }
  .topnav a { font-size: .85rem; }
  .app-shell .mode-label { display: none; }
  .app-nav { flex-wrap: wrap; justify-content: end; gap: .2rem .75rem; }
  .app-nav a { min-height: 36px; }
  .journey ol { grid-template-columns: 1fr; }
  .journey li { min-height: 0; padding: 1.15rem; }
  .journey h3 { margin-top: .4rem; }
  .journey li p { max-width: 38ch; margin-top: .28rem; }
  .receipt-top { margin-bottom: 1.1rem; }
  .stage { padding: 25px 18px; }
  .workspace-title { align-items: start; }
  .workspace-title p { font-size: .91rem; }
  .ledger-header, .filters { padding-inline: .8rem; }
  .filters { gap: .4rem; }
  .filters .search { flex: 1; }
  .filters select { max-width: 135px; }
  .footer { gap: .5rem; flex-direction: column; align-items: start; }
}

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

/* ===== PORTAL COMPONENTS (EDITORIAL LIGHT THEME) ===== */
.notice.info { color: #1d4ed8; background: #eef4ff; }
.form-stack select {
  background: var(--white);
  border: 1px solid #d6d6d0;
  border-radius: 6px;
  color: var(--ink);
  padding: .59rem .68rem;
  min-height: 42px;
  width: 100%;
  font-size: .95rem;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
}

.auth-brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: var(--field);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 560;
}

.auth-tab.active {
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.auth-actions { display: grid; gap: 8px; }
.auth-divider {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
}

#portal-shell { --portal-rail: 208px; --portal-gutter: clamp(1.4rem, 3.25vw, 3rem); padding-inline-start: var(--portal-rail); }
.app-shell .portal-topbar-wrap {
  position: sticky;
  z-index: 3;
  top: 0;
  width: auto;
  min-height: 68px;
  margin: 0;
  padding-inline: var(--portal-gutter);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  background: var(--paper);
}
.topbar-brand-group, .topbar-meta { display: flex; align-items: center; gap: .65rem; }
.topbar-brand-group {
  position: fixed;
  z-index: 2;
  inset: 0 auto auto 0;
  width: var(--portal-rail);
  min-height: 68px;
  padding-inline: 1.3rem;
  background: #242422;
}
.topbar-brand-group .wordmark { color: var(--white); }
.portal-header-title { color: var(--ink); font-size: 1rem; font-weight: 630; letter-spacing: -.025em; }
.portal-nav {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--portal-rail);
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: .28rem;
  overflow-y: auto;
  padding: 5.3rem .95rem 1rem;
  scroll-padding-top: 5.3rem;
  background: #242422;
  color: #eeeae4;
}
#nav-admin-group { display: contents; }
.nav-pill {
  min-height: 42px;
  padding: .48rem .78rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #d5d3ce;
  font-size: .9rem;
  font-weight: 520;
  text-align: left;
}
.nav-pill:hover { background: #363633; color: var(--white); }
.nav-pill.active { background: #3f302c; border-color: #67433a; color: #fff3ee; font-weight: 650; }
.portal-nav .nav-pill:focus-visible { outline-color: #ffb7a7; outline-offset: 2px; }
#portal-shell .workspace { width: min(1130px, calc(100% - var(--portal-gutter) * 2)); padding-top: 1.65rem; }
.portal-environment { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .6rem; margin-bottom: 1.15rem; color: var(--muted); font-size: .78rem; }
.portal-environment-dot { width: .44rem; height: .44rem; border-radius: 50%; background: var(--red); }
.portal-environment strong { color: var(--ink); font-weight: 650; }
.portal-environment-note { padding-left: .55rem; border-left: 1px solid #d0d0ca; }
#portal-toast {
  position: fixed;
  z-index: 4;
  right: var(--portal-gutter);
  bottom: 1.25rem;
  max-width: min(340px, calc(100vw - 2rem));
  border: 1px solid #4a4842;
  background: #242422;
  color: var(--white);
  font-size: .88rem;
  box-shadow: 0 8px 24px #29251c28;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  font-size: .8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #15803d; }

.avatar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: .84rem;
}
.avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: .78rem;
  background: #f7d0c7;
  color: var(--red-dark);
}

.mobile-only { display: none; }
.portal-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.35rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.invoice-list-heading .head-actions { flex: 0 0 auto; }
.invoice-grid { min-width: 55rem; table-layout: fixed; }
.invoice-grid :is(th, td) { padding-inline: .7rem; }
.invoice-grid :is(th, td):first-child { width: auto; padding-left: 1.25rem; }
.invoice-grid :is(th, td):last-child { padding-right: 1.25rem; }
.invoice-grid .invoice-date { width: 7rem; }
.invoice-grid .invoice-fee { width: 6.7rem; }
.invoice-grid :is(.invoice-total, .invoice-net) { width: 7.75rem; }
.invoice-grid .invoice-status { width: 8rem; }
.invoice-grid :is(th, td).invoice-detail { width: 5rem; }
.invoice-identity .table-title { overflow-wrap: break-word; line-height: 1.35; }
.invoice-reference { margin-top: .2rem; overflow-wrap: anywhere; }
.invoice-cards { display: none; margin: 0; padding: 0; list-style: none; }
.invoice-card { display: grid; min-width: 0; gap: .62rem; padding: .85rem 1rem; border-top: 1px solid var(--line); }
.invoice-card-header { min-width: 0; }
.invoice-card-footer { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .65rem; }
.invoice-card-total { display: grid; gap: .12rem; margin-right: auto; max-width: 100%; }
.invoice-card-total > :first-child { color: var(--muted); font-size: .75rem; }
.invoice-card-total strong { font-weight: 640; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.invoice-card-footer .table-action { min-height: 44px; padding-inline: .35rem; }
[data-view-panel="transactions"] .filters select { width: 9.25rem; max-width: 100%; }

.mode-badge {
  display: inline-flex;
  align-items: center;
  padding: .35rem .68rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: .82rem;
  color: var(--muted);
}

.balance-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.2rem;
}
.balance-label { font-size: .84rem; color: var(--muted); display: block; }
.balance-amount {
  display: block;
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1.15;
  margin: .25rem 0 .85rem;
  font-variant-numeric: tabular-nums;
}
.balance-flows { display: flex; flex-wrap: wrap; gap: 1.6rem; margin-bottom: .65rem; }
.balance-flows span { display: block; font-size: .8rem; color: var(--muted); }
.balance-flows strong { font-size: .98rem; font-variant-numeric: tabular-nums; }
.flow-in { color: #15613e; }
.flow-out { color: var(--red-dark); }
.balance-side { display: grid; gap: .75rem; justify-items: end; }
.channel-tags { display: flex; flex-wrap: wrap; gap: .45rem; }

.metrics.kpi-five { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.2rem; align-items: start; }
.split-grid > * { min-width: 0; }
.card-pad { padding: 1.25rem 1.35rem; display: grid; gap: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: .75rem; }
.card-head p { font-size: .84rem; color: var(--muted); margin-top: .2rem; }

.leaderboard-list { display: grid; gap: .5rem; }
.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .62rem .8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-size: .88rem;
}
.lb-row.me { background: #fdf3f1; border-color: #ebc3bc; }
.lb-rank { color: var(--red-dark); font-weight: 650; margin-right: .6rem; }

.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { width: 100%; height: 220px; display: block; }

.mini-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem .9rem;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.mini-balance strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

.api-docs { gap: 1.65rem; }
.api-docs-heading { min-width: 0; }
.api-docs-heading p { max-width: 62ch; }
.api-docs-layout, .settings-layout { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: clamp(1rem, 2.35vw, 1.8rem); align-items: start; }
.api-docs-nav, .settings-nav { position: sticky; top: 5.25rem; display: grid; min-width: 0; gap: .1rem; border-left: 1px solid var(--line); }
.api-docs-nav-title { padding: .1rem .75rem .4rem; color: var(--muted); font-size: .77rem; font-weight: 630; }
.api-docs-nav a, .settings-nav a { display: block; padding: .4rem .75rem; color: var(--muted); font-size: .88rem; }
.api-docs-nav a:hover, .api-docs-nav a:focus-visible, .settings-nav a:hover, .settings-nav a:focus-visible { color: var(--red-dark); text-decoration: underline; text-underline-offset: .22em; }
.api-docs-content { display: grid; min-width: 0; gap: 1rem; }
.api-docs-card { min-width: 0; display: grid; gap: .75rem; padding: clamp(1rem, 2.1vw, 1.45rem); border: 1px solid var(--line); border-radius: 10px; background: var(--white); scroll-margin-top: 5.2rem; }
.api-docs-key { background: #fcf4ef; border-color: #e8d5ca; }
.api-docs-section-head { display: grid; gap: .45rem; min-width: 0; }
.api-docs-card h2 { color: var(--ink); font-size: clamp(1.03rem, 2.1vw, 1.22rem); line-height: 1.25; font-weight: 630; letter-spacing: -.03em; }
.api-docs-card p { max-width: 67ch; color: var(--muted); font-size: .88rem; }
.api-docs-key-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.api-docs-route { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; min-width: 0; color: var(--ink); font-size: .85rem; overflow-wrap: anywhere; }
.api-docs-method { display: inline-flex; align-items: center; padding: .17rem .38rem; border-radius: 4px; background: #eee9fc; color: #4e347e; font-size: .71rem; font-weight: 700; letter-spacing: .025em; }
.api-docs-method[data-method="get"] { background: #e4f2e9; color: #1b603f; }
.api-docs-example { min-width: 0; overflow: hidden; border: 1px solid #343431; border-radius: 7px; background: #242422; color: #f5f2eb; }
.api-docs-example-bar { display: flex; justify-content: space-between; align-items: center; gap: .65rem; padding: .36rem .65rem .36rem .86rem; border-bottom: 1px solid #494845; color: #e5dfd3; font-size: .77rem; }
.api-docs-example-bar .button { min-height: 31px; padding: .3rem .6rem; border-color: #68635b; background: transparent; color: #f5f2eb; font-size: .75rem; }
.api-docs-example-bar .button:hover { background: #46433e; }
.api-docs-example pre { margin: 0; min-width: 0; overflow-x: auto; padding: .8rem .9rem 1rem; color: inherit; background: transparent; font-size: .78rem; line-height: 1.65; }

.portal-settings { gap: 1.6rem; }
.settings-content, .settings-profile-form { display: grid; min-width: 0; gap: 1rem; }
.settings-card { display: grid; min-width: 0; gap: 1rem; padding: clamp(1.05rem, 2.2vw, 1.65rem); scroll-margin-top: 5.2rem; }
.settings-card-heading { display: grid; gap: .28rem; min-width: 0; }
.settings-card-heading h2 { line-height: 1.25; }
.settings-card-heading p { max-width: 62ch; }
.settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.settings-fields label, .settings-logo-controls label, .settings-integration-form > label, .settings-card > .link-field { display: grid; gap: .26rem; color: var(--muted); font-size: .83rem; font-weight: 550; }
.settings-card :is(input:not([type="checkbox"], [type="radio"]), .link-field input) { width: 100%; min-width: 0; min-height: 42px; padding: .56rem .68rem; border: 1px solid #d6d6d0; border-radius: 6px; background: var(--white); color: var(--ink); font-size: .9rem; }
.settings-card input[readonly] { background: var(--field); font-family: ui-monospace, Consolas, monospace; }
.settings-card input::placeholder { color: #73746e; }
.settings-card-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.settings-logo-editor { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: .9rem; align-items: start; }
.settings-logo-preview { display: grid; place-items: center; width: 62px; aspect-ratio: 1; padding: .4rem; border: 1px solid #e8d5ca; border-radius: 8px; background: #fcf4ef; color: var(--red-dark); font-weight: 650; }
.settings-logo-preview img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.settings-logo-controls { display: grid; min-width: 0; gap: .42rem; }
.settings-card input[type="file"] { font-size: .8rem; min-height: 40px; }
.settings-card input[type="file"]::file-selector-button { margin-right: .45rem; border: 0; background: var(--field); border-radius: 4px; padding: .22rem .36rem; color: var(--ink); font: inherit; cursor: pointer; }
.settings-identity { margin: 0; }
.settings-identity > div { border-top: 1px solid var(--line); }
.settings-fee-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.settings-fee-option { display: flex; gap: .6rem; align-items: start; padding: .8rem; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.settings-fee-option:has(:checked) { border-color: #bd7769; background: #fcf4ef; }
.settings-fee-option:has(:focus-visible) { outline: 2px solid #1d5fbf; outline-offset: 3px; }
.settings-fee-option input, .settings-switch { accent-color: var(--red-dark); }
.settings-fee-option input { width: 1rem; height: 1rem; margin: .18rem 0 0; flex-shrink: 0; }
.settings-fee-copy { display: grid; gap: .18rem; line-height: 1.4; }
.settings-fee-copy strong { font-size: .88rem; }
.settings-fee-copy span { color: var(--muted); font-size: .8rem; }
.settings-status { padding: .52rem .65rem; border-left: 2px solid #d2aaa0; background: #f8f5f1; overflow-wrap: anywhere; }
.settings-toggle-row { display: flex; justify-content: space-between; gap: .7rem; align-items: center; padding: .65rem .75rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; font-size: .9rem; }
.settings-switch { width: 1.12rem; height: 1.12rem; margin: 0; flex-shrink: 0; }
.settings-integration-form, .settings-secret-row, .settings-deliveries { display: grid; min-width: 0; gap: .54rem; }
.settings-deliveries { padding-top: .85rem; border-top: 1px solid var(--line); }
.settings-deliveries .settings-card-heading { display: flex; justify-content: space-between; gap: .5rem; align-items: center; }
.settings-deliveries h3 { font-size: .92rem; font-weight: 630; }
.settings-deliveries th, .settings-deliveries td { padding-inline: .45rem; }
.settings-deliveries table { min-width: 480px; }
.settings-delivery-state { display: inline-flex; align-items: center; padding: .14rem .35rem; border-radius: 4px; background: #eeefed; color: #525550; font-size: .75rem; white-space: nowrap; }
.settings-delivery-state[data-status="delivered"] { background: #e4f2e9; color: #15613e; }
.settings-delivery-state[data-status="failed"] { background: #fae8e4; color: #8d2419; }

.status[data-status='completed'] { background: #e4f2e9; color: #15613e; }
.status[data-status='rejected'] { background: #fae8e4; color: #8d2419; }

@media (max-width: 1050px) {
  .metrics.kpi-five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics.kpi-five div:nth-child(odd) { border-left: 0; }
  .metrics.kpi-five div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 74rem) {
  .invoice-grid { min-width: 0; }
  .invoice-grid .invoice-extra { display: none; }
}

@media (max-width: 42rem) {
  #invoice-table { display: none; }
  .invoice-cards { display: grid; }
}

@media (max-width: 28rem) {
  [data-view-panel="transactions"] .filters { flex-direction: column; align-items: stretch; }
  [data-view-panel="transactions"] .filters .search,
  [data-view-panel="transactions"] .filters select { width: 100%; }
}

@media (max-width: 980px) {
  #portal-shell { --portal-rail: 180px; }
  .api-docs-layout, .settings-layout { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
  .api-docs-nav, .settings-nav { position: static; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .65rem; border-left: 0; border-bottom: 1px solid var(--line); padding: 0 0 .65rem; }
  .api-docs-nav-title, .api-docs-nav a, .settings-nav a { padding: .2rem 0; }
  .api-docs-nav-title { margin-right: .18rem; }
}

@media (max-width: 820px) {
  .live-chip { display: none; }
  .balance-side { justify-items: start; }
}

@media (max-width: 700px) {
  #portal-shell { --portal-rail: 0px; --portal-gutter: 1rem; }
  .app-shell .portal-topbar-wrap { min-height: 63px; gap: .45rem; }
  .topbar-brand-group { position: static; min-height: 0; width: auto; padding: 0; gap: .48rem; background: transparent; }
  .topbar-brand-group .wordmark { color: var(--ink); font-size: 1.06rem; }
  .portal-header-title { display: none; }
  .topbar-meta { gap: .3rem; }
  .topbar-meta #avatar-slug { display: none; }
  .topbar-meta .avatar-chip { padding: 3px; }
  .topbar-meta #logout-btn { padding-inline: .5rem; }
  .mobile-only { display: inline-flex; }
  .portal-nav { position: absolute; inset: calc(100% + .3rem) var(--portal-gutter) auto; width: auto; max-height: calc(100dvh - 5.5rem); display: none; padding: .5rem; scroll-padding-top: .5rem; border: 1px solid var(--line); border-radius: 9px; background: var(--white); box-shadow: 0 10px 26px #241a131a; }
  .portal-nav.open { display: flex; }
  .portal-nav .nav-pill { color: var(--ink); }
  .portal-nav .nav-pill:hover { background: var(--field); }
  .portal-nav .nav-pill.active { background: #fcf4ef; border-color: #e8d5ca; color: var(--red-dark); }
  .portal-nav .nav-pill:focus-visible { outline-color: #1d5fbf; }
  .portal-environment-note { border-left: 0; padding-left: 0; }
  .api-docs { gap: 1rem; }
  .api-docs-card { scroll-margin-top: 4.7rem; }
}

@media (max-width: 475px) {
  .portal-view > .workspace-title { flex-direction: column; align-items: flex-start; gap: .7rem; }
  .settings-fields, .settings-fee-options { grid-template-columns: minmax(0, 1fr); }
  .settings-layout, .portal-settings { gap: .9rem; }
  .settings-card { scroll-margin-top: 4.7rem; }
}

@media (max-width: 375px) {
  [data-page="home"] .topbar { gap: .35rem .5rem; }
  [data-page="home"] .topbar .wordmark { font-size: 1.06rem; }
  [data-page="home"] .nav-action { padding-inline: .48rem; font-size: .78rem; }
  [data-page="home"] .topnav { flex-wrap: wrap; gap: .05rem .8rem; }
  .topbar-meta .avatar-chip { display: none; }
  .auth-card .button { white-space: normal; text-align: center; }
  #menu-toggle { width: 42px; min-width: 42px; padding: 0; font-size: 0; }
  #menu-toggle::before { content: ''; width: 15px; height: 2px; background: currentColor; box-shadow: 0 -5px currentColor, 0 5px currentColor; }
}
