/* ============================================================
   Maintenance module — minimal helpers.
   The maintenance pages now use MudBlazor primitives end-to-end so
   they match the rest of the Tansi app. This file is kept only for
   tiny niceties: tabular numerals on monospace numbers, etc.
   ============================================================ */

[style*="JetBrains Mono"] {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* ============================================================
   WORK ORDERS — board + list grid UI 
   ============================================================ */
.wo-scope {
    --wo-card: var(--mud-palette-surface);
    --wo-panel: var(--mud-palette-background);
    --wo-panel-2: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
    --wo-border: var(--mud-palette-lines-default);
    --wo-border-strong: var(--mud-palette-lines-inputs);
    --wo-text: var(--mud-palette-text-primary);
    --wo-text-2: var(--mud-palette-text-secondary);
    --wo-text-3: var(--mud-palette-text-disabled);
    --wo-focus: var(--mud-palette-primary);
    --wo-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- filter / toolbar bar ---------- */
.wo-bar {
    background: var(--wo-card);
    border: 1px solid var(--wo-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 0 0 16px;
}
.wo-bar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 28px;
    align-items: flex-start;
}
.wo-bar__row--b {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--wo-border);
    align-items: flex-end;
}
.wo-group { min-width: 0; }
.wo-group__label {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--wo-text-3);
}
.wo-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}
.wo-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid var(--wo-border-strong);
    background: var(--wo-card);
    color: var(--wo-text);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.wo-chip:hover { background: var(--wo-panel-2); }
.wo-chip:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }
.wo-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 19px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--wo-panel-2);
    color: var(--wo-text-2);
    font-size: 11.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.wo-chip[aria-pressed="true"] {
    background: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}
.wo-chip[aria-pressed="true"] .wo-chip__count {
    background: var(--mud-palette-primary-text);
    color: var(--mud-palette-primary);
}
.wo-chip[aria-pressed="true"] .wo-chip__label::before {
    content: "\2713\00a0";
    font-weight: 900;
}

/* search + view switch row */
.wo-search { flex: 1 1 260px; min-width: 220px; max-width: 460px; }
.wo-search label {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--wo-text-3);
}
.wo-search__field { position: relative; }
.wo-search__field svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wo-text-3);
    pointer-events: none;
}
.wo-search input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--wo-border-strong);
    background: var(--wo-card);
    color: var(--wo-text);
    font: inherit;
    font-size: 14px;
}
.wo-search input:focus-visible {
    outline: 3px solid var(--wo-focus);
    outline-offset: 2px;
    border-color: var(--mud-palette-primary);
}
.wo-viewsw { display: flex; flex-direction: column; }
.wo-viewsw > .wo-group__label { margin-bottom: 6px; }
.wo-viewbtns {
    display: inline-flex;
    background: var(--wo-panel-2);
    border: 1px solid var(--wo-border-strong);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
}
.wo-vbtn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--wo-text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.wo-vbtn:hover { color: var(--wo-text); }
.wo-vbtn:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }
.wo-vbtn[aria-pressed="true"] {
    background: var(--wo-card);
    color: var(--mud-palette-primary);
    box-shadow: var(--shadow-card);
}

/* count line + clear */
.wo-countline {
    margin: 12px 0 0;
    font-size: 13.5px;
    color: var(--wo-text-2);
    line-height: 1.5;
}
.wo-clear {
    background: none;
    border: 0;
    padding: 0 2px;
    font: inherit;
    font-weight: 700;
    color: var(--mud-palette-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.wo-clear:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }

/* legend disclosure */
.wo-legend { margin: 10px 0 0; }
.wo-legend__toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--wo-border-strong);
    background: var(--wo-card);
    color: var(--wo-text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.wo-legend__toggle:hover { background: var(--wo-panel-2); color: var(--wo-text); }
.wo-legend__toggle:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }
.wo-legend__toggle svg { transition: transform .15s ease; }
.wo-legend__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.wo-legend__body {
    margin: 12px 0 0;
    display: grid;
    gap: 8px 22px;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}
.wo-legend__body > div {
    display: grid;
    grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border-top: 1px solid var(--wo-border);
}
.wo-legend__body dt { margin: 0; }
.wo-legend__body dd { margin: 0; font-size: 13px; color: var(--wo-text-2); line-height: 1.45; }

/* ---------- board ---------- */
.wo-board {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
}
@media (max-width: 1400px) { .wo-board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .wo-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .wo-board { grid-template-columns: minmax(0, 1fr); } }

.wo-col {
    min-width: 0;
    background: var(--wo-panel);
    border: 1px solid var(--wo-border);
    border-radius: var(--radius-md);
    padding: 12px;
    transition: border-color .12s ease, background .12s ease;
}
.wo-col.is-over {
    border-color: var(--mud-palette-primary);
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, var(--wo-panel));
    box-shadow: 0 0 0 2px var(--mud-palette-primary) inset;
}
.wo-col__head { padding: 2px 3px 10px; }
.wo-col__head h3 {
    margin: 0;
    font-size: 13.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--wo-text);
}
.wo-col__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--wo-panel-2);
    color: var(--wo-text-2);
    font-size: 11.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.wo-col__blurb { margin: 4px 0 0; font-size: 12px; color: var(--wo-text-3); line-height: 1.4; }
.wo-empty { margin: 6px 3px 0; font-size: 12.5px; color: var(--wo-text-3); line-height: 1.5; }
.wo-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }

/* ---------- card ---------- */
.wo-card {
    position: relative;
    min-width: 0;
    background: var(--wo-card);
    border: 1px solid var(--wo-border);
    border-left: 4px solid var(--wo-border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px 44px;
    box-shadow: var(--shadow-card);
    cursor: grab;
}
.wo-card:active { cursor: grabbing; }
.wo-card.is-late { border-left-color: var(--mud-palette-error); }
.wo-card.is-dragging { opacity: .45; }
.wo-card:has(.wo-open:focus-visible) { border-color: var(--mud-palette-primary); }
.wo-card__top { margin: 0 0 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wo-num {
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--wo-text-3);
    font-family: var(--wo-mono);
}
.wo-title { margin: 0 0 5px; }
.wo-open {
    position: static;
    background: none;
    border: 0;
    padding: 3px 5px;
    margin: -3px -5px;
    border-radius: 7px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--wo-text);
    text-align: left;
    cursor: pointer;
    min-height: 24px;
}
.wo-open::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-sm); }
.wo-open:hover { color: var(--mud-palette-primary); text-decoration: underline; }
.wo-open:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }
.wo-meta { margin: 0 0 3px; font-size: 12.5px; color: var(--wo-text-2); line-height: 1.45; }
.wo-asset { font-family: var(--wo-mono); font-weight: 700; font-size: 12px; }
.wo-av {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: var(--wo-panel-2);
    color: var(--wo-text-2);
    font-size: 9.5px;
    font-weight: 800;
    margin-right: 5px;
    vertical-align: -4px;
}
.wo-due .late { color: var(--mud-palette-error); font-weight: 800; }
.wo-due .soon { color: var(--mud-palette-warning); font-weight: 800; }
.wo-prog { margin: 8px 0 0; font-size: 11.5px; color: var(--wo-text-3); display: flex; align-items: center; gap: 8px; }
.wo-pbar { display: block; flex: 1 1 auto; height: 5px; border-radius: 999px; background: var(--wo-panel-2); overflow: hidden; }
.wo-pbar > span { display: block; height: 100%; background: var(--mud-palette-primary); }
.wo-move { position: absolute; left: 12px; bottom: 9px; z-index: 1; }

/* ---------- badges (type / priority / status) ----------
   never colour alone — the word is always present */
.wo-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .01em;
    white-space: nowrap;
    border: 1px solid transparent;
}
.wo-type--preventive { background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent); color: var(--mud-palette-primary); }
.wo-type--reactive   { background: color-mix(in srgb, var(--mud-palette-error) 14%, transparent);   color: var(--mud-palette-error); }
.wo-type--inspection { background: color-mix(in srgb, var(--mud-palette-info) 14%, transparent);    color: var(--mud-palette-info); }
.wo-type--project    { background: color-mix(in srgb, var(--mud-palette-tertiary) 16%, transparent); color: var(--mud-palette-tertiary); }
.wo-type--safety     { background: color-mix(in srgb, var(--mud-palette-warning) 16%, transparent); color: var(--mud-palette-warning); }
.wo-prio--critical { background: color-mix(in srgb, var(--mud-palette-error) 14%, transparent); color: var(--mud-palette-error); }
.wo-prio--critical::before { content: "\25CF\00a0"; font-size: 9px; }
.wo-prio--high { background: color-mix(in srgb, var(--mud-palette-warning) 16%, transparent); color: var(--mud-palette-warning); }
.wo-prio--high::before { content: "\25B2\00a0"; font-size: 8px; }
.wo-prio--medium { background: var(--wo-panel-2); color: var(--wo-text-2); border-color: var(--wo-border-strong); }
.wo-prio--low { background: transparent; color: var(--wo-text-3); border-color: var(--wo-border-strong); }
.wo-stat--open { background: var(--wo-panel-2); color: var(--wo-text-2); border-color: var(--wo-border-strong); }
.wo-stat--inprogress { background: color-mix(in srgb, var(--mud-palette-info) 14%, transparent); color: var(--mud-palette-info); }
.wo-stat--onhold { background: color-mix(in srgb, var(--mud-palette-warning) 16%, transparent); color: var(--mud-palette-warning); }
.wo-stat--done { background: color-mix(in srgb, var(--mud-palette-success) 14%, transparent); color: var(--mud-palette-success); }
.wo-stat--closed { background: transparent; color: var(--wo-text-3); border-color: var(--wo-border-strong); }

/* ---------- list ---------- */
.wo-tscroll {
    overflow: auto;
    border: 1px solid var(--wo-border);
    border-radius: var(--radius-md);
    background: var(--wo-card);
    max-width: 100%;
}
.wo-tscroll:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }
.wo-tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 900px; }
.wo-tbl th, .wo-tbl td {
    text-align: left;
    padding: 9px 12px;
    vertical-align: top;
    border-bottom: 1px solid var(--wo-border);
}
.wo-tbl thead th {
    background: var(--wo-panel);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--wo-text-3);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--wo-border-strong);
}
.wo-sortbtn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    background: none;
    border: 0;
    font: inherit;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--wo-text-3);
    cursor: pointer;
    text-align: left;
}
.wo-sortbtn:hover { background: var(--wo-panel-2); color: var(--wo-text); }
.wo-sortbtn:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: -3px; }
.wo-sortmark { font-size: 9px; color: var(--mud-palette-primary); }
.wo-tbl tbody tr:hover { background: var(--wo-panel-2); }
.wo-tbl tbody tr.is-late th[scope="row"] { box-shadow: inset 3px 0 0 var(--mud-palette-error); }
.wo-tbl tbody tr:last-child td, .wo-tbl tbody tr:last-child th { border-bottom: 0; }
.wo-numbtn {
    background: none;
    border: 0;
    padding: 6px 8px;
    margin: -6px -8px;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    color: var(--mud-palette-primary);
    cursor: pointer;
    min-height: 34px;
    font-family: var(--wo-mono);
    text-decoration: underline;
}
.wo-numbtn:hover { background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); }
.wo-numbtn:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }
.wo-tsub { display: block; font-size: 12px; color: var(--wo-text-3); line-height: 1.4; font-weight: 400; letter-spacing: 0; text-transform: none; }
.wo-mono { font-family: var(--wo-mono); font-weight: 700; font-size: 12.5px; }
.wo-tdue .late { color: var(--mud-palette-error); font-weight: 800; }
.wo-tdue .soon { color: var(--mud-palette-warning); font-weight: 800; }
.wo-tempty { color: var(--wo-text-3); padding: 24px 12px; text-align: center; }

.wo-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 760px) {
    .wo-viewsw { margin-left: 0; width: 100%; }
    .wo-legend__body > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .wo-bar__row { gap: 14px; }
}

/* ---------- "Move" pill (MudMenu activator on each card) ---------- */
.wo-movebtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid var(--wo-border-strong);
    background: var(--wo-panel-2);
    color: var(--wo-text-2);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.wo-movebtn:hover { background: color-mix(in srgb, var(--mud-palette-text-primary) 12%, transparent); color: var(--wo-text); }
.wo-movebtn:focus-visible { outline: 3px solid var(--wo-focus); outline-offset: 2px; }

/* ============================================================
   MAINTENANCE HUB — /maintenance  (MaintenanceHub.razor)
   ============================================================ */
.mh-scope {
    --mh-border: var(--mud-palette-lines-default);
    --mh-border-strong: var(--mud-palette-lines-inputs);
    --mh-panel: color-mix(in srgb, var(--mud-palette-text-primary) 4%, var(--mud-palette-surface));
    --mh-text: var(--mud-palette-text-primary);
    --mh-text-2: var(--mud-palette-text-secondary);
    --mh-focus: var(--mud-palette-primary);
}

/* Short sentence under a section head, kept at readable contrast. */
.mh-note {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--mh-text-2);
    max-width: 92ch;
}

/* The reconciliation note above the numbers. */
.mh-note--callout {
    padding: 9px 12px;
    border: 1px solid var(--mh-border-strong);
    border-left: 4px solid var(--mud-palette-primary);
    border-radius: var(--radius-sm, 8px);
    background: var(--mud-palette-surface);
}

/* Small secondary button used in section heads ("Show how each is worked out"). */
.mh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--mh-border-strong);
    background: var(--mud-palette-surface);
    color: var(--mh-text);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}
.mh-btn:hover { background: var(--mh-panel); }
.mh-btn:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 2px; }

/* ---------- the numbers ---------- */
.mh-kpis { margin-bottom: 0; gap: 11px; grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }
.mh-kpis .tansi-stat-card { padding: 14px 15px; gap: 4px; }
.mh-kpis .tansi-stat-card__value { font-size: 1.8rem; font-weight: 800; }
.mh-kpis .tansi-stat-card__caption { font-size: 0.75rem; color: var(--mh-text-2); }

.mh-def {
    margin: 8px 0 0;
    padding-top: 9px;
    border-top: 1px solid var(--mh-border);
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--mh-text-2);
}

/* ---------- modules ---------- */
.mh-mods {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
    gap: 11px;
}

/* One control per card, stretched over the whole card by its ::after. The
   card is not itself the control (a link or button may not contain a
   definition list), so the heading holds the only interactive thing. */
.mh-mod {
    position: relative;
    min-width: 0;
    padding: 13px 40px 13px 14px;
    background: var(--mh-panel);
    border: 1px solid var(--mh-border-strong);
    border-radius: var(--radius-md, 10px);
    transition: border-color .15s ease, background-color .15s ease;
}
.mh-mod:hover,
.mh-mod:has(.mh-mod__btn:focus-visible) {
    border-color: var(--mud-palette-primary);
    background: var(--mud-palette-surface);
}
.mh-mod--bad { border-left: 4px solid var(--mud-palette-error); }

.mh-mod__h { margin: 0; font-size: inherit; }
.mh-mod__btn {
    display: inline-block;
    min-height: 24px;
    padding: 3px 5px;
    margin: -3px -5px;
    border-radius: 7px;
    font-size: 0.9063rem;
    font-weight: 800;
    color: var(--mh-text);
    text-decoration: none;
}
.mh-mod__btn::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.mh-mod:hover .mh-mod__btn { color: var(--mud-palette-primary); }
.mh-mod__btn:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 2px; }

.mh-mod__go {
    position: absolute;
    top: 14px;
    right: 13px;
    display: flex;
    color: var(--mh-text-2);
    transition: transform .15s ease, color .15s ease;
}
.mh-mod:hover .mh-mod__go { color: var(--mud-palette-primary); transform: translateX(2px); }

.mh-mod__d {
    margin: 5px 0 9px;
    font-size: 0.7813rem;
    line-height: 1.55;
    color: var(--mh-text-2);
}

.mh-mod__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
    padding-top: 9px;
    border-top: 1px solid var(--mh-border);
}
.mh-mod__stats > div { min-width: 0; }
.mh-mod__stats dt {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--mh-text-2);
}
.mh-mod__stats dd {
    margin: 2px 0 0;
    font-size: 0.9375rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--mh-text);
}
.mh-mod__stats .is-bad dt,
.mh-mod__stats .is-bad dd { color: color-mix(in srgb, var(--mud-palette-error) 85%, var(--mh-text)); }

/* ---------- two columns: activity + copilot ---------- */
.mh-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 20px;
    align-items: start;
}
.mh-cols > .tansi-section { margin-bottom: 0; }
@media (max-width: 1020px) { .mh-cols { grid-template-columns: minmax(0, 1fr); } }

/* ---------- activity ---------- */
.mh-select {
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid var(--mh-border-strong);
    border-radius: 8px;
    background: var(--mud-palette-surface);
    color: var(--mh-text);
    font: inherit;
    font-size: 0.8125rem;
}
.mh-select:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 2px; }

.mh-act { list-style: none; margin: 0; padding: 0; }
.mh-act__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 2px;
    border-top: 1px solid var(--mh-border);
}
.mh-act__row:first-child { border-top: 0; }

.mh-kind {
    --mh-kind: var(--mud-palette-text-secondary);
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--mh-kind) 60%, transparent);
    background: color-mix(in srgb, var(--mh-kind) 12%, transparent);
    color: color-mix(in srgb, var(--mh-kind) 72%, var(--mh-text));
    font-size: 0.6563rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.mh-kind--wo    { --mh-kind: var(--mud-palette-primary); }
.mh-kind--asset { --mh-kind: var(--mud-palette-error); }
.mh-kind--plan  { --mh-kind: var(--mud-palette-success); }
.mh-kind--ai    { --mh-kind: var(--mud-palette-tertiary); }
.mh-kind--part  { --mh-kind: var(--mud-palette-warning); }

.mh-act__text { flex: 1 1 240px; min-width: 0; }
.mh-act__t {
    display: inline-block;
    min-height: 24px;
    padding: 3px 4px;
    margin: -3px -4px;
    border-radius: 6px;
    font-size: 0.8438rem;
    font-weight: 800;
    color: var(--mh-text);
    text-decoration: none;
}
a.mh-act__t:hover { color: var(--mud-palette-primary); text-decoration: underline; }
a.mh-act__t:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 2px; }
.mh-act__d {
    display: block;
    margin-top: 3px;
    font-size: 0.7813rem;
    line-height: 1.5;
    color: var(--mh-text-2);
}
.mh-act__when { flex: none; min-width: 150px; text-align: right; }
.mh-act__rel { display: block; font-size: 0.7813rem; font-weight: 700; color: var(--mh-text); }
.mh-act__abs { display: block; margin-top: 2px; font-size: 0.6875rem; color: var(--mh-text-2); }

.mh-empty {
    margin: 4px 0 0;
    padding: 14px;
    font-size: 0.8125rem;
    color: var(--mh-text-2);
    border: 1px dashed var(--mh-border-strong);
    border-radius: 8px;
    background: var(--mh-panel);
}

@media (max-width: 600px) {
    .mh-act__when { min-width: 0; text-align: left; flex-basis: 100%; padding-left: 89px; }
}

@media (prefers-reduced-motion: reduce) {
    .mh-mod, .mh-mod__go { transition: none; }
}

/* ---------- what needs attention ---------- */
.mh-attn .mh-attn__sub { margin-bottom: 0; max-width: 86ch; }
.mh-attn__list {
    list-style: none;
    margin: 13px 0 0;
    padding: 0;
    display: grid;
    gap: 9px;
}
.mh-attn__list[hidden] { display: none; }

.mh-attn__row {
    --mh-sev: var(--mud-palette-text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--mh-border);
    border-left: 4px solid var(--mh-sev);
    border-radius: 8px;
    background: var(--mud-palette-surface);
}
.mh-attn__row--stop { --mh-sev: var(--mud-palette-error); background: color-mix(in srgb, var(--mud-palette-error) 7%, var(--mud-palette-surface)); }
.mh-attn__row--warn { --mh-sev: var(--mud-palette-warning); background: color-mix(in srgb, var(--mud-palette-warning) 8%, var(--mud-palette-surface)); }
.mh-attn__row--note { --mh-sev: var(--mh-border-strong); }

.mh-attn__n {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 6px;
    border-radius: 9px;
    border: 2px solid var(--mh-sev);
    background: var(--mud-palette-surface);
    color: color-mix(in srgb, var(--mh-sev) 75%, var(--mh-text));
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.mh-attn__row--note .mh-attn__n { color: var(--mh-text); }

.mh-attn__text { flex: 1 1 340px; min-width: 0; }
.mh-attn__t { display: block; font-size: 0.875rem; font-weight: 800; line-height: 1.4; color: var(--mh-text); }
.mh-attn__w { display: block; margin-top: 3px; font-size: 0.7813rem; line-height: 1.55; color: var(--mh-text-2); }
.mh-attn__link { flex: none; align-self: center; }

/* module card control is a <button> now (opens the sheet) */
button.mh-mod__btn { cursor: pointer; text-align: left; line-height: 1.35; }

/* ---------- module sheet (HubModuleSheet.razor, inside .tansi-sheet) ---------- */
.mh-sheet__stats { border-top: 0; padding-top: 0; margin-bottom: 16px; }

.mh-btn--sm { min-height: 28px; padding: 0 10px; font-size: 0.75rem; }

.mh-tscroll {
    overflow-x: auto;
    border: 1px solid var(--mh-border);
    border-radius: 8px;
}
.mh-tscroll:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 2px; }

.mh-dtable {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.mh-dtable th,
.mh-dtable td {
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
    border-top: 1px solid var(--mh-border);
    color: var(--mh-text);
}
.mh-dtable thead th {
    border-top: 0;
    background: var(--mh-panel);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--mh-text-2);
    white-space: nowrap;
}
.mh-dtable tbody th { font-weight: 400; white-space: nowrap; }
.mh-dtable tr.is-bad > th:first-child { box-shadow: inset 3px 0 0 var(--mud-palette-error); }

.mh-dtable__id {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
}
.mh-dtable__t { display: block; font-weight: 700; }
.mh-dtable__m,
.mh-dtable__sub { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--mh-text-2); }
.mh-dtable__main { display: block; white-space: nowrap; }
.mh-dtable__sub.is-bad { color: color-mix(in srgb, var(--mud-palette-error) 85%, var(--mh-text)); font-weight: 700; }
.mh-dtable__go { width: 1%; white-space: nowrap; text-align: right; }

.mh-sheet__note {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-left: 4px solid var(--mud-palette-primary);
    border-radius: 0 8px 8px 0;
    background: var(--mh-panel);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--mh-text);
}

/* ---------- copilot recommendations ---------- */
.mh-scope { --mh-violet: color-mix(in srgb, var(--mud-palette-tertiary) 80%, var(--mud-palette-text-primary)); }

.mh-ai__chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--mh-violet);
    background: color-mix(in srgb, var(--mud-palette-tertiary) 12%, transparent);
    color: var(--mh-violet);
    font-size: 0.7188rem;
    font-weight: 800;
}

.mh-ai__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

/* Small cards: one control each, stretched over the card by its ::after. */
.mh-ai__card {
    position: relative;
    padding: 11px 38px 11px 13px;
    background: var(--mh-panel);
    border: 1px solid var(--mh-border-strong);
    border-left: 4px solid var(--mh-violet);
    border-radius: 8px;
    transition: border-color .15s ease, background-color .15s ease;
}
.mh-ai__card:hover,
.mh-ai__card:has(.mh-ai__btn:focus-visible) {
    border-color: var(--mud-palette-primary);
    border-left-color: var(--mh-violet);
    background: var(--mud-palette-surface);
}
.mh-ai__card--done {
    border-left-color: var(--mud-palette-success);
    background: color-mix(in srgb, var(--mud-palette-success) 8%, var(--mud-palette-surface));
}
.mh-ai__card--done:hover { border-left-color: var(--mud-palette-success); }
.mh-ai__card--off { border-left-color: var(--mh-text-2); }
.mh-ai__card--off:hover { border-left-color: var(--mh-text-2); }
.mh-ai__card:hover .mh-mod__go { color: var(--mud-palette-primary); transform: translateX(2px); }

.mh-ai__h { margin: 0; font-size: inherit; }
.mh-ai__btn {
    display: inline-block;
    min-height: 24px;
    padding: 3px 5px;
    margin: -3px -5px;
    border-radius: 7px;
    font-size: 0.8438rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--mh-text);
    text-align: left;
    cursor: pointer;
}
.mh-ai__btn::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.mh-ai__card:hover .mh-ai__btn { color: var(--mud-palette-primary); }
.mh-ai__btn:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 2px; }

.mh-ai__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 5px 0 0; }
.mh-ai__kind {
    font-size: 0.6563rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--mh-text-2);
}
.mh-ai__tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--mh-border-strong);
    background: var(--mud-palette-surface);
    color: var(--mh-text-2);
    font-size: 0.6563rem;
    font-weight: 800;
    letter-spacing: normal;
    text-transform: none;
    vertical-align: middle;
}
.mh-ai__tag--done {
    border-color: var(--mud-palette-success);
    background: color-mix(in srgb, var(--mud-palette-success) 12%, transparent);
    color: color-mix(in srgb, var(--mud-palette-success) 72%, var(--mh-text));
}
.mh-ai__saw { margin: 5px 0 0; font-size: 0.75rem; line-height: 1.5; color: var(--mh-text-2); }

/* recommendation sheet */
.mh-sheet--ai .tansi-sheet__head { box-shadow: inset 4px 0 0 var(--mh-violet); }
.mh-aidl { margin: 0 0 16px; }
.mh-aidl > div {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 14px;
    padding: 8px 0;
    border-top: 1px solid var(--mh-border);
}
.mh-aidl > div:first-child { border-top: 0; padding-top: 0; }
.mh-aidl dt { flex: 0 0 30%; min-width: 130px; font-size: 0.7188rem; font-weight: 800; color: var(--mh-text-2); }
.mh-aidl dd { flex: 1 1 55%; margin: 0; font-size: 0.8125rem; line-height: 1.6; color: var(--mh-text); }
.mh-sheet__h3 { margin: 0 0 8px; font-size: 0.875rem; font-weight: 800; color: var(--mh-text); }
.mh-sheet--ai .mh-sheet__note { border-left-color: var(--mh-violet); }
.mh-dtable--ev { min-width: 460px; }

@media (prefers-reduced-motion: reduce) {
    .mh-ai__card { transition: none; }
}

/* ---------- breadcrumb row + keyboard button ---------- */
.mh-crumbrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 14px; }
.mh-crumbrow > .mh-btn { margin-left: auto; flex: none; }

/* ---------- centred hub dialogs (NewWorkOrderDialog, HubKeyboardDialog) ---------- */
.mh-wo { --section-bg: var(--mud-palette-background); --card-hover-border: var(--mud-palette-lines-inputs); }
.mh-wo .mud-dialog-title { padding: 16px 20px 10px; border-bottom: 1px solid var(--mh-border); }
.mh-wo .mud-dialog-content { padding-top: 16px; }
.mh-wo .mud-dialog-actions { flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--mh-border); }
.mh-wo__head { display: flex; align-items: center; gap: 12px; }
.mh-wo__title { flex: 1 1 auto; margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--mh-text); }
.mh-wo__title:focus { outline: none; }
.mh-wo__title:focus-visible { outline: 2px solid var(--mh-focus); outline-offset: 2px; }

.mh-wo__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}
@media (max-width: 560px) { .mh-wo__grid { grid-template-columns: minmax(0, 1fr); } }

.mh-field { min-width: 0; }
.mh-field--wide { grid-column: 1 / -1; }
.mh-field__label { display: block; margin-bottom: 5px; font-size: 0.8125rem; font-weight: 700; color: var(--mh-text); }
.mh-field__req { color: color-mix(in srgb, var(--mud-palette-error) 85%, var(--mh-text)); }
.mh-field__opt { font-weight: 400; color: var(--mh-text-2); }
.mh-field__input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--mh-border-strong);
    border-radius: 8px;
    background: var(--mud-palette-surface);
    color: var(--mh-text);
    font: inherit;
    font-size: 0.875rem;
    color-scheme: light dark;
}
.mh-field__input--area { min-height: 76px; resize: vertical; line-height: 1.5; }
.mh-field__input:focus-visible { outline: 3px solid var(--mh-focus); outline-offset: 1px; border-color: var(--mh-focus); }
.mh-field__input[aria-invalid="true"] { border-color: var(--mud-palette-error); border-width: 2px; }
.mh-field__hint { margin: 5px 0 0; font-size: 0.75rem; line-height: 1.5; color: var(--mh-text-2); }
.mh-field__err {
    margin: 5px 0 0;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.5;
    color: color-mix(in srgb, var(--mud-palette-error) 85%, var(--mh-text));
}

.mh-wo__what {
    margin-top: 16px;
    padding: 11px 14px;
    border: 1px solid var(--mh-border);
    border-left: 4px solid var(--mud-palette-primary);
    border-radius: 0 8px 8px 0;
    background: var(--mh-panel);
}
.mh-wo__what h3 { margin: 0 0 6px; font-size: 0.8125rem; font-weight: 800; color: var(--mh-text); }
.mh-wo__what ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.mh-wo__what li { font-size: 0.8125rem; line-height: 1.55; color: var(--mh-text); }
.mh-wo__warn { color: color-mix(in srgb, var(--mud-palette-error) 80%, var(--mh-text)); font-weight: 700; }

.mh-wo__sum { flex: 1 1 220px; min-width: 0; margin: 0; font-size: 0.75rem; line-height: 1.45; color: var(--mh-text-2); }
.mh-wo__sum b {
    display: block;
    font-size: 0.8125rem;
    color: var(--mh-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- fixes from the in-browser test pass ---------- */
/* The shared validation summary is a flex row (mud-alert); in a narrow dialog
   that squeezes its heading into a thin column, so stack it here. */
.mh-wo .tansi-validation-summary { display: block; }
.mh-wo .tansi-validation-summary h2 { margin-bottom: 6px; }


/* ---------- module / recommendation sheet — matched to the mockup ---------- */
/* Heading: the mockup rings the heading when the sheet opens, so a keyboard or
   screen-magnifier user sees where they landed. :focus (not :focus-visible)
   because focus arrives programmatically, which Chrome may not flag as visible. */
.mh-scope .tansi-sheet__title:focus,
.mh-wo__title:focus {
    outline: 3px solid var(--mh-focus);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Head sits on a slightly tinted band, separated from the body. */
.mh-scope.tansi-sheet .tansi-sheet__head { background: var(--mh-panel); }
.mh-scope.tansi-sheet .tansi-sheet__head .tansi-sheet__close { background: transparent; }
.mh-scope.tansi-sheet .tansi-sheet__head .tansi-sheet__close:hover { background: var(--mh-border); }

/* The counts sit in their own bordered box above the rows. */
.mh-sheet__stats {
    padding: 12px 14px;
    border: 1px solid var(--mh-border-strong);
    border-radius: 10px;
    background: var(--mh-panel);
    margin-bottom: 14px;
}
.mh-sheet__stats dd { font-size: 1.05rem; }

/* Rows behind the counts: the bad ones are tinted across the whole row and
   their id turns red, rather than only a bar on the first cell. */
.mh-tscroll { border-color: var(--mh-border-strong); border-radius: 10px; }
.mh-dtable th, .mh-dtable td { padding: 11px 12px; }
.mh-dtable tr.is-bad > th:first-child { box-shadow: none; }
.mh-dtable tbody tr.is-bad > th,
.mh-dtable tbody tr.is-bad > td {
    background: color-mix(in srgb, var(--mud-palette-error) 9%, var(--mud-palette-surface));
}
.mh-dtable tbody tr.is-bad .mh-dtable__id {
    color: color-mix(in srgb, var(--mud-palette-error) 85%, var(--mh-text));
}
.mh-dtable__id { font-family: inherit; font-size: 0.8125rem; font-weight: 800; }
.mh-dtable__t { font-size: 0.8438rem; line-height: 1.4; }
.mh-dtable__main { font-size: 0.8438rem; }

/* Full-size Open buttons, as in the mockup. */
.mh-dtable__go .mh-btn { min-height: 38px; padding: 0 14px; font-size: 0.8438rem; border-radius: 8px; }

/* Note under the table: bordered card with the accent on the left. */
.mh-sheet__note {
    border: 1px solid var(--mh-border-strong);
    border-left: 4px solid var(--mud-palette-primary);
    border-radius: 8px;
    background: var(--mud-palette-surface);
}

/* ---------- whole-card click target (module + CoPilot cards) ---------- */
/* MudBlazor sets `button { position: relative }` globally, which made each
   card button the containing block of its own ::after — so the stretched
   target covered only the title and a click anywhere else on the card did
   nothing. Static puts the containing block back on the card (<li>, relative),
   so the ::after covers the whole card as in the mockup. The arrow is purely
   decorative and must not swallow the click. */
.mh-mod__btn,
.mh-ai__btn { position: static; }
.mh-mod__btn::after,
.mh-ai__btn::after { z-index: 1; }
.mh-mod__go { pointer-events: none; }

/* ---------- contrast fixes from the light-theme pass ---------- */
/* The current page in the breadcrumb is a MudBlazor "disabled" item, drawn in
   the disabled grey (~1.5:1 on white). It is the page you are on, not an
   unavailable action, so give it readable secondary text. */
.mh-crumbrow .mud-breadcrumb-item.mud-disabled,
.mh-crumbrow .mud-breadcrumb-item.mud-disabled > * {
    color: var(--mh-text-2);
    opacity: 1;
}

/* On the tinted sheet head the shared --text-caption grey lands at 4.47:1 —
   just under AA for this small text. Use the palette's secondary text. */
.mh-scope.tansi-sheet .tansi-sheet__kind,
.mh-scope.tansi-sheet .tansi-sheet__sub { color: var(--mh-text-2); }

/* The shared TansiValidationSummary is a filled error alert: white on the dark
   theme's pink error measures 2.74:1. Inside the hub's dialog draw it as a
   tinted panel with body text and a red rule instead — readable in both themes
   (the mockup's error summary has the same shape). */
.mh-wo .tansi-validation-summary.mud-alert {
    background: color-mix(in srgb, var(--mud-palette-error) 12%, var(--mud-palette-surface));
    color: var(--mh-text);
    border: 1px solid color-mix(in srgb, var(--mud-palette-error) 55%, transparent);
    border-left: 4px solid var(--mud-palette-error);
    border-radius: 8px;
}
.mh-wo .tansi-validation-summary h2 { color: var(--mh-text); font-weight: 800; }
.mh-wo .tansi-validation-summary .tansi-validation-link {
    color: color-mix(in srgb, var(--mud-palette-error) 70%, var(--mh-text));
    text-decoration: underline;
    text-align: left;
}
.mh-wo .tansi-validation-summary .tansi-validation-link:focus-visible {
    outline: 3px solid var(--mh-focus);
    outline-offset: 2px;
}
