/* Shared components (docs/DESIGN.md "Components"). Owner: lead. Screen agents use these
   classes and put screen-only rules in their own file; a change here needs the lead.
   Ported from the reference design (FMeter-redesign/admin-center/src/app.css). */

/* ---- Page header: breadcrumb, title + subtitle + actions, command bar ---- */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: var(--fontSizeBase300); color: var(--colorNeutralForeground3); }
.crumbs a { color: var(--colorNeutralForeground3); }
.crumbs a:hover { color: var(--colorNeutralForeground2); }
.crumbs .i { width: 12px; height: 12px; color: var(--colorNeutralForeground3); }
.crumbs [aria-current] { color: var(--colorNeutralForeground1); }
.page-head { display: flex; align-items: flex-start; gap: var(--spacingHorizontalL); margin-top: var(--spacingVerticalS); }
.page-head .titles { flex: 1; min-width: 0; }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-head .sub { margin-top: 2px; color: var(--colorNeutralForeground3); }
.page-head .acts { display: flex; align-items: center; gap: 8px; flex: none; padding-top: 2px; }
.page-head + .card, .page-head + .grid, .page-head + .stack { margin-top: var(--spacingVerticalL); }

/* Command bar: flat on the canvas, pulled 12 px left so icons line up with the title */
.cmdbar {
  display: flex; align-items: center; gap: 2px; min-height: 44px;
  margin: var(--spacingVerticalM) 0 var(--spacingVerticalM) -12px;
}
.cmdbar .sep { width: 1px; height: 20px; background: var(--colorNeutralStroke2); margin: 0 6px; flex: none; }
.cmdbar .end { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-right: 8px; }
.cmdbar fluent-button, .cmdbar fluent-anchor-button { flex: none; }
.cmd-more { display: none; }

/* Live indicator: "● Live opdateret …" (role=status) */
.live-status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fontSizeBase200); line-height: 16px; color: var(--colorNeutralForeground3); white-space: nowrap; }
.live-status .pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--colorStatusSuccessForeground3); flex: none; }
.live-status .pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--colorStatusSuccessForeground3); opacity: .35; }
.live-status b { color: var(--colorStatusSuccessForeground1); font-weight: var(--fontWeightSemibold); }

/* ---- Cards ---------------------------------------------------------------- */
.card { background: var(--fm-card); border-radius: var(--borderRadiusXLarge); box-shadow: var(--fm-card-shadow); border: 1px solid var(--fm-card-stroke); min-width: 0; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 12px 16px 8px 20px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .meta { color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); }
.card-head .end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 0 20px 16px; }
.card-foot { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--fm-row-stroke); padding: 10px 20px; }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: var(--fontWeightSemibold); }
.link-arrow .i { width: 16px; height: 16px; }
.grid { display: grid; gap: var(--spacingVerticalL); }
.cols-main { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); align-items: start; }
.stack { display: grid; gap: var(--spacingVerticalL); min-width: 0; }
.mt { margin-top: var(--spacingVerticalL); }

/* KPI strip: one card, cells split by hairlines */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; color: inherit; min-width: 0; border-left: 1px solid var(--fm-row-stroke); }
.kpi:first-child { border-left: 0; }
a.kpi:hover { text-decoration: none; background: var(--colorSubtleBackgroundHover); color: inherit; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: var(--fontSizeBase200); line-height: 16px; font-weight: var(--fontWeightSemibold); color: var(--colorNeutralForeground2); white-space: nowrap; }
.kpi-value { font-family: var(--fontFamilyNumeric); font-variant-numeric: tabular-nums; font-size: var(--fontSizeHero700); line-height: var(--lineHeightHero700); white-space: nowrap; }
.kpi-value small { font-family: var(--fontFamilyBase); font-size: var(--fontSizeBase300); color: var(--colorNeutralForeground3); margin-left: 4px; }
.kpi-sub { font-size: var(--fontSizeBase200); line-height: 16px; color: var(--colorNeutralForeground3); }

/* ---- Status vocabulary: icon + colour + word (docs/DESIGN.md "Status") ---- */
.st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st .i { width: 16px; height: 16px; }
.st-ok .i { color: var(--colorStatusSuccessForeground1); }
.st-warn .i { color: var(--colorStatusWarningForeground1); }
.st-bad .i { color: var(--fm-danger-fg); }
.st-none .i { color: var(--colorNeutralForeground3); }
.st-info .i { color: var(--colorBrandForeground1); }
.st-bad .st-word { color: var(--fm-danger-fg); font-weight: var(--fontWeightSemibold); }
.st-warn .st-word { color: var(--colorStatusWarningForeground1); }
.sev-bad { color: var(--fm-danger-fg); }
.sev-warn { color: var(--colorStatusWarningForeground1); }
.sev-info { color: var(--colorBrandForeground1); }
.sev-none { color: var(--colorNeutralForeground3); }
.okmark { display: inline-flex; color: var(--colorStatusSuccessForeground1); }
.okmark .i { width: 14px; height: 14px; }

/* Medium identity: one icon + one tint per medium (heat, cold, hot, el) */
.med { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.med .i { width: 16px; height: 16px; }
.med-heat .i { color: var(--fm-heat); }
.med-cold .i { color: var(--fm-cold); }
.med-hot .i { color: var(--fm-hot); }
.med-el .i { color: var(--fm-el); }
.med-tile { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--borderRadiusMedium); flex: none; }
.med-tile.heat { background: var(--fm-heat-bg); color: var(--fm-heat); }
.med-tile.cold { background: var(--fm-cold-bg); color: var(--fm-cold); }
.med-tile.hot { background: var(--fm-hot-bg); color: var(--fm-hot); }
.med-tile.el { background: var(--fm-el-bg); color: var(--fm-el); }
.med-tile.unit { background: var(--colorBrandBackground2); color: var(--colorBrandForeground2); }
.med-tile.sm { width: 24px; height: 24px; }
.med-tile.sm .i { width: 16px; height: 16px; }
.med-tile.lg { width: 40px; height: 40px; border-radius: var(--borderRadiusLarge); }
.med-tile.lg .i { width: 24px; height: 24px; }

/* Delta chips: decrease = success, increase = neutral (or warning when notable) */
.deltachip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 12px;
  font-size: var(--fontSizeBase200); font-weight: var(--fontWeightSemibold); white-space: nowrap;
  background: var(--colorStatusSuccessBackground1); color: var(--colorStatusSuccessForeground1); border: 1px solid var(--colorStatusSuccessBorder1);
}
.deltachip .i { width: 14px; height: 14px; }
.deltachip.up { background: var(--colorNeutralBackground3); color: var(--colorNeutralForeground2); border-color: var(--colorNeutralStroke2); }
.deltachip.warn { background: var(--colorStatusWarningBackground1); color: var(--colorStatusWarningForeground3); border-color: var(--colorStatusWarningBorder1); }
.dmini { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fontSizeBase200); line-height: 16px; color: var(--colorNeutralForeground3); font-variant-numeric: tabular-nums; }
.dmini .i { width: 12px; height: 12px; }
.dmini.up { color: var(--colorStatusWarningForeground1); font-weight: var(--fontWeightSemibold); }
.dmini.down { color: var(--colorStatusSuccessForeground1); }

/* Badges / tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--borderRadiusMedium);
  font-size: var(--fontSizeBase200); line-height: 20px; white-space: nowrap;
  background: var(--colorNeutralBackground3); color: var(--colorNeutralForeground2); border: 1px solid var(--colorNeutralStroke2);
}
.tag.bad { background: var(--colorStatusDangerBackground1); color: var(--colorStatusDangerForeground1); border-color: var(--colorStatusDangerBorder1); }
.tag.warn { background: var(--colorStatusWarningBackground1); color: var(--colorStatusWarningForeground3); border-color: var(--colorStatusWarningBorder1); }
.tag.ok { background: var(--colorStatusSuccessBackground1); color: var(--colorStatusSuccessForeground1); border-color: var(--colorStatusSuccessBorder1); }
.tag.brand { background: var(--colorBrandBackground2); color: var(--colorBrandForeground2); border-color: var(--colorBrandStroke2); }

/* ---- Data grid (styled native table) -------------------------------------- */
.table-wrap { border-top: 1px solid var(--fm-row-stroke); }
.table-wrap:focus-visible { outline-offset: -2px; }
table.dg { width: 100%; border-collapse: collapse; font-size: var(--fontSizeBase300); }
.dg th, .dg td { height: 44px; padding: 0 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--fm-row-stroke); vertical-align: middle; }
.dg th:first-child, .dg td:first-child { padding-left: 20px; }
.dg th:last-child, .dg td:last-child { padding-right: 12px; }
.dg thead th { height: 40px; font-size: var(--fontSizeBase200); font-weight: var(--fontWeightSemibold); color: var(--colorNeutralForeground2); background: var(--fm-card); position: sticky; top: 0; }
.dg tbody tr:hover { background: var(--colorSubtleBackgroundHover); }
.dg tbody tr:has(:focus-visible) { background: var(--colorSubtleBackgroundHover); }
.dg tbody tr:last-child td { border-bottom: 0; }
.dg .r { text-align: right; }
.dg .c { text-align: center; }
.dg .wrap { white-space: normal; }
/* Sortable header: <th aria-sort><a class="sortbtn" href="?sort=…">Label <svg/></a></th> */
.dg .sortbtn {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; margin: 0 -6px; border: 0; border-radius: var(--borderRadiusMedium);
  background: transparent; font: inherit; color: inherit; cursor: pointer;
}
.dg .sortbtn:hover { background: var(--colorSubtleBackgroundHover); color: var(--colorNeutralForeground1); text-decoration: none; }
.dg .sortbtn .i { width: 12px; height: 12px; }
.dg th.r .sortbtn { flex-direction: row-reverse; }
.dg .primary { display: block; line-height: 20px; font-weight: var(--fontWeightSemibold); color: var(--colorNeutralForeground1); }
.dg a.primary:hover { color: var(--colorBrandForegroundLinkHover); }
.dg .second { display: block; max-width: 240px; font-size: var(--fontSizeBase200); line-height: 16px; color: var(--colorNeutralForeground3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dg td.two { padding-top: 4px; padding-bottom: 4px; }
.dg .val { font-variant-numeric: tabular-nums; }
.dg .val .unit { margin-left: 3px; }
.dg .namecell { display: flex; align-items: flex-start; gap: 10px; }
.dg .namecell > .med { margin-top: 2px; }
/* Row accents: 3 px left stripe */
.dg tr.alarm td:first-child { box-shadow: inset 3px 0 0 var(--colorStatusDangerBorder2); }
.dg tr.stale td:first-child { box-shadow: inset 3px 0 0 var(--colorStatusWarningBorderActive); }
.dg tr.group td { height: 32px; background: var(--colorNeutralBackground2); font-size: var(--fontSizeBase200); font-weight: var(--fontWeightSemibold); color: var(--colorNeutralForeground2); }
.dg tr.group:hover { background: transparent; }
.dg .chev, .dg td.only-m { display: none; }
/* Whole row clickable (stretched link): the row's only real <a class="rowlink"> covers the
   row with ::after. Other interactive bits and [title] targets sit above the overlay. */
.dg tbody tr:has(a.rowlink) { position: relative; cursor: pointer; }
.dg a.rowlink::after { content: ""; position: absolute; inset: 0; }
.dg tbody tr:has(a.rowlink) :is(fluent-menu, fluent-button, button, form, [title], .above) { position: relative; z-index: 1; }
.dg tbody tr:has(a.rowlink) fluent-menu { cursor: default; }
/* Selected row (pane open): aria-current="true" on its rowlink */
.dg tbody tr:has(a.rowlink[aria-current="true"]), .dg tbody tr:has(a.rowlink[aria-current="true"]):hover { background: var(--colorBrandBackground2); }
.dg tbody tr:has(a.rowlink[aria-current="true"]) a.primary { color: var(--colorNeutralForeground1); }
.iconbtn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--borderRadiusMedium);
  background: transparent; color: var(--colorNeutralForeground2); cursor: pointer;
}
.iconbtn:hover { background: var(--colorSubtleBackgroundHover); color: var(--colorNeutralForeground1); text-decoration: none; }
.iconbtn:active { background: var(--colorSubtleBackgroundPressed); }

/* Signal bars: <span class="bars b3" aria-hidden="true"><i></i><i></i><i></i><i></i></span> */
.sig { display: inline-flex; align-items: center; gap: 6px; }
.sig .unit { margin-left: -3px; font-size: var(--fontSizeBase200); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.bars i { display: block; width: 3px; border-radius: 1px; background: var(--colorNeutralStroke1); }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 11px; } .bars i:nth-child(4) { height: 14px; }
.bars.b1 i:nth-child(-n+1), .bars.b2 i:nth-child(-n+2), .bars.b3 i:nth-child(-n+3), .bars.b4 i { background: var(--colorNeutralForeground2); }
.bars.b1 i:nth-child(1) { background: var(--colorStatusWarningForeground1); }

/* Grid toolbar: views (tabs with counts) + search + filter chips */
.gridbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 12px; flex-wrap: wrap; }
.gridbar .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.views-wrap { min-width: 0; }
.views { display: flex; gap: 2px; flex-wrap: wrap; }
.view {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--borderRadiusMedium);
  border: 0; background: transparent; color: var(--colorNeutralForeground2); cursor: pointer; position: relative;
}
.view:hover { background: var(--colorSubtleBackgroundHover); color: var(--colorNeutralForeground1); text-decoration: none; }
.view:is([aria-pressed="true"], [aria-current]) { color: var(--colorNeutralForeground1); font-weight: var(--fontWeightSemibold); }
.view:is([aria-pressed="true"], [aria-current])::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 2px; background: var(--colorCompoundBrandStroke); }
.view .n { font-weight: var(--fontWeightRegular); color: var(--colorNeutralForeground3); font-variant-numeric: tabular-nums; }
.searchbox {
  display: flex; align-items: center; gap: 6px; width: 260px; max-width: 100%; height: 32px;
  padding: 0 10px; border-radius: var(--borderRadiusMedium);
  background: var(--colorNeutralBackground1); color: var(--colorNeutralForeground3);
  border: 1px solid var(--colorNeutralStroke1); border-bottom-color: var(--colorNeutralStrokeAccessible);
}
.searchbox:focus-within { border-bottom: 2px solid var(--colorCompoundBrandStroke); }
/* The :not() chain repeats fluent.css's input rule so this one wins. */
.searchbox input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
.searchbox input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):hover,
.searchbox input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible { flex: 1; min-width: 0; min-height: 0; height: 28px; border: 0; border-radius: 0; outline: 0; box-shadow: none; background: transparent; padding: 0; }
.searchbox input::placeholder { color: var(--colorNeutralForeground4); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; align-items: center; }
.chips .lbl { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); margin-right: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--colorNeutralStroke1); background: var(--colorNeutralBackground1); color: var(--colorNeutralForeground1); font-size: var(--fontSizeBase200);
}
.chip:hover { background: var(--colorNeutralBackground1Hover); border-color: var(--colorNeutralStroke1Hover); text-decoration: none; color: var(--colorNeutralForeground1); }
.chip:is([aria-pressed="true"], [aria-current]) { background: var(--colorBrandBackground2); border-color: var(--colorBrandStroke2); color: var(--colorBrandForeground2); font-weight: var(--fontWeightSemibold); }
.chip .i { width: 16px; height: 16px; }
.select-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.select-wrap select { appearance: none; width: 100%; padding: 0 32px 0 10px; }
.select-wrap .i { position: absolute; right: 10px; pointer-events: none; color: var(--colorNeutralForeground3); }
.grid-foot { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--fm-row-stroke); color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); }
.grid-foot .kbd-hint { margin-left: auto; }

/* Tabs as links (pivot) and segmented control (links or aria-pressed buttons) */
.pivot { display: flex; gap: 4px; }
.pivot a {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: var(--borderRadiusMedium);
  color: var(--colorNeutralForeground2);
}
.pivot a:hover { background: var(--colorSubtleBackgroundHover); text-decoration: none; color: var(--colorNeutralForeground1); }
.pivot a[aria-current] { color: var(--colorNeutralForeground1); font-weight: var(--fontWeightSemibold); }
.pivot a[aria-current]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 2px; background: var(--colorCompoundBrandStroke); }
.pivot .i { width: 16px; height: 16px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--borderRadiusMedium); background: var(--colorNeutralBackground3); }
.seg a, .seg button {
  padding: 2px 10px; border: 0; border-radius: var(--borderRadiusSmall); background: transparent; cursor: pointer; white-space: nowrap;
  color: var(--colorNeutralForeground2); font-size: var(--fontSizeBase200); line-height: 20px;
}
.seg a:hover, .seg button:hover { text-decoration: none; color: var(--colorNeutralForeground1); background: var(--colorSubtleBackgroundHover); }
.seg :is(a[aria-current], button[aria-pressed="true"]) { background: var(--colorNeutralBackground1); color: var(--colorNeutralForeground1); font-weight: var(--fontWeightSemibold); box-shadow: var(--shadow2); }
.seg.lg a, .seg.lg button { padding: 4px 12px; font-size: var(--fontSizeBase300); }

/* Empty state */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 40px 20px 44px; }
.empty .ring { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--colorNeutralBackground3); color: var(--colorNeutralForeground3); margin-bottom: 4px; }
.empty .ring .i { width: 32px; height: 32px; }
.empty p { color: var(--colorNeutralForeground3); max-width: 44ch; }
.empty.sm { padding: 20px 12px 24px; }
.empty.sm .ring { width: 48px; height: 48px; }
.empty.sm .ring .i { width: 24px; height: 24px; }

/* Key/value lists */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; }
.kv dt, .kv dd { padding: 6px 0; border-bottom: 1px solid var(--colorNeutralStroke3); }
.kv dt { color: var(--colorNeutralForeground2); }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.kv dt:nth-last-child(2), .kv dd:last-child { border-bottom: 0; }
.regs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; }
.regs dt { font-size: var(--fontSizeBase200); line-height: var(--lineHeightBase200); color: var(--colorNeutralForeground3); }
.regs dd { font-family: var(--fontFamilyNumeric); font-variant-numeric: tabular-nums; font-size: var(--fontSizeBase400); line-height: var(--lineHeightBase400); white-space: nowrap; }
.regs dd .unit { font-family: var(--fontFamilyBase); font-size: var(--fontSizeBase200); margin-left: 3px; }

/* Message bars: the icon slot gets the status colour */
fluent-message-bar [slot="icon"] .i { color: currentColor; }
fluent-message-bar[intent="error"] [slot="icon"] { color: var(--fm-danger-fg); display: inline-flex; }
fluent-message-bar[intent="warning"] [slot="icon"] { color: var(--colorStatusWarningForeground3); display: inline-flex; }
.bars-stack { display: grid; gap: 8px; }

/* ---- Side pane: list + reading pane (docs/DESIGN.md "Pane pattern") ------- */
/* <div class="mpage has-sel" data-pane-page> … <div class="msplit"><div class="mlist card">…</div>
   <section id="pane" class="mpane card" aria-labelledby="pane-title">…</section></div></div> */
.msplit { display: block; }
.mpane { container: pane / inline-size; min-width: 0; }
.mpane:empty { display: none; }
.mp-back { display: none; align-items: center; gap: 6px; margin: 8px 8px 0; padding: 6px 8px; border-radius: var(--borderRadiusMedium); color: var(--colorNeutralForeground2); font-weight: var(--fontWeightSemibold); }
.mp-back:hover { background: var(--colorSubtleBackgroundHover); color: var(--colorNeutralForeground1); text-decoration: none; }
.mp-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 12px 8px 20px; }
.mp-titles { flex: 1; min-width: 0; }
.mp-title { font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); font-weight: var(--fontWeightSemibold); }
.mp-title:focus { outline: none; box-shadow: none; }
.mp-titles p { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: var(--fontSizeBase200); line-height: 20px; color: var(--colorNeutralForeground3); }
.mp-close { flex: none; }
.mp-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 0 12px 12px 8px; }
.mp-actions fluent-menu { margin-left: auto; }
.mp-bar { width: calc(100% - 40px); box-sizing: border-box; margin: 0 20px 16px; }
.mp-bar a { font-weight: var(--fontWeightSemibold); }
.mp-sec { padding: 16px 20px; border-top: 1px solid var(--fm-row-stroke); }
.mp-h { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mp-h .end { margin-left: auto; }
.mp-kpis { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 24px; }
.mp-kpis > div { display: flex; flex-direction: column; }
.mp-kpis .v { font-family: var(--fontFamilyNumeric); font-variant-numeric: tabular-nums; font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); white-space: nowrap; }
.mp-kpis .v .unit { font-family: var(--fontFamilyBase); font-size: var(--fontSizeBase200); margin-left: 3px; }
.mp-kpis .v.prev { color: var(--colorNeutralForeground2); }
.mp-kpis .v.bad { color: var(--fm-danger-fg); }
.mp-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
.mp-cols h3 { margin-bottom: 4px; }
@container pane (max-width: 600px) { .mp-cols { grid-template-columns: minmax(0, 1fr); } }
.mp-sec details.tbl { margin: 12px -20px -16px; }
.mp-sec details.tbl summary { padding: 10px 20px; }
@media (min-width: 1024px) {
  .mpage.has-sel .msplit { display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: var(--spacingHorizontalL); align-items: start; }
  .mpage.has-sel .dg .hide-p { display: none; }
  .mpage.has-sel .grid-foot .kbd-hint { display: none; }
  .mpane { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
@media (min-width: 1024px) and (max-width: 1239px) {
  .mpage.has-sel .msplit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
/* Below 1024 px the pane is the page: list chrome hidden, back link instead of ✕ */
@media (max-width: 1023px) {
  .mpage.has-sel > :not(.msplit), .mpage.has-sel .mlist { display: none; }
  .mp-back { display: inline-flex; }
  .mp-close { display: none; }
}
@media (max-width: 599px) {
  .mp-actions .hide-narrow { display: none; }
  .mp-head { padding: 12px 12px 8px 16px; }
  .mp-sec { padding: 14px 16px; }
  .mp-sec details.tbl { margin: 12px -16px -14px; }
  .mp-sec details.tbl summary { padding: 10px 16px; }
  .mp-bar { width: calc(100% - 32px); margin: 0 16px 14px; }
  .mp-kpis { gap: 8px 20px; }
}

/* ---- Charts (charts.js, docs/DESIGN.md "Charts") --------------------------- */
.chart-kpis { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 32px; }
.chart-kpis .t-caption1 { display: block; }
.chart-kpis .v { font-family: var(--fontFamilyNumeric); font-variant-numeric: tabular-nums; font-size: var(--fontSizeBase600); line-height: var(--lineHeightBase600); }
.chart-kpis .v.prev { color: var(--colorNeutralForeground2); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fontSizeBase200); line-height: 16px; color: var(--colorNeutralForeground2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.sw.s-heat { background: var(--fm-heat); } .sw.s-cold { background: var(--fm-cold); } .sw.s-hot { background: var(--fm-hot); } .sw.s-el { background: var(--fm-el); }
.sw.s-prev { background: var(--fm-prev-line); } .sw.s-ret { background: var(--fm-ret); }
.sw.ln { width: 14px; height: 2px; border-radius: 1px; }
.sw.band-bad { width: 12px; height: 12px; background: var(--fm-band-bad); box-shadow: inset 0 0 0 1px var(--colorStatusDangerBorder1); }
.sw.flag { width: auto; height: auto; background: transparent; color: var(--colorStatusWarningForeground1); }
.sw.flag .i { width: 14px; height: 14px; }
/* The uPlot host: <div class="ts" data-ts …>. Height via .ts-sm / default / .ts-lg. */
.ts { position: relative; min-height: 160px; margin-top: 8px; }
.ts.ts-sm { min-height: 120px; }
.ts.ts-lg { min-height: 280px; }
.ts .uplot { font-family: var(--fontFamilyBase); }
.ts .u-over { cursor: default; }
.ts-empty { display: grid; place-items: center; min-height: inherit; color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); text-align: center; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 8px 12px; border-radius: var(--borderRadiusMedium);
  background: var(--colorNeutralBackground1); color: var(--colorNeutralForeground1); box-shadow: var(--shadow16);
  font-size: var(--fontSizeBase200); line-height: 16px; border: 1px solid var(--colorTransparentStroke, transparent); white-space: nowrap;
}
.tip[hidden] { display: none; }
.tip b { display: block; margin-bottom: 4px; font-weight: var(--fontWeightSemibold); }
.tip div { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.tip div span { display: inline-flex; align-items: center; gap: 6px; color: var(--colorNeutralForeground2); }
.tip .sw { width: 8px; height: 8px; }
.tip .sw.ln { width: 12px; height: 2px; }
.tip em { font-style: normal; display: block; margin-top: 4px; color: var(--colorStatusWarningForeground1); }
.ts-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 8px 12px; border-radius: var(--borderRadiusMedium); background: var(--colorNeutralBackground2); font-size: var(--fontSizeBase200); line-height: 16px; color: var(--colorNeutralForeground2); }
.ts-note .i { width: 16px; height: 16px; color: var(--colorStatusWarningForeground1); }
.ts-note.info .i { color: var(--colorNeutralForeground3); }
/* "Vis som tabel": the chart's table alternative, server-rendered */
details.tbl { margin: 8px 0 0; border-top: 1px solid var(--fm-row-stroke); }
details.tbl summary { display: flex; align-items: center; gap: 8px; padding: 10px 20px; cursor: pointer; list-style: none; color: var(--colorBrandForegroundLink); font-weight: var(--fontWeightSemibold); }
details.tbl summary::-webkit-details-marker { display: none; }
details.tbl summary:hover { color: var(--colorBrandForegroundLinkHover); }
details.tbl summary .i:last-child { width: 16px; height: 16px; margin-left: -2px; transition: transform .1s; }
details.tbl[open] summary .i:last-child { transform: rotate(180deg); }
details.tbl .table-wrap { max-height: 320px; overflow: auto; }
details.tbl .dg td, details.tbl .dg th { height: 32px; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) { .cols-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767px) {
  .page-head { flex-direction: column; gap: 12px; }
  .page-head .t-title3 { font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); }
  .page-head .acts { width: 100%; }
  .page-head .acts > :not(fluent-menu) { flex: 1; }
  .cmdbar .lbl-sm, .cmdbar .end { display: none; }
  .cmd-more { display: inline-flex; }
  .kpi-value { font-size: var(--fontSizeBase600); line-height: var(--lineHeightBase600); }
  .card-head { padding-left: 16px; }
  .card-head .meta { display: none; }
  .card-body { padding: 0 16px 14px; }
  .card-foot { padding-left: 16px; padding-right: 16px; }
  .gridbar { padding: 8px 12px; }
  .gridbar .end { width: 100%; margin-left: 0; }
  .gridbar .searchbox { flex: 1; width: auto; }
  .chips { padding: 0 16px 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chip { flex: none; }
  .gridbar .views-wrap {
    width: calc(100% + 24px); margin: 0 -12px; padding: 0 12px; overflow-x: auto; scrollbar-width: none;
    scroll-snap-type: x proximity; scroll-padding-inline: 12px;
    mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 40px), transparent);
  }
  .gridbar .views-wrap .views { width: max-content; flex-wrap: nowrap; padding-right: 32px; }
  .gridbar .views-wrap .view { scroll-snap-align: start; flex: none; }
  .legend { width: 100%; }
  details.tbl summary { padding: 10px 16px; }

  /* Data grid → list rows (CSS only): <div class="table-wrap stackable">. Cells opt in with
     m-st (status icon, rows 1-2), m-name (line 1), m-a / m-b (line 2), m-val, m-seen, chev;
     hide-m hides a cell. Screens may define their own grid template in their file. */
  .table-wrap.stackable { overflow: visible; }
  .stackable table.dg, .stackable .dg tbody { display: block; }
  .stackable .dg thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stackable .dg tbody tr {
    display: grid; grid-template-columns: 20px auto auto minmax(0, 1fr) auto 16px; column-gap: 8px; row-gap: 2px; align-items: center;
    padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--fm-row-stroke); position: relative;
  }
  .stackable .dg tbody tr:last-child { border-bottom: 0; }
  .stackable .dg td { display: block; height: auto; padding: 0 !important; border: 0; min-width: 0; white-space: nowrap; }
  .stackable .dg td.hide-m { display: none; }
  .stackable .dg td.only-m { display: block; }
  .stackable .dg tr.alarm td:first-child, .stackable .dg tr.stale td:first-child { box-shadow: none; }
  .stackable .dg tr.alarm { box-shadow: inset 3px 0 0 var(--colorStatusDangerBorder2); }
  .stackable .dg tr.stale { box-shadow: inset 3px 0 0 var(--colorStatusWarningBorderActive); }
  .stackable .dg td.m-st { grid-column: 1; grid-row: 1 / span 2; align-self: start; padding-top: 2px !important; }
  .stackable .dg td.m-st .st-word { display: none; }
  .stackable .dg td.m-name { grid-column: 2 / 5; grid-row: 1; overflow: hidden; text-overflow: ellipsis; }
  .stackable .dg td.m-name .second, .stackable .namecell > .med { display: none; }
  .stackable .dg td.m-a { grid-column: 2; grid-row: 2; font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); }
  .stackable .dg td.m-a::after { content: "·"; margin-left: 8px; }
  .stackable .dg td.m-b { grid-column: 3; grid-row: 2; font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); }
  .stackable .dg td.m-val { grid-column: 5; grid-row: 1; text-align: right; font-weight: var(--fontWeightSemibold); }
  .stackable .dg td.m-seen { grid-column: 5; grid-row: 2; text-align: right; font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); }
  .stackable .dg td.m-seen .second { display: none; }
  .stackable .dg td.chev { display: block; grid-column: 6; grid-row: 1 / span 2; color: var(--colorNeutralForeground3); }
  .stackable .dg tr.group { display: block; padding: 6px 16px; background: var(--colorNeutralBackground2); }
  .stackable .dg tr.group td { background: transparent; }
  .stackable .dg a.rowlink:focus-visible { outline: none; box-shadow: none; }
  .stackable .dg tr:has(a.rowlink:focus-visible) { outline: 2px solid var(--colorStrokeFocus2); outline-offset: -2px; }
  .pivot { width: 100%; }
  .pivot a { flex: 1; justify-content: center; padding: 0 6px; }
  .seg.fill { width: 100%; }
  .seg.fill > * { flex: 1; text-align: center; }
}
