/* Lifting order (public schedule + director preview) and the MeetNav "Lifting order" pill.
   Loaded after platform.css (see App.razor). Everything is mp-lo-* over the existing --mp-* tokens; the markup is plain
   semantic HTML (details/table), so layout, the mobile card transformation and the print view are all CSS.

   Contracts this file honours:
     * 390px: no page-level horizontal scroll. Below 760px (screen only) table rows become labelled cards, using the
       cell's data-label via ::before — no JavaScript.
     * Touch targets >= 44px for every control (buttons, inputs, selects, flight summaries, checkboxes).
     * Visible keyboard focus on every interactive element.
     * Everything is rem/fr based, so 200% zoom (which also narrows the CSS viewport) just takes the card layout.
     * Print: nav/filters/buttons hidden, metadata block + "Printed view" line shown, light palette, flights expanded
       (lifting-order.js opens every <details> first) and kept whole where the browser can. The mobile rules are
       SCREEN-only: an A4 page is ~700 CSS px wide and must keep the table layout. */

/* ---- MeetNav: Lifting order pill beside the staff strip --------------------------------------------------------- */
.mp-meet-navwrap { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.6rem; margin-bottom: 1.25rem; }
.mp-meet-navwrap > .mp-meet-nav { margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
.mp-meet-subnav {
    background: var(--mp-surface); border: 1px solid var(--mp-border); border-radius: 10px;
    padding: 0.6rem 1rem; align-items: center; align-self: stretch;
}
.mp-meet-subnav a { padding: 0.15rem 0; }
.mp-meet-subnav a.active { color: var(--mp-accent); border-bottom: 2px solid var(--mp-accent); }

/* ---- Page shell ------------------------------------------------------------------------------------------------- */
.mp-lo-page { min-width: 0; }
.mp-lo-page :where(a, button, input, select, summary):focus-visible {
    outline: 3px solid var(--mp-accent); outline-offset: 2px; border-radius: 6px;
}
.mp-lo-btn { box-sizing: border-box; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-align: center; }

.mp-lo-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: 0.5rem 0 1rem; }
.mp-lo-head-main { min-width: 0; }
.mp-lo-head h1 { margin: 0.2rem 0 0.4rem; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.mp-lo-meet-name { margin: 0.15rem 0; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.mp-lo-meet-meta { margin: 0.15rem 0 0; overflow-wrap: anywhere; }
.mp-lo-head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.mp-lo-notice {
    margin: 1rem 0; padding: 0.9rem 1.1rem; border: 1px solid var(--mp-border); border-left: 4px solid var(--mp-accent);
    border-radius: 8px; background: color-mix(in srgb, var(--mp-accent) 8%, var(--mp-surface));
}
.mp-lo-notice p { margin: 0.35rem 0 0; color: var(--mp-muted); }

.mp-lo-status { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin: 1rem 0; font-size: 0.9rem; color: var(--mp-muted); }
.mp-lo-status-state { color: var(--mp-good); font-weight: 700; }

.mp-lo-stats { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; padding: 0; list-style: none; }
.mp-lo-stats li { background: var(--mp-surface); border: 1px solid var(--mp-border); border-radius: 9px; padding: 0.45rem 0.9rem; font-size: 0.85rem; }
.mp-lo-stats b { font-size: 1.15rem; margin-right: 0.3rem; }

/* ---- Filters (plain GET form) ----------------------------------------------------------------------------------- */
.mp-lo-filters {
    display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; gap: 0.9rem; align-items: end;
    margin: 1rem 0; padding: 1rem 1.1rem; background: var(--mp-surface); border: 1px solid var(--mp-border); border-radius: 12px;
}
.mp-lo-field { min-width: 0; }
.mp-lo-field label { display: block; margin-bottom: 0.3rem; font-size: 0.78rem; font-weight: 700; color: var(--mp-muted); }
.mp-lo-field input, .mp-lo-field select {
    box-sizing: border-box; width: 100%; min-height: 44px; padding: 0.5rem 0.7rem; font: inherit;
    color: var(--mp-text); background: var(--mp-control-bg); border: 1px solid var(--mp-control-border); border-radius: 8px;
}
.mp-lo-filter-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---- Schedule --------------------------------------------------------------------------------------------------- */
.mp-lo-count { margin: 0.75rem 0; color: var(--mp-muted); }
.mp-lo-filter-note { margin: 0 0 1rem; padding: 0.55rem 0.8rem; border-radius: 8px; font-size: 0.88rem; color: var(--mp-muted); background: var(--mp-surface); border: 1px dashed var(--mp-border); }

.mp-lo-empty { text-align: center; padding: 2rem 1rem; }
.mp-lo-empty h2 { margin-top: 0; font-size: 1.3rem; }
.mp-lo-state { text-align: center; padding: 2rem 1rem; }
.mp-lo-state h2 { margin-top: 0; font-size: 1.3rem; }

.mp-lo-day { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem; margin: 1.8rem 0 0.8rem; font-size: 1.3rem; }
.mp-lo-day-label { font-size: 0.85rem; font-weight: 600; color: var(--mp-muted); }

.mp-lo-session {
    display: grid; grid-template-columns: 11rem minmax(0, 1fr); grid-template-areas: "time head" "time flights";
    column-gap: 1.4rem; margin-bottom: 1.6rem;
}
.mp-lo-session-name {
    grid-area: head; margin: 0; padding: 0.9rem 1.1rem; font-size: 1.1rem; overflow-wrap: anywhere;
    background: var(--mp-surface); border: 1px solid var(--mp-border); border-bottom: 0; border-radius: 12px 12px 0 0;
}
.mp-lo-time { grid-area: time; padding-top: 0.6rem; min-width: 0; }
.mp-lo-time-eyebrow { display: block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; color: var(--mp-muted); }
.mp-lo-time-value { display: block; margin: 0.15rem 0; font-size: 1.9rem; line-height: 1.1; letter-spacing: -0.02em; }
.mp-lo-time-tbc { font-size: 1.5rem; }
.mp-lo-time-zone { display: block; font-size: 0.85rem; color: var(--mp-muted); }

.mp-lo-flights { grid-area: flights; min-width: 0; background: var(--mp-surface); border: 1px solid var(--mp-border); border-radius: 0 0 12px 12px; overflow: hidden; }
.mp-lo-noflights { margin: 0; padding: 1rem 1.1rem; }
.mp-lo-flight + .mp-lo-flight { border-top: 1px solid var(--mp-border); }
.mp-lo-flight > summary {
    box-sizing: border-box; min-height: 44px; padding: 0.7rem 1.1rem; cursor: pointer;
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 1rem; background: var(--mp-surface-2); font-weight: 700;
}
.mp-lo-flight-meta { font-weight: 400; color: var(--mp-muted); }

.mp-lo-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mp-lo-table thead th:nth-child(1) { width: 30%; }
.mp-lo-table thead th:nth-child(2), .mp-lo-table thead th:nth-child(3) { width: 24%; }
.mp-lo-table th, .mp-lo-table td { padding: 0.65rem 1.1rem; text-align: left; vertical-align: middle; border-top: 1px solid var(--mp-border); overflow-wrap: anywhere; }
.mp-lo-table thead th { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--mp-muted); }
.mp-lo-table tbody th.mp-lo-lifter { font-weight: 700; }

/* Contract 2.6.0: a retained "not competing" row. The name is struck through (<del>) AND carries a visible text label,
   so the state never relies on colour or line-through alone. */
.mp-lo-not-competing th.mp-lo-lifter del { text-decoration-thickness: 2px; color: var(--mp-muted); }
.mp-lo-status-note {
    display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border: 1px dashed currentColor;
    border-radius: 6px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; color: var(--mp-muted);
}
.mp-lo-not-competing td { color: var(--mp-muted); }

/* Tested status: always TEXT, and three distinct border styles so it never relies on colour alone. */
.mp-lo-badge {
    display: inline-block; padding: 0.1rem 0.55rem; border-radius: 6px; border: 1px solid; font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.mp-lo-badge.tested { color: var(--mp-good); border-style: solid; background: color-mix(in srgb, var(--mp-good) 12%, transparent); }
.mp-lo-badge.untested { color: var(--mp-accent); border-style: dashed; }
.mp-lo-badge.unknown { color: var(--mp-muted); border-style: dotted; }

.mp-lo-footer { margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--mp-border); font-size: 0.85rem; color: var(--mp-muted); }

/* ---- Director page ---------------------------------------------------------------------------------------------- */
.mp-lo-card h2 { margin-top: 0; font-size: 1.15rem; }
.mp-lo-flash { margin: 0 0 1rem; padding: 0.8rem 1rem; border: 1px solid var(--mp-border); border-left-width: 4px; border-radius: 8px; background: var(--mp-surface); overflow-wrap: anywhere; }
.mp-lo-flash.good { border-left-color: var(--mp-good); }
.mp-lo-flash.warn { border-left-color: var(--mp-accent); }
.mp-lo-flash.bad { border-left-color: var(--mp-nolift); }

.mp-lo-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: 0.6rem; margin: 0 0 1rem; }
.mp-lo-counts div { padding: 0.6rem 0.8rem; background: var(--mp-surface-2); border: 1px solid var(--mp-border); border-radius: 8px; }
.mp-lo-counts dt { font-size: 0.78rem; font-weight: 600; color: var(--mp-muted); }
.mp-lo-counts dd { margin: 0.1rem 0 0; font-size: 1.5rem; font-weight: 800; }

.mp-lo-issues { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.6rem; }
.mp-lo-issue { padding: 0.7rem 0.9rem; border: 1px solid var(--mp-border); border-left-width: 4px; border-radius: 8px; }
.mp-lo-issue p { margin: 0.2rem 0; overflow-wrap: anywhere; }
.mp-lo-issue.error { border-left-color: var(--mp-nolift); }
.mp-lo-issue.warning { border-left-color: var(--mp-accent); }
.mp-lo-issue.info { border-left-color: var(--mp-info); }
.mp-lo-sev { display: inline-block; margin-right: 0.4rem; padding: 0 0.45rem; border: 1px solid currentColor; border-radius: 5px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.mp-lo-sev.error { color: var(--mp-nolift); }
.mp-lo-sev.warning { color: var(--mp-accent); }
.mp-lo-sev.info { color: var(--mp-muted); }

.mp-lo-changelist, .mp-lo-how { margin: 0.4rem 0 0.8rem; padding-left: 1.2rem; }
.mp-lo-how { color: var(--mp-muted); }
.mp-lo-check { display: flex; align-items: flex-start; gap: 0.6rem; min-height: 44px; padding: 0.4rem 0; cursor: pointer; }
.mp-lo-check input { flex: none; width: 1.4rem; height: 1.4rem; margin-top: 0.1rem; }
.mp-lo-form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.6rem 0; }
.mp-lo-preview { margin: 1.5rem 0; }
.mp-lo-preview-title { font-size: 1.3rem; }
.mp-lo-tablewrap { max-width: 100%; overflow-x: auto; }

/* ---- Print-only blocks are hidden on screen --------------------------------------------------------------------- */
.mp-lo-printmeta, .mp-lo-printline { display: none; }

/* ---- Mobile (screen only): table rows become labelled cards ----------------------------------------------------- */
@media screen and (max-width: 760px) {
    .mp-lo-filters { grid-template-columns: minmax(0, 1fr); }
    .mp-lo-filter-actions .mp-lo-btn { flex: 1 1 8rem; }
    .mp-lo-head-actions { width: 100%; }
    .mp-lo-head-actions .mp-lo-btn { flex: 1 1 auto; }

    .mp-lo-session { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "time" "flights"; }
    .mp-lo-session-name { border-bottom: 1px solid var(--mp-border); border-radius: 12px; margin-bottom: 0.4rem; padding: 0.8rem 1rem; font-size: 1.05rem; }
    .mp-lo-time { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; padding: 0 0.1rem 0.5rem; }
    .mp-lo-time-eyebrow { flex: 1 0 100%; }
    .mp-lo-time-value { display: inline; font-size: 1.6rem; }
    .mp-lo-time-zone { display: inline; }
    .mp-lo-flights { border-radius: 12px; }
    .mp-lo-flight > summary { padding: 0.7rem 1rem; }
    .mp-lo-flight-meta { flex: 1 0 100%; }

    .mp-lo-table, .mp-lo-table tbody, .mp-lo-table tr, .mp-lo-table th, .mp-lo-table td { display: block; }
    .mp-lo-table thead {
        position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .mp-lo-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.45rem 0.9rem; padding: 0.75rem 1rem; border-top: 1px solid var(--mp-border); }
    .mp-lo-table th, .mp-lo-table td { padding: 0; border: 0; font-size: 0.9rem; }
    .mp-lo-table tbody th.mp-lo-lifter { grid-column: 1 / -1; font-size: 1.05rem; }
    .mp-lo-table td::before {
        content: attr(data-label); display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mp-muted);
    }
    .mp-lo-table td[data-label="Tested status"] { grid-column: 1 / -1; }
    .mp-lo-table td[data-label="Tested status"] .mp-lo-badge { margin-top: 0.15rem; }
}

/* ---- Print ------------------------------------------------------------------------------------------------------ */
@media print {
    html, body { background: #fff !important; color: #000 !important; }
    .mp-navbar, .mp-meet-navwrap, .mp-lo-noprint, .mp-lo-filters, .mp-lo-btn, #blazor-error-ui,
    .mp-lo-manage .mp-lo-card { display: none !important; }
    .mp-container { padding: 0 !important; max-width: none !important; }

    /* Re-point the dark tokens at a paper palette for this page only. */
    .mp-lo-page {
        --mp-surface: #fff; --mp-surface-2: #f1f1f1; --mp-border: #8a8a8a; --mp-text: #000; --mp-muted: #333;
        --mp-accent: #000; --mp-good: #000; --mp-control-bg: #fff;
        color: #000; font-size: 10.5pt;
    }
    .mp-lo-page a { color: #000; text-decoration: none; }
    .mp-lo-head h1 { font-size: 20pt; }
    .mp-lo-notice { background: #fff; border-color: #000; break-inside: avoid; }
    .mp-lo-status-state { color: #000; }
    .mp-lo-stats li { background: #fff; }

    .mp-lo-printmeta {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.15rem 1.5rem; margin: 0.4rem 0 0.8rem; padding-bottom: 0.5rem;
        border-bottom: 1px solid #000;
    }
    .mp-lo-printmeta div { display: flex; gap: 0.5rem; }
    .mp-lo-printmeta dt { font-weight: 700; }
    .mp-lo-printmeta dt::after { content: ":"; }
    .mp-lo-printmeta dd { margin: 0; }
    .mp-lo-printline { display: block; margin: 0.4rem 0 0.6rem; font-weight: 700; }

    .mp-lo-day { break-after: avoid; margin-top: 1rem; }
    .mp-lo-session { break-inside: auto; margin-bottom: 1rem; column-gap: 1rem; grid-template-columns: 8.5rem minmax(0, 1fr); }
    .mp-lo-session-name { break-after: avoid; background: #fff; border-bottom: 1px solid #000; border-radius: 0; border-color: #000; }
    .mp-lo-time { break-after: avoid; }
    .mp-lo-time-value { font-size: 16pt; }
    .mp-lo-flights { border-radius: 0; border-color: #000; overflow: visible; }
    .mp-lo-flight { break-inside: avoid; }
    .mp-lo-flight > summary { background: #f1f1f1; border-bottom: 1px solid #000; }
    .mp-lo-flight > summary::-webkit-details-marker { display: none; }
    .mp-lo-flight > summary { list-style: none; }
    .mp-lo-table th, .mp-lo-table td { padding: 0.3rem 0.7rem; }
    .mp-lo-table tr { break-inside: avoid; }
    .mp-lo-badge { border-color: #000; background: transparent !important; color: #000 !important; }
    .mp-lo-footer { color: #000; border-color: #000; }
}
