/* Mercy: the public vault. The same shell as the trading screen: the full-width 48px top bar, then panels on an
   8px gutter. The hero is the pool balance, one large figure beside the safe render; the four flows that make it
   up sit under it as one line, coloured as the chart colours them (fees white, rebates mint, burns grey). */

.vault { --gap: 8px; --chart-burn-ink: #A4ACA7; }
.col { width: 100%; padding-inline: var(--gap); }

/* ---------- the head: the pool, beside the safe ---------- */
.head { position: relative; }
.head-in {
  position: relative; display: grid; column-gap: 40px;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 380px);
  grid-template-areas: "title safe" "pool safe" "sub safe" "finding safe" "flows flows" "period period";
  padding: 28px calc(var(--gap) + var(--card-pad)) 32px;
}
.title-row { grid-area: title; display: flex; align-items: center; gap: 14px; }
.head h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
.pool { grid-area: pool; margin-top: 18px; font-size: clamp(64px, 7.4vw, 112px); font-weight: 900; line-height: .95; letter-spacing: -0.045em; white-space: nowrap; }
.pool .unit { font-size: .26em; font-weight: 700; letter-spacing: 0; color: var(--muted); margin-left: 4px; }
.pool-sub { grid-area: sub; margin-top: 12px; font-size: 16px; color: var(--muted); }
.finding { grid-area: finding; margin-top: 20px; font-size: 17px; line-height: 1.5; color: var(--muted); max-width: 640px; }
.finding b { color: var(--text); font-weight: 700; }
.safe { grid-area: safe; align-self: center; justify-self: end; width: 100%; max-width: 300px; height: auto; margin: -16px 32px -72px 0; }

/* the flows: four figures on one line, each as wide as its words, no boxes */
.flows { grid-area: flows; display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 20px clamp(28px, 4.4vw, 64px); margin-top: 32px; }
.fl dt { display: flex; align-items: center; gap: 7px; font-size: var(--fs-small); color: var(--faint); white-space: nowrap; }
.fl dd { margin-top: 4px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; }
.fl-sub { margin-top: 4px; font-size: var(--fs-small); color: var(--faint); line-height: 1.4; }
.fl-out dd { color: var(--positive); }
.fl-burn dd { color: var(--chart-burn-ink); }
#kPause { display: inline-flex; align-items: center; gap: 8px; }
#kPause::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--positive); }
#kPause.paused::before { background: var(--negative); }
.period { grid-area: period; margin-top: 22px; font-size: var(--fs-small); }

.body { display: flex; flex-direction: column; gap: var(--gap); padding: 0 var(--gap) 40px; }

/* ---------- row two: the flow chart and the pause meter ---------- */
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: var(--gap); align-items: stretch; }
.flow { display: flex; flex-direction: column; min-height: 320px; }
.flow-head { gap: 18px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: var(--fs-small); white-space: nowrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw-in { background: var(--chart-2); }
.sw-reb { background: var(--chart-1); }
.sw-burn { background: var(--chart-3); }
.readout { padding: 0 var(--card-pad); height: 20px; font-size: var(--fs-small); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout b { color: var(--text); font-weight: 500; }
.flow-wrap { position: relative; flex: 1; min-height: 260px; margin: 0 8px 8px; }
.flow-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#flowChart text { font: 400 12px var(--font); font-variant-numeric: tabular-nums; fill: var(--axis-ink); }
#flowChart .note { fill: var(--text); font-weight: 500; }
#flowChart .bar-hit { cursor: default; }

.side { display: flex; flex-direction: column; gap: var(--gap); }
.ratio { display: flex; flex-direction: column; }
.ratio-body { padding: 2px var(--card-pad) 6px; display: flex; flex-direction: column; gap: 12px; }
.sub-h { display: flex; justify-content: space-between; align-items: baseline; padding: 12px var(--card-pad) 6px; font-size: 14px; font-weight: 700; }
.sub-h .faint { font-weight: 400; font-size: var(--fs-small); }
.meter-row { display: flex; justify-content: space-between; color: var(--muted); }
.meter-row b { color: var(--text); font-weight: 700; font-size: 15px; }
.meter-track { position: relative; height: 8px; margin-top: 8px; border-radius: 4px; background: var(--raised); }
.meter-track span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--positive); }
.pause-tick { position: absolute; left: 80%; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 1px; }
.meter-scale { position: relative; height: 16px; margin-top: 6px; font-size: var(--fs-small); color: var(--faint); }
.meter-scale span:last-child { position: absolute; left: 80%; transform: translateX(-50%); white-space: nowrap; }
.meter-scale span:first-child { position: absolute; left: 0; }
.settings { padding: 0 var(--card-pad) 12px; }
.settings div { display: flex; justify-content: space-between; align-items: center; height: 33px; border-top: 1px solid var(--rule); gap: 12px; }
.settings dt { color: var(--muted); }
.settings dd { font-weight: 500; white-space: nowrap; }

/* ---------- the ledger ---------- */
.ledger-head { gap: 24px; border-bottom: 1px solid var(--rule); min-height: 52px; }
.ledger-head .tabs button { height: 52px; }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 34px; width: 280px; padding: 0 12px; border-radius: var(--radius-control); background: var(--ground); color: var(--faint); border: 1px solid transparent; }
.search:focus-within { border-color: var(--control); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; }
.search input::placeholder { color: var(--faint); }
.ledger table { table-layout: fixed; }
.ledger th:nth-child(1) { width: 118px; }
.ledger th:nth-child(2) { width: 168px; }
.ledger th:nth-child(4) { width: 132px; text-align: right; }
.ledger td.wallet { text-align: right; }
.ledger th:nth-child(5) { width: 140px; }
.ledger th:nth-child(6) { width: 140px; }
.ledger tbody tr:first-child td { border-top-color: transparent; }
.ledger td { height: 44px; }
.ledger td.detail { white-space: normal; line-height: 1.35; padding-top: 8px; padding-bottom: 8px; color: var(--muted); }
.ledger td.detail b { color: var(--text); font-weight: 500; }
.ledger td.wallet { color: var(--muted); }
.ledger td.amt { font-weight: 500; }
.kind { display: inline-flex; align-items: center; gap: 8px; }
.kind i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.kind-fee i { background: var(--chart-2); }
.kind-rebate i { background: var(--chart-1); }
.kind-burn i { background: var(--chart-3); }
.demo-tag { margin-left: 8px; height: 22px; font-size: 12px; }
tr.mine { background: #0F1F17; }
tr.mine td, tbody tr.mine:hover td { background: transparent; }
tr.flash { animation: rowFlash 2.4s ease-out; }
@keyframes rowFlash { 0% { background: #1B4430; } 100% { background: #0F1F17; } }
.m-sub { display: none; }
.ledger td.m-link { display: none; }
.ledger td.back { color: var(--positive); } /* mint means money returned to a holder, on every page */
.ledger-foot { display: flex; align-items: center; gap: 16px; padding: 12px var(--card-pad) 14px; border-top: 1px solid var(--rule); }
.foot-note { margin-left: auto; font-size: var(--fs-small); }
.ledger .empty { margin: 14px var(--card-pad); }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .row2 { grid-template-columns: 1fr; }
  .head-in { grid-template-columns: minmax(0, 1fr) 260px; column-gap: 24px; }
  .ledger th:nth-child(4), .ledger td.wallet { display: none; }
  .search { width: 220px; }
  .vault .tb-right .acct, .vault .tier-pill { display: none; }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .head-in {
    grid-template-columns: minmax(0, 1fr) 112px; column-gap: 8px;
    grid-template-areas: "title safe" "pool pool" "sub sub" "finding finding" "flows flows" "period period";
    padding: 18px var(--card-pad) 24px;
  }
  .safe { width: 112px; margin: -10px -6px -16px 0; align-self: start; }
  .title-row { flex-wrap: wrap; row-gap: 8px; align-self: center; }
  .head h1 { font-size: 22px; }
  .pool { margin-top: 10px; font-size: clamp(48px, 15vw, 64px); }
  .pool-sub { font-size: 15px; }
  .finding { font-size: 15px; margin-top: 14px; }
  .flows { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; margin-top: 22px; }
  .fl dd { font-size: 22px; }
  .body { gap: 8px; }
  .legend, .readout, .period, .settings, .meter-scale, .ledger-range, .foot-note, .fl-sub { font-size: 13px; }
  .ledger td { font-size: 14px; }
  .side { flex-direction: column; }
  .flow { min-height: 0; }
  .flow-head { flex-wrap: wrap; row-gap: 4px; padding-top: 12px; padding-bottom: 6px; }
  .flow-head .meta { display: none; }
  .legend { width: 100%; order: 3; }
  .flow-wrap { min-height: 200px; height: 200px; flex: none; }
  .readout { height: auto; white-space: normal; line-height: 1.5; padding-bottom: 4px; }
  .ledger-head { flex-wrap: wrap; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
  .ledger-head .tabs { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; gap: 16px; padding-right: 32px; -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent); mask-image: linear-gradient(90deg, #000 84%, transparent); } /* taste-skill-ignore: a scroll-edge mask on a sideways row, not a fill */
  .ledger-head .tabs button { height: 44px; }
  .ledger td.m-link { display: block; grid-column: 2; grid-row: 2; align-self: center; text-align: right; }
  .ledger td.m-link .link { position: relative; font-size: 13px; }
  .ledger td.m-link .link::before { content: ""; position: absolute; inset: -14px -6px; }
  #moreBtn { height: 44px; }
  .search { height: 44px; }
  .search input { font-size: 16px; }
  .search { order: 4; width: 100%; margin: 0; height: 40px; }
  .ledger table, .ledger tbody { display: block; }
  .ledger thead { display: none; }
  .ledger tr { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 3px; padding: 10px var(--card-pad); border-top: 1px solid var(--rule); }
  .ledger tbody tr:first-child { border-top: 0; }
  .ledger td { display: none; height: auto; padding: 0; border: 0; }
  .ledger td.m-show { display: block; }
  .ledger td.amt { text-align: right; }
  .ledger td.m-sub { display: block; grid-column: 1; grid-row: 2; align-self: center; color: var(--faint); font-size: 13px; white-space: normal; line-height: 1.45; }
  .ledger tbody tr:hover td { background: none; }
  .ledger-foot { flex-wrap: wrap; }
  .foot-note { margin-left: 0; width: 100%; }
}
