/* Maintenance page (templates/maintenance.html, static/js/pages/maintenance.js,
   ADR 0019 PR5). Everything carries the mt- prefix; colors from tokens.css,
   cards/containers from insights.css (loaded before this sheet). The page
   is a document, not a full-viewport frame: the template sets body
   .page-scroll (base.css) so the window scrolls, and every wide table
   scrolls sideways inside its own .mt-table-wrap card (the Compliance and
   Equipment lists inside their section card) rather than widening the
   page. */

#mt-page { padding: var(--space-4) var(--space-3); }

/* ── header ── */
.mt-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3); }
.mt-header h2 { margin: 0; font-size: 18px; }
.mt-sub { color: #667; font-size: 12px; }

/* ── tabs ── */
.mt-tabs { display: flex; gap: var(--space-1); margin-bottom: var(--space-3); border-bottom: 1px solid #d7dde8; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.mt-tabs::-webkit-scrollbar { display: none; }
.mt-tab { flex: 0 0 auto; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: #556; font-size: 14px; cursor: pointer; white-space: nowrap; }
.mt-tab:hover { color: #223; }
.mt-tab[aria-selected="true"] { color: var(--color-accent); border-bottom-color: var(--color-accent); font-weight: 600; }
.mt-tab:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* ── coming-soon panel ── */
.mt-soon { padding: var(--space-4); }
.mt-soon h3 { margin: 0 0 var(--space-2); font-size: 16px; }
.mt-soon p { margin: 0 0 var(--space-2); color: #334; }
.mt-soon-note { color: #778; font-style: italic; }

/* ── documents ── */
.mt-uploader { padding: var(--space-3); margin-bottom: var(--space-3); }
.mt-docs-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.mt-toggle { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #334; cursor: pointer; }
.mt-note { padding: var(--space-3) var(--space-4); color: #556; }
.mt-error { color: var(--color-severity-red); }
/* Horizontal scroll container for every table that can outgrow its card
   (the documents table here; Summary / Phase Items / ADs / Matrix /
   Equipment / Logbook / Audit tables get the same class from the template
   or from maintenance.js). The wrapper, not the page, scrolls. */
.mt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mt-table th, .mt-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
.mt-table th { font-size: 12px; color: #667; font-weight: 600; white-space: nowrap; }
.mt-table tr:last-child td { border-bottom: 0; }
.mt-num { text-align: right; }
.mt-col-thumb { width: 56px; }
.mt-thumb { display: block; width: 44px; height: 58px; object-fit: cover; border: 1px solid #d7dde8; border-radius: var(--radius-sm); background: #f2f4f8; cursor: pointer; }
.mt-thumb-empty { display: block; width: 44px; height: 58px; border: 1px dashed #d7dde8; border-radius: var(--radius-sm); background: #f7f9fc; }
.mt-row-hidden td { opacity: .6; }
.mt-title-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--color-accent); cursor: pointer; text-align: left; }
.mt-title-btn:hover { text-decoration: underline; }
.mt-title-text { color: #223; }
.mt-rename { padding: 4px 6px; border: 1px solid #c9d2e3; border-radius: var(--radius-md); font-size: 13px; width: 100%; min-width: 160px; }
.mt-rename-btn { margin-left: 6px; }
.mt-hidden-tag { margin-left: 6px; font-size: 11px; color: #889; }

.mt-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; background: #eef1f6; color: #334; }
.mt-chip-ready { background: #e8f5e9; color: var(--color-severity-green); }
.mt-chip-rendering, .mt-chip-queued, .mt-chip-uploading { background: #e7eefb; color: #1a4f9c; }
.mt-chip-error { background: #fdecea; color: var(--color-severity-red); white-space: normal; }
.mt-chip-warning { background: #fff3e0; color: var(--color-severity-amber); white-space: normal; }
.mt-chip-stored { background: #f2f2f2; color: #667; }

/* ── processing progress (ADR 0020 §9, M5): chip + thin bar + label ── */
.mt-status-cell { min-width: 160px; }
.mt-bar { height: 4px; margin-top: 5px; border-radius: 2px; background: #e3e8f0; overflow: hidden; max-width: 220px; }
.mt-bar-fill { height: 100%; background: var(--color-accent); border-radius: 2px; transition: width .4s ease; }
.mt-progress-label { margin-top: 3px; font-size: 12px; color: #556; }
.mt-toolbar-toggles { display: flex; gap: var(--space-3); align-items: center; }
.mt-toggle[hidden] { display: none; }

/* ── per-page analysis badges (viewer bar, thumbnails, panel) ── */
.mt-badge { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.mt-badge-ok { background: #e8f5e9; color: var(--color-severity-green); }
.mt-badge-check { background: #ede7f6; color: #4527a0; }
.mt-badge-failed { background: #fdecea; color: var(--color-severity-red); }
.mt-badge-skip { background: #ececec; color: #556; }
.mt-badge-busy { background: #e7eefb; color: #1a4f9c; }
.mt-page-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.mt-page-badge[hidden] { display: none; }
.mt-page-badge.mt-badge-ok { background: #e8f5e9; color: #1b5e20; }
.mt-page-badge.mt-badge-check { background: #ede7f6; color: #4527a0; }
.mt-page-badge.mt-badge-failed { background: #fdecea; color: #b71c1c; }
.mt-page-badge.mt-badge-skip { background: #e6e6e6; color: #444; }
.mt-page-badge.mt-badge-busy { background: #e7eefb; color: #1a4f9c; }
.mt-thumb-tag { font-size: 10px; padding: 0 5px; border-radius: 7px; font-weight: 600; }

.mt-actions { display: flex; flex-wrap: wrap; gap: 4px; }

/* admin undelete list (collapsed <details>) */
.mt-deleted { margin-top: var(--space-3); padding: var(--space-2) var(--space-4); }
.mt-deleted summary { cursor: pointer; font-size: 13px; color: #556; }
.mt-deleted-list { display: flex; flex-direction: column; gap: 6px; padding: var(--space-2) 0 var(--space-1); }
.mt-deleted-row { display: flex; align-items: center; gap: var(--space-3); font-size: 13px; flex-wrap: wrap; }
.mt-deleted-title { flex: 1 1 200px; color: #223; }
.mt-danger { color: var(--color-severity-red); }

/* ── viewer ── */
.mt-viewer { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: #1b1d24; color: #eee; }
/* maintenance.js sets this while the viewer is open: the document behind
   the fixed dialog must not scroll under a wheel (this sheet loads after
   base.css, so it outranks body.page-scroll at equal specificity) */
body.mt-viewer-open { overflow: hidden; }
/* flex containers: the hidden attribute must beat display:flex */
.mt-viewer[hidden], .mt-toggle[hidden], .mt-page-date[hidden], .mt-tabs[hidden] { display: none; }
.mt-viewer-bar { display: flex; align-items: center; gap: var(--space-3); padding: 6px 10px; background: var(--color-header-bg); flex-wrap: wrap; }
.mt-viewer-title { flex: 1 1 200px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mt-viewer-nav, .mt-viewer-zoom { display: flex; align-items: center; gap: 6px; }
.mt-viewer-counter { min-width: 100px; text-align: center; font-size: 13px; }
.mt-zoom-label { min-width: 64px; text-align: center; font-size: 13px; }
.mt-vbtn { width: 32px; height: 32px; border: 1px solid #44485a; border-radius: var(--radius-md); background: var(--color-panel-bg); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.mt-vbtn:hover:not(:disabled) { border-color: var(--color-accent); }
.mt-vbtn:disabled { opacity: .4; cursor: default; }
.mt-vbtn:focus-visible { outline: 2px solid var(--color-accent); }
.mt-page-date { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mt-page-date input { padding: 3px 6px; border: 1px solid #44485a; border-radius: var(--radius-md); background: #fff; color: #222; font-size: 13px; }
.mt-page-date-state { font-size: 12px; color: #aab; min-width: 60px; }
.mt-page-date-state.mt-saved { color: #8fd19e; }
.mt-page-date-state.mt-invalid { color: #ff8a80; }
.mt-page-date-view { font-size: 13px; color: #aab; }

.mt-viewer-body { flex: 1; display: flex; min-height: 0; }
.mt-stage { flex: 1; overflow: auto; position: relative; display: flex; align-items: flex-start; justify-content: center; padding: var(--space-3); outline: none; }
.mt-stage.mt-pannable { cursor: grab; }
.mt-stage.mt-panning { cursor: grabbing; user-select: none; }
.mt-page-img { display: block; max-width: none; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.5); -webkit-user-drag: none; }
.mt-page-img[hidden] { display: none; }
.mt-img-msg { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: #2a2d38; border-radius: var(--radius-lg); }
.mt-img-msg[hidden] { display: none; }

.mt-thumbs { width: 132px; overflow-y: auto; padding: var(--space-2); background: #14161c; display: flex; flex-direction: column; gap: var(--space-2); }
.mt-thumb-btn { border: 2px solid transparent; border-radius: var(--radius-md); background: #2a2d38; padding: 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 90px; }
.mt-thumb-btn img { width: 100px; display: block; background: #fff; }
.mt-thumb-btn[aria-current="true"] { border-color: var(--color-accent); }
.mt-thumb-btn:focus-visible { outline: 2px solid var(--color-accent); }
.mt-thumb-num { font-size: 11px; color: #aab; }
.mt-thumb-date { font-size: 10px; color: #8fd19e; }

/* ── phones: tabs scroll, viewer full-screen, strip hidden ── */
@media (max-width: 768px) {
    #mt-page { padding: var(--space-2); }
    .mt-header { flex-direction: column; align-items: flex-start; }
    /* the documents table drops Uploaded / By; the status tables keep every
       column (their 6th / 7th are Next Due, Notes, TSN…) and scroll instead */
    #mt-docs-table th:nth-child(6), #mt-docs-table td:nth-child(6),
    #mt-docs-table th:nth-child(7), #mt-docs-table td:nth-child(7) { display: none; }
    .mt-viewer-bar { gap: var(--space-2); padding: 6px; }
    .mt-viewer-title { flex-basis: 100%; }
    .mt-thumbs { display: none; }
    .mt-stage { padding: 0; }
    .mt-analysis { position: absolute; right: 0; top: 0; bottom: 0; width: min(92vw, 360px); box-shadow: -4px 0 12px rgba(0,0,0,.3); }
    .mt-viewer-body { position: relative; }
}

/* ── "What was read from this page" (the owner's validation panel, M5) ── */
.mt-analysis-toggle { white-space: nowrap; }
.mt-analysis { width: 360px; overflow-y: auto; padding: var(--space-3); background: #fff; color: #223; border-left: 1px solid #d7dde8; font-size: 13px; }
.mt-analysis[hidden] { display: none; }
.mt-analysis-title { margin: 0 0 4px; font-size: 14px; }
.mt-analysis-hint { margin: 0 0 var(--space-3); font-size: 12px; color: #667; }
.mt-analysis-note { color: #667; margin: var(--space-2) 0; }
.mt-analysis-head { margin-bottom: var(--space-3); }
.mt-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: var(--space-2) 0; }
.mt-facts dt { color: #667; font-size: 12px; }
.mt-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.mt-entry { padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2); border: 1px solid #d7dde8; border-radius: var(--radius-md); background: #f9fafc; }
.mt-entry-check { border-color: #b39ddb; background: #faf8fe; }
.mt-entry-title { margin: 0 0 4px; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mt-check-reasons { margin: 4px 0; padding-left: 18px; color: #4527a0; font-size: 12px; }
.mt-actions-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.mt-action { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; border-top: 1px solid #e8ecf2; }
.mt-action-title { font-weight: 600; }
.mt-action-detail { color: #334; }
.mt-action-desc { color: #556; font-size: 12px; }
.mt-action-match { font-size: 12px; color: #1b5e20; }
.mt-action-match.mt-badge-check { display: inline-block; padding: 1px 6px; border-radius: 8px; }
.mt-transcription { margin-top: var(--space-2); font-size: 12px; }
.mt-transcription summary { cursor: pointer; color: #556; }
.mt-transcription pre { white-space: pre-wrap; font: inherit; margin: 4px 0 0; color: #334; }
.mt-page-issues { margin: var(--space-2) 0 0; padding-left: 18px; }
.mt-page-issue { color: var(--color-severity-amber); font-size: 12px; }
.mt-page-issue.mt-issue-resolved, .mt-page-issue.mt-issue-dismissed { color: #889; text-decoration: line-through; }

/* ── Overview + Compliance (the drill-down layout, 2026-10-07). Colours
   follow the owner's compliance sheet: complied green, due soon amber,
   overdue red, optional grey, N/A muted, Check purple. ── */
.ms-block { padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3); }
.ms-h { margin: 0 0 var(--space-2); font-size: 14px; color: #223; }
h4.ms-h { font-size: 13px; margin-top: var(--space-3); }
/* the Overview's aircraft-state block: label over value, a compact grid */
.ms-state { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-2) var(--space-4); margin: 0; }
.ms-state-item { min-width: 0; }
.ms-state dt { font-size: 11px; color: #667; text-transform: uppercase; letter-spacing: .03em; }
.ms-state dd { margin: 0; font-size: 13px; color: #334; }
.ms-state-value { font-size: 16px; font-weight: 600; color: #112; }
.ms-state-unknown .ms-state-value { color: #889; }
.ms-flag { font-size: 12px; color: var(--color-severity-amber); margin-top: 4px; }
.ms-counts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
/* a count chip is a link into the Compliance list filtered to its state */
.ms-count { display: inline-flex; gap: 4px; align-items: baseline; padding: 4px 10px; border-radius: 12px; background: #eef1f6; font-size: 13px; color: inherit; text-decoration: none; }
a.ms-count:hover { box-shadow: 0 0 0 1px currentColor; }
a.ms-count:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.ms-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; background: #eef1f6; color: #334; margin-right: 4px; }
.ms-chip.ms-overdue, .ms-count.ms-overdue { background: #fdecea; color: var(--color-severity-red); }
.ms-chip.ms-due-soon, .ms-count.ms-due-soon { background: #fff3e0; color: var(--color-severity-amber); }
.ms-chip.ms-complied, .ms-count.ms-complied, .ms-chip.ms-ok, .ms-count.ms-ok { background: #e8f5e9; color: var(--color-severity-green); }
.ms-chip.ms-optional, .ms-count.ms-optional { background: #ececec; color: #555; }
.ms-chip.ms-na, .ms-count.ms-na { background: #f2f2f2; color: #889; }
.ms-chip.ms-unknown, .ms-count.ms-unknown { background: #e3ecfa; color: #1565c0; }
/* an on-condition item with no record: neutral, nothing due (no count chip) */
.ms-chip.ms-on-cond { background: #eef1f6; color: #445; }
.ms-oncond-note { margin: 4px 0 0; font-size: 12px; color: #667; }
.ms-why, .ms-basis { font-size: 12px; color: #556; }
.ms-issue { display: flex; gap: var(--space-2); align-items: center; padding: 6px 0; border-top: 1px solid #eef1f6; font-size: 13px; flex-wrap: wrap; }
.ms-issue-kind { font-size: 11px; text-transform: uppercase; color: #667; min-width: 120px; }
.ms-issue-warn .ms-issue-kind { color: var(--color-severity-amber); }
.ms-issue-msg { flex: 1 1 300px; }
.ms-evidence-link, .mc-entry-link { color: var(--color-accent); text-decoration: none; white-space: nowrap; }
.ms-evidence-link:hover, .mc-entry-link:hover { text-decoration: underline; }
/* visually hidden, read by assistive tech (a toggle's separators and its
   "— show details" suffix: the accessible name starts with the visible text) */
.ms-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.ms-sort { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: #223; cursor: pointer; text-align: left; }
.ms-trace { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; color: #334; margin: 4px 0 0; }
.ms-field { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: #334; }
.ms-field input, .ms-field select { padding: 4px 6px; border: 1px solid #c9d2e3; border-radius: var(--radius-md); font-size: 13px; }
@media (max-width: 768px) {
    .ms-state { grid-template-columns: 1fr 1fr; }
}

/* The Compliance toolbar (the search box and the status filter chips) and
   the Equipment one (its search box and match count). */
.mc-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2) var(--space-4); padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.mc-toolbar[hidden] { display: none; }
.mc-search-field { flex: 1 1 220px; max-width: 360px; }
.mc-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.mc-filter { padding: 3px 10px; border: 1px solid #d7dde8; border-radius: 12px; background: #fff; color: #334; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.mc-filter:hover { border-color: var(--color-accent); }
.mc-filter-on, .mc-filter[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }
.mc-filter:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* A folding section (Compliance and Equipment): its heading is a button
   (aria-expanded) over a list of one-line rows. Every line is a grid of
   min-width-0 cells that ellipsize, so the page never scrolls sideways;
   the list may scroll inside its card on a very narrow screen. */
.mc-section { padding: 0; margin-bottom: var(--space-3); overflow: hidden; }
.mc-section-h { margin: 0; font-size: 14px; }
.mc-section-toggle { display: flex; align-items: baseline; gap: 6px; width: 100%; padding: var(--space-2) var(--space-4); background: none; border: 0; font: inherit; font-weight: 600; color: #223; text-align: left; cursor: pointer; }
.mc-section-toggle:hover { background: #f7f9fc; }
.mc-section-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.mc-caret { width: 12px; color: #667; flex: none; }
.mc-count { color: #667; font-weight: 400; }
.mc-section-body { overflow-x: auto; border-top: 1px solid #edf0f5; }
.mc-section-body[hidden] { display: none; }
.mc-empty { margin: 0; padding: var(--space-2) var(--space-4); }
.mc-row { border-bottom: 1px solid #edf0f5; }
.mc-row:last-child { border-bottom: 0; }
.mc-toggle, .me-toggle { display: grid; align-items: baseline; gap: var(--space-3); width: 100%; min-width: 0; padding: 7px var(--space-4); background: none; border: 0; font: inherit; font-size: 13px; color: #223; text-align: left; cursor: pointer; }
.mc-toggle, .mc-head { grid-template-columns: 150px minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1.5fr) 36px; }
.mc-head { display: grid; gap: var(--space-3); padding: 4px var(--space-4); border-bottom: 1px solid #edf0f5; font-size: 11px; color: #667; text-transform: uppercase; letter-spacing: .03em; }
.mc-head span:last-child { text-align: right; }
.mc-toggle:hover, .me-toggle:hover { background: #f7f9fc; }
.mc-toggle:focus-visible, .me-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.mc-chips, .mc-item, .mc-last, .mc-due, .me-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-item { color: #112; }
.mc-last, .mc-due { color: #445; font-size: 12px; }
.mc-clip { color: #556; font-size: 12px; text-align: right; white-space: nowrap; }
.mc-open > .mc-toggle, .mc-open > .me-toggle { background: #f2f5fa; }
.mc-row.ms-overdue > .mc-toggle { background: #fff5f5; }
.mc-row.ms-due-soon > .mc-toggle { background: #fff9ef; }
.mc-row.ms-na > .mc-toggle { color: #889; }
/* the row a link opened (#tab=compliance&item=…) */
.mc-row.mc-target > .mc-toggle { box-shadow: inset 0 2px 0 var(--color-accent), inset 0 -2px 0 var(--color-accent); }
.mc-detail { padding: var(--space-2) var(--space-4) var(--space-3) calc(var(--space-4) + 12px); background: #fbfcfe; border-left: 3px solid var(--color-accent); font-size: 13px; }
.mc-detail[hidden] { display: none; }
.mc-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px var(--space-3); margin: 0 0 var(--space-2); }
.mc-facts dt { color: #556; }
.mc-facts dd { margin: 0; overflow-wrap: anywhere; }
.mc-h { margin: var(--space-2) 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #556; }
.mc-history, .mc-notes, .me-history { list-style: none; margin: 0; padding: 0; }
.mc-record, .me-event { padding: 2px 0; overflow-wrap: anywhere; }
.mc-sep { color: #889; }
.mc-none { margin: 0; }
.mc-faa { margin-top: var(--space-2); }
@media (max-width: 700px) {
    /* two lines per row: status + item, then last done / next due */
    .mc-toggle { grid-template-columns: auto minmax(0, 1fr); row-gap: 2px; }
    .mc-last, .mc-due { grid-column: 1 / -1; }
    .mc-clip, .mc-head { display: none; }
}

/* ── Equipment (ADR 0020 §1, M9; one line per LRU since 2026-10-07): the
   part's name · P/N · S/N, a removed / life-limit chip at the end; the
   unfold holds the life-limit figures and the part's history at its
   position, newest first. ── */
.me-toggle { grid-template-columns: minmax(0, 1fr) auto; }
.me-name { font-weight: 600; color: #112; }
.me-rest { color: #445; }
.me-chips { white-space: nowrap; }
.me-chips .ms-chip { margin: 0 0 0 4px; }
.me-row.me-empty .me-name, .me-row.me-empty .me-rest { color: #778; }
/* the search box's "12 of 81 parts", level with the input */
.me-search-count { align-self: center; padding-top: 14px; }
.me-search-count[hidden] { display: none; }
.me-removed { background: #eef0f4; color: #556; }
.me-llp-figures { margin: var(--space-2) 0; }
.me-event { border-top: 1px solid #edf0f5; }
.me-event:first-child { border-top: 0; }
.me-event-text { color: #223; }
.me-unstated .me-event-text { color: #556; }
.me-more { margin-top: 4px; }
.me-foot p { margin: 0 0 4px; }
.mt-propeller { font-style: italic; font-size: 12px; }

/* the audit log under Documents */
.mt-audit { padding: var(--space-3) var(--space-4); margin-top: var(--space-3); border-left: 3px solid var(--color-accent); }
.mt-audit[hidden] { display: none; }
.mt-audit-link { font-size: 13px; color: var(--color-accent); text-decoration: none; }
.mt-audit-link:hover { text-decoration: underline; }
.mt-audit-link[hidden] { display: none; }
/* ── Logbook (M9): filter row, the table, the pager and the pages-by-date
   groups (year → month <details>, thumbnails per month). ── */
.mt-log-filters { display: flex; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.mt-log-filters .ms-field { min-width: 160px; }
.mt-log-filters[hidden], .mt-log-pages[hidden], .mt-log-pager[hidden], .mt-inbox[hidden] { display: none; }
.mt-logbook th button { white-space: nowrap; }
.mt-log-summary { min-width: 260px; }
.mt-log-summary .ms-chip { margin-left: 6px; }
.mt-log-items { font-size: 12px; min-width: 180px; }
.mt-log-page { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; color: var(--color-accent); text-decoration: none; font-size: 12px; }
.mt-log-page:hover .mt-log-page-label { text-decoration: underline; }
.mt-log-pager { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
/* ADR 0021: one line per maintenance event (no wrapping: the summary
   ellipsizes), folding out to a details row. Fixed layout so a long
   summary can never widen the table. */
.mt-events { table-layout: fixed; width: 100%; }
.mt-events .mt-ev-col-date { width: 96px; }
.mt-events .mt-ev-col-hours { width: 150px; }
.mt-events .mt-ev-col-logbook { width: 150px; }
.mt-events .mt-ev-col-shop { width: 200px; }
tr.mt-ev-row { cursor: pointer; }
tr.mt-ev-row td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
tr.mt-ev-row:hover td { background: #f7f9fc; }
tr.mt-ev-row.mt-ev-open td { background: #f2f5fa; }
.mt-logbook { min-width: 860px; }
/* the entry a #tab=logbook&entry= link opened */
tr.mt-ev-row.mt-ev-target td { box-shadow: inset 0 2px 0 var(--color-accent), inset 0 -2px 0 var(--color-accent); }
/* a flagged (Check) logbook row or action */
tr.ms-flagged td:first-child { border-left: 3px solid #4527a0; }
tr.mt-ev-paper td { color: #445; }
.mt-ev-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mt-ev-toggle { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; flex: 0 1 auto; background: none; border: 0; padding: 0; font: inherit; color: #112; text-align: left; cursor: pointer; }
.mt-ev-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.mt-ev-caret { flex: none; color: #667; width: 10px; }
.mt-ev-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mt-ev-paperwork { flex: none; font-size: 12px; padding: 0 6px; border-radius: 9px; background: #eef1f6; color: #334; }
.mt-ev-dot { flex: none; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #4527a0; cursor: help; }
.mt-ev-linkstate { flex: none; font-size: 11px; padding: 0 6px; border-radius: 9px; background: #fff3e0; color: var(--color-severity-amber); white-space: nowrap; }
p.mt-ev-linkstate { display: inline-block; margin: 0 0 var(--space-2); }
tr.mt-ev-detail[hidden] { display: none; }
tr.mt-ev-detail > td { background: #fbfcfe; border-left: 3px solid var(--color-accent); white-space: normal; padding: var(--space-3) var(--space-4); }
.mt-ev-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-4); }
.mt-ev-h { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #556; }
.mt-ev-transcription { margin: 0 0 var(--space-2); white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: #223; max-height: 320px; overflow-y: auto; }
.mt-ev-meta { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--space-3); margin: 0 0 var(--space-2); font-size: 13px; }
.mt-ev-meta dt { color: #556; }
.mt-ev-meta dd { margin: 0; }
.mt-ev-paper-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.mt-ev-paper-item { display: flex; gap: var(--space-2); align-items: flex-start; padding: 6px; border: 1px solid #e3e7ef; border-radius: var(--radius-md); background: #fff; }
.mt-ev-paper-item.mt-conf-likely { border-style: dashed; }
.mt-ev-paper-link { display: inline-flex; flex-direction: column; gap: 2px; flex: none; width: 150px; color: var(--color-accent); text-decoration: none; font-size: 12px; }
.mt-ev-paper-info { display: flex; flex-direction: column; gap: 2px; font-size: 12px; min-width: 0; }
.mt-ev-paper-info .mt-actions { margin-top: 4px; }
.mt-ev-paper-info .ms-chip { align-self: flex-start; }
.ms-chip.mt-conf-manual { background: #e3ecfa; color: #1565c0; }
.ms-chip.mt-conf-strong { background: #e8f5e9; color: var(--color-severity-green); }
.ms-chip.mt-conf-likely { background: #fff3e0; color: var(--color-severity-amber); }
.mt-ev-attach, .mt-ev-pick, .mt-ev-suggestion { margin-top: var(--space-2); font-size: 13px; }
.mt-ev-attach-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.mt-ev-attach-form[hidden], .mt-ev-attach-btn[hidden] { display: none; }
.mt-ev-pick { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.mt-ev-source { margin-top: var(--space-2); font-size: 12px; }
.mt-ev-actions { min-width: 640px; font-size: 12px; }
.mt-ev-error:empty { display: none; }
@media (max-width: 768px) {
    .mt-ev-cols { grid-template-columns: 1fr; }
}
.mt-log-count { flex: 1; text-align: center; }
.mt-year { padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.mt-year > summary { cursor: pointer; font-weight: 600; color: #223; font-size: 14px; }
.mt-month { margin: var(--space-2) 0 0 var(--space-3); }
.mt-month > summary { cursor: pointer; color: #334; font-size: 13px; }
.mt-page-tiles { display: flex; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-2) 0 var(--space-1); }
.mt-page-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 132px; color: #334; text-decoration: none; font-size: 11px; text-align: center; }
.mt-page-tile img { width: 100px; height: 132px; object-fit: cover; border: 1px solid #d7dde8; border-radius: var(--radius-sm); background: #f2f4f8; }
.mt-page-tile:hover img, .mt-page-tile:focus-visible img { border-color: var(--color-accent); }

/* ── owner inbox on the Documents tab (ADR 0019 §7) ── */
.mt-inbox { padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.mt-inbox > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: #334; }
.mt-inbox-host { padding-top: var(--space-2); }

/* ── header aircraft switcher (M2) ── */
.mt-header-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; justify-content: flex-end; }
.mt-aircraft { padding: 5px 8px; border: 1px solid #ccc; border-radius: var(--radius-md); font-size: 13px; background: #fff; color: #223; max-width: 220px; }
.mt-aircraft:focus { outline: none; border-color: var(--color-accent); }
.mt-aircraft[hidden] { display: none; }

/* ── /maintenance entry page (templates/maintenance_home.html, M2) ── */
#mh-page { padding: var(--space-4) var(--space-3); }
.mh-empty p { margin: 0 0 var(--space-3); color: #334; }
.mh-register { display: inline-block; padding: 7px 14px; border-radius: var(--radius-md); background: var(--color-accent); color: #fff; text-decoration: none; font-size: 13px; }
.mh-register:hover { filter: brightness(1.08); }
.mh-picker[hidden], .mh-filter-wrap[hidden], .mh-cards[hidden] { display: none; }
.mh-filter-wrap { padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.mh-filter-label { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; color: #334; }
.mh-filter { flex: 1 1 200px; padding: 5px 8px; border: 1px solid #ccc; border-radius: var(--radius-md); font-size: 13px; }
.mh-filter:focus { outline: none; border-color: var(--color-accent); }
.mh-section-title { margin: 0 0 var(--space-2); font-size: 14px; color: #556; font-weight: 600; }
.mh-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-3); }
.mh-card { display: block; padding: var(--space-3) var(--space-4); border: 1px solid #d7dde8; border-radius: var(--radius-md); background: #fff; color: #223; text-decoration: none; }
.mh-card:hover, .mh-card:focus-visible { border-color: var(--color-accent); outline: none; }
.mh-card-title { font-size: 16px; font-weight: 600; }
.mh-card-sub { font-size: 12px; color: #667; margin-top: 2px; }
.mh-card-counts { font-size: 12px; color: #334; margin-top: var(--space-2); }
.mh-others { padding: var(--space-2) var(--space-4); }
.mh-others summary { cursor: pointer; font-size: 13px; color: #556; }
.mh-others .mh-cards { padding-top: var(--space-2); margin-bottom: var(--space-1); }

/* ── Reading history, Issues and Audit (ADR 0020 M7): the per-document
   runs card under Documents with its entry diff; the Issues list (same
   .ms-issue rows as the Status summary, plus state and links); the Audit
   table. Rendered with textContent only. ── */
.mt-history { padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3); border-left: 3px solid var(--color-accent); }
.mt-history .mt-docs-toolbar { margin-bottom: var(--space-2); }
.mt-run-current td { background: #f3f8f3; font-weight: 600; }
.mt-history-diff { margin-top: var(--space-2); }
.mt-diff-title { margin-top: var(--space-2); }
.mt-diff-summary { margin: 0 0 var(--space-2); }
.mt-diff-list { list-style: none; margin: 0; padding: 0; }
.mt-diff { padding: 6px 0; border-top: 1px solid #eef1f6; font-size: 13px; }
.mt-diff-kind { display: inline-block; min-width: 72px; margin-right: var(--space-2); padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600; text-transform: uppercase; background: #eef1f6; color: #334; }
.mt-diff-added .mt-diff-kind { background: #e8f5e9; color: var(--color-severity-green); }
.mt-diff-removed .mt-diff-kind { background: #fdecea; color: var(--color-severity-red); }
.mt-diff-changed .mt-diff-kind { background: #fff3e0; color: var(--color-severity-amber); }
.mt-diff-changes { margin: 4px 0 0 84px; padding: 0 0 0 var(--space-3); font-size: 12px; color: #334; }
.mt-issue-meta { font-size: 12px; color: #556; margin-top: 2px; }
.mt-issue-resolved, .mt-issue-dismissed, .mt-issue-unresolved { opacity: .75; }
.mt-issue-resolved .ms-issue-kind, .mt-issue-dismissed .ms-issue-kind { color: #889; }
.mt-undo { margin-left: auto; }

/* ── Issues triage (owner request 2026-10-08): three folding tiers
   (.mc-section, as on Compliance) of cards, one per matter; Record notes
   one .mc-row per document unfolding to its .ms-issue rows. ── */
.mt-triage .mc-section-body > .mt-note { margin: 0; padding: var(--space-2) var(--space-4); font-size: 13px; }
.mt-card { padding: var(--space-3) var(--space-4); border-top: 1px solid #eef1f6; font-size: 13px; min-width: 0; }
.mt-card:first-child { border-top: 0; }
/* the card an issue link opened (#tab=issues&issue=…) */
.mt-card.mt-card-target { box-shadow: inset 3px 0 0 var(--color-accent); background: #f7f9fd; }
.mc-row.mt-card-target > .mc-toggle { box-shadow: inset 0 2px 0 var(--color-accent), inset 0 -2px 0 var(--color-accent); }
.mt-card-title { margin: 0 0 4px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.mt-card-overdue .mt-card-title { color: var(--color-severity-red); }
.mt-card-items, .mt-card-why { list-style: none; margin: 4px 0 0; padding: 0; }
.mt-card-item { display: flex; align-items: baseline; gap: var(--space-2); padding: 1px 0; min-width: 0; }
.mt-card-item-text { min-width: 0; overflow-wrap: anywhere; color: #334; }
.mt-card-why-line { padding: 1px 0 1px 14px; position: relative; color: #334; overflow-wrap: anywhere; }
.mt-card-why-line::before { content: "–"; position: absolute; left: 2px; color: #889; }
.mt-card-resolves { margin: 6px 0 0; font-style: italic; }
.mt-card-links { margin-top: 6px; overflow-wrap: anywhere; }
.mt-card-links .ms-evidence-link { white-space: normal; }
.mt-card .mt-actions, .mt-notes-actions { margin-top: var(--space-2); }
.mt-notes-row .mt-notes-toggle { display: block; white-space: normal; overflow-wrap: anywhere; }
.mt-notes-title { font-weight: 600; color: #112; }
.mt-notes-row .mc-detail .ms-issue:first-of-type { border-top: 0; }
.mt-overview-triage { padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); font-size: 14px; }
/* "No flight data since … — hours-based items may be understated" (Overview, Compliance) */
.mt-gap-caveat { padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); font-size: 14px;
                 border-left: 3px solid #c98a00; color: #6b4a00; }
.mt-needs-you-link { color: var(--color-accent); text-decoration: none; font-weight: 600; }
.mt-needs-you-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.mt-needs-you-some { color: var(--color-severity-amber); }
.mt-audit-rows td { vertical-align: top; }
.mt-audit-change { max-width: 480px; white-space: normal; word-break: break-word; font-size: 12px; color: #334; }
.mt-audit-system td:nth-child(2) { color: #667; font-style: italic; }
@media (max-width: 768px) {
    .mt-diff-changes { margin-left: var(--space-3); }
}
.mt-diff-status-title { margin-top: var(--space-2); }
.mt-diff-status-list { margin: 0 0 var(--space-2); padding-left: var(--space-4); font-size: 13px; color: #334; }
