/* ---- V1.74 Fleet and Equipment Performance (flt-): Client\Apps\Fleet (FleetPage, mockup 31). Design system tokens only (--os-*), full page
   width; a new app file: every design guard at zero (DesignGuardTests.ZeroTolerance). The time model's colours: working good, operating
   delays warn, standby neutral, down scheduled the bad ground dashed, down unscheduled bad; the haul cycle's seven segments the chart hues. ---- */

.flt-mono { font-family: var(--os-font-mono); }
.flt-wrap { overflow-wrap: anywhere; min-width: 10ch; }
.flt-table td.flt-wrap { white-space: normal; } /* (os-table cells are nowrap: without it the column cannot narrow) */
.flt-clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.flt-warn { color: var(--os-warn-text); font-weight: 600; }
.flt-bad { color: var(--os-bad-text); font-weight: 600; }
.flt-down { color: var(--os-bad-text); font-weight: 600; }
.flt-spacer { flex: 1; }
.flt-rule { color: var(--os-text-3); }
.flt-feed { display: inline-flex; align-items: center; gap: var(--os-space-1); }
.flt-feed .mud-icon-root { color: var(--os-good); }

/* The grid: columns whose panels stack (no gap beside a tall panel), stretched to the row's height */
.flt-col { --span: 4; display: flex; flex-direction: column; gap: var(--os-gutter); min-width: 0; }
.flt-col.flt-col--3 { --span: 3; }
.flt-col.flt-col--5 { --span: 5; }
.flt-col.flt-col--6 { --span: 6; }
.flt-col.flt-col--7 { --span: 7; }
.flt-col.flt-col--8 { --span: 8; }
.flt-ovgrid { margin-top: var(--os-gutter); align-items: stretch; }
.flt-ovgrid > .flt-col > :last-child { flex: 1 1 auto; }
.flt-block { margin-top: var(--os-gutter); }
.flt-page .os-panel--flush > .os-panel__foot { margin: 0; flex-wrap: wrap; }

/* Legends and swatches */
.flt-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--os-space-2) var(--os-space-3); font: var(--os-type-caption); color: var(--os-text-2); }
.flt-legend > span { display: inline-flex; align-items: center; gap: var(--os-space-1); }
.flt-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--os-border-strong); flex: none; }
.flt-sw.is-good, .flt-sw.is-work { background: var(--os-good); }
.flt-sw.is-warn, .flt-sw.is-delay { background: var(--os-warn); }
.flt-sw.is-standby { background: var(--os-neutral); }
.flt-sw.is-sched { background: var(--os-bad-soft); border: 1px dashed var(--os-bad); }
.flt-sw.is-down { background: var(--os-bad); }
.flt-sw.is-s1 { background: var(--os-chart-1); }
.flt-sw.is-s2 { background: var(--os-chart-2); }
.flt-sw.is-s3 { background: var(--os-chart-3); }
.flt-sw.is-s4 { background: var(--os-chart-4); }
.flt-sw.is-s5 { background: var(--os-chart-5); }
.flt-sw.is-s6 { background: var(--os-chart-6); }
.flt-sw.is-s7 { background: var(--os-chart-7); }
.flt-tick { display: inline-block; width: 2px; height: 12px; background: var(--os-chart-target); }
.flt-line { display: inline-block; width: 16px; border-top: 2px solid var(--os-chart-1); }
.flt-line.is-c2 { border-top-color: var(--os-chart-2); }
.flt-line.is-c3 { border-top-color: var(--os-chart-3); }
.flt-delta { font: var(--os-type-caption); }
.flt-delta.is-good { color: var(--os-good-text); }
.flt-delta.is-bad { color: var(--os-bad-text); }

/* Availability, utilization and OEE by class */
.flt-classes { display: grid; gap: var(--os-space-2); width: 100%; }
.flt-classes__head, .flt-classes__row, .flt-classes__axis { display: grid; grid-template-columns: minmax(150px, 1.1fr) repeat(3, minmax(0, 1fr)); gap: var(--os-space-4); align-items: center; }
.flt-classes__head { font: var(--os-type-caption); color: var(--os-text-2); }
.flt-classes__head small { color: var(--os-text-3); }
.flt-classes__name { display: grid; min-width: 0; }
.flt-classes__axis { font: var(--os-type-caption); color: var(--os-text-3); }
.flt-classes__axis > span { display: flex; justify-content: space-between; }
.flt-classes__axis i { font-style: normal; }
.flt-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--os-space-2); align-items: center; min-width: 0; }
.flt-bar__track { position: relative; display: block; height: 10px; border-radius: 3px; background: var(--os-surface-sunken); }
.flt-bar__fill { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 3px; background: var(--os-good); }
.flt-bar__fill.is-warn { background: var(--os-warn); }
.flt-bar__fill.is-neutral { background: var(--os-neutral); }
.flt-bar__tick { position: absolute; top: -3px; bottom: -3px; left: var(--x); width: 2px; background: var(--os-chart-target); }
.flt-bar__text { display: grid; justify-items: end; min-width: 9ch; }
.flt-bar__text b.is-warn { color: var(--os-warn-text); }
.flt-hbar { display: grid; grid-template-columns: minmax(80px, 1fr) 6ch; gap: var(--os-space-2); align-items: center; }
.flt-hbar > b { text-align: right; font-variant-numeric: tabular-nums; }

/* The strips of figures under a panel */
.flt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--os-space-3); margin: 0; width: 100%; }
.flt-stats > div { display: grid; gap: var(--os-space-1); }
.flt-stats dt { font: var(--os-type-kpi-sm); color: var(--os-text); }
.flt-stats dd { margin: 0; font: var(--os-type-caption); color: var(--os-text-2); }
.flt-stats > div.is-warn dt { color: var(--os-warn-text); }
.flt-stats > div.is-bad dt { color: var(--os-bad-text); }
.flt-stats--model { margin-top: var(--os-space-4); padding-top: var(--os-space-3); border-top: var(--os-border-w) solid var(--os-border-subtle); }

/* The time usage model: the levels that add up, then the one bar */
.flt-model { display: grid; gap: var(--os-space-2); }
.flt-model__level { display: flex; gap: 2px; font: var(--os-type-caption); color: var(--os-text-2); }
.flt-model__seg { flex: 0 0 var(--w); min-width: 0; padding: var(--os-space-1) 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flt-model__seg b { color: var(--os-text); font-weight: 600; }
.flt-model__seg.is-cal { border-top: 2px solid var(--os-border-strong); }
.flt-model__seg.is-line { border-top: 2px solid var(--os-border-strong); }
.flt-model__seg.is-down { border-top-color: var(--os-bad); }
.flt-model__seg.is-gap { border-top: 0; }
.flt-model__bar { display: flex; height: 44px; border-radius: var(--os-radius-md); overflow: hidden; background: var(--os-surface-sunken); }
.flt-model__part { flex: 0 0 var(--w); display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0 var(--os-space-2); color: var(--os-on-good); font: var(--os-type-caption); overflow: hidden; white-space: nowrap; }
.flt-model__part b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.flt-model__part.is-work { background: var(--os-good); }
.flt-model__part.is-delay { background: var(--os-warn); color: var(--os-on-warn); }
.flt-model__part.is-standby { background: var(--os-neutral); color: var(--os-on-neutral); }
.flt-model__part.is-sched { background: var(--os-bad-soft); color: var(--os-bad-text); border: 1px dashed var(--os-bad); }
.flt-model__part.is-down { background: var(--os-bad); color: var(--os-on-bad); }
.flt-model__notes { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--os-space-2); }

.flt-reasons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--os-space-4); margin-top: var(--os-space-4); }
.flt-reasons__col { display: grid; gap: var(--os-space-1h); align-content: start; min-width: 0; }
.flt-reasons__head { display: flex; justify-content: space-between; gap: var(--os-space-2); font-weight: 600; }
.flt-reasons__head > span:first-child { display: inline-flex; align-items: center; gap: var(--os-space-1); }
.flt-reasons__row { display: grid; grid-template-columns: minmax(0, 1fr) auto 70px; gap: var(--os-space-2); align-items: center; font: var(--os-type-caption); color: var(--os-text-2); }
.flt-reasons__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flt-reasons__h { font-variant-numeric: tabular-nums; }
.flt-reasons__bar { display: block; height: 4px; border-radius: 2px; background: var(--os-surface-sunken); }
.flt-reasons__bar > i { display: block; width: var(--w); height: 100%; border-radius: 2px; background: var(--os-bad); }
.flt-reasons__bar > i.is-standby { background: var(--os-neutral); }
.flt-reasons__bar > i.is-delay { background: var(--os-warn); }
.flt-reasons__bar > i.is-sched { background: var(--os-bad-soft); border: 1px dashed var(--os-bad); }
.flt-reasons--links { margin-top: var(--os-space-2); }
.flt-reasons--links a { display: inline-flex; align-items: center; gap: var(--os-space-1); color: var(--os-accent-text); }

.flt-byclass-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--os-space-2); margin-top: var(--os-space-5); padding-top: var(--os-space-3); border-top: var(--os-border-w) solid var(--os-border-subtle); }
.flt-byclass { display: grid; gap: var(--os-space-2); margin-top: var(--os-space-2); }
.flt-byclass__row { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) minmax(130px, auto); gap: var(--os-space-3); align-items: center; }
.flt-byclass__bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--os-surface-sunken); }
.flt-byclass__bar > i { flex: 0 0 var(--w); }
.flt-byclass__bar > i.is-work { background: var(--os-good); }
.flt-byclass__bar > i.is-delay { background: var(--os-warn); }
.flt-byclass__bar > i.is-standby { background: var(--os-neutral); }
.flt-byclass__bar > i.is-sched { background: var(--os-bad-soft); }
.flt-byclass__bar > i.is-down { background: var(--os-bad); }
.flt-byclass__au { text-align: right; font-variant-numeric: tabular-nums; }
.flt-byclass__legend { width: 100%; margin-top: var(--os-space-2); }

/* Needs attention now */
.flt-alist { list-style: none; margin: 0; padding: 0; }
.flt-alist li { display: flex; align-items: flex-start; gap: var(--os-space-3); padding: var(--os-space-3) var(--os-space-4); border-top: var(--os-border-w) solid var(--os-border-subtle); }
.flt-alist li:first-child { border-top: 0; }
.flt-alist li > div { display: grid; gap: var(--os-space-1); flex: 1; min-width: 0; }
.flt-alist__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--os-space-2); min-width: 0; overflow-wrap: anywhere; }
.flt-alist__icon { display: inline-flex; padding: var(--os-space-1h); border-radius: var(--os-radius-md); background: var(--os-neutral-soft); color: var(--os-neutral-text); flex: none; }
.flt-alist__icon--warn { background: var(--os-warn-soft); color: var(--os-warn-text); }
.flt-alist__icon--bad { background: var(--os-bad-soft); color: var(--os-bad-text); }
.flt-alist__icon--info { background: var(--os-info-soft); color: var(--os-info-text); }
.flt-alist__icon--good { background: var(--os-good-soft); color: var(--os-good-text); }
.flt-alist--phone li { padding: var(--os-space-2) 0; }
.flt-attention .os-panel__foot .os-spacer { flex: 1; }

/* Tables */
.flt-table th { white-space: normal; height: auto; padding-top: var(--os-space-2); padding-bottom: var(--os-space-2); }
.flt-table td { vertical-align: top; }
.flt-table .flt-col-bar { min-width: 180px; }
.flt-num { width: 9ch; text-align: right; }
.flt-units tr.is-down td:first-child { border-left: 3px solid var(--os-bad); }
.flt-state { display: inline-flex; align-items: center; gap: var(--os-space-1); white-space: nowrap; }
.flt-dot2 { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--os-neutral); flex: none; }
.flt-dot2.is-work { background: var(--os-good); }
.flt-dot2.is-delay { background: var(--os-warn); }
.flt-dot2.is-sched { background: var(--os-bad-soft); border: 1px solid var(--os-bad); }
.flt-dot2.is-down { background: var(--os-bad); }
.flt-link { display: inline-flex; align-items: center; gap: var(--os-space-1); color: var(--os-accent-text); white-space: nowrap; }
/* The units' last column: a long link ("Dans Temps d'arrêt", "Demande de travail ...") wraps rather than going past the panel */
.flt-units .flt-link { display: inline; white-space: normal; }
.flt-units th:last-child, .flt-units td:last-child { width: 17ch; min-width: 17ch; white-space: normal; }
.flt-units .flt-link > i { display: inline-flex; vertical-align: -3px; margin-right: 4px; }

/* Haul cycle breakdown */
.flt-cycles__legend { margin-bottom: var(--os-space-3); }
.flt-cycles { display: grid; gap: var(--os-space-2); }
.flt-cycles__row, .flt-cycles__axis { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr) 5ch; gap: var(--os-space-2); align-items: center; }
.flt-cycles__row.is-avg { padding-top: var(--os-space-2); border-top: var(--os-border-w) solid var(--os-border-subtle); }
.flt-cycles__name { display: grid; min-width: 0; }
.flt-cycles__name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flt-cycles__bar { position: relative; display: flex; height: 20px; border-radius: 3px; background: var(--os-surface-sunken); }
.flt-cycles__bar > i { flex: 0 0 var(--w); overflow: hidden; color: var(--os-on-good); font: var(--os-type-caption); font-style: normal; text-align: center; line-height: 20px; }
.flt-cycles__bar > i.is-s1 { background: var(--os-chart-1); }
.flt-cycles__bar > i.is-s2 { background: var(--os-chart-2); }
.flt-cycles__bar > i.is-s3 { background: var(--os-chart-3); }
.flt-cycles__bar > i.is-s4 { background: var(--os-chart-4); }
.flt-cycles__bar > i.is-s5 { background: var(--os-chart-5); }
.flt-cycles__bar > i.is-s6 { background: var(--os-chart-6); }
.flt-cycles__bar > i.is-s7 { background: var(--os-chart-7); }
.flt-cycles__bar > i.flt-cycles__tick { position: absolute; top: -3px; bottom: -3px; left: var(--x); width: 2px; flex: none; background: var(--os-chart-target); }
.flt-cycles__total { text-align: right; font-variant-numeric: tabular-nums; }
.flt-cycles__axis { font: var(--os-type-caption); color: var(--os-text-3); }
.flt-cycles__axis > span:nth-child(2) { position: relative; height: 1.4em; }
.flt-cycles__axis i { position: absolute; left: var(--x); transform: translateX(-50%); font-style: normal; }

/* The SVG charts */
.flt-chart { width: 100%; }
.flt-svg { display: block; width: 100%; height: auto; overflow: visible; }
.flt-svg--phone { max-height: 140px; }
.flt-grid { stroke: var(--os-chart-grid); stroke-width: 1; }
.flt-axis { font: var(--os-type-caption); fill: var(--os-chart-label); }
.flt-axis.is-strong { fill: var(--os-text); font-weight: 600; }
.flt-hist { fill: var(--os-neutral); }
.flt-hist.is-warn { fill: var(--os-warn); }
.flt-hist.is-bad { fill: var(--os-bad); }
.flt-band.is-warn { fill: var(--os-warn-soft); }
.flt-band.is-bad { fill: var(--os-bad-soft); }
.flt-target { stroke: var(--os-chart-target); stroke-width: 1.5; stroke-dasharray: 5 4; }
.flt-limit { stroke-width: 1.5; stroke-dasharray: 3 3; }
.flt-limit.is-warn { stroke: var(--os-warn); }
.flt-limit.is-bad { stroke: var(--os-bad); }
.flt-shift { fill: var(--os-chart-shift); opacity: 0.35; }
.flt-shift.is-night { opacity: 0.7; }
.flt-path { fill: none; stroke: var(--os-chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.flt-path.is-c2 { stroke: var(--os-chart-2); }
.flt-path.is-c3 { stroke: var(--os-chart-3); }
.flt-dot { fill: var(--os-chart-1); }
.flt-dot.is-c2 { fill: var(--os-chart-2); }
.flt-dot.is-c3 { fill: var(--os-chart-3); }

/* Where the data comes from */
.flt-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--os-space-4); width: 100%; }
.flt-source { display: flex; gap: var(--os-space-3); min-width: 0; }
.flt-source > div { display: grid; gap: var(--os-space-1); min-width: 0; }
.flt-source__icon { display: inline-flex; align-self: flex-start; padding: var(--os-space-1h); border-radius: var(--os-radius-md); background: var(--os-warn-soft); color: var(--os-warn-text); }
.flt-source__title { font-weight: 600; color: var(--os-text); }
.flt-source__status { display: inline-flex; align-items: center; gap: var(--os-space-1); font: var(--os-type-caption); color: var(--os-text-2); }
.flt-rules { margin: 0; padding-left: var(--os-space-5); display: grid; gap: var(--os-space-1); color: var(--os-text-2); }

/* Dialogs */
.flt-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--os-space-4); background: var(--os-scrim); }
.flt-dialog { width: min(520px, 100%); }

/* The phone: My unit and Fleet now */
.flt-phone-only { display: none; }
.flt-my { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--os-space-3); }
.flt-my__pick { display: grid; gap: var(--os-space-1); }
.flt-my__feed { display: flex; align-items: center; gap: var(--os-space-1); margin: 0; }
/* Two buttons side by side; a longer French label wraps inside its button rather than widening the phone's page */
.flt-my__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--os-space-2); }
.flt-my__actions > .os-btn { justify-content: center; min-width: 0; white-space: normal; height: auto; min-height: 40px; text-align: center; }
.flt-shiftbar { position: relative; height: 12px; border-radius: 3px; background: var(--os-surface-sunken); overflow: hidden; }
/* Dark: the bar sits on the page, and the sunken well is the Night canvas itself (#1F1B18): the track takes the neutral rule instead,
   so the shift's empty part shows (owner 2026-11-16) */
:root[data-theme="dark"] .flt-shiftbar { background: var(--os-neutral-border); }
.flt-shiftbar > i { position: absolute; top: 0; bottom: 0; left: var(--x); width: var(--w); background: var(--os-neutral); }
.flt-shiftbar > i.is-work { background: var(--os-good); }
.flt-shiftbar > i.is-delay { background: var(--os-warn); }
.flt-shiftbar > i.is-sched { background: var(--os-bad-soft); }
.flt-shiftbar > i.is-down { background: var(--os-bad); }
.flt-shiftbar__legend { display: flex; justify-content: space-between; gap: var(--os-space-2); flex-wrap: wrap; }
.flt-card { display: grid; gap: var(--os-space-2); padding: var(--os-space-3) var(--os-space-4); border: var(--os-border-w) solid var(--os-border); border-radius: var(--os-radius-lg); background: var(--os-surface-raised); }
.flt-card--ai { border-left: 3px solid var(--os-accent); }
.flt-card__head { display: flex; align-items: center; gap: var(--os-space-2); justify-content: space-between; }
.flt-card__title { margin: 0; font: var(--os-type-h3); color: var(--os-text); }
.flt-card__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--os-space-3); padding-top: var(--os-space-2); border-top: var(--os-border-w) solid var(--os-border-subtle); }
.flt-card__stats > div { display: grid; gap: 2px; min-width: 0; }
.flt-card__stats b { font: var(--os-type-kpi-sm); color: var(--os-text); }
.flt-card__stats b.flt-warn { color: var(--os-warn-text); }
.flt-card__stats small { font: var(--os-type-caption); color: var(--os-text-2); }
.flt-card__stats span { font: var(--os-type-caption); color: var(--os-text-2); }
.flt-tolink { color: var(--os-bad-text); }
.flt-progress { position: relative; height: 10px; border-radius: 3px; background: var(--os-surface-sunken); }
.flt-progress > i { position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 3px; background: var(--os-accent); }
.flt-progress > b { position: absolute; top: -3px; bottom: -3px; left: var(--x); width: 2px; background: var(--os-chart-target); }
.flt-statebar { display: flex; height: 22px; border-radius: 3px; overflow: hidden; }
.flt-statebar > i { flex: 0 0 var(--w); color: var(--os-on-good); font: var(--os-type-caption); font-style: normal; text-align: center; line-height: 22px; }
.flt-statebar > i.is-work { background: var(--os-good); }
.flt-statebar > i.is-delay { background: var(--os-warn); color: var(--os-on-warn); }
.flt-statebar > i.is-standby { background: var(--os-neutral); color: var(--os-on-neutral); }
.flt-statebar > i.is-down { background: var(--os-bad); color: var(--os-on-bad); }
.flt-now-down { display: flex; align-items: center; gap: var(--os-space-3); }
.flt-now-down > div { display: grid; flex: 1; min-width: 0; }

@media (max-width: 1199.98px) {
    .flt-reasons { grid-template-columns: 1fr; }
}

@media (max-width: 639.98px) {
    .flt-phone-only { display: block; }
    .flt-phone-hide { display: none; }
    .flt-phone-switch { margin-bottom: var(--os-space-3); }
    .flt-classes__head, .flt-classes__row, .flt-classes__axis { grid-template-columns: 1fr; gap: var(--os-space-1); }
    .flt-classes__axis { display: none; }
    .flt-byclass__row, .flt-cycles__row { grid-template-columns: 1fr; }
}

@media print {
    .flt-phone-only, .flt-phone-switch { display: none; }
}
