/* Pyrios MES in the Pyrios design system: graphite and white, one orange mark, square corners, hairlines,
   status as a square beside a word, Helvetica Neue and Menlo, a dark twin (static/js/theme.js sets data-theme). */
:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f2f2;
  --raise: #e9e9e9;
  --line: #d6d6d6;
  --line-2: #8a8a8a;
  --text: #161616;
  --muted: #575757;
  --faint: #717171;
  --link: #2f6fe0;
  --amber: #f4a52a;
  --amber-hi: #f4a52a;
  --amber-ink: #161616;
  --on-ink: #ffffff;
  --green: #2fa36b;
  --blue: #4b8df8;
  --cyan: #4b8df8;
  --red: #e0464a;
  --yellow: #eac435;
  --violet: #8a8a8a;
  --r-lg: 0;
  --r: 0;
  --r-sm: 0;
  --op: #161616;
  --op-head: #f2f2f2;
  --op-head-line: #d6d6d6;
  --op-label: #575757;
  --sub: #ffffff;
  --sub-line: #d6d6d6;
  --field: #ffffff;
  --field-text: #161616;
  --field-line: #8a8a8a;
  --field-ph: #717171;
  --field-off: #f2f2f2;
  --sub-label: #575757;
  --head: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: Menlo, "SF Mono", Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #161616; --panel: #161616; --panel-2: #222222; --raise: #333333; --line: #333333; --line-2: #717171;
  --text: #ffffff; --muted: #a3a3a3; --faint: #8a8a8a; --link: #4b8df8; --amber-ink: #161616; --on-ink: #161616;
  --op: #ffffff; --op-head: #222222; --op-head-line: #333333; --op-label: #a3a3a3; --sub: #161616; --sub-line: #333333;
  --field: #161616; --field-text: #ffffff; --field-line: #717171; --field-ph: #8a8a8a; --field-off: #222222; --sub-label: #a3a3a3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 40px; line-height: 1.1; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 19px; line-height: 1.25; }
p { margin: 0 0 8px; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.wrap { white-space: pre-wrap; }
.grow { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.stack > * + * { margin-top: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── top bar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar-in, .tabs-in, main { max-width: 1440px; margin: 0 auto; padding: 0 28px; }
.topbar-in { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: flex; align-items: center; gap: 16px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.wordmark { font: 500 30px/1 var(--body); letter-spacing: 0.32em; }
.wordmark b { color: var(--amber); font-weight: 400; letter-spacing: 0; margin-left: -0.12em; }
.brand-mod { font: 600 22px/1 var(--head); color: var(--muted); padding-left: 16px; border-left: 1px solid var(--line-2); }
.search { position: relative; flex: 1; max-width: 720px; margin-left: auto; }
.search input {
  width: 100%; height: 48px; padding: 0 44px; border-radius: var(--r);
  background: var(--panel); border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 16px;
}
.search input::placeholder { color: var(--faint); }
.search svg { position: absolute; left: 15px; top: 15px; color: var(--muted); }
.search kbd {
  position: absolute; right: 12px; top: 12px; font: 13px var(--body); color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 7px;
}
.search-results {
  position: absolute; top: 54px; left: 0; right: 0; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 6px;  max-height: 420px; overflow: auto;
}
.search-results a { display: flex; gap: 12px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); }
.search-results a:hover, .search-results a.on { background: var(--raise); text-decoration: none; }
.search-results .kind { width: 82px; color: var(--muted); font-size: 13px; padding-top: 1px; }
.user-pill {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px 0 7px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 16px; cursor: pointer;
}
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--raise); font-weight: 600; font-size: 14px; }
.user-menu {
  position: absolute; right: 0; top: 56px; width: 280px; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--r); padding: 6px; 
}
.user-menu button {
  width: 100%; text-align: left; display: block; padding: 9px 10px; border-radius: var(--r-sm);
  background: none; border: 0; color: var(--text); font: inherit; cursor: pointer;
}
.user-menu button:hover, .user-menu button.on { background: var(--raise); }
.user-menu small { display: block; }

.tabs { background: var(--bg); border-bottom: 1px solid var(--line); }
.tabs-in { display: flex; gap: 4px; overflow-x: auto; }
.tabs a {
  font: 600 21px/1 var(--head); color: var(--muted); padding: 16px 18px 18px; white-space: nowrap;
  border-bottom: 4px solid transparent;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--amber); }

main { padding-top: 36px; padding-bottom: 80px; }
.banner { max-width: 1440px; margin: 20px auto 0; padding: 12px 18px; border-radius: var(--r); background: var(--panel-2);
  border: 1px solid var(--line); color: var(--text); width: calc(100% - 56px); }
.user-menu #sign-out { border-top: 1px solid var(--line-2); border-radius: 0 0 var(--r-sm) var(--r-sm); margin-top: 4px; }

/* sign-in page */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 40px 36px 32px; }
.login-card h1 { margin: 26px 0 10px; }
.login-sub { color: var(--muted); font-size: 17px; margin-bottom: 26px; }
.login-btn { width: 100%; }
.login-err { color: var(--text); background: var(--panel-2); border: 1px solid var(--red); border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 18px; }
.login-note { color: var(--muted); margin-bottom: 18px; }
.login-foot { color: var(--faint); font-size: 14px; margin: 18px 0 0; }

/* ── buttons & inputs ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  font: 500 15px/1 var(--body); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--raise); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn-primary:hover { background: var(--amber-hi); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 18px; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--text); border-color: var(--red); background: var(--panel-2); }
.btn-danger:hover { background: var(--raise); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

input, select, textarea {
  font: inherit; color: var(--field-text); background: var(--field); border: 1px solid var(--field-line);
  border-radius: var(--r-sm); padding: 8px 10px; min-height: 38px; width: 100%;
  color-scheme: light; /* dark arrows, date pickers and spinners on the light fields */
}
input::placeholder, textarea::placeholder { color: var(--field-ph); opacity: 1; }
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--amber); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber);  }
input:disabled, select:disabled, textarea:disabled { background: var(--field-off); color: var(--faint); cursor: not-allowed; }
select option { color: var(--field-text); background: var(--field); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--faint); }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.label-row { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }
.label-row label { cursor: default; }
.check-row { display: flex; align-items: center; gap: 8px; }
.access-policy { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 14px 16px; margin: -4px 0 14px; }
.access-policy .check { align-items: flex-start; }
.access-policy input { margin-top: 3px; }
.info {
  flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: help;
  font: italic 600 12px/1 Georgia, "Times New Roman", serif;
}
.info:hover, .info[aria-expanded="true"] { color: var(--amber); border-color: var(--amber); }
.tip {
  position: fixed; z-index: 80; max-width: min(320px, calc(100vw - 16px)); padding: 10px 13px; border-radius: 9px;
  background: var(--raise); border: 1px solid var(--line-2); color: var(--text); font-size: 14px; line-height: 1.45;  pointer-events: none;
}
.tip[hidden] { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }

/* ── page head ─────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 17px; margin-top: 10px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ── panels ────────────────────────────────────────────── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 26px; }
.panel + .panel, .panel + .grid-2, .grid-2 + .panel, .grid-2 + .grid-2, .kpis + .panel, .kpis + .grid-2 { margin-top: 24px; }
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.grid-2 > .panel, .grid-2 > div > .panel:first-child { margin-top: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; font-size: 16px; }

/* KPI strip — one container, divided, like the procurement dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpi { padding: 24px 28px 22px; border-right: 1px solid var(--line); color: var(--text); display: block; }
.kpi:last-child { border-right: 0; }
a.kpi:hover { background: var(--panel-2); text-decoration: none; }
.kpi .v { font: 600 46px/1 var(--head); }
.kpi .l { color: var(--muted); font-size: 18px; margin-top: 10px; }
.kpi .s { color: var(--muted); font-size: 14px; margin-top: 6px; }
.kpi.alert .v { color: var(--red); }
.kpi.warn .v { color: var(--yellow); }

/* status pipeline (circle stepper) */
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: relative; padding-top: 6px; }
.pipeline::before { content: ""; position: absolute; left: 10%; right: 10%; top: 33px; height: 2px; background: var(--line-2); }
.pipeline a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); font-size: 16px; text-align: center; }
.pipeline a:hover { text-decoration: none; color: var(--text); }
.pipeline .dot {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--panel);
  border: 2px solid var(--line-2); font: 600 22px/1 var(--head); color: var(--muted);
}
.pipeline .has .dot { border-color: var(--text); color: var(--text); }
.pipeline .has { color: var(--text); }

/* ── tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 14px; padding: 8px 10px;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.grid td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tbody tr.click { cursor: pointer; }
table.grid tbody tr.click:hover td { background: var(--panel-2); }
table.grid .id { font-weight: 600; white-space: nowrap; color: var(--text); }
table.grid td.sub { color: var(--muted); font-size: 14px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 180px; }
.filters input[type="search"] { min-width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 999px; padding: 5px 13px;
  font: inherit; font-size: 14px; cursor: pointer;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ── status badges ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 13px;
  font-weight: 500; white-space: nowrap; border: 1px solid currentColor; line-height: 1.5;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-gray { color: var(--muted); }
.b-blue { color: var(--blue); }
.b-cyan { color: var(--cyan); }
.b-green { color: var(--green); }
.b-red { color: var(--red); }
.b-yellow { color: var(--yellow); }
.b-violet { color: var(--violet); }
.b-amber { color: var(--amber); }
.flag { font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--raise); color: var(--muted); }
.flag.itar { background: var(--panel-2); color: var(--text); }
.flag.haz { background: var(--panel-2); color: var(--amber); }
.pri-hot { color: var(--red); font-weight: 600; }
.pri-high { color: var(--amber); font-weight: 600; }
.pri-low { color: var(--faint); }

/* attention list */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.attn li:last-child { border-bottom: 0; }
.attn .sev { width: 4px; border-radius: 2px; flex-shrink: 0; }
.attn .sev.high { background: var(--red); }
.attn .sev.med { background: var(--yellow); }
.attn .sev.low { background: var(--line-2); }
.attn .k { color: var(--muted); font-size: 13px; width: 86px; flex-shrink: 0; padding-top: 2px; }
.attn a { color: var(--text); }

/* bars */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding: 10px 4px 0; border-bottom: 1px solid var(--line-2); }
.bars .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; position: relative; }
.bars .seg { border-radius: 3px; min-height: 0; }
.bars .col:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--raise); border: 1px solid var(--line-2); padding: 4px 8px; border-radius: 6px; font-size: 13px; white-space: nowrap; z-index: 2;
}
.bar-labels { display: flex; gap: 14px; padding: 8px 4px 0; }
.bar-labels span { flex: 1; text-align: center; color: var(--muted); font-size: 13px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.hbar > i { display: block; height: 100%; background: var(--amber); border-radius: 4px; }

/* ── work order traveler ───────────────────────────────── */
.wo-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 24px; }
.wo-head dt { color: var(--muted); font-size: 14px; }
.wo-head dd { margin: 2px 0 0; font-size: 16px; }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; min-width: 80px; }
.progress i { display: block; height: 100%; background: var(--green); }

.rail { position: relative; }
.op { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 18px; position: relative; }
.op::before { content: ""; position: absolute; left: 31px; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.op:first-child::before { top: 30px; }
.op:last-child::before { bottom: calc(100% - 30px); }
.op.done::before { background: var(--green); }
.op-dot {
  position: relative; z-index: 1; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); border: 2px solid var(--line-2); font: 600 21px/1 var(--head); color: var(--muted); margin-top: 0;
}
.op.done .op-dot { border-color: var(--green); color: var(--green); }
.op.active .op-dot { border-color: var(--amber); color: var(--amber);  }
.op.qa .op-dot { border-color: var(--violet); color: var(--violet); }
.op-body { padding: 0 0 40px; min-width: 0; }
.op-title {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 60px; padding: 8px 18px;
  background: var(--op-head); border: 1px solid var(--op-head-line); border-left: 5px solid var(--op);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.op-title h3 { font-size: 22px; color: var(--text); }
.op-title .wc { color: var(--op-label); font-size: 15px; }
.op-title .meta { margin-left: auto; color: var(--op-label); font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.op-card {
  background: var(--panel); border: 1px solid var(--line); border-top: 0; border-left: 5px solid var(--op-head-line);
  border-radius: 0 0 var(--r-lg) var(--r-lg); padding: 18px 20px; margin-top: 0;
}
.op.active .op-title { border-color: var(--amber); border-left-color: var(--op); }
.op.active .op-card { border-color: var(--line); border-left-color: var(--op-head-line); }
.op.done .op-title { opacity: .85; }
.op-instr { white-space: pre-wrap; font-size: 16px; line-height: 1.55; max-width: 78ch; }
.safety { display: flex; gap: 10px; background: var(--panel-2); border: 1px solid var(--yellow); color: var(--text); border-radius: var(--r); padding: 10px 14px; margin: 12px 0; font-size: 15px; }
.tooling { color: var(--muted); font-size: 14px; margin-top: 8px; }
.op-section { margin-top: 16px; background: var(--sub); border: 1px solid var(--sub-line); border-radius: var(--r); padding: 12px 16px 14px; }
.op-section h4, .ed-sub h4 {
  font: 600 13px/1.2 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--sub-label); margin: 0 0 10px;
}
.op-section table.grid th { border-bottom-color: var(--sub-line); }
.op-section table.grid td, .op-section .data-row { border-bottom-color: var(--sub-line); }
.data-row { display: grid; grid-template-columns: minmax(140px, 1fr) 150px minmax(120px, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.data-row:last-child { border-bottom: 0; }
.data-row .lim { color: var(--muted); font-size: 14px; }
.oos { color: var(--red); font-weight: 600; }
.ins { color: var(--green); }
.signoffs { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-top: 12px; }
.signoffs b { color: var(--text); font-weight: 500; }
.op-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.added-tag { font-size: 12px; color: var(--amber); border: 1px solid var(--amber); border-radius: 4px; padding: 0 6px; }

/* ── steps editor (procedure drafts + WO redlines) ─────── */
.ed-step { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--op); border-radius: var(--r-lg); overflow: hidden; }
.ed-step + .ed-step { margin-top: 30px; }
.ed-step.locked { opacity: .62; }
.ed-step.locked input, .ed-step.locked textarea, .ed-step.locked select { pointer-events: none; }
.ed-step.new { border-left-color: var(--amber); }
.ed-step-head {
  display: grid; grid-template-columns: 90px minmax(0, 1fr) 200px auto; gap: 12px; align-items: end;
  background: var(--op-head); border-bottom: 1px solid var(--op-head-line); padding: 14px 18px 16px;
}
.ed-step-head .field > span { color: var(--op-label); font-weight: 500; }
.ed-step-head input { border-color: var(--line-2); }
.ed-step-head input[data-k="title"] { font-weight: 600; font-size: 16px; }
.ed-step-head .op-no input { background: var(--op); border-color: var(--op); color: var(--on-ink); font: 600 20px/1 var(--head); text-align: center; }
.ed-step-head .op-no input:focus { border-color: var(--amber); }
.ed-body { padding: 16px 18px 18px; display: grid; gap: 14px; }
.ed-note { margin: 0; }
.ed-sub { background: var(--sub); border: 1px solid var(--sub-line); border-radius: var(--r); padding: 12px 16px 14px; min-width: 0; }
.ed-sub h4 { display: flex; gap: 10px; align-items: center; }
.ed-sub h4 .btn, .ed-sub h4 .info { text-transform: none; letter-spacing: 0; }
.ed-line { display: grid; gap: 8px; align-items: center; margin-bottom: 6px; }
.ed-mat { grid-template-columns: minmax(200px, 2fr) 170px 140px minmax(120px, 1fr) 34px; }
.ed-mat-head { font-size: 13px; color: var(--sub-label); margin-bottom: 2px; align-items: end; }
.ed-mat-head .label-row { gap: 6px; }
.ed-mat-hint { grid-column: 1 / -1; margin: -2px 0 6px; font-size: 13px; }
.ed-mat-hint:empty { display: none; }
.amount { position: relative; }
.amount input { width: 100%; padding-right: 56px; }
.amount .uom { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; font-size: 14px; pointer-events: none; white-space: nowrap; }
.amount.unset input { border-color: var(--amber); background: var(--panel-2); }
.warn-text { color: var(--amber); }
.amt-unset { color: var(--amber); }
.ed-field { grid-template-columns: minmax(160px, 2fr) 130px 90px 100px 100px 90px 34px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: var(--red); border-color: var(--red); }
/* starting stock */
.paste { margin: 4px 0 14px; }
.paste summary { cursor: pointer; color: var(--blue); font-size: 15px; }
.paste textarea { width: 100%; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
table.grid.start-stock td { vertical-align: middle; }
.filters .check input { min-width: 0; }
.start-stock input:not([type=checkbox]), .start-stock select { width: 100%; min-width: 0; }
.start-stock .amount { min-width: 120px; }
.start-stock td:nth-child(4) { min-width: 120px; }
.start-stock td:nth-child(5) { min-width: 170px; }
.start-stock td:nth-child(6) { min-width: 150px; }
.start-stock td:nth-child(8) { width: 110px; }
.start-stock tr.filled > td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.start-stock tr.has-err > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.start-stock tr.err-row td { color: var(--text); background: var(--panel-2); font-size: 14px; padding-top: 6px; padding-bottom: 6px; }
.ed-bar { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 30%); padding: 26px 0 16px; margin-top: 10px; display: flex; gap: 10px; align-items: center; z-index: 5; }

/* ── diff ──────────────────────────────────────────────── */
.diff-step { border-left: 4px solid var(--line-2); padding: 10px 16px; background: var(--panel); border-radius: 0 var(--r) var(--r) 0; }
.diff-step + .diff-step { margin-top: 10px; }
.diff-step.added { border-left-color: var(--green); }
.diff-step.removed { border-left-color: var(--red); }
.diff-step.changed { border-left-color: var(--amber); }
.diff-step h4 { margin: 0 0 6px; font: 600 18px/1.2 var(--head); }
.diff-step ul { margin: 4px 0 0; padding-left: 18px; }
.diff-step li { margin: 3px 0; }
del { color: var(--text); background: var(--panel-2); text-decoration: line-through; padding: 0 3px; border-radius: 3px; }
ins { color: var(--text); background: var(--panel-2); text-decoration: none; padding: 0 3px; border-radius: 3px; }

/* revision list */
.revs { list-style: none; margin: 0; padding: 0; }
.revs li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.revs li:last-child { border-bottom: 0; }
.rev-tag { font: 600 22px/1 var(--head); text-align: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 0; }
.rev-tag.released { border-color: var(--green); color: var(--green); }
.rev-tag.draft { border-color: var(--amber); color: var(--amber); border-style: dashed; }
.rev-tag.superseded { color: var(--faint); }

/* trace tree */
.tree { list-style: none; margin: 0; padding-left: 0; }
.tree .tree { padding-left: 26px; border-left: 2px solid var(--line-2); margin-left: 10px; }
.tree li { padding: 6px 0; }
.node { display: inline-flex; gap: 10px; align-items: baseline; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 12px; }
.node.wo { background: transparent; border-style: dashed; }

/* ── modal & toast ─────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; background: rgba(22, 22, 22, .5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 24px 26px;  }
.modal.wide { width: min(980px, 100%); }
.modal h2 { margin-bottom: 6px; }
.modal .lede { color: var(--muted); margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal .err { color: var(--text); background: var(--panel-2); border: 1px solid var(--red); border-radius: var(--r-sm); padding: 9px 12px; margin-top: 14px; white-space: pre-wrap; }
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--green); border-radius: var(--r); padding: 12px 16px; max-width: 460px;  white-space: pre-wrap; }
.toast.err { border-left-color: var(--red); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .18s ease-out; }
  @keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
}
.loading { color: var(--muted); padding: 60px 0; text-align: center; }

/* ── responsive ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid-2, .grid-2.even { grid-template-columns: minmax(0, 1fr); }
  .brand-mod { display: none; }
}
@media (max-width: 760px) {
  .topbar-in, .tabs-in, main { padding: 0 16px; }
  main { padding-top: 24px; }
  .topbar { position: static; }
  .topbar-in { height: auto; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; gap: 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .wordmark { font-size: 22px; }
  .user-pill .uname { display: none; }
  .new-wo-btn { display: none; }
  h1 { font-size: 32px; }
  .panel { padding: 18px 16px; }
  .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .pipeline { grid-auto-flow: row; gap: 12px; }
  .pipeline::before { display: none; }
  .pipeline a { flex-direction: row; }
  .op { grid-template-columns: 44px minmax(0, 1fr); gap: 0 12px; }
  .op::before { left: 21px; }
  .op-dot { width: 44px; height: 44px; font-size: 17px; }
  .data-row { grid-template-columns: 1fr 1fr; }
  .ed-step-head, .ed-mat, .ed-field { grid-template-columns: 1fr 1fr; }
  .ed-step-head { padding: 12px; }
  .ed-body { padding: 12px; gap: 12px; }
  .ed-sub { padding: 10px 12px 12px; }
  .op-title { padding: 8px 12px; }
  .op-card { padding: 14px 12px; }
  .op-section { padding: 10px 12px 12px; }
  .ed-bar { flex-wrap: wrap; }
  .ed-bar .field.grow { flex-basis: 100%; }
  .ed-mat-head { display: none; }
  .form-grid .span-2 { grid-column: auto; }
  .filters input[type="search"] { min-width: 0; width: 100%; }
}

/* ── scan station ──────────────────────────────────────── */
.scan-panel .chips { margin-bottom: 14px; }
#scan-body { margin-top: 24px; }
.scan-row { display: flex; gap: 10px; align-items: stretch; }
.scan-input { flex: 1; height: 64px; font: 600 26px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; text-transform: uppercase; }
.scan-input::placeholder { text-transform: none; letter-spacing: 0; font: 400 18px var(--body); }
.scan-row .btn-lg { height: 64px; }
.scan-msg { margin-top: 12px; min-height: 48px; padding: 12px 16px; border-radius: var(--r); font-size: 19px; font-weight: 500; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.scan-msg:empty { visibility: hidden; }
.scan-msg.ok { background: var(--panel-2); border-color: var(--green); color: var(--text); }
.scan-msg.err { background: var(--panel-2); border-color: var(--red); color: var(--text); }
.scan-msg.warn { background: var(--panel-2); border-color: var(--amber); color: var(--text); }
.scan-msg.info { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.cam-box { position: relative; margin-top: 12px; max-width: 520px; border-radius: var(--r); overflow: hidden; background: #000; }
.cam-box video { display: block; width: 100%; }
.cam-aim { position: absolute; left: 10%; right: 10%; top: 38%; height: 24%; border: 2px solid var(--amber); border-radius: 8px; pointer-events: none; }
.panel.dest.set { border-color: var(--green); }
.dest-code { font: 600 56px/1 var(--head); color: var(--green); }
.dest-name { font-size: 18px; margin-top: 6px; }
.dest-empty { font: 600 30px/1.2 var(--head); color: var(--muted); padding: 16px 0 8px; }
.pending { margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--amber); border-radius: var(--r-sm); color: var(--text); }
tr.undone td { opacity: .5; }
tr.undone td.id a { text-decoration: line-through; }

/* ── labels ────────────────────────────────────────────── */
.labels-layout { margin-bottom: 24px; }
.pick-list { max-height: 420px; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 6px; }
.pick-group { font: 600 13px/1.2 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--sub-label); margin: 10px 0 2px; }
.pick-group:first-child { margin-top: 0; }
.label-sheet { display: flex; flex-wrap: wrap; gap: 18px; }
.label {
  width: 4in; height: 2in; padding: .12in .16in; overflow: hidden; display: flex; flex-direction: column;
  background: #fff; color: #000; border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); font-family: var(--body);
}
.label .l-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .08in; }
.label .l-title { font: 600 .32in/1 var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .l-flags { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.label .l-flags span { font: 700 .1in/1 var(--body); border: 1.5px solid #000; border-radius: 3px; padding: 2px 4px; white-space: nowrap; }
.label .l-flags span.inv { background: #000; color: #fff; }
.label .l-sub { font-size: .13in; line-height: 1.2; margin-top: .03in; max-height: 2.4em; overflow: hidden; }
.label .l-bars { flex: 1; min-height: .42in; margin-top: .05in; }
.label svg.bc { display: block; width: 100%; height: 100%; }
.label .bc-missing { border: 1px dashed #900; color: #900; font-size: .11in; padding: 4px; height: 100%; }
.label .l-code { font: 600 .14in/1.15 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; letter-spacing: .04em; }
.label .l-lines { font-size: .105in; line-height: 1.25; margin-top: .02in; }
.label-sheet.thermal2x1 .label { width: 2in; height: 1in; padding: .05in .08in; }
.label-sheet.thermal2x1 .l-title { font-size: .17in; }
.label-sheet.thermal2x1 .l-flags span { font-size: .07in; padding: 1px 2px; }
.label-sheet.thermal2x1 .l-sub, .label-sheet.thermal2x1 .l-lines { display: none; }
.label-sheet.thermal2x1 .l-bars { min-height: .3in; margin-top: .02in; }
.label-sheet.thermal2x1 .l-code { font-size: .09in; }
.label-sheet.avery5160 { display: grid; grid-template-columns: repeat(3, 2.625in); column-gap: .125in; row-gap: 12px; }
.label-sheet.avery5160 .label { width: 2.625in; height: 1in; padding: .06in .12in; border-radius: 4px; }
.label-sheet.avery5160 .l-title { font-size: .17in; }
.label-sheet.avery5160 .l-flags span { font-size: .07in; padding: 1px 2px; }
.label-sheet.avery5160 .l-sub { font-size: .08in; max-height: 1.2em; white-space: nowrap; text-overflow: ellipsis; }
.label-sheet.avery5160 .l-lines { display: none; }
.label-sheet.avery5160 .l-bars { min-height: .32in; margin-top: .02in; }
.label-sheet.avery5160 .l-code { font-size: .09in; }

/* ── procurement ───────────────────────────────────────── */
table.grid.tracker th, table.grid.tracker td { white-space: normal; }
table.grid.tracker tr.stages th { font: 600 14px/1.2 var(--body); color: var(--text); background: var(--panel-2); border-bottom: 1px solid var(--line-2); border-left: 1px solid var(--line); padding: 9px 10px; }
table.grid.tracker tr.stages th:first-child { border-left: 0; border-top-left-radius: var(--r-sm); }
table.grid.tracker tr.stages th b { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--amber); color: var(--amber-ink); font-size: 12px; }
table.grid.tracker td { min-width: 82px; }
table.grid.tracker tr.problem > td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.st { font-weight: 500; }
.st.ok { color: var(--green); }
.st.warn { color: var(--yellow); }
.st.bad, .bad { color: var(--red); font-weight: 500; }
.info-t { color: var(--blue); }
.who-fills { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 18px; }
.who-fills > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.who-fills b { display: block; }
.who-fills span { color: var(--muted); font-size: 14px; }
.problems { background: var(--panel-2); border: 1px solid var(--red); color: var(--text); border-radius: var(--r); padding: 12px 16px; margin-bottom: 20px; }
.problems > div + div { margin-top: 4px; }
.stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; position: relative; }
.stepper::before { content: ""; position: absolute; left: 10%; right: 10%; top: 20px; height: 2px; background: var(--line-2); }
.stepper > div { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); font-size: 15px; }
.stepper .dot { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line-2); font: 600 18px/1 var(--head); }
.stepper .done { color: var(--text); }
.stepper .done .dot { border-color: var(--green); color: var(--green); }
.stepper .now .dot { border-color: var(--amber); color: var(--amber);  }
.used-big { font-size: 18px; margin-bottom: 14px; }
.attn.hist .k { width: 128px; }
.used-big b { font: 600 26px/1 var(--head); }
.banner-ok { background: var(--panel-2); border: 1px solid var(--green); color: var(--text); border-radius: var(--r); padding: 12px 16px; margin: -12px 0 20px; }
textarea.mono { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* setup: warehouses */
.wh-block + .wh-block { margin-top: 18px; }
.wh-block.off { opacity: .6; }
.wh-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 4px; }
.wh-head .grow { flex: 1; }
table.grid tr.off td { opacity: .55; }

@media (max-width: 760px) {
  .scan-row { flex-wrap: wrap; }
  .scan-row .btn-lg { width: 100%; height: 48px; }
  .dest-code { font-size: 42px; }
  .stepper { grid-template-columns: 1fr; }
  .stepper::before { display: none; }
  .stepper > div { flex-direction: row; text-align: left; }
  .label-sheet.avery5160 { grid-template-columns: 1fr; }
}

/* printing labels only (the Print button on the labels page adds this class) */
@media print {
  body.printing-labels { background: #fff; }
  body.printing-labels .topbar, body.printing-labels .tabs, body.printing-labels .no-print,
  body.printing-labels .banner, body.printing-labels .toasts { display: none !important; }
  body.printing-labels main { padding: 0; margin: 0; max-width: none; }
  body.printing-labels .label-sheet { display: block; }
  body.printing-labels .label { box-shadow: none; border-radius: 0; break-inside: avoid; }
  body.printing-labels .label:not(:last-child) { break-after: page; }
  body.printing-labels .label-sheet.avery5160 { display: grid; grid-template-columns: repeat(3, 2.625in); column-gap: .125in; row-gap: 0; }
  body.printing-labels .label-sheet.avery5160 .label:not(:last-child) { break-after: auto; }
  body.printing-labels .label-sheet.avery5160 .label:nth-child(30n):not(:last-child) { break-after: page; }
}

/* ── printable traveler ────────────────────────────────── */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar, .tabs, .no-print, .op-actions, .toasts, .page-head .actions { display: none !important; }
  main { padding: 0; max-width: none; }
  .panel, .op-card { background: #fff; border-color: #999; break-inside: avoid; }
  .op-title { background: #eee; border-color: #999; border-left-color: #000; }
  .op-title h3, .op-title .wc, .op-title .meta { color: #000; }
  .op-section { background: #fff; border-color: #bbb; }
  .op-section h4 { color: #333; }
  .op-dot { background: #fff; border-color: #000 !important; color: #000 !important; box-shadow: none !important; }
  .op::before { background: #999 !important; }
  .muted, small, .wo-head dt { color: #444; }
  a { color: #000; }
  .badge { color: #000 !important; }
}

/* ── Pyrios design system: shape, type, status, brand ── */
*, *::before, *::after { border-radius: 0 !important; }
body { font: 400 14px/1.5 var(--body); }
a, .link-btn, .paste summary { color: var(--link); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--text); outline: 2px solid var(--text); outline-offset: 0; }
h1 { font-size: 26.67px; font-weight: 500; }
h2 { font-size: 18px; font-weight: 500; }
h3 { font-size: 15px; font-weight: 500; }
.topbar-in { height: 60px; }
.wordmark { display: inline-flex; align-items: center; }
.wordmark img { height: 16px; display: block; }
.wordmark .wm-dark, :root[data-theme="dark"] .wordmark .wm-light { display: none; }
:root[data-theme="dark"] .wordmark .wm-dark { display: block; }
.brand-mod { font: 500 14px/1 var(--body); }
.tabs a { font: 400 14px/1 var(--body); color: var(--muted); padding: 14px 14px 12px; border-bottom-width: 2px; display: inline-flex; align-items: center; gap: 8px; }
.tabs a.on { color: var(--text); font-weight: 500; border-bottom-color: var(--text); }
.tabs a.on::before { content: ""; width: 8px; height: 8px; background: var(--amber); }
.tabs-in { align-items: center; }
.theme-switch { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.33px; white-space: nowrap; }
.theme-switch select { width: auto; min-height: 30px; padding: 4px 8px; }
.btn { font: 500 14px/1 var(--body); background: var(--bg); border-color: var(--line-2); }
.btn:hover { background: var(--panel-2); }
.btn-danger { border-color: var(--red); }
.btn-primary, .btn-primary:hover { background: var(--text); border-color: var(--text); color: var(--on-ink); font-weight: 500; }
/* status as a square beside a word, the word in ink */
.st.ok, .st.warn, .st.bad, .bad, .oos, .ins, .pri-hot { color: var(--text); }
.st.ok::before, .st.warn::before, .st.bad::before, .bad::before, .oos::before, .ins::before, .pri-hot::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--red); }
.st.ok::before, .ins::before { background: var(--green); }
.st.warn::before { background: var(--yellow); }
.badge { color: var(--text); border: 0; padding: 0; gap: 6px; font-size: 13.33px; }
.badge::before { width: 8px; height: 8px; background: var(--c, var(--muted)); }
.b-gray { --c: var(--faint); } .b-blue, .b-cyan { --c: var(--blue); } .b-green { --c: var(--green); } .b-red { --c: var(--red); }
.b-yellow { --c: var(--yellow); } .b-violet { --c: var(--violet); } .b-amber { --c: var(--amber); }
.b-gray, .b-blue, .b-cyan, .b-green, .b-red, .b-yellow, .b-violet, .b-amber { color: var(--text); }
.warn-text, .amt-unset, .pri-high, .added-tag, .rev-tag.draft, .flag.haz, .info:hover, .info[aria-expanded="true"],
.op.active .op-dot, .stepper .now .dot, .pending { color: var(--text); }
.kpi .v, .dest-code { font-weight: 300; font-size: 32px; }
.kpi.alert .v, .kpi.warn .v, .dest-code { color: var(--text); }
.kpi .l { font-size: 13.33px; }
table.grid th { font-size: 10.67px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; border-bottom-color: var(--text); }
table.grid .id, .scan-input, textarea.mono, .paste textarea, .l-code { font-family: var(--mono); }
.panel, .kpis, .modal { border-color: var(--line); }
.modal { border-color: var(--text); }
.tip, .toast { background: var(--text); color: var(--on-ink); border-color: var(--text); }
.toast { border-left-color: var(--green); }
.chip.on { background: var(--text); color: var(--on-ink); }
