/* The Flows tab (rh-flows.js): the headline, four figures, a plain-words card, the table by stock or by fund with a bar
   from the middle (sells left in red, buys right in green), and the card beside it. Colours are tokens, so dark mode
   follows. */

/* The tab's links stay out of the bars until /flows.json answers (the phone strip's links are display: flex). */
.rh-links a[hidden], .rh-sub a[hidden] { display: none !important; }

.fl-h1 { margin-top: 10px; max-width: 32ch; font: 650 clamp(28px, 2.5vw, 40px)/1.12 var(--display); font-stretch: 100%; letter-spacing: -.028em; text-wrap: balance; }
.fl-h1 b { font-weight: inherit; font-variant-numeric: tabular-nums; }
.fl-h1 b.up { color: var(--up); }
.fl-h1 b.down { color: var(--down); }
.fl-status { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; margin-top: 12px; font-size: 14px; color: var(--text-2); }
.fl-status > span:not(.fl-live) + span::before { content: "·"; margin: 0 8px; color: var(--text-3); }
.fl-live { display: inline-block; flex: none; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--live); animation: fl-pulse 2s infinite; }
.fl-live.off { background: var(--text-3); animation: none; }
@keyframes fl-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

/* Four figures under the headline. */
.fl-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.fl-tile { min-width: 0; padding: 16px 18px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.fl-tile > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); }
.fl-tile > strong { display: block; margin-top: 6px; font: 600 26px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.fl-tile > strong.up { color: var(--up); }
.fl-tile > strong.down { color: var(--down); }
.fl-tile > small { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); }

/* What this shows, in plain words. */
.fl-what { margin-top: 16px; padding: 18px 22px 20px; border-radius: 16px; background: var(--sunk); }
.fl-what h2 { font: 650 15px var(--ui); }
.fl-what p { max-width: 78ch; margin-top: 6px; font-size: 15px; line-height: 1.6; color: var(--text-2); }

/* The table. */
.fl-table { margin-top: 32px; }
.fl-h2 { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.fl-h2 h2 { padding: 0; border: 0; }
.fl-seg { display: inline-flex; flex: none; padding: 3px; border-radius: 999px; background: var(--sunk); }
.fl-seg button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font: 600 13px var(--ui); color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.fl-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(13, 13, 15, .12); }
.fl-cols { display: grid; grid-template-columns: minmax(200px, 1.8fr) minmax(76px, .75fr) minmax(76px, .75fr) minmax(110px, 1.4fr) minmax(92px, .85fr); align-items: center; gap: 16px; }
.fl-fcols { display: grid; grid-template-columns: minmax(140px, 1.3fr) 64px minmax(64px, .6fr) minmax(76px, .75fr) minmax(110px, 1.4fr) minmax(92px, .85fr); align-items: center; gap: 16px; }
.fl-thead { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.fl-thead.fl-cols span:nth-child(n+2), .fl-thead.fl-fcols span:nth-child(n+2) { text-align: right; }
.fl-thead .fl-mid { text-align: center !important; }
.fl-row, .fl-frow { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.fl-row.open { border-bottom-color: transparent; background: color-mix(in srgb, var(--act) 5%, transparent); }
.fl-frow { min-height: 58px; }
.fl-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fl-row:not(.none) { cursor: pointer; }
.fl-tog { display: grid; place-items: center; flex: none; width: 24px; height: 32px; margin-left: -6px; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; }
.fl-tog:hover { background: var(--sunk); }
.fl-row:not(.none):hover .fl-sym b { color: var(--act-ink); }
.fl-row.none { color: var(--text-2); }
.fl-chev { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.fl-row.open .fl-chev { transform: rotate(90deg); }
.fl-logo { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); object-fit: cover; }
.fl-mono { display: grid; place-items: center; background: var(--sunk); font: 700 9.5px/1 var(--ui); letter-spacing: .02em; color: var(--text-2); }
.fl-name { min-width: 0; }
.fl-sym { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fl-sym b { font-weight: 650; font-size: 15px; transition: color .15s; }
.fl-name small { display: block; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-on { flex: none; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--act) 12%, transparent); color: var(--act-ink); font: 650 11.5px/1.6 var(--ui); text-decoration: none; white-space: nowrap; transition: background .15s; }
.fl-on:hover { background: color-mix(in srgb, var(--act) 22%, transparent); }
.fl-num { font-weight: 600; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.fl-flow { font-weight: 650; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.fl-num.up, .fl-flow.up, .fl-msub .up { color: var(--up); }
.fl-num.down, .fl-flow.down, .fl-msub .down { color: var(--down); }
.fl-stale { color: var(--text-3); font-weight: 600; font-size: 13px; }
.fl-stale small { display: block; font-weight: 500; font-size: 12px; }
.stale .fl-sym b, .stale .fl-ft b, .none .fl-sym b { color: var(--text-2); }
.fl-u a { color: var(--act-ink); font-weight: 650; text-decoration: none; }
.fl-u a:hover { text-decoration: underline; }
.fl-u { font-weight: 600; font-size: 14px; text-align: right; }
.fl-ft { min-width: 0; }
.fl-ft b { display: block; font-weight: 650; font-size: 15px; }
.fl-ft small { display: block; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-lev { justify-self: start; padding: 2px 8px; border-radius: 6px; background: var(--sunk); font: 650 12px var(--ui); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-lev.inv { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-2); }
.fl-fcols > .fl-lev { justify-self: end; }

/* The bar: a line in the middle, buys to its right, sells to its left, against the biggest on the page. */
.fl-bar { position: relative; height: 10px; }
.fl-bar::before { content: ""; position: absolute; left: 50%; top: -5px; bottom: -5px; width: 1px; background: var(--line-2); }
.fl-bar i { position: absolute; top: 0; bottom: 0; width: calc(var(--w) / 2); min-width: 2px; }
.fl-bar i.up { left: 50%; border-radius: 0 3px 3px 0; background: var(--up); }
.fl-bar i.down { right: 50%; border-radius: 3px 0 0 3px; background: var(--down); }
.fl-bar i.flat { display: none; }
.fl-msub { display: none; }

/* A stock's funds, opened under its row. */
.fl-funds { padding: 2px 12px 10px 48px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--act) 5%, transparent); }
.fl-funds[hidden] { display: none; }
.fl-fund { display: grid; grid-template-columns: minmax(0, 1.4fr) 64px minmax(0, 1fr) minmax(92px, .8fr); align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.fl-fund:first-child { border-top: 0; }
.fl-fund .fl-ft b { font-size: 14px; }
.fl-fund .fl-ft small { font-size: 12px; }
.fl-aum { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fl-fund .fl-flow { font-size: 14px; }
.fl-none { padding: 10px 0; font-size: 14px; color: var(--text-3); }

/* About this estimate. */
.fl-foot p { max-width: 80ch; padding-top: 12px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.fl-foot p:first-of-type { color: var(--ink); font-weight: 600; }
.fl-err { margin-top: 14px; color: var(--text-2); }

/* The card: the next close, the sum in words, and the biggest flows listed on Borro. */
.fl-count { margin-top: 8px; font: 600 40px/1.05 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; }
.fl-cap { margin-top: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.fl-h3 { margin-top: 18px; font: 650 15px var(--ui); }
.fl-p { margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.fl-eg { padding: 10px 12px; border-radius: 10px; background: var(--sunk); font-size: 13px; color: var(--ink); }
.fl-pick { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fl-pick .fl-logo { width: 30px; height: 30px; }
.fl-pick b { display: block; font-weight: 650; }
.fl-pick small { display: block; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fl-pick small.up { color: var(--up); }
.fl-pick small.down { color: var(--down); }
.fl-acts { display: flex; gap: 6px; }
.fl-act { height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: none; font: 650 13px var(--ui); color: var(--ink); cursor: pointer; transition: border-color .15s, filter .15s; }
.fl-act:hover { border-color: var(--ink); }
.fl-act[data-trade="short"] { border-color: var(--act); background: var(--act); color: #fff; }
.fl-act[data-trade="short"]:hover { filter: brightness(.95); }
.fl-fine { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--text-3); }

:root[data-theme="dark"] .fl-seg button[aria-pressed="true"] { background: var(--line-2); }

@media (prefers-reduced-motion: reduce) {
  .fl-live { animation: none; }
  .fl-chev { transition: none; }
}
@media (hover: none) {
  .fl-row:not(.none):hover .fl-sym b { color: inherit; }
  .fl-tog:hover { background: none; }
  .fl-row:active, .fl-frow:active { background: var(--sunk); }
}
@media (max-width: 1180px) {
  .fl-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1240px) and (min-width: 641px) {
  .fl-fcols { grid-template-columns: minmax(120px, 1.2fr) 56px minmax(56px, .6fr) minmax(70px, .7fr) minmax(80px, 1fr) minmax(84px, .8fr); gap: 12px; }
}
/* A phone: the name and the trade on one line, the bar under them, the move and the trade per 1% under that. */
@media (max-width: 640px) {
  .fl-h1 { font-size: 27px; max-width: none; }
  .fl-tiles { gap: 10px; }
  .fl-tile { padding: 14px 14px 12px; }
  .fl-tile > strong { font-size: 22px; }
  .fl-what { padding: 16px 16px 18px; }
  .fl-what p { font-size: 14px; }
  .fl-h2 { flex-wrap: wrap; }
  .fl-thead { display: none; }
  .fl-status .fl-every { display: none; }
  .fl-cols, .fl-fcols { grid-template-columns: minmax(0, 1fr) minmax(104px, 38%); grid-template-areas: "who flow" "sub bar"; gap: 6px 12px; }
  .fl-row, .fl-frow { padding: 12px 4px; }
  .fl-who, .fl-frow .fl-ft { grid-area: who; }
  .fl-cols > .fl-flow, .fl-fcols > .fl-flow { grid-area: flow; }
  .fl-cols > .fl-bar, .fl-fcols > .fl-bar { grid-area: bar; }
  .fl-msub { grid-area: sub; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding-left: 28px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
  .fl-fcols > .fl-msub { padding-left: 0; }
  .fl-msub > span:first-child { font-weight: 650; }
  .fl-msub .fl-u { text-align: left; font-size: 13px; }
  .fl-cols > .fl-pp, .fl-cols > .fl-mv, .fl-fcols > .fl-lev, .fl-fcols > .fl-u, .fl-fcols > .fl-na { display: none; }
  .fl-on { padding: 3px 8px; }
  .fl-funds { padding: 2px 4px 10px 28px; }
  .fl-fund { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ft flow" "lev aum"; gap: 4px 10px; }
  .fl-fund .fl-ft { grid-area: ft; }
  .fl-fund .fl-flow { grid-area: flow; }
  .fl-fund .fl-lev { grid-area: lev; }
  .fl-fund .fl-aum { grid-area: aum; justify-self: end; font-size: 13px; }
  .fl-count { font-size: 34px; }
}
