/* Budget: built from Recurring's pieces (.rec-sum, .rec-list, .rec-insp, .rec-kv), with what is its own:
   the bars, their mark and the setup. Recurring's rules that name its page are repeated here for this one. */
#bg-page{display:grid;gap:16px}
[data-page="budget"]{gap:16px}
[data-page="budget"] .w-rrow{text-align:start}
[data-page="budget"] .w-rrow .w-ico{border-radius:10px}
[data-page="budget"] .w-rrow .w-ico svg.i{width:18px;height:18px}
[data-page="budget"] .w-rrow h6{font-size:16px;font-weight:500}
[data-page="budget"] .w-rrow p{font-size:var(--fs-foot);color:var(--w-ink2)}
[data-page="budget"] .w-rrow .amt{font-size:16px;font-weight:400;text-align:end}
[data-page="budget"] .w-rrow .amt small{font-size:12px;color:var(--w-ink2)}
.bg-one{display:grid;grid-template-columns:minmax(0,1fr)}

/* A limit: its name and what was spent, the bar under them, what is left on the right */
.bg-row{align-items:start!important}
.bg-row .w-ico{margin-top:2px}
.bg-row .rec-rn p{display:block}
.bg-row .amt{min-width:96px}
.bg-row .amt small.over{color:var(--w-bad)}
div.bg-row{cursor:default}
div.bg-row:hover{background:none}
.rec-list .bg-row{row-gap:8px}
.bg-row > .w-ico{grid-row:1/span 2}
.bg-row > .bg-bar{grid-column:2/-1;margin-top:0}
.bg-bar{position:relative;height:6px;border-radius:3px;background:var(--w-fill2);margin-top:9px}
/* What was spent; bills still due carry on from it, in a lighter shade, as one bar: square where they meet, rounded only
   at the ends. A limit gone over is red. Every bar, the lead's too, is in the same pastel (the accent and the red at
   lightness 73%, saturation 85%), as the Recap and its PDF draw them: solid accent is for what can be tapped; the lead
   stands out by its card, its size and its number. --bg-under is what a bar sits on. */
:root{--bg-spent:#808AF5;--bg-overc:#F58083}
.bg-bar{--bg-under:var(--w-panel);--bg-due:color-mix(in srgb,var(--bg-spent) var(--bg-mix),var(--bg-under))}
.bg-bar.over{--bg-due:color-mix(in srgb,var(--bg-overc) var(--bg-mix),var(--bg-under))}
.bg-bar i{position:absolute;inset-block:0;inset-inline-start:0;border-radius:inherit;background:var(--bg-spent);max-width:100%}
.bg-bar i:not(:last-child){border-start-end-radius:0;border-end-end-radius:0}
.bg-bar i.due{background:var(--bg-due);border-start-start-radius:0;border-end-start-radius:0}
.bg-bar.over i:not(.due){background:var(--bg-overc)}
/* The even pace by today: a short, thin mark across the bar */
.bg-bar u{position:absolute;top:-5px;bottom:-5px;width:1.5px;border-radius:1px;background:var(--w-ink)}
/* With a mouse the whole bar shows a tooltip: a target taller than the 6 px it draws */
@media (hover:hover){.bg-bar::before{content:"";position:absolute;inset:-8px 0}}
/* Its tooltip: the name, spent, bills still due, what is left or over; this month the even pace (drawn as the mark),
   and how far apart they are */
.w-tip .bg-tiph{display:block;margin-bottom:4px}
/* The pace's key is a piece of the bar, as wide as Spent's square, with the mark across it: not a bare line, which reads as a letter */
.w-tip .r i.bg-tk{position:relative;width:10px;height:4px;border-radius:2px;background:color-mix(in srgb,var(--w-ink) 22%,transparent);margin-inline:0 4px}
.w-tip .r i.bg-tk::after{content:"";position:absolute;inset-inline-start:4.25px;top:-3.5px;bottom:-3.5px;width:1.5px;border-radius:1px;background:var(--w-ink)}
.w-tip .r .bg-good{color:var(--w-good)}
.w-tip .r .bg-bad{color:var(--w-bad)}
.w-tip .bg-tippace{margin-top:5px;padding-top:5px;border-top:1px solid var(--w-line2)}
/* Without a limit: a shorter row, a smaller tile; this month it opens the sheet */
.rec-list .bg-none{min-height:46px;padding-block:6px}
.bg-none .w-ico{width:32px!important;height:32px!important;border-radius:8px!important;justify-self:center}
.bg-none .w-ico svg.i{width:16px!important;height:16px!important}
.bg-none h6{font-weight:400!important}
div.bg-none{cursor:default}
div.bg-none:hover{background:none}
/* The panel: no rule under every row, one under each heading */
.bg-insp .rec-kv{border-top:0;min-height:40px;padding-block:8px}
.bg-insp .rec-kvs{border-top:1px solid var(--w-line2);padding-top:4px}
.bg-insp .rec-sh{border-bottom:1px solid var(--w-line2);margin-bottom:4px}
/* A transaction: the name shrinks to an ellipsis, the date and the amount never shrink or wrap. The panel's grid tracks
   take min-width 0, or a long unwrapped name would widen the whole panel past its edge */
.bg-insp,.bg-insp .rec-sec2{grid-template-columns:minmax(0,1fr)}
.bg-insp .bg-tx > span{flex:1 1 auto;min-width:0;display:flex;color:var(--w-ink)}
.bg-tx .bg-txn{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bg-tx .bg-txd{flex:none;white-space:nowrap}
.bg-tx > b{flex:none;white-space:nowrap}
/* The lead: spent against the limit for everything, as a bar with a quiet key under it */
.bg-sum .rec-big{margin-bottom:2px}
/* Its eyebrow with Edit on the right, as a limit's panel has it */
.bg-eyeh{display:flex;align-items:baseline;gap:8px}
/* The per-day line with the limit on its right, over the bar's end; the limit wraps under it, still on the right */
.bg-top{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 16px}
.bg-lim{margin-inline-start:auto;font-size:var(--fs-foot);color:var(--w-ink2);white-space:nowrap}
.bg-lim b{font-weight:400;font-variant-numeric:tabular-nums}
.bg-lead{margin-top:8px}
/* The lead, with its bar or without a limit, is a card from 768 px, as the Summary's number with its chart is; on phones it sits on the page.
   --bg-lead-under is what its bar and key sit on */
.bg-sum{--bg-lead-under:var(--w-canvas)}
@media (min-width:768px){
  .bg-card{--bg-lead-under:var(--w-panel);background:var(--w-panel);border-radius:var(--r-card);padding:20px 22px;box-shadow:0 1px 2px rgba(20,22,27,.04)}
}
.bg-lead .bg-bar{--bg-under:var(--bg-lead-under);height:10px;border-radius:5px;margin-top:0}
.bg-key{display:flex;flex-wrap:wrap;align-items:center;gap:4px 16px;margin-top:8px;font-size:var(--fs-foot);color:var(--w-ink2)}
.bg-key span{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.bg-key b{font-weight:400;font-variant-numeric:tabular-nums}
.bg-key i{display:inline-block;width:10px;height:10px;border-radius:3px;background:var(--bg-spent)}
.bg-key i.du{background:color-mix(in srgb,var(--bg-spent) var(--bg-mix),var(--bg-lead-under))}
.bg-key i.over{background:var(--bg-overc)}
.bg-key i.du.over{background:color-mix(in srgb,var(--bg-overc) var(--bg-mix),var(--bg-lead-under))}

/* The lighter shade for bills still due: stronger in dark mode, where 38% sinks into the track */
:root{--bg-mix:38%}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--bg-mix:55%}}
:root[data-theme="dark"]{--bg-mix:55%}

@media (max-width:767px){
  .bg-list{padding:4px 16px 10px}
  [data-page="budget"] .w-rrow h6{font-size:var(--fs-body);font-weight:400}
  [data-page="budget"] .w-rrow .amt{font-size:var(--fs-body)}
  .bg-row .amt{min-width:84px}
  /* No chevron next to ‹ ›: the person button is just the faces, as on the Summary */
  .bg-head .w-hact{margin-inline-start:0}
}
