html, body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.loading-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #555;
    font-size: 1.1rem;
}

#blazor-error-ui {
    background: #ffdede;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ---- layout density ---- */
.vm-content {
    padding: 8px 10px;
}

.vm-toolbar {
    background: transparent;
    margin-bottom: 6px;
}

.vm-toolbar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 38px;
}

/* Headline out-of-date count */
.vm-summary {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 6px;
    line-height: 1;
}
.vm-summary-bad { background: rgba(244, 67, 54, 0.12); }
.vm-summary-ok  { background: rgba(76, 175, 80, 0.14); }
.vm-summary-num { font-size: 1.4rem; font-weight: 700; }
.vm-summary-bad .vm-summary-num { color: #d32f2f; }
.vm-summary-ok  .vm-summary-num { color: #2e7d32; }
.vm-summary-lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .03em; color: #666; }

.vm-affected { font-size: 0.78rem; color: #666; }

.vm-search { max-width: 360px; flex: 1 1 220px; }
.vm-type   { max-width: 150px; }

/* ---- dense table ---- */
.vm-grid .mud-table-cell {
    padding: 1px 10px !important;
    font-size: 0.78rem;
    height: 26px;
    line-height: 1.2;
}
.vm-grid .mud-table-head .mud-table-cell {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #555;
    height: 28px;
}

/* Type tag */
.vm-type-tag {
    font-size: 0.66rem;
    font-weight: 700;
    color: #5b6b7b;
    background: #eef1f4;
    border-radius: 3px;
    padding: 1px 5px;
}

/* Behind chips — escalate by severity */
.vm-behind {
    font-weight: 700;
    font-size: 0.74rem;
    border-radius: 3px;
    padding: 1px 6px;
    white-space: nowrap;
}
.vm-behind-lo  { color: #8a6d00; background: rgba(255, 193, 7, 0.18); }
.vm-behind-mid { color: #b35309; background: rgba(255, 152, 0, 0.22); }
.vm-behind-hi  { color: #fff;    background: #d32f2f; }
.vm-current    { color: #2e7d32; font-weight: 700; }

/* Row tints (kept subtle so the dense grid stays readable) */
.row-behind td   { background-color: rgba(255, 193, 7, 0.07); }
.row-mismatch td { background-color: rgba(244, 67, 54, 0.10); }

/* ---- matrix view ---- */
.vm-legend { font-size: 0.7rem; color: #666; display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
.vm-key { width: 12px; height: 12px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,.1); }

.vm-matrix-wrap {
    overflow: auto;
    max-height: calc(100vh - 150px);
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}
table.vm-matrix {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.66rem;
}
.vm-matrix th, .vm-matrix td {
    border-right: 1px solid #ececec;
    border-bottom: 1px solid #ececec;
}
/* section header row (top), clickable to collapse */
.vm-matrix th.section {
    position: sticky;
    top: 0;
    z-index: 4;
    height: 22px;
    background: #eef1f6;
    color: #33415c;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    padding: 0 6px;
    border-left: 2px solid #c8d2e0;
}
.vm-matrix th.section:hover { background: #e2e8f2; }
.vm-chev { margin-right: 4px; }
.vm-seccount { margin-left: 5px; font-weight: 600; color: #7a8aa0; }

/* component column headers (second row), vertical text on the inner div */
.vm-matrix th.comp {
    position: sticky;
    top: 22px;
    z-index: 3;
    background: #fafafa;
    height: 118px;
    width: 26px;
    min-width: 26px;
    max-width: 26px;
    padding: 0;
    vertical-align: bottom;
}
.vm-matrix th.comp > div {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 112px;
    margin: 4px auto;
    font-weight: 600;
    color: #555;
    line-height: 1;
}
.vm-matrix th.comp-collapsed { background: #eef1f6; cursor: pointer; }
.vm-matrix th.comp-collapsed > div { color: #33415c; font-weight: 700; }

/* tenant row headers (left), sticky */
.vm-matrix .rowhdr {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    text-align: left;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1px 8px;
    font-weight: 600;
    font-size: 0.72rem;
    height: 20px;
}
/* top-left corner sticky on both axes */
.vm-matrix .corner {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 6;
    background: #fff;
    font-weight: 700;
    color: #999;
    white-space: nowrap;
    padding: 2px 8px;
    font-size: 0.64rem;
}
.vm-matrix td.cell {
    width: 26px;
    min-width: 26px;
    max-width: 26px;
    height: 20px;
    text-align: center;
    padding: 0;
    font-weight: 700;
    cursor: default;
}
/* Cell fill = deployment RECENCY only (how recently this version was deployed), answering
   "what changed on this tenant lately?". Okabe–Ito colourblind-safe hues; the days-behind
   number always stays visible so meaning never rests on colour alone (WCAG 1.4.1). */
.cell-fresh        { background: #009E73; color: #fff; }              /* ≤7d  — bluish-green */
.cell-recent       { background: #7fcdb5; color: #08432f; }           /* ≤30d */
.cell-older        { background: #56B4E9; color: #06344a; }           /* ≤90d — sky blue */
.cell-aged         { background: #aebccb; color: #2f3944; }           /* >90d — muted slate-blue: old but present */
.cell-age-unknown  { background: #ece7de; color: #8a8172; }           /* deployed, date unknown — warm grey */
/* not deployed = absence: hatched near-white so it can't be mistaken for a faded fill (pattern, not colour) */
.cell-na {
    background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 4px, #e7e7e7 4px, #e7e7e7 8px);
    color: #bbb;
}

/* Danger = failed/partial deploy (running≠deployed) or significantly behind. Overriding
   treatment: vermilion + heavy inset border + ⚠ glyph, and the row sorts to the top. The
   border + glyph make it survive greyscale, so it never depends on the red hue alone. */
.cell-danger {
    background: #D55E00;
    color: #fff;
    font-weight: 800;
    box-shadow: inset 0 0 0 2px #7a2b00;
}

/* Row badges / chips (canary is a per-tenant property, so a chip — never a cell colour). */
.vm-chip {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    vertical-align: middle;
}
.vm-canary-chip { background: #E69F00; color: #3a2a00; margin-left: 5px; }   /* Okabe–Ito amber */
.vm-tenant-name { vertical-align: middle; }

/* "Last collected at" banner + stale state. */
.vm-collected { font-size: 0.7rem; color: #667; display: inline-flex; align-items: center; gap: 6px; }
.vm-collected-stale { color: #7a2b00; font-weight: 700; }
.vm-stale-badge {
    background: #D55E00; color: #fff; font-weight: 800; font-size: 0.62rem;
    padding: 2px 5px; border-radius: 3px; letter-spacing: .03em;
}
/* A scrape that has stopped refreshing must not read as an all-green grid: desaturate + fade the
   whole matrix so stale data is unmistakably distinct (spec, Operational Impact — failure mode). */
.vm-matrix-wrap.vm-stale table.vm-matrix { filter: grayscale(0.9) opacity(0.6); }

/* Full key panel — spells out what each colour/badge means. */
.vm-keypanel {
    margin-top: 6px;
    padding: 8px 10px;
    background: #fafbfc;
    border: 1px solid #e6e9ee;
    border-radius: 4px;
    font-size: 0.72rem;
    color: #33415c;
}
.vm-keygrid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 14px;
}
/* each key entry: symbol + CAPS label on one line; full meaning is in the title tooltip */
.vm-keyrow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    cursor: help;
    font-size: 0.68rem;
    letter-spacing: .02em;
}
.vm-keyrow > .vm-key,
.vm-keyrow > .vm-chip,
.vm-keyrow > .vm-stale-badge,
.vm-keyrow > .vm-keyglyph { flex: 0 0 auto; }
/* a mini "cell" showing how the in-cell number/tick looks */
.vm-keyglyph {
    display: inline-block;
    min-width: 16px;
    text-align: center;
    padding: 1px 3px;
    font-weight: 800;
    font-size: 0.66rem;
    background: #eef1f6;
    border-radius: 2px;
    color: #33415c;
}
