/* Charts page, group meetings (tools/parts/charts/meetings.mjs): the week and the MD's Executive cards.
   Tokens only. Bars are SVG stretched to their row (preserveAspectRatio none); every stroke is non-scaling. */

/* ── The section around a use ── */
.chm-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.chm-meta__item { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) var(--space-4); border: 1px solid var(--color-default); border-radius: var(--radius-card); background: var(--color-surface); }
.chm-meta__text { margin: 0; font-size: var(--text-sm); line-height: var(--leading-sm); color: var(--color-foreground); }
.chm-place { margin-bottom: var(--space-6); }
.chm-after { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.chm-after__col { display: flex; flex-direction: column; gap: var(--space-2); }
.chm-links { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.chm-links a { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-primary); text-decoration: none; }
.chm-links a:hover { text-decoration: underline; }
.chm-links .icon { color: var(--color-muted); }
.chm-where { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-2); font-size: var(--text-xs); color: var(--color-muted); }
.chm-cap { font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--color-muted); }
.chm-foot { display: flex; align-items: flex-start; gap: var(--space-1); margin: 0; padding: var(--space-2) var(--space-4) var(--space-4); font-size: var(--text-xs); line-height: var(--leading-xs); color: var(--color-muted); }
.chm-foot .icon { flex: none; margin-top: 2px; }
.chm-pair { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: flex-start; }
.chm-pair__col { flex: 1 1 360px; min-width: 0; }
.chm-pair__col--card { flex: 0 0 368px; }

/* The empty state of a chart, in the States look */
.chm-ecard { width: 368px; max-width: 100%; }
.chm-ecard > header { border-bottom: 1px solid var(--color-default); }
.chm-ecard .c-empty__art { background: var(--color-surface-muted); color: var(--color-muted); }

/* ── Bars, axes, legends ── */
.chm-bar { display: block; width: 100%; overflow: visible; }
.chm-bar rect, .chm-bar line { vector-effect: non-scaling-stroke; }
.chm-track { fill: var(--color-chart-track); }
.chm-grid { stroke: var(--color-surface); stroke-width: 1; }
.chm-sep { stroke: var(--color-surface); stroke-width: 2; }
.chm-target { stroke: var(--color-foreground); stroke-width: 2; }
.chm-band-edge { stroke: var(--color-subtle); stroke-width: 1; stroke-dasharray: 2 2; }
.chm-bestmark { stroke: var(--color-muted); stroke-width: 2; stroke-dasharray: 2 1; }
.chm-axis { position: relative; height: 16px; font-size: var(--text-xs); color: var(--color-subtle); }
.chm-axis > span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.chm-axis > span:first-child { transform: none; }
.chm-axis > span:last-child { transform: translateX(-100%); }
.chm-axis__unit { font-size: var(--text-xs); color: var(--color-subtle); text-align: center; }
.chm-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4) 0; font-size: var(--text-xs); color: var(--color-muted); }
.chm-key { display: inline-flex; align-items: center; gap: 6px; }
.chm-key .icon { color: var(--c, var(--color-muted)); }
.chm-sw { display: inline-block; width: 10px; height: 10px; border-radius: var(--radius-sm); background: var(--c); }
.chm-sw--ghost { --c: var(--color-subtle); opacity: 0.4; height: 5px; }
.chm-sw--target { width: 2px; height: 12px; border-radius: 0; background: var(--color-foreground); }
.chm-sw--best { width: 2px; height: 12px; border-radius: 0; background: var(--color-muted); }
.chm-sw--edge { width: 0; height: 12px; border-radius: 0; border-left: 1px dashed var(--color-subtle); background: none; }
.chm-sw--md { display: none; }
.chm-sw--fn { background: linear-gradient(90deg, var(--color-fn-land) 25%, var(--color-fn-partnerships) 25% 50%, var(--color-fn-construction) 50% 75%, var(--color-fn-backoffice) 75%); width: 20px; }
.chm-sw--green { display: none; }
.chm-sw--amber { display: none; }
.chm-sw--red { display: none; }
.chm-key:has(.chm-sw--green) .icon { color: var(--color-success-text); }
.chm-key:has(.chm-sw--amber) .icon { color: var(--color-warning-text); }
.chm-key:has(.chm-sw--red) .icon { color: var(--color-danger-text); }

/* Fills: each a colour token, never alone (a word or an icon beside it) */
.chm-fill--actual { --c: var(--color-chart-actual); fill: var(--c); }
.chm-fill--prev { --c: var(--color-chart-forecast); fill: var(--c); }
.chm-fill--weak { --c: var(--color-danger); fill: var(--c); }
.chm-fill--good { --c: var(--color-success); fill: var(--c); }
.chm-fill--fair { --c: var(--color-warning); fill: var(--c); }
.chm-fill--poor { --c: var(--color-danger); fill: var(--c); }
.chm-fill--over { --c: var(--color-danger); fill: var(--c); }
.chm-fill--fn-land { fill: var(--color-fn-land); }
.chm-fill--fn-partnerships { fill: var(--color-fn-partnerships); }
.chm-fill--fn-construction { fill: var(--color-fn-construction); }
.chm-fill--fn-backoffice { fill: var(--color-fn-backoffice); }
.chm-rag { display: inline-flex; align-items: center; gap: 3px; flex: none; font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.chm-rag--green { color: var(--color-success-text); }
.chm-rag--amber { color: var(--color-warning-text); }
.chm-rag--red { color: var(--color-danger-text); }
[tabindex="0"]:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ── 7 · weeklySections: the band inside the Weekly Regional Review ── */
.chm-frame .chm-band { margin-top: var(--space-3); }
.chm-band { padding-bottom: 0; }
.chm-band__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-2); }
.chm-band__head h2 { margin: 0; }
.chm-st--on { --c: var(--color-success); fill: var(--c); }
.chm-st--risk { --c: var(--color-warning); fill: var(--c); }
.chm-st--stalled { --c: var(--color-danger); fill: var(--c); }
.chm-st--same { --c: var(--color-subtle); fill: var(--c); }
.chm-st--unset { --c: var(--color-surface); fill: var(--c); stroke: var(--color-subtle); stroke-dasharray: 2 2; }
.chm-sw.chm-st--unset { border: 1px dashed var(--color-subtle); }
.chm-st.is-ghost { opacity: 0.45; }
.chm-key .icon { width: 12px; height: 12px; }
.chm-key:has(.chm-st--on) .icon { color: var(--color-success-text); }
.chm-key:has(.chm-st--risk) .icon { color: var(--color-warning-text); }
.chm-key:has(.chm-st--stalled) .icon { color: var(--color-danger-text); }
.chm-key:has(.chm-st--same) .icon { color: var(--color-muted); }
.chm-ws { margin: 0; padding: 0 var(--space-4); list-style: none; }
.chm-ws__row, .chm-ws__axis { display: grid; grid-template-columns: 150px minmax(0, 1fr) 340px; align-items: center; gap: var(--space-3); }
.chm-ws__row { padding: 5px 0; border-bottom: 1px solid var(--color-default); }
.chm-ws__row.is-all { border-bottom-color: var(--color-emphasis); }
.chm-ws__row.is-all .chm-ws__label { font-weight: var(--weight-semibold); }
.chm-ws__axis { padding: 4px var(--space-4) 0; }
.chm-ws__label { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); font-size: var(--text-label); }
.chm-ws__label b { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.chm-ws__bars { display: flex; flex-direction: column; gap: 3px; }
.chm-ws__vals { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-3); font-size: var(--text-xs); color: var(--color-muted); }
.chm-ws__n { display: inline-flex; align-items: center; gap: 3px; color: var(--color-foreground); }
.chm-ws__n b { font-weight: var(--weight-semibold); }
.chm-ws__n--on .icon { color: var(--color-success-text); }
.chm-ws__n--risk .icon { color: var(--color-warning-text); }
.chm-ws__n--stalled .icon { color: var(--color-danger-text); }
.chm-ws__n--same .icon { color: var(--color-muted); }
.chm-ws__n .icon { width: 12px; height: 12px; }
.chm-ws__note, .chm-ws__last { color: var(--color-subtle); }
.chm-ws__last { flex-basis: 100%; }

/* ── 8 · weeklyPack: the card on the draft, and the letter ── */
.chm-pk { width: 440px; max-width: 100%; }
.chm-pk > header, .chm-card > header { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.chm-pk__counts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); padding: 0 var(--space-4) var(--space-3); }
.chm-pk__count { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border-radius: var(--radius-control); background: var(--color-surface-muted); }
.chm-pk__count--stage { box-shadow: inset 3px 0 0 var(--color-chart-actual); }
.chm-pk__count--warn { box-shadow: inset 3px 0 0 var(--color-warning); }
.chm-pk__fees { padding: var(--space-2) var(--space-4) 0; border-top: 1px solid var(--color-default); }
.chm-pk__list { margin: var(--space-2) 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.chm-pk__row, .chm-pk__axis { display: grid; grid-template-columns: 116px minmax(0, 1fr) 96px; align-items: center; gap: var(--space-3); }
.chm-pk__wk { font-size: var(--text-xs); color: var(--color-muted); }
.chm-pk__v { display: flex; flex-direction: column; text-align: right; font-size: var(--text-sm); }
.chm-mail { margin: 0; }
.chm-mail__body { padding: var(--space-4) var(--space-5) var(--space-5); background: var(--color-surface); }
.chm-mt { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.chm-mt td { padding: var(--space-2) 0; vertical-align: middle; }
.chm-mt--counts td { width: 50%; padding: var(--space-3); border: 1px solid var(--color-default); color: var(--color-muted); font-size: var(--text-xs); }
.chm-mt__n { display: block; font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--color-foreground); }
.chm-mt__h { margin: var(--space-4) 0 0; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.chm-mt__wk { width: 96px; color: var(--color-muted); font-size: var(--text-xs); }
.chm-mt__bar { padding-right: var(--space-3) !important; }
.chm-mt__track { width: 100%; height: 14px; border-collapse: collapse; background: var(--color-chart-track); }
.chm-mt__track td { padding: 0; height: 14px; }
.chm-mt__fill { background: var(--color-chart-actual); }
.chm-mt__fill--prev { background: var(--color-chart-forecast); }
.chm-mt__v { width: 110px; text-align: right; }
.chm-mt__v span { font-size: var(--text-xs); color: var(--color-muted); }
.chm-mt__note { margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--color-subtle); }

/* ── 9–11 · the Executive cards at their size, and the regional grid ── */
.chm-card { width: 368px; max-width: 100%; }
.chm-card--wide { width: 100%; }
.chm-card > header { padding-bottom: var(--space-2); }
.chm-fns, .chm-lgs, .chm-tms { margin: 0; padding: 0 var(--space-4); list-style: none; }
.chm-fn { display: flex; flex-direction: column; gap: 3px; padding: 6px 0; border-bottom: 1px solid var(--color-default); }
.chm-fn:last-child { border-bottom: 0; }
.chm-fn__top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.chm-fn__l { display: inline-flex; align-items: center; gap: 4px; min-width: 0; font-size: var(--text-label); }
.chm-fn__v { display: inline-flex; align-items: baseline; gap: 6px; flex: none; }
.chm-fn__v b { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.chm-fn__bot { display: grid; grid-template-columns: minmax(0, 1fr) 104px; align-items: center; gap: var(--space-2); }
.chm-fn.is-weak .chm-fn__l, .chm-fn.is-weak .chm-fn__v b { color: var(--color-danger-text); font-weight: var(--weight-semibold); }
.chm-fn__t { margin-top: -2px; }
.chm-fns__axis { padding: 2px calc(var(--space-4) + 104px + var(--space-2)) 0 var(--space-4); }
.chm-md { display: inline-flex; color: var(--color-subtle); }
.chm-md .icon { width: 12px; height: 12px; }

.chm-rg { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.chm-rg th, .chm-rg td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-default); text-align: left; vertical-align: middle; }
.chm-rg thead th { padding-top: 0; padding-bottom: var(--space-1); border-bottom-color: var(--color-emphasis); vertical-align: bottom; }
.chm-rg tbody th { width: 210px; font-weight: var(--weight-regular); }
.chm-rg tbody th .chm-cap { display: block; }
.chm-rg__region { display: block; font-size: var(--text-label); font-weight: var(--weight-semibold); }
.chm-axis--head { display: block; margin-top: 2px; }
.chm-rg__cell { min-width: 200px; }
.chm-rg__v { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin-bottom: 3px; }
.chm-rg__v .chm-cap { white-space: nowrap; }
.chm-rg .chm-fn__l { display: inline; }
.chm-rg__v b { font-weight: var(--weight-semibold); }
.chm-rg__v .chm-rag { margin-left: auto; }
.chm-best, .chm-gap { display: block; margin-top: 2px; font-size: var(--text-xs); }
.chm-best { color: var(--color-foreground); font-weight: var(--weight-medium); }
.chm-gap { color: var(--color-muted); }

.chm-lg { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--color-default); }
.chm-lg:last-child { border-bottom: 0; }
.chm-lg__top { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: var(--space-2); }
.chm-lg__bar { margin-left: 24px; width: calc(100% - 24px); }
.chm-lg__r { font-size: var(--text-xs); color: var(--color-subtle); }
.chm-lg__name { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; font-size: var(--text-label); line-height: var(--leading-xs); }
.chm-lg__name strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: var(--weight-medium); }
.chm-lg__name .chm-cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chm-lg__b { gap: 4px; }
.chm-lg__b .icon { width: 12px; height: 12px; }
.chm-lgs__axis { padding: 2px var(--space-4) 0 calc(var(--space-4) + 24px); }

.chm-tm { display: flex; flex-direction: column; gap: 4px; padding: 7px 0; border-bottom: 1px solid var(--color-default); }
.chm-tm:last-child { border-bottom: 0; }
.chm-tm__top { display: flex; align-items: center; gap: var(--space-3); }
.chm-tm__top .si-fn { margin-right: auto; }
.chm-tm__v, .chm-tm__o { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.chm-tm__v b, .chm-tm__o b { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.chm-tm__o { color: var(--color-muted); }
.chm-tm__o.is-over b, .chm-tm__o.is-over .chm-cap { color: var(--color-danger-text); }
.chm-tms__axis { padding: 2px var(--space-4) 0; }

@media (max-width: 900px) {
  .chm-meta, .chm-after { grid-template-columns: minmax(0, 1fr); }
}

/* The Weekly screen stands whole: the frame grows with it, and the band keeps its height */
.chm-frame .device__screen { height: auto; }
.chm-frame .ap { height: auto; min-height: 800px; }
.chm-frame .ap-main, .chm-frame .ap-page { overflow: visible; }
.chm-frame .chm-band { flex: none; }
