/* Fundamentals tab (js/fundamentals-view.js): open sections divided by thin lines, no
   boxes; every metric is a row with what it is, its value, ten years of bars and a rule
   of thumb. Colours come from tokens.css, so light and dark follow the app. */
/* A grid item of .symbol-tab-panel: without min-width 0 the widest table stretched the page. */
.fundamentals-view { min-width: 0; max-width: 100%; }
.fv {
  --fv-bg: var(--bg);
  --fv-bar: color-mix(in srgb, var(--text) 72%, transparent);
  --fv-bar-soft: color-mix(in srgb, var(--muted) 42%, transparent);
  --fv-band: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font-size: .9rem;
  line-height: 1.5;
  min-width: 0;
}
.fv .pos { color: var(--positive); }
.fv .neg { color: var(--negative); }
.fv-warn { color: var(--warn); }
.fv-mut { color: var(--muted); }
.fv-small { font-size: .76rem; }
.fv-w5 { font-weight: 500; }
.fv-sans { font-family: var(--font-sans) !important; font-size: .92rem !important; }
.fv-empty { padding: 22px 0; margin: 0; }
.fv a { color: var(--accent); }
.fv-term[data-tip], .fv [data-tip]:not(rect):not(.band):not(.mk) { cursor: help; text-decoration: underline dotted color-mix(in srgb, var(--muted) 60%, transparent); text-underline-offset: 3px; }

/* the tab's one-line reading */
.fv-read { padding: 6px 0 14px; }
.fv-read h2 { margin: 0; font-size: 1.18rem; font-weight: 600; letter-spacing: -.015em; line-height: 1.42; max-width: 900px; }
.fv-read h2 b { font-weight: 650; }
.fv-src { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.fv-src b { color: var(--text); font-weight: 550; }
.fv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); display: inline-block; margin-right: 6px; vertical-align: 1px; }
.fv-dot.warn { background: var(--warn); }

/* sub-tabs: an open rail with an underline on the active one */
.fv-subtabs { display: flex; gap: 22px; border-bottom: 1px solid var(--hairline); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.fv-subtabs::-webkit-scrollbar { display: none; }
.fv-subtabs button { all: unset; cursor: pointer; padding: 8px 0; white-space: nowrap; font-weight: 550; font-size: .9rem; color: var(--muted); }
.fv-subtabs button:hover { color: var(--text); }
.fv-subtabs button.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.fv-subtabs button:focus-visible, .fv-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* a section = a question, its answer, how to read it, and the evidence */
.fv-q { padding: 4px 0 26px; }
.fv-q + .fv-q { border-top: 1px solid var(--hairline); padding-top: 22px; }
.fv-q h3 { margin: 0; font-size: .76rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fv-answer { margin: 6px 0 0; font-size: 1.06rem; font-weight: 600; letter-spacing: -.01em; max-width: 860px; }
.fv-lede { margin: 6px 0 0; color: var(--muted); max-width: 820px; font-size: .88rem; }
.fv-lede b { color: var(--text); font-weight: 600; }

/* metric rows: label + plain-English line | value | 10-year bars | yardstick */
.fv-rows { margin-top: 14px; }
.fv-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 128px 170px minmax(0, 1fr); gap: 4px 22px; align-items: center; padding: 11px 0; border-top: 1px solid var(--hairline); }
.fv-row:first-child { border-top: 0; }
.fv-lbl { font-weight: 600; font-size: .9rem; }
.fv-what { color: var(--muted); font-size: .8rem; line-height: 1.4; margin-top: 1px; }
.fv-val { font: 650 1.04rem var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.fv-val small { display: block; font: 500 .7rem var(--font-sans); color: var(--muted); white-space: normal; }
.fv-yard { font-size: .78rem; color: var(--muted); line-height: 1.4; }
.fv-yard b { font-weight: 600; }
.fv-row.na .fv-val { color: var(--muted); font: 550 .85rem var(--font-sans); }
.fv-spark { display: block; width: 170px; height: 34px; overflow: visible; }
.fv-spark rect { fill: var(--fv-bar-soft); }
.fv-spark rect.last { fill: var(--fv-bar); }
.fv-spark rect.neg { fill: color-mix(in srgb, var(--negative) 55%, transparent); }
.fv-spark rect.gap { fill: none; stroke: var(--fv-bar-soft); stroke-dasharray: 2 2; }
.fv-spark rect.hit { fill: transparent; cursor: default; }
.fv-spark rect.hit:hover { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.fv-spark line { stroke: var(--chart-grid); }
.fv-spark-cap { display: flex; justify-content: space-between; font: 500 .66rem var(--font-mono); color: var(--muted); width: 170px; }

/* how it's calculated */
.fv-how { margin-top: 12px; font-size: .84rem; }
.fv-how summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .8rem; list-style: none; }
.fv-how summary::-webkit-details-marker { display: none; }
.fv-how summary::before { content: "+ "; }
.fv-how[open] summary::before { content: "− "; }
.fv-how summary:hover { color: var(--text); }
.fv-how dl { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 6px 18px; margin: 10px 0 0; }
.fv-how dt { font-weight: 600; }
.fv-how dd { margin: 0; color: var(--muted); }
.fv-how code { font-family: var(--font-mono); font-size: .8rem; color: var(--text); word-break: break-word; }

/* valuation scale: neutral, never a traffic light */
.fv-scale { position: relative; margin: 46px 0 30px; height: 44px; }
.fv-scale .track { position: absolute; left: 0; right: 0; top: 20px; height: 4px; background: var(--hairline); border-radius: 2px; }
.fv-scale .band { position: absolute; top: 14px; height: 16px; background: var(--fv-band); border-radius: 4px; }
.fv-scale .mk { position: absolute; top: -12px; transform: translateX(-50%); text-align: center; white-space: nowrap; font-size: .72rem; line-height: 1.25; color: var(--muted); }
.fv-scale .mk i { display: block; width: 2px; height: 16px; margin: 4px auto 0; background: var(--accent); }
.fv-scale .mk.base i { height: 22px; margin-top: 1px; }
.fv-scale .mk.price { top: auto; bottom: -26px; color: var(--text); font-weight: 600; }
.fv-scale .mk.price i { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 2px solid var(--fv-bg); margin: 0 auto 4px; position: relative; top: -14px; }
.fv-scale .mk.price span { position: relative; top: -14px; }
.fv-facts { display: flex; flex-wrap: wrap; gap: 12px 34px; margin-top: 8px; }
.fv-fact { display: flex; flex-direction: column; min-width: 0; }
.fv-fact > span { font-size: .72rem; color: var(--muted); font-weight: 550; }
.fv-fact > b { font: 650 1.02rem var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fv-fact > small { font-size: .72rem; color: var(--muted); }

/* growth comparison bars */
.fv-gbars { margin-top: 14px; display: grid; grid-template-columns: 210px minmax(0, 1fr) 70px; gap: 8px 14px; align-items: center; max-width: 760px; }
.fv-gbars .gl { font-size: .84rem; }
.fv-gbars .gl small { display: block; color: var(--muted); font-size: .74rem; }
.fv-gbars .gt { height: 10px; background: var(--hairline); border-radius: 5px; position: relative; }
.fv-gbars .gf { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--fv-bar-soft); max-width: 100%; }
.fv-gbars .gf.key { background: var(--accent); }
.fv-gbars .gv { font: 600 .9rem var(--font-mono); text-align: right; }

/* build-up of the base value */
.fv-build { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 0 18px; max-width: 760px; font-size: .88rem; }
.fv-build > div { padding: 7px 0; border-top: 1px solid var(--hairline); }
.fv-build > div:nth-child(-n+2) { border-top: 0; }
.fv-build .v { text-align: right; font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.fv-build .t small { display: block; color: var(--muted); font-size: .76rem; }
.fv-build .tot { font-weight: 650; border-top: 1px solid var(--border) !important; }
.fv-split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 10px 0 4px; max-width: 760px; }
.fv-split div { height: 100%; }
.fv-split .a { background: var(--fv-bar); }
.fv-split .b { background: var(--fv-bar-soft); }
.fv-split-cap { display: flex; justify-content: space-between; gap: 12px; font-size: .74rem; color: var(--muted); max-width: 760px; }

/* tables */
.fv-tbl { overflow-x: auto; margin-top: 12px; scrollbar-width: thin; }
table.fv-t { border-collapse: collapse; width: 100%; font-size: .84rem; }
table.fv-t th, table.fv-t td { padding: 7px 10px; text-align: right; white-space: nowrap; border-top: 1px solid var(--hairline); }
table.fv-t thead th { border-top: 0; font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; vertical-align: bottom; }
table.fv-t th:first-child, table.fv-t td:first-child { text-align: left; position: sticky; left: 0; background: var(--fv-bg); padding-left: 0; z-index: 1; }
table.fv-t td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.fv-t td:first-child { font-family: var(--font-sans); font-weight: 550; }
table.fv-t td.miss, table.fv-t th.miss { color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--muted) 9%, transparent) 5px 6px); }
table.fv-t tbody tr:hover td { background-color: color-mix(in srgb, var(--text) 3%, var(--fv-bg)); }
table.fv-t sup { color: var(--accent); font-family: var(--font-sans); }
.fv-seg { display: flex; gap: 2px; flex-wrap: wrap; }
.fv-seg button { all: unset; cursor: pointer; padding: 3px 8px; border-radius: 6px; font: 600 .78rem var(--font-sans); color: var(--muted); white-space: nowrap; }
.fv-seg button:hover { color: var(--text); }
.fv-seg button.on { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.fv-ctrl { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-top: 12px; }
.fv-foot { margin-top: 10px; font-size: .76rem; color: var(--muted); }

/* quarterly chart */
.fv-qchart { position: relative; margin-top: 14px; }
.fv-qchart svg { display: block; width: 100%; overflow: visible; }
.fv-qchart text { font: 500 11px var(--font-mono); fill: var(--muted); }
.fv-qchart text.cap { font-family: var(--font-sans); font-weight: 600; }
.fv-qchart rect.b { fill: var(--fv-bar-soft); }
.fv-qchart rect.b.last { fill: var(--fv-bar); }
.fv-qchart rect.b.hov { fill: var(--accent); }
.fv-qchart rect.col { fill: transparent; }
.fv-qchart .m { fill: none; stroke: var(--accent); stroke-width: 2; }
.fv-qchart circle { fill: var(--fv-bg); stroke: var(--accent); stroke-width: 2; }
.fv-qchart .grid { stroke: var(--chart-grid); }

@media (max-width: 760px) {
  .fv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .fv-sparkcell, .fv-yard { grid-column: 1 / -1; }
  .fv-gbars { grid-template-columns: 120px minmax(0, 1fr) 56px; }
  .fv-build { grid-template-columns: minmax(0, 1fr) 100px; }
  .fv-how dl { grid-template-columns: 1fr; }
  .fv-how dd { margin-bottom: 6px; }
  .fv-read h2 { font-size: 1.04rem; }
  .fv-scale { margin-left: 30px; margin-right: 30px; }
  .fv-scale .mk { font-size: .66rem; }
}
