/* MoneyMan app layout — dashboard shell + screens. Uses theme.css tokens. */

/* ---- Responsive conventions (issue #66) --------------------------------
   One system: the vendored Bootstrap grid + utilities (css/vendor/, 5.3.8,
   MIT). They load BEFORE this file, so MoneyMan always wins the cascade.

   Breakpoints — use Bootstrap's, never a new magic number:
     sm 576 · md 768 · lg 992 · xl 1200 · xxl 1400
   Prefer a responsive utility (.d-md-none, .col-lg-6) over a media query.
   These screens are desktop-first, so the queries below are max-width and use
   Bootstrap's -0.02px convention (max-width: 991.98px) to avoid overlapping the
   min-width utilities at the boundary.

   Reconciled from the old ad-hoc numbers — all three land on lg, because they
   were always one decision: "is there room for the 248px rail plus content?"
     880 (topbar search, rail/shell) -> lg (992)
     900 (.cols-* collapse)          -> lg (992)
     1000 (.tune-layout collapse)    -> lg (992)
   Not md (768): the rail would appear 112px earlier than it used to and the
   canvas overflows the viewport between 768 and 880 (measured on #66).
   The hamburger is .d-lg-none so it hides exactly where the rail returns —
   if the two ever disagree, the range between them has no navigation at all.
   Ultrawide stays bespoke — prebuilt utilities stop at xxl and these encode
   product intent, not a device class (see issue #17.6):
     1500 -> .cols-2 goes 3-up, tune gains its side rail
     1700 -> canvas widens to 92vw
     2100 -> .cols-2 goes 4-up
   Keep them as hand-written min-width queries; do not fold them into xxl.

   Naming — Bootstrap owns .row / .ratio / .container / .col-* / utilities.
   MoneyMan's equivalents are .mm-row and .mm-ratio. Before vendoring or
   bumping anything under css/vendor/, run:
       python3 scripts/check-vendor-collisions.py
   ------------------------------------------------------------------------ */

/* Bootstrap's .row sets --bs-gutter-x on itself, so the :root value in
   theme.css cannot reach it — restate the 1rem grid gap here. */
.row { --bs-gutter-x: 1rem; --bs-gutter-y: 0; }

/* power-on glow sweep on load */
@keyframes power-on { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen { animation: power-on var(--t-base) var(--ease); }

/* ---- App shell ---- */
#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(10,10,15,.85); backdrop-filter: blur(8px);
}
.topbar-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.4rem;
  /* The badge set is variable (TEST/LIVE + EXPLORE + AI) and the brand + hamburger
     alone need ~200px, so no fixed arrangement fits every phone. Wrapping to a
     second row is the only thing that can never overflow — and the TEST/LIVE badge
     is a safety affordance that must stay visible rather than be hidden to fit. */
  flex-wrap: wrap;
}
/* ---- Migration reallocation widget (issue #41) ---- */
.alloc-row { display: flex; align-items: center; gap: .7rem; margin: .35rem 0; }
.alloc-tk { flex: 0 0 56px; font-family: var(--font-data); font-size: .85rem; }
.alloc-track { position: relative; flex: 1; height: 18px; background: var(--mm-steel);
  border-radius: 4px; overflow: hidden; cursor: ew-resize;
  /* the handle drags horizontally, so the browser must not claim the gesture for
     scrolling on touch (#67) */
  touch-action: none; }
/* Below md the fixed 56px ticker + 170px meta squeeze the drag track down to ~53px
   of a 301px row — the control is the point of this widget, so give it its own
   full-width line and keep ticker + value on the line above (#67). */
@media (max-width: 767.98px) {
  .alloc-row { flex-wrap: wrap; gap: .25rem .7rem; }
  .alloc-tk { flex: 1 1 auto; }
  .alloc-meta { flex: 0 0 auto; }
  .alloc-track { flex: 1 1 100%; order: 3; }
}
.alloc-fill { position: relative; height: 100%; min-width: 2px;
  background: linear-gradient(90deg, var(--mm-pink), var(--mm-cyan)); border-radius: 4px; }
.alloc-handle { position: absolute; right: -3px; top: -2px; width: 8px; height: 22px;
  background: var(--mm-ghost); border-radius: 2px; cursor: ew-resize; box-shadow: 0 0 6px rgba(255,46,151,.5); }
.alloc-meta { flex: 0 0 170px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.alloc-val { font-size: .85rem; }

/* ---- Enlarged chart overlay (issue #41, uPlot) ---- */
.chart-overlay { max-width: 92vw; width: auto; }
.chart-overlay-host { margin-top: .6rem; }
.enlarge-btn { white-space: nowrap; }
.u-legend { color: var(--mm-ghost); font-family: var(--font-data); font-size: .78rem; }
.u-title { color: var(--mm-ghost); font-family: var(--font-display); }
.uplot, .u-wrap { background: transparent; }

.or-divider { display: flex; align-items: center; gap: .8rem; color: var(--mm-muted); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .12em; margin: .2rem 0 .7rem; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--mm-steel); }

.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; }
.brand .logomark { display: block; filter: drop-shadow(0 0 5px rgba(255,46,151,.35)); }
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  letter-spacing: .06em; text-transform: uppercase;
}
.wordmark .lo { color: var(--mm-pink); }
.topbar-spacer { flex: 1; }

/* topbar search + autocomplete (issue #15) */
.topbar-search-wrap { position: relative; flex: 1; max-width: 460px; margin: 0 1rem; display: flex; align-items: center; }
.topbar-search { width: 100%; font-family: var(--font-data); font-size: .85rem; padding-left: 2rem; }
.topbar-search-wrap .ai-spark { position: absolute; left: .65rem; color: var(--mm-violet); font-size: .9rem; pointer-events: none; }
.ac-drop {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: var(--mm-carbon); border: 1px solid var(--mm-steel); border-radius: var(--r-md);
  box-shadow: 0 12px 30px -14px #000; max-height: 340px; overflow-y: auto;
}
.ac-item { padding: .5rem .7rem; cursor: pointer; font-size: .85rem; border-bottom: 1px solid rgba(35,35,47,.5); display: flex; align-items: center; gap: .4rem; }
.ac-item:hover { background: var(--mm-steel); }
.ac-item b { font-family: var(--font-data); }
.ac-item .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-fin { margin-left: auto; font-size: .6rem; }
/* Below lg the topbar search is surfaced inside the mobile flow-nav instead. */
@media (max-width: 991.98px){ .topbar-search-wrap { display: none; } }
.env-badge-wrap { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
/* Below lg, buy back the width the hamburger costs: tighten the row and re-home
   Activity into the flow-nav, the same way #66 re-homed the AI search. Activity is
   a navigation destination, so the offcanvas is where it belongs on a phone —
   .mm-navlink is its marker there (see .mm-mobilenav-body). */
@media (max-width: 991.98px){
  .topbar-inner { gap: .5rem; padding: .6rem .8rem; }
  .env-badge-wrap { gap: .4rem; }
}

.shell { display: grid; grid-template-columns: 248px 1fr; flex: 1; min-height: 0; }
/* A grid item defaults to min-width:auto, i.e. it refuses to shrink below its
   content's min-content width. One wide table (or a fixed-width chart) therefore
   stretched this column past the viewport and scrolled the whole page sideways —
   measured 826px @375 and 1074px @1024 (issue #67). min-width:0 lets the column
   track the viewport; the overflow-x wrappers inside it (.table-scroll) can then
   actually do their job, because a scroll container is only able to scroll once
   its ancestors allow it to be narrower than its content. */
.canvas-host { min-width: 0; }
/* Below lg the rail collapses out of the shell; its steps live in the mobile
   flow-nav (.mm-mobilenav), which the topbar hamburger opens. */
@media (max-width: 991.98px){ .shell { grid-template-columns: 1fr; } .railnav { display: none; } }

/* ---- Mobile flow-nav (issue #66) ----
   Below lg the rail and the topbar search are display:none. The hamburger opens
   this offcanvas so a phone keeps the a–f flow and the AI search. Slides from
   the left (nav convention) rather than the right like the candidate .drawer,
   but shares .drawer-bg and the .in toggle. prefers-reduced-motion is handled
   globally in theme.css. */
.mm-navtoggle { font-size: 1rem; line-height: 1; padding: .35rem .55rem; margin-right: .1rem; }
/* marker only — the backdrop's looks come from .drawer-bg */
.mm-mobilenav-bg { z-index: 55; }
.mm-mobilenav {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 320px);
  display: flex; flex-direction: column;
  background: var(--mm-carbon); border-right: 1px solid var(--mm-steel);
  z-index: 56; overflow-y: auto; transform: translateX(-100%);
  transition: transform var(--t-base) var(--ease); box-shadow: 20px 0 50px -20px #000;
}
.mm-mobilenav.in { transform: none; }
.mm-mobilenav-head {
  position: sticky; top: 0; z-index: 2; background: var(--mm-carbon);
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: 1rem 1rem .8rem; border-bottom: 1px solid var(--mm-steel);
}
.mm-mobilenav-body { padding: .9rem; display: flex; flex-direction: column; gap: 1rem; }
.mm-mobilenav-steps { display: flex; flex-direction: column; }
/* Re-show the search: .topbar-search-wrap is display:none below lg, but inside
   the panel it is the point. Full width here, not the topbar's 460px cap. */
.mm-mobilenav .topbar-search-wrap { display: flex; margin: 0; max-width: none; flex: none; }
/* Activity, re-homed here from the topbar below lg (#67), sized to the 44px
   touch target the flow-nav's other controls meet. */
.mm-navlink { width: 100%; min-height: 44px; font-size: .92rem; }

/* ---- Flow rail (left nav, steps a–f) ---- */
.railnav { border-right: 1px solid var(--mm-steel); padding: 1.2rem .8rem; background: var(--mm-void); }
.rail-title { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mm-muted); margin: 0 .6rem .8rem; }
.rail-step {
  display: flex; align-items: center; gap: .7rem; width: 100%;
  padding: .6rem .7rem; border-radius: var(--r-sm); border: 0; background: transparent;
  color: var(--mm-ghost); cursor: pointer; text-align: left; margin-bottom: .2rem;
  font-family: var(--font-ui); font-size: .92rem;
}
.rail-step:hover { background: var(--mm-carbon); }
.rail-step.active { background: var(--mm-carbon); box-shadow: inset 2px 0 0 var(--mm-pink); }
.rail-step.done .rail-dot { background: var(--mm-teal); border-color: var(--mm-teal); }
.rail-step.locked { opacity: .4; cursor: not-allowed; }
.rail-dot {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--mm-steel); display: grid; place-items: center;
  font-family: var(--font-data); font-size: .72rem; color: var(--mm-void); font-weight: 700;
}
.rail-step.active .rail-dot { border-color: var(--mm-pink); color: var(--mm-pink); }
.rail-step .rail-sub { display: block; font-size: .7rem; color: var(--mm-muted); }

/* ---- Main canvas ---- */
.canvas { padding: 1.6rem 2rem; max-width: 1480px; width: 100%; margin: 0 auto; }
/* Phones need the pixels more than the gutter: 2rem each side spends 64 of a
   320px viewport on nothing (#67). */
@media (max-width: 575.98px) {
  .canvas { padding: 1.2rem 1rem; }
  .center-wrap { padding: 1rem; }
}
/* Ultrawide: use the screen — single pane of glass (issue #17.6) */
@media (min-width: 1700px) { .canvas { max-width: 92vw; } }
@media (min-width: 1500px) {
  .grid.cols-2 { grid-template-columns: repeat(3, 1fr); }
  .tune-layout { grid-template-columns: 1fr 340px; }
}
@media (min-width: 2100px) {
  /* cols-2 widens to 4-up on ultrawide; cols-3 must stay 3-up so 3-stat rows
     (e.g. Assess's Proposed/Current/Δ) don't render into a 4th empty cell (#41). */
  .grid.cols-2 { grid-template-columns: repeat(4, 1fr); }
}

/* group constituents modal + clickable decomposition rows (issue #17.2) */
/* headers center-aligned by default (standard policy, issue #17/#19) */
.search-table th { text-align: center; }
.search-table td:first-child { text-align: left; }

.group-row { cursor: pointer; }
.group-row:hover td { background: rgba(0,240,255,.06); }
.group-count { color: var(--mm-cyan); font-family: var(--font-data); font-size: .72rem; }
.const-list { max-height: 50vh; overflow-y: auto; margin-top: .6rem; }
.const-row {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  background: var(--mm-void); border: 1px solid var(--mm-steel); border-radius: var(--r-sm);
  padding: .5rem .7rem; margin-bottom: .35rem; cursor: pointer; color: var(--mm-ghost);
  font-family: var(--font-data); font-size: .85rem; text-align: left;
}
.const-row:hover { border-color: var(--mm-pink); box-shadow: var(--glow-pink); }
.canvas-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .3rem; }
.canvas-head .step-tag { font-family: var(--font-data); color: var(--mm-cyan); font-size: .8rem; letter-spacing: .1em; }
.lede { color: var(--mm-muted); max-width: 70ch; margin: 0 0 1.4rem; }

.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 991.98px){ .cols-2,.cols-3,.cols-4 { grid-template-columns: 1fr; } }

/* ---- Stat callouts ---- */
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat .k { font-size: .75rem; color: var(--mm-muted); text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-family: var(--font-data); font-size: 2rem; font-weight: 700; }
.stat .v.sm { font-size: 1.35rem; }
.stat .sub { font-size: .8rem; color: var(--mm-muted); }
.hero-stat .v { font-size: 3rem; }

/* ---- Overall portfolio score (issue #41) ---- */
.score-head { display: flex; align-items: center; gap: 1.2rem; }
.score-grade {
  font-family: var(--font-display); font-weight: 700; font-size: 3.4rem; line-height: 1;
  width: 5rem; height: 5rem; flex: 0 0 5rem; display: grid; place-items: center;
  border: 2px solid var(--mm-steel); border-radius: var(--r-md, 12px);
}
.score-grade.gain { color: var(--mm-teal); border-color: var(--mm-teal); box-shadow: 0 0 14px rgba(25,227,194,.25); }
.score-grade.loss { color: var(--mm-pink); border-color: var(--mm-pink); box-shadow: 0 0 14px rgba(255,46,151,.25); }
.score-grade.muted { color: var(--mm-amber); border-color: var(--mm-amber); }

/* ---- Tables ---- */
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
/* Standard policy: table headers are center-aligned by default (see BRAND_GUIDELINES §6.x
   "Data tables" + the moneyman-ui-ux skill). Body cells keep their per-column alignment;
   the first (label) column stays left. */
table.data th { text-align: center; color: var(--mm-muted); font-weight: 500; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .06em; padding: .5rem .6rem; border-bottom: 1px solid var(--mm-steel); }
table.data td:first-child { text-align: left; }
table.data td { padding: .55rem .6rem; border-bottom: 1px solid rgba(35,35,47,.5); font-family: var(--font-data); font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: rgba(35,35,47,.3); }

/* ---- Bars (exposure) ---- */
.bar-row { display: grid; grid-template-columns: 130px 1fr 56px; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.bar-row .lbl { font-size: .82rem; color: var(--mm-ghost); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--mm-void); border: 1px solid var(--mm-steel); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-row .val { font-family: var(--font-data); font-size: .82rem; text-align: right; color: var(--mm-muted); }

/* ---- Candidate / shopping cards ---- */
/* roomier cards: wider minimum + more gap so the grid packs fewer, less-cramped
   columns and each card breathes (decrowd the Tune screen, #33). */
.cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.15rem; }
.cand {
  background: var(--mm-carbon); border: 1px solid var(--mm-steel); border-radius: var(--r-md);
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .65rem; transition: border-color var(--t-base) var(--ease);
}
.cand:hover { border-color: var(--mm-cyan); box-shadow: var(--glow-cyan); }
.cand.picked { border-color: var(--mm-pink); box-shadow: var(--glow-pink); }
.cand-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.cand-tk { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.cand-px { font-family: var(--font-data); font-weight: 700; }
/* Only the NAME ellipsizes; the rank rides alongside it and stays visible (#67).
   min-width:0 is what lets the name shrink — a flex item won't go below its
   content, which would push the rank out of the card. */
.cand-name-row { display: flex; align-items: baseline; gap: .3rem; margin-top: -.4rem; }
.cand-name { font-size: .78rem; color: var(--mm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
.cand-name-row .rank-tag { flex: none; }
.metric-row { display: grid; grid-template-columns: repeat(3,1fr); gap: .4rem; }
.metric { background: var(--mm-void); border-radius: var(--r-sm); padding: .35rem .45rem; }
.metric .mk { font-size: .62rem; color: var(--mm-muted); text-transform: uppercase; letter-spacing: .05em; }
.metric .mv { font-family: var(--font-data); font-size: .92rem; }
.cand-why { font-size: .78rem; color: var(--mm-ghost); min-height: 1.1em; }
.cand-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; }

/* ---- Cart / sidebar ---- */
.tune-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.2rem; align-items: start; }
@media (max-width: 991.98px){ .tune-layout { grid-template-columns: 1fr; } }
.cart { position: sticky; top: 84px; }
.cart-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid rgba(35,35,47,.5); font-size: .9rem; }
.cart-item .x { color: var(--mm-red); cursor: pointer; background: none; border: 0; font-size: 1rem; }

/* ---- AI panel ---- */
.ai-panel { border: 1px solid var(--mm-violet); box-shadow: 0 0 22px -10px rgba(163,92,255,.6); }
.ai-panel .ai-verdict { font-family: var(--font-display); font-size: 1.6rem; color: var(--mm-violet); }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar input { max-width: 280px; }
.toolbar select { max-width: 220px; }

.flags li { color: var(--mm-amber); font-size: .85rem; margin-bottom: .3rem; }
.disclaimer { font-size: .78rem; color: var(--mm-muted); border-left: 2px solid var(--mm-steel); padding-left: .8rem; margin-top: 1.4rem; }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(5,5,9,.75); display: grid; place-items: center; z-index: 60; }
/* width adapts to content: defaults to ~440px but grows to a modal's own inner
   min-width (e.g. the AI-baskets / advanced-search modals set 580–840px) instead
   of clipping it, capped at 92vw (#33). */
.modal { background: var(--mm-carbon); border: 1px solid var(--mm-steel); border-radius: var(--r-lg); padding: 0;
  width: fit-content; min-width: min(440px, 92vw); max-width: 92vw;
  /* cap height so a tall modal (e.g. advanced search results) never overflows the
     viewport; the body scrolls internally instead (#49). */
  max-height: 95vh; display: flex; flex-direction: column; overflow: hidden; }
/* Width modifiers (issue #67). These belong on the .modal, never on a child: a
   child sized in vw is blind to .modal-body's 1.5rem padding, so "min-width:80vw"
   inside a 92vw modal rendered wider than the dialog and scrolled inside it. Both
   still yield to the 92vw max-width above, so they fit any viewport. */
.modal.mm-mid { width: min(680px, 92vw); }
/* Keeps the old "at least 80vw, and at least 1280px" intent — on an ultrawide the
   80vw floor is what wins (2048px at 2560), which is the single-pane-of-glass rule
   of #17.6; the outer min() is what lets it collapse onto a phone. */
.modal.mm-wide { width: min(92vw, max(1280px, 80vw)); }
.modal-body { padding: 1.4rem 1.5rem; overflow-y: auto; min-height: 0; }
/* Phones: claw back the side padding the content needs. */
@media (max-width: 575.98px) { .modal-body { padding: 1.1rem .9rem; } }

/* ---- Onboarding ---- */
.center-wrap { display: grid; place-items: center; flex: 1; padding: 2rem; }
/* 100%, not 94vw: vw units are blind to the ancestors' padding (.canvas 2rem +
   .center-wrap 2rem = 128px), so a "94vw" card overflowed a 320px phone by 45px
   (#67). Percent resolves against the real content box, so the paddings below are
   the only thing setting the gutter. */
.auth-card { width: min(480px, 100%); }
.otp-box { font-family: var(--font-data); font-size: 1.6rem; letter-spacing: .15em; color: var(--mm-lime);
  background: var(--mm-void); border: 1px dashed var(--mm-steel); border-radius: var(--r-md); padding: 1rem; text-align: center; }
.qr { background: #fff; padding: 12px; border-radius: var(--r-md); width: 200px; height: 200px; }
.qr svg { width: 100%; height: 100%; }
.steps-dots { display: flex; gap: .4rem; margin-bottom: 1rem; }
.steps-dots span { width: 28px; height: 4px; border-radius: 999px; background: var(--mm-steel); }
.steps-dots span.on { background: var(--mm-pink); }

.toast-wrap { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 60; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: var(--mm-carbon); border: 1px solid var(--mm-steel); border-left-width: 3px; border-radius: var(--r-sm);
  padding: .7rem 1rem; font-size: .88rem; min-width: 240px; box-shadow: 0 8px 24px -12px #000; }
.toast.ok { border-left-color: var(--mm-teal); }
.toast.err { border-left-color: var(--mm-red); }
.toast.info { border-left-color: var(--mm-cyan); }

/* ---- Candidate quick-pick + details affordance ---- */
.cand { position: relative; cursor: pointer; }
/* positive portfolio impact: slight pink tint (issue #3) */
.cand.positive {
  background: linear-gradient(180deg, rgba(255,46,151,.10), rgba(255,46,151,.04));
  border-color: rgba(255,46,151,.45);
}
.cand.positive:hover { box-shadow: var(--glow-pink); border-color: var(--mm-pink); }
.cand .impact-mini { font-family: var(--font-data); font-size: .74rem; }
.cand .lookup-tag { color: var(--mm-cyan); font-size: .7rem; margin-left: .25rem; vertical-align: super; }
.cand .quick-pick {
  position: absolute; top: .6rem; right: .6rem; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--mm-cyan);
  background: var(--mm-void); color: var(--mm-cyan); font-size: 1.1rem; line-height: 1;
  font-weight: 700; display: grid; place-items: center; cursor: pointer; padding: 0;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.cand .quick-pick:hover { border-color: var(--mm-cyan); color: var(--mm-void); background: var(--mm-cyan); box-shadow: var(--glow-cyan); }
/* picked → green check (issue #23) */
.cand.picked .quick-pick { background: var(--gain); color: var(--mm-void); border-color: var(--gain); box-shadow: 0 0 12px -2px var(--gain); }
.cand.picked .quick-pick:hover { background: var(--gain); color: var(--mm-void); }
/* already-in-another-basket indicator (issue #23) */
.cand .basket-flag {
  display: inline-block; margin-top: .35rem; font-family: var(--font-data); font-size: .68rem;
  color: var(--mm-violet); border: 1px solid var(--mm-violet); border-radius: 999px;
  padding: .05rem .45rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cand .tap-hint { font-size: .68rem; color: var(--mm-muted); }
.cand .chg { font-family: var(--font-data); font-size: .8rem; }

/* ---- Detail drawer (the "menu item" view) ---- */
.drawer-bg { position: fixed; inset: 0; background: rgba(5,5,9,.6); z-index: 55; opacity: 0; transition: opacity var(--t-base) var(--ease); }
.drawer-bg.in { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 80vw;
  background: var(--mm-carbon); border-left: 1px solid var(--mm-steel);
  z-index: 56; overflow-y: auto; transform: translateX(100%);
  transition: transform var(--t-base) var(--ease); box-shadow: -20px 0 50px -20px #000;
}
.drawer.in { transform: none; }
.drawer-head { position: sticky; top: 0; background: var(--mm-carbon); z-index: 2; padding: 1.1rem 1.4rem .9rem; border-bottom: 1px solid var(--mm-steel); }

/* competitor drill-down: back nav + breadcrumb (issue #13 follow-up) */
.drawer-nav { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.drawer-depth { font-family: var(--font-data); font-size: .7rem; color: var(--mm-pink);
  border: 1px solid var(--mm-pink); border-radius: 999px; padding: .1rem .5rem; }
.drawer-trail { font-family: var(--font-data); font-size: .72rem; color: var(--mm-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* depth visual: ghost layers behind the panel that fan out the deeper you dive */
.drawer-stack { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
.drawer-stack-layer {
  position: fixed; right: 0; width: 80vw;
  top: calc(9px * var(--i)); bottom: calc(9px * var(--i));
  background: var(--mm-carbon);
  border-left: 2px solid var(--mm-pink);
  border-top-left-radius: var(--r-lg); border-bottom-left-radius: var(--r-lg);
  transform: translateX(calc(-13px * var(--i)));
  opacity: 0; transition: opacity var(--t-base) var(--ease);
  box-shadow: -10px 0 26px -18px #000;
}
.drawer-stack.in .drawer-stack-layer { opacity: calc(0.6 - 0.07 * var(--i)); }
.drawer-body { padding: 1.2rem 1.4rem 2.4rem; }
.drawer-tk { font-family: var(--font-display); font-weight: 700; font-size: 1.8rem; }
.drawer-close { background: none; border: 0; color: var(--mm-muted); font-size: 1.5rem; cursor: pointer; }
.drawer-close:hover { color: var(--mm-pink); }
/* drag-to-resize handle pinned to the drawer's left edge (issue #23) */
.drawer-resize { position: fixed; top: 0; bottom: 0; width: 7px; z-index: 57; cursor: ew-resize;
  touch-action: none; }  /* horizontal drag must not be taken for a scroll (#67) */
.drawer-resize:hover, .drawer-resize:active { background: linear-gradient(90deg, var(--mm-pink), transparent); }
.section-label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mm-muted); margin: 1.4rem 0 .6rem; }
/* non-caps trailing note appended to a section label (was repeated inline, issue #27) */
.section-label .sub { font-size: .72rem; text-transform: none; letter-spacing: 0; color: var(--mm-muted); font-weight: 400; }

/* ratio grid */
.ratio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.mm-ratio { background: var(--mm-void); border: 1px solid var(--mm-steel); border-radius: var(--r-sm); padding: .5rem .6rem; }
.mm-ratio .rk { font-size: .64rem; color: var(--mm-muted); text-transform: uppercase; letter-spacing: .05em; }
.mm-ratio .rv { font-family: var(--font-data); font-size: 1.05rem; font-weight: 500; }

/* impact block */
.impact-hero { display: flex; align-items: baseline; gap: .8rem; }
.impact-hero .big { font-family: var(--font-data); font-size: 2.4rem; font-weight: 700; }
.impact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; margin-top: .7rem; }
.impact-chip { background: var(--mm-void); border: 1px solid var(--mm-steel); border-radius: var(--r-sm); padding: .45rem .55rem; text-align: center; }
.impact-chip .ik { font-size: .62rem; color: var(--mm-muted); text-transform: uppercase; }
.impact-chip .iv { font-family: var(--font-data); font-size: 1rem; }

/* market cap tag by ticker (issue #13) */
.mcap-tag { color: var(--mm-muted); font-family: var(--font-data); font-size: .7rem; margin-left: .4rem; font-weight: 400; }
.rank-tag { color: var(--mm-cyan); font-family: var(--font-data); font-size: .7rem; }

/* basket switcher (issue #19) */
.basket-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.basket-chip { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  background: var(--mm-carbon); border: 1px solid var(--mm-steel); border-radius: 999px;
  padding: .35rem .75rem; font-size: .85rem; }
.basket-chip:hover { border-color: var(--mm-cyan); }
.basket-chip.active { border-color: var(--mm-pink); color: var(--mm-pink); box-shadow: var(--glow-pink); }
.basket-chip.add { color: var(--mm-cyan); border-style: dashed; }
.basket-chip.ai { color: var(--mm-violet); border-color: var(--mm-violet); border-style: dashed; }
.basket-chip.ai:hover { box-shadow: 0 0 12px -3px var(--mm-violet); }
.basket-cnt { font-family: var(--font-data); font-size: .7rem; background: var(--mm-void); border-radius: 999px; padding: 0 .4rem; }
.basket-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: .8rem; padding: 0 .1rem; opacity: .8; }
.basket-x:hover { opacity: 1; }
.cand-tk .mcap-tag { font-size: .62rem; }

/* return decomposition (issue #13) */
.contrib-cell { display: flex; align-items: center; gap: .4rem; justify-content: flex-end; }
.contrib-bar { height: 8px; border-radius: 999px; display: inline-block; min-width: 2px; }
.contrib-bar.pos { background: var(--mm-teal); }
.contrib-bar.neg { background: var(--mm-red); }
.contrib-val { font-family: var(--font-data); font-size: .78rem; min-width: 52px; text-align: right; }

/* competitor header click-to-swap (issue #13) */
.comp-table th.comp-clickable { cursor: pointer; color: var(--mm-cyan); }
.comp-table th.comp-clickable:hover { color: var(--mm-pink); text-decoration: underline; }

/* 4-year trends (issue #13) */
.trend-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.trend-tile { background: var(--mm-void); border: 1px solid var(--mm-steel); border-radius: var(--r-sm); padding: .5rem .6rem; }
.trend-tile .rk { font-size: .68rem; color: var(--mm-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.trend-tile .rv { font-family: var(--font-data); font-size: 1rem; }
.trend-delta { font-family: var(--font-data); }

/* Wide-table container (issue #67, generalized from the competitors/financials
   .comp-scroll of #7). EVERY table.data goes in one of these — see tableScroll()
   in ui.js. Without it a wide table either scrolls the whole page sideways or,
   inside a .card.live-top (which is overflow:hidden), gets silently cut off with
   no way to reach the hidden columns. -webkit-overflow-scrolling keeps the scroll
   momentum native on iOS. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.comp-table th, .fin-table th { white-space: nowrap; }
.comp-table th.self, .comp-table td.self { color: var(--mm-pink); }
.comp-table td, .fin-table td { white-space: nowrap; }
.comp-table tbody tr:last-child td { border-bottom: 0; }

/* news */
.news-item { display: flex; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid rgba(35,35,47,.5); }
.news-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; flex: none; }
.news-dot.positive { background: var(--mm-teal); } .news-dot.negative { background: var(--mm-red); } .news-dot.neutral { background: var(--mm-muted); }
.news-head { font-size: .9rem; line-height: 1.35; }
.news-meta { font-size: .72rem; color: var(--mm-muted); font-family: var(--font-data); margin-top: .15rem; }
.drawer-cta { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--mm-carbon) 30%); padding: 1rem 1.4rem; }
.drawer-cta .btn { width: 100%; }

.empty { text-align: center; color: var(--mm-muted); padding: 3rem 1rem; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--mm-steel); border-top-color: var(--mm-pink);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.mm-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
/* split: the header-row pattern (title left, status/control right). Replaces the
   24 hand-rolled `row` + inline justify-content:space-between across screens so
   every card/section header is laid out identically (issue #27 cohesion). */
.split { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.split.base { align-items: baseline; }
/* one coherent caption size — collapses the .78/.8/.82/.85rem small-text drift
   into a single step used everywhere (issue #27). */
.fine { font-size: .8rem; }
.mt { margin-top: 1rem; } .mt2 { margin-top: 1.6rem; } .mb { margin-bottom: 1rem; }

/* ---- Touch targets (issue #67) ----
   WCAG 2.5.5 / 44px. Gated on (pointer: coarse) rather than a width breakpoint so
   the desktop's dense control sizing — which the brand depends on — is untouched,
   and so a small touch laptop still gets real targets. Measured before this:
   the hamburger was 34x29, the basket chips 34px, .btn-sm 28-29px. */
@media (pointer: coarse) {
  .btn, .chip, .basket-chip, .rail-step, .ac-item, .const-row, input, select, .brand { min-height: 44px; }
  /* these are icon-only, so they need width as well as height */
  .cart-item .x, .basket-x, .drawer-close, .mm-navtoggle { min-width: 44px; min-height: 44px; }
  .cand .quick-pick { width: 44px; height: 44px; font-size: 1.25rem; }
  .alloc-track { height: 26px; }
  .alloc-handle { width: 16px; height: 34px; top: -4px; right: -5px; }
  .drawer-resize { width: 14px; }
}

/* ---- AI assistant view (issue #23) ---- */
.ai-ask-row { display: flex; gap: .6rem; align-items: flex-end; }
.ai-input { width: 100%; font-family: var(--font-ui); font-size: .95rem; resize: vertical; min-height: 3rem; }
.ai-ask-row .btn { white-space: nowrap; }
.ai-clamp { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: .8rem; }

/* ---- Activity / async jobs view (issue #39) ---- */
.activity-row { padding: .7rem 0; border-bottom: 1px solid rgba(35,35,47,.5); }
.activity-row:last-child { border-bottom: 0; }
.progress { height: 8px; background: var(--mm-void); border: 1px solid var(--mm-steel);
  border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--mm-pink), var(--mm-cyan));
  transition: width var(--t-base) var(--ease); }
