/* ============================================================
   Monitor Report — executive analytics screen
   ============================================================
   Data colours come from a validated palette (categorical slots, a single-hue
   ordinal ramp for ordered bands, a sequential ramp for the heatmap). Chart chrome
   is deliberately recessive so the marks carry all the weight. The brand purple
   stays on the page furniture — headers, buttons, the active tab — and never on a
   data mark, so identity and branding never compete.
   ============================================================ */

.fxmr {
    --mr-surface: #ffffff;
    --mr-plane: #f6f6f4;
    --mr-ink: #0b0b0b;
    --mr-ink-2: #52514e;
    --mr-muted: #898781;
    --mr-grid: #e1e0d9;
    --mr-axis: #c3c2b7;
    --mr-ring: rgba(11, 11, 11, .10);

    /* Categorical slots — fixed order, never cycled. */
    --mr-c1: #2a78d6;
    --mr-c2: #eb6834;
    --mr-c3: #1baf7a;
    --mr-c4: #eda100;
    --mr-c5: #e87ba4;

    /* Status — reserved, never reused as a series colour. */
    --mr-good: #0ca30c;
    --mr-good-text: #006300;
    --mr-warning: #fab219;
    --mr-serious: #ec835a;
    --mr-critical: #d03b3b;

    --mr-brand: #4B3E7B;

    /* The page sits inside MudContainer, which already supplies the horizontal gutter, and on
       top of the app's own decorative background. Painting a plane here would put a grey slab
       over that background with a double gutter around it — so the wrapper stays transparent
       and the cards below carry every surface, the same way the other pages work. */
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    padding: 4px 0 40px;
    background: transparent;
}

/* ── Header ─────────────────────────────────────────────── */

.fxmr-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.fxmr-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--mr-ink);
    letter-spacing: -.2px;
}

.fxmr-sub {
    font-size: 13px;
    color: var(--mr-ink-2);
    margin-top: 3px;
}

/* ── Filter bar ─────────────────────────────────────────── */

.fxmr-filters {
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-radius: 14px;
    padding: 14px 18px 16px;
    margin-bottom: 18px;
}

.fxmr-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
}

.fxmr-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 190px;
}

.fxmr-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--mr-muted);
}

/* Presets sit in one row above the report, per the filter composition rule. */
.fxmr-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid var(--mr-grid);
}

.fxmr-preset {
    border: 1px solid var(--mr-ring);
    background: var(--mr-surface);
    color: var(--mr-ink-2);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.fxmr-preset:hover {
    background: rgba(75, 62, 123, .07);
    border-color: rgba(75, 62, 123, .3);
    color: var(--mr-brand);
}

/* ── Section scaffolding ────────────────────────────────── */

/* Section headings carry the brand purple rather than the muted grey they started in:
   at 12px uppercase, #898781 sat at roughly 3:1 on white, which is fine for a hairline
   but thin for text a reader is meant to navigate by. #4B3E7B clears 8.6:1 and is page
   furniture, so it still never competes with a data mark. */
.fxmr-section-title {
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .7px;
    text-transform: uppercase;
    color: var(--mr-brand);
    margin: 26px 2px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* A hairline rule carries the eye across to the right margin, so the heading reads as a
   band rather than as a stray label. */
.fxmr-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--mr-grid);
}

.fxmr-card {
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-radius: 14px;
    padding: 16px 18px 14px;
}

.fxmr-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--mr-ink);
}

.fxmr-card-note {
    font-size: 11.5px;
    color: var(--mr-muted);
    margin-top: 2px;
    margin-bottom: 10px;
}

/* ── KPI stat tiles ─────────────────────────────────────── */
/* Headline numbers are tiles, not a chart — a bar chart of eleven unrelated
   measures says nothing that eleven numbers don't say better. */

.fxmr-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 12px;
}

.fxmr-kpi {
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-radius: 14px;
    padding: 14px 16px 13px;
}

.fxmr-kpi-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .35px;
    text-transform: uppercase;
    color: var(--mr-muted);
    display: block;
    margin-bottom: 7px;
}

.fxmr-kpi-value {
    font-size: 27px;
    font-weight: 800;
    color: var(--mr-ink);
    line-height: 1.1;
    letter-spacing: -.6px;
}

.fxmr-kpi-unit {
    font-size: 14px;
    font-weight: 600;
    color: var(--mr-muted);
    margin-left: 2px;
}

.fxmr-kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 8px;
}

/* Direction is carried by the glyph as well as the colour, so the tile never
   depends on hue alone. */
.fxmr-kpi-delta.up { color: var(--mr-good-text); }
.fxmr-kpi-delta.down { color: var(--mr-critical); }
.fxmr-kpi-delta.flat { color: var(--mr-muted); }

.fxmr-kpi-prev {
    font-size: 11px;
    color: var(--mr-muted);
    margin-left: 4px;
    font-weight: 500;
}

/* ── Insights ───────────────────────────────────────────── */

.fxmr-insights {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 12px;
}

.fxmr-insight {
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-left-width: 4px;
    border-radius: 12px;
    padding: 13px 16px;
}

.fxmr-insight.sev-positive { border-left-color: var(--mr-good); }
.fxmr-insight.sev-info { border-left-color: var(--mr-c1); }
.fxmr-insight.sev-warning { border-left-color: var(--mr-warning); }
.fxmr-insight.sev-critical { border-left-color: var(--mr-critical); }

.fxmr-insight-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--mr-ink);
}

/* Status colours ship with an icon and a label, never on their own. */
.fxmr-insight-icon { font-size: 17px; }
.fxmr-insight.sev-positive .fxmr-insight-icon { color: var(--mr-good); }
.fxmr-insight.sev-info .fxmr-insight-icon { color: var(--mr-c1); }
.fxmr-insight.sev-warning .fxmr-insight-icon { color: #b47c00; }
.fxmr-insight.sev-critical .fxmr-insight-icon { color: var(--mr-critical); }

.fxmr-insight-body {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--mr-ink-2);
    margin-top: 5px;
}

/* ── Chart grid ─────────────────────────────────────────── */

.fxmr-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 14px;
}

.fxmr-col-12 { grid-column: span 12; }
.fxmr-col-8 { grid-column: span 8; }
.fxmr-col-6 { grid-column: span 6; }
.fxmr-col-4 { grid-column: span 4; }

@media (max-width: 1200px) {
    .fxmr-col-8, .fxmr-col-6, .fxmr-col-4 { grid-column: span 12; }
}

.fxmr-canvas-wrap {
    position: relative;
    width: 100%;
}

.fxmr-h-260 { height: 260px; }
.fxmr-h-300 { height: 300px; }
.fxmr-h-340 { height: 340px; }

/* ── Legend / value relief ──────────────────────────────── */
/* Three of the categorical slots sit below 3:1 on a white surface, so every
   breakdown prints its own numbers rather than leaning on the swatch. */

.fxmr-values {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--mr-grid);
}

.fxmr-value {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--mr-ink-2);
}

.fxmr-swatch {
    width: 9px;
    height: 9px;
    border-radius: 3px;
    flex: none;
}

.fxmr-value b {
    color: var(--mr-ink);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ── Tables ─────────────────────────────────────────────── */

.fxmr-table-scroll {
    overflow-x: auto;
    margin: 0 -4px;
}

.fxmr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 900px;
}

.fxmr-table th {
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .45px;
    text-transform: uppercase;
    color: var(--mr-muted);
    padding: 9px 10px;
    border-bottom: 1px solid var(--mr-axis);
    white-space: nowrap;
}

.fxmr-table td {
    padding: 10px;
    border-bottom: 1px solid var(--mr-grid);
    color: var(--mr-ink-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fxmr-table td.name {
    color: var(--mr-ink);
    font-weight: 600;
    font-variant-numeric: normal;
}

.fxmr-table tbody tr:hover td { background: rgba(75, 62, 123, .04); }
.fxmr-table td.num { text-align: right; }
.fxmr-table th.num { text-align: right; }

/* A compliance figure earns a colour only because it is a status, not a series. */
.fxmr-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

.fxmr-pill.ok { background: rgba(12, 163, 12, .12); color: #056605; }
.fxmr-pill.warn { background: rgba(250, 178, 25, .18); color: #8a6000; }
.fxmr-pill.bad { background: rgba(208, 59, 59, .12); color: #a52a2a; }
.fxmr-pill.none { background: rgba(137, 135, 129, .14); color: var(--mr-ink-2); }

/* ── Department flow (Sankey) ───────────────────────────── */

.fxmr-flow-tabs {
    display: inline-flex;
    background: var(--mr-plane);
    border: 1px solid var(--mr-ring);
    border-radius: 999px;
    padding: 3px;
    gap: 3px;
}

.fxmr-flow-tab {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 6px 15px;
    font-size: 12px;
    font-weight: 700;
    color: var(--mr-ink-2);
    cursor: pointer;
}

.fxmr-flow-tab.active {
    background: var(--mr-brand);
    color: #fff;
}

.fxmr-sankey {
    width: 100%;
    overflow-x: auto;
}

/* Ribbons share one hue: the diagram's job is magnitude, not identity — the
   matrix below names every edge exactly. */
.fxmr-ribbon {
    fill: var(--mr-c1);
    fill-opacity: .22;
    transition: fill-opacity .15s;
}

.fxmr-ribbon:hover { fill-opacity: .62; }

.fxmr-node { fill: var(--mr-c1); }

.fxmr-node-label {
    font-size: 11.5px;
    fill: var(--mr-ink);
    font-weight: 600;
}

.fxmr-node-sub {
    font-size: 10.5px;
    fill: var(--mr-muted);
}

.fxmr-axis-label {
    font-size: 10.5px;
    fill: var(--mr-muted);
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* ── Re-assignment journey depth ────────────────────────── */
/* The headline above the flow diagram: how far tickets actually travel. Ordered
   bands, so they take a single-hue ordinal ramp rather than categorical slots. */

.fxmr-depth {
    margin-top: 16px;
    padding: 14px 16px 12px;
    background: var(--mr-plane);
    border: 1px solid var(--mr-ring);
    border-radius: 12px;
}

.fxmr-depth-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.fxmr-depth-total {
    font-size: 24px;
    font-weight: 800;
    color: var(--mr-ink);
    line-height: 1;
    letter-spacing: -.5px;
}

.fxmr-depth-total-label {
    font-size: 12.5px;
    color: var(--mr-ink-2);
}

.fxmr-depth-total-label b {
    color: var(--mr-ink);
    font-weight: 700;
}

.fxmr-depth-bars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.fxmr-depth-band {
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-radius: 10px;
    padding: 10px 12px 11px;
}

.fxmr-depth-band-top {
    display: flex;
    align-items: center;
    gap: 7px;
}

.fxmr-depth-band-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--mr-muted);
}

.fxmr-depth-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--mr-ink);
    line-height: 1.2;
    margin-top: 5px;
    font-variant-numeric: tabular-nums;
}

.fxmr-depth-track {
    height: 6px;
    border-radius: 999px;
    background: var(--mr-grid);
    overflow: hidden;
    margin-top: 7px;
}

.fxmr-depth-fill {
    height: 100%;
    border-radius: 999px;
    min-width: 2px;
}

.fxmr-depth-pct {
    font-size: 10.5px;
    color: var(--mr-muted);
    margin-top: 6px;
}

/* ── Heatmap ────────────────────────────────────────────── */

.fxmr-heat {
    display: grid;
    grid-template-columns: 42px repeat(24, minmax(15px, 1fr));
    gap: 2px;
    min-width: 640px;
}

.fxmr-heat-cell {
    aspect-ratio: 1 / 1;
    border-radius: 3px;
    min-height: 15px;
}

.fxmr-heat-daylabel,
.fxmr-heat-hourlabel {
    font-size: 10px;
    color: var(--mr-muted);
    display: flex;
    align-items: center;
    font-weight: 600;
}

.fxmr-heat-hourlabel { justify-content: center; }

.fxmr-heat-scale {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--mr-muted);
}

.fxmr-heat-ramp {
    display: flex;
    gap: 2px;
}

.fxmr-heat-ramp span {
    width: 22px;
    height: 9px;
    border-radius: 2px;
}

/* ── Empty / loading / notes ────────────────────────────── */

.fxmr-empty {
    background: var(--mr-surface);
    border: 1px dashed var(--mr-axis);
    border-radius: 14px;
    padding: 56px 24px;
    text-align: center;
    color: var(--mr-ink-2);
}

.fxmr-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--mr-ink);
    margin: 12px 0 5px;
}

.fxmr-notes {
    background: var(--mr-surface);
    border: 1px solid var(--mr-ring);
    border-radius: 14px;
    padding: 15px 18px 17px;
    margin-top: 16px;
}

.fxmr-notes ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.fxmr-notes li {
    font-size: 12px;
    line-height: 1.65;
    color: var(--mr-ink-2);
    margin-bottom: 5px;
}
