/* ==========================================================================
   Datalab — Module Maintenance
   ========================================================================== */
:root {
  --ok: #22c55e; --deg: #f59e0b; --bad: #ef4444; --info: #3b82f6; --vio: #a855f7; --due: #f5b400;
  --ok-bg: rgba(34, 197, 94, .14); --deg-bg: rgba(245, 158, 11, .15); --bad-bg: rgba(239, 68, 68, .14); --info-bg: rgba(59, 130, 246, .14); --vio-bg: rgba(168, 85, 247, .15);
}
:root[data-theme="light"] { --ok: #16a34a; --deg: #d97706; --bad: #dc2626; --info: #2563eb; --vio: #9333ea; --due: #d99a00; }

.small { font-size: .78rem; }
.pad { padding: 12px 4px; }
.center { text-align: center; }
.right { text-align: right; }
.pre { white-space: pre-wrap; margin: 0; }
.bad { color: var(--bad); }
.row-gap { display: flex; align-items: center; gap: 8px; }
.row-gap.wrap { flex-wrap: wrap; }
.icon-btn.hidden { visibility: hidden; }
.icon-btn.bordered { border: 1px solid var(--border-strong); width: 34px; height: 34px; }
.icon-btn.mini { width: 26px; height: 26px; }
.icon-btn .ic { width: 1.05em; height: 1.05em; }
.modal.wide { max-width: 760px; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; min-width: 0; }
.form-grid.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; min-width: 0; }
.form-grid.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; min-width: 0; }
.form-grid .span2 { grid-column: span 2; }
.field small { font-size: .74rem; }
.inline-form { display: flex; gap: 10px; align-items: center; }
.link-more { color: var(--accent); text-decoration: none; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }
.m-h3 { display: inline-flex; align-items: center; gap: 8px; }
.m-h3 .ic { color: var(--accent); }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.count-pill.red { background: var(--bad); color: #fff; }
.count-pill.amber { background: var(--due); color: #1a1500; }
.count-pill.blue { background: var(--info-bg); color: var(--info); }

/* ---------- Sous-navigation ---------- */
.m-subnav { display: flex; gap: 4px; margin: -6px 0 18px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.m-subnav::-webkit-scrollbar { display: none; }
.m-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 550; font-size: .88rem; border-bottom: 2px solid transparent; margin-bottom: -3px; white-space: nowrap; transition: var(--tr); }
.m-tab:hover { color: var(--text); }
.m-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.m-page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.m-page-head > div:first-child { flex: 1; min-width: 220px; }
.m-page-head p { margin: 4px 0 0; font-size: .85rem; }
.m-page-head p::first-letter { text-transform: uppercase; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span:last-child { color: var(--text); }

/* Filtre site */
.site-filter { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 18px; padding-bottom: 2px; scrollbar-width: thin; }
.sf-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap; transition: var(--tr); }
.sf-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.sf-chip:hover { color: var(--text); border-color: var(--border-strong); }
.sf-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.sf-chip.on .dot { box-shadow: 0 0 0 2px var(--bg); }

.m-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { position: relative; display: flex; align-items: center; min-width: 200px; }
.search-box .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 36px !important; }

.m-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 20px; color: var(--text); }
.m-empty p { margin: 0 0 8px; max-width: 460px; font-size: .86rem; }
.m-empty-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-bottom: 6px; }
.m-empty-ic .ic { width: 26px; height: 26px; }

/* ---------- Badges ---------- */
.st-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .74rem; font-weight: 650; white-space: nowrap; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.st-dot.st-ok { background: var(--ok); } .st-dot.st-degraded { background: var(--deg); } .st-dot.st-down { background: var(--bad); }
.st-badge.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-badge.st-degraded { background: var(--deg-bg); color: var(--deg); }
.st-badge.st-down { background: var(--bad-bg); color: var(--bad); }
.st-badge.st-down .st-dot { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 60%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.type-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 7px; font-size: .72rem; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--tc) 16%, transparent); color: color-mix(in srgb, var(--tc) 80%, var(--text)); }
.type-badge .ic { width: 12px; height: 12px; }
.kind-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: .7rem; font-weight: 650; background: var(--info-bg); color: var(--info); white-space: nowrap; }
.kind-badge .ic { width: 12px; height: 12px; }
.kind-badge.k-corrective { background: var(--bad-bg); color: var(--bad); }
.kind-badge.k-upgrade { background: var(--vio-bg); color: var(--vio); }
.kind-badge.k-inspection { background: var(--ok-bg); color: var(--ok); }
.kind-badge.k-other { background: var(--surface-3); color: var(--muted); }
.occ-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.occ-chip .ic { width: 13px; height: 13px; }
.occ-chip.s-overdue { background: var(--bad-bg); color: var(--bad); }
.occ-chip.s-due { background: color-mix(in srgb, var(--due) 18%, transparent); color: color-mix(in srgb, var(--due) 85%, var(--text)); }
.occ-chip.s-upcoming { background: var(--info-bg); color: var(--info); }
.occ-chip.s-ok { background: var(--ok-bg); color: var(--ok); }
.ref-chip, .item-chip { display: inline-flex; padding: 1px 7px; border-radius: 6px; font-size: .7rem; background: var(--surface-3); color: var(--muted); font-weight: 600; white-space: nowrap; }
.measure-chip { display: inline-flex; align-items: center; gap: 4px; color: var(--info); }
.crit { display: inline-flex; color: var(--due); }
.crit .ic { width: 14px; height: 14px; fill: currentColor; }
.bullet { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex: 0 0 auto; margin: 0 4px; }

/* Vignettes */
.m-thumb { width: 44px; height: 44px; border-radius: 11px; overflow: hidden; flex: 0 0 auto; display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface-2)), color-mix(in srgb, var(--tc) 10%, var(--surface-2))); color: var(--tc); }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; }
.m-thumb .ic { width: 52%; height: 52%; }
.m-thumb.xs { width: 26px; height: 26px; border-radius: 7px; }
.m-thumb.sm { width: 38px; height: 38px; border-radius: 10px; }
.m-thumb.md { width: 52px; height: 52px; border-radius: 13px; }

/* ---------- Tableau de bord ---------- */
.m-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.m-kpi { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); overflow: hidden; transition: var(--tr); --k: var(--muted); }
.m-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--k); }
.m-kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.m-kpi.tone-red { --k: var(--bad); } .m-kpi.tone-amber { --k: var(--due); } .m-kpi.tone-blue { --k: var(--info); }
.m-kpi.tone-orange { --k: var(--deg); } .m-kpi.tone-violet { --k: var(--vio); }
.mk-ic { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--k) 16%, transparent); color: var(--k); }
.mk-val { font-size: 1.9rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--k); }
.mk-lbl { font-weight: 650; font-size: .86rem; }
.mk-sub { font-size: .72rem; color: var(--muted); }
.m-kpi.zero .mk-val { color: var(--muted); opacity: .6; }
.m-kpi.zero::before { opacity: .25; }

.m-dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.m-col { min-width: 0; }
.alert-zone { border-top: 3px solid var(--bad); }
.alert-group { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; background: var(--surface-2); }
.alert-group.late { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.ag-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.ag-title { display: flex; flex-direction: column; text-decoration: none; color: var(--text); min-width: 0; line-height: 1.25; }
.ag-title:hover strong { color: var(--accent); }
.ag-tasks { border-top: 1px solid var(--border); }
.ag-task { display: flex; align-items: center; gap: 8px; padding: 8px 12px; text-decoration: none; color: var(--text); font-size: .86rem; border-top: 1px solid var(--border); }
.ag-task:first-child { border-top: none; }
.ag-task:hover { background: var(--surface-3); }
.ag-label { flex: 1; min-width: 0; }

.mini-parc { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.mini-machine { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: .82rem; border-left: 3px solid var(--ok); transition: var(--tr); }
.mini-machine:hover { border-color: var(--border-strong); }
.mini-machine.st-degraded { border-left-color: var(--deg); } .mini-machine.st-down { border-left-color: var(--bad); }
.mm-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.mm-badge { min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; font-size: .7rem; font-weight: 700; padding: 0 5px; }
.mm-badge.red { background: var(--bad); color: #fff; } .mm-badge.amber { background: var(--due); color: #1a1500; }
.mm-ok { color: var(--ok); display: inline-flex; }

.watch-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); border: 1px solid transparent; transition: var(--tr); }
.watch-row:hover { background: var(--surface-2); border-color: var(--border); }
.wr-main { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
.wr-top { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.wr-note { font-size: .78rem; font-style: italic; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.inter-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.inter-row:last-child { border-bottom: none; }
.inter-row > button { background: none; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; }
.date-block { flex: 0 0 auto; width: 46px; height: 48px; border-radius: 11px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; background: var(--info-bg) !important; color: var(--info) !important; line-height: 1; }
.db-d { font-size: 1.15rem; font-weight: 750; } .db-m { font-size: .66rem; text-transform: uppercase; font-weight: 650; margin-top: 2px; }
.inter-row.late .date-block { background: var(--bad-bg) !important; color: var(--bad) !important; }
.inter-row.s-done .date-block { background: var(--ok-bg) !important; color: var(--ok) !important; }
.inter-row.s-cancelled { opacity: .55; }
.inter-row.s-cancelled .ir-top strong { text-decoration: line-through; }
.ir-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ir-main:hover strong { color: var(--accent); }
.ir-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inter-row.compact { padding: 7px 0; }
.inter-row.compact .date-block { width: 40px; height: 42px; }

.up-day { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.up-day:last-child { border-bottom: none; }
.up-date { flex: 0 0 82px; display: flex; flex-direction: column; font-size: .84rem; }
.up-list { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.up-item { font-size: .82rem; color: var(--text); text-decoration: none; display: flex; gap: 6px; min-width: 0; }
.up-item span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.up-m { font-weight: 600; white-space: nowrap; }
.up-item:hover .up-m { color: var(--accent); }

.log-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px; background: none; border: none; border-bottom: 1px solid var(--border); color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.log-row:last-child { border-bottom: none; }
.log-row:hover { background: var(--surface-2); }
.lr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.log-counts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.lc { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.lc .ic { width: 12px; height: 12px; }
.lc.done { background: var(--ok-bg); color: var(--ok); } .lc.issue { background: var(--deg-bg); color: var(--deg); }
.lc.skipped { background: var(--surface-3); color: var(--muted); } .lc.out { background: var(--bad-bg); color: var(--bad); }
.lc.files { background: var(--info-bg); color: var(--info); }

/* ---------- Parc ---------- */
.parc-site { margin-bottom: 26px; }
.ps-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ps-head h3 { font-size: 1.05rem; }
.ps-dot { width: 12px; height: 12px; border-radius: 4px; }
.parc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.m-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); transition: var(--tr); box-shadow: var(--shadow-sm); }
.m-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.m-card.st-down { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); }
.m-card.st-degraded { border-color: color-mix(in srgb, var(--deg) 45%, var(--border)); }
.m-card.off { opacity: .55; filter: grayscale(.6); }
.mc-cover { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface-2)), color-mix(in srgb, var(--tc) 6%, var(--surface-2))); }
.mc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mc-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--tc); }
.mc-ph .ic { width: 42px; height: 42px; opacity: .8; }
.mc-status { position: absolute; top: 10px; left: 10px; }
.mc-status .st-badge { backdrop-filter: blur(8px); background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: var(--shadow-sm); }
.mc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.mc-title { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.mc-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.mc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.mc-meta .ic { width: 12px; height: 12px; }
.mc-alerts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 8px; }

/* ---------- Fiche machine ---------- */
.m-hero { display: grid; grid-template-columns: 300px 1fr; gap: 22px; padding: 18px; border-top: 3px solid var(--ok); }
.m-hero.st-degraded { border-top-color: var(--deg); }
.m-hero.st-down { border-top-color: var(--bad); }
.m-hero.off { opacity: .8; }
.mh-media { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface-2)), color-mix(in srgb, var(--tc) 6%, var(--surface-2))); }
.mh-media img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.mh-ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--tc); }
.mh-ph .ic { width: 64px; height: 64px; opacity: .8; }
.mh-count { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .74rem; }
.mh-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mh-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mh-title h2 { font-size: 1.5rem; }
.mh-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mh-model { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; font-weight: 550; }
a.mh-model:hover { color: var(--accent); }
.mh-model .ic { width: 13px; height: 13px; }
.mh-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 2px 0; }
.mh-meta .mi { background: var(--surface-2); border-radius: 10px; padding: 8px 11px; min-width: 0; }
.mh-meta dt { font-size: .7rem; color: var(--muted); display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.mh-meta dt .ic { width: 12px; height: 12px; }
.mh-meta dd { margin: 2px 0 0; font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ss-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; transition: var(--tr); }
.ss-btn:hover { color: var(--text); }
.ss-btn.st-ok:hover, .ss-btn.st-ok.active { --c: var(--ok); }
.ss-btn.st-degraded:hover, .ss-btn.st-degraded.active { --c: var(--deg); }
.ss-btn.st-down:hover, .ss-btn.st-down.active { --c: var(--bad); }
.ss-btn:hover { border-color: var(--c); color: var(--c); }
.ss-btn.active { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 6px 16px -8px var(--c); }
.mh-since { margin: 6px 0 0; }
.mh-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }

.m-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; }
.m-banner > .ic { width: 22px; height: 22px; flex: 0 0 auto; }
.m-banner > div { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: .86rem; }
.m-banner > div span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-banner.late, .m-banner.down { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.m-banner.due { background: color-mix(in srgb, var(--due) 13%, transparent); border-color: color-mix(in srgb, var(--due) 35%, transparent); color: color-mix(in srgb, var(--due) 85%, var(--text)); }
.m-banner.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.m-banner strong { color: inherit; }
.m-banner.slim { padding: 8px 12px; margin: 8px 0; font-size: .82rem; }
.m-banner.slim > .ic { width: 16px; height: 16px; }
.m-banner.slim span { white-space: normal; }

.tabs-card { padding: 0; }
.m-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.m-tabbtn { display: inline-flex; align-items: center; gap: 6px; padding: 14px 12px 12px; background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.m-tabbtn:hover { color: var(--text); }
.m-tabbtn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-n { font-size: .68rem; padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.tab-body { padding: 18px 20px 20px; }
.tab-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.tab-head p { margin: 0; flex: 1; min-width: 220px; }
.sub-sep { margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.sub-sep:first-child { margin-top: 0; }
.sub-sep.red { color: var(--bad); }

.proto-group { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.proto-group.own { border-style: dashed; }
.pg-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--surface-2); font-size: .88rem; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); }
.task-row.off { opacity: .5; }
.tr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-list .tr-main { cursor: pointer; }
.task-list .tr-main:hover strong { color: var(--accent); }
.tr-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tr-sub { display: flex; gap: 12px; flex-wrap: wrap; }
.tr-sub span { display: inline-flex; align-items: center; gap: 4px; }
.tr-sub .ic { width: 12px; height: 12px; }
.switch.sm { width: 34px; height: 19px; }
.switch.sm .slider::before { width: 13px; height: 13px; }
.switch.sm input:checked + .slider::before { transform: translateX(15px); }

.feed { position: relative; }
.feed-item { display: grid; grid-template-columns: 90px 34px 1fr; gap: 10px; align-items: start; padding: 8px 0; position: relative; }
.feed-item::before { content: ""; position: absolute; left: 106px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.feed-item:first-child::before { top: 18px; } .feed-item:last-child::before { bottom: calc(100% - 18px); }
.feed-when { display: flex; flex-direction: column; align-items: flex-end; font-size: .82rem; padding-top: 4px; }
.feed-ic { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); border: 3px solid var(--surface); }
.feed-ic .ic { width: 15px; height: 15px; }
.f-log .feed-ic { background: var(--ok-bg); color: var(--ok); }
.f-inter .feed-ic { background: var(--info-bg); color: var(--info); }
.f-status.st-down .feed-ic { background: var(--bad-bg); color: var(--bad); }
.f-status.st-degraded .feed-ic { background: var(--deg-bg); color: var(--deg); }
.f-status.st-ok .feed-ic { background: var(--ok-bg); color: var(--ok); }
.feed-body { display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; text-align: left; font: inherit; color: inherit; width: 100%; }
.feed-body.link { cursor: pointer; }
.feed-body.link:hover { border-color: var(--border-strong); }
.fb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.const-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.const-group { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.const-group h4 { margin-bottom: 8px; }
.const-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: .86rem; }
.const-group h4 + .const-row { border-top: none; }
.cr-val { font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.cr-val em { font-style: normal; color: var(--muted); font-weight: 500; }
.cr-note { grid-column: 1 / -1; }

.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.doc-row:hover { border-color: var(--border-strong); }
.doc-ic { width: 40px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: .62rem; font-weight: 800; letter-spacing: .02em; text-decoration: none; background: var(--surface-3); color: var(--muted); flex: 0 0 auto; }
.doc-ic.ext-pdf { background: rgba(239, 68, 68, .15); color: #ef4444; }
.doc-ic.ext-doc, .doc-ic.ext-docx, .doc-ic.ext-odt { background: rgba(59, 130, 246, .15); color: #3b82f6; }
.doc-ic.ext-xls, .doc-ic.ext-xlsx, .doc-ic.ext-ods, .doc-ic.ext-csv { background: rgba(34, 197, 94, .15); color: #22c55e; }
.doc-ic.ext-zip { background: rgba(168, 85, 247, .15); color: #a855f7; }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.doc-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-main:hover strong { color: var(--accent); }
.doc-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.g-item { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 2px solid transparent; }
.g-item.cover { border-color: var(--accent); }
.g-item img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.g-cover-tag { position: absolute; left: 6px; bottom: 6px; font-size: .64rem; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--accent); color: var(--accent-ink); }
.g-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; opacity: 0; transition: var(--tr); }
.g-item:hover .g-actions, .g-item:focus-within .g-actions { opacity: 1; }
.g-actions .icon-btn { width: 28px; height: 28px; background: rgba(0, 0, 0, .55); color: #fff; }
.g-actions .icon-btn:hover { background: rgba(0, 0, 0, .8); color: var(--accent); }
.g-add { aspect-ratio: 1; border-radius: 10px; border: 2px dashed var(--border-strong); background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .75rem; cursor: pointer; transition: var(--tr); padding: 6px; text-align: center; }
.g-add:hover { border-color: var(--accent); color: var(--accent); }
.g-add .ic { width: 22px; height: 22px; }
@media (hover: none) { .g-actions { opacity: 1; } }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(4, 6, 12, .92); display: flex; align-items: center; justify-content: center; padding: 50px 60px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lb-cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #cbd5e1; font-size: .85rem; }
.lb-nav, .lb-close { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, .22); }
.lb-nav.prev { left: 10px; top: 50%; transform: translateY(-50%); } .lb-nav.next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-close { top: 10px; right: 10px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.status-preview { display: flex; align-items: center; gap: 10px; }
.status-preview .ic { color: var(--muted); }
.detail { display: flex; flex-direction: column; gap: 14px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; margin: 0; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv a { color: var(--text); font-weight: 600; }
.detail-block h4 { margin-bottom: 6px; }

/* ---------- Frise ---------- */
.tl-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-range { font-weight: 650; font-size: .88rem; margin-left: 6px; white-space: nowrap; }
.tl-wrap { position: relative; transition: opacity .2s; }
.tl-wrap.loading { opacity: .5; pointer-events: none; }
.tl-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.tl-inner { position: relative; --lw: 220px; --dot: 12px; }
.tl-head { display: grid; grid-template-columns: var(--lw) 1fr; position: sticky; top: 0; z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tl-corner { position: sticky; left: 0; z-index: 4; background: var(--surface-2); padding: 8px 12px; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; display: flex; align-items: flex-end; border-right: 1px solid var(--border); }
.tl-scale { position: relative; height: 50px; }
.tl-months { position: absolute; left: 0; right: 0; top: 0; height: 22px; }
.tl-month { position: absolute; top: 0; height: 22px; padding: 4px 0; font-size: .74rem; font-weight: 700; text-transform: capitalize; border-left: 1px solid var(--border-strong); white-space: nowrap; }
.tl-month span { position: sticky; left: calc(var(--lw) + 8px); padding: 0 8px; }
.tl-days { position: absolute; left: 0; right: 0; bottom: 0; height: 28px; }
.tl-day { position: absolute; top: 0; height: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.05; }
.tl-day.we { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.tl-dow { font-size: .58rem; opacity: .7; }
.tl-day.today { color: var(--accent-ink); font-weight: 800; }
.tl-day.today::before { content: ""; position: absolute; inset: 2px 1px; border-radius: 6px; background: var(--accent); z-index: -1; }
.tl-tick { position: absolute; bottom: 4px; font-size: .66rem; color: var(--muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.tl-tick::before { content: ""; position: absolute; left: 50%; top: -6px; height: 4px; width: 1px; background: var(--border-strong); }
.tl-tick.today { color: var(--accent); font-weight: 800; }
.tl-body { position: relative; }
.tl-overlay { position: absolute; top: 0; bottom: 0; left: var(--lw); right: 0; pointer-events: none; z-index: 0; }
.tl-we { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.tl-mline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.tl-todaycol { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.tl-row { display: grid; grid-template-columns: var(--lw) 1fr; min-height: 34px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.tl-row:hover { background: color-mix(in srgb, var(--text) 2.5%, transparent); }
.tl-label { position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--border); padding: 6px 12px; display: flex; align-items: center; min-width: 0; font-size: .82rem; }
.tl-row:hover .tl-label { background: var(--surface-2); }
.tl-track { position: relative; z-index: 1; min-width: 0; }
.tl-lbl-main { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tl-lbl-main .ic { width: 14px; height: 14px; }
.tl-lbl-task { display: flex; align-items: center; gap: 5px; min-width: 0; }
.tl-lbl-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lbl-machine { display: flex; align-items: center; gap: 7px; min-width: 0; text-decoration: none; color: var(--text); font-weight: 600; width: 100%; }
.tl-lbl-machine:hover { color: var(--accent); }
.tl-site { width: 8px; height: 8px; border-radius: 3px; margin-left: auto; flex: 0 0 auto; }
.tl-group { padding: 10px 12px 4px; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent); position: relative; z-index: 2; }
.tl-group span { position: sticky; left: 12px; }
.tl-row.r-status, .tl-row.r-inter { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tl-row.r-inter { border-bottom: 2px solid var(--border); min-height: 36px; }
.tl-row.r-machine { min-height: 42px; }
.tl-seg { position: absolute; top: 9px; bottom: 9px; border-radius: 5px; opacity: .9; }
.tl-seg.st-ok { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.tl-seg.st-degraded { background: repeating-linear-gradient(-45deg, var(--deg), var(--deg) 6px, color-mix(in srgb, var(--deg) 60%, transparent) 6px, color-mix(in srgb, var(--deg) 60%, transparent) 12px); }
.tl-seg.st-down { background: repeating-linear-gradient(-45deg, var(--bad), var(--bad) 6px, color-mix(in srgb, var(--bad) 65%, transparent) 6px, color-mix(in srgb, var(--bad) 65%, transparent) 12px); }
.tl-seg.thin { top: auto; bottom: 3px; height: 5px; border-radius: 3px; opacity: .75; }
.tl-seg.thin.st-ok { opacity: .35; }
.tl-inter { position: absolute; top: 6px; bottom: 6px; min-width: 16px; border-radius: 6px; border: 1.5px solid var(--info); background: var(--info-bg); color: var(--info); font: inherit; font-size: .72rem; font-weight: 650; padding: 0 6px; display: flex; align-items: center; overflow: hidden; cursor: pointer; z-index: 2; }
.tl-inter span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-inter:hover { filter: brightness(1.15); z-index: 3; }
.tl-inter.k-corrective { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.tl-inter.k-upgrade { border-color: var(--vio); color: var(--vio); background: var(--vio-bg); }
.tl-inter.s-done { background: var(--info); color: #fff; }
.tl-inter.s-done.k-corrective { background: var(--bad); } .tl-inter.s-done.k-upgrade { background: var(--vio); }
.tl-inter.s-cancelled { opacity: .4; text-decoration: line-through; border-style: dashed; }
.tl-inter.late { animation: blink 1.6s infinite; }
@keyframes blink { 50% { box-shadow: 0 0 0 3px var(--bad-bg); } }
.tl-inter.small { top: 4px; bottom: auto; height: 12px; min-width: 12px; padding: 0; border-radius: 3px; }
.tl-dot { position: absolute; top: 50%; width: var(--dot); height: var(--dot); margin: 0; padding: 0; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid transparent; background: var(--muted); cursor: default; display: grid; place-items: center; font-size: .6rem; font-weight: 800; color: #fff; z-index: 2; transition: transform .12s; }
button.tl-dot { cursor: pointer; font-family: inherit; }
.tl-dot:hover { transform: translate(-50%, -50%) scale(1.35); z-index: 4; }
.tl-dot.s-done { background: var(--ok); }
.tl-dot.s-issue { background: var(--deg); }
.tl-dot.s-skipped { background: var(--surface); border-color: var(--muted); }
.tl-dot.s-missed { background: var(--bad); }
.tl-dot.s-due, .tl-dot.s-overdue { background: var(--due); box-shadow: 0 0 0 3px color-mix(in srgb, var(--due) 30%, transparent); animation: duepulse 1.8s infinite; }
.tl-dot.s-overdue { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
@keyframes duepulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.tl-dot.s-upcoming { background: var(--surface); border-color: var(--info); }
.tl-dot.s-projected { background: transparent; border: 2px dashed var(--info); opacity: .7; }
.tl-dot.s-suspended { background: var(--surface-3); border-color: var(--border-strong); opacity: .7; }
.tl-dot.out { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--bad); }
.tl-dot.adhoc { border-radius: 4px; }
.tl-dot.multi { font-size: .58rem; }
.tl-dot.static { position: static; transform: none; display: inline-block; width: 11px; height: 11px; animation: none; vertical-align: middle; }
.tl-dot.static:hover { transform: none; }
.tl-none { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-style: italic; white-space: nowrap; }
.tl-empty-row { padding: 14px; text-align: center; }
.tl-tip { position: fixed; z-index: 300; display: none; max-width: 320px; padding: 8px 11px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: .78rem; line-height: 1.45; pointer-events: none; color: var(--text); }
.tl-tip .tt-mut { color: var(--muted); }
.tl-tip .tt-bad { color: var(--bad); }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 10px; font-size: .74rem; color: var(--muted); }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-band { width: 18px; height: 8px; border-radius: 3px; }
.lg-band.st-ok { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.lg-band.st-degraded { background: var(--deg); } .lg-band.st-down { background: var(--bad); }
.lg-inter { width: 18px; height: 10px; border-radius: 3px; border: 1.5px solid var(--info); background: var(--info-bg); }
.lg-sep { width: 1px; height: 14px; background: var(--border-strong); }
.tl-list { max-height: 560px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tll-day { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.tll-day.past { opacity: .82; }
.tll-day.today { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.tll-date { display: flex; flex-direction: column; font-size: .84rem; }
.tll-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tll-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; background: none; border: none; color: inherit; font: inherit; text-align: left; padding: 0; }
.tll-item.link { cursor: pointer; }
.tll-m { font-weight: 650; color: var(--text); text-decoration: none; }
.tll-m:hover { color: var(--accent); }
.tll-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.occ-mini { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: .75rem; color: var(--text); font-family: inherit; }
button.occ-mini { cursor: pointer; }
button.occ-mini:hover { border-color: var(--border-strong); }
.occ-mini b.bad { color: var(--bad); }
.om-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.occ-mini.s-done .om-dot { background: var(--ok); } .occ-mini.s-issue .om-dot { background: var(--deg); }
.occ-mini.s-missed .om-dot, .occ-mini.s-overdue .om-dot { background: var(--bad); } .occ-mini.s-due .om-dot { background: var(--due); }
.occ-mini.s-upcoming .om-dot { background: transparent; border: 2px solid var(--info); }
.occ-mini.s-projected .om-dot { background: transparent; border: 2px dashed var(--info); }
.occ-mini.s-missed { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

/* ---------- Checklist ---------- */
.check-head { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; }
.ch-main { flex: 1; min-width: 260px; }
.ch-main p { margin: 6px 0 0; font-size: .86rem; }
.ch-date { width: 260px; }
.check-machine { border-left: 4px solid var(--ok); }
.check-machine.st-degraded { border-left-color: var(--deg); }
.check-machine.st-down { border-left-color: var(--bad); }
.check-machine.calm { opacity: .92; }
.cm-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.cm-title { display: flex; flex-direction: column; min-width: 0; }
.cm-title a { color: var(--text); text-decoration: none; font-size: 1.02rem; }
.cm-title a:hover { color: var(--accent); }
.ck-sec { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.ck-sec .ic { width: 14px; height: 14px; }
.ck-sec.toggle { width: 100%; background: none; border: none; border-top: 1px solid var(--border); padding: 12px 0 4px; cursor: pointer; font-family: inherit; }
.ck-sec.toggle:hover { color: var(--text); }
.ck-sec.toggle > .ic:last-child { margin-left: auto; transition: transform .2s; }
.ck-sec.toggle + .ck-collapse.open { }
.ck-collapse { display: none; }
.ck-collapse.open { display: block; }
.ck-sec.toggle:has(+ .ck-collapse.open) > .ic:last-child { transform: rotate(180deg); }
.ck-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: start; padding: 12px; margin-bottom: 8px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid var(--border); cursor: pointer; transition: var(--tr); }
.ck-row:hover { border-color: var(--border-strong); }
.ck-box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; transition: var(--tr); margin-top: 1px; }
.ck-box .ic { width: 16px; height: 16px; stroke-width: 3; }
.ck-row.sel[data-res="done"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface-2)); }
.ck-row.sel[data-res="done"] .ck-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.ck-row.sel[data-res="issue"] { border-color: var(--deg); background: color-mix(in srgb, var(--deg) 8%, var(--surface-2)); }
.ck-row.sel[data-res="issue"] .ck-box { background: var(--deg); border-color: var(--deg); color: #fff; }
.ck-row.sel[data-res="skipped"] { border-color: var(--muted); }
.ck-row.sel[data-res="skipped"] .ck-box { background: var(--muted); border-color: var(--muted); color: var(--surface); }
.ck-row.sel[data-res="skipped"] .ck-title strong { text-decoration: line-through; color: var(--muted); }
.ck-row.out { box-shadow: 0 0 0 2px var(--bad-bg); }
.ck-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ck-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: .95rem; }
.ck-info { width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--surface-3); color: var(--info); display: grid; place-items: center; cursor: pointer; }
.ck-info .ic { width: 14px; height: 14px; }
.ck-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ck-instr { display: none; white-space: pre-wrap; font-size: .82rem; padding: 9px 12px; border-radius: 9px; background: var(--info-bg); color: var(--text); border-left: 3px solid var(--info); cursor: default; }
.ck-instr.open { display: block; }
.ck-extra { display: none; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.ck-row.sel .ck-extra, .ck-row.out .ck-extra { display: flex; }
.ck-row:not(.sel) .ck-extra:has(.ck-mfield) { display: flex; }
.ck-row:not(.sel) .ck-extra .ck-note { display: none; }
.ck-mfield { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--info); font-weight: 600; flex-wrap: wrap; }
.ck-mfield .ic { width: 14px; height: 14px; vertical-align: -2px; }
.ck-measure { width: 110px !important; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ck-row.out .ck-measure { border-color: var(--bad); color: var(--bad); }
.ck-warn { color: var(--bad); font-weight: 700; font-size: .76rem; }
.ck-note { flex: 1; min-width: 200px; width: auto !important; }
.ck-results { display: flex; gap: 4px; }
.ck-res { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; transition: var(--tr); white-space: nowrap; }
.ck-res .ic { width: 14px; height: 14px; }
.ck-res:hover { color: var(--text); }
.ck-res.r-done.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.ck-res.r-issue.on { background: var(--deg); border-color: var(--deg); color: #fff; }
.ck-res.r-skipped.on { background: var(--muted); border-color: var(--muted); color: var(--surface); }
.ck-comment { margin-top: 12px; }
.ck-comment > span { display: inline-flex; align-items: center; gap: 6px; }
.check-bar { position: sticky; bottom: 12px; z-index: 15; margin-top: 10px; }
.cb-inner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.cb-sum { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; }
.cb-sum .lc { margin-left: 4px; }

.log-tasks { display: flex; flex-direction: column; gap: 6px; }
.lt-row { display: flex; gap: 10px; padding: 9px 11px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--ok); }
.lt-row.r-issue { border-left-color: var(--deg); } .lt-row.r-skipped { border-left-color: var(--muted); }
.lt-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); flex: 0 0 auto; }
.lt-ic .ic { width: 13px; height: 13px; }
.r-issue .lt-ic { background: var(--deg-bg); color: var(--deg); } .r-skipped .lt-ic { background: var(--surface-3); color: var(--muted); }
.lt-main { flex: 1; min-width: 0; }
.lt-measure { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: .82rem; color: var(--info); margin-top: 3px; }
.lt-measure .ic { width: 13px; height: 13px; }
.lt-measure.bad { color: var(--bad); }
.lt-note { font-size: .82rem; font-style: italic; color: var(--muted); margin-top: 3px; }

.hist-card .day-sep { position: static; }
.hist-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 6px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: var(--tr); }
.hist-row:hover { border-color: var(--border-strong); }
.hr-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .84rem; width: 46px; flex: 0 0 auto; }
.hr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hr-main .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Bibliothèque ---------- */
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; transition: var(--tr); }
.type-chip:hover { border-color: var(--tc); }
.type-chip > .ic { width: 13px; height: 13px; color: var(--muted); opacity: 0; transition: var(--tr); }
.type-chip:hover > .ic { opacity: 1; }
.tch-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 20%, transparent); color: var(--tc); }
.tch-ic .ic { width: 15px; height: 15px; }
.tch-n { font-size: .7rem; padding: 1px 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.icon-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.ip-btn { aspect-ratio: 1; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.ip-btn:hover { color: var(--text); }
.ip-btn.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.lib-card { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: var(--tr); }
.lib-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.lib-card.off { opacity: .6; }
.lc-cover { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface-2)), color-mix(in srgb, var(--tc) 6%, var(--surface-2))); }
.lc-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lc-count { position: absolute; right: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .74rem; font-weight: 700; }
.lc-count .ic { width: 13px; height: 13px; }
.lc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.lc-name { font-size: 1.02rem; }
.lc-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.lc-stats span { display: inline-flex; align-items: center; gap: 4px; }
.lc-stats .ic { width: 12px; height: 12px; }

.model-head { display: grid; grid-template-columns: 340px 1fr; gap: 24px; }
.mo-gallery { min-width: 0; }
.mo-cover { aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; margin-bottom: 10px; background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 30%, var(--surface-2)), color-mix(in srgb, var(--tc) 6%, var(--surface-2))); }
.mo-cover img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.mo-cover .mc-ph .ic { width: 60px; height: 60px; }
.mo-gallery .gallery { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.mo-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mo-form textarea { resize: vertical; }
.mo-actions { padding-top: 4px; border-top: 1px solid var(--border); padding-top: 14px; }
.help { margin: -6px 0 14px; }
.item-block { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.item-block.general { border-style: dashed; }
.ib-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; background: var(--surface-2); flex-wrap: wrap; justify-content: space-between; }
.ib-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ib-title > .ic { color: var(--accent); }
.ib-empty { padding: 10px 14px; border-top: 1px solid var(--border); }
.const-table td { vertical-align: middle; }
.const-table .grp-row td { background: var(--surface-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--accent); padding: 6px 12px; }
.wrap-cell { white-space: normal !important; }

/* Éditeur de tâche */
.task-editor { display: flex; flex-direction: column; gap: 16px; }
.te-section { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.te-section h4 { margin: 0; }
.seg.wrap { flex-wrap: wrap; }
.recur-cfg { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.recur-cfg .field { gap: 10px; }
.recur-cfg .check { font-size: .84rem; align-items: flex-start; }
.recur-cfg .check input { margin-top: 3px; }
.inline-ctl { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text) !important; font-size: .88rem !important; }
.inline-ctl .every { width: 72px !important; text-align: center; }
.inline-ctl select { width: auto; }
.wd-picker { display: flex; gap: 6px; }
.wd { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; transition: var(--tr); }
.wd:hover { color: var(--text); }
.wd.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.recur-summary { font-weight: 650; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.recur-preview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 26px; }
.date-chip { padding: 3px 9px; border-radius: 7px; background: var(--info-bg); color: var(--info); font-size: .76rem; font-weight: 600; }
.crit-check { align-self: end; padding-bottom: 10px; }
.crit-check .ic { color: var(--due); width: 14px; height: 14px; vertical-align: -2px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .m-kpis { grid-template-columns: repeat(3, 1fr); }
  .m-dash-grid { grid-template-columns: 1fr; }
  .model-head { grid-template-columns: 260px 1fr; }
}
@media (max-width: 860px) {
  .m-hero { grid-template-columns: 1fr; }
  .mh-media { aspect-ratio: 16 / 8; }
  .model-head { grid-template-columns: 1fr; }
  .mh-meta { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .m-kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mk-val { font-size: 1.55rem; }
  .mk-ic { width: 28px; height: 28px; }
  .m-tab { padding: 9px 10px; }
  .m-tab span { font-size: .82rem; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
  .form-grid.four { grid-template-columns: 1fr 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .tab-body { padding: 14px; }
  .mh-meta { grid-template-columns: 1fr; }
  .mh-actions .btn { flex: 1 1 auto; }
  .status-seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .ss-btn { justify-content: center; padding: 9px 6px; font-size: .78rem; flex-direction: column; gap: 3px; }
  .ck-row { grid-template-columns: 26px 1fr; }
  .ck-results { grid-column: 1 / -1; }
  .ck-res { flex: 1; justify-content: center; padding: 10px 6px; }
  .ck-note { min-width: 0; width: 100% !important; }
  .check-bar { bottom: 78px; }
  .cb-inner .btn.ghost { display: none; }
  .ch-date { width: 100%; }
  .feed-item { grid-template-columns: 62px 30px 1fr; gap: 8px; }
  .feed-item::before { left: 76px; }
  .feed-ic { width: 30px; height: 30px; }
  .tll-day { grid-template-columns: 1fr; gap: 6px; }
  .tll-date { flex-direction: row; gap: 8px; align-items: baseline; }
  .tl-controls .tl-range { order: 5; width: 100%; margin: 0; }
  .lightbox { padding: 50px 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 6px; }
  .icon-picker { grid-template-columns: repeat(5, 1fr); }
  .parc-grid, .lib-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .mini-parc { grid-template-columns: 1fr 1fr; }
  .hist-row { flex-wrap: wrap; }
  .hist-row .pill { display: none; }
  .m-banner { flex-wrap: wrap; }
  .m-banner > div span { white-space: normal; }
}
@media (max-width: 420px) {
  .parc-grid, .lib-grid { grid-template-columns: 1fr; }
  .wd { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-dot, .st-badge .st-dot, .tl-inter { animation: none !important; }
}
.tl-dot.s-upcoming, .tl-dot.s-projected { color: var(--info); }
.tl-dot.s-skipped, .tl-dot.s-suspended { color: var(--muted); }
.tl-dot.s-due { color: #1a1500; }

/* ==========================================================================
   Stock de pièces
   ========================================================================== */
.m-kpis.three { grid-template-columns: repeat(3, 1fr); }
.stock-table td { vertical-align: middle; }
.part-row.off { opacity: .5; }
.part-row.a-out td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.part-row.a-low td:first-child { box-shadow: inset 3px 0 0 var(--deg); }
.part-name { display: flex; flex-direction: column; align-items: flex-start; background: none; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; max-width: 280px; }
.part-name strong { white-space: normal; }
.part-name:hover strong { color: var(--accent); }
.link-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 320px; }
.stock-cells { display: flex; flex-wrap: wrap; gap: 6px; }
.stock-cell { display: inline-flex; align-items: baseline; gap: 4px; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; transition: var(--tr); }
.stock-cell:hover { border-color: var(--border-strong); }
.sc-dot { width: 8px; height: 8px; border-radius: 3px; align-self: center; }
.sc-qty { font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.sc-unit { font-size: .72rem; color: var(--muted); }
.sc-min { font-size: .68rem; color: var(--muted); margin-left: 4px; }
.sc-need { font-size: .68rem; color: var(--info); font-weight: 700; margin-left: 2px; }
.stock-cell.s-low, .stock-cell.s-short { border-color: color-mix(in srgb, var(--deg) 55%, var(--border)); background: var(--deg-bg); }
.stock-cell.s-low .sc-qty, .stock-cell.s-short .sc-qty { color: var(--deg); }
.stock-cell.s-out { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); background: var(--bad-bg); }
.stock-cell.s-out .sc-qty { color: var(--bad); }
.big-num { font-size: 1.4rem !important; font-weight: 700; text-align: center; max-width: 200px; }
.stock-sites { display: flex; flex-direction: column; gap: 6px; }
.ss-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.ss-row .input.sm { width: 110px; }
.ss-qty { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.ss-qty em { font-style: normal; font-weight: 500; font-size: .8rem; color: var(--muted); }
.link-list { display: flex; flex-direction: column; gap: 4px; }
.link-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .86rem; }
.link-row a { color: var(--muted); text-decoration: none; }
.link-row a:hover { color: var(--accent); }
.mv-kind { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.mv-kind.k-in { background: var(--ok-bg); color: var(--ok); }
.mv-kind.k-out, .mv-kind.k-task { background: var(--deg-bg); color: var(--deg); }
.mv-kind.k-transfer { background: var(--info-bg); color: var(--info); }
.data-table td.neg { color: var(--bad); }
.data-table td.pos { color: var(--ok); }
.moves-table td { white-space: nowrap; }
.moves-table td.wrap-cell { min-width: 160px; }
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.part-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: .72rem; font-weight: 600; background: var(--info-bg); color: var(--info); white-space: nowrap; }
.part-chip .ic { width: 12px; height: 12px; }
.part-chip em { font-style: normal; font-weight: 500; }
.ck-parts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .78rem; color: var(--info); }
.ck-parts .ic { width: 14px; height: 14px; }
.ck-part { font-weight: 650; }
.ck-part em { font-style: normal; font-weight: 500; color: var(--muted); }
.ck-part.low, .ck-part.low em { color: var(--bad); }
.stock-alert { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); border: 1px solid transparent; }
.stock-alert:hover { background: var(--surface-2); border-color: var(--border); }
.sa-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--deg-bg); color: var(--deg); flex: 0 0 auto; }
.stock-alert.s-out .sa-ic { background: var(--bad-bg); color: var(--bad); }
.sa-qty { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.stock-alert.s-out .sa-qty { color: var(--bad); }
.stock-alert.s-low .sa-qty, .stock-alert.s-short .sa-qty { color: var(--deg); }

/* ==========================================================================
   Réglages e-mail
   ========================================================================== */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.code-box { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--input-bg); border: 1px solid var(--border); font-size: .8rem; white-space: pre-wrap; word-break: break-all; color: var(--text); }
.last-run { display: flex; align-items: center; gap: 6px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.sub-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sub-row .sr-main { display: flex; flex-direction: column; min-width: 180px; flex: 0 1 260px; }
.sr-sites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; }
.sub-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; font-weight: 600; }
.sub-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.sub-chip .ic { width: 12px; height: 12px; }
.sub-chip button { width: 20px; height: 20px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.sub-chip button:hover { background: var(--bad-bg); color: var(--bad); }
.sub-chip.off { opacity: .5; }
.save-bar { display: flex; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 6px; }
.mail-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 10px; background: #f4f6fb; }

/* ==========================================================================
   Étiquettes QR
   ========================================================================== */
.qr-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 4px 0 10px; }
.qp-site strong { display: block; font-size: .8rem; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.qp-list { display: flex; flex-direction: column; gap: 4px; }
.qr-sheet { display: flex; flex-wrap: wrap; gap: 6mm; justify-content: flex-start; padding: 6mm; background: #fff; border-radius: var(--radius); }
.qr-label { box-sizing: border-box; background: #fff; color: #111; border: 1px dashed #b8bec9; border-radius: 3mm; display: flex; align-items: center; gap: 3mm; padding: 3mm; font-family: var(--ff); break-inside: avoid; page-break-inside: avoid; }
.qr-label.size-s { width: 50mm; flex-direction: column; text-align: center; gap: 1.5mm; }
.qr-label.size-m { width: 70mm; }
.qr-label.size-l { width: 100mm; padding: 4mm; gap: 4mm; }
.ql-code { flex: 0 0 auto; }
.qr-label.size-s .ql-code { width: 34mm; height: 34mm; }
.qr-label.size-m .ql-code { width: 30mm; height: 30mm; }
.qr-label.size-l .ql-code { width: 44mm; height: 44mm; }
.qr-svg { width: 100%; height: 100%; display: block; }
.ql-info { min-width: 0; display: flex; flex-direction: column; gap: .6mm; }
.ql-brand { font-size: 6.5pt; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; font-weight: 700; }
.ql-name { font-size: 11pt; font-weight: 800; line-height: 1.1; word-break: break-word; }
.qr-label.size-l .ql-name { font-size: 15pt; }
.qr-label.size-s .ql-name { font-size: 9.5pt; }
.ql-model { font-size: 7.5pt; color: #374151; }
.ql-meta { font-size: 6.5pt; color: #6b7280; }
.ql-cta { margin-top: 1mm; font-size: 6.5pt; font-weight: 700; color: #b45309; }
.qr-label.size-l .ql-model { font-size: 10pt; }
.qr-label.size-l .ql-meta, .qr-label.size-l .ql-cta { font-size: 8pt; }
.qr-modal { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-modal .qr-label { border-style: solid; }
.qr-modal code { word-break: break-all; }

@media print {
  @page { margin: 8mm; }
  body { background: #fff !important; }
  .topbar, .nav-mobile, .m-subnav, .no-print, .toast-stack, #modal-root { display: none !important; }
  .main { padding: 0 !important; max-width: none !important; }
  .qr-sheet { padding: 0; gap: 4mm; border-radius: 0; }
  .qr-label { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (max-width: 720px) {
  .m-kpis.three .mk-ic { display: none; }
  .hide-sm { display: none; }
  .ss-row .input.sm { width: 90px; }
  .qr-sheet { justify-content: center; }
}

/* Import de protocole */
.imp-tree { max-height: 52vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.imp-all { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; width: 100%; }
.imp-h { margin: 12px 0 6px; }
.imp-item { margin-bottom: 8px; }
.imp-item-head { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.imp-item-head .ic { color: var(--accent); }
.imp-tasks { display: flex; flex-direction: column; gap: 3px; padding-left: 26px; }
.imp-task { align-items: flex-start; font-size: .86rem; }
.imp-txt { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.imp-exists { margin-left: auto; font-size: .68rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--deg-bg); color: var(--deg); white-space: nowrap; }
.imp-opts { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; }
.imp-sum { margin-left: auto; }
.measure-chip.small { font-size: .7rem; }

/* ==========================================================================
   Contrats de maintenance
   ========================================================================== */
.m-kpis .mk-val.small-val { font-size: 1.35rem; }
.contract-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 18px; }
.contract-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--ok); text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm); transition: var(--tr); }
.contract-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.contract-card.st-expiring { border-top-color: var(--due); }
.contract-card.st-expired { border-top-color: var(--bad); }
.contract-card.st-inactive { opacity: .6; border-top-color: var(--border-strong); }
.contract-card.st-future { border-top-color: var(--info); }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cc-title { display: flex; flex-direction: column; min-width: 0; }
.cc-title strong { font-size: 1.05rem; }
.ct-bar { position: relative; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: visible; }
.ct-fill { height: 100%; border-radius: 999px; background: var(--ok); }
.ct-bar.s-due .ct-fill { background: var(--due); }
.ct-bar.s-overdue .ct-fill { background: var(--bad); }
.ct-notice { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text); opacity: .55; border-radius: 1px; }
.cc-due { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.cc-due .ic { width: 14px; height: 14px; flex: 0 0 auto; }
.cc-due.s-due { color: color-mix(in srgb, var(--due) 85%, var(--text)); }
.cc-due.s-overdue { color: var(--bad); }
.cc-due.big { font-size: .92rem; margin: 10px 0 4px; }
.cc-machines { display: flex; flex-wrap: wrap; gap: 5px; }
.cc-contacts { display: flex; flex-direction: column; gap: 3px; font-size: .8rem; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); }
.cc-phone { display: inline-flex; align-items: center; gap: 5px; color: var(--info); }
.cc-phone .ic { width: 13px; height: 13px; }
.cc-person { color: var(--muted); }
.cc-person b { color: var(--text); }
.cc-foot { display: flex; flex-wrap: wrap; gap: 12px; margin-top: auto; }
.cc-foot span { display: inline-flex; align-items: center; gap: 4px; }
.cc-foot .ic { width: 12px; height: 12px; }

.contract-hero { border-top: 3px solid var(--ok); }
.contract-hero.st-expiring { border-top-color: var(--due); }
.contract-hero.st-expired { border-top-color: var(--bad); }
.ch-top { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ch-top p { margin: 4px 0 0; }
.mh-meta.four { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.mh-meta dd a { color: var(--accent); }
.hotline-btn { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 16px; border-radius: 12px; background: var(--info-bg); color: var(--info); text-decoration: none; border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); }
.hotline-btn strong { font-size: 1.1rem; letter-spacing: .02em; }
.hotline-btn:hover { background: color-mix(in srgb, var(--info) 22%, transparent); }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.contact-card { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.contact-card p { margin: 0; }
.contact-lines { display: flex; flex-direction: column; gap: 4px; }
.phone-link { display: inline-flex; align-items: center; gap: 6px; color: var(--info); text-decoration: none; font-weight: 600; font-size: .86rem; word-break: break-all; }
.phone-link .ic { width: 14px; height: 14px; flex: 0 0 auto; }
.phone-link:hover { text-decoration: underline; }
.phone-link.compact { font-size: .78rem; white-space: nowrap; }

/* Encart contrat sur la fiche machine */
.mh-contracts { display: flex; flex-direction: column; gap: 6px; }
.mhc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--ok); font-size: .85rem; }
.mhc-row.st-expiring { border-left-color: var(--due); }
.mhc-row.st-expired { border-left-color: var(--bad); }
.mhc-row > .ic { color: var(--muted); }
.mhc-main { display: flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--text); min-width: 0; flex-wrap: wrap; }
.mhc-main:hover strong { color: var(--accent); }
.mhc-due { margin-left: auto; }
.mhc-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; }
.mhc-add:hover { color: var(--accent); border-color: var(--accent); }
.mhc-add .ic { width: 13px; height: 13px; }

/* Formulaire contrat : interlocuteurs */
.contact-edit { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ce-row { display: grid; grid-template-columns: 1.1fr 1.2fr 1fr 1fr 1.4fr auto; gap: 6px; width: 100%; align-items: center; }
.ce-row .input.sm { width: 100%; }

/* Intervention : heure + contrat */
.db-t { font-size: .6rem; font-weight: 700; margin-top: 2px; opacity: .85; }
.contract-hint { display: flex; flex-direction: column; gap: 4px; }
.contract-hint:empty { display: none; }
.ch-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .8rem; padding: 6px 10px; border-radius: 8px; background: var(--info-bg); color: var(--text); }
.ch-line .ic { width: 14px; height: 14px; color: var(--info); }
.ch-line.st-expired { background: var(--bad-bg); }
.tl-inter b { font-weight: 800; margin-right: 2px; }

@media (max-width: 860px) {
  .ce-row { grid-template-columns: 1fr 1fr; }
  .mh-meta.four { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .contract-grid { grid-template-columns: 1fr; }
  .mhc-due { margin-left: 0; }
}

.tl-inter-lbl { position: absolute; z-index: 2; display: flex; align-items: center; padding: 0 6px; border: none; background: transparent; color: var(--text); font: inherit; font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-align: left; }
.tl-inter-lbl b { color: var(--info); margin-right: 3px; }
.tl-inter-lbl.s-done { color: var(--muted); }
.tl-inter-lbl.s-cancelled { color: var(--muted); text-decoration: line-through; }
.tl-inter-lbl.late { color: var(--bad); }
.tl-inter-lbl:hover { color: var(--accent); }

/* Frise : séparation entre sites */
.tl-site-sep { position: relative; z-index: 2; height: 30px; display: flex; align-items: center; background: color-mix(in srgb, var(--sc) 9%, var(--surface-2)); border-top: 2px solid var(--sc); border-bottom: 1px solid var(--border); }
.tl-body > .tl-overlay + .tl-site-sep { border-top-width: 0; }
.tss-lbl { position: sticky; left: 0; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: color-mix(in srgb, var(--sc) 70%, var(--text)); white-space: nowrap; }
.tss-lbl em { font-style: normal; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.tss-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--sc); }

/* ==========================================================================
   Cartes compactes : vignette carrée fixe + informations à droite
   ========================================================================== */
.parc-grid, .lib-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.m-card, .lib-card { flex-direction: row; align-items: stretch; min-height: 104px; }
.m-card:hover, .lib-card:hover { transform: translateY(-2px); }
.m-card { border-left: 3px solid var(--ok); }
.m-card.st-degraded { border-left-color: var(--deg); }
.m-card.st-down { border-left-color: var(--bad); }
.mc-cover, .lc-cover { flex: 0 0 88px; width: 88px; height: 88px; aspect-ratio: auto; margin: 8px 0 8px 8px; border-radius: 10px; overflow: hidden; align-self: flex-start; }
.mc-cover img, .lc-cover img { width: 88px; height: 88px; object-fit: cover; }
.mc-ph .ic { width: 34px; height: 34px; }
.lc-count { top: auto; bottom: 4px; right: 4px; padding: 1px 6px; font-size: .68rem; border-radius: 6px; }
.lc-count .ic { width: 11px; height: 11px; }
.mc-body, .lc-body { flex: 1; min-width: 0; padding: 9px 12px 10px; gap: 3px; }
.mc-title { justify-content: flex-start; }
.mc-title strong, .lc-name { font-size: .92rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
.mc-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-tags { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.mc-tags .st-badge { padding: 2px 8px 2px 6px; font-size: .68rem; }
.mc-tags .type-badge, .lc-body .type-badge { font-size: .66rem; padding: 1px 7px; }
.mc-meta { gap: 8px; font-size: .72rem; }
.mc-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mc-alerts { padding-top: 5px; gap: 4px; }
.mc-alerts .occ-chip { font-size: .68rem; padding: 2px 7px; }
.lc-stats { gap: 2px 10px; font-size: .7rem; }

/* Fiches machine et modèle : visuel carré de taille fixe */
.m-hero { grid-template-columns: 220px 1fr; }
.mh-media { width: 220px; height: 220px; aspect-ratio: auto; align-self: start; }
.model-head { grid-template-columns: 260px 1fr; }
.mo-cover { width: 260px; height: 260px; aspect-ratio: auto; }
.mo-gallery .gallery { grid-template-columns: repeat(auto-fill, 60px); }
.mo-gallery .g-item, .mo-gallery .g-add { width: 60px; height: 60px; }
.mo-gallery .g-add span { display: none; }
@media (max-width: 860px) {
  .m-hero, .model-head { grid-template-columns: 1fr; }
  .mh-media { width: 160px; height: 160px; aspect-ratio: auto; }
  .mo-cover { width: 200px; height: 200px; }
}
@media (max-width: 420px) {
  .parc-grid, .lib-grid { grid-template-columns: 1fr; }
}
.m-card.st-degraded, .m-card.st-down { border-color: var(--border); }
.m-card.st-degraded { border-left-color: var(--deg); }
.m-card.st-down { border-left-color: var(--bad); }

/* ==========================================================================
   Photos dans la checklist
   ========================================================================== */
.photo-req { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; font-size: .68rem; font-weight: 700; background: var(--vio-bg); color: var(--vio); white-space: nowrap; }
.photo-req .ic { width: 12px; height: 12px; }
.ck-photos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.ck-row:not(.sel) .ck-photos { display: none; }
.ck-photo-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.ck-photo-btn .ic { width: 16px; height: 16px; color: var(--info); }
.ck-photo-btn:hover { border-color: var(--accent); color: var(--accent); }
.ck-photo-btn.req { border-color: color-mix(in srgb, var(--vio) 60%, var(--border)); }
.ck-photo-btn.req .ic { color: var(--vio); }
.ck-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.ck-thumb { position: relative; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; }
.ck-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.ck-thumb-x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.ck-thumb-x .ic { width: 12px; height: 12px; }
.ck-spin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; vertical-align: middle; }
.cb-upl .ck-spin { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ck-row.need-photo { box-shadow: 0 0 0 2px var(--vio); }
.ck-row.need-photo .ck-photo-btn { border-style: solid; border-color: var(--vio); color: var(--vio); animation: blink 1.4s 3; }
.cb-upl { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; }
.lt-photos .gallery { grid-template-columns: repeat(auto-fill, 64px); margin: 6px 0 2px; }
.lt-photos .g-item { width: 64px; height: 64px; }
.lt-add-photo { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; padding: 3px 9px; border-radius: 7px; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); font: inherit; font-size: .74rem; cursor: pointer; }
.lt-add-photo:hover { color: var(--accent); border-color: var(--accent); }
.lt-add-photo .ic { width: 13px; height: 13px; }
.tl-dot.has-photo::after { content: ""; position: absolute; right: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--vio); box-shadow: 0 0 0 1.5px var(--surface); }

/* ==========================================================================
   Tableau de bord : arborescence Site › Machine › Tâches
   ========================================================================== */
.tt { display: flex; flex-direction: column; gap: 10px; }
.tt-site { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.tt-shead { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; flex-wrap: wrap; user-select: none;
  background: color-mix(in srgb, var(--sc) 9%, var(--surface-2)); border-left: 4px solid var(--sc); }
.tt-shead:hover { background: color-mix(in srgb, var(--sc) 14%, var(--surface-2)); }
.tt-sdot { width: 10px; height: 10px; border-radius: 3px; background: var(--sc); }
.tt-shead strong { font-size: .95rem; }
.tt-chev { display: inline-flex; color: var(--muted); transition: transform .18s; }
.tt-chev .ic { width: 16px; height: 16px; }
.tt-site.open > .tt-shead .tt-chev, .tt-machine.open > .tt-mhead .tt-chev { transform: rotate(90deg); }
.tt-site > .tt-machines { display: none; }
.tt-site.open > .tt-machines { display: flex; }
.tt-machines { flex-direction: column; display: flex; }
.tt-site > .tt-machines { padding: 4px 8px 8px; gap: 4px; }
.tt-machine { border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
.tt-machine.late { border-left: 3px solid var(--bad); }
.tt > .tt-machines { gap: 6px; }
.tt-mhead { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; flex-wrap: wrap; user-select: none; }
.tt-mhead:hover { background: var(--surface-2); border-radius: 9px; }
.tt-mname { font-weight: 650; color: var(--text); text-decoration: none; min-width: 0; }
.tt-mname:hover { color: var(--accent); }
.tt-chips { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tt-crit { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 700; color: var(--due); }
.tt-crit .ic { width: 12px; height: 12px; fill: currentColor; }
.tt-machine > .tt-tasks { display: none; border-top: 1px solid var(--border); }
.tt-machine.open > .tt-tasks { display: block; }
.tt-task { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 36px; text-decoration: none; color: var(--text); font-size: .85rem; border-top: 1px solid var(--border); }
.tt-task:first-child { border-top: none; }
.tt-task:hover { background: var(--surface-2); }
.tt-label { flex: 1; min-width: 0; }
.tt-dates { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.tt-toggles { display: inline-flex; gap: 2px; }
.tt-tg { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 7px; border: none; background: transparent; color: var(--muted); font: inherit; font-size: .74rem; cursor: pointer; }
.tt-tg:hover { background: var(--surface-3); color: var(--text); }
.tt-tg .ic { width: 13px; height: 13px; }
.up-zone { border-top: 3px solid var(--info); }
@media (max-width: 720px) {
  .tt-tg span { display: none; }
  .tt-chips { margin-left: 0; width: 100%; padding-left: 24px; }
  .tt-task { padding-left: 14px; flex-wrap: wrap; }
  .tt-dates { width: 100%; justify-content: flex-start; padding-left: 14px; }
}
@media (max-width: 720px) {
  .tt-mhead .btn { order: 2; margin-left: auto; padding: 5px 10px; }
  .tt-mhead .tt-chips { order: 3; }
  .tt-shead .link-more { order: 2; margin-left: auto; }
  .tt-shead .tt-chips { order: 3; }
}
