/* Steel neutrals, argon-blue accent, melt-orange for risk; utilitarian, works on a shop-floor phone and tablet.
   Phone first: 390 px wide, no horizontal scroll, tap targets 44 px. */
:root { --bg: #eef1f3; --paper: #f9fafb; --ink: #1c2328; --muted: #5d6870; --rule: #cfd6db;
  --accent: #2f5fd0; --ok: #2b8a3e; --warn: #b8730a; --bad: #c92a2a; --soft: #dfe7fa;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --tap: 44px; --on-accent: #fff; }
@media (prefers-color-scheme: dark) { :root { --bg: #13171a; --paper: #1a1f23; --ink: #e3e8eb; --muted: #95a2ab; --rule: #2c353b;
  --accent: #7d9df0; --ok: #69db7c; --warn: #ffc14d; --bad: #ff6b6b; --soft: #22304d; --on-accent: #10151b; color-scheme: dark; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); overflow-wrap: anywhere; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-block: 16px 60px; }
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 6px; } h2 { font-size: 19px; margin: 26px 0 8px; }
h3 { font-size: 17px; margin: 0; }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the bar */
.top { background: var(--ink); color: var(--bg); }
.top a, .top button.link { color: var(--bg); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; min-height: 52px; }
.brand { font-weight: 600; text-decoration: none; letter-spacing: .02em; min-height: var(--tap); display: inline-flex; align-items: center; }
/* the machine switcher (several machines on one site: ml/u27/machines.py) */
.machines { display: inline-flex; gap: .6em; align-items: center; font-size: .9em; }
.machines a { text-decoration: none; opacity: .8; }
nav { display: flex; flex-wrap: wrap; gap: 0 14px; }
nav a { text-decoration: none; opacity: .85; min-height: var(--tap); display: inline-flex; align-items: center; }
nav a:hover { opacity: 1; text-decoration: underline; }
.who { margin-left: auto; font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 8px; }

.muted { color: var(--muted); } .small { font-size: 13px; } .lede { max-width: 72ch; }
.err { color: var(--bad); } .ok { color: var(--ok); }
.card { background: var(--paper); border: 1px solid var(--rule); padding: 16px; display: grid; gap: 10px; margin: 12px 0; }
.card.narrow { max-width: 420px; margin: 40px auto; } .card.row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; }
label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
/* 16 px in fields: iOS does not zoom the page into them */
input, select { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule);
  padding: 8px 10px; border-radius: 3px; min-width: 0; min-height: var(--tap); width: 100%; }
input[type=file] { min-height: 0; }
button, .btn { font: inherit; background: var(--accent); color: var(--on-accent); border: 0; padding: 8px 16px; border-radius: 3px; cursor: pointer;
  min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: none; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; color: var(--accent); padding: 0 4px; text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .btn:focus-within, .seg label:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* tables; .cards: a card per row on a phone */
.t { border-collapse: collapse; width: 100%; background: var(--paper); border: 1px solid var(--rule); font-size: 14px; display: block; overflow-x: auto; }
.t.narrow { max-width: 480px; }
.t th, .t td { padding: 7px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.t th { font: 500 12px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.t tr.off td { opacity: .5; }
.t.cards { display: table; }
@media (max-width: 640px) {
  .t.cards, .t.cards tbody { display: block; background: none; border: 0; }
  .t.cards thead { display: none; }
  .t.cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; position: relative; background: var(--paper);
    border: 1px solid var(--rule); padding: 12px 14px; margin-bottom: 8px; }
  .t.cards td { display: block; padding: 0; border: 0; }
  .t.cards td.lead { order: -1; flex: 1 0 100%; font-weight: 600; font-size: 15px; }
  .t.cards td[data-l]::before { content: attr(data-l) " "; color: var(--muted); font: 12px var(--font); }
  .t.cards .stretch { color: var(--muted); text-decoration: none; }
  .t.cards .stretch::after { content: ""; position: absolute; inset: 0; }     /* the whole card opens the print */
  .wide-only { display: none; }
  .who span { display: none; }
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { font: 500 12px/1 var(--mono); padding: 3px 7px; border: 1px solid var(--rule); border-radius: 3px; white-space: nowrap; display: inline-block; }
.pill.todo { border-color: var(--accent); color: var(--accent); }
.sev { font: 500 12px/1 var(--mono); padding: 3px 7px; border-radius: 3px; border: 1px solid currentColor; text-decoration: none; white-space: nowrap; display: inline-block; }
.sev-ok { color: var(--ok); } .sev-warn { color: var(--warn); } .sev-bad, .sev-error { color: var(--bad); }

/* the landing */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; background: var(--paper); border: 1px solid var(--rule); padding: 14px 16px; }
.state { font-size: 22px; font-weight: 600; } .state.s-printing { color: var(--ok); } .state.s-paused { color: var(--warn); }
.facts { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.cta { display: grid; gap: 2px; margin: 12px 0 0; padding: 14px 18px; background: var(--accent); color: var(--on-accent); text-decoration: none; border-radius: 3px; min-height: 64px; }
.cta b { font-size: 18px; } .cta span { font-size: 13px; opacity: .9; }
@media (min-width: 641px) { .cta { display: inline-grid; min-width: 360px; } }

/* a print: parts as cards */
.box { background: var(--paper); border: 1px solid var(--rule); margin: 12px 0; }
.box > summary { padding: 0 14px; min-height: var(--tap); display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 500; }
.box > :not(summary) { margin: 0 14px 12px; }
.runs { padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.parts { display: grid; gap: 12px; }
@media (min-width: 900px) { .parts { grid-template-columns: 1fr 1fr; align-items: start; } }
.part { background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--rule); padding: 12px 14px; display: grid; gap: 10px; min-width: 0; }
.part.sev-b-warn, .crow.sev-b-warn { border-left-color: var(--warn); } .part.sev-b-bad, .crow.sev-b-bad { border-left-color: var(--bad); }
.part.sev-b-ok, .crow.sev-b-ok { border-left-color: var(--ok); }
.ph { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.st { margin-left: auto; color: var(--muted); white-space: nowrap; }
.st.ok { color: var(--ok); } .st.err { color: var(--bad); white-space: normal; }
.msgs { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 3px; }
.msgs .m-info { color: var(--muted); }
.cam p { margin: 0 0 6px; }
.strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cam .strip { display: grid; grid-template-columns: repeat(4, minmax(0, 120px)); }     /* four in a row on a phone */
.shot { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--bg); border: 1px solid var(--rule); }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot span { position: absolute; left: 0; bottom: 0; font: 11px/1 var(--mono); padding: 2px 4px; background: rgba(0, 0, 0, .6); color: #fff; }

/* the verdict: a segmented control of big buttons (radios underneath: keyboard and screen readers work) */
.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; min-width: 0; }
.seg label { position: relative; display: block; color: var(--ink); font-size: 14px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15; min-height: var(--tap);
  padding: 4px 2px; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); cursor: pointer; user-select: none;
  overflow-wrap: normal; hyphens: auto; }     /* a word breaks with a hyphen, if at all, not anywhere */
.seg input:checked + span { color: var(--on-accent); background: var(--muted); border-color: var(--muted); font-weight: 600; }
.seg .t-ok input:checked + span { background: var(--ok); border-color: var(--ok); }
.seg .t-warn input:checked + span { background: var(--warn); border-color: var(--warn); }
.seg .t-bad input:checked + span { background: var(--bad); border-color: var(--bad); }
.note input { width: 100%; }
.meas > summary { min-height: var(--tap); display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--accent); font-size: 14px; }
.meas > summary .muted { color: var(--muted); }
.evrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.evrow .wide, label.wide { grid-column: 1 / -1; }

/* photos */
.photos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.photos .strip { flex: 1 0 100%; }
.photos .strip:empty { display: none; }
.photos figure { position: relative; margin: 0; width: 96px; height: 96px; background: var(--bg); border: 1px solid var(--rule); }
.photos figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .x { position: absolute; top: 0; right: 0; width: 32px; min-height: 32px; height: 32px; padding: 0; font-size: 20px; line-height: 1;
  background: rgba(0, 0, 0, .55); color: #fff; border-radius: 0 0 0 3px; }
.photos .tag { position: absolute; left: 0; bottom: 0; font: 11px/1 var(--mono); padding: 2px 4px; background: rgba(0, 0, 0, .6); color: #fff; }
.btn input[type=file] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.btn { position: relative; }

/* coupons: one compact row each */
.call { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.crows { display: grid; gap: 6px; }
.crow { display: grid; grid-template-columns: minmax(0, 1fr) 140px 90px; grid-template-areas: "n v r" "s s s"; align-items: center; gap: 2px 8px;
  border-left: 4px solid var(--rule); padding: 4px 0 4px 8px; }
.crow .cn { grid-area: n; font-family: var(--mono); font-size: 14px; min-width: 0; }
.crow select { grid-area: v; } .crow input { grid-area: r; }
.crow .st { grid-area: s; margin: 0; text-align: right; }
.crow .st:empty, .crow .st.ok { display: none; }       /* a row says only "saving" and a failure; saved: the green edge */
.crow.saved select { border-color: var(--ok); }
.crow.chead { border-left-color: transparent; padding-block: 0; }
.crow.chead .cn { font-family: var(--font); font-size: 13px; }
@media (max-width: 400px) { .crow { grid-template-columns: minmax(0, 1fr) 128px 76px; gap: 2px 6px; } .crow select { padding-inline: 6px; } }
@media (min-width: 900px) { .crows { grid-template-columns: 1fr 1fr; column-gap: 24px; } }
.pnote { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.pnote input { flex: 1 1 260px; }

.crumbs { margin: 0; font-size: 13px; }
.crumbs a { display: inline-flex; min-height: 32px; align-items: center; }
code, .sel { font-family: var(--mono); word-break: break-all; user-select: all; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 10px; }
form.inline select { width: auto; }
progress { width: 220px; max-width: 100%; vertical-align: middle; }

/* the assistant (templates/assistant.html, static/assistant.js) */
.as { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.as-side { display: grid; gap: 10px; }
.as-new { display: grid; gap: 8px; }
.as-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.as-list li { padding: 6px 8px; border-left: 3px solid transparent; }
.as-list li.on { border-left-color: var(--accent); background: var(--paper); }
.as-list .link { background: none; color: var(--accent); padding: 0; min-height: 0; text-align: left; }
.as-main { display: grid; gap: 10px; min-width: 0; }
.as-log { background: var(--paper); border: 1px solid var(--rule); padding: 12px; height: 62vh; overflow-y: auto; display: grid; gap: 8px; align-content: start; }
.as-msg { max-width: 85%; padding: 8px 12px; border-radius: 6px; }
.as-user { justify-self: end; background: var(--soft); }
.as-bot { justify-self: start; border: 1px solid var(--rule); }
.as-who { font-size: 12px; color: var(--muted); }
.as-text { white-space: pre-wrap; }
.as-tool { font: 13px/1.4 var(--mono); color: var(--muted); }
.as-tool pre, .as-approval pre { white-space: pre-wrap; max-height: 260px; overflow: auto; margin: 4px 0 0; font-size: 12px; }
.as-write summary { color: var(--warn); } .as-err summary { color: var(--bad); }
.as-approval { border: 2px solid var(--warn); padding: 10px 12px; border-radius: 6px; display: grid; gap: 6px; }
.as-row { display: flex; flex-wrap: wrap; gap: 8px; } .as-row input { flex: 1 1 200px; width: auto; }
.as-note { font-size: 13px; color: var(--muted); }
.as-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.as-form textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); padding: 8px 10px; border-radius: 3px; width: 100%; resize: vertical; }
@media (max-width: 760px) { .as { grid-template-columns: 1fr; } .as-log { height: 55vh; } .as-msg { max-width: 100%; } }
.as-approval button.secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule); }

/* picture viewer over the page (site.js) */
.lb { position: fixed; inset: 0; z-index: 50; background: rgba(8, 10, 12, .92); display: none; align-items: center; justify-content: center; padding: 12px; }
.lb.on { display: flex; }
body.lb-open { overflow: hidden; }
.lb figure { margin: 0; max-width: 100%; max-height: 100%; display: grid; gap: 6px; justify-items: center; }
.lb img { max-width: calc(100vw - 24px); max-height: calc(100vh - 70px); object-fit: contain; background: #000; }
.lb figcaption { color: #d8dee3; font-size: 13px; text-align: center; }
.lb figcaption a { color: #9fb8ff; }
.lb button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 50%; width: 48px; height: 48px; min-height: 0; padding: 0; font-size: 28px; line-height: 1; }
.lb .lb-x { top: 10px; right: 10px; }
.lb .lb-p { left: 10px; top: 50%; transform: translateY(-50%); }
.lb .lb-n { right: 10px; top: 50%; transform: translateY(-50%); }
.lb button[hidden] { display: none; }

/* defects of a part (print.html) */
.defects summary { cursor: pointer; }
.dlist { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
.dlist li { padding: 4px 6px; background: var(--bg); border-left: 3px solid var(--warn); }
.dlist .x { margin-left: 6px; background: transparent; color: var(--bad); min-height: 0; padding: 0 6px; }
.dadd { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; margin: 6px 0; }
.dadd .wide { grid-column: 1 / -1; }

/* the registries (people, powder lots, loads) */
label.chk { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; min-height: var(--tap); }
label.chk input { width: 22px; height: 22px; min-height: 0; flex: none; }
label.grow { flex: 1 1 220px; }
fieldset.evrow { border: 0; padding: 0; margin: 0; min-width: 0; }
h2.flush { margin: 0; }
.t tr.hl td { background: var(--soft); }
ul.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
