/* Parc chariots (parc.html), on top of app.css: indicator tiles, filters, register of the machines, synthesis by model,
   machine sheet in a side panel, costs and VGP windows. The forklift photo stays in the background, faint.
   Every rule is scoped to body.parc. */

body.parc {
  /* The former application's colour names, mapped onto MyDipro's (light and dark follow the theme). */
  --warn: var(--high); --warn-bg: var(--high-soft); --crit-bg: var(--crit-soft); --ok-bg: var(--ok-soft); --neutral-bg: var(--surface-2);
  --yellow: #8A6200; --photo-op: .42; --glass: 72%;
  --tint-fen: rgba(214, 58, 47, .045); --tint-fen-h: rgba(214, 58, 47, .10); --tint-jun: rgba(232, 180, 0, .07); --tint-jun-h: rgba(232, 180, 0, .14);
}
:root[data-theme="dark"] body.parc {
  --yellow: #F1B62A; --photo-op: .36; --glass: 78%;
  --tint-fen: rgba(255, 110, 96, .05); --tint-fen-h: rgba(255, 110, 96, .11); --tint-jun: rgba(241, 190, 40, .05); --tint-jun-h: rgba(241, 190, 40, .11);
}
.parc .parc-photo { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--photo-op);
  background: url("../img/parc-fond.webp") no-repeat right max(-2vw, -24px) bottom 0 / min(1400px, 96vw) auto }
@media (max-width: 700px) { .parc .parc-photo { background-size: 130vw auto; background-position: right -20vw bottom 0 } }
.parc #app, .parc #noAccess { position: relative; z-index: 1 }
/* Wide register: the whole width of the screen, with a small margin. */
.parc .wrap { max-width: none; padding-inline: clamp(12px, 2vw, 32px) }

/* Indicator tiles */
.parc .parc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px }
.parc .parc-kpi { background: color-mix(in srgb, var(--surface) var(--glass), transparent); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; text-align: left; cursor: pointer; font: inherit; color: var(--ink) }
.parc .parc-kpi:hover { border-color: var(--accent) }
.parc .parc-kpi .v { font-family: var(--f-display); font-size: 2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--title) }
.parc .parc-kpi .l { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600 }
.parc .parc-kpi .d { font-size: .8rem; color: var(--muted) }
.parc .parc-kpi.crit .v { color: var(--crit) }
.parc .parc-kpi.warn .v { color: var(--warn) }
.parc .parc-kpi.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent) }

/* Filters */
.parc .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center }
.parc .filters input, .parc .filters select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink);
  background: color-mix(in srgb, var(--surface) var(--glass), transparent); max-width: 100% }
.parc .filters input[type=search] { flex: 1 1 220px; min-width: 0 }
.parc .seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--surface) var(--glass), transparent) }
.parc .seg button { font: inherit; border: 0; border-right: 1px solid var(--line); padding: 8px 12px; background: transparent; color: var(--ink); cursor: pointer }
.parc .seg button:last-child { border-right: 0 }
.parc .seg button[aria-pressed=true] { background: var(--brand-navy); color: #fff }
.parc .count { color: var(--muted); font-size: .85rem; margin-left: auto }

/* Tables */
.parc .tablebox, .parc .panelbox { background: color-mix(in srgb, var(--surface) var(--glass), transparent); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto }
.parc table { border-collapse: collapse; width: 100% }
.parc table.fleet { min-width: 1160px }
.parc .panelbox table { min-width: 520px }
.parc th, .parc td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line) }
.parc th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent); position: sticky; top: 0 }
.parc tbody tr[data-id] { cursor: pointer; box-shadow: inset 4px 0 0 transparent }
.parc tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent) }
.parc tbody tr.s-crit { box-shadow: inset 4px 0 0 var(--crit) }
.parc tbody tr.s-warn { box-shadow: inset 4px 0 0 var(--warn) }
.parc tbody tr:last-child td { border-bottom: 0 }
.parc tbody tr.m-fen { background: var(--tint-fen) }
.parc tbody tr.m-fen:hover { background: var(--tint-fen-h) }
.parc tbody tr.m-jun { background: var(--tint-jun) }
.parc tbody tr.m-jun:hover { background: var(--tint-jun-h) }
.parc .num { font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; line-height: 1.1 }
.parc .mono { font-family: var(--f-mono); font-size: .82rem }
.parc .tnum { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap }
.parc .nowrap { white-space: nowrap; font-variant-numeric: tabular-nums }
.parc .cell { display: flex; flex-direction: column; gap: 3px; min-width: 0 }
.parc .c-crit { color: var(--crit) }
.parc .parc-empty { padding: 36px 16px; text-align: center; color: var(--muted) }
.parc .pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--neutral-bg); color: var(--muted) }
.parc .pill.ok { background: var(--ok-bg); color: var(--ok) }
.parc .pill.warn { background: var(--warn-bg); color: var(--warn) }
.parc .pill.crit { background: var(--crit-bg); color: var(--crit) }
.parc .pill.vgp.crit { font-weight: 800; font-size: .78rem }
.parc .tag { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted) }
.parc .tag.loc { border-color: var(--yellow); color: var(--yellow) }
.parc button.vgpmiss { font: inherit; cursor: pointer; border: 1px solid var(--crit); background: var(--crit-bg); color: var(--crit); border-radius: 999px; padding: 2px 8px; font-size: .78rem; font-weight: 800 }
.parc button.vgpmiss:hover { text-decoration: underline }
.parc button.vgpmiss.plain { background: transparent; border-color: transparent; font-size: inherit }
.parc .costbtn { font: inherit; color: var(--ink); display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; background: transparent; border: 1px solid transparent;
  border-radius: 6px; padding: 4px 6px; margin: -4px -6px; text-align: right; cursor: pointer; font-variant-numeric: tabular-nums }
.parc .costbtn:hover { border-color: var(--accent) }
.parc .costbtn .lnk { font-size: .74rem; font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 2px }
.parc details.arch summary { cursor: pointer; font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: 1.2rem; color: var(--title) }
.parc .arch-box { margin-top: 10px }
.parc .parc-h2 { font-family: var(--f-display); font-weight: 700; font-size: 1.5rem; text-transform: uppercase; margin: 12px 0 0; letter-spacing: .02em; color: var(--title) }
.parc .grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start }
@media (max-width: 900px) { .parc .grid2 { grid-template-columns: minmax(0, 1fr) } }
.parc .notes { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; color: var(--muted) }
.parc .notes b { color: var(--ink) }

/* Machine sheet (side panel) */
.parc .overlay { position: fixed; inset: 0; background: rgba(10, 12, 14, .45); display: flex; justify-content: flex-end; z-index: 20 }
.parc .sheet { background: var(--bg); width: min(640px, 100%); height: 100%; overflow-y: auto; border-left: 4px solid var(--brand-navy);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); padding-right: env(safe-area-inset-right, 0px) }
.parc .sheet-h { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; gap: 12px; z-index: 1 }
.parc .sheet-h .num { font-size: 2rem }
.parc .sheet-h .t { flex: 1; min-width: 0 }
.parc .sheet-b { padding: 16px 18px; display: flex; flex-direction: column; gap: 18px }
.parc .statusrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
@media (max-width: 480px) { .parc .statusrow { grid-template-columns: minmax(0, 1fr) } }
.parc .sbox { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px }
.parc .sbox .l { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600 }
.parc .sbox b.big { font-family: var(--f-display); font-size: 1.5rem; font-variant-numeric: tabular-nums }
.parc fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; margin: 0; background: var(--surface); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px }
@media (max-width: 480px) { .parc fieldset { grid-template-columns: minmax(0, 1fr) } }
.parc legend { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: 1.05rem; padding: 0 6px; letter-spacing: .03em; color: var(--title) }
.parc .sheet label, .parc .quick label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); font-weight: 500; min-width: 0 }
.parc label.full { grid-column: 1 / -1 }
.parc .sheet label input, .parc .sheet label select, .parc .sheet label textarea, .parc .quick input, .parc .quick select, .parc .modal-b select, .parc .vm-date {
  font: inherit; font-size: .92rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; width: 100% }
.parc .modal-b .filters select { width: auto }
.parc textarea { resize: vertical; min-height: 60px }
.parc .stack { display: flex; flex-direction: column; gap: 14px }
.parc .quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 12px }
.parc .quick label { flex: 1 1 140px }
.parc .quick label.wide { flex: 2 1 220px }
.parc .quick label.line { flex-basis: 100% }
.parc .quick label.check { flex-direction: row; align-items: center; gap: 6px; flex: 0 0 auto }
.parc .quick label.check input { width: auto }
.parc .hist-h { font-size: 1.15rem; margin: 0 0 8px }
.parc .hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px }
.parc .hist li { display: grid; grid-template-columns: 90px 90px minmax(0, 1fr) 110px auto; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 10px; font-size: .88rem }
.parc .hist .hcost { font: inherit; font-size: .85rem; width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--ink); text-align: right }
@media (max-width: 520px) { .parc .hist li { grid-template-columns: minmax(0, 1fr) 100px } .parc .hist li > span:nth-child(3) { grid-column: 1 / -1 } }
.parc .sheet-f { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center }
.parc .row-end { display: flex; gap: 8px; align-items: center; flex-wrap: wrap }
.parc .btn.danger { color: var(--crit); border-color: var(--crit) }

/* Windows: costs, VGP to fill in */
.parc .parc-modal { position: fixed; inset: 0; background: rgba(10, 12, 14, .5); z-index: 25; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)) }
.parc .modal-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; width: min(1040px, 100%); overflow: hidden }
.parc .modal-h { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.parc .modal-h h3 { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: 1.5rem; margin: 0; flex: 1; min-width: 0; color: var(--title) }
.parc .modal-h h3 .sub { font-family: var(--f-body); text-transform: none; font-size: .9rem; font-weight: 500; color: var(--muted) }
.parc .modal-b { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px }
.parc .parc-modal table { min-width: 760px }
.parc .costsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px }
.parc .vm-alert { background: var(--crit-bg); color: var(--crit); font-weight: 600 }
.parc .vm-date { width: auto; padding: 5px 8px }
.parc .vm-state { color: var(--ok); font-weight: 600; white-space: nowrap }

@media (prefers-reduced-motion: no-preference) { .parc .sheet { animation: parc-slide .18s ease-out } @keyframes parc-slide { from { transform: translateX(24px); opacity: .6 } } }

/* Over the photo: the register's cells let it show through, a light halo keeps the text readable. */
.parc .tablebox th { background: color-mix(in srgb, var(--surface-2) 70%, transparent) }
.parc .tablebox td { text-shadow: 0 0 6px var(--surface) }
