/* Shared, scoped dashboard chart surfaces. No transforms on labels or neighbours. */
#dashboard-grid .dx-card { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto auto; gap: 12px; height: 356px; min-height: 356px; padding: 20px 22px 12px; overflow: visible; color: var(--ink); }
.dx-header, .dx-readout, .dx-controls, .dx-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.dx-header h3 { min-width: 0; }
.dx-segments { display: inline-flex; align-items: center; flex-shrink: 0; padding: 3px; border-radius: 9px; background: var(--surface-muted); gap: 2px; }
.dx-segments button { min-height: 25px; min-width: 29px; border: 0; border-radius: 7px; padding: 3px 8px; background: transparent; color: var(--ink-muted); font: 500 10px/1.3 var(--font-sans,sans-serif); cursor: pointer; box-shadow: none; transform: none !important; transition: color .18s, background .18s, box-shadow .18s; }
.dx-segments button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px rgb(0 0 0 / 7%); }
.dx-readout { justify-content: flex-start; min-height: 38px; }
.dx-readout > div { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.dx-readout strong { font-size: 27px; font-weight: 600; letter-spacing: -.045em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dx-readout [data-dx-unit] { font-size: 11px; color: var(--ink-muted); }
.dx-readout > small { color: var(--ink-muted); font-size: 10px; line-height: 1.4; margin-left: auto; text-align: right; }
.dx-readout > button { background: transparent; border: 0; padding: 3px; font: 500 10px/1.3 var(--font-sans,sans-serif); color: var(--ink-muted); cursor: pointer; }
.dx-readout > button[hidden] { display: none; }
.dx-chart { position: relative; display: grid; grid-template-columns: 31px minmax(0,1fr); grid-template-rows: minmax(0,1fr) 19px; column-gap: 9px; min-height: 122px; }
.dx-axis { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; text-align: right; padding: 1px 0 5px; color: var(--ink-muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.dx-plot { grid-column: 2; grid-row: 1; position: relative; min-width: 0; }
.dx-plot > svg, .dx-mini-plot > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dx-grid { stroke: var(--line); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; opacity: .65; }
.dx-line { stroke: var(--dx-color); stroke-width: 2; fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.dx-area { fill: var(--dx-color); opacity: .055; }
.dx-point, .dx-zero { fill: var(--dx-color); stroke: var(--surface); stroke-width: 1.2; vector-effect: non-scaling-stroke; transition: opacity .16s; }
.dx-bar { fill: var(--dx-color); opacity: .8; transition: opacity .16s; }
.dx-point.is-dimmed, .dx-zero.is-dimmed, .dx-bar.is-dimmed { opacity: .24; }
.dx-point.is-highlighted, .dx-zero.is-highlighted, .dx-bar.is-highlighted { opacity: 1; }
.dx-hotspots { position: absolute; inset: 0; display: grid; }
.dx-hotspots button { display: block; width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; transform: none !important; box-shadow: none !important; }
.dx-hotspots button.is-highlighted { background: color-mix(in srgb,var(--dx-color) 4%,transparent); }
.dx-hotspots button:focus-visible { outline: 2px solid var(--dx-color); outline-offset: -2px; }
.dx-months { grid-column: 2; grid-row: 2; display: grid; align-items: end; color: var(--ink-muted); font-size: 10px; line-height: 1.3; text-align: center; }
.dx-guide { position: absolute; top: 4px; bottom: 4px; left: var(--dx-x,50%); width: 1px; background: var(--dx-color); opacity: 0; pointer-events: none; }
.dx-active-point { position: absolute; left: var(--dx-x,50%); top: var(--dx-y,50%); width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--surface); background: var(--dx-color); box-shadow: 0 0 0 3px color-mix(in srgb,var(--dx-color) 15%,transparent); transform: translate(-50%,-50%); opacity: 0; pointer-events: none; }
.dx-tooltip { position: absolute; z-index: 3; left: clamp(66px,var(--dx-x,50%),calc(100% - 66px)); top: clamp(2px,calc(var(--dx-y,50%) - 45px),calc(100% - 38px)); transform: translateX(-50%); min-width: 118px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 6px 18px rgb(0 0 0 / 8%); text-align: center; pointer-events: none; opacity: 0; transition: opacity .14s; }
.dx-tooltip small, .dx-tooltip strong { display: block; line-height: 1.35; white-space: nowrap; }
.dx-tooltip small { font-size: 9px; color: var(--ink-muted); font-weight: 400; }
.dx-tooltip strong { font-size: 11px; color: var(--ink); font-weight: 600; }
.dx-chart.has-preview .dx-guide { opacity: .3; }
.dx-chart.has-preview .dx-active-point, .dx-chart.has-preview .dx-tooltip { opacity: 1; }
.dx-controls { min-height: 31px; }
.dx-controls > small { color: var(--ink-muted); font-size: 9px; line-height: 1.3; text-align: right; }
.dx-footer { min-height: 34px; border-top: 1px solid var(--line); padding-top: 6px; }
.dx-footer > a { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 1; min-height: 28px; font-size: 12px; font-weight: 500; text-decoration: none; color: var(--ink); }
.dx-footer svg, .dx-kpi-open > svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dx-footer > button { display: grid; place-items: center; width: 28px; height: 28px; padding: 5px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-muted); cursor: pointer; }
.dx-footer > a:hover, .dx-footer > button:hover { color: var(--dx-color); }
.dx-empty { grid-column: 1/-1; color: var(--ink-muted); font-size: 12px; place-self: center; }
#dashboard-kpi-grid .dx-kpis { align-items: stretch; }
.dx-kpi { position: relative; display: grid; grid-template-rows: 1fr 42px 14px; gap: 8px; padding: 18px; min-width: 0; min-height: 170px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 28px rgb(18 28 45 / 3%); color: var(--ink); }
.dx-kpi-open { display: flex; align-items: center; gap: 12px; padding: 0; width: 100%; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; transform: none !important; box-shadow: none !important; }
.dx-kpi-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb,var(--dx-color) 9%,transparent); color: var(--dx-color); }
.dx-kpi-icon > svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dx-kpi-copy { display: grid; min-width: 0; gap: 6px; }
.dx-kpi-copy small { font-size: 10px; font-weight: 500; line-height: 1.3; color: var(--ink-muted); }
.dx-kpi-copy strong { font-size: 28px; font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.dx-kpi-open > svg { margin-left: auto; width: 13px; height: 13px; color: var(--ink-muted); opacity: .4; }
.dx-kpi-open:hover > svg { color: var(--dx-color); opacity: 1; }
.dx-kpi-open:disabled { cursor: default; }
.dx-kpi-open:disabled > svg { visibility: hidden; }
.dx-mini-plot { position: relative; min-width: 0; height: 42px; }
.dx-mini-caption { min-height: 14px; margin: 0; color: var(--ink-muted); font-size: 9px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dx-card button:focus-visible, .dx-card a:focus-visible, .dx-kpi-open:focus-visible { outline: 2px solid var(--dx-color,#3287ef); outline-offset: 3px; }
html[data-theme="dark"] .dx-kpi { background: #080808; box-shadow: none; }
html[data-theme="dark"] .dx-kpi-icon { background: color-mix(in srgb,var(--dx-color) 15%,transparent); }
html[data-theme="dark"] .dx-segments button[aria-pressed="true"] { background: #282a2e; }
html[data-theme="dark"] .dx-tooltip { background: #202227; box-shadow: 0 8px 24px rgb(0 0 0 / 25%); }
@media (max-width: 1100px) and (min-width: 701px) { .dx-kpi { padding: 14px; } .dx-kpi-open { gap: 8px; } .dx-kpi-icon { flex-basis: 30px; height: 30px; } }
@media (max-width: 500px) { #dashboard-grid .dx-card { padding: 16px 16px 10px; height: 356px; } .dx-header { gap: 5px; } .dx-segments button { padding: 3px 6px; min-width: 26px; } .dx-chart { grid-template-columns: 27px minmax(0,1fr); gap: 6px; } .dx-readout strong { font-size: 25px; } .dx-controls > small { max-width: 110px; } .dx-months { font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { .dx-card *, .dx-kpi * { animation: none !important; transition: none !important; } }

.dx-header-tools { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.dx-header-tools > button { display: grid; place-items: center; width: 28px; height: 28px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink-muted); cursor: pointer; transform: none !important; }
.dx-header-tools > button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dx-header-tools > button:hover { color: var(--dx-color); }
@media (max-width: 500px) { .dx-header-tools { gap: 4px; } }

/* KPI refinement: a quiet surface lifts; content and adjacent cards stay fixed. */
#dashboard-kpi-grid .dx-kpi { display: block; height: 156px; min-height: 156px; padding: 20px; border: 0; border-radius: 22px; background: transparent; box-shadow: none; isolation: isolate; }
.dx-kpi::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border: 1px solid var(--line); border-radius: inherit; background: linear-gradient(145deg, rgb(255 255 255 / 97%), var(--surface) 65%); box-shadow: 0 6px 22px rgb(18 28 45 / 3%), inset 0 1px 0 rgb(255 255 255 / 80%); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.dx-kpi:hover::before, .dx-kpi:focus-within::before { transform: translateY(-2px); border-color: color-mix(in srgb,var(--dx-color) 18%,var(--line)); box-shadow: 0 12px 30px rgb(18 28 45 / 7%), inset 0 1px 0 rgb(255 255 255 / 90%); }
.dx-kpi:has(.dx-kpi-open:active)::before { transform: translateY(0); box-shadow: 0 3px 12px rgb(18 28 45 / 4%), inset 0 1px 3px rgb(18 28 45 / 4%); }
.dx-kpi .dx-kpi-open { position: relative; display: block; min-height: 90px; border-radius: 9px; }
.dx-kpi .dx-kpi-copy { display: grid; gap: 13px; padding-right: 38px; }
.dx-kpi .dx-kpi-copy small { min-height: 17px; font-size: 13px; font-weight: 500; line-height: 17px; letter-spacing: -.015em; color: var(--ink-muted); text-transform: none; }
.dx-kpi .dx-kpi-copy strong { display: block; width: fit-content; max-width: 52%; font-size: clamp(32px,2.6vw,40px); font-weight: 600; line-height: 1; letter-spacing: -.055em; }
.dx-kpi--compact-value .dx-kpi-copy strong { font-size: 30px; letter-spacing: -.045em; }
.dx-kpi .dx-kpi-icon { position: absolute; top: 0; right: 0; width: 30px; height: 30px; border-radius: 10px; background: color-mix(in srgb,var(--dx-color) 8%,transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--dx-color) 5%,transparent); }
.dx-kpi .dx-kpi-icon > svg { width: 17px; height: 17px; stroke-width: 1.5; }
.dx-kpi .dx-mini-plot { position: absolute; z-index: 2; right: 20px; top: 61px; width: 42%; max-width: 128px; height: 43px; }
.dx-kpi .dx-mini-plot .dx-line { stroke-width: 1.7; }
.dx-kpi .dx-mini-plot .dx-area { opacity: .045; }
.dx-kpi .dx-point { opacity: 0; }
.dx-kpi .dx-point:last-child { opacity: .65; }
.dx-kpi .dx-point.is-highlighted { opacity: 1; }
.dx-kpi .dx-point.is-dimmed { opacity: .12; }
.dx-kpi .dx-mini-caption { position: absolute; left: 20px; right: 45px; bottom: 16px; font-size: 10px; line-height: 14px; min-height: 14px; }
.dx-kpi-navhint { position: absolute; right: 20px; bottom: 16px; display: grid; place-items: center; width: 14px; height: 14px; color: var(--ink-muted); opacity: .45; pointer-events: none; }
.dx-kpi-navhint[hidden] { display: none; }
.dx-kpi-navhint svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dx-kpi:hover .dx-kpi-navhint { color: var(--dx-color); opacity: .85; }
html[data-theme="dark"] #dashboard-kpi-grid .dx-kpi { background: transparent; }
html[data-theme="dark"] .dx-kpi::before { border-color: rgb(255 255 255 / 8%); background: linear-gradient(145deg,#141518,#090a0c 75%); box-shadow: inset 0 1px 0 rgb(255 255 255 / 4%); }
html[data-theme="dark"] .dx-kpi:hover::before, html[data-theme="dark"] .dx-kpi:focus-within::before { border-color: color-mix(in srgb,var(--dx-color) 22%,#24262a); box-shadow: 0 10px 28px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 5%); }
@media (max-width: 1100px) and (min-width: 701px) { #dashboard-kpi-grid .dx-kpi { padding: 17px; } .dx-kpi .dx-kpi-copy small { font-size: 12px; } .dx-kpi .dx-mini-plot { right: 17px; width: 40%; } .dx-kpi .dx-mini-caption { left: 17px; } .dx-kpi-navhint { right: 17px; } }
@media (prefers-reduced-motion: reduce) { .dx-kpi::before { transition: none !important; transform: none !important; } }

/* Override the legacy KPI engine's card lift; only the background may move. */
#dashboard-kpi-grid .dx-kpi, #dashboard-kpi-grid .dx-kpi:hover, #dashboard-kpi-grid .dx-kpi:focus-within, #dashboard-kpi-grid .dx-kpi:active { transform: none !important; translate: none !important; rotate: none !important; scale: none !important; }

/* Explicit status shortcut, including empty status lists. */
.dx-kpi .dx-kpi-icon { top: 20px; right: 20px; padding: 0; border: 0; cursor: pointer; transform: none !important; }
.dx-kpi .dx-kpi-icon:hover { background: color-mix(in srgb,var(--dx-color) 15%,transparent); }
.dx-kpi .dx-kpi-icon:focus-visible { outline: 2px solid var(--dx-color); outline-offset: 3px; }
@media (max-width: 1100px) and (min-width: 701px) { .dx-kpi .dx-kpi-icon { top: 17px; right: 17px; } }
