/*
 * HPAY people tools: the pay page (/pay/@name), Split a bill, Statements and the Pay with HPAY button page.
 * base.css tokens only (ink, line, red, fg, ok, warn, display, body, mono), the same black and red as the rest of Biome, and the
 * form controls of paylink.css (.pl-input, .pl-label, .pl-help, .pl-error, .pl-success). Nothing new in the palette or the fonts.
 *
 * Spacing is a 4/8 scale and type is a small scale, both declared once on .ht-page. One accent (red) marks the primary action and the
 * live state; green, amber and red are used for status only. Every number that lines up uses tabular figures.
 */
.ht-page {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --t-xs: 11px; --t-sm: 12px; --t-base: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 28px;
  --ease: cubic-bezier(.2, 0, .2, 1);
  padding-block: clamp(20px, 4vw, 40px) var(--s7);
  font-variant-numeric: tabular-nums;
}
.ht-wrap { max-width: 1240px; margin: 0 auto; padding-inline: var(--pad); }
.ht-wrap--pay { max-width: 1120px; }
.ht-wrap--doc { max-width: 1120px; }
.ht-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ht-link { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; overflow-wrap: anywhere; }
.ht-link:hover { text-decoration-color: var(--red-hi); }
.ht-muted { color: var(--fg-2); }
.ht-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- header ------------------------------------------------------------------------------------------------------ */
.ht-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; margin-bottom: var(--s5); }
.ht-title { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.ht-mark { color: var(--red); display: inline-flex; flex: none; line-height: 0; }
.ht-head h1 { font: 700 clamp(32px, 5vw, 54px)/1.02 var(--display); letter-spacing: -0.03em; margin: 2px 0 0; overflow-wrap: anywhere; }
.ht-head .eyebrow { margin-bottom: var(--s2); }
.ht-head .lede { margin-top: var(--s3); max-width: 62ch; }
.ht-badge { display: inline-block; font: 500 var(--t-xs)/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--red); color: var(--red-hi); padding: 3px 6px; margin-left: var(--s2); vertical-align: 1px; }
.ht-head .eyebrow { line-height: 1.5; letter-spacing: .2em; }
.ht-mark svg { display: block; }

/* ---- the strip under the header: the live line, the network, the wallet --------------------------------------------- */
.ht-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); border-block: 1px solid var(--line-2); padding: 10px 0; font: var(--t-sm)/1.5 var(--mono); color: var(--fg-2); }
.ht-strip p { margin: 0; overflow-wrap: anywhere; }
.ht-live { display: inline-flex; align-items: center; gap: var(--s2); color: var(--fg-3); }
.ht-live::before { content: ''; width: 8px; height: 8px; background: currentColor; flex: none; }
.ht-live[data-health="live"] { color: var(--ok); }
.ht-live[data-health="stale"] { color: var(--warn); }
.ht-live[data-health="offline"] { color: var(--red-hi); }
.ht-strip .ht-end { margin-left: auto; }

/* ---- the workspace: panels side by side, divided by hairlines ------------------------------------------------------- */
.ht-grid { display: grid; grid-template-columns: var(--cols, 1fr); border: 1px solid var(--line-2); margin-top: var(--s5); background: rgba(17, 12, 14, .55); }
.ht-grid--pay { --cols: minmax(0, 1.25fr) minmax(300px, .85fr); grid-template-areas: "pay share" "pay activity"; grid-template-rows: auto 1fr; }
.ht-grid--pay > :nth-child(1) { grid-area: pay; }
.ht-grid--pay > :nth-child(2) { grid-area: share; }
.ht-grid--pay > :nth-child(3) { grid-area: activity; border-top: 1px solid var(--line-2); }
.ht-grid--split { --cols: minmax(320px, 1fr) minmax(0, 1.7fr) minmax(260px, .85fr); }
.ht-grid--statement { --cols: minmax(280px, .8fr) minmax(0, 2.6fr); grid-template-areas: "read pay" "notes pay"; grid-template-rows: auto 1fr; }
.ht-grid--statement > :nth-child(1) { grid-area: read; }
.ht-grid--statement > :nth-child(2) { grid-area: pay; }
.ht-grid--statement > :nth-child(3) { grid-area: notes; border-left: 0; border-top: 1px solid var(--line-2); }
.ht-grid--solo { --cols: minmax(0, 1fr); grid-template-areas: none; grid-template-rows: none; }
.ht-grid--solo > :nth-child(n) { grid-area: auto; border-left: 0; border-top: 0; }
.ht-grid--button { --cols: minmax(300px, .85fr) minmax(0, 1.5fr); grid-template-areas: "req try" "req code"; grid-template-rows: auto 1fr; }
.ht-grid--button > :nth-child(1) { grid-area: req; }
.ht-grid--button > :nth-child(2) { grid-area: try; }
.ht-grid--button > :nth-child(3) { grid-area: code; border-top: 1px solid var(--line-2); }
.ht-panel { padding: var(--s5); min-width: 0; }
.ht-panel + .ht-panel { border-left: 1px solid var(--line-2); }
.ht-panel > h2, .ht-panel-head h2 { font: 500 17px/1.2 var(--display); letter-spacing: -0.01em; margin: 0 0 var(--s4); }
.ht-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.ht-panel-head h2 { margin: 0; }
.ht-sub { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--line); }
.ht-sub > h3 { font: 500 var(--t-xs)/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 var(--s3); }
.ht-note { font-size: var(--t-sm); line-height: 1.6; color: var(--fg-2); margin: var(--s2) 0 0; overflow-wrap: anywhere; }
.ht-note b { color: var(--fg); font-weight: 600; }
.ht-tabs { display: none; border-bottom: 1px solid var(--line-2); margin-top: var(--s5); }
.ht-tabs button { flex: 1; min-height: 48px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--fg-2); font: 500 var(--t-base) var(--body); cursor: pointer; }
.ht-tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--red); }
.ht-tabs:not([hidden]) { display: flex; }

/* ---- fields ---------------------------------------------------------------------------------------------------- */
.ht-field { margin-bottom: var(--s4); }
.ht-field .pl-label { margin-bottom: var(--s2); }
.ht-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3); align-items: end; }
.ht-input-wrap { position: relative; }
.ht-input-wrap > .ht-affix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--fg-3); font: 600 16px var(--mono); pointer-events: none; }
.ht-input-wrap > .pl-input.has-affix { padding-left: 30px; }
.ht-big-input { font: 600 20px/1.2 var(--mono) !important; min-height: 52px; }
.ht-btn-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.ht-btn-row .btn { flex: 1 1 140px; justify-content: center; min-height: 44px; }
.ht-panel-head .ht-btn-row .btn { flex: 0 0 auto; }
.ht-btn-row .btn.ht-small { min-height: 36px; }
.btn.ht-small { min-height: 36px; padding: 8px 12px; font-size: var(--t-sm); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.ht-primary { width: 100%; justify-content: center; min-height: 52px; font-size: var(--t-md); margin-top: var(--s3); }
.ht-reason { min-height: 20px; margin: var(--s2) 0 0; font-size: var(--t-sm); color: var(--fg-2); }
.ht-reason[data-tone="error"] { color: #ff8a8a; }

/* chips and the dollar / QUAI switch */
.ht-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.ht-chip { min-height: 48px; min-width: 68px; padding: 0 var(--s4); border: 1px solid var(--line-2); background: transparent; color: var(--fg); border-radius: 11px; font: 600 18px var(--display); cursor: pointer; transition: border-color .18s, background .18s; font-variant-numeric: tabular-nums; }
.ht-chip:hover { border-color: var(--red-hi); }
.ht-chip[aria-pressed="true"] { border-color: var(--red); background: rgba(229, 36, 59, .14); color: #fff; }
.ht-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 11px; overflow: hidden; }
.ht-seg button { min-height: 44px; min-width: 56px; padding: 0 var(--s3); border: 0; background: transparent; color: var(--fg-2); font: 600 var(--t-base) var(--mono); cursor: pointer; }
.ht-seg button + button { border-left: 1px solid var(--line-2); }
.ht-seg button[aria-pressed="true"] { background: var(--ink-700); color: var(--fg); }

/* the price under the amount */
.ht-price { margin: var(--s4) 0 0; padding-top: var(--s3); border-top: 1px solid var(--line); min-height: 64px; font: var(--t-base)/1.5 var(--mono); color: var(--fg-2); }
.ht-price strong { display: block; font: 700 clamp(24px, 3.4vw, 32px)/1.1 var(--display); letter-spacing: -0.02em; color: var(--fg); overflow-wrap: anywhere; }
.ht-price small { display: block; margin-top: var(--s1); font-size: var(--t-sm); color: var(--fg-3); }
.ht-price[data-state="expired"] strong, .ht-price[data-state="refused"] strong { color: var(--fg-3); }
.ht-price[data-state="empty"] strong { font-size: 18px; color: var(--fg-2); font-weight: 500; letter-spacing: 0; }
.ht-price .ht-btn-row { margin-top: var(--s3); }

/* ---- who: the ring, the name, the address --------------------------------------------------------------------------- */
.ht-who { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s5); align-items: center; padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--line); }
.ht-ring { display: block; flex: none; }
.ht-ring .d { transition: opacity .4s var(--ease), transform .4s var(--ease); transition-delay: calc(var(--i) * 12ms); transform-box: fill-box; transform-origin: center; }
.ht-ring[data-lit="false"] .d { opacity: .14; transform: scale(.6); }
.ht-ring .d.dim { fill: rgba(255, 190, 190, .32); }
.ht-ring .d.on { fill: var(--fg-2); }
.ht-ring .d.hot { fill: var(--red-hi); }
.ht-ring-initial { font: 700 34px var(--display); fill: var(--fg); letter-spacing: -0.02em; }
.ht-ring--ghost .d { fill: none; stroke: var(--line-2); stroke-width: .6; }
.ht-name { font: 700 clamp(34px, 6vw, 60px)/1 var(--display); letter-spacing: -0.035em; margin: 0; overflow-wrap: anywhere; }
.ht-name small { font-size: .38em; color: var(--fg-3); font-weight: 500; letter-spacing: 0; }
.ht-addr { margin: var(--s3) 0 0; font: var(--t-sm)/1.5 var(--mono); color: var(--fg-2); }
.ht-addr code { display: block; font: inherit; color: var(--fg); overflow-wrap: anywhere; }
.ht-addr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s2); }
.ht-addr-actions .ht-link { font-size: var(--t-sm); }
.ht-h3 { font: 500 17px/1.2 var(--display); margin: 0 0 var(--s3); }
.ht-top { margin-top: var(--s4); }
.ht-top-sm { margin-top: var(--s3); }
.ht-flush { margin-top: 0; }
.ht-action { margin-top: var(--s3); }
.ht-resolved { margin: var(--s2) 0 0; font: var(--t-sm)/1.5 var(--mono); color: var(--ok); display: flex; align-items: baseline; gap: var(--s2); }
.ht-resolved::before { content: ''; width: 7px; height: 7px; background: currentColor; flex: none; transform: translateY(-1px); }
.ht-looking { margin: var(--s2) 0 0; font-size: var(--t-sm); color: var(--fg-2); }
.ht-looking::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: var(--s2); background: var(--red); animation: ht-blink 1s steps(2, jump-none) infinite; }
@keyframes ht-blink { 50% { opacity: .2; } }
.ht-trust { margin: 0 0 var(--s5); padding: var(--s3) var(--s4); border-left: 3px solid var(--red); background: rgba(229, 36, 59, .06); font-size: var(--t-base); line-height: 1.6; color: var(--fg); }

/* ---- the wallet ------------------------------------------------------------------------------------------------- */
.ht-wallet { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.ht-wallet dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--s4); margin: 0 0 var(--s3); font: var(--t-sm)/1.6 var(--mono); }
.ht-wallet dt { color: var(--fg-3); }
.ht-wallet dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ---- the steps of a payment --------------------------------------------------------------------------------------- */
.ht-steps { list-style: none; margin: var(--s5) 0 0; padding: var(--s4) 0 0; border-top: 1px solid var(--line); display: grid; gap: var(--s3); }
.ht-step { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--s3); align-items: start; color: var(--fg-3); font-size: var(--t-base); line-height: 1.4; }
.ht-step::before { content: ''; width: 9px; height: 9px; margin-top: 5px; border: 1px solid var(--line-2); }
.ht-step[data-state="active"] { color: var(--fg); }
.ht-step[data-state="active"]::before { background: var(--red); border-color: var(--red); }
.ht-step[data-state="done"] { color: var(--fg-2); }
.ht-step[data-state="done"]::before { background: var(--ok); border-color: var(--ok); }
.ht-step[data-state="error"] { color: #ff8a8a; }
.ht-step[data-state="error"]::before { background: var(--red-hi); border-color: var(--red-hi); }
.ht-step small { display: block; color: var(--fg-3); font: var(--t-sm)/1.5 var(--mono); overflow-wrap: anywhere; }
.ht-outcome { margin: var(--s4) 0 0; padding: var(--s3) var(--s4); border: 1px solid var(--line-2); font-size: var(--t-base); line-height: 1.6; }
.ht-outcome[data-tone="ok"] { border-color: rgba(74, 222, 128, .4); color: var(--ok); background: rgba(74, 222, 128, .07); }
.ht-outcome[data-tone="error"] { border-color: rgba(196, 30, 58, .5); color: #ff8a8a; background: rgba(196, 30, 58, .1); }
.ht-outcome[data-tone="info"] { color: var(--fg-2); }
.ht-details { margin-top: var(--s5); border-top: 1px solid var(--line); }
.ht-details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font: var(--t-sm) var(--mono); color: var(--fg-2); }
.ht-details[open] > summary { color: var(--fg); }
.ht-details > summary::after { content: ''; width: 6px; height: 6px; margin: -3px 0 0 var(--s3); border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg); transition: transform .18s var(--ease); }
.ht-details[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.ht-details pre { margin: 0 0 var(--s3); padding: var(--s3); background: var(--ink-950); border: 1px solid var(--line-2); font: var(--t-sm)/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- sharing: the QR code and the card ---------------------------------------------------------------------------- */
.ht-share-qr { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); align-items: center; }
.ht-share-qr .pl-qr-plate { padding: 8px; }
.ht-share-qr .pl-qr-plate canvas { width: 148px; height: 148px; }
.ht-card-preview { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; border: 1px solid var(--line-2); background: var(--ink-950); margin-top: var(--s4); }

/* ---- lists and tables ---------------------------------------------------------------------------------------------- */
.ht-feed { list-style: none; margin: 0; padding: 0; font: var(--t-sm)/1.6 var(--mono); }
.ht-feed li { padding: var(--s3) 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.ht-feed time { display: block; color: var(--fg-3); font-size: var(--t-xs); letter-spacing: .04em; }
.ht-empty { padding: var(--s5) 0; color: var(--fg-2); font-size: var(--t-base); line-height: 1.6; }
.ht-empty strong { display: block; color: var(--fg); font: 600 var(--t-md) var(--display); margin-bottom: var(--s1); }
.ht-table-wrap { overflow-x: auto; }
.ht-table { width: 100%; border-collapse: collapse; font: var(--t-sm)/1.5 var(--mono); }
.ht-table th { text-align: left; font-weight: 400; color: var(--fg-3); padding: 0; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.ht-table th button { all: unset; box-sizing: border-box; cursor: pointer; min-height: 44px; padding: 0 var(--s2) 0 0; display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.ht-table th button:hover, .ht-table th[aria-sort] button { color: var(--fg); }
.ht-table th button:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.ht-table th.num, .ht-table td.num { text-align: right; }
.ht-table th.num button { padding: 0 0 0 var(--s2); }
.ht-table td { padding: var(--s3) var(--s2) var(--s3) 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.ht-table td.num { padding-right: 0; padding-left: var(--s2); white-space: nowrap; }
.ht-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.ht-table td small { display: block; color: var(--fg-3); font-size: var(--t-xs); margin-top: 2px; }
.ht-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s4); font-size: var(--t-sm); color: var(--fg-2); }

/* the amount, with its tag lit */
.ht-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ht-tag { color: var(--red-hi); font-weight: 600; }
[data-state="paid"] .ht-tag { color: var(--ok); }

/* status chips: colour is only ever status */
.ht-status { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--t-xs)/1 var(--body); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border: 1px solid currentColor; color: var(--fg-3); white-space: nowrap; }
.ht-status::before { content: ''; width: 6px; height: 6px; background: currentColor; }
.ht-status[data-state="paid"], .ht-status[data-state="ok"] { color: var(--ok); }
.ht-status[data-state="confirming"], .ht-status[data-state="unreadable"], .ht-status[data-state="warn"] { color: var(--warn); }
.ht-status[data-state="needs-look"], .ht-status[data-state="bad"] { color: var(--red-hi); }

/* progress and the daily chart */
.ht-progress { margin: var(--s2) 0 var(--s4); }
.ht-progress svg { display: block; width: 100%; height: 10px; }
.ht-progress .track { fill: var(--ink-700); }
.ht-progress .fill { fill: var(--ok); transition: width .5s var(--ease); }
.ht-progress p { margin: var(--s2) 0 0; font: var(--t-sm)/1.5 var(--mono); color: var(--fg-2); }
.ht-progress p b { color: var(--fg); font-weight: 600; }
.ht-chart { margin: var(--s4) 0; }
/* one slot per day; a bar never grows wider than 32 px, so a short period is not a few fat blocks */
.ht-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: 120px; border-bottom: 1px solid var(--line-2); }
.ht-bar-slot { display: flex; align-items: flex-end; justify-content: center; min-width: 0; padding-inline: var(--gap, 1px); }
.ht-bar { width: 100%; max-width: 32px; height: var(--h); min-height: 2px; background: var(--red); }
.ht-bar-slot:hover .ht-bar { background: var(--red-hi); }

/* stat blocks */
.ht-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); margin: 0 0 var(--s5); padding: 0 0 var(--s4); border-bottom: 1px solid var(--line); }
.ht-stat dt { font: 500 var(--t-xs)/1.3 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); margin: 0 0 var(--s1); }
.ht-stat dd { margin: 0; font: 700 clamp(18px, 2.4vw, 26px)/1.15 var(--display); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ht-stat dd .ht-unit { font: 500 var(--t-sm)/1 var(--mono); letter-spacing: 0; color: var(--fg-3); }
.ht-stat dd small { display: block; margin-top: 2px; font: var(--t-xs)/1.4 var(--mono); color: var(--fg-3); letter-spacing: 0; }

/* code blocks */
.ht-code { position: relative; margin: 0 0 var(--s4); background: var(--ink-950); border: 1px solid var(--line-2); }
.ht-code .ht-code-title { display: block; padding: var(--s3) 96px var(--s2) var(--s4); font: var(--t-xs)/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.ht-code .btn { position: absolute; top: var(--s2); right: var(--s2); }
.ht-code pre { margin: 0; padding: var(--s2) var(--s4) var(--s4); font: var(--t-sm)/1.7 var(--mono); overflow-x: auto; white-space: pre; tab-size: 2; }
.ht-code code { font: inherit; }
.ht-log { list-style: none; margin: 0; padding: 0; font: var(--t-sm)/1.6 var(--mono); }
.ht-log li { padding: var(--s2) 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--s3); overflow-wrap: anywhere; }
.ht-log li::before { content: ''; width: 8px; height: 8px; margin-top: 6px; background: var(--ok); }
.ht-log li > span { min-width: 0; }
.ht-log-time { display: block; color: var(--fg-3); font-size: var(--t-xs); letter-spacing: .04em; }
.ht-log li[data-state="bad"]::before { background: var(--red-hi); }
.ht-log li[data-state="wait"]::before { background: var(--warn); }

/* toasts */
.ht-toasts { position: fixed; right: var(--s4); bottom: var(--s4); display: grid; gap: var(--s2); z-index: 60; max-width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.ht-toast { margin: 0; padding: 10px 14px; background: var(--ink-800); border-left: 3px solid var(--red); font-size: var(--t-base); line-height: 1.5; box-shadow: 0 8px 30px -12px rgba(0, 0, 0, .8); }
.ht-toast[data-tone="ok"] { border-left-color: var(--ok); }
.ht-toast[data-tone="error"] { border-left-color: var(--red-hi); color: #ffb0b0; }

/* dialog */
.ht-dialog { color: var(--fg); background: var(--ink-850); border: 1px solid var(--line-2); border-radius: var(--r); padding: var(--s5); width: min(480px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; }
.ht-dialog::backdrop { background: rgba(0, 0, 0, .75); }
.ht-dialog h2 { font: 500 17px var(--display); margin: 0 0 var(--s3); }
.ht-dialog .pl-qr-wrap { margin: var(--s4) 0; }

/* people rows in the split form */
.ht-people { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.ht-person { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: var(--s2); align-items: center; }
.ht-person .pl-input { min-height: 44px; }
.ht-person .btn { min-height: 44px; min-width: 44px; padding: 0; justify-content: center; }
.ht-me { display: flex; align-items: center; gap: var(--s3); min-height: 44px; font-size: var(--t-base); cursor: pointer; }
.ht-me input { width: 20px; height: 20px; accent-color: var(--red); }
.ht-sum { margin: var(--s3) 0; padding: var(--s3) 0; border-block: 1px solid var(--line); font: var(--t-sm)/1.7 var(--mono); color: var(--fg-2); }
.ht-sum b { color: var(--fg); font-weight: 600; }

/* the person who gets paid, as the form shows them */
.ht-payee { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); align-items: center; margin-top: var(--s3); padding: var(--s3); border: 1px solid rgba(74, 222, 128, .3); }
.ht-payee strong { display: block; font: 600 var(--t-md) var(--display); }
.ht-payee code { display: block; font: var(--t-xs)/1.5 var(--mono); color: var(--fg-2); overflow-wrap: anywhere; }
.ht-notelist { margin: var(--s2) 0 0; padding-left: var(--s4); }
.ht-warn { margin-top: var(--s1); color: var(--warn); }
.ht-fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
.ht-fieldset legend { padding: 0; }
.ht-feed--plain { font: inherit; }
.ht-ledger-note { margin-top: 0; }

/* a share's row on the split board */
.ht-share { padding: var(--s4) 0; border-bottom: 1px solid var(--line); display: grid; gap: var(--s2); }
.ht-share-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.ht-share-who { font: 600 var(--t-md) var(--display); }
.ht-share-who small { font: var(--t-sm) var(--mono); color: var(--fg-3); margin-left: var(--s2); font-weight: 400; }
.ht-share-amount { font: var(--t-base)/1.5 var(--mono); }
.ht-share-meta { font: var(--t-sm)/1.6 var(--mono); color: var(--fg-3); overflow-wrap: anywhere; }
.ht-share-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s1); }
.ht-share[data-state="paid"] { background: linear-gradient(90deg, rgba(74, 222, 128, .06), transparent 60%); }

/* ---- the button page: the request link, the live button, the check ---------------------------------------------------- */
.ht-linkline { display: block; padding: var(--s3); background: var(--ink-950); border: 1px solid var(--line-2); font: var(--t-sm)/1.6 var(--mono); overflow-wrap: anywhere; color: var(--fg); }
.ht-live-button { min-height: 72px; display: grid; align-items: center; }
.ht-live-button .ht-empty { padding: 0; }
.ht-outcome strong { display: block; font: 600 var(--t-md) var(--display); }
.ht-outcome-line { margin: var(--s1) 0 0; font: var(--t-sm)/1.5 var(--mono); }
.ht-checks { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: 2px; font: var(--t-sm)/1.5 var(--mono); }
.ht-checks li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: var(--s2); align-items: baseline; }
.ht-checks li::before { content: ''; width: 8px; height: 8px; background: var(--line-2); }
.ht-checks li[data-state="yes"]::before { background: var(--ok); }
.ht-checks li[data-state="no"]::before { background: var(--red-hi); }

/* ---- the statement: period chips, dates, the paper-tape table -------------------------------------------------------- */
.ht-chips--period .ht-chip { min-height: 40px; min-width: 0; padding: 0 var(--s3); font: 500 var(--t-base) var(--body); }
.ht-dates { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.ht-dates .pl-input { min-width: 0; }
.ht-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 220px); gap: var(--s3); margin-bottom: var(--s3); }
.ht-toolbar .ht-field { margin-bottom: 0; }
.ht-flushlist { margin-top: 0; }
.ht-subject { margin: 0 0 var(--s4); font: var(--t-sm)/1.6 var(--mono); color: var(--fg-2); overflow-wrap: anywhere; }
.ht-subject > * { display: block; }
.ht-subject strong { font: 600 var(--t-lg)/1.2 var(--display); letter-spacing: -0.01em; color: var(--fg); }
.ht-subject code { font: inherit; color: var(--fg); }
.ht-callout { margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border-left: 3px solid var(--warn); background: var(--ink-850); font-size: var(--t-sm); line-height: 1.6; color: var(--fg); }
.ht-callout p { margin: 0; }
.ht-callout ul { margin: var(--s1) 0 0; padding-left: var(--s4); color: var(--fg-2); }
.ht-chart-axis { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s1); font: var(--t-xs)/1.4 var(--mono); color: var(--fg-3); }
.ht-chart-peak { margin: var(--s1) 0 0; font: var(--t-xs)/1.4 var(--mono); color: var(--fg-3); }
.ht-sources { list-style: none; padding-left: 0; }
.ht-sources li { margin: 0 0 var(--s3); font-size: var(--t-sm); line-height: 1.6; color: var(--fg-2); }
.ht-sources li b { color: var(--fg); font-weight: 600; }
.ht-sources li[data-tone="warn"] { color: var(--warn); }
.ht-sources li[data-tone="warn"] b { color: var(--warn); }
.ht-empty[data-tone="error"] strong { color: #ff8a8a; }
.ht-pager-buttons { display: inline-flex; gap: var(--s2); }

/* sort markers are drawn, not typed, so no font has to carry an arrow */
.ht-table th[aria-sort] button::after { content: ''; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
.ht-table th[aria-sort="ascending"] button::after { border-bottom: 5px solid currentColor; }
.ht-table th[aria-sort="descending"] button::after { border-top: 5px solid currentColor; }

/* the paper tape: a dotted rule between payments and a coloured edge that says what the node found */
.ht-table--tape td { border-bottom: 1px dotted var(--line-2); }
.ht-table--tape th.num, .ht-table--tape td.num { padding-right: var(--s4); }
.ht-table--tape th.num button { padding-left: var(--s3); }
.ht-table--tape tbody tr { --tape: transparent; }
.ht-table--tape tbody tr[data-check="ok"] { --tape: var(--ok); }
.ht-table--tape tbody tr[data-check="warn"] { --tape: var(--warn); }
.ht-table--tape tbody tr[data-check="bad"] { --tape: var(--red-hi); }
.ht-table--tape tbody tr[data-check="none"] { --tape: var(--line-2); }
.ht-table--tape tbody td:first-child { box-shadow: inset 3px 0 0 var(--tape); padding-left: var(--s3); }
.ht-table--tape tbody tr[data-check="bad"] .c-amount, .ht-table--tape tbody tr[data-check="bad"] .c-value:not(.is-empty) { color: var(--fg-3); text-decoration: line-through; }
.ht-table--tape tbody td { white-space: nowrap; }
.ht-table--tape tbody tr.has-note td { border-bottom: 0; padding-bottom: 2px; }
.ht-table--tape .c-note-row td { padding-top: 0; font-size: var(--t-xs); line-height: 1.5; color: var(--fg-3); white-space: normal; }

/* the statement table needs about 830 px, so below 1200 px the form sits above it instead of beside it */
@media (max-width: 1200px) {
  .ht-grid--statement { --cols: minmax(0, 1fr); grid-template-areas: "read" "pay" "notes"; grid-template-rows: auto; }
  .ht-grid--button { --cols: minmax(0, 1fr); grid-template-areas: "req" "try" "code"; grid-template-rows: auto; }
  .ht-grid--button > :nth-child(2) { border-left: 0; border-top: 1px solid var(--line-2); }
  .ht-grid--button > :nth-child(3) { border-left: 0; }
  .ht-grid--statement > :nth-child(2) { border-left: 0; border-top: 1px solid var(--line-2); }
  .ht-dates { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }
}
/* ---- adapting to a phone: one panel at a time, tables as cards, 44 px targets, 16 px text in fields ---------------------- */
@media (max-width: 1100px) {
  .ht-grid--split { --cols: minmax(260px, 1fr) minmax(0, 1.5fr); }
  .ht-grid--split .ht-panel:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line-2); }
  .ht-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .ht-grid { display: block; border: 0; margin-top: 0; background: none; }
  .ht-grid--pay > :nth-child(3) { border-top: 0; }
  .ht-panel { padding: var(--s5) 0; }
  .ht-panel + .ht-panel { border-left: 0; }
  .ht-page .pl-input, .ht-page select, .ht-page textarea { font-size: 16px; }
  .ht-head { margin-bottom: var(--s4); }
  .ht-who { grid-template-columns: auto minmax(0, 1fr); gap: var(--s4); padding-bottom: var(--s4); margin-bottom: var(--s4); }
  .ht-name { font-size: clamp(30px, 9vw, 40px); }
  .ht-trust { font-size: var(--t-sm); padding: var(--s2) var(--s3); margin-bottom: var(--s4); }
  .ht-strip { gap: var(--s1) var(--s4); }
  .ht-strip .ht-end { margin-left: 0; }
  .ht-sticky { position: sticky; bottom: 0; z-index: 5; padding: var(--s3) 0 calc(var(--s3) + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--ink-900) 70%, rgba(11, 7, 8, 0)); }
  .ht-sticky .ht-primary { margin-top: 0; }
  .ht-person { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .ht-table--cards thead { display: none; }
  .ht-table--cards, .ht-table--cards tbody, .ht-table--cards tr, .ht-table--cards td { display: block; width: 100%; }
  .ht-table--cards tr { padding: var(--s3) 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s3); }
  .ht-table--cards td { border: 0; padding: 0; text-align: left; }
  .ht-table--cards td.num { text-align: right; }
  .ht-table--cards td[data-label]::before { content: attr(data-label) ' '; color: var(--fg-3); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; }
  .ht-table--cards td.wide { grid-column: 1 / -1; }
  .ht-grid--statement > :nth-child(2), .ht-grid--statement > :nth-child(3) { border-top: 0; }
  .ht-grid--button > :nth-child(2), .ht-grid--button > :nth-child(3) { border-top: 0; }
  .ht-table--tape tbody tr { grid-template-areas: "when amount" "from value" "kind check" "tx tx"; gap: 6px var(--s3); padding: var(--s3) 0 var(--s3) var(--s3); box-shadow: inset 3px 0 0 var(--tape); border-bottom: 1px dotted var(--line-2); }
  .ht-table--tape tbody td:first-child { box-shadow: none; padding-left: 0; }
  .ht-table--tape td { border-bottom: 0; }
  .ht-table--tape .c-when { grid-area: when; }
  .ht-table--tape .c-from { grid-area: from; }
  .ht-table--tape .c-kind { grid-area: kind; }
  .ht-table--tape .c-amount { grid-area: amount; font-weight: 600; }
  .ht-table--tape .c-value { grid-area: value; }
  .ht-table--tape .c-check { grid-area: check; text-align: right; }
  .ht-table--tape tbody tr.has-note { border-bottom: 0; padding-bottom: var(--s1); }
  .ht-table--tape tbody tr.c-note-row { display: block; padding: 0 0 var(--s3) var(--s3); box-shadow: inset 3px 0 0 var(--tape); border-bottom: 1px dotted var(--line-2); }
  .ht-table--tape .c-note-row td { display: block; padding: 0; }
  .ht-table--tape .c-tx { grid-area: tx; }
  .ht-toolbar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .ht-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .ht-share-qr { grid-template-columns: 1fr; justify-items: start; }
  .ht-chip { flex: 1 1 calc(50% - var(--s2)); }
  .ht-ring { width: 76px; height: 76px; }
  .ht-mark svg { width: 52px; height: auto; }
  .ht-title { gap: var(--s3); align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .ht-ring .d, .ht-progress .fill { transition: none !important; }
  .ht-looking::before { animation: none; }
}

/* ---- touch: on a phone, a tablet or any touch screen every action is a full-size tap target (44 px). A payment in a statement can only be
   opened through its link, so the links are as tall as the buttons. ---- */
@media (max-width: 1024px), (pointer: coarse) {
  .btn.ht-small, .ht-btn-row .btn.ht-small { min-height: 44px; }
  .ht-chips--period .ht-chip { min-height: 44px; }
  .ht-table td a, .ht-table--cards a, .ht-share a, .ht-notelist a, .ht-feed a, .ht-addr-actions a, .ht-outcome a, .ht-payee a { display: inline-flex; align-items: center; min-height: 44px; }
  label.ht-me { display: flex; align-items: center; gap: var(--s2); min-height: 44px; }
  label.ht-me input { flex: none; width: 20px; height: 20px; }
}

/* ---- the inbox: one account page for an address ---------------------------------------------------------------------------
   The Statement's look, asked about both sides of an address: the same tokens, the same paper tape and node-check edge. Nothing new in
   the palette or the fonts. A received payment is a filled square, a sent one a hollow square, a payment to yourself a square with a dot:
   drawn, not typed, and never a colour (colour stays status). */
.ht-grid--inbox { --cols: minmax(0, 1fr); }
.ht-grid--inbox > .ht-panel + .ht-panel { border-left: 0; border-top: 1px solid var(--line-2); }
.ht-grid--facts { --cols: minmax(0, 1.25fr) minmax(0, 1fr); margin-top: var(--s5); }
.ib-side-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--s5) var(--s6); align-items: start; }
.ib-side-grid[data-has="false"] { grid-template-columns: minmax(0, 40rem); }
.ib-side > h2 { margin-bottom: var(--s4); }
.ib-who { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s5); align-items: center; }
.ib-ring { display: inline-flex; line-height: 0; }
.ib-ring svg { display: block; }
.ib-name { margin: 0; font: 700 clamp(26px, 2.8vw, 38px)/1.05 var(--display); letter-spacing: -0.03em; overflow-wrap: anywhere; }
.ib-address { display: block; margin-top: var(--s2); font: var(--t-sm)/1.5 var(--mono); color: var(--fg-2); overflow-wrap: anywhere; }
.ib-own { margin: var(--s2) 0 0; font: 500 var(--t-xs)/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); }
.ib-own[data-own="true"] { color: var(--ok); }
.ib-account-actions { margin: var(--s4) 0 0; }
.ib-account-actions .btn { flex: 0 1 auto; }
.ib-unread-box { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: 0 0 var(--s3); border-bottom: 1px solid var(--line); margin-bottom: var(--s3); }
.ib-unread { margin: 0; display: flex; align-items: center; gap: var(--s2); font: var(--t-sm)/1.5 var(--mono); color: var(--fg-2); }
.ib-unread::before { content: ''; width: 8px; height: 8px; border: 1px solid var(--line-2); flex: none; }
.ib-unread[data-new="true"] { color: var(--fg); }
.ib-unread[data-new="true"]::before { background: var(--red); border-color: var(--red); }
.ib-connect-text { margin: 0 0 var(--s3); font-size: var(--t-base); line-height: 1.6; color: var(--fg-2); }
#ib-connect-panel[hidden], #ib-account[hidden], .ib-unread-box[hidden] { display: none; }
#ib-connect-panel .ht-primary { margin-top: 0; }
.ib-switch > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font: var(--t-sm) var(--mono); color: var(--fg-2); }
.ib-switch[open] > summary { color: var(--fg); }
.ib-form { padding-top: var(--s2); }
.ib-scope { max-width: 78ch; margin-bottom: var(--s4); }
.ib-progress { margin-top: var(--s2); }
.ib-disclosure { margin: 0; font-size: var(--t-sm); line-height: 1.7; color: var(--fg-2); }
.ib-facts { margin: 0; display: grid; gap: var(--s4); }
.ib-facts dt { font: 600 var(--t-base)/1.4 var(--display); color: var(--fg); margin: 0 0 var(--s1); }
.ib-facts dd { margin: 0; font-size: var(--t-sm); line-height: 1.7; color: var(--fg-2); }

/* the tabs over the list */
.ib-tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); margin: var(--s4) 0 var(--s3); }
.ib-tabs[hidden] { display: none; }
.ib-tabs button { min-height: 44px; padding: 0 var(--s4); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--fg-2); font: 500 var(--t-base) var(--body); cursor: pointer; display: inline-flex; align-items: baseline; gap: var(--s2); padding-top: 12px; }
.ib-tabs button:hover { color: var(--fg); }
.ib-tabs button:focus-visible { outline: 2px solid var(--red-hi); outline-offset: -2px; }
.ib-tabs button small { font: var(--t-xs) var(--mono); color: var(--fg-3); }
.ib-tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--red); }

/* the list */
.ib-table { min-width: 0; }
.ib-table .c-dir, .ib-table .c-kind { white-space: nowrap; }
.ib-dir { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 500; color: var(--fg); }
.ib-dir::before { content: ''; width: 9px; height: 9px; flex: none; border: 1px solid var(--fg); box-sizing: border-box; }
.ib-dir[data-direction="received"]::before { background: var(--fg); }
.ib-dir[data-direction="self"]::before { background: radial-gradient(circle, var(--fg) 0 1.5px, transparent 2px); }
.ib-dir[data-direction="sent"]::before { border-color: var(--fg-2); }
.ib-who-cell { display: inline-flex; align-items: center; gap: var(--s2); }
.ib-who-cell svg { flex: none; display: block; }
.ht-page .ib-who-cell .ht-ring { width: 28px; height: 28px; }
.ib-who-cell .ht-link { font-family: var(--mono); }
.ib-copy-btn { all: unset; box-sizing: border-box; cursor: pointer; padding: 2px 6px; border: 1px solid var(--line-2); color: var(--fg-3); font: 500 var(--t-xs)/1.4 var(--body); letter-spacing: .06em; text-transform: uppercase; }
.ib-copy-btn:hover { color: var(--fg); border-color: var(--fg-3); }
.ib-copy-btn:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.ib-copy-btn.is-copied { color: var(--ok); border-color: var(--ok); }
.ib-known { display: inline-block; margin: 4px 4px 0 0; padding: 2px 6px; border: 1px dashed var(--line-2); color: var(--fg-2); font: var(--t-xs)/1.4 var(--body); white-space: normal; max-width: 28ch; overflow-wrap: anywhere; }
.ib-new { display: inline-block; margin-left: var(--s2); padding: 2px 5px; border: 1px solid var(--red); color: var(--red-hi); font: 500 var(--t-xs)/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; vertical-align: 1px; }
.ib-receipt { font-size: var(--t-sm); }
.ib-pager { border-top: 1px solid var(--line); padding-top: var(--s3); }
.ib-pager .btn { flex: none; }

@media (max-width: 1200px) {
  .ht-grid--inbox > :nth-child(2) { border-top: 1px solid var(--line-2); }
  .ht-grid--facts { --cols: minmax(0, 1fr); }
  .ht-grid--facts > :nth-child(2) { border-left: 0; border-top: 1px solid var(--line-2); }
}
@media (max-width: 820px) {
  .ht-grid--inbox > :nth-child(2), .ht-grid--facts > :nth-child(2) { border-top: 0; }
  .ht-grid--facts { margin-top: 0; }
  .ib-side-grid, .ib-side-grid[data-has="false"] { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .ib-who { gap: var(--s3); }
  .ib-name { font-size: clamp(24px, 7vw, 30px); }
  .ib-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .ib-tabs button { flex: 1 0 auto; justify-content: center; padding-inline: var(--s3); }
  .ht-table--tape.ib-table tbody tr[data-hash] { grid-template-areas: "when amount" "dir value" "who who" "kind check" "tx tx"; }
  .ht-table--tape.ib-table .c-when { grid-area: when; }
  .ht-table--tape.ib-table .c-dir { grid-area: dir; }
  .ht-table--tape.ib-table .c-who { grid-area: who; }
  .ht-table--tape.ib-table .c-kind { grid-area: kind; white-space: normal; }
  .ht-table--tape.ib-table .c-amount { grid-area: amount; text-align: right; }
  .ht-table--tape.ib-table .c-value { grid-area: value; text-align: right; }
  .ht-table--tape.ib-table .c-check { grid-area: check; text-align: right; }
  .ht-table--tape.ib-table .c-tx { grid-area: tx; }
  .ib-pager { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .ib-ring svg { width: 76px; height: 76px; }
  .ib-account-actions .btn { flex: 1 1 calc(50% - var(--s2)); }
}
@media (max-width: 1024px), (pointer: coarse) {
  .ib-copy-btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .ib-tabs button { min-height: 48px; }
}
