/* Operations dashboard: validated categorical chart palette and shared chart primitives.
   Slots validated on the white card surface (light only; the admin is light-scheme). */
:root {
    --viz-s1: #2a78d6;
    --viz-s2: #eb6834;
    --viz-s3: #1baf7a;
    --viz-s4: #eda100;
    --viz-s5: #e87ba4;
    --viz-s6: #008300;
    --viz-other: #b4b3ad;
    --viz-total: #3d4a5c;
    --viz-critical: #d03b3b;
    --viz-grid: #ececef;
    --viz-baseline: #c9c9ce;
    --viz-hover: rgba(0, 0, 0, 0.035);
    --viz-pending: #d9d9de;
    --viz-up: #b42318;
    --viz-down: #18713c;
}

.viz-s1 { --viz-color: var(--viz-s1); }
.viz-s2 { --viz-color: var(--viz-s2); }
.viz-s3 { --viz-color: var(--viz-s3); }
.viz-s4 { --viz-color: var(--viz-s4); }
.viz-s5 { --viz-color: var(--viz-s5); }
.viz-s6 { --viz-color: var(--viz-s6); }
.viz-other { --viz-color: var(--viz-other); }
.viz-total { --viz-color: var(--viz-total); }
.viz-critical { --viz-color: var(--viz-critical); }

.viz-swatch {
    display: inline-block;
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--viz-color);
}

.viz-key {
    display: inline-block;
    flex: none;
    width: 12px;
    height: 3px;
    border-radius: 2px;
    background: var(--viz-color);
}

.viz-delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--ops-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.viz-delta[data-direction="up"] { color: var(--viz-up); }
.viz-delta[data-direction="down"] { color: var(--viz-down); }

@media (forced-colors: active) {
    .viz-swatch, .viz-key { forced-color-adjust: none; border: 1px solid CanvasText; }
}

/* Dashboard sections and cards */
.dash-section { display: grid; gap: 16px; min-width: 0; }
.dash-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.dash-section-head h2 { margin: 0; color: var(--ops-text); font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.dash-section-head p { max-width: 920px; margin: 4px 0 0; color: var(--ops-muted); font-size: 13px; line-height: 1.5; }
.dash-section-head > a { flex: none; color: var(--ops-accent-text); font-size: 13px; font-weight: 600; }
.dash-section-head > a:focus-visible, .dash-card-head a:focus-visible, .dash-row-link:focus-visible { border-radius: 3px; outline: 2px solid var(--ops-accent-strong); outline-offset: 2px; }

.dash-grid { display: grid; gap: 16px; min-width: 0; }
.dash-grid-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-grid-narrow-first { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.dash-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.dash-grid > :only-child { grid-column: 1 / -1; }
.dash-grid-top { align-items: start; }

.dash-card { display: grid; align-content: start; gap: 14px; min-width: 0; padding: 18px 20px; border: 1px solid var(--ops-border); border-radius: 14px; background: var(--ops-card); }
.dash-card-flush { gap: 0; padding: 0; overflow: hidden; }
.dash-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; min-width: 0; }
.dash-card-flush > .dash-card-head { padding: 16px 18px 12px; }
.dash-card-subhead { border-top: 1px solid var(--ops-border); }
.dash-card-head h3 { margin: 0; color: var(--ops-text); font-size: 16px; font-weight: 500; }
.dash-card-head > span { color: var(--ops-muted); font-size: 12px; }
.dash-card-head > a { color: var(--ops-accent-text); font-size: 12px; font-weight: 600; }

.dash-rows { display: grid; border-top: 1px solid var(--ops-border); }
.dash-row-link { display: inline-block; margin: 8px 14px 0; color: var(--ops-accent-text); font-size: 12px; font-weight: 600; }
.dash-empty { margin: 0; padding: 16px 18px; color: var(--ops-muted); font-size: 13px; }
.dash-note { margin: 0; color: var(--ops-muted); font-size: 12px; }
.dash-state { margin: 0; padding: 14px 16px; border: 1px solid var(--ops-border); border-radius: 12px; color: var(--ops-muted); background: var(--ops-surface-raised); font-size: 13px; }
.dash-state.is-warning { border-color: #f1d08a; color: #7b4700; background: #fff8e6; }
.dash-state.is-error { border-color: #efb0ac; color: #9f211b; background: #fff4f3; }

.dash-toggle { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ops-border); border-radius: 9px; background: var(--ops-surface); }
.dash-toggle button { min-height: 28px; padding: 0 12px; border: 0; border-radius: 7px; color: var(--ops-muted); background: transparent; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.dash-toggle button[aria-pressed="true"] { color: var(--ops-text); background: var(--ops-card); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.dash-toggle button:focus-visible { outline: 2px solid var(--ops-accent-strong); outline-offset: 1px; }

@media (max-width: 1280px) {
    .dash-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
    .dash-grid-wide, .dash-grid-narrow-first, .dash-grid-three { grid-template-columns: minmax(0, 1fr); }
    .dash-section-head { align-items: flex-start; flex-direction: column; gap: 8px; }
}

/* KPI strips shared by the dashboard and every Observability tab */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); overflow: hidden; border: 1px solid var(--ops-border); border-radius: 14px; background: var(--ops-card); }
.kpi-strip article { display: grid; align-content: start; gap: 5px; min-width: 0; min-height: 148px; padding: 18px 20px; border-right: 1px solid var(--ops-border); }
.kpi-strip article:last-child { border-right: 0; }
.kpi-strip .kpi-label { color: var(--ops-muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.kpi-strip strong { color: var(--ops-text); font-size: clamp(24px, 2.2vw, 32px); font-weight: 650; line-height: 1.1; letter-spacing: -.01em; }
.kpi-strip .kpi-hero strong { font-size: clamp(30px, 3vw, 44px); }
.kpi-strip .is-attention strong { color: #a15c00; }
.kpi-strip small { color: var(--ops-muted); font-size: 12px; line-height: 1.4; }
.kpi-strip .kpi-basis { font-size: 11px; }
.kpi-strip .metric-detail-link { align-self: end; justify-self: start; width: fit-content; max-width: 100%; margin-top: 4px; color: var(--ops-accent-text); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.kpi-strip .metric-detail-link:focus-visible { border-radius: 3px; outline: 2px solid var(--ops-accent-strong); outline-offset: 2px; }

@media (min-width: 1280px) {
    .kpi-strip { grid-template-columns: none; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; }
    .kpi-strip.has-hero { grid-template-columns: minmax(0, 1.35fr); }
}

@media (max-width: 700px) {
    .kpi-strip article { min-height: 0; border-right: 0; border-bottom: 1px solid var(--ops-border); }
    .kpi-strip article:last-child { border-bottom: 0; }
}

/* Observability runtime and invocation tables */
.runtime-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.obs-button, .runtime-refresh { min-height: 32px; padding: 0 14px; border: 1px solid var(--ops-control-border); border-radius: 9px; color: var(--ops-text); background: var(--ops-card); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.obs-button:hover, .runtime-refresh:hover { background: var(--ops-surface); }
.obs-button:focus-visible, .runtime-refresh:focus-visible { outline: 2px solid var(--ops-accent-strong); outline-offset: 2px; }
.obs-button:disabled, .runtime-refresh:disabled { cursor: progress; opacity: .6; }
.runtime-freshness { margin: -6px 0 0; color: var(--ops-muted); font-size: 12px; }
.runtime-chart-grid, .runtime-run-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.runtime-table-scroll { max-height: 520px; overflow: auto; border-top: 1px solid var(--ops-border); }
.runtime-table-scroll:focus-visible { outline: 2px solid var(--ops-accent-strong); outline-offset: -2px; }
.runtime-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.runtime-table thead th { position: sticky; top: 0; z-index: 1; padding: 9px 12px; color: var(--ops-muted); background: var(--ops-surface-raised); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.runtime-table td, .runtime-table tbody th { padding: 10px 12px; border-top: 1px solid var(--ops-border); text-align: left; vertical-align: top; white-space: nowrap; }
.runtime-table tbody th { min-width: 200px; font-weight: 400; }
.runtime-table tbody th a { display: block; color: var(--ops-text); font-weight: 600; }
.runtime-table tbody th code { display: block; margin-top: 2px; color: var(--ops-muted); font-size: 11px; }
.runtime-table .is-number { text-align: right; font-variant-numeric: tabular-nums; }
.runtime-table small { display: block; margin-top: 2px; color: var(--ops-muted); font-size: 11px; }
.runtime-table tbody tr:hover { background: var(--ops-surface-raised); }
.runtime-success { display: inline-grid; grid-template-columns: 64px auto; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.runtime-success-track { height: 6px; overflow: hidden; border-radius: 3px; background: #f6d4d4; }
.runtime-success-track span { display: block; height: 100%; border-radius: 3px; background: var(--viz-s1); }
.runtime-table small.runtime-failed, .runtime-runs .runtime-failed { color: var(--ops-danger); }
.runtime-status { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; color: #3c3c43; background: #ececf0; font-size: 11px; font-weight: 600; white-space: nowrap; }
.runtime-status[data-status="Succeeded"] { color: #0f5132; background: #def5e8; }
.runtime-status[data-status="Failed"] { color: #9f211b; background: #ffe4e1; }
.runtime-status[data-status="Running"], .runtime-status[data-status="Awaiting approval"] { color: #7b4700; background: #fff0c7; }
.runtime-runs { margin: 0; padding: 0; list-style: none; }
.runtime-runs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--ops-border); }
.runtime-run-main { display: grid; gap: 2px; min-width: 0; }
.runtime-run-main a { overflow: hidden; color: var(--ops-text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.runtime-run-main a:focus-visible { border-radius: 3px; outline: 2px solid var(--ops-accent-strong); outline-offset: 2px; }
.runtime-run-main small { overflow: hidden; color: var(--ops-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.runtime-run-side { display: grid; justify-items: end; gap: 4px; font-variant-numeric: tabular-nums; }
.runtime-run-side strong { color: var(--ops-text); font-size: 13px; font-weight: 600; }

@media (max-width: 1050px) {
    .runtime-chart-grid, .runtime-run-grid { grid-template-columns: minmax(0, 1fr); }
}

.obs-button.is-primary { border-color: var(--ops-accent-strong); color: #fff; background: var(--ops-accent-strong); }
.obs-button.is-primary:hover { background: var(--ops-accent-hover); }
.invocation-table-scroll { max-height: none; border: 1px solid var(--ops-border); border-radius: 14px; background: var(--ops-card); }
.invocation-run { cursor: pointer; }
.invocation-open { padding: 0; border: 0; color: var(--ops-accent-text); background: none; font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }
.invocation-open:focus-visible { border-radius: 3px; outline: 2px solid var(--ops-accent-strong); outline-offset: 2px; }
.invocation-table .invocation-run-id { max-width: 150px; overflow: hidden; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; }
.invocation-table .invocation-agent { display: block; color: var(--ops-text); font-weight: 600; }
.invocation-detail { display: grid; gap: 16px; }
.invocation-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.invocation-detail-head h3 { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ops-text); font-size: 18px; font-weight: 600; }
.invocation-detail-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.invocation-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 13px; }
.invocation-facts dt { color: var(--ops-muted); }
.invocation-facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ops-text); }
.invocation-facts code, .invocation-event code { font-size: 12px; overflow-wrap: anywhere; }
.invocation-event { border-top: 1px solid var(--ops-border); }
.invocation-event summary { display: grid; grid-template-columns: 72px minmax(0, 2fr) minmax(0, 1fr) auto 80px; align-items: center; gap: 12px; padding: 10px 18px; font-size: 13px; cursor: pointer; list-style: none; }
.invocation-event summary::-webkit-details-marker { display: none; }
.invocation-event summary:hover, .invocation-event[open] summary { background: var(--ops-surface-raised); }
.invocation-event summary:focus-visible { outline: 2px solid var(--ops-accent-strong); outline-offset: -2px; }
.invocation-event summary strong { overflow: hidden; color: var(--ops-text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.invocation-event summary > span:first-child, .invocation-event summary > span:nth-child(3) { color: var(--ops-muted); }
.invocation-event summary .is-number { text-align: right; font-variant-numeric: tabular-nums; }
.invocation-missing { color: var(--ops-muted); }
.invocation-event-facts { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 4px 18px 12px; font-size: 12px; }
.invocation-event-facts > div { display: flex; gap: 6px; min-width: 0; }
.invocation-event-facts dt { color: var(--ops-muted); }
.invocation-event-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--ops-text); }
.invocation-event > [role="note"] { margin: 0; padding: 0 18px 12px; color: var(--ops-muted); font-size: 12px; overflow-wrap: anywhere; }
.invocation-detail [role="note"] pre, .invocation-event pre { padding: 10px; border: 1px solid var(--ops-border); border-radius: 8px; background: var(--ops-surface-raised); color: #334155; font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.invocation-detail .invocation-more { margin: 12px 18px; }

@media (max-width: 1050px) {
    .invocation-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

.dash-grid-halves { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.azure-price-scroll { max-height: 420px; }
.azure-price-model th { color: var(--ops-text); background: var(--ops-surface); font-weight: 600; }
.azure-price-model code { margin-left: 6px; color: var(--ops-muted); font-size: 11px; font-weight: 400; }
.dash-disclosure { border: 1px solid var(--ops-border); border-radius: 14px; background: var(--ops-card); }
.dash-disclosure > summary { padding: 14px 18px; color: var(--ops-text); font-size: 14px; font-weight: 600; cursor: pointer; }
.dash-disclosure > summary:focus-visible { border-radius: 14px; outline: 2px solid var(--ops-accent-strong); outline-offset: -2px; }
.dash-disclosure[open] > summary { border-bottom: 1px solid var(--ops-border); }
.dash-disclosure > :not(summary) { margin: 16px 18px; }

@media (max-width: 1050px) {
    .dash-grid-halves { grid-template-columns: minmax(0, 1fr); }
}
.invocation-usage-missing { margin: 0; color: var(--ops-muted); font-size: 13px; }
.dash-section-head p.runtime-freshness { margin-top: 6px; }
.dash-section-head p a { color: var(--ops-accent-text); font-weight: 600; }
