/* The merchant portal (templates/portal/), from the approved design.

   Palette taken from anypay.pro: white and neutral greys, near-black ink, the
   brand blue #2B7FFF with its #0A71DB -> #3D98F6 gradient, Onest throughout,
   JetBrains Mono for order numbers and ids. Dark follows the system setting.

   Contrast is WCAG AA in both themes (4.5:1 for text, 3:1 for a field's edge).
   The design's light colours are kept for what is not text - a bar, a meter, a
   dot, a focus ring - and text gets the *-text shade of the same hue, a step
   darker where the brand colour is too light to read on white: links, pills,
   the "Test mode" label. Grey text is --muted; --faint is for marks only.

   The portal's CSP refuses inline styles: a page never writes style="" - what
   would go there is a class here. A width that depends on data (a meter, a
   bar) is an SVG attribute (width="..."), which the CSP allows. */

:root {
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --hover: #F5F7FA;
  --line: #E5E5E5;
  --line-strong: #D4D4D4;
  --text: #151515;
  --muted: #6B6B6B;
  --faint: #A3A3A3;
  --accent: #2B7FFF;
  --accent-ink: #FFFFFF;
  --accent-soft: #EAF2FF;
  --accent-text: #1565D8;
  --grad: linear-gradient(to right top, #0A71DB, #3D98F6);
  /* The brand gradient a shade deeper under white button text (4.6:1 at its light end). */
  --grad-button: linear-gradient(to right top, #0A63C4, #1F74DA);
  --field: #8C8C8C;
  --ok: #16A34A;
  --ok-soft: #E8F6EE;
  --ok-text: #157A3A;
  --warn: #B26B00;
  --warn-soft: #FFF4E0;
  --warn-text: #945A00;
  --bad: #E40014;
  --bad-soft: #FDEAEA;
  --bad-text: #C70014;
  --neutral-soft: #F2F2F2;
  --bar: #2B7FFF;
  --bar-dim: #CFE0FF;
  --overlay: rgba(21, 21, 21, 0.35);
  --shadow: 0 1px 2px rgba(21, 21, 21, 0.04), 0 16px 40px -20px rgba(21, 21, 21, 0.25);
  --sans: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  /* A field's focus: the accent edge two pixels thick, the soft halo around it. */
  --ring: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111; --card: #1A1A1A; --hover: #202227; --line: #2A2A2A; --line-strong: #3A3A3A;
    --text: #F5F5F5; --muted: #A3A3A3; --faint: #6B6B6B; --accent: #3D98F6; --accent-ink: #FFFFFF; --accent-soft: #14243A;
    --ok: #4ADE80; --ok-soft: #12291B; --warn: #F5B547; --warn-soft: #2C2210; --bad: #FF5A66; --bad-soft: #331417;
    --neutral-soft: #242424; --bar: #3D98F6; --bar-dim: #1F3550; --overlay: rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 20px 48px -20px rgba(0,0,0,0.7); color-scheme: dark;
    /* On the dark ground the design's colours already read at AA. */
    --accent-text: #3D98F6; --ok-text: #4ADE80; --warn-text: #F5B547; --bad-text: #FF5A66; --field: #6E6E6E;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); padding-inline: 16px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
a { color: var(--accent-text); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
/* A quieter aside ("· by IP"): the muted grey, which still reads at AA. */
.faint { color: var(--muted); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
::placeholder { color: var(--muted); opacity: 1; }

/* "Skip to content": the first stop of Tab, out of sight until it is focused. */
.skip { position: absolute; left: 16px; top: -48px; z-index: 40; background: var(--card); color: var(--accent-text); padding: 8px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; }
.skip:focus { top: 12px; }
main:focus { outline: none; }

.app { max-width: 1120px; margin: 0 auto; padding-block: 20px 64px; }

/* Header */
.top { display: flex; align-items: center; gap: 24px; padding: 6px 0 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand .logo { display: block; flex: none; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 14px; border-radius: 10px; color: var(--muted); font-weight: 500; text-decoration: none; }
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--text); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.mode { font-size: 11px; font-weight: 600; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok-text); }
.mode.test { background: var(--warn-soft); color: var(--warn-text); }
.signout { margin: 0; }
.signout button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; }
.signout button:hover { color: var(--text); background: var(--hover); }

h1 { font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin: 28px 0 18px; }
.head p { margin: 4px 0 0; color: var(--muted); }

.seg { display: inline-flex; background: var(--neutral-soft); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Overview */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .value small { font-size: 15px; color: var(--muted); margin-left: 2px; font-weight: 500; }
.kpi .sub { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.kpi .sub .up { color: var(--ok-text); font-weight: 500; }
.kpi .sub .down { color: var(--bad-text); font-weight: 500; }
.kpi .stack { display: grid; gap: 2px; margin-top: 8px; }
.kpi .stack div { font-size: 19px; line-height: 1.3; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-top: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.panel-head.tight { padding-top: 4px; }
.panel-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.panel-head .hint { color: var(--muted); font-size: 12.5px; }
.panel-head a { color: var(--accent-text); text-decoration: none; font-weight: 500; }
.panel-head a:hover { text-decoration: underline; }
.chart { padding: 6px 10px 12px; }
/* overflow: the axis labels, larger on a phone, may reach left of the viewBox into the padding. */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px var(--sans); fill: var(--muted); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.bar { fill: var(--bar); }
.bar-dim { fill: var(--bar-dim); }
.bar:hover, .bar-dim:hover { opacity: .8; }

.panel-head .tools { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }

/* The merchant's payment accounts as cards (the switch in their panel's head, portal.js) */
.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; padding: 14px 18px 18px; }
.acc { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; min-width: 0; }
.acc.paused { background: var(--neutral-soft); border-style: dashed; }
.acc .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acc .name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.acc .name span.cur { font-size: 12px; color: var(--muted); font-weight: 500; }
.acc .meter { display: grid; gap: 6px; }
.acc .meter .nums { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.acc .meter .nums b { font-weight: 600; font-variant-numeric: tabular-nums; }
.acc .meter .nums span { color: var(--muted); font-variant-numeric: tabular-nums; }
.acc.paused .track { background: var(--line); }
.acc dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 12.5px; }
.acc dt { color: var(--muted); }
.acc dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.acc .why { font-size: 12.5px; color: var(--muted); }

/* The merchant's payment accounts: one row each, the day's limit the widest column */
/* Positioned so it is the containing block of the .sr-only country names in its
   rows: otherwise those absolute spans escape its scroll and widen the page. */
.acc-list { position: relative; padding: 6px 0 8px; overflow-x: auto; }
.acc-list .r { display: grid; grid-template-columns: minmax(120px, 1.1fr) 108px minmax(220px, 2.2fr) minmax(130px, 1.2fr) 96px 92px; align-items: center; gap: 0 16px; padding: 12px 18px; border-top: 1px solid var(--line); min-width: 860px; }
.acc-list .r.h { border-top: 0; padding-block: 6px 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.acc-list .r.paused { background: var(--neutral-soft); }
.acc-list .r.paused .dim { color: var(--muted); }
.acc-list .nm { font-weight: 600; font-size: 14.5px; display: flex; align-items: baseline; gap: 8px; }
.acc-list .nm span { font-size: 12px; color: var(--muted); font-weight: 500; }
.acc-list .day { display: grid; gap: 6px; }
.acc-list .day .nums { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.acc-list .day .nums b { font-weight: 600; }
.acc-list .day .nums span { color: var(--muted); }
.acc-list .day .note { font-size: 12px; color: var(--muted); }
.acc-list .r.paused .track { background: var(--line); }
.acc-list .c { font-size: 13px; font-variant-numeric: tabular-nums; }
.acc-list .c.muted { color: var(--muted); }

/* A meter: <svg class="track" viewBox="0 0 100 6" preserveAspectRatio="none"><rect class="fill" width="42" height="6" rx="3"/></svg> */
.track { display: block; width: 100%; height: 6px; border-radius: 99px; background: var(--neutral-soft); overflow: hidden; }
.track .fill { fill: var(--accent); }
.track .fill.near { fill: var(--warn); }
.track .fill.full { fill: var(--bad); }
.track .fill.rest { fill: var(--line-strong); }

.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.list { padding: 6px 0 8px; }
.row-mini { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 18px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.row-mini:first-child { border-top: 0; }
.row-mini:hover, .row-mini:focus-visible { background: var(--hover); }
.row-mini:focus-visible { outline-offset: -2px; border-radius: 0; }
.row-mini .ref { font: 500 13px var(--mono); }
.row-mini .meta { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.row-mini .amt { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.row-mini .pill { justify-self: end; align-self: start; grid-column: 2; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; }
.notice .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-top: 6px; flex: none; }
.notice p { margin: 0; color: var(--muted); }
.notice b { color: var(--text); font-weight: 600; }
.notice .dot.ok { background: var(--ok); }
.notice + .list { padding-top: 0; }
.more { padding: 0 18px 14px; }
.more .ghost { margin-top: 0; }
.split .none { margin: 0; color: var(--muted); font-size: 13px; }
.ghost { display: inline-block; margin-top: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: none; }
.ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.split { padding: 4px 18px 16px; display: grid; gap: 10px; }
.split .line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.split .line .num { font-weight: 600; }
.split .track { grid-column: 1 / -1; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.paid, .pill.active { background: var(--ok-soft); color: var(--ok-text); }
.pill.open { background: var(--accent-soft); color: var(--accent-text); }
.pill.expired, .pill.paused { background: var(--neutral-soft); color: var(--muted); }
.pill.paused { box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill.failed { background: var(--bad-soft); color: var(--bad-text); }
.pill.full { background: var(--warn-soft); color: var(--warn-text); }
.kv .pill { margin-left: 6px; }

/* Transactions */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 240px; max-width: 340px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--field); border-radius: 10px; background: var(--card); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
select.f { padding: 8px 30px 8px 11px; border: 1px solid var(--field); border-radius: 10px; background: var(--card); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.count { margin-left: auto; color: var(--muted); font-size: 13px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 820px; }
th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr { cursor: pointer; }
.table-wrap tbody tr:hover td, .table-wrap tbody tr:focus-within td { background: var(--hover); }
td a.row-link { color: inherit; text-decoration: none; }
td.ref { font: 500 13px var(--mono); white-space: nowrap; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
td.ref .lname { font-family: var(--sans); font-weight: 500; }
td.when { color: var(--muted); white-space: nowrap; }
td.amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.amt { text-align: right; }
td.card, td.acct { color: var(--muted); white-space: nowrap; }
td.acct .off { color: var(--muted); font-size: 11.5px; margin-left: 4px; }
td.cust { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; color: var(--muted); font-size: 13px; gap: 8px; flex-wrap: wrap; }
.pager a, .pager span.off { display: inline-block; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); padding: 6px 12px; border-radius: 10px; text-decoration: none; }
.pager span.off { opacity: .4; }
.pager .pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager a:hover { border-color: var(--accent); color: var(--accent-text); }
.pager a[aria-current="page"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.pager .gap { padding: 0 2px; color: var(--muted); }
.filters .dates { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
input.f { padding: 7px 10px; border: 1px solid var(--field); border-radius: 10px; background: var(--card); }
input.f:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select.f:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.filters .ghost { margin-top: 0; padding-block: 8px; }

/* The transaction panel */
.overlay { position: fixed; inset: 0; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 30; }
.overlay.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--card); box-shadow: var(--shadow); transform: translateX(100%); transition: transform .22s ease; z-index: 31; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer.on { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer, .overlay { transition: none; } }
.d-head { position: sticky; top: 0; background: var(--card); display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 14px; border-bottom: 1px solid var(--line); z-index: 1; }
.d-title { margin: 0; color: var(--muted); font-size: 13px; font-weight: 400; }
.close { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 18px; display: inline-grid; place-items: center; text-decoration: none; }
.close:hover { background: var(--hover); color: var(--text); }
.d-body { padding: 20px; display: grid; gap: 22px; }
.d-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.d-amount { font-size: 32px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.d-ref { font: 13px var(--mono); color: var(--muted); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.d-sub { font-size: 13px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy { border: 1px solid var(--line); background: transparent; border-radius: 7px; padding: 1px 8px; font: 11.5px var(--sans); cursor: pointer; color: var(--muted); }
.copy:hover { color: var(--accent-text); border-color: var(--accent); }
.kv .copy { margin-left: 8px; }
.sec h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-size: 12.5px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 16px 1fr auto; gap: 2px 12px; position: relative; padding-bottom: 14px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .tdot { width: 9px; height: 9px; border-radius: 50%; margin: 5px 0 0 3px; background: var(--faint); }
.timeline .tdot.ok { background: var(--ok); }
.timeline .tdot.bad { background: var(--bad); }
.timeline .tdot.start { background: var(--accent); }
.timeline .what { font-size: 13.5px; }
.timeline .why { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.timeline .at { color: var(--muted); font: 12px var(--mono); white-space: nowrap; }
.lnk { display: inline-flex; align-items: center; gap: 4px; font: 500 11px var(--sans); color: var(--accent-text); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.answers { display: grid; gap: 8px; margin: 0; }
.answers div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.answers dt { color: var(--muted); font-size: 12px; }
.answers dd { margin: 2px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }
.kv dd.bad { color: var(--bad-text); }
.d-warn { background: var(--warn-soft); color: var(--text); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.d-warn b { color: var(--warn-text); }
/* The page under an open panel does not scroll with it. */
html.drawer-open { overflow: hidden; }
/* For a screen reader only: what the eye gets from the layout. */
.sr-only { position: absolute; width: 1px; height: 1px; min-width: 0; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Sign in */
.signin { min-height: 72vh; display: grid; place-items: center; }
.signin-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.signin-card .brand { margin-bottom: 22px; }
.signin-card h1 { font-size: 21px; }
.signin-card p { color: var(--muted); margin: 6px 0 20px; }
.signin-card .error { color: var(--bad-text); background: var(--bad-soft); border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; }
.field input { padding: 10px 12px; border: 1px solid var(--field); border-radius: 10px; background: var(--card); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.primary { display: block; width: 100%; border: 0; background: var(--grad-button); color: #fff; text-align: center; text-decoration: none; padding: 11px; border-radius: 10px; font-weight: 600; cursor: pointer; margin-top: 4px; }
/* Darker on hover, not lighter: the white text keeps its contrast. */
.primary:hover { filter: brightness(0.92); }
.signin-card .foot { margin-top: 16px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Not found, something went wrong (templates/portal/error.html): the sign-in card's shape. */
.status-card .code { margin: 0 0 6px; font: 500 13px var(--mono); color: var(--muted); }
.status-card .primary { margin-top: 0; }

/* Narrower screens. A phone (375px) never scrolls the page sideways: the
   header puts its tabs on a row of their own, the accounts show as cards, a
   transaction is a compact block of its own rather than a table row, and the
   chart's labels grow as the chart shrinks (its text is sized in the
   1000-unit viewBox, so 11px at full width would be ~4px on a phone). */
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  .chart text { font-size: 14px; }
}
@media (max-width: 640px) {
  .app { padding-top: 14px; }
  .top { gap: 10px 12px; padding-bottom: 12px; }
  .top .nav { order: 3; flex-basis: 100%; }
  .who { gap: 8px; }
  .head { margin: 22px 0 14px; }
  .chart { padding: 6px 8px 10px 16px; }
  .chart text { font-size: 19px; }

  /* The accounts: the cards (they carry their own labels), whatever the switch says. */
  [data-accounts-view], .acc-list[data-view-of] { display: none !important; }
  .accounts[data-view-of] { display: grid !important; grid-template-columns: 1fr; padding: 12px 14px 14px; }

  .filters .search { flex-basis: 100%; max-width: none; }
  .filters select.f { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .filters .dates { flex-basis: 100%; }
  .filters .dates input { flex: 1 1 0; min-width: 0; }
  .filters .count { flex-basis: 100%; margin-left: 0; }

  /* A transaction as a block: what and how much, then who, then when; the
     status beside them. The account and the card are in its panel. The
     table's roles are set in the markup, so it is still read as a table. */
  .table-wrap table { min-width: 0; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-wrap tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ref amt" "cust status" "when status"; gap: 2px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-wrap tbody tr:last-child { border-bottom: 0; }
  .table-wrap td { display: block; padding: 0; border: 0; background: none; }
  .table-wrap tbody tr:hover, .table-wrap tbody tr:focus-within { background: var(--hover); }
  .table-wrap tbody tr:hover td, .table-wrap tbody tr:focus-within td { background: none; }
  /* The cell has no padding here, so clipping it would cut the link's focus
     ring down to a sliver; the link clips its own text instead, and its ring
     falls in the row's padding. */
  .table-wrap td.ref { grid-area: ref; max-width: none; overflow: visible; }
  .table-wrap td.ref a.row-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-wrap td.amt { grid-area: amt; }
  .table-wrap td.cust { grid-area: cust; max-width: none; font-size: 13px; color: var(--muted); }
  .table-wrap td.when { grid-area: when; font-size: 12.5px; }
  .table-wrap td.st { grid-area: status; justify-self: end; }
  .table-wrap td.acct, .table-wrap td.card { display: none; }

  .pager { justify-content: center; }
  .pager > span { flex-basis: 100%; text-align: center; }
  .pager .pages { justify-content: center; }
}
@media (max-width: 520px) {
  /* A long username is cut short rather than pushing Sign out off the row. */
  .who .name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kpis { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .chart text { font-size: 26px; }
  .signin-card { padding: 24px 20px; }
}

/* Account (templates/portal/account.html): the merchant's API credentials. */
.panel-body { padding: 14px 18px 18px; }
.account-kv { grid-template-columns: 150px 1fr; gap: 14px 12px; }
.account-kv dd { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.secret { font-size: 12.5px; overflow-wrap: anywhere; }
.secret-tools { display: inline-flex; gap: 6px; }
.kv-note { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.panel-body .error { color: var(--bad-text); background: var(--bad-soft); border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; }
@media (max-width: 520px) {
  .account-kv { grid-template-columns: 1fr; gap: 4px; }
  .account-kv dd { margin-bottom: 10px; }
}
