/* =====================================================================================================
   Miracle EDC — UI refresh (22 Oct 2026). Loaded after app.css; uses the theme variables so light and dark
   modes both follow. Sections: page header · cards · process steps · KPI tiles · tables · buttons · inputs ·
   alerts · workflow panels.
   ===================================================================================================== */

/* ---- Typeface: Inter (self-hosted, SIL OFL; fonts/inter) -------------------------------------------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/inter/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/inter/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/inter/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/inter/inter-latin-700-normal.woff2) format("woff2"); }
:root { --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss01"; }
input, select, textarea, button { font-family: inherit; }

/* ---- Page header: title and description on the left, actions on the right --------------------------- */
.mx-head {
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 24px;
    margin: 0 0 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line-2);
}
    .mx-head > :first-child { flex: 1 1 auto; min-width: 0; }
    .mx-head > :not(:first-child) {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 2px;
    }
    .mx-head h1 {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 22px;
        line-height: 1.25;
        letter-spacing: -0.01em;
        margin: 0;
    }
        .mx-head h1 > i.fa {
            flex: 0 0 auto;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 38px;
            height: 38px;
            margin: 0;
            border-radius: 10px;
            background: var(--brand-050);
            color: var(--brand);
            font-size: 17px;
        }
    .mx-head .mx-sub {
        max-width: 980px;
        margin: 8px 0 0;
        font-size: 13.5px;
        line-height: 1.55;
        color: var(--muted);
    }
@media (max-width: 900px) {
    .mx-head { flex-wrap: wrap; gap: 14px; }
    .mx-head > :not(:first-child) { justify-content: flex-start; width: 100%; }
}

/* ---- Cards ---------------------------------------------------------------------------------------------- */
.mx-card { border-color: var(--line); box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04); }
.mx-card-head { padding: 16px 20px; background: linear-gradient(180deg, var(--card), var(--card)); }
    .mx-card-head h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.005em; display: flex; align-items: center; gap: 9px; margin: 0; }
        .mx-card-head h3 > i.fa { color: var(--brand); width: 18px; text-align: center; }
    .mx-card-head .mx-card-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.mx-pad { padding: 18px 20px; }

/* ---- Process steps (shared): numbered, connected stages; vertical on narrow screens ---------------------- */
.mx-process {
    list-style: none;
    margin: 0;
    padding: 4px 0 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0;
    counter-reset: mxstep;
}
    .mx-process > li {
        position: relative;
        counter-increment: mxstep;
        padding: 0 12px;
        text-align: center;
    }
        /* connector to the previous step */
        .mx-process > li + li::before {
            content: "";
            position: absolute;
            top: 23px;
            left: calc(-50% + 30px);
            right: calc(50% + 30px);
            height: 2px;
            border-radius: 2px;
            background: linear-gradient(90deg, var(--line), var(--brand));
            opacity: .55;
        }
    .mx-step-dot {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--brand-050);
        color: var(--brand);
        border: 2px solid var(--brand);
        font-size: 18px;
        box-shadow: 0 0 0 5px var(--card);
    }
        .mx-step-dot::after {
            content: counter(mxstep);
            position: absolute;
            top: -6px;
            right: -8px;
            min-width: 20px;
            height: 20px;
            padding: 0 5px;
            border-radius: 10px;
            background: var(--brand);
            color: #fff;
            font-size: 11px;
            font-weight: 700;
            line-height: 20px;
            box-shadow: 0 0 0 2px var(--card);
        }
    .mx-step-title { margin: 12px 0 2px; font-size: 13.5px; font-weight: 650; color: var(--ink); }
    .mx-step-who {
        display: inline-block;
        margin: 2px 0 6px;
        padding: 1px 8px;
        border-radius: 999px;
        background: var(--line-2);
        color: var(--ink-2);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .02em;
    }
    .mx-step-text { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
    .mx-step-ev { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
        .mx-step-ev li { padding: 2px 0; }
        .mx-step-ev li::before { content: "\2713"; color: var(--ok); font-weight: 700; margin-right: 6px; }
@media (max-width: 900px) {
    .mx-process { grid-auto-flow: row; grid-auto-columns: auto; gap: 18px; }
        .mx-process > li { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; text-align: left; padding: 0; }
            .mx-process > li > :not(.mx-step-dot) { grid-column: 2; }
            .mx-process > li > .mx-step-dot { grid-row: 1 / span 4; }
            .mx-process > li > .mx-step-who { justify-self: start; }
            .mx-process > li + li::before { top: -18px; left: 23px; right: auto; width: 2px; height: 18px; }
        .mx-step-title { margin-top: 4px; }
}

/* ---- KPI tiles --------------------------------------------------------------------------------------------- */
.mx-stat { padding: 16px 18px 15px; }
.mx-stat-label { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.mx-stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px; }
.mx-stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.mx-stat.mx-kpi-warn { box-shadow: inset 3px 0 0 var(--warn), 0 1px 2px rgba(16, 24, 40, .05); }
.mx-stat.mx-kpi-danger { box-shadow: inset 3px 0 0 var(--danger), 0 1px 2px rgba(16, 24, 40, .05); }
.mx-stat.mx-kpi-ok { box-shadow: inset 3px 0 0 var(--ok), 0 1px 2px rgba(16, 24, 40, .05); }

/* Balanced tile rows: the column count follows the number of tiles, so rows never end half-empty
   (8 -> 4 + 4, 6 -> 3 + 3, 7 -> 4 + 3, 9 -> 3 x 3, 10 -> 5 + 5, 12 -> 6 + 6). */
@media (min-width: 900px) {
    .mx-stats:has(> :nth-child(3):last-child)  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(4):last-child)  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(5):last-child)  { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(6):last-child)  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(7):last-child),
    .mx-stats:has(> :nth-child(8):last-child)  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(9):last-child)  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(10):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .mx-stats:has(> :nth-child(11):last-child),
    .mx-stats:has(> :nth-child(12):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
    .mx-stats:has(> :nth-child(6):last-child)  { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Six-tile summary rows (e.g. Device Accountability) stay one row on wide screens, 3 + 3 below that. */
.mx-stats.da-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1280px) { .mx-stats.da-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .mx-stats.da-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Tables ------------------------------------------------------------------------------------------------- */
.mx-table th {
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--line-2);
    border-bottom: 1px solid var(--line);
    padding-top: 10px;
    padding-bottom: 10px;
    white-space: nowrap;
}
.mx-table td { padding-top: 11px; padding-bottom: 11px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.mx-table tbody tr:hover td { background: var(--brand-050); }
.mx-table tbody tr:last-child td { border-bottom: 0; }

/* ---- Buttons ------------------------------------------------------------------------------------------------ */
.mx-btn {
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    line-height: 1.2;
    background: var(--card);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}
    .mx-btn:hover { border-color: var(--brand); color: var(--brand); }
    .mx-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(20, 102, 216, .25); }
.mx-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
    .mx-btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.mx-btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12.5px; }

/* ---- Inputs ------------------------------------------------------------------------------------------------- */
.mx-input { min-height: 38px; padding: 7px 10px; border-radius: 8px; transition: border-color .15s ease, box-shadow .15s ease; }
    .mx-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 102, 216, .15); }
.mx-field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }

/* ---- Alerts --------------------------------------------------------------------------------------------------- */
.mx-alert { border-radius: 10px; padding: 12px 16px; font-size: 13.5px; line-height: 1.5; }

/* ---- Workflow action panels inside dialogs (deficiency and privacy cases) ---------------------------------------- */
.dd-step, .pv-step {
    border: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 14px;
    background: var(--card);
}
    .dd-step h4, .pv-step h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0 0 8px; }
        .dd-step h4 > i.fa, .pv-step h4 > i.fa { color: var(--brand); }

/* =====================================================================================================
   Application shell v2 (22 Oct 2026): refined sidebar, white top bar with breadcrumb and study context,
   designed empty states. Expanded sidebar only — the collapsed (icon) mode keeps its own rules.
   ===================================================================================================== */

/* ---- Sidebar ---------------------------------------------------------------------------------------- */
.mx-side { background: #0b1526; border-right: 1px solid rgba(255, 255, 255, .04); }
.mx-brand { border-bottom: 1px solid rgba(255, 255, 255, .06); padding: 16px 18px; }
.mx-shell:not(.mx-collapsed) .mx-nav { padding: 10px 0 16px; }
.mx-shell:not(.mx-collapsed) .mx-navgrp {
    margin: 2px 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 8px;
}
.mx-shell:not(.mx-collapsed) .mx-navgrp-h {
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 600;
    color: #a9b8cc;
    padding: 8px 10px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
}
    .mx-shell:not(.mx-collapsed) .mx-navgrp-h:hover { background: rgba(255, 255, 255, .05); color: #e3eaf3; }
    .mx-shell:not(.mx-collapsed) .mx-navgrp-h > i:first-child { width: 18px; text-align: center; color: #7f93ad; font-size: 14px; }
.mx-shell:not(.mx-collapsed) .mx-navgrp-active > .mx-navgrp-h { color: #ffffff; }
    .mx-shell:not(.mx-collapsed) .mx-navgrp-active > .mx-navgrp-h > i:first-child { color: #7fb0ff; }
.mx-shell:not(.mx-collapsed) .mx-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 10px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: #c3cfde;
    border: 0;
    background: transparent;
    box-shadow: none;
    text-transform: none;
    letter-spacing: 0;
}
    .mx-shell:not(.mx-collapsed) .mx-nav a > i { width: 18px; text-align: center; color: #7f93ad; font-size: 14px; }
    .mx-shell:not(.mx-collapsed) .mx-nav a:hover { background: rgba(255, 255, 255, .06); color: #ffffff; }
        .mx-shell:not(.mx-collapsed) .mx-nav a:hover > i { color: #c9d6e6; }
    .mx-shell:not(.mx-collapsed) .mx-nav a.active {
        background: rgba(37, 117, 230, .22);
        color: #ffffff;
        box-shadow: inset 3px 0 0 #4f93ff;
    }
        .mx-shell:not(.mx-collapsed) .mx-nav a.active > i { color: #9cc2ff; }
/* items inside a group sit under the group label */
.mx-shell:not(.mx-collapsed) .mx-navgrp-i a { margin-left: 10px; margin-right: 0; padding-left: 30px; }
    .mx-shell:not(.mx-collapsed) .mx-navgrp-i a > i { display: none; }
/* Configuration -> Branding -> "Icons on menu items": item icons inside a group, smaller and dimmer than the
   group heading's, so the heading still leads */
.mx-shell.mx-nav-icons:not(.mx-collapsed) .mx-navgrp-i a { padding-left: 20px; }
    .mx-shell.mx-nav-icons:not(.mx-collapsed) .mx-navgrp-i a > i { display: inline-block; width: 16px; font-size: 12.5px; color: #6b7f99; }
    .mx-shell.mx-nav-icons:not(.mx-collapsed) .mx-navgrp-i a:hover > i { color: #c9d6e6; }
    .mx-shell.mx-nav-icons:not(.mx-collapsed) .mx-navgrp-i a.active > i { color: #9cc2ff; }
.mx-set.mx-set-flush { padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-2); }

/* ---- Top bar ------------------------------------------------------------------------------------------ */
.mx-top {
    height: 56px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    gap: 16px;
}
.mx-crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
}
    .mx-crumb > i { font-size: 12px; opacity: .7; }
    .mx-crumb > b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .mx-crumb > span, .mx-crumb > i { display: none; } }

/* ---- Empty states: any table whose only row is the "nothing here yet" message ------------------------- */
.mx-table tr > td[colspan]:only-child,
.mx-table td.dataTables_empty {
    padding: 36px 20px 38px;
    text-align: center;
    color: var(--muted);
    font-size: 13.5px;
    background: var(--card);
}
    .mx-table tr > td[colspan]:only-child::before,
    .mx-table td.dataTables_empty::before {
        content: "\f187";                       /* Font Awesome archive (inbox) */
        font-family: FontAwesome;
        display: block;
        width: 44px;
        height: 44px;
        margin: 0 auto 10px;
        border-radius: 12px;
        background: var(--brand-050);
        color: var(--brand);
        font-size: 19px;
        line-height: 44px;
    }
.mx-table tbody tr:hover > td[colspan]:only-child { background: var(--card); }

/* Top bar balance: the breadcrumb takes the free space; search, study and user stay compact on one line. */
.mx-top > .mx-crumb { flex: 1 1 auto; }
.mx-top > .mx-omni { flex: 0 1 300px; width: 300px; max-width: 300px; }
.mx-top > .mx-user { flex: 0 0 auto; white-space: nowrap; }
    .mx-top > .mx-user .mx-badge-area { white-space: nowrap; }
@media (max-width: 1360px) { .mx-top > .mx-user .mx-badge-area { display: none; } }
@media (max-width: 1100px) { .mx-top > .mx-omni { flex-basis: 220px; width: 220px; } }
@media (max-width: 1500px) { .mx-top > .mx-user .mx-badge-area { display: none; } }

/* ---- Dropdown menu (no script): <details class="mx-dropdown"><summary class="mx-btn">…</summary><div class="mx-dropdown-menu"> --- */
.mx-dropdown { position: relative; display: inline-block; }
    .mx-dropdown > summary { list-style: none; cursor: pointer; }
        .mx-dropdown > summary::-webkit-details-marker { display: none; }
    .mx-dropdown[open] > summary { border-color: var(--brand); color: var(--brand); }
    .mx-dropdown[open] .mx-dropdown-caret { transform: rotate(180deg); }
.mx-dropdown-caret { margin-left: 2px; transition: transform .15s ease; }
.mx-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 40;
    min-width: 290px;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);
}
    .mx-dropdown-menu > a {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 9px 10px;
        border-radius: 7px;
        color: var(--ink);
        text-decoration: none;
    }
        .mx-dropdown-menu > a:hover { background: var(--brand-050); }
        .mx-dropdown-menu > a > i { width: 18px; margin-top: 2px; text-align: center; color: var(--brand); }
        .mx-dropdown-menu > a b { display: block; font-size: 13px; font-weight: 600; }
        .mx-dropdown-menu > a small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---- Tiles: one surface for every state (theme-aware); state shows as the side bar and the icon colour ---- */
.mx-stat,
.mx-stat.mx-kpi-ok,
.mx-stat.mx-kpi-warn,
.mx-stat.mx-kpi-danger { background: var(--card); border: 1px solid var(--line); }
.mx-stat.mx-kpi-danger .mx-stat-value { color: var(--ink); }
.mx-stat.mx-kpi-danger .mx-stat-value i { color: var(--danger); }

/* ---- Card toolbar: filters on the right of a card head -------------------------------------------------- */
.mx-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
    .mx-toolbar .mx-input { min-width: 170px; }
    .mx-toolbar label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 0; }
    .mx-toolbar .mx-mon-filter { display: flex; align-items: center; gap: 8px; }

/* Tile rows that include a chart tile (e.g. Queries: four counts + the state donut): one row, the chart tile
   twice as wide, all tiles the same compact height. */
@media (min-width: 900px) {
    .mx-stats:has(> .mx-donut-card) { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
        .mx-stats:has(> .mx-donut-card) > .mx-donut-card { grid-column: span 2; }
}
.mx-donut-card .mx-donut-wrap { margin-top: 6px; gap: 14px; }
.mx-donut-card .mx-donut { width: 56px; height: 56px; }
.mx-donut-card .mx-donut-leg-wrap { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }

/* ---- Subject casebook (Rave-style): ID + status pill, facts strip, metric tiles, per-form status strip ---- */
.mx-subj-pill {
    display: inline-flex; align-items: center; vertical-align: middle; margin-left: 10px; padding: 3px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0; line-height: 1.4;
}
    .mx-subj-pill.mx-tone-ok { background: var(--ok-bg); color: var(--ok); }
    .mx-subj-pill.mx-tone-warn { background: var(--warn-bg); color: var(--warn); }
    .mx-subj-pill.mx-tone-off { background: var(--line-2); color: var(--muted); }
.mx-subj-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.mx-subj-fact { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
    .mx-subj-fact > i { color: var(--muted); width: 14px; text-align: center; }
.mx-subj-fact-l { color: var(--muted); }

.mx-subj-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mx-subj-kpi {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
    box-shadow: var(--shadow); min-width: 0;
}
.mx-subj-kpi-l { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-subj-kpi-v { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mx-subj-kpi-bar { height: 4px; border-radius: 4px; background: var(--line-2); margin: 8px 0 6px; overflow: hidden; }
    .mx-subj-kpi-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.mx-subj-kpi.mx-tone-ok .mx-subj-kpi-bar > span { background: var(--ok); }
.mx-subj-kpi.mx-tone-warn .mx-subj-kpi-v { color: var(--warn); }
.mx-subj-kpi-s { font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 6px; }
.mx-subj-kpi-bar + .mx-subj-kpi-s { margin-top: 0; }

.mx-fitem-flags { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
    .mx-fitem-flags:empty { display: none; }
    .mx-fitem-flags .mx-fitem-sdv { margin-right: 0; }
.mx-fitem-q {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px;
    background: var(--warn-bg); color: var(--warn); font-size: 11.5px; font-weight: 700;
}
.mx-fitem-frozen { background: var(--brand-050); color: var(--brand); }
.mx-subj-kpis { margin: 0 0 16px; }
@media (max-width: 760px) { .mx-subj-kpis { grid-template-columns: 1fr; } }

/* ---- Settings pages: cards of setting rows (title, short description, default; control on the right) ---- */
.mx-set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
    .mx-set-grid > .mx-card { margin: 0; }
@media (max-width: 1100px) { .mx-set-grid { grid-template-columns: 1fr; } }
.mx-set { display: flex; align-items: flex-start; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line-2); }
    .mx-set:first-child { border-top: 0; }
.mx-set-text { flex: 1 1 auto; min-width: 0; }
    .mx-set-text > b { font-size: 14px; font-weight: 600; color: var(--ink); }
    .mx-set-text > small { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
    .mx-set-text .mx-badge { margin-left: 6px; vertical-align: 1px; }
.mx-set-def { display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--line-2); border-radius: 6px; padding: 1px 7px; }
.mx-set-ctl { flex: 0 0 auto; margin-top: 2px; }
.mx-set-block { flex-direction: column; align-items: stretch; gap: 10px; }
    .mx-set-block textarea.mx-input { width: 100%; font-family: inherit; resize: vertical; }
.mx-set-foot { margin-top: 16px; padding: 0; border: 0; background: none; justify-content: flex-end; }

/* Choice cards: a radio choice shown as a selectable card with an example */
.mx-choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.mx-choice {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; cursor: pointer;
    border: 1px solid var(--line); border-radius: 10px; background: var(--card); transition: border-color .12s, box-shadow .12s;
}
    .mx-choice:hover { border-color: var(--brand); }
    .mx-choice:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-050); }
    .mx-choice:has(input:disabled) { cursor: default; }
    .mx-choice input[type=radio] { margin-top: 3px; accent-color: var(--brand); }
.mx-choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
    .mx-choice-body b { font-size: 14px; color: var(--ink); }
    .mx-choice-body small { font-size: 12.5px; color: var(--muted); }
.mx-choice-eg { margin-top: 6px; font-size: 12px; color: var(--ink-2); background: var(--line-2); border-radius: 6px; padding: 3px 8px; align-self: flex-start; font-family: ui-monospace, Consolas, monospace; }
/* On/off toggle for setting rows (the checkbox itself, so the server control and its posted value are unchanged) */
.mx-set-ctl input[type=checkbox] {
    -webkit-appearance: none; appearance: none; position: relative; top: 0; margin: 0;
    width: 38px; height: 22px; border-radius: 999px; background: #cbd2dc; cursor: pointer; transition: background .15s;
}
    .mx-set-ctl input[type=checkbox]::after {
        content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
        background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.25); transition: transform .15s;
    }
    .mx-set-ctl input[type=checkbox]:checked { background: var(--brand); }
        /* The full knob again: the shared checkbox tick (app.css, same specificity) would otherwise reshape it. */
        .mx-set-ctl input[type=checkbox]:checked::after {
            top: 3px; left: 3px; width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff;
            box-shadow: 0 1px 2px rgba(16,24,40,.25); transform: translateX(16px);
        }
    .mx-set-ctl input[type=checkbox]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
    .mx-set-ctl input[type=checkbox]:disabled { cursor: default; opacity: .6; }
.mx-set-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
    .mx-set-col > .mx-card { margin: 0; }
/* A list of setting rows inside a padded card body (e.g. Branding -> menu categories): compact, two columns */
.mx-set-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
    .mx-set-cats .mx-set { padding: 10px 14px; border-top: 0; border-bottom: 1px solid var(--line-2); align-items: center; }
    .mx-set-cats .mx-set-text > small { margin-top: 1px; }
/* Casebook row: form version ahead of the date line ("<fork> v1 | Recorded ...") */
.mx-fitem-ver { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
    .mx-fitem-ver > i { font-size: 11px; }
.mx-fitem-ver-old { color: var(--warn); font-weight: 600; }
.mx-fitem-sep { margin: 0 6px; color: var(--line); }


/* Role matrix (Roles & permissions, Governance): capability columns in groups, sticky role column and
   headings, a quiet dash where a role does not hold a capability. */

.cr-scroll { overflow: auto; max-height: calc(100vh - 230px); min-height: 260px; border: 1px solid var(--mx-line, #e6eaf0); border-radius: 10px; }
table.cr-grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; margin: 0; }
table.cr-grid th, table.cr-grid td { padding: 7px 4px; border-bottom: 1px solid var(--mx-line, #e6eaf0); background: var(--mx-card, #fff); }
table.cr-grid thead th { position: sticky; z-index: 2; top: 0; font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: none; color: var(--mx-ink2, #344054); vertical-align: bottom; line-height: 1.25; }
table.cr-grid thead tr.cr-groups th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mx-muted, #667085); text-align: center; padding: 6px 4px 4px; border-bottom: 2px solid var(--gcol, #d0d5dd); }
table.cr-grid th.cr-cap, table.cr-grid td.cr-cap { width: 64px; min-width: 64px; max-width: 64px; text-align: center; }
table.cr-grid .cr-h { display: inline-block; cursor: help; }
table.cr-grid th.cr-gs, table.cr-grid td.cr-gs { border-left: 1px solid var(--mx-line, #e6eaf0); }
table.cr-grid th:first-child, table.cr-grid td:first-child { position: sticky; left: 0; z-index: 1; width: 236px; min-width: 236px; max-width: 236px; padding-left: 12px; text-align: left; box-shadow: 1px 0 0 var(--mx-line, #e6eaf0); }
table.cr-grid thead th:first-child { z-index: 3; }
table.cr-grid tbody tr:hover td, table.cr-grid td.cr-colhi { background: var(--mx-row-hover, #f5f8ff); }
.cr-role-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.cr-role-name code { font-size: 11px; color: var(--mx-muted, #667085); background: none; padding: 0; }
.cr-role-meta { display: flex; align-items: flex-start; gap: 6px; margin-top: 3px; }
.cr-role-meta .mx-badge { flex: none; font-size: 10.5px; }
.cr-resp { font-size: 11.5px; line-height: 1.35; color: var(--mx-muted, #667085); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-lock { font-size: 10.5px; font-weight: 700; color: #b54708; background: #fffaeb; border: 1px solid #fedf89; border-radius: 999px; padding: 0 7px; cursor: help; }
table.cr-grid thead tr.cr-groups th { height: 28px; box-sizing: border-box; }
table.cr-grid thead tr.cr-groups + tr th { top: 28px; }
table.cr-grid .cr-yes { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; background: #dcfae6; color: #067647; font-size: 12px; font-weight: 700; }
table.cr-grid .cr-dash { color: #c4cad4; }
table.cr-grid thead th { white-space: normal; }
table.cr-grid.cr-ro td:first-child { width: 200px; min-width: 200px; max-width: 200px; }

/* Wide grids (App.master mxFitColumns): short values on one line, tighter padding from 8 columns. */
table.mx-fit td.mx-nw { white-space: nowrap; }
table.mx-dense > thead > tr > th { padding-left: 8px; }
table.mx-dense > tbody > tr > td { padding-left: 8px; padding-right: 8px; font-size: 13px; }
