/* Spending › Live › Categories (SL-002). Pocket tokens only, so both themes work.
   Desktop >= 769px: a header (breadcrumb, totals, play) and the three-column stage of pill nodes.
   Phone <= 768px: a stacked bar and rows that drill in place. The month comes from the shared pill row (SL-008). */
#dsub-flow.flow-view { gap: 10px; align-content: start; }
@media (min-width: 769px) { #dsub-flow.flow-view { max-width: var(--lg-max, 1280px); } }

/* header */
#dsub-flow .fl-head { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; min-height: 36px; }
#dsub-flow .fl-crumb { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13.5px; }
#dsub-flow .fl-crumb-step { border: 0; background: var(--surface-2); color: var(--text-mid); border-radius: var(--r-ctl); padding: 6px 12px; font: 600 13px var(--font-sans); cursor: pointer; min-height: 32px; }
#dsub-flow .fl-crumb-step:hover { background: var(--surface-3); color: var(--text); }
#dsub-flow .fl-crumb-sep { color: var(--text-dim); padding: 0 2px; }
#dsub-flow .fl-crumb-here { font: 700 15px var(--font-display); color: var(--text); padding: 0 4px; }
#dsub-flow .fl-tot { font-size: 12.5px; color: var(--text-dim); }
#dsub-flow .fl-tot b { font: 800 16px var(--font-display); color: var(--text); margin-right: 4px; }
#dsub-flow .fl-play { height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--accent-hi); font: 600 12.5px var(--font-sans); cursor: pointer; }
#dsub-flow .fl-play[aria-pressed="true"] { background: var(--accent-dim); }
#dsub-flow .fl-head .fl-all, #dsub-flow .fl-foot .fl-all { height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--text); font: 600 12.5px var(--font-sans); cursor: pointer; }
#dsub-flow .fl-head .fl-crumb { margin-left: auto; }  /* the breadcrumb sits at the right (SL-015) */
/* In the Live bento the breadcrumb and Play sit in the card's header (index.html #live-flow-tools) */
#live-flow-tools { display: flex; align-items: center; gap: 8px; min-width: 0; margin-left: auto; }
#live-flow-tools .fl-crumb { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13px; }
#live-flow-tools .fl-crumb-step { border: 0; background: var(--surface-2); color: var(--text-mid); border-radius: var(--r-ctl); padding: 0 10px; font: 600 12.5px var(--font-sans); cursor: pointer; min-height: 30px; }
#live-flow-tools .fl-crumb-step:hover { background: var(--surface-3); color: var(--text); }
#live-flow-tools .fl-crumb-sep { color: var(--text-dim); padding: 0 2px; }
#live-flow-tools .fl-crumb-here { font: 700 13.5px var(--font-display); color: var(--text); padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#live-flow-tools .fl-play { height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--accent-hi); font: 600 12.5px var(--font-sans); cursor: pointer; white-space: nowrap; }
#live-flow-tools .fl-play[aria-pressed="true"] { background: var(--accent-dim); }
#live-flow-tools .fl-play:focus-visible, #live-flow-tools .fl-crumb-step:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
#live-sec-flow .live-sec-expand { margin-left: 0; }
@media (pointer: coarse) and (min-width: 769px) { #live-flow-tools .fl-play, #live-flow-tools .fl-crumb-step, #dsub-flow .fl-deep, #dsub-flow .fl-play, #dsub-flow .fl-crumb-step { min-height: 48px; } }  /* a touch tablet in the desktop view (touch.md) */
.has-expanded .live-sec:not(.is-expanded) #live-flow-tools, #live-flow-tools:empty { display: none; }  /* no room in the rail; nothing on the phone */
#dsub-flow .fl-hint, #dsub-flow .fl-empty { font-size: 12.5px; color: var(--text-dim); margin: 0; }
/* The legend bar (SL-015): each category with its share, the total at the right, a thin stacked bar under it */
#dsub-flow .fl-legend { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; font-size: 12.5px; color: var(--text-mid); }
#dsub-flow .fl-lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#dsub-flow .fl-lg b { color: var(--text); font-weight: 700; }
#dsub-flow .fl-lg small, #dsub-flow .fl-ft small { font-size: 11.5px; color: var(--text-dim); }
#dsub-flow .fl-legend .fl-tot { margin-left: auto; white-space: nowrap; }
#dsub-flow .fl-tot { font-size: 12.5px; color: var(--text-dim); }
#dsub-flow .fl-tot b { font: 800 14px var(--font-display); color: var(--text); }
#dsub-flow .fl-legend-bar { display: flex; gap: 2px; height: 5px; border-radius: 3px; overflow: hidden; margin-top: -2px; }
#dsub-flow .fl-legend-bar i { display: block; height: 100%; min-width: 2px; background: var(--fl-c, var(--accent)); }
/* The footer: counts and the average charge per category, the deep-dive link at the right */
#dsub-flow .fl-foot { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px 16px; min-width: 0; font-size: 12px; color: var(--text-mid); }  /* one line: a long list is cut, never wrapped under the stage */
#dsub-flow .fl-ft { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#dsub-flow .fl-foot .fl-deep { flex: none; }
#dsub-flow .fl-ft b { color: var(--text); font-weight: 700; }
#dsub-flow .fl-foot .fl-dot, #dsub-flow .fl-legend .fl-dot { width: 8px; height: 8px; flex: none; }
#dsub-flow .fl-deep { margin-left: auto; min-height: 32px; padding: 0 4px; border: 0; background: none; color: var(--accent-hi); font: 600 12.5px var(--font-sans); cursor: pointer; white-space: nowrap; }
#dsub-flow .fl-deep:hover { text-decoration: underline; }
/* Inside the Live bento the stage takes the room the card leaves after the legend and the footer (flow.js draws into it) */
#live-sec-flow > .live-sec-body { display: flex; flex-direction: column; }
#live-sec-flow #dsub-flow.flow-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
#live-sec-flow #dsub-flow .fl-stage { flex: 1; min-height: 0; padding: 8px 16px 6px; overflow: hidden; }
#live-sec-flow #dsub-flow .fl-head { min-height: 32px; }
#dsub-flow .fl-empty { padding: 14px 0; }

/* stage */
#dsub-flow .fl-stage { min-width: 0; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 14px 16px 10px; }
#dsub-flow svg text { font-family: var(--font-sans); }
#dsub-flow .fl-snk { display: block; max-width: 100%; }
#dsub-flow .fl-colh { font-size: 10.5px; fill: var(--text-dim); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
#dsub-flow .fl-lnk { fill: color-mix(in srgb, var(--fl-c, var(--accent)) 32%, transparent); transition: fill .15s; }
#dsub-flow .fl-lnk[data-fl-n] { cursor: pointer; }
#dsub-flow .fl-nd { fill: color-mix(in srgb, var(--fl-c, var(--accent)) 22%, var(--surface)); stroke: var(--fl-c, var(--accent)); stroke-width: 1.5px; }
#dsub-flow .fl-node.is-act { cursor: pointer; }
#dsub-flow .fl-node.is-other .fl-nd { stroke-dasharray: 3 3; }
#dsub-flow .fl-lbl { font-size: 12px; font-weight: 600; fill: var(--text); }
#dsub-flow .fl-lbl.is-beside { fill: var(--text-mid); font-weight: 500; paint-order: stroke; stroke: var(--surface); stroke-width: 2.5px; stroke-linejoin: round; }
#dsub-flow .fl-val { font-family: var(--font-numeric); font-weight: 800; font-size: 12px; fill: var(--text); }
#dsub-flow .fl-node:focus-visible { outline: none; }
#dsub-flow .fl-node:focus-visible .fl-nd { stroke: var(--text); stroke-width: 2.5px; }
@media (hover: hover) {
  #dsub-flow .fl-node.is-act:hover .fl-nd { fill: color-mix(in srgb, var(--fl-c, var(--accent)) 42%, var(--surface)); stroke-width: 2px; }
  #dsub-flow .fl-lnk[data-fl-n]:hover { fill: color-mix(in srgb, var(--fl-c, var(--accent)) 55%, transparent); }
}
#dsub-flow .fl-snk.is-drawing { animation: fl-reveal .9s cubic-bezier(.3,.8,.3,1) both; }
@keyframes fl-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { #dsub-flow .fl-snk.is-drawing { animation: none; } #dsub-flow .fl-lnk { transition: none; } }

/* phone: stacked bar and rows that drill in place */
#dsub-flow .fl-phone { display: grid; gap: 10px; min-width: 0; }
#dsub-flow .fl-ptot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
#dsub-flow .fl-ptot b { font: 800 26px var(--font-display); }
#dsub-flow .fl-ptot span { font-size: 12.5px; color: var(--text-dim); text-align: right; }
#dsub-flow .fl-pbar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
#dsub-flow .fl-pbar i { display: block; height: 100%; background: var(--fl-c, var(--accent)); min-width: 2px; }
#dsub-flow .fl-prow { width: 100%; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 14px; gap: 4px 10px; align-items: center; padding: 10px 2px 8px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 56px; }
#dsub-flow .fl-prow:first-of-type { border-top: 0; }
#dsub-flow .fl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--fl-c, var(--accent)); }
#dsub-flow .fl-pn { min-width: 0; display: grid; }
#dsub-flow .fl-pn > span { font: 600 15px var(--font-sans); }
#dsub-flow .fl-pn small { font-size: 12.5px; color: var(--text-dim); }
#dsub-flow .fl-pamt { font: 700 16px var(--font-numeric); }
#dsub-flow .fl-pchev { color: var(--text-dim); font-weight: 700; text-align: center; }
#dsub-flow .fl-pline { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: var(--surface-2); }
#dsub-flow .fl-pline i { display: block; height: 100%; border-radius: 2px; background: var(--fl-c, var(--accent)); }
#dsub-flow .fl-pall { min-height: 48px; border: 0; border-radius: var(--r-ctl); background: var(--surface-2); color: var(--accent-hi); font: 600 14px var(--font-sans); cursor: pointer; padding: 0 16px; }
#dsub-flow .fl-prow:focus-visible, #dsub-flow .fl-pall:focus-visible, #dsub-flow .fl-crumb-step:focus-visible, #dsub-flow .fl-play:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
@media (max-width: 768px) {
  #dsub-flow.flow-view { gap: 12px; }
  #dsub-flow .fl-crumb { font-size: 14px; }
  #dsub-flow .fl-crumb-step { min-height: 48px; padding: 0 14px; }
}

/* first-open skeleton (PERF-001): same layout as the stage, painted on the click frame */
#dsub-flow .skel { display: block; border-radius: 10px; }
#dsub-flow .fl-sk-bar { height: 32px; width: 320px; max-width: 100%; }
#dsub-flow .fl-sk-block { width: 100%; }
#dsub-flow .fl-sk-total { height: 38px; width: 160px; }
#dsub-flow .fl-sk-prow { height: 56px; width: 100%; background-clip: content-box; }
@media (prefers-reduced-motion: reduce) { #dsub-flow .skel { animation: none; } }
