/* Ledger — "Console" design (spec: docs/mockups/console-v3.html).
   Inter (tabular numbers) for text, JetBrains Mono for addresses and hashes.
   Thin borders, one accent, status dots. CSP: no inline styles anywhere — dynamic values are
   set from static/js/app.js through the CSSOM. */

/* ---------- fonts (OFL, self-hosted) ---------- */
@font-face {
  font-family:"Inter";
  src:url("../vendor/fonts/Inter.ttf") format("truetype");
  font-weight:100 900;
  font-display:swap;
}
@font-face {
  font-family:"JetBrains Mono";
  src:url("../vendor/fonts/JetBrainsMono.ttf") format("truetype");
  font-weight:100 800;
  font-display:swap;
}

/* ---------- tokens ---------- */
:root {
  --bg:#f6f7f9; --surface:#ffffff; --inset:#f8f9fb; --line:#e7e9ee; --line2:#f0f2f5;
  --ink:#0e1320; --ink2:#566073; --ink3:#687082;
  --accent:#2563eb; --accent-btn:#2563eb; --accent-ink:#ffffff; --accent-soft:#edf3ff;
  --navy:#101a33; --navy-ink:#ffffff;
  --amber:#965a00; --amber-soft:#fff6e6; --red:#cf2f22; --red-soft:#fdeeec; --green:#0f7f59; --green-soft:#e8f7f0;
  --scrim:rgba(9,12,18,.22); --shadow:0 24px 60px rgba(9,12,18,.18); --shadow-sm:0 6px 16px rgba(16,26,51,.10);
  --ease:cubic-bezier(.2,.8,.2,1); --spring:cubic-bezier(.34,1.4,.64,1);
  --sans:"Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:"JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme:light;
}
.dark {
  --bg:#090c12; --surface:#10141d; --inset:#0d1118; --line:#1f2532; --line2:#171c27;
  --ink:#eef1f6; --ink2:#a0a9ba; --ink3:#8590a3;
  --accent:#5b8dff; --accent-btn:#3563d6; --accent-ink:#ffffff; --accent-soft:#16213b; --navy:#e9eefb; --navy-ink:#0b1020;
  --amber:#f2b24a; --amber-soft:#2a2112; --red:#ff7a6e; --red-soft:#2c1614; --green:#46d39f; --green-soft:#0e271e;
  --scrim:rgba(0,0,0,.5); --shadow:0 24px 60px rgba(0,0,0,.5); --shadow-sm:0 6px 16px rgba(0,0,0,.35);
  color-scheme:dark;
}
/* Anonymous pages (login) follow the OS; signed-in users get .light / .dark. */
@media (prefers-color-scheme: dark) {
  .auto {
    --bg:#090c12; --surface:#10141d; --inset:#0d1118; --line:#1f2532; --line2:#171c27;
    --ink:#eef1f6; --ink2:#a0a9ba; --ink3:#8590a3;
    --accent:#5b8dff; --accent-btn:#3563d6; --accent-ink:#ffffff; --accent-soft:#16213b; --navy:#e9eefb; --navy-ink:#0b1020;
    --amber:#f2b24a; --amber-soft:#2a2112; --red:#ff7a6e; --red-soft:#2c1614; --green:#46d39f; --green-soft:#0e271e;
    --scrim:rgba(0,0,0,.5); --shadow:0 24px 60px rgba(0,0,0,.5); --shadow-sm:0 6px 16px rgba(0,0,0,.35);
    color-scheme:dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing:border-box }
html { -webkit-text-size-adjust:100% }
body {
  margin:0; background:var(--bg); color:var(--ink);
  font-family:var(--sans); font-size:13.5px; line-height:1.45;
  font-feature-settings:"cv11", "ss01", "tnum"; font-variant-numeric:tabular-nums;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}
a { color:inherit }
button, input, select, textarea { font:inherit; color:inherit }
button { cursor:pointer }
h1, h2, h3, h4 { margin:0; font-weight:600; letter-spacing:-.015em; line-height:1.2 }
h1 { font-size:20px }
p { margin:0 0 10px }
.mono, code, pre, kbd { font-family:var(--mono); font-feature-settings:normal }
.m { font-size:12px; color:var(--ink3) }
.lead { font-size:15px; margin:0 0 10px }
form.inline { display:inline; margin:0 }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px }
[hidden], [x-cloak] { display:none !important }
.sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); border:0; white-space:nowrap }
.grow { flex:1 }
kbd { font-size:11px; font-weight:500; border:1px solid currentColor; border-radius:4px; padding:0 4px; opacity:.6; line-height:1.4 }
svg.i { width:15px; height:15px; flex:none; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round }
::selection { background:var(--accent-soft) }

/* ---------- shell ---------- */
.app { display:grid; grid-template-columns:216px minmax(0, 1fr); min-height:100vh }
.app.anon { grid-template-columns:minmax(0, 1fr) }
.main { padding:28px clamp(24px, 3vw, 56px) 72px; width:100%; min-width:0 }
/* Large screens: scale the whole UI up proportionally instead of leaving empty space. */
/* Gentle, height-aware: only scale up when the window is both wide AND tall enough,
   so the page never needs extra scrolling. */
@media (min-width: 1900px) and (min-height: 1050px) { body { zoom:1.05 } }
@media (min-width: 2400px) and (min-height: 1300px) { body { zoom:1.12 } }
.main.auth { max-width:420px; margin:0 auto; padding-top:9vh }

.sidebar {
  border-right:1px solid var(--line); padding:14px 10px; display:flex; flex-direction:column; gap:1px;
  /* Fixed to the viewport: always full screen height, never scrolls with the page. */
  position:fixed; top:0; bottom:0; left:0; width:216px; overflow-y:auto; background:var(--surface); z-index:20;
}
.app:not(.anon) > .main { grid-column:2 }
.brand { display:flex; align-items:center; gap:9px; font-weight:600; font-size:14px; padding:6px 10px 18px; letter-spacing:-.01em; text-decoration:none; color:var(--ink) }
.brand svg { width:18px; height:18px; fill:var(--navy); stroke:none }
.newbtn {
  display:flex; align-items:center; justify-content:space-between; gap:8px; background:var(--navy); color:var(--navy-ink);
  border:0; border-radius:7px; padding:9px 12px; font-weight:500; margin:0 2px 14px; text-decoration:none;
  transition:transform .15s var(--ease), box-shadow .2s;
}
.newbtn:hover { transform:translateY(-1px); box-shadow:var(--shadow-sm) }
.newbtn kbd { opacity:.55 }
.navs { display:flex; flex-direction:column; gap:1px }
.nav {
  display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:6px; color:var(--ink2); font-weight:450;
  position:relative; text-decoration:none; transition:background .15s, color .15s; white-space:nowrap;
}
.nav:hover { background:var(--inset); color:var(--ink) }
.nav.on { color:var(--ink); background:var(--inset) }
.nav.on::before { content:""; position:absolute; left:-10px; top:8px; bottom:8px; width:2px; border-radius:2px; background:var(--accent) }
.nav.off { opacity:.6; cursor:default; pointer-events:none }
.nav .cnt, .nav .soon { margin-left:auto; font-size:11px; font-weight:500; color:var(--ink3); font-style:normal }
.badge { margin-left:auto; font-style:normal; font-size:11px; font-weight:600; color:var(--accent-ink); background:var(--accent-btn); border-radius:9px; padding:0 6px; line-height:17px; min-width:17px; text-align:center }
.badge:empty { display:none }
.navlabel { font-size:11px; color:var(--ink3); padding:14px 10px 6px; letter-spacing:.02em }
.side-foot { margin-top:auto; border-top:1px solid var(--line); padding-top:8px; display:flex; flex-direction:column; gap:1px }
.me { display:flex; gap:9px; align-items:center; padding:8px 10px 4px }
.av {
  width:26px; height:26px; border-radius:50%; background:linear-gradient(135deg, #c2410c, #9a3412); color:#fff;
  display:grid; place-items:center; font-weight:600; font-size:11px; font-style:normal; flex:none;
}
.me .who { min-width:0; line-height:1.25 }
.me .who b { display:block; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.me .who small { display:block; color:var(--ink3); font-size:11px }
.me form { margin-left:auto }
.theme, .icon-btn {
  border:1px solid var(--line); background:transparent; color:var(--ink2); border-radius:6px; width:28px; height:28px;
  display:grid; place-items:center; padding:0; text-decoration:none; transition:background .15s, color .15s;
}
.theme:hover, .icon-btn:hover { background:var(--inset); color:var(--ink) }
.icon-btn { border-color:transparent; color:var(--ink3) }
.side-foot .nav { font-size:12.5px; padding:6px 10px }
.side-foot form .nav { width:100%; border:0; background:transparent; text-align:left }

/* ---------- page head ---------- */
.head { display:flex; align-items:baseline; gap:12px; margin-bottom:22px; flex-wrap:wrap }
.head h1 { font-size:20px }
.head .sub { color:var(--ink3) }
.head .tools { margin-left:auto; display:flex; gap:8px; align-self:center }
.crumbs { display:inline-flex; align-items:center; gap:4px; color:var(--ink3); font-size:12px; text-decoration:none; margin-bottom:10px }
.crumbs:hover { color:var(--ink) }
.crumbs svg.i { width:13px; height:13px }

/* ---------- messages / toast ---------- */
.msgs { position:fixed; top:14px; left:50%; transform:translateX(-50%); z-index:90; display:grid; gap:6px; width:min(460px, calc(100% - 32px)) }
.msg {
  border:1px solid var(--line); background:var(--surface); border-radius:9px; padding:9px 12px; box-shadow:var(--shadow-sm);
  display:flex; gap:8px; align-items:center; animation:enter .4s var(--ease) both;
}
.msg::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--ink3); flex:none }
.msg-success::before { background:var(--green) }
.msg-warning::before { background:var(--amber) }
.msg-error::before { background:var(--red) }
.toast {
  position:fixed; left:50%; bottom:22px; z-index:100; transform:translate(-50%, 30px); opacity:0;
  max-width:calc(100% - 32px); background:var(--navy); color:var(--navy-ink); padding:9px 14px; border-radius:9px;
  font-size:12.5px; display:flex; gap:8px; align-items:center; box-shadow:0 10px 30px rgba(0,0,0,.2);
  transition:transform .35s var(--spring), opacity .25s;
}
.toast.on { opacity:1; transform:translate(-50%, 0) }
.toast.err { background:#b42318; color:#fff }
.toast svg.i { width:14px; height:14px; stroke-width:2.2 }

/* ---------- buttons ---------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px; position:relative;
  border:1px solid var(--line); background:var(--surface); color:var(--ink); border-radius:8px;
  height:34px; padding:0 14px; font-weight:500; font-size:13px; line-height:1; text-decoration:none; white-space:nowrap;
  transition:background .15s var(--ease), transform .15s var(--ease), box-shadow .15s, border-color .15s, filter .15s;
}
.btn:hover { background:var(--inset) }
.btn.sm { height:28px; padding:0 10px; font-size:12.5px; border-radius:7px }
.btn.o { background:var(--accent-btn); border-color:var(--accent-btn); color:var(--accent-ink) }
.btn.o:hover { filter:brightness(1.07); transform:translateY(-1px); box-shadow:0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent) }
.btn.k { background:var(--navy); border-color:var(--navy); color:var(--navy-ink) }
.btn.k:hover { transform:translateY(-1px); box-shadow:var(--shadow-sm) }
.btn.g { background:transparent }
.btn.g:hover { background:var(--inset) }
.btn.danger { color:var(--red) }
.btn kbd { margin-left:2px; border:0; padding:0; opacity:.65 }
.btn:disabled, .btn[aria-disabled="true"] { opacity:.45; cursor:not-allowed; transform:none; box-shadow:none; filter:none }
.btn svg.i { width:14px; height:14px }
/* Request in flight (htmx adds .htmx-request to the posting form): spinner on its primary button. */
.htmx-request .btn.o[type="submit"], .htmx-request .btn.k[type="submit"], .htmx-request.btn.o { color:transparent }
.htmx-request .btn.o[type="submit"]::after, .htmx-request .btn.k[type="submit"]::after, .htmx-request.btn.o::after {
  content:""; position:absolute; width:14px; height:14px; border-radius:50%; left:calc(50% - 7px); top:calc(50% - 7px);
  border:2px solid rgba(255,255,255,.4); border-top-color:#fff; animation:spin .7s linear infinite;
}
.linkbtn { border:0; background:transparent; color:var(--accent); font-weight:500; padding:0; height:auto; text-decoration:none }
.linkbtn:hover { text-decoration:underline; background:transparent }

/* ---------- dots / status ---------- */
.dot { width:7px; height:7px; border-radius:50%; background:currentColor; display:inline-block; flex:none; position:relative }
.pulse::after { content:""; position:absolute; inset:-4px; border-radius:50%; border:1.5px solid currentColor; opacity:0; animation:pulse 2s var(--ease) infinite }
.st { display:inline-flex; align-items:center; gap:7px; font-size:12.5px; color:var(--ink2); white-space:nowrap }
.st .dot { color:var(--ink3) }
.st.y .dot { color:var(--amber) }
.st.l .dot, .st.s .dot { color:var(--accent) }
.st.g .dot { color:var(--green) }
.st.r .dot { color:var(--red) }
.c-amber { color:var(--amber) } .c-accent { color:var(--accent) } .c-green { color:var(--green) } .c-red { color:var(--red) }
/* Flag tag ("new wallet", "look-alike"): quiet coloured text with a dot. */
.w { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:500; color:var(--amber); margin-left:7px; white-space:nowrap; vertical-align:1px }
.w::before { content:""; width:5px; height:5px; border-radius:50%; background:currentColor }
.w.red { color:var(--red) }
.pill {
  display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--ink2); white-space:nowrap;
  border:1px solid var(--line); border-radius:20px; padding:1px 9px 1px 8px; background:var(--surface);
}
.pill::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--ink3) }
.pill.y::before { background:var(--amber) }
.pill.l::before, .pill.s::before { background:var(--accent) }
.pill.g::before { background:var(--green) }
.pill.r::before { background:var(--red) }

/* ---------- coin marks ---------- */
.coin { position:relative; width:24px; height:24px; flex:none; display:inline-block }
.coin > svg { width:100%; height:100%; display:block }
.coin .net {
  position:absolute; right:-4px; bottom:-4px; width:13px; height:13px; border-radius:50%;
  border:2px solid var(--surface); background:var(--surface); display:grid; place-items:center; overflow:hidden;
}
.coin .net svg { width:100%; height:100%; display:block }
.coin.sm { width:18px; height:18px }
.coin.sm .net { width:11px; height:11px; right:-3px; bottom:-3px; border-width:1.5px }
.coin.lg { width:22px; height:22px }

/* ---------- KPI strip ---------- */
.kpis {
  display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); border:1px solid var(--line); border-radius:10px;
  background:var(--surface); margin-bottom:22px; overflow:hidden;
}
.kpi { padding:14px 18px; border-right:1px solid var(--line); position:relative; text-decoration:none; color:inherit; transition:background .15s; display:block; min-width:0 }
.kpi:last-child { border-right:0 }
a.kpi:hover { background:var(--inset) }
.kpi .l { color:var(--ink2); font-size:12px; display:flex; align-items:center; gap:7px }
.kpi .v { display:block; font-size:20px; font-weight:600; letter-spacing:-.02em; margin-top:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.kpi .s { display:block; color:var(--ink3); font-size:12px; margin-top:2px }

/* ---------- toolbar ---------- */
.toolbar { display:flex; gap:8px; align-items:center; margin-bottom:10px; flex-wrap:wrap; position:relative }
.search {
  display:flex; align-items:center; gap:8px; border:1px solid var(--line); border-radius:7px; padding:0 10px; height:32px;
  color:var(--ink3); flex:1; min-width:200px; max-width:360px; background:var(--surface); transition:border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft) }
.search .q { border:0; outline:0; background:transparent; color:var(--ink); width:100%; min-width:0; height:100% }
.search .q::placeholder { color:var(--ink3) }
.search .q::-webkit-search-cancel-button { opacity:.5 }
.search kbd { border-color:var(--line); opacity:1; color:var(--ink3) }
.seg { display:inline-flex; border:1px solid var(--line); border-radius:7px; overflow:hidden; background:var(--surface) }
.seg a { color:var(--ink2); padding:0 11px; height:30px; display:inline-flex; align-items:center; font-size:12.5px; border-right:1px solid var(--line); text-decoration:none; white-space:nowrap; transition:background .15s, color .15s }
.seg a:last-child { border-right:0 }
.seg a:hover { color:var(--ink); background:var(--inset) }
.seg a.on { background:var(--inset); color:var(--ink); font-weight:500 }
details.filters { position:relative }
details.filters > summary { list-style:none; cursor:pointer }
details.filters > summary::-webkit-details-marker { display:none }
details.filters[open] > summary { background:var(--inset) }
.fpop {
  position:absolute; top:calc(100% + 6px); left:0; z-index:30; width:300px; background:var(--surface);
  border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow-sm); padding:12px; display:grid; gap:8px;
  animation:enter .25s var(--ease) both;
}
.fpop .two-col { display:grid; grid-template-columns:1fr 1fr; gap:8px }
.fpop label { font-size:11.5px; color:var(--ink3); display:grid; gap:4px }

/* ---------- form fields ---------- */
.in {
  display:block; width:100%; border:1px solid var(--line); border-radius:8px; min-height:36px; padding:7px 11px;
  background:var(--surface); color:var(--ink); outline:0; transition:border-color .15s, box-shadow .15s;
}
.in:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft) }
.in::placeholder { color:var(--ink3) }
select.in { appearance:none; -webkit-appearance:none; padding-right:30px; cursor:pointer;
  background-image:linear-gradient(45deg, transparent 50%, var(--ink3) 50%), linear-gradient(135deg, var(--ink3) 50%, transparent 50%);
  background-position:calc(100% - 15px) 52%, calc(100% - 11px) 52%; background-size:4px 4px; background-repeat:no-repeat }
textarea.in { resize:vertical; min-height:64px }
.in.mono { font-family:var(--mono); font-size:12.5px }
.in.big { font-size:24px; font-weight:600; letter-spacing:-.02em; min-height:48px }
.in.sm { min-height:30px; padding:4px 9px; font-size:12.5px; width:auto; display:inline-block }
input[type="checkbox"], input[type="radio"] { accent-color:var(--accent) }
label.m, .fl > label, .fl > small { display:block; font-size:12px; color:var(--ink2); margin-bottom:6px }

/* ---------- payments list ---------- */
.list { border:1px solid var(--line); border-radius:10px; background:var(--surface); overflow:clip }
.wkl {
  display:flex; justify-content:space-between; gap:12px; padding:9px 18px; background:var(--inset); border-bottom:1px solid var(--line);
  font-size:12px; color:var(--ink2); position:sticky; top:0; z-index:2; flex-wrap:wrap;
}
.wkl b { color:var(--ink); font-weight:500 }
.wkl + .wkl, .r + .wkl, .empty + .wkl { border-top:1px solid var(--line) }
.r {
  display:grid; grid-template-columns:minmax(0, 2.1fr) minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, .8fr) 64px;
  gap:14px; align-items:center; padding:11px 18px; border-bottom:1px solid var(--line2); position:relative; transition:background .12s;
}
.r:last-child { border-bottom:0 }
.r:hover { background:var(--inset) }
.r.sel { background:var(--accent-soft) }
.r.sel::before { content:""; position:absolute; left:0; top:0; bottom:0; width:2px; background:var(--accent) }
.r.enter { animation:enter .5s var(--ease) both; animation-delay:var(--d, 0ms) }
.r a.rl { text-decoration:none; color:inherit }
.r a.rl::after { content:""; position:absolute; inset:0; z-index:0 }
.r a.rl:focus-visible { outline:0 }
.r a.rl:focus-visible::after { outline:2px solid var(--accent); outline-offset:-2px; border-radius:2px }
.r a.h { position:relative; z-index:1 }
.sup, .asset { display:flex; gap:11px; align-items:center; min-width:0 }
.ava {
  width:30px; height:30px; border-radius:8px; display:grid; place-items:center; font-weight:600; font-size:12px; color:#fff; flex:none; letter-spacing:.01em;
  background:#5b6b8c;
}
.ava.t0 { background:#6d4aff } .ava.t1 { background:#0f7f5f } .ava.t2 { background:#b45309 } .ava.t3 { background:#1f6fd8 }
.ava.t4 { background:#c2410c } .ava.t5 { background:#0e7490 } .ava.t6 { background:#c2417f } .ava.t7 { background:#5b6b8c }
.stack { min-width:0 }
.stack b { display:block; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.stack small { display:block; color:var(--ink3); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.stack .plus { color:var(--ink3); font-weight:400 }
a.h { color:var(--ink2); text-decoration:none; font-family:var(--mono); font-size:12px }
a.h:hover { color:var(--accent); text-decoration:underline }
.amt { text-align:right; font-weight:500; white-space:nowrap }
.amt small { display:block; color:var(--ink3); font-weight:400; font-size:12px }
.stc { min-width:0 }
.mini { display:block; height:3px; border-radius:3px; background:var(--line); margin-top:6px; overflow:hidden; width:90px; max-width:100% }
.mini i { display:block; height:100%; width:0; background:var(--accent); border-radius:3px; transition:width .8s var(--ease) }
.time { color:var(--ink3); font-size:12px; white-space:nowrap }
.go { display:flex; align-items:center; justify-content:flex-end; gap:2px; color:var(--ink3); font-size:12px; font-weight:500; opacity:0; transform:translateX(-4px); transition:opacity .18s var(--ease), transform .18s var(--ease), color .15s }
.go svg.i { width:14px; height:14px }
.r:hover .go, .r.sel .go, .r:focus-within .go { opacity:1; transform:none; color:var(--accent) }
.empty { padding:18px; color:var(--ink3); font-size:12.5px }
.more { text-align:center; padding:12px; border-top:1px solid var(--line2) }

/* ---------- floating sheet (side panel + request drawer) ---------- */
.dim { position:fixed; inset:0; z-index:50; background:var(--scrim); backdrop-filter:blur(1.5px); -webkit-backdrop-filter:blur(1.5px) }
.dim.opening { animation:fade .3s var(--ease) both }
.dim.closing { animation:fade .25s var(--ease) reverse both }
.sheet {
  position:absolute; top:10px; right:10px; bottom:10px; width:480px; max-width:calc(100% - 20px);
  background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow);
  display:grid; grid-template-columns:minmax(0, 1fr) auto; grid-template-rows:auto minmax(0, 1fr) auto; overflow:hidden;
}
form.sheet, .sheet > form { margin:0 }
.sheet > form.pay-form { display:contents }
.drawer.sheet { width:520px }
.dim.opening .sheet { animation:sheet-in .5s var(--spring) both }
.dim.closing .sheet { animation:sheet-out .25s var(--ease) both }
.ph { grid-column:1 / -1; padding:16px 20px 14px; display:flex; justify-content:space-between; align-items:flex-start; gap:12px; border-bottom:1px solid var(--line) }
.ph h2, .ph h3 { margin:4px 0 0; font-size:17px; font-weight:600; letter-spacing:-.01em; display:flex; align-items:center; gap:10px }
.crumb { color:var(--ink3); font-size:12px; display:flex; gap:6px; align-items:center; flex-wrap:wrap }
.pb { grid-column:1 / -1; padding:18px 20px 22px; display:flex; flex-direction:column; gap:18px; overflow:auto; overscroll-behavior:contain; min-height:0 }
.dim.opening .pb > * { animation:enter .45s var(--ease) both }
.dim.opening .pb > :nth-child(2) { animation-delay:.05s }
.dim.opening .pb > :nth-child(3) { animation-delay:.1s }
.dim.opening .pb > :nth-child(4) { animation-delay:.15s }
.dim.opening .pb > :nth-child(n+5) { animation-delay:.2s }
.pf { grid-column:1; padding:12px 20px; border-top:1px solid var(--line); display:flex; gap:8px; align-items:center; background:var(--surface); flex-wrap:wrap; min-height:59px }
.pf-side { grid-column:2; grid-row:3; padding:12px 20px 12px 0; border-top:1px solid var(--line); display:flex; gap:8px; align-items:center; justify-content:flex-end; background:var(--surface) }
.pf.full { grid-column:1 / -1 }
.amt-hero { display:flex; justify-content:space-between; align-items:flex-end; gap:12px }
.amt-hero .n { font-size:32px; font-weight:600; letter-spacing:-.03em; line-height:1; white-space:nowrap }
.amt-hero .n small { font-size:15px; color:var(--ink3); font-weight:500; margin-left:2px; letter-spacing:0 }
.amt-hero .time { text-align:right; line-height:1.5 }
.lbl { font-size:12px; color:var(--ink3); margin-bottom:7px; display:flex; justify-content:space-between; align-items:center; gap:8px }
.lbl b { color:var(--ink); font-weight:500 }
.kv { display:grid; grid-template-columns:96px minmax(0, 1fr); gap:7px 12px; font-size:13px }
.kv > span:nth-child(odd) { color:var(--ink3) }
.kv > span { overflow-wrap:anywhere }
.note { border-left:2px solid var(--amber); background:var(--amber-soft); border-radius:0 8px 8px 0; padding:9px 12px; font-size:13px }
.note b { font-weight:600 }
.note p { margin:4px 0 0 }
.warnbox { border:1px solid color-mix(in srgb, var(--red) 30%, var(--line)); background:var(--red-soft); color:var(--ink); border-radius:9px; padding:9px 12px; font-size:13px; display:flex; gap:9px; align-items:flex-start }
.warnbox::before { content:""; width:7px; height:7px; border-radius:50%; background:var(--red); flex:none; margin-top:6px }
.warnbox p { margin:0 }
.warnbox > div > p + p { margin-top:4px }
.warnbox.change-note { border-color:color-mix(in srgb, var(--amber) 35%, var(--line)); background:var(--amber-soft) }
.warnbox.change-note::before { background:var(--amber) }
.side-done { display:flex; align-items:center; gap:8px; background:var(--green-soft); color:var(--green); border-radius:9px; padding:9px 12px; font-weight:500 }
.side-done .m { color:inherit; opacity:.8; margin-left:auto; font-weight:400 }
.side-wait { color:var(--ink2); font-size:12.5px; margin:0 }
.ptx { display:grid; grid-template-columns:auto minmax(0, 1fr) auto auto; gap:10px; align-items:center; font-size:13px; padding:8px 0; border-top:1px solid var(--line2) }
.ptx:first-of-type { border-top:0 }

/* popovers (send back / reject / cancel): open upwards from the footer */
details.pop { position:relative }
details.pop > summary { list-style:none; cursor:pointer }
details.pop > summary::-webkit-details-marker { display:none }
details.pop[open] > summary { background:var(--inset) }
details.pop > form, details.pop > .popc {
  position:absolute; bottom:calc(100% + 8px); left:0; z-index:5; width:300px; max-width:calc(100vw - 48px);
  background:var(--surface); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow-sm);
  padding:12px; display:grid; gap:8px; animation:enter .25s var(--ease) both;
}
details.pop.right > form { left:auto; right:0 }
details.pop.down > form { bottom:auto; top:calc(100% + 8px) }
details.pop > form .btn { justify-self:start }

/* wallet cards */
.wlist { display:flex; flex-direction:column; gap:8px }
.wcard { border:1px solid var(--line); border-radius:10px; padding:12px 14px; transition:border-color .2s, box-shadow .2s; background:var(--surface) }
.wcard:hover { border-color:color-mix(in srgb, var(--accent) 35%, var(--line)) }
.wcard.flag { border-color:color-mix(in srgb, var(--amber) 45%, var(--line)) }
.wcard.flag.red { border-color:color-mix(in srgb, var(--red) 50%, var(--line)) }
.wcard.compact { padding:10px 12px; background:var(--inset) }
.wtop { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:10px }
.wtop .asset b { font-weight:500 }
.wtop .w { margin:0 }
.addr { display:flex; align-items:flex-start; gap:12px; position:relative }
.addr .full { flex:1; font-size:13px; line-height:1.6; color:var(--ink); overflow-wrap:anywhere; min-width:0 }
.addr .full span { display:inline-block; margin-right:.5em }
.addr .full span:nth-child(even) { color:var(--ink2) }
.copy-src { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); border:0; white-space:nowrap }
.copy {
  position:relative; flex:none; border:1px solid var(--line); background:var(--surface); color:var(--ink); border-radius:7px; height:30px; min-width:76px;
  padding:0 10px; font-size:12.5px; font-weight:500; display:inline-flex; align-items:center; justify-content:center; gap:6px;
  transition:background .2s var(--ease); overflow:hidden;
}
.copy:hover { background:var(--inset) }
.copy svg.i { width:14px; height:14px; stroke-width:1.8 }
.copy .done { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; gap:5px; background:var(--green); color:var(--surface); transform:translateY(100%); transition:transform .25s var(--spring) }
.copy .done svg.i { stroke-dasharray:20; stroke-dashoffset:20; stroke-width:2.2 }
.copy.ok .done { transform:none }
.copy.ok .done svg.i { animation:draw .35s .1s var(--ease) forwards }
.verif { font-size:12px; color:var(--ink2); margin-top:10px; padding-top:10px; border-top:1px dashed var(--line); display:flex; gap:7px; align-items:center; flex-wrap:wrap }
.verif svg.i { width:13px; height:13px; color:var(--green); stroke-width:2.2 }
.verif.warn svg.i { color:var(--amber) }

/* approve -> pay in the same panel */
.approvedbar { display:flex; align-items:center; gap:8px; background:var(--green-soft); color:var(--green); border-radius:9px; padding:9px 12px; font-weight:500; font-size:13px; margin-bottom:14px }
.approvedbar svg.i { stroke-width:2.4; stroke-dasharray:20; stroke-dashoffset:0 }
.approvedbar .time { margin-left:auto; color:inherit; opacity:.75; font-weight:400 }
.motion .approvedbar svg.i { stroke-dashoffset:20; animation:draw .4s .25s var(--ease) forwards }
.expand { display:grid; grid-template-rows:1fr; opacity:1; transition:grid-template-rows .5s var(--ease), opacity .4s }
.expand > div { overflow:hidden; min-height:0 }
.expand.pre { grid-template-rows:0fr; opacity:0 }
.paysec .lbl .rem { color:var(--ink2) }
.pay-rows { display:flex; flex-direction:column; gap:12px }
.prow { display:flex; flex-direction:column; gap:8px }
.prow + .prow { border-top:1px dashed var(--line); padding-top:12px }
.prow-in { display:grid; grid-template-columns:170px minmax(0, 1fr); gap:8px }
.prow-in .amt-in { grid-column:1 / -1 }
.prow-x { align-self:flex-start }
.hint { font-size:12px; color:var(--ink3); margin:0 }

/* transfer lane (record payment) */
.flow { border:1px solid var(--line); border-radius:12px; padding:16px; background:var(--inset) }
.lane { display:grid; grid-template-columns:auto minmax(0, 1fr) auto; align-items:center; gap:12px }
.node { display:flex; flex-direction:column; align-items:center; gap:6px; font-size:11.5px; color:var(--ink2); width:76px; text-align:center; overflow-wrap:anywhere }
.node .c { width:38px; height:38px; border-radius:50%; background:var(--surface); border:1px solid var(--line); display:grid; place-items:center }
.node .c svg.i { width:18px; height:18px; color:var(--ink2) }
.track { position:relative; height:6px; border-radius:6px; background:var(--line) }
.track .fill { position:absolute; left:0; top:0; bottom:0; width:0; border-radius:6px; background:linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #77ccff)); overflow:hidden }
.track .tok { position:absolute; top:50%; left:0; transform:translate(-50%, -50%); filter:drop-shadow(0 4px 8px rgba(0,0,0,.18)); line-height:0 }
.track .tok .coin { width:22px; height:22px }
.flow.playing .fill { transition:width 2.4s cubic-bezier(.45,.05,.2,1) }
.flow.playing .tok { transition:left 2.4s cubic-bezier(.45,.05,.2,1) }
.flow.playing .fill::after { content:""; position:absolute; inset:0; background:linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); background-size:60px 100%; background-repeat:no-repeat; animation:shimmer 1s linear infinite }
.steps { display:flex; justify-content:space-between; gap:8px; margin-top:14px; font-size:12px; color:var(--ink3) }
.steps span { display:flex; align-items:center; gap:6px; transition:color .3s }
.steps i { width:15px; height:15px; border-radius:50%; border:1.5px solid currentColor; display:grid; place-items:center; font-style:normal; font-size:9px; flex:none; transition:background .3s, border-color .3s, color .3s }
.steps .done { color:var(--green) }
.steps .done i { background:var(--green); border-color:var(--green); color:var(--surface) }
.success { text-align:center; padding:12px 0 2px }
.success.wait { display:none }
.success .ring { width:56px; height:56px; margin:4px auto 10px; display:block }
.success .ring circle { stroke:var(--green); stroke-width:2.5; fill:none }
.success .ring path { stroke:var(--green); stroke-width:3; fill:none; stroke-linecap:round; stroke-linejoin:round }
.success.draw .ring circle { stroke-dasharray:160; stroke-dashoffset:160; animation:draw .6s var(--ease) forwards }
.success.draw .ring path { stroke-dasharray:30; stroke-dashoffset:30; animation:draw .35s .45s var(--ease) forwards }
.success.draw { animation:enter .4s var(--ease) both }
.success b { font-size:15px; font-weight:600; display:block }
.success p { margin:4px 0 0; color:var(--ink2); font-size:12.5px }

/* ---------- request drawer (finance) ---------- */
.drawer .pb { gap:16px }
.fl { min-width:0 }
.fl .in + .in { margin-top:8px }
.wrows { display:flex; flex-direction:column; gap:10px }
.wrow { border:1px solid var(--line); border-radius:10px; padding:12px 14px; display:flex; flex-direction:column; gap:10px; transition:border-color .2s }
.wrow:focus-within { border-color:color-mix(in srgb, var(--accent) 40%, var(--line)) }
.wrow.enter { animation:enter .4s var(--ease) both }
.wrow .live { display:grid; grid-template-columns:minmax(0, 1fr); gap:10px }
.wrow .net-pick { display:flex; gap:10px; align-items:center }
.wrow .net-pick .in { flex:1 }
.add-wallet:empty { display:none }
.add-wallet .btn { width:100%; border-style:dashed; color:var(--ink2) }
.foot-msg { font-size:12px; color:var(--ink3); flex:1; min-width:0 }

/* wallet check results: calm inline status bars */
.res { border:1px solid var(--line); border-left:3px solid var(--ink3); border-radius:8px; padding:9px 12px; background:var(--inset); font-size:12.5px }
.res .rh { display:flex; align-items:center; gap:7px; font-weight:500; font-size:13px; color:var(--ink) }
.res .rh svg.i { width:14px; height:14px; stroke-width:2 }
.res p { margin:5px 0 0; color:var(--ink2); line-height:1.5 }
.res b { color:var(--ink); font-weight:500 }
.res.st-known { border-left-color:var(--green); background:var(--green-soft) }
.res.st-known .rh svg.i { color:var(--green) }
.res.st-new, .res.st-other { border-left-color:var(--amber); background:var(--amber-soft) }
.res.st-new .rh svg.i, .res.st-other .rh svg.i { color:var(--amber) }
.res.st-look { border-left-color:var(--red); background:var(--red-soft) }
.res.st-look .rh svg.i { color:var(--red) }
.res .ck { display:flex; gap:8px; align-items:center; font-weight:500; margin-top:10px; color:var(--ink); cursor:pointer }
.res .how { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap }
.res .how label { display:inline-flex; align-items:center; gap:5px; font-size:12px; border:1px solid var(--line); background:var(--surface); border-radius:20px; padding:2px 10px 2px 7px; cursor:pointer; transition:border-color .15s, background .15s }
.res .how label:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); color:var(--ink) }
.res .how input { margin:0 }
.res textarea.in { margin-top:6px; font-size:12.5px }
.cmp { border:1px solid var(--line); background:var(--surface); border-radius:7px; padding:8px 10px; margin-top:8px; display:grid; gap:4px }
.cmp div { display:grid; grid-template-columns:60px minmax(0, 1fr); gap:8px; font-size:12.5px; align-items:baseline }
.cmp .m { font-size:11px; letter-spacing:.04em }
.cmp .mono { overflow-wrap:anywhere }
.cmp b { font-weight:600 }
.cmp mark { background:color-mix(in srgb, var(--red) 22%, transparent); color:var(--red); border-radius:3px; padding:0 2px }

/* ---------- history / detail page ---------- */
.dhead { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:18px; flex-wrap:wrap }
.dhead .title { font-size:20px; font-weight:600; letter-spacing:-.015em; display:flex; align-items:center; gap:10px; flex-wrap:wrap }
.dhead .sub, .dhead .m { color:var(--ink3); font-size:12.5px; margin-top:3px }
.dhead .total { text-align:right; font-size:26px; font-weight:600; letter-spacing:-.025em; line-height:1.1 }
.dhead .total .pill, .dhead .total .m { font-size:12px; font-weight:400; letter-spacing:0; margin-top:6px; display:inline-flex }
.acts { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:0 0 16px }
.prog { display:flex; height:4px; border-radius:4px; overflow:hidden; background:var(--line); margin:0 0 18px }
.prog i { display:block; width:0; background:var(--green); transition:width .8s var(--ease) }
.dg { display:grid; grid-template-columns:minmax(0, 1.55fr) minmax(0, 1fr); gap:16px; align-items:start }
.col { display:flex; flex-direction:column; gap:16px; min-width:0 }
.panel { border:1px solid var(--line); border-radius:10px; padding:16px 18px; background:var(--surface); margin-bottom:16px; min-width:0 }
.col > .panel { margin-bottom:0 }
.panel > h4, .rows > h4 { margin:0 0 12px; font-size:12px; font-weight:500; color:var(--ink3); letter-spacing:.01em }
.panel form > p { margin:0 0 12px }
.panel ul { margin:0 0 14px; padding-left:18px; color:var(--ink2) }
.panel ul li { margin-bottom:4px }
.tx { display:grid; grid-template-columns:minmax(0, 1.3fr) 90px minmax(0, 1.2fr) minmax(0, 1fr); gap:12px; align-items:center; padding:10px 0; border-top:1px solid var(--line2); font-size:13px }
.tx.hd { border:0; padding:0 0 4px }
.tx .k { font-size:11.5px; color:var(--ink3) }
.tx .netw { display:flex; gap:8px; align-items:center; min-width:0 }
.tx .fix { grid-column:1 / -1; display:flex; gap:6px; flex-wrap:wrap; align-items:flex-start }
.tx details.pop > form { bottom:auto; top:calc(100% + 6px) }
.lock { color:var(--amber) }
.log { position:relative }
.log > div { display:grid; grid-template-columns:14px minmax(0, 1fr); gap:10px; font-size:13px; padding-bottom:14px; position:relative }
.log > div:not(:last-child)::before { content:""; position:absolute; left:4px; top:14px; bottom:0; width:1px; background:var(--line) }
.log i { width:9px; height:9px; border-radius:50%; margin-top:5px; background:var(--ink3); box-shadow:0 0 0 3px var(--surface) }
.log i.c-y { background:var(--amber) }
.log i.c-g { background:var(--green) }
.log i.c-l { background:var(--accent) }
.log i.c-r { background:var(--red) }
.log i.c-o { background:var(--amber) }
.log small { display:block; font-size:11.5px; color:var(--ink3); margin-top:1px }
.log q { display:block; font-size:12.5px; color:var(--ink2); margin-top:2px }
.log q::before, .log q::after { content:"" }

/* ---------- tables (suppliers, users, audit, networks) ---------- */
.rows { border:1px solid var(--line); border-radius:10px; background:var(--surface); margin-bottom:16px; overflow-x:auto }
.rows > h4 { padding:14px 18px 0 }
.tbl { width:100%; border-collapse:collapse; font-size:13px }
.tbl th { text-align:left; font-size:12px; font-weight:500; color:var(--ink3); padding:9px 12px; background:var(--inset); border-bottom:1px solid var(--line); white-space:nowrap }
.rows .tbl th:first-child, .rows .tbl td:first-child { padding-left:18px }
.rows .tbl th:last-child, .rows .tbl td:last-child { padding-right:18px }
.panel .tbl th { background:transparent; padding-left:0 }
.panel .tbl td { padding-left:0 }
.tbl td { padding:10px 12px; border-bottom:1px solid var(--line2); vertical-align:middle }
.tbl tr:last-child td { border-bottom:0 }
.tbl tbody tr { transition:background .12s }
.rows .tbl tbody tr:hover { background:var(--inset) }
.tbl .num { text-align:right }
.tbl td.mono { font-size:12px; color:var(--ink2) }
.tbl a { text-decoration:none; font-weight:500 }
.tbl a:hover { color:var(--accent) }
.tbl td .sup { gap:10px }
.tbl td .ava { width:26px; height:26px; border-radius:7px; font-size:11px }
.tbl td form.inline { display:inline-flex; gap:6px; align-items:center }
.tbl td details { display:inline-block; margin-left:4px }
.tbl td details > summary { cursor:pointer; font-size:12px; color:var(--ink3); list-style:none }
.tbl td details > summary::-webkit-details-marker { display:none }
.tbl td details > form { margin-top:6px }
.tbl .cell-acts { display:flex; gap:6px; align-items:center; flex-wrap:wrap }
.filterbar { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap }
.filterbar label { display:grid; gap:4px; font-size:11.5px; color:var(--ink3) }
.filterbar .in { min-width:150px }
.pager { display:flex; gap:10px; align-items:center; color:var(--ink3); font-size:12.5px }
.invite { display:flex; gap:8px; align-items:center }
.invite .in { flex:1 }

/* ---------- auth pages (allauth) ---------- */
.auth-brand { display:flex; align-items:center; gap:9px; font-weight:600; font-size:15px; margin-bottom:28px; text-decoration:none; color:var(--ink) }
.auth-brand svg { width:20px; height:20px; fill:var(--navy) }
.auth h1 { font-size:22px; margin-bottom:6px }
.auth > p, .auth p { color:var(--ink2); margin:0 0 14px }
.auth form { display:flex; flex-direction:column; gap:6px; border:1px solid var(--line); background:var(--surface); border-radius:12px; padding:20px; margin:16px 0 }
.auth form p { margin:0 0 8px; color:var(--ink) }
.auth label { display:block; font-size:12px; color:var(--ink2); margin-bottom:5px }
.auth input[type="text"], .auth input[type="password"], .auth input[type="email"],
.auth input[type="number"], .auth input:not([type]), .auth textarea {
  width:100%; border:1px solid var(--line); border-radius:8px; min-height:38px; padding:8px 11px; outline:0;
  background:var(--surface); color:var(--ink); transition:border-color .15s, box-shadow .15s;
}
.auth input:focus, .auth textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft) }
.auth input[type="checkbox"] { margin-right:8px }
.auth button, .auth .btn {
  display:inline-flex; align-items:center; justify-content:center; height:36px; padding:0 14px; border-radius:8px; font-weight:500;
  border:1px solid var(--line); background:var(--surface); color:var(--ink); cursor:pointer; margin:4px 6px 4px 0; text-decoration:none;
}
.auth button:hover, .auth .btn:hover { background:var(--inset) }
.auth button[type="submit"] { background:var(--accent-btn); border-color:var(--accent-btn); color:var(--accent-ink) }
.auth button[type="submit"]:hover { filter:brightness(1.07) }
.auth ul.errorlist { list-style:none; padding:0; margin:0 0 8px; font-size:12.5px; color:var(--red) }
.auth .helptext, .auth small { color:var(--ink3); font-size:12px }
.auth img { background:#fff; padding:10px; border-radius:10px; border:1px solid var(--line); max-width:100% }
.auth hr { border:0; border-top:1px solid var(--line); margin:18px 0 }
.auth code, .auth pre { font-size:12.5px; background:var(--inset); border:1px solid var(--line); border-radius:6px; padding:1px 5px }
.auth pre { padding:10px; overflow:auto }
.auth ul { padding-left:18px }
.auth a { color:var(--accent) }

/* ---------- motion ---------- */
@keyframes enter { from { opacity:0; transform:translateY(6px) } to { opacity:1; transform:none } }
@keyframes fade { from { opacity:0 } to { opacity:1 } }
@keyframes sheet-in { from { transform:translateX(110%) } to { transform:none } }
@keyframes sheet-out { from { transform:none; opacity:1 } to { transform:translateX(40px); opacity:0 } }
@keyframes pulse { 0% { transform:scale(.6); opacity:.7 } 100% { transform:scale(1.6); opacity:0 } }
@keyframes spin { to { transform:rotate(360deg) } }
@keyframes draw { to { stroke-dashoffset:0 } }
@keyframes shimmer { from { background-position:-60px 0 } to { background-position:calc(100% + 60px) 0 } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:.001ms !important; animation-delay:0s !important; animation-iteration-count:1 !important;
    transition-duration:.001ms !important; transition-delay:0s !important; scroll-behavior:auto !important;
  }
  .pulse::after { display:none }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .main { padding:22px 24px 60px }
  .r { grid-template-columns:minmax(0, 2fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr) 44px; }
  .r > .time { display:none }
  .go { font-size:0; gap:0 }
}
@media (max-width: 899px) {
  /* sidebar -> top bar: brand, new request and user tools on one row, nav scrolls sideways */
  .app { grid-template-columns:minmax(0, 1fr) }
  .app:not(.anon) > .main { grid-column:1 }
  .sidebar {
    position:sticky; top:0; bottom:auto; width:auto; overflow:visible; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center; gap:6px 8px;
    border-right:0; border-bottom:1px solid var(--line); padding:8px 12px;
  }
  .brand { padding:4px 6px; order:1 }
  .newbtn { order:2; margin:0 0 0 auto; padding:7px 10px }
  .newbtn kbd { display:none }
  .side-foot { order:3; margin:0; border:0; padding:0; flex-direction:row; align-items:center }
  .side-foot .nav .lbl-t, .me .who, .side-foot .nav.sec .lbl-t { display:none }
  .side-foot .nav { padding:6px }
  .me { padding:0 4px }
  .navs {
    order:4; width:100%; flex-direction:row; overflow-x:auto; overflow-y:hidden; gap:2px; padding:6px 6px 8px;
    scrollbar-width:none; -webkit-overflow-scrolling:touch; scroll-padding-inline:6px;
  }
  .navs::-webkit-scrollbar { display:none }
  .navlabel { display:none }
  .nav { flex:none; padding:6px 10px }
  .nav.on::before { left:10px; right:10px; top:auto; bottom:-2px; width:auto; height:2px }
  .nav .badge, .nav .soon { margin-left:4px }
  .main { padding:18px 16px 60px }
  .kpis { grid-template-columns:repeat(2, minmax(0, 1fr)) }
  .kpi:nth-child(2) { border-right:0 }
  .kpi:nth-child(-n+2) { border-bottom:1px solid var(--line) }
  .search { max-width:none; flex-basis:100% }
  .seg { max-width:100%; overflow-x:auto; scrollbar-width:none }
  .r {
    grid-template-columns:minmax(0, 1fr) auto; grid-template-areas:"sup amt" "asset st"; gap:8px 12px; padding:12px 14px;
  }
  .r > .sup { grid-area:sup } .r > .amt { grid-area:amt } .r > .asset { grid-area:asset } .r > .stc { grid-area:st; justify-self:end; text-align:right }
  .r > .time, .r > .go { display:none }
  .r .mini { margin-left:auto }
  .wkl { padding:9px 14px }
  .sheet, .drawer.sheet { top:0; right:0; bottom:0; width:100%; max-width:100%; border-radius:0; border:0 }
  .dg { grid-template-columns:minmax(0, 1fr) }
  .dhead .total { text-align:left }
  .tx { grid-template-columns:minmax(0, 1fr) auto; gap:4px 10px }
  .tx.hd { display:none }
  .main.auth { padding-top:32px }
}
@media (max-width: 520px) {
  .prow-in { grid-template-columns:minmax(0, 1fr) }
  .amt-hero { flex-direction:column; align-items:flex-start }
  .amt-hero .time { text-align:left }
  .ph, .pb, .pf { padding-left:16px; padding-right:16px }
  .pf-side { padding-right:16px }
  .kv { grid-template-columns:84px minmax(0, 1fr) }
  .fpop { width:min(300px, calc(100vw - 32px)) }
  .fpop .two-col { grid-template-columns:minmax(0, 1fr) }
}

/* page-level notices (history, admin pages) */
#payment-body > .warnbox, .main > .warnbox { margin-bottom:16px }
.dhead .sup { align-items:center }
.dhead .sup .ava { width:38px; height:38px; border-radius:10px; font-size:14px }
label.check { display:inline-flex; gap:8px; align-items:center; font-size:13px; color:var(--ink) }
.tbl td .sup .av { width:24px; height:24px; font-size:10.5px }
.tbl td b { font-weight:500 }
.stack > b { display:flex; align-items:center; min-width:0 }
.stack > b > a.rl, .stack > b > .nm { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0 }
.stack > b > .w, .stack > b > .plus { flex:none }
.stack > b > .plus { margin-left:5px }
.auth .auth-brand { color:var(--ink) }
.wtop .w::before { display:none }
select.in.sm { padding-right:26px; background-position:calc(100% - 13px) 52%, calc(100% - 9px) 52% }
.panel form > p > label.m + br { display:none }
.panel form > p > .in { max-width:520px }

/* flash messages: errors / warnings stay until dismissed */
.msg-x { margin-left:auto; border:0; background:transparent; color:var(--ink3); width:22px; height:22px; border-radius:5px; display:grid; place-items:center; padding:0 }
.msg-x:hover { background:var(--inset); color:var(--ink) }
.msg-x svg.i { width:13px; height:13px }
.approve-hint { margin:0 0 2px; flex-basis:100% }
.pf .hist { font-size:12px; color:var(--ink2); text-decoration:none; padding:0 4px }
.pf .hist:hover { color:var(--ink); text-decoration:underline }
.sheet:focus { outline:0 }

.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0 }

/* ---------- P&L: entries screen + entry panel (sketch docs/mockups/pnl-v2.html) ---------- */
.pnl-head { align-items:center }
.mswitch { display:inline-flex; align-items:center; gap:6px }
.mswitch b { font-weight:500; min-width:120px; text-align:center }
.mswitch .btn { width:28px; padding:0; font-size:16px }
.chips { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px }
.chip { border:1px solid var(--line); border-radius:20px; padding:3px 11px; font-size:12.5px; color:var(--ink2); text-decoration:none; background:var(--surface); transition:background .15s, color .15s }
.chip:hover { background:var(--inset); color:var(--ink) }
.chip.on { background:var(--navy); border-color:var(--navy); color:var(--navy-ink) }
.ent td { vertical-align:top }
.ent .d { color:var(--ink2); white-space:nowrap }
.ent .desc a.rl { color:var(--ink); font-weight:500 }
.ent .desc small { display:block; color:var(--ink3); font-size:12px; margin-top:2px }
.ent tr.e:hover { background:var(--inset) }
.ent tr.split td { border-bottom:1px solid var(--line2); color:var(--ink2); font-size:12.5px; padding-top:5px; padding-bottom:5px; background:var(--inset) }
.ent tr.split q { color:var(--ink3) }
.cat { display:inline-block; border:1px solid var(--line); border-radius:6px; padding:0 7px; font-size:12px; color:var(--ink2); margin:0 4px 4px 0; white-space:nowrap }
.cat.inc { color:var(--green); border-color:color-mix(in srgb, var(--green) 40%, var(--line)) }
.meth { display:inline-flex; align-items:center; gap:7px; white-space:nowrap }
.ent .proof a, .ent .proof span { display:block; font-size:12px }
.ent .proof a.att { color:var(--ink2); text-decoration:none }
.ent .proof a.att:hover { color:var(--accent); text-decoration:underline }
.amtc { font-weight:500; white-space:nowrap }
.amtc.pos { color:var(--green) }
.amtc.neg { color:var(--red) }
.warnbox.amber { border-color:color-mix(in srgb, var(--amber) 35%, var(--line)); background:var(--amber-soft) }
.warnbox.amber::before { background:var(--amber) }
.warnbox .m { color:var(--ink2); font-size:12.5px }
.sheet > form.entry-form { display:contents }
.kseg { display:grid; grid-template-columns:repeat(3, 1fr); border:1px solid var(--line); border-radius:9px; overflow:hidden }
.kseg label { position:relative; border-right:1px solid var(--line); cursor:pointer }
.kseg label:last-child { border-right:0 }
.kseg input { position:absolute; opacity:0; inset:0; margin:0; cursor:pointer }
.kseg span { display:flex; align-items:center; justify-content:center; height:34px; color:var(--ink2); transition:background .15s, color .15s }
.kseg input:checked + span { background:var(--navy); color:var(--navy-ink); font-weight:500 }
.kseg input:focus-visible + span { outline:2px solid var(--accent); outline-offset:-2px }
.row2 { display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, 1fr); gap:10px }
.in.tot { font-weight:600 }
.splitbox { border:1px solid var(--line); border-radius:10px; overflow:hidden }
.slh, .sl { display:grid; grid-template-columns:minmax(0, 1.3fr) 104px minmax(0, 1fr) 26px; gap:8px; align-items:center }
.slh { font-size:11.5px; color:var(--ink3); padding:8px 10px 0 }
.sl { padding:8px 10px; border-bottom:1px solid var(--line2) }
.sl .in { min-height:32px; padding:5px 9px; font-size:13px }
.sl select.in { padding-right:26px }
.x { border:0; background:transparent; color:var(--ink3); font-size:17px; line-height:1; width:26px; height:26px; border-radius:6px; cursor:pointer }
.x:hover { background:var(--inset); color:var(--red) }
.addrow { padding:8px 12px }
.addrow:empty { display:none }
.hrows { display:flex; flex-direction:column; gap:6px }
.hrow { display:flex; gap:6px; align-items:center }
.hrow .in { flex:1 }
.fl > .addrow { padding:6px 0 0 }
.sltot { display:flex; justify-content:space-between; gap:10px; padding:9px 12px; background:var(--inset); font-size:13px; border-top:1px solid var(--line2) }
.sltot b { font-weight:600 }
.sltot .ok { color:var(--green); font-weight:500 }
.sltot .bad { color:var(--red); font-weight:500 }
details.newcat { margin-top:8px; font-size:12.5px; color:var(--ink2) }
details.newcat > summary { list-style:none; cursor:pointer }
details.newcat > summary::-webkit-details-marker { display:none }
.newcat-in { display:grid; grid-template-columns:minmax(0, 1.4fr) minmax(0, 1fr) auto; gap:8px; margin-top:8px; align-items:center }
.newcat-in .in { min-height:30px; padding:4px 9px; font-size:12.5px }
details.newcat p { margin:6px 0 0 }
.rcur { display:flex; gap:12px; align-items:center; margin-bottom:8px; font-size:13px }
.rcur label.m { margin:0; display:inline-flex; gap:5px; align-items:center }
.in.file { padding:6px 9px; font-size:12.5px; border-style:dashed; cursor:pointer }
.fl > .hint { display:block; margin-top:5px; color:var(--ink3); font-size:12px }
.ro-line { grid-template-columns:minmax(0, 1fr) minmax(0, 1fr) auto }
.ro-line .m { color:var(--ink3) }
@media (max-width: 899px) {
  .rows .ent { min-width:720px }
}
@media (max-width: 520px) {
  .row2, .newcat-in { grid-template-columns:minmax(0, 1fr) }
  .slh { display:none }
  .sl { grid-template-columns:minmax(0, 1fr) 96px 26px }
  .sl > input[name$="-note"] { grid-column:1 / 3; grid-row:2 }
}

/* ---------- P&L: month summary, owner side (waterfall, partners), categories ---------- */
.nav.sub { padding:5px 10px 5px 36px; font-size:12.5px }
.nav.sub.on::before { top:6px; bottom:6px }
.pnl-head .tools { align-items:center; flex-wrap:wrap }
.pnl-month { margin-bottom:16px }
.msum { margin-bottom:0 }
.msum-h { display:flex; justify-content:space-between; align-items:baseline; gap:10px; padding:14px 18px 10px; flex-wrap:wrap }
.msum-h h3 { margin:0; font-size:14px; font-weight:600 }
.msum-h small { color:var(--ink3); font-size:12px }
.grp { display:flex; justify-content:space-between; gap:10px; padding:8px 18px; background:var(--inset); border-top:1px solid var(--line); border-bottom:1px solid var(--line2); font-size:12px; color:var(--ink2) }
.grp b { color:var(--ink); font-weight:500 }
.mline { display:flex; justify-content:space-between; gap:10px; padding:8px 18px; border-bottom:1px solid var(--line2); color:inherit; text-decoration:none; transition:background .12s }
a.mline:hover { background:var(--inset) }
a.mline:hover span { color:var(--accent) }
.mline b { font-weight:500; white-space:nowrap }
.mline.add { border-bottom:0; font-size:12.5px }
.mline.add a { text-decoration:none; color:var(--accent); font-weight:500 }
.mline.add a:hover { text-decoration:underline }
.mtot { display:flex; justify-content:space-between; gap:10px; padding:11px 18px; background:var(--inset); border-top:1px solid var(--line); font-weight:500 }
.mtot small { color:var(--ink3); font-weight:400; font-size:12px; margin-left:6px }
.mtot b { font-weight:600; white-space:nowrap }
.mtot + .mtot { border-top-color:var(--line2) }
.kvrow { display:flex; justify-content:space-between; gap:10px; padding:6px 0; font-size:13.5px }
.kvrow b { font-weight:500 }
.fin-note .m { margin:10px 0 0 }
.trafform { margin:0 }
.bigin { display:flex; align-items:center; gap:6px; border:1px solid var(--line); border-radius:10px; padding:0 12px; min-height:46px; font-size:20px; font-weight:600; background:var(--surface); transition:border-color .15s, box-shadow .15s }
.bigin:focus-within { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft) }
.bigin .in { border:0; box-shadow:none; background:transparent; font:inherit; text-align:right; padding:0; min-height:44px }
.bigin .in:focus { box-shadow:none }
.trafv { font-size:20px; font-weight:600; letter-spacing:-.02em; padding:4px 0 2px }
.trafv .m { font-size:13px; font-weight:400 }
.saved { font-size:12px; font-weight:500; animation:fade .3s var(--ease) both }
.ferr { margin:6px 0 0; color:var(--red); font-size:12.5px }
.wf { margin-top:10px }
.wfr { display:grid; grid-template-columns:minmax(0, 1fr) auto; gap:6px 8px; align-items:center; padding:8px 0; border-bottom:1px dashed var(--line) }
.wfr > span { color:var(--ink2) }
.wfr > b { font-weight:500; white-space:nowrap }
.wfb { grid-column:1 / -1; height:6px; border-radius:6px; background:var(--line2); overflow:hidden }
.wfb i { display:block; height:100%; width:0; border-radius:6px; background:var(--accent); transition:width .8s var(--ease) }
.wfb i.inc { background:var(--green) }
.wfb i.exp { background:var(--red) }
.wfr.net { border-bottom:0; padding-top:12px }
.wfr.net > span { color:var(--ink); font-weight:600 }
.wfr.net > b { font-size:22px; font-weight:600; letter-spacing:-.02em }
.wfr .chg { grid-column:1 / -1; font-size:12px; color:var(--ink2) }
.parts { margin-bottom:0 }
.bridge { display:flex; gap:6px; flex-wrap:wrap; align-items:center; padding:10px 18px; border-top:1px solid var(--line2); font-size:12.5px; color:var(--ink2) }
.bridge b { color:var(--ink); font-weight:500 }
.parts .tbl td { white-space:nowrap }
.parts .tbl tr.sum td { background:var(--inset); font-weight:600; border-top:1px solid var(--line) }
.tookform { display:inline-flex; gap:6px; align-items:center; margin:0 }
.in.sm.took { width:104px; text-align:right }
.chk { margin:0; padding:10px 18px; font-size:12.5px; border-top:1px solid var(--line2) }
.chk.ok { color:var(--green) }
.chk.bad { color:var(--red) }
.catnew { display:grid; grid-template-columns:minmax(0, 1.6fr) minmax(0, 1fr) auto; gap:8px; max-width:620px }
.rows > h4 .m { font-weight:400; margin-left:4px }
.tbl.cats td:first-child { width:100% }
.tbl.cats tr.is-hidden td:first-child { color:var(--ink3) }
details.catedit { display:inline-block; text-align:left }
details.catedit > summary { list-style:none; display:inline-flex }
details.catedit > summary::-webkit-details-marker { display:none }
details.catedit[open] > summary { background:var(--inset) }
.catform { display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; margin-top:8px }
.catform .in.sm { min-width:140px }
.chk-l { display:inline-flex; gap:5px; align-items:center }
@media (max-width: 899px) {
  .nav.sub { padding:6px 10px; font-size:13px }
  .parts { overflow-x:auto }
}
@media (max-width: 520px) {
  .catnew { grid-template-columns:minmax(0, 1fr) }
  .pnl-head .tools { margin-left:0; width:100% }
}
.nav.open { color:var(--ink) }

/* ---------- P&L: overview (owner only; server-rendered SVG charts, no inline style) ---------- */
.ovk { margin-bottom:18px }
.ovempty { border:1px dashed var(--line); border-radius:10px; margin:0 0 16px }
.ovcharts { display:grid; grid-template-columns:minmax(0, 1.6fr) minmax(0, 1fr); gap:16px; margin-bottom:16px }
.ovchart { padding:14px 16px 10px; margin-bottom:0 }
.ovchart-h { display:flex; justify-content:space-between; align-items:baseline; gap:10px; flex-wrap:wrap; margin-bottom:6px }
.ovchart-h h3 { margin:0; font-size:14px; font-weight:600 }
.ovlegend { display:inline-flex; gap:12px; font-size:12px; color:var(--ink2); flex-wrap:wrap }
.ovlegend > span { display:inline-flex; align-items:center; gap:5px }
.ovlegend .sw { width:9px; height:9px; border-radius:2px; background:var(--accent) }
.ovlegend .sw.exp { background:var(--red); opacity:.75 }
.ovc { display:block; width:100%; height:auto; max-height:240px; overflow:visible }
.ovc text { fill:var(--ink3); font-size:10px; font-family:inherit; font-variant-numeric:tabular-nums }
.ovc text.yl { text-anchor:end }
.ovc text.xl { text-anchor:middle }
.ovc .grid line { stroke:var(--line2); stroke-width:1 }
.ovc line.base { stroke:var(--line); stroke-width:1.2 }
.ovc .bar { fill:var(--accent); transform-box:fill-box; transform-origin:50% 100%; animation:ovgrow .7s var(--ease) both }
.ovc .bar.neg { transform-origin:50% 0 }
.ovc .bar.exp { fill:var(--red); opacity:.75 }
.ovc .bar.inc.neg { fill:var(--red); opacity:1 }
.ovc .bar:hover { opacity:.85 }
.ovc .mo:nth-child(2) .bar { animation-delay:.03s } .ovc .mo:nth-child(3) .bar { animation-delay:.06s }
.ovc .mo:nth-child(4) .bar { animation-delay:.09s } .ovc .mo:nth-child(5) .bar { animation-delay:.12s }
.ovc .mo:nth-child(6) .bar { animation-delay:.15s } .ovc .mo:nth-child(7) .bar { animation-delay:.18s }
.ovc .mo:nth-child(n+8) .bar { animation-delay:.21s }
.ovc .area { fill:var(--accent); fill-opacity:.1; animation:fade .6s .3s var(--ease) both }
.ovc .pl { fill:none; stroke:var(--accent); stroke-width:2.5; stroke-linejoin:round; stroke-linecap:round; stroke-dasharray:1; stroke-dashoffset:1; animation:draw .9s var(--ease) forwards }
.ovc .pt { fill:var(--surface); stroke:var(--accent); stroke-width:2 }
.ovc .pt.last { fill:var(--accent) }
.ovc .pt.neg { stroke:var(--red) }
.ovc .pt.neg.last { fill:var(--red) }
@keyframes ovgrow { from { transform:scaleY(0) } to { transform:scaleY(1) } }
.ovt td:first-child { white-space:nowrap }
.ovt tbody tr { position:relative; cursor:pointer }
.ovt a.rl { color:var(--ink) }
.ovt a.rl::after { content:""; position:absolute; inset:0 }
.ovt a.rl:hover { color:var(--accent) }
.ovt a.rl:focus-visible { outline:0 }
.ovt a.rl:focus-visible::after { outline:2px solid var(--accent); outline-offset:-2px; border-radius:2px }
.ovt .pill { margin-left:6px }
.ovnote { margin:-6px 0 0 }
@media (max-width: 899px) {
  .ovcharts { grid-template-columns:minmax(0, 1fr) }
}

/* ---------- P&L: partners page (owner only) ---------- */
.partform { max-width:620px }
.partstart { max-width:200px; margin-bottom:12px }
.partrows { display:grid; grid-template-columns:minmax(0, 1.6fr) minmax(0, .7fr) minmax(0, 1fr); gap:8px }
.partrows .ph { font-size:12px; color:var(--ink2) }
.partrows .in.num { text-align:right }
.partnote { margin:12px 0; font-size:12.5px; color:var(--ink3) }
.partsh { display:inline-block; margin-right:14px; white-space:nowrap }
.partsh b { font-weight:500 }
.msum-h .edit-link { color:var(--accent); text-decoration:none; font-weight:500 }
.msum-h .edit-link:hover { text-decoration:underline }
.partform .warnbox { margin-bottom:12px }
