/*
 * The Parts Department pages: the cockpit at /inventory (Job Parts, Inventory, Requests and Transfers tabs) and
 * stock level suggestions. These rules were <style> blocks in parts/cockpit.html.twig and
 * parts/stock/level_suggestions.html.twig until theming phase 3; they moved here so a theme can restyle them.
 *
 * Listed before app.css in theme.yaml, so app.css still wins every tie, as it did when these were in the page head.
 */

.pc-toolbar-right { display: flex; align-items: center; gap: 1rem; }
/* The tab bar's bottom rule reads as the top edge of the tab's content, so it needs real air
   beneath it. Out-specifies Bootstrap's `.nav { margin-bottom: 0 }` (this used to be a <style> block that
   rendered before Bootstrap's CSS, so it had to win on specificity; it still does). */
.nav.pc-tabs { margin-bottom: 2rem; }
.pc-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.pc-group__label { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bs-muted, #6b7280); margin: 0 0 0.5rem 0.1rem; }
.pc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 0.55rem; }
.pc-tiles--wide { margin-bottom: 0.8rem; }
/* The four status boxes each have a colour of their own: To Order red, On Order orange, Awaiting release green, Returns neon blue. It
   colours the outline, the count and the label; the box you are on is picked out with a glow in the same colour. */
.pc-tile--to_order { --pc-tile: #e5484d; }
.pc-tile--on_order { --pc-tile: #ff8a1f; }
.pc-tile--dates_to_confirm { --pc-tile: #e5484d; }
.pc-tile--awaiting_release { --pc-tile: var(--bs-hi-vis, var(--rs-accent)); }
.pc-tile--returns { --pc-tile: #26c6ff; }
/* The Inventory page's boxes: replenishment matches the job lists' To Order / On Order / Returns; the stock levels run green to red. */
.pc-tile--stock_to_order { --pc-tile: #e5484d; }
.pc-tile--stock_on_order { --pc-tile: #ff8a1f; }
.pc-tile--stock_returns { --pc-tile: #26c6ff; }
.pc-tile--all { --pc-tile: #8b95a5; }
.pc-tile--in_stock { --pc-tile: var(--bs-hi-vis, var(--rs-accent)); }
.pc-tile--low { --pc-tile: #f0b429; }
.pc-tile--out { --pc-tile: #e5484d; }
.pc-tile--surplus { --pc-tile: #a78bfa; }
/* Requests and transfers: what is coming in is green, what is going out is orange. */
.pc-tile--requests_in, .pc-tile--transfers_in { --pc-tile: var(--bs-hi-vis, var(--rs-accent)); }
.pc-tile--requests_out, .pc-tile--transfers_out { --pc-tile: #ff8a1f; }
/* The same graduated look as the Jobs dashboard's status tiles: a wash of the box's colour fading across it, a coloured edge down the
   left, a soft glow beneath. The box you are on has a stronger glow and a full outline. */
.es--stock .pc-tile[class*="pc-tile--"] {
    --tone: var(--pc-tile);
    --pc-wash: 9%;
    border: 1px solid color-mix(in srgb, var(--pc-tile) 38%, var(--es-line));
    background: linear-gradient(155deg, color-mix(in srgb, var(--pc-tile) var(--pc-wash), var(--es-panel, #fff)), var(--es-panel, #fff) 78%);
    box-shadow: inset 4px 0 0 var(--pc-tile), 0 6px 18px -10px color-mix(in srgb, var(--pc-tile) 45%, transparent);
}
[data-bs-theme="dark"] .es--stock .pc-tile[class*="pc-tile--"] { --pc-wash: 16%; }
.es--stock a.pc-tile[class*="pc-tile--"]:hover { border-color: color-mix(in srgb, var(--pc-tile) 70%, var(--es-line)); }
.es--stock .pc-tile[class*="pc-tile--"] .board-tile__count:not(.board-tile__count--zero), .es--stock .pc-tile[class*="pc-tile--"] .board-tile__label { color: var(--pc-tile); }
.es--stock .pc-tile[class*="pc-tile--"].is-active { border-color: var(--pc-tile); box-shadow: inset 4px 0 0 var(--pc-tile), 0 0 0 1px var(--pc-tile), 0 0 16px color-mix(in srgb, var(--pc-tile) 50%, transparent); }
/* Every word in the boxes starts with a capital: "To Order", "Arrived, To Fit". */
:root:lang(en) .pc-tiles--wide .pc-tile .board-tile__label, :root:lang(en) .pc-tiles--wide .pc-tile .pc-tile__sub { text-transform: capitalize; }
/* Title and count on the left, the search box on the same line at the right. */
.pc-jobs .pc-worklist__head { flex-wrap: wrap; align-items: center; margin-bottom: 0.5rem; }
.pc-worklist__title { display: flex; align-items: baseline; gap: 0.9rem; }
.pc-jobs .pc-worklist__head .pc-search { margin-inline-start: auto; }
.pc-tile { text-decoration: none; position: relative; display: flex; flex-direction: column; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.pc-tile:hover { transform: translateY(-1px); }
.pc-tile.is-active { box-shadow: inset 0 0 0 2px rgba(20,23,26,0.55), 0 8px 18px -12px rgba(16,24,40,0.5); }
/* Reserve two lines for the label and one for the sub so every tile is the same height whether the
   label wraps (e.g. "Awaiting release" in the narrower 4-up column) or not. */
.pc-tile .board-tile__label { min-height: 2.5em; line-height: 1.25; }
.pc-tile__sub { display: block; min-height: 2.2em; font-size: 0.58rem; line-height: 1.25; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; margin-top: 0.2rem; }
/* .pc-filters, .pc-worklist__head, .pc-meta, .pc-sub and .pc-rowform moved to app.css (RSPH-151):
   parts/stock/browse.html.twig uses all five and extends the base layout directly, so it never saw
   this block — its request form rendered with full-width inputs that pushed the button out of the
   row. A rule used by two pages does not belong in one page's <style>. */
.pc-cats { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pc-search { margin-inline-start: auto; }
.pc-search input { font: inherit; font-size: 0.88rem; padding: 0.45rem 0.7rem; border: 1px solid var(--bs-line, #c9ced6); border-radius: calc(8px * var(--rs-radius-scale)); min-width: 240px; }
.pc-subchips { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.9rem; }
.pc-subchips__lead { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bs-muted, #6b7280); }
.pc-section-label { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bs-muted, #6b7280); margin: 1rem 0 0.4rem; }
.pc-suggest { display: block; font-size: 0.72rem; color: var(--rs-amber-ink); margin-top: 0.15rem; }
/* Stock already on its way — the reason a Low item doesn't need ordering again. */
.pc-incoming { display: block; font-size: 0.72rem; color: #0a6ebd; margin-top: 0.15rem; }
[data-bs-theme="dark"] .pc-incoming { color: #7cc4fa; }
/* A group of lines that belong on one order: a job's parts, or a supplier's consumables. */
.pc-jobgroup { border-inline-start: 3px solid var(--bs-hi-vis, var(--rs-blue)); }
.pc-jobgroup + .pc-jobgroup { margin-top: 0.85rem; }
/* To order: the mass apply bar under a job's header — one date and one supplier for the ticked parts. */
/* A part's name on the lists is a button that opens its details popup; it should read as text, with a hover cue. */
/* A job group's header: the job and the people to chase on the left; on the right its buttons with the cost summary under them. */
.pc-jobgroup__who { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
/* Each person is a box with the same height and corners as the "Order all for this job" button beside them, in the app's plain grey outline. */
.pc-jobgroup__staff { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pc-jobgroup__staff li {
    display: inline-flex; align-items: center; gap: 0.45rem; height: 1.85rem; padding: 0 0.7rem; border-radius: calc(8px * var(--rs-radius-scale));
    border: 1px solid var(--es-line); background: var(--es-field); color: var(--es-ink); font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
/* The column heading above the received-quantity box, in the same blue as the staff job titles. */
.data-table th.pc-col-ctl { color: #26c6ff; white-space: nowrap; }
.data-table td.pc-col-recv { width: 1%; }
/* The four part statuses wear the app's one pill family (tokens.css --pill-*), by what they mean: To order is red (nobody has ordered it),
   Ordered is blue (on its way), Received is green (arrived), and Back order is red and pulsing (the one that needs chasing). They had an
   orange, a red, a cyan and a red of their own; the dark theme's glow follows the tokens like every other pill. (2026-11-10, Jay's choice.) */
.pc-col-status .badge-flag.badge-flag--ordered, .pc-peek .badge-flag.badge-flag--ordered { --pt: var(--pill-info); --pbg: var(--pill-info-bg); --pbd: var(--pill-info-bd); }
/* A part still to be ordered. */
.pc-col-status .badge-flag.badge-flag--to-order, .pc-peek .badge-flag.badge-flag--to-order { --pt: var(--pill-bad); --pbg: var(--pill-bad-bg); --pbd: var(--pill-bad-bd); }
/* The card shown while the pointer rests on a part's name: the picture (or its placeholder) top left beside the name, the facts beneath across the full width of the card, so they wrap only when the card is as wide as it may be. Appended to <body>, so it floats over the page. */
.pc-peek { position: fixed; z-index: 2000; width: max-content; max-width: min(40rem, 94vw); padding: 0.7rem 0.85rem; border-radius: calc(10px * var(--rs-radius-scale)); font-size: 0.78rem;
    background: var(--bs-paper); color: var(--bs-text); border: 1px solid var(--bs-line); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); pointer-events: none; }
.pc-peek[hidden] { display: none; }
.pc-peek__inner { display: block; }
.pc-peek__head { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.6rem; }
.pc-peek__photo { width: 7.5rem; height: 7.5rem; object-fit: cover; border-radius: calc(8px * var(--rs-radius-scale)); border: 1px solid var(--bs-line); flex: none; }
.pc-peek__photo--none { display: flex; align-items: center; justify-content: center; text-align: center; padding: 0.4rem; font-size: 0.72rem; color: var(--bs-muted); border: 1px dashed var(--bs-line); background: none; }
.pc-peek__name { margin: 0; font-weight: 600; font-size: 0.86rem; overflow-wrap: anywhere; }
.pc-peek__number { margin: 0.1rem 0 0.4rem; color: var(--bs-muted); }
.pc-peek__facts { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.7rem; margin: 0; }
.pc-peek__facts dt { color: #0a8fc4; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
[data-bs-theme="dark"] .pc-peek__facts dt { color: #26c6ff; }
.pc-peek__facts dd { margin: 0; font-variant-numeric: tabular-nums; }
/* The Status heading sits over the middle of the pill beneath it, and the pill (with any note under it) is centred in its column. */
.data-table thead th.pc-col-status, .data-table td.pc-col-status { text-align: center; }
/* A part that has arrived and is waiting to be released. */
.pc-col-status .badge-flag.badge-flag--received, .pc-peek .badge-flag.badge-flag--received { --pt: var(--pill-good); --pbg: var(--pill-good-bg); --pbd: var(--pill-good-bd); }
/* A back-ordered part pulses red — the one status that needs chasing — as a slow glow around its box (and not at all for anyone who has
   asked their system for less motion). */
.pc-col-status .badge-flag.badge-flag--back-order, .pc-peek .badge-flag.badge-flag--back-order {
    --pt: var(--pill-bad); --pbg: var(--pill-bad-bg); --pbd: var(--pill-bad-bd); animation: pc-backorder-pulse 1.6s ease-in-out infinite; }
@keyframes pc-backorder-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0); background-color: rgba(229, 72, 77, 0.10); }
    50% { box-shadow: 0 0 9px 2px rgba(229, 72, 77, 0.75); background-color: rgba(229, 72, 77, 0.30); }
}
@media (prefers-reduced-motion: reduce) { .pc-col-status .badge-flag.badge-flag--back-order, .pc-peek .badge-flag.badge-flag--back-order { animation: none; } }
/* "3 in stock · Rack 7" under a part that is already on a shelf. */
.pc-stock-note { display: block; margin-top: 0.15rem; font-size: 0.72rem; font-weight: 600; color: var(--bs-hi-vis, var(--rs-accent)); }
[data-bs-theme="light"] .pc-stock-note { color: #0a7a53; }
.pc-jobgroup__hint { margin: 0.3rem 0 0; font-size: 0.66rem; color: var(--es-muted, var(--bs-muted)); }
.pc-jobgroup__staff span { color: #26c6ff; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.pc-jobgroup__mail { color: inherit; text-decoration: none; }
.pc-jobgroup__mail:hover, .pc-jobgroup__mail:focus-visible { text-decoration: underline; outline: none; }
.pc-jobgroup__none { font-style: normal; font-weight: 600; color: var(--a-overdue, #e5484d); }
.pc-jobgroup__side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.pc-jobgroup__side .pc-jobgroup__cost { justify-content: flex-end; }
/* Laid out on one grid so the staff boxes (left) and the cost boxes (right) sit on the same line: plate and buttons above, hint below. */
.pc-jobgroup__head:has(> .pc-jobgroup__who) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem 0.75rem; }
.pc-jobgroup__who, .pc-jobgroup__side { display: contents; }
.pc-jobgroup__id { grid-column: 1; grid-row: 1; }
.pc-jobgroup__actions { grid-column: 2; grid-row: 1; justify-self: end; }
.pc-jobgroup__staff { grid-column: 1; grid-row: 2; }
.pc-jobgroup__cost { grid-column: 2; grid-row: 2; justify-self: end; }
.pc-jobgroup__hint { grid-column: 1; grid-row: 3; }
/* The cost summary in a job group's header: each figure in a box with its label in front, between the job and its buttons. */
.pc-jobgroup__cost { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin: 0; }
/* Each figure is boxed in the app's plain grey outline, like the other uncoloured boxes. */
.pc-jobgroup__cost > div {
    display: flex; align-items: center; gap: 0.45rem; height: 1.85rem; padding: 0 0.7rem; border-radius: calc(8px * var(--rs-radius-scale)); white-space: nowrap;
    border: 1px solid var(--es-line); background: var(--es-field);
}
.pc-jobgroup__cost > .pc-jobgroup__warn { border-color: var(--a-soon, #d68a00); }
.pc-jobgroup__cost dt { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--es-muted, var(--bs-muted)); }
.pc-jobgroup__cost dd { margin: 0; font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pc-jobgroup__neg { color: var(--a-overdue, #d64545); }
.pc-jobgroup__warn dd { font-size: 0.74rem; font-weight: 600; color: var(--a-soon, #d68a00); }
.pc-marginform { display: inline-flex; align-items: center; gap: 0.2rem; }
.pc-jobgroup .pc-rowform input.pc-margin-input { width: 3.2rem; padding-inline: 0.3rem; text-align: end; }
.pc-marginform__pct { color: var(--es-muted, var(--bs-muted)); font-size: 0.78rem; }
.pc-linkbtn { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.pc-linkbtn:hover, .pc-linkbtn:focus-visible { text-decoration: underline; outline: none; }
/* To order: Apply all, History and Order all share one row, on the same line as the date and supplier controls; History and Order all are pushed to the right-hand end, away from the apply buttons. */
.pc-bulkbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 0.5rem; }
.pc-bulkbar .pc-bulk { flex: 0 1 auto; padding-inline-end: 0; }
.pc-bulkbar__extra { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding: 0.55rem 1rem 0.2rem 0; margin-inline-start: auto; }
.pc-bulkbar__extra form { margin: 0; }
.pc-bulk { display: flex; align-items: flex-end; gap: 0.5rem 1.25rem; flex-wrap: wrap; padding: 0.55rem 1rem 0.2rem; }
.pc-bulk__set { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.pc-bulk__warn { flex: 1 0 100%; margin: 0; font-size: 0.78rem; font-weight: 600; color: var(--a-overdue, #e5484d); }
.pc-bulk__warn[hidden] { display: none; }
.pc-bulk__row { display: inline-flex; align-items: center; gap: 0.4rem; }
/* The title above each mass-apply control, in the same blue as the staff job titles. */
.pc-bulk__title { color: #26c6ff; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.data-table th.pc-col-select, .data-table td.pc-col-select { width: 1%; padding-inline-end: 0; text-align: center; }
.pc-jobgroup__head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.95rem 1rem 0; }
.pc-jobgroup__wip { margin-inline-start: 0.5rem; }
/* Vehicle plate (green) and WIP number (purple), slightly enlarged so a job scans fast. */
.pc-plate { color: #0a8f4f; font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.pc-plate:hover { text-decoration: underline; }
.pc-wip { color: #7c3aed; font-weight: 600; font-size: 0.9rem; }
.pc-wip--block { display: block; }
[data-bs-theme="dark"] .pc-plate { color: #34d399; }
/* A registration in the cockpit is the app's number plate (the partial draws the workshop country's), shrunk to a row. Every plate
   of a country is one width, the longest registration it issues, so the plates line up down a column. Same rules as the customer
   record's tables (redesign.css .crec-plate) and the loading cards (app.css .vehicle-card__plate). */
.pc-reg { vertical-align: middle; box-sizing: border-box; justify-content: center; text-decoration: none; }
.pc-reg.plate { --plate-h: 1.45rem !important; --pc-ratio: 5.2; width: calc(var(--plate-h) * var(--pc-ratio)); }
.pc-reg.reg-plate--ae { --pc-ratio: 4.9; }
.pc-reg.reg-plate--eu, .pc-reg.reg-plate--ch { --pc-ratio: 5.8; }
.pc-reg.reg-plate--ru { --pc-ratio: 5; }
.pc-reg.reg-plate--us { --pc-ratio: 2.8; }
.pc-reg.reg-plate--br { --pc-ratio: 2.7; }
.pc-reg.reg-plate--cn { --pc-ratio: 3.2; }
.pc-reg.reg-plate--jp { --pc-ratio: 1.8; }
.pc-reg.mofa { width: auto; }
.pc-reg.reg-plate--uk { --strip: calc(0.85rem + 2px); width: 6.9rem; height: 1.45rem; font-size: 1.12rem; padding: 0 0.4rem 0 calc(0.85rem + 0.35rem); border-width: 1.5px; border-radius: calc(4px * var(--rs-radius-scale)); }
.pc-reg.reg-plate--uk.reg-plate--long { font-size: calc(1.12rem * 7 / var(--plate-chars, 8)); letter-spacing: 0.02em; }
a.pc-reg:hover { transform: none; }
.pc-jobgroup__id .pc-reg { margin-inline-end: 0.25rem; }

[data-bs-theme="dark"] .pc-wip { color: #a78bfa; }
.pc-supplier { font-weight: 700; font-size: 1.02rem; }
.pc-jobgroup__count { margin-inline-start: 0.6rem; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bs-muted, #6b7280); }
@media (max-width: 860px) { .pc-ledger { grid-template-columns: 1fr; } .pc-search { margin-inline-start: 0; } }

/* ---- Stock level suggestions ---- */
/* Figures stay on one line; the wrapped "0.0 a / week / not used / in this / period" stack made every
   row four lines tall. Only the reason text beside the badge is allowed to wrap. */
.sl-figure { white-space: nowrap; }
.sl-hints { margin-bottom: 1rem; }
.sl-hints .form-hint { margin-bottom: .35rem; }
