/* PHIL 2.0 production extras (Dylan 16 Nov): run tiles, printer Printing/Materials tabs, the 12 slots,
   print builder queue, one-tap big choices. Tokens only, so dark mode follows. */

/* Run tiles: PR number, status, product(s) and qty */
.kcard .rc-top{display:flex;justify-content:space-between;gap:8px;align-items:center}
.kcard .rc-prods{margin:8px 0 2px;display:flex;gap:6px 10px;flex-wrap:wrap;align-items:center}
.kcard .rc-prod{display:inline-flex;gap:6px;align-items:center}
.kcard .rc-acts{display:flex;gap:6px;margin-top:10px;flex-wrap:wrap}
.kcard .rc-acts:empty{display:none}
.draft-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:12px}
.draft-grid .kcard{margin:0}

/* Printer card: tabs next to the printer's name */
.prn-hd{flex-wrap:wrap;gap:8px 14px}
.prn-name{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
.prn-name h3{margin:0}
.prn-tabs button{display:inline-flex;align-items:center;gap:6px}
.prn-tabs .ct{font-size:11px;font-weight:700;background:var(--surface);border-radius:999px;padding:1px 7px;color:var(--muted)}
.prn-tabs button.on .ct{background:var(--bolt-100);color:var(--bolt-ink)}

/* The 12 slots: 6 per bay (M1-M5 + S1) */
.slots-h{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:4px 2px 8px}
.slots{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin-bottom:14px}
.slot{display:flex;flex-direction:column;align-items:flex-start;gap:3px;text-align:left;min-height:104px;padding:10px 12px;border-radius:var(--r);
  border:1.5px solid var(--line);background:var(--card);color:var(--ink);font:inherit;cursor:pointer;min-width:0;box-shadow:var(--sh-1)}
.slot:hover{border-color:var(--line2);background:var(--hover)}
.slot:disabled{cursor:default}
.slot .slot-code{font-size:12px;font-weight:800;color:var(--muted);letter-spacing:.02em}
.slot .slot-mat{font-size:15px;line-height:1.2;overflow-wrap:anywhere}
.slot .slot-lot{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;overflow-wrap:anywhere}
.slot .slot-exp{font-size:12px;color:var(--muted);display:flex;gap:4px;flex-wrap:wrap;align-items:center}
.slot .slot-empty{color:var(--faint);font-size:13px;margin-top:auto}
.slot.empty{background:var(--surface);border-style:dashed;box-shadow:none}
.slot.bad{border-color:var(--stop);background:var(--stop-bg)}

/* Print builder */
.bqueue{display:grid;grid-template-columns:repeat(auto-fill,minmax(380px,1fr));gap:16px;align-items:start}
.brun .hd{flex-wrap:wrap;gap:8px}
.brun .hd .chips{gap:6px}
.brun.kept{border-color:var(--info)}
.bfill{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.bfill .progress{flex:1;min-width:120px}
.progress.over span{background:var(--stop)}
.bitem{flex-wrap:wrap}
.bitem .grow{min-width:160px}
.bitem-acts{display:flex;gap:4px;flex-wrap:wrap}
.brun-ft{display:flex;gap:8px;justify-content:space-between;align-items:center;flex-wrap:wrap;padding:12px 16px;border-top:1px solid var(--line)}
.brun-order{display:flex;gap:4px;flex-wrap:wrap}

/* Plan drawer */
.prow{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap;margin-bottom:10px}
.needs{display:flex;flex-direction:column;gap:6px;max-height:320px;overflow-y:auto}
.needs .check{margin:0}

/* Finish pop-up */
.prn-clean{display:flex;gap:14px;align-items:center;padding:14px 16px;min-height:60px;border:1.5px solid var(--line2);border-radius:var(--r);background:var(--card)}
.prn-clean input{flex:none;width:26px;height:26px;margin:0;accent-color:var(--ok);cursor:pointer}
.prn-clean label{display:flex;flex-direction:column;gap:2px;cursor:pointer;flex:1;min-width:0;font-weight:400;margin:0;color:var(--ink)}
.prn-clean:has(input:checked){border-color:var(--ok);background:var(--ok-bg)}
.nextrun{background:var(--surface);border:0}
details.when summary{cursor:pointer;color:var(--muted);min-height:32px;display:flex;align-items:center}
details.when[open] summary{margin-bottom:8px}

/* One-tap QC / cleaning: two big choices */
.bigchoice{display:flex;gap:14px;align-items:center;width:100%;text-align:left;font:inherit;color:var(--ink);cursor:pointer;
  padding:18px;margin-bottom:12px;border-radius:var(--r-l);border:2px solid var(--line);background:var(--card);min-height:88px}
.bigchoice .bc-ic{flex:none;width:46px;height:46px;border-radius:50%;display:grid;place-items:center;font-size:24px;font-weight:800}
.bigchoice .bc-t{display:flex;flex-direction:column;gap:2px;min-width:0}
.bigchoice .bc-t b{font-size:18px}
.bigchoice .bc-t span{font-size:13px;color:var(--muted)}
.bigchoice.ok{border-color:var(--ok-line);background:var(--ok-bg)}
.bigchoice.ok .bc-ic{background:var(--ok);color:var(--card)}
.bigchoice.ok:hover{border-color:var(--ok)}
.bigchoice.bad{border-color:var(--stop-line)}
.bigchoice.bad .bc-ic{background:var(--stop-bg);color:var(--stop)}
.bigchoice.bad:hover{border-color:var(--stop)}

@media (max-width:1100px){ .slots{grid-template-columns:repeat(3,minmax(0,1fr))} }
@media (max-width:720px){
  .bqueue{grid-template-columns:minmax(0,1fr)}
  .slots{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .slot{min-height:96px;padding:8px 10px}
  .prow .field{width:auto!important;flex:1 1 120px!important}
  .brun-ft .btn.bolt{flex:1;justify-content:center}
  .bitem{flex-wrap:wrap!important}
  .bitem .grow{flex:1 1 calc(100% - 60px);min-width:0}
  .bitem-acts{flex:1 1 100%;justify-content:flex-end}
  .brun .hd h3{white-space:nowrap}
}

/* Production tabs in two groups (Dylan 16 Nov): Plan | Stages. Each group scrolls/wraps inside the bar, never the page. */
.ptabs{display:flex;flex-wrap:wrap;align-items:stretch;gap:0 18px;border-bottom:1px solid var(--line);margin:0 0 20px;max-width:100%}
.ptg{display:flex;align-items:flex-end;gap:8px;min-width:0;max-width:100%}
.ptg + .ptg{border-left:1px solid var(--line2);padding-left:18px}
.ptg-l{font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--ink);padding:0 0 13px;white-space:nowrap}   /* Dylan 16 Nov: black labels (ink = near-white in dark mode) */
.ptg-t{display:flex;align-items:flex-end;gap:2px;overflow-x:auto;scrollbar-width:none;min-width:0}
.ptg-t::-webkit-scrollbar{display:none}
.ptg-t a{padding:10px 12px;font-weight:600;font-size:14.5px;color:var(--muted);text-decoration:none;border-bottom:3px solid transparent;margin-bottom:-1px;white-space:nowrap;display:inline-flex;align-items:center}
.ptg-t a.on{color:var(--ink);border-bottom-color:var(--bolt)}
.ptg-t a:hover{color:var(--ink)}
.ptg-t .ct{font-size:12px;background:var(--sunk);border-radius:99px;padding:1px 7px;margin-left:5px;color:var(--muted)}
.ptg-ar{color:var(--faint);padding:0 0 12px;font-size:14px}
@media (pointer:coarse){ .ptg-t a{min-height:44px} }

/* Today: the daily equipment check on the right of the greeting tile */
.hero.ptoday{display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,380px);gap:18px;align-items:center}
.ptoday > *{position:relative;z-index:1}
.ptoday-chk{margin:0;display:flex;flex-direction:column;gap:8px;color:var(--ink)}
.ptoday-chk-h{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.ptoday-chk-h h3{margin:0;flex:1;min-width:120px;font-size:16px}
.ptoday-chk.due{border:2px solid var(--bolt)}
.ptoday-chk.fault{border:2px solid var(--stop)}
.ptoday-chk .btn{align-self:flex-start}

/* Design */
.dz-st{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.dz-sugg{display:inline-flex;align-items:center;gap:4px}
.dz-tbl td{vertical-align:top}

/* Manufacture */
.mf-note{margin-bottom:16px;background:var(--surface)}

/* IHM zones (Dylan 16 Nov): 18 tiles, one order each; phone: they stack */
.ihm-zones{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:stretch}   /* 19 Nov (Dylan): 3 a row, as on the floor */
.ihm-z{border:1.5px solid var(--line2);border-radius:16px;background:var(--card);padding:12px 14px;display:flex;flex-direction:column;gap:8px;min-width:0}
.ihm-z.free{background:var(--surface);border-style:dashed}
.ihm-z.ready{border-color:var(--ok-line);box-shadow:0 0 0 3px var(--ok-bg)}
.ihm-zh{display:flex;align-items:center;justify-content:space-between;gap:8px}
.ihm-code{font:800 20px/1.1 var(--fd)}
.ihm-free{padding:6px 0}
.ihm-oh{min-width:0;overflow-wrap:anywhere}
.ihm-cust{font-weight:600}
.ihm-items{display:flex;flex-direction:column;gap:6px;min-width:0}
.ihm-it{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px 8px;padding:6px 8px;border-radius:10px;background:var(--surface);min-width:0}
.ihm-it .grow{flex:1;min-width:120px;overflow-wrap:anywhere}
.ihm-it.ok{background:var(--ok-bg)}
.ihm-it.ok>.ic{color:var(--ok)}
.ihm-it>.ic{flex:none;margin-top:2px;color:var(--muted)}
.ihm-it .pill{flex:none}
.ihm-since{margin-top:auto;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.ihm-wait{margin-bottom:16px;border-color:var(--wait)}
.ihm-wrow{align-items:flex-start!important;flex-wrap:wrap;gap:12px}
.ihm-wrow .ihm-oh{min-width:160px;flex:0 1 220px}
.ihm-wrow .ihm-items{min-width:200px}

/* View processes (Clean, Manufacture) */
.vp{margin-bottom:16px;display:grid;gap:12px}
.vp[hidden]{display:none}
.vp-note{margin:-4px 0 0}
.vp-card .hd{flex-wrap:wrap;gap:8px}
.vp-card .hd h3{margin:0;display:flex;align-items:center;gap:8px}
.vp-in{padding:0 16px 14px;display:grid;gap:10px}
.vp-prods{display:flex;flex-wrap:wrap;gap:8px}
.vp-prod{display:inline-flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:12px;padding:4px 10px 4px 4px;font-size:13px;font-weight:600;min-width:0}
.vp-parts{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.vp-steps{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.vp-step{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--line);border-radius:14px;padding:10px 12px;min-width:0}
.vp-n{flex:none;width:28px;height:28px;border-radius:99px;background:var(--bolt-100);color:var(--ink);display:grid;place-items:center;font-weight:800;font-size:13px}
.vp-b{flex:1;min-width:0}
.vp-h{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-bottom:4px}
.vp-h .tag{font-size:11.5px}
.vp-row{display:flex;justify-content:space-between;gap:12px;padding:4px 0;border-top:1px dashed var(--line);font-size:14px}
.vp-row:first-of-type{border-top:0}
.vp-row>span{min-width:0;overflow-wrap:anywhere}
.vp-row>b{flex:none;text-align:right;white-space:nowrap}
.vp-row>b.vp-meas{color:var(--ink);background:var(--bolt-100);border-radius:8px;padding:0 8px}

@media (max-width:900px){ .hero.ptoday{grid-template-columns:minmax(0,1fr)} }
@media (max-width:720px){
  .ptabs{gap:0;border-bottom:0}
  .ptg{width:100%;border-bottom:1px solid var(--line);flex-direction:column;align-items:stretch;gap:0}
  .ptg + .ptg{border-left:0;padding-left:0;margin-top:6px}
  .ptg-l{padding:4px 0 0 9px}
  .ptg-t{flex-wrap:wrap}
  .ptg-t a{padding:10px 9px}
  .ptg-ar{display:none}
  .ptoday-chk .btn{align-self:stretch;justify-content:center}
  .ihm-zones{grid-template-columns:minmax(0,1fr)}
  .ihm-z.free{padding:8px 14px}
  .ihm-z.free .ihm-free{display:none}
  .ihm-z.free .ihm-code{font-size:16px}
  .vp-row{flex-direction:column;gap:2px}
  .vp-row>b{text-align:left;white-space:normal;align-self:flex-start}
}

/* Materials: one row per material with its lots inside (Dylan 18 Nov) */
.matgrp td{vertical-align:top}
.matgrp .ml-list{display:flex;flex-direction:column;gap:6px}
.matgrp .ml-count{margin-bottom:6px}
.ml-lot{display:flex;flex-direction:column;align-items:stretch;gap:4px;width:100%;min-height:40px;text-align:left;font:inherit;color:inherit;
  background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:7px 10px;cursor:pointer}
.ml-lot:hover{border-color:var(--ink)}
.ml-lot.gone{opacity:.65}
.ml-lot .ml-top{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 10px}
.ml-lot .ml-sub{display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px;color:var(--muted)}
.ml-lot .ml-left{display:inline-flex;align-items:center;gap:6px}
.ml-lot .ml-left .progress{min-width:60px!important}
/* Materials › History: used-up / written-off lots by material, newest first (Dylan 18 Nov) */
.mh-mat{border-top:1px solid var(--line)}
.mh-mat:first-of-type{border-top:0}
.mh-mat .mh-hd{padding:12px 16px 4px}
.mh-tbl tr.click{cursor:pointer}
@media (min-width:721px){
  .mh-tbl{table-layout:fixed;width:100%}
  .mh-tbl th:nth-child(1){width:22%} .mh-tbl th:nth-child(2),.mh-tbl th:nth-child(3){width:19%}
  .mh-tbl th:nth-child(4){width:10%} .mh-tbl th:nth-child(5){width:15%} .mh-tbl th:nth-child(6){width:15%}
}
.mh-tbl tr.click:hover td{background:var(--hover)}
.ml-none{border-top:1px solid var(--line)}
@media (max-width:720px){
  .tbl.cards.matgrp td.ml-cell{display:block}
  .ml-lot{min-height:44px}
  .mh-tbl tr.click{min-height:44px}
  /* History on a phone: a compact card per lot (lot + status on top, dates / runs / expiry in a 2x2 grid) */
  .tbl.cards.mh-tbl{padding:0 12px}
  .tbl.cards.mh-tbl tr{display:grid;grid-template-columns:1fr 1fr;gap:6px 12px;padding:10px 12px;margin-bottom:8px}
  .tbl.cards.mh-tbl td{display:block;padding:0;text-align:left}
  .tbl.cards.mh-tbl td[data-l]::before{display:block;font-size:11px;margin-bottom:1px}
  .tbl.cards.mh-tbl td[data-l="Lot"]::before,.tbl.cards.mh-tbl td[data-l="Status"]::before{display:none}
  .tbl.cards.mh-tbl td[data-l="Lot"]{order:-2}
  .tbl.cards.mh-tbl td[data-l="Status"]{order:-1;text-align:right}
}

/* Materials & equipment › Stock: one tile per material, its lots listed under it (Dylan, 20 Nov 2026) */
.mtiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:14px;margin-bottom:16px;align-items:start}
.mtile{padding:16px;display:flex;flex-direction:column;gap:8px}
.mtile .mt-name{font:700 19px var(--fd);line-height:1.2}
.mtile .mt-sum{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:14px}
.mtile .mt-sum i{width:1px;height:14px;background:var(--line)}
.mtile .mt-exp{font-size:13px;color:var(--muted);display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.mtile .mt-lots{display:flex;flex-direction:column;gap:6px;margin-top:4px;padding-top:10px;border-top:1px solid var(--line)}
@media (max-width:640px){ .mtiles{grid-template-columns:1fr} }
.mtile{cursor:pointer;transition:border-color .15s}
.mtile:hover{border-color:var(--ink)}
.mtile .mt-hd{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.mtile .mt-total{display:flex;flex-direction:column;align-items:flex-end;line-height:1.1}
.mtile .mt-total b{font:700 24px var(--fd)}
.mt-lot{display:flex;align-items:stretch;gap:8px;cursor:default}
.mt-lot.bad .mt-lot-body,.mt-lot.bad .mt-qtile{border-color:var(--stop,#d33)}
.mt-qtile{flex:none;display:grid;grid-template-columns:auto auto;grid-template-rows:1fr auto;align-items:center;column-gap:6px;min-width:76px;
  padding:6px 8px 5px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.mt-qtile b{font:700 24px var(--fd);line-height:1;grid-row:1;grid-column:1;text-align:center}
.mt-qtile .mt-arrows{grid-row:1;grid-column:2;display:flex;flex-direction:column;gap:2px}
.mt-qtile .mt-unit{grid-row:2;grid-column:1/3;font-size:10.5px;color:var(--muted);text-align:center;margin-top:3px;white-space:nowrap}
.mt-ar{width:22px;height:18px;padding:0;border:1px solid var(--line);border-radius:6px;background:var(--bg,#fff);font-size:9px;line-height:1;color:var(--ink);cursor:pointer}
.mt-ar:hover:not(:disabled){border-color:var(--ink);background:var(--bolt,#fcc01e)}
.mt-ar:disabled{opacity:.3;cursor:not-allowed}
.mt-lot-body{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:3px;text-align:left;font:inherit;color:inherit;background:var(--surface);
  border:1px solid var(--line);border-radius:12px;padding:8px 12px;cursor:pointer}
.mt-lot-body:hover{border-color:var(--ink)}
.mt-lotno{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-weight:800;font-size:16px;letter-spacing:.02em;color:var(--ink);overflow-wrap:anywhere}
.mt-lot-sub{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;font-size:12.5px;color:var(--muted)}
.mtile .mt-add{align-self:flex-start;margin-top:4px}
.mtile .mt-lots{border-top:1px solid var(--line)}
/* Drag a cartridge between slots (Dylan, 20 Nov 2026) */
.slot[data-lot]{cursor:grab;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.slot.dragging{opacity:.45}
.slot.drop-on{outline:3px solid var(--bolt,#f5c400);outline-offset:2px}
body.slot-dragging{cursor:grabbing;-webkit-user-select:none;user-select:none}
.slot-ghost{position:fixed;z-index:9999;pointer-events:none;transform:translate(-50%,-120%);background:#111;color:#fff;font-weight:700;font-size:13px;
  padding:6px 10px;border-radius:9px;box-shadow:0 6px 18px rgba(0,0,0,.25);white-space:nowrap}
