/* The styles of the headline figures and charts embedded in the /notes/ and /funds/ overview pages
   (':::app' wraps each in .app-embed.dash), loaded after /site.css, whose
   tokens they use. The page is light only, as the site is. Chart marks follow
   the dataviz skill (bars.js). */
:root {
  --bar: var(--chart-1, #005388);              /* single-series bars: the palette's first colour */
  --st-exempt: var(--chart-other, #A7AFB7);    /* the "Other" bar: neutral, not a status */
}

.dash .asof { font: 13px var(--mono); color: var(--faint); margin: 0 0 24px; }
.dash-state { padding: 18px 20px; background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: 6px; color: var(--text); max-width: 68ch; }
.dash-state[data-state="error"] { background: #FBF1EC; border-color: #EBC9B8; }

/* headline figures: the label (dt) comes first in the markup and shows under the figure */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 16px; }
.kpi { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px 20px; min-width: 0; }
.kpi-value { margin: 0; font-size: 30px; line-height: 1.1; font-weight: var(--fw-bold, 700); color: var(--navy, var(--bar)); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 13px; line-height: 1.35; color: var(--muted); }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .kpis { gap: 10px; } .kpi { padding: 12px 14px; } .kpi-value { font-size: 24px; } }

/* chart panels */
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px 14px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
/* two short panels sharing one grid cell, beside a long one */
.panel-stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.dash .panel h3 { margin: 0 0 4px; padding: 0; border: 0; font-size: 21px; line-height: 1.25; }
.dash .panel .sub { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: none; }
.dash .panel .sub a { color: var(--accent); }
@media (max-width: 767px) { .dash .panel .sub { font-size: 14px; } }
.dash .panel.wide .sub { max-width: 100ch; }

/* ranked horizontal bars */
.hb { list-style: none; padding: 0; margin: 0; }
.hb-row { margin: 0; }
.hb-hit { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); align-items: center; gap: 10px; min-height: 26px; padding: 2px 4px; border-radius: 4px; color: var(--text); text-decoration: none; }
a.hb-hit:hover, .hb-hit:hover, .hb-hit:focus-visible { background: var(--accent-wash); }
a.hb-hit:hover .hb-label { color: var(--accent); text-decoration: underline; }
.hb-label { font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hb-bar { display: block; height: 16px; width: calc((100% - 6.5em) * var(--f)); min-width: 2px; background: var(--bar); border-radius: 0 4px 4px 0; flex: none; }
.hb-val { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-row.other .hb-bar { background: var(--st-exempt); }

/* 100% stacked bars */
.legend { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sb { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sb-row { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) 5.5em; align-items: center; gap: 10px; }
.sb-label { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-bar { display: flex; gap: 2px; height: 18px; min-width: 0; }
.sb-seg { display: block; flex: 1 1 0; min-width: 2px; }
.sb-seg:first-child { border-radius: 0; }
.sb-seg:last-child { border-radius: 0 4px 4px 0; }
.sb-seg:hover, .sb-seg:focus-visible { filter: brightness(1.12); outline: 2px solid var(--ink); outline-offset: 1px; }
.sb-total { font-size: 12.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* table twin */
.table-view { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 8px; }
.table-view summary { cursor: pointer; font-size: 12.5px; color: var(--accent); }
.dash .table-view table { display: table; width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.dash .table-view :is(th, td) { padding: 6px 8px; border-bottom: 1px solid var(--rule); text-align: left; }
.dash .table-view th { color: var(--label); font-weight: 500; font-size: 12px; }
.dash .table-view .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.dash-tip { position: absolute; z-index: 50; max-width: 280px; padding: 8px 10px; background: var(--sqx-white, #FFFFFF); color: var(--sqx-ink, #1A2430); border: 1px solid var(--sqx-hairline, #D3D7DF); border-radius: 6px; box-shadow: 0 4px 16px rgba(26, 36, 48, 0.14); font-size: 13px; line-height: 1.4; pointer-events: none; display: flex; flex-direction: column; box-shadow: 0 4px 14px rgba(16, 26, 36, 0.18); }
.dash-tip strong { font-weight: 600; font-size: 14px; }
.dash-tip span { color: var(--sqx-grey, #69727A); }

@media (max-width: 900px) {
  .panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .panel { padding: 16px 14px 12px; }
  .hb-hit { grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 8px; }
  .sb-row { grid-template-columns: minmax(0, 5.5em) minmax(0, 1fr) 4.5em; gap: 8px; }
}
