/* The rebuilt Home's own sheet (board 06-home-market.html: Home, and the first-watch Home). Shared parts (tokens, bar,
   dock, pictures, charts, the story card and stream, buttons, tabs, notes) are in rb.css. */

/* phone: one column in the board's order (positions, the big move, your markets, the stream) */
.rb-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.rb-left, .rb-latest { display: contents; }
.rb-notes { order: 0; display: grid; gap: 8px; margin: 2px 0 10px; }
.rb-pos { order: 1; }
.rb-lead-kick { order: 2; margin: 22px 0 8px; }
.rb-lead { order: 3; }
.rb-mk { order: 4; margin-top: 26px; }
.rb-latest > .rb-hd { order: 5; margin-top: 28px; }
.rb-late { order: 6; }
.rb-tl, .rb-quiet { order: 7; }
.rb-offer-card { order: 8; }

/* your positions */
.rb-pos { padding-top: 6px; position: relative; }
.rb-pnl { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.rb-pnl-px { font-size: min(2.875rem, 11.5vw); }
.rb-pnl-sub { display: grid; gap: 2px; padding-bottom: 4px; font-size: .875rem; color: var(--muted); }
.rb-pnl-sub span[aria-hidden] { font-size: .8em; margin-right: 2px; }
.rb-pos > .rb-tabs { margin-top: 10px; }
.rb-mc { margin: 14px -16px 0; }
.rb-pos > .rb-tabs + .rb-mc { margin-top: 4px; }
.rb-mc-plot { position: relative; padding-right: 46px; }
.rbc-money { height: 96px; }
.rbc-area { fill: url(#rb-mg); }
.rb-mc-y { position: absolute; inset: 4px 10px 4px auto; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; font-size: .6875rem; color: var(--faint); font-variant-numeric: tabular-nums; pointer-events: none; }
.rb-mc-x { display: flex; justify-content: space-between; padding: 6px 46px 0 16px; font-size: .6875rem; color: var(--faint); }

/* offers: add your side, get alerts (the first-watch Home) */
.rb-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: .84375rem; color: var(--muted); }
.rb-offer > span { flex: 1 1 14em; min-width: 0; }
.rb-offer b { color: var(--fg); font-weight: 600; display: block; }
.rb-mk > .rb-offer { margin-top: 14px; }

/* your markets */
.rb-rows { margin-top: 4px; }
.rb-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; min-height: 56px; border-bottom: 1px solid var(--line); }
a.rb-row:hover .rb-nm b, a.rb-nm:hover b { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.rb-nm { min-width: 0; display: block; }
.rb-nm b { display: block; font: 600 .90625rem/1.3 var(--body); }
.rb-nm small { display: block; overflow-wrap: anywhere; font: 400 .78125rem/1.35 var(--body); color: var(--muted); margin-top: 2px; }
.rb-nm small b { display: inline; font: 500 1em var(--body); }
.rb-row .rbc-spark { display: none; }
.rb-rt { display: grid; gap: 3px; justify-items: end; }
.rb-rp { font-size: min(1.375rem, 7vw); }
/* every row's title, the lead's too, at every size (Head of Design, check of 133): two lines, then clamped; it breaks only
   at spaces, and a word too long for the line ends in an ellipsis instead of breaking */
.rb-nm > b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: normal; word-break: normal; text-overflow: ellipsis; }
/* update 134 (Head of Design minor a, lead's call): with large text the title column is narrow for its words, and two
   lines cut "Fed Decision in September?" to the same "Fed / Decision…" as October. Under 6.5em (390 at 150%) it takes
   three lines; under 5.5em (390 at 200%, 320 at 150% and up) one word fills a line, so four, and the month shows. At
   100% text every width stays at two (320 is 7em). */
.rb-row > .rb-nm { container: rb-nm / inline-size; }
@container rb-nm (max-width: 6.5em) { .rb-nm > b { -webkit-line-clamp: 3; line-clamp: 3; } }
@container rb-nm (max-width: 5.5em) { .rb-nm > b { -webkit-line-clamp: 4; line-clamp: 4; } }
.rb-chg { font-size: .8125rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rb-chg span[aria-hidden] { font-size: .8em; margin-right: 1px; }
.rb-chg i { font-style: normal; color: var(--muted); }
.rb-row-add { color: var(--muted); border-bottom: 0; }
.rb-row-add .rb-nm b { font-weight: 500; }
.rb-add-plus { width: 30px; height: 30px; border-radius: 8px; border: 1px dashed var(--line); display: grid; place-items: center; font-size: 1.125rem; line-height: 1; }
.rb-row-done .rb-nm b { color: var(--muted); }
.rb-row-done .rb-pic { filter: grayscale(1); opacity: .7; }
.rb-stop { min-height: 40px; padding: 0 12px; white-space: nowrap; }
/* a start row: picture, words, price and change, Watch; on the phone the price sits under the words' right */
.rb-row-start { grid-template-columns: 30px minmax(0, 1fr) auto auto; }
.rb-nospark { display: none; }
.rb-row-start .rb-btn { min-height: 40px; }
.rb-watching { font-size: .78125rem; color: var(--muted); }

/* the lead card: one loud move */
.rb-lead { position: relative; border: 1px solid; border-radius: 16px; padding: 14px 16px 14px; display: grid; gap: 10px; min-width: 0; }
.rb-lead-up { border-color: rgba(79, 195, 138, .3); background: linear-gradient(180deg, rgba(79, 195, 138, .07), var(--surf) 70%), var(--surf); }
.rb-lead-dn { border-color: rgba(238, 107, 132, .3); background: linear-gradient(180deg, rgba(238, 107, 132, .07), var(--surf) 70%), var(--surf); }
.rb-lead-top { display: flex; gap: 10px; align-items: center; }
.rb-lead-q { font: 600 .9375rem/1.3 var(--body); min-width: 0; flex: 1; padding: 6px 0; overflow-wrap: anywhere; }
.rb-lead-see { font-size: .8125rem; font-weight: 600; white-space: nowrap; padding: 12px 0 12px 8px; }
.rb-lead-q:hover, .rb-lead-see:hover { text-decoration: underline; text-underline-offset: 3px; }
.rb-lead-mid { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: flex-end; }
.rb-lead > * { min-width: 0; }
.rb-lead-side { display: grid; gap: 4px; min-width: 0; }
.rb-lead-side > span, .rb-lead-mv > span, .rb-pnl-sub span, .rb-offer > span, .rb-kick { overflow-wrap: anywhere; }
.rb-lead-side > span:first-child { font-size: .78125rem; color: var(--muted); }
.rb-lead-px { font-size: min(2.875rem, 12vw); }
.rb-lead-mv { display: grid; gap: 3px; padding-bottom: 4px; font-size: .875rem; flex: 1 1 12em; min-width: 0; }
.rb-lead-mv b { font-weight: 600; }
.rb-lead-mv b span[aria-hidden] { font-size: .8em; margin-right: 1px; }
.rb-lead-g { color: var(--muted); font-size: .8125rem; }
.rbc-lead { height: 84px; }
.rb-lead-story { display: grid; gap: 3px; border-top: 1px solid var(--line); padding-top: 10px; min-width: 0; }
.rb-lead-h { font: 600 .90625rem/1.35 var(--body); overflow-wrap: anywhere; }
a.rb-lead-h:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.rb-lead-none { border-top: 1px solid var(--line); padding-top: 10px; font-size: .84375rem; color: var(--muted); }

/* Latest: the late-stories line, the daily note's offer */
.rb-late { font-size: .78125rem; color: var(--muted); margin-top: 4px; }
.rb-offer-card { margin-top: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surf); padding: 16px; display: grid; gap: 8px; font-size: .875rem; color: var(--muted); }
.rb-offer-card h2 { font: 700 1.0625rem/1.25 var(--head); color: var(--fg); }
.rb-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rb-steps { list-style: decimal; padding-left: 1.3em; display: grid; gap: 4px; }
.rb-fine { font-size: .75rem; color: var(--faint); }

/* nothing watched */
.rb-empty { padding: 28px 0 0; display: grid; gap: 10px; justify-items: start; }
.rb-empty h1 { font: 700 1.625rem/1.15 var(--head); letter-spacing: -.02em; }
.rb-empty > p { color: var(--muted); max-width: 30rem; }
.rb-empty > .rb-btn { min-height: 46px; padding: 0 18px; font-size: .875rem; }
.rb-empty > .rb-hd { margin-top: 26px; }
.rb-empty > .rb-rows, .rb-empty > .rb-note { justify-self: stretch; }

@media (min-width: 900px) {
  .rb-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 0 48px; align-items: start; }
  .rb-notes { grid-column: 1 / -1; }
  .rb-left, .rb-latest { display: block; min-width: 0; }
  .rb-pnl-px { font-size: min(3.75rem, 5.5vw); }
  .rb-pnl-sub { padding-bottom: 7px; }
  .rb-pos > .rb-tabs { position: absolute; right: 46px; top: 54px; margin: 0; }
  .rb-mc, .rb-pos > .rb-tabs + .rb-mc { margin: 14px 0 0; }
  .rbc-money { height: 190px; }
  .rb-mc-y { right: 0; } .rb-mc-x { padding: 6px 46px 0 0; }
  .rb-mk { margin-top: 22px; }
  .rb-row { grid-template-columns: 30px minmax(0, 1fr) 96px 150px; gap: 14px; }
  .rb-row-done { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .rb-row-start { grid-template-columns: 30px minmax(0, 1fr) 96px 150px auto; }
  .rb-row .rbc-spark, .rb-nospark { display: block; }
  .rb-rt { grid-template-columns: 64px 1fr; align-items: center; gap: 14px; justify-items: end; }
  .rb-rp { display: block; font-size: 1.5rem; grid-column: 1; }
  .rb-chg { grid-column: 2; }
  .rb-chg[data-rb="back"] { grid-column: 1 / -1; }
  .rb-rt:has(> .rb-chg[data-rb="back"]) > .rb-rp { grid-column: 1 / -1; }  /* its price sits right above it, on the same edge */  /* "▲4 pts, back in 24h" is longer than a change: under the price, in the same column */
  .rb-latest > .rb-hd { margin-top: 6px; }
  .rb-lead-kick { margin: 14px 0 8px; }
  .rb-empty { max-width: 760px; padding-top: 40px; }
}

/* update 133: a held row's change reads for its side and may wrap at the row's edge; its story line is one muted line */
.rb-chg:is([data-rb="for-side"], :has(> .rb-stand)) { white-space: normal; text-align: end; max-width: 11em; }
.rb-nm small.rb-row-story { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
@media (min-width: 900px) {
  .rb-rt:has(> .rb-chg:is([data-rb="for-side"], :has(> .rb-stand))) > .rb-rp, .rb-chg:is([data-rb="for-side"], :has(> .rb-stand)) { grid-column: 1 / -1; }
}
/* update 133 review (200% text on a 390 phone): the right column never takes more than 45% of the row; its "for your
   side" line and the holder's label wrap inside it, so the market's title keeps the rest */
@media (max-width: 899.98px) {
  .rb-row:not(.rb-row-start) { grid-template-columns: 30px minmax(0, 1fr) fit-content(45%); }
  .rb-rt { min-width: 0; }
}
@media (min-width: 900px) { .rb-chg:is([data-rb="for-side"], :has(> .rb-stand)) { max-width: 16em; } }
/* update 135 (check of 135): at 200% text on a computer a plain "▲2 pts 24h" spilled past its 150px column; it wraps there */
@media (min-width: 900px) { .rb-rt .rb-chg { white-space: normal; text-align: end; } }
/* update 135: the stand line (A "Still ▼N pts since the … move", B "Back after …") wraps in the same column as 133's line */
/* update 136 (Head of Design m1): a held row's "Still ▼8 pts" over "since 1:04 PM yesterday" (muted, .rb-chg i) on the
   phone, as the other rows' change and its window; one line on a computer */
.rb-stand-at { font-weight: 400; }
@media (max-width: 899px) {
  .rb-stand-at { display: block; }
  /* room for "since 1:04 PM yesterday" on its one line at 100% text; larger text still wraps inside the row */
  .rb-chg:has(.rb-stand-at) { max-width: 12.5em; }
}

/* update 137 (careDecision_1114): the holder's label (kit holderCare) leads the held side's block on its own line, above
   its change line: red against the side, green for a big move for it, muted when it came back or stayed quiet */
.rb-care { display: block; font: 600 .75rem/1.3 var(--body); letter-spacing: .01em; text-align: end; white-space: normal; }
.rb-care-against { color: var(--dn); }
.rb-care-big { color: var(--up); }
.rb-care-back, .rb-care-quiet { color: var(--muted); font-weight: 500; }
@media (min-width: 900px) { .rb-rt:has(> .rb-care) > * { grid-column: 1 / -1; } }
/* update 137 (check of 137, 200% text at 390): with the label above it, a held row's plain line ("Unchanged 24h", "▲2 pts,
   back in 24h") wraps inside the right column too, as the "for your side" and stand lines do, so the column keeps its 45% */
.rb-rt:has(> .rb-care) > .rb-chg { white-space: normal; text-align: end; }
/* update 138 (Head of Design m1 of 137): on the phone with large text (a row under 13em: 390 at 200%, 320 at 150% and
   up) the title column would fall under about 5.5em, so the right block stacks under the title, left-aligned: price,
   the holder's label, then the change line. The title then has the row's width and keeps its two lines, breaking only at
   spaces. 100% text (a 320 row is 18em) and the computer layout are unchanged. */
@media (max-width: 899.98px) {
  .rb-rows { container: rb-rows / inline-size; }
  @container rb-rows (max-width: 13em) {
    .rb-row:not(.rb-row-start, .rb-row-add) { grid-template-columns: 30px minmax(0, 1fr); row-gap: 6px; }
    .rb-row:not(.rb-row-start, .rb-row-add) > .rb-pic { align-self: start; }
    .rb-row:not(.rb-row-start, .rb-row-add) > .rb-rt { grid-column: 2; justify-items: start; }
    .rb-row:not(.rb-row-start, .rb-row-add) > .rb-rt > * { text-align: start; max-width: none; }
    .rb-row:not(.rb-row-start, .rb-row-add) > .rb-nm > b { -webkit-line-clamp: 2; line-clamp: 2; }
  }
}

/* rebuild 138 (SW-13, the lead card at 390 with 200% text): the title breaks only at spaces; with too little room beside it,
   "See the move ›" takes the next line instead of squeezing the title into a column. A story's source line (the lead's and Latest's) wraps its time
   under the source rather than running past the card. */
.rb-lead-top { flex-wrap: wrap; row-gap: 0; }
.rb-lead-q { flex: 1 1 6em; overflow-wrap: break-word; }
.rb-grid .rb-meta { flex-wrap: wrap; row-gap: 2px; }

.rb-pos-say { margin-top: 12px; font-size: .9375rem; line-height: 1.4; color: var(--muted); max-width: 34em; }
.rb-pos-say b { color: var(--fg); font-weight: 600; }
.rb-pos-go { margin-top: 10px; }
.rb-pos-add { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.rb-pos-add-b { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.rb-pos-add-b .rb-nm { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.rb-pos-add-b b { font-weight: 600; overflow-wrap: break-word; }
.rb-pos-add-b small { font-size: .84375rem; color: var(--muted); }
.rb-pos-add-go { color: var(--muted); }
.rb-pos-add-b:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* KHA-35 option D: the first Home. Same frame as a full Home, every part waiting; the chart is quiet, the + is the action. */
.rb-zero-px { color: var(--faint); }
.rb-mc-zero .rbc-money { height: 150px; display: block; width: 100%; }
.rb-mc-zero .rbc-line { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 6; }
.rb-mc-zero .rbc-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.rb-zero-note { position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% - 23px), -50%); padding: 0 12px; background: var(--bg); font-size: .875rem; color: var(--muted); white-space: nowrap; }
.rb-row-zero { color: var(--fg); border: 1px dashed var(--faint); border-bottom: 1px dashed var(--faint); border-radius: 12px; padding: 12px; margin-top: 6px; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; }
.rb-row-zero .rb-add-plus { border: 0; background: var(--sig); color: var(--sig-ink); font-weight: 700; }
.rb-row-zero .rb-nm b { font-weight: 600; }
.rb-row-zero .rb-nm small { color: var(--muted); }
.rb-row-zero .rb-zero-go { color: var(--muted); font-size: 1.25rem; }
.rb-row-zero:hover { border-color: var(--muted); }
.rb-tl-zero { order: 7; }
.rb-it-ghost { gap: 9px; }
.rb-it-ghost::after { border-color: var(--faint); }
.rb-it-ghost-2 { opacity: .45; }
.rb-it-ghost p { display: flex; gap: 8px; align-items: center; }
.rb-it-ghost i { display: block; height: 10px; border-radius: 5px; background: var(--surf2); }
.rb-ghost-meta i:nth-child(1) { width: 14px; height: 14px; border-radius: 50%; }
.rb-ghost-meta i:nth-child(2) { width: 84px; }
.rb-ghost-meta i:nth-child(3) { width: 38px; margin-left: auto; }
.rb-ghost-h { flex-direction: column; align-items: stretch !important; gap: 7px !important; }
.rb-ghost-h i { height: 13px; }
.rb-ghost-h i:nth-child(2) { width: 62%; }
.rb-ghost-chip i { width: 150px; }
.rb-zero-say { display: grid; gap: 6px; font-size: .875rem; color: var(--muted); }
.rb-zero-say .rb-ghost-meta { margin-bottom: 2px; }
.rb-zero-say b { color: var(--fg); font-weight: 600; font-size: 1rem; line-height: 1.3; }
.rb-zero-say u { color: var(--sig); text-decoration: none; font-weight: 600; margin-top: 2px; }
.rb-zero-say:hover b { text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 900px) { .rb-mc-zero .rbc-money { height: 190px; } }

/* KHA-93: your positions and markets stay beside Latest on a computer (rb.css, desktop scroll) */
@media (min-width: 900px) and (min-height: 46em) {
  .rb-left { position: sticky; top: var(--rb-bar-h); max-height: calc(100vh - var(--rb-bar-h) - var(--rb-page-foot)); overflow-y: auto; scroll-padding-bottom: 24px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; margin: 0 -8px; padding: 0 8px 24px; mask-image: linear-gradient(#000 calc(100% - 24px), transparent); }
}
/* KHA-131: "Holding this? Add your side", the one prompt, on a big move's card for a market with no side */
.rb-lead-ask { margin: 0; }
.rb-lead-ask-b { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surf2); color: var(--muted); font: 400 .84375rem/1.3 var(--body); cursor: pointer; }
.rb-lead-ask-b b { color: var(--fg); font-weight: 600; margin-left: .3em; }
.rb-lead-ask-b:hover { border-color: var(--faint); }
.rb-lead-ask-b:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* KHA-131: "What do you hold?", one list of every watched market (board-portfolio). The frame is rb-sheets.css's; a row is
   the market, then Yes / No / Watching, then the price paid and shares; a table at 900 px and wider. */
.rb-pl .rb-pl-hd { display: none; }
.rb-pl .cbtn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.rb-pl-rows { list-style: none; margin: 0; padding: 0 0 16px; display: grid; border-top: 1px solid var(--sh-line); }
.rb-pl-row { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--sh-line); min-width: 0; }
.rb-pl-row:last-child { border-bottom: 0; }
.rb-pl-q { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; }
.rb-pl-q b { font-weight: 600; font-size: .9375rem; line-height: 1.3; min-width: 0; }
.rb-pl-q > span:not(.rb-pic) { display: grid; gap: 2px; min-width: 0; }
.rb-pl-q small { font-size: .78125rem; color: var(--muted); }
[data-rb-page] .rb-pl .rb-pl-seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-rb-page] .rb-pl .rb-pl-seg > button { min-height: 48px; padding: 8px 12px; }
[data-rb-page] .rb-pl .rb-pl-seg > button:last-child { justify-content: center; }
[data-rb-page] .rb-pl .rb-pl-seg > button:last-child .rb-sx-n { flex: none; text-align: center; }
.rb-pl-f { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
[data-rb-page] .rb-pl-f .inp:has(input[aria-invalid="true"]) { border-color: var(--dn); }
.rb-pl-err { grid-column: 1 / -1; margin: 0; font-size: .8125rem; line-height: 1.35; color: var(--dn); }
.rb-pl-act { display: grid; grid-template-columns: auto 1fr; gap: 8px; position: sticky; z-index: 1; bottom: calc(-1 * max(18px, env(safe-area-inset-bottom))); margin: 0 -16px calc(-1 * max(18px, env(safe-area-inset-bottom))); padding: 12px 16px max(18px, env(safe-area-inset-bottom)); background: var(--sh); border-top: 1px solid var(--sh-line); }
@media (max-width: 359px) { [data-rb-page] .rb-pl .rb-pl-seg { grid-template-columns: 1fr; } }
@media (min-width: 900px) {
  [data-rb-page] .dlg.rb-pl { max-width: 880px; }
  .rb-pl .rb-pl-hd { display: grid; grid-template-columns: minmax(200px, 1fr) 304px 200px; gap: 12px; margin: 4px 0 -4px; font: 700 .6875rem/1.2 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .rb-pl-row { grid-template-columns: minmax(200px, 1fr) 304px 200px; align-items: center; gap: 12px; padding: 10px 0; }
  [data-rb-page] .rb-pl .rb-pl-seg { grid-template-columns: repeat(3, max-content); justify-content: start; }
  [data-rb-page] .rb-pl .rb-pl-seg > button { min-height: 44px; }
  .rb-pl-rows { padding-bottom: 0; }
  .rb-pl-act { display: flex; justify-content: flex-end; position: static; margin: 0; padding: 12px 0 0; }
  .rb-pl-act .pri { min-width: 96px; }
}
