:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #1c2330; --muted: #667085; --line: #d9dde3;
  --accent: #1f5fbf; --ok: #1f8a4c; --ok-bg: #e6f4ec; --warn: #b26a00; --warn-bg: #fff4e0;
  --bad: #c0362c; --bad-bg: #fdecea;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; font-size: 12px; font-weight: 700; text-align: center; background: var(--warn); color: #fff; margin-left: 4px; }
.badge.bad { background: var(--bad); }
main { max-width: 1700px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 16px; }
[hidden] { display: none !important; }
.qstep { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.qstep .qs-btn { min-width: 26px; height: 26px; padding: 0; font-size: 16px; line-height: 1; border-radius: 6px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.qstep .qs-btn:hover { border-color: var(--accent); }
.qstep .qs-in { width: 48px; height: 26px; padding: 2px 4px; text-align: center; font-weight: 700; font-size: 14px; }
.qstep.saving .qs-in { border-color: #f0b400; } .qstep.saved .qs-in { border-color: var(--ok); background: #eefbea; } .qstep.err .qs-in { border-color: var(--bad); background: #fdecea; }
.unit-switch { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin: -6px 0 6px; } .unit-switch button { min-width: 52px; }
.grid.wording { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; } .grid.wording h3 { font-size: 15px; margin: 0 0 4px; } .grid.wording label { margin-top: 12px; } .grid.wording textarea { font-family: inherit; } .wording-preview { margin-top: 8px; } .wording-preview pre { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 6px; font-size: 12.5px; max-height: 360px; overflow: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.low td { background: var(--warn-bg); }
tr.neg td { background: var(--bad-bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
a { color: var(--accent); }
.btn, button { display: inline-block; font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--accent); }
.btn.small, button.small { padding: 3px 9px; font-size: 13px; }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
form.inline { display: inline; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%; background: #fff; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 15px; }
.check input { width: auto; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
.flash.info { background: #e8f0fd; color: var(--accent); }
.brand-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 14px; font-size: 13px; background: #fff; cursor: pointer; }
.chip input { width: auto; margin: 0; }
.chip.have { opacity: .55; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--muted); }
.pill.sent { background: #e8f0fd; color: var(--accent); }
.pill.failed { background: var(--bad-bg); color: var(--bad); }
.pill.pending { background: var(--warn-bg); color: var(--warn); }
.pill.to_order { background: var(--warn-bg); color: var(--warn); }
.pill.ordered { background: var(--ok-bg); color: var(--ok); }
.pill.received { background: var(--ok-bg); color: var(--ok); }
.muted { color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

.tools-table th { white-space: nowrap; }
.tools-table td { font-size: 14px; }
.tools-table td.desc { min-width: 220px; }
.tools-table td { white-space: nowrap; }
.tools-table td.desc { white-space: normal; }
.tools-scroll { max-height: 75vh; overflow: auto; }
.tools-table thead th { position: sticky; top: 0; z-index: 1; }

/* Scan station */
.modes { display: flex; gap: 0; margin-bottom: 16px; }
.modes button { flex: 1; font-size: 20px; padding: 14px; border-radius: 0; background: #fff; color: var(--ink); border: 2px solid var(--line); }
.modes button:first-child { border-radius: 8px 0 0 8px; }
.modes button:last-child { border-radius: 0 8px 8px 0; }
.modes button.on.issue { background: var(--accent); border-color: var(--accent); color: #fff; }
.modes button.on.receive { background: var(--ok); border-color: var(--ok); color: #fff; }
#scanInput { font-size: 26px; padding: 16px; text-align: center; border-width: 2px; }
#scanInput:focus { outline: none; border-color: var(--accent); }
#result { margin-top: 16px; padding: 24px; border-radius: 10px; text-align: center; min-height: 150px; }
#result.idle { background: #fff; border: 2px dashed var(--line); color: var(--muted); }
#result.ok { background: var(--ok-bg); color: #0f5130; }
#result.warn { background: var(--warn-bg); color: #6e4300; }
#result.bad { background: var(--bad-bg); color: #7a1d16; }
#result .big { font-size: 28px; font-weight: 700; }
#result .count { font-size: 56px; font-weight: 800; line-height: 1.1; }
#recent td { font-size: 14px; }
#receiveBox { display: none; margin-top: 16px; }
#receiveBox input { font-size: 22px; text-align: center; }

/* Scan station extras */
.mode-banner { text-align: center; font-size: 26px; font-weight: 800; letter-spacing: .03em; padding: 14px; border-radius: 10px; margin-bottom: 10px; color: #fff; }
.mode-banner.issue { background: var(--accent); }
.mode-banner.receive { background: var(--ok); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .75; } }
#result.receive-armed { background: var(--ok-bg); color: #0f5130; border: 3px dashed var(--ok); }
#notReady { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(192,54,44,.93); color: #fff;
  flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; font-size: 20px; }
#notReady .big { font-size: 44px; font-weight: 800; margin-bottom: 10px; }
.pill.quoted { background: #efe8fd; color: #6a3fc0; }

input.prefilled, span.prefilled { background: #fff8e1; border-color: #e7c66b; }
.each-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.each-row input.each { width: 84px; padding: 3px 7px; font-size: 13px; }
.each-row span { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---- Leverage additions */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a .badge { margin-left: 6px; }
.idno { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: .95em; line-height: 1.35;
  background: #e8f0fd; color: #163f86; border: 1px solid #b9cdf0; border-radius: 5px; padding: 0 6px; white-space: nowrap; letter-spacing: .02em; vertical-align: baseline; }
a .idno { text-decoration: none; } a:hover .idno { background: #d6e4fb; border-color: #8fb0e8; }
h1 .idno { font-size: .85em; padding: 1px 8px; margin-right: 4px; vertical-align: 2px; }
.muted .idno { font-size: 12px; }
.cat { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; letter-spacing: .03em; text-transform: uppercase; }
.cat.tooling { background: #e3ecfb; color: #1f4f9a; }
.cat.consumable { background: #e7f5ee; color: #17663b; }
.pill.full { background: var(--ok-bg); color: var(--ok); }
.pill.empty { background: var(--bad-bg); color: var(--bad); }
.pill.kanban { background: #f1e9fb; color: #6a3fc0; }
.pill.count { background: #eef0f3; color: var(--muted); }
/* kanban board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; align-items: start; }
@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, minmax(200px, 1fr)); } }
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }
.kcol { background: #eceef2; border-radius: 10px; padding: 10px; min-height: 120px; }
.kcol h3 { margin: 2px 4px 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: flex; justify-content: space-between; }
.kcard { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; font-size: 14px; }
.kcard.signal { border-left-color: var(--bad); }
.kcard.rfq { border-left-color: #6a3fc0; }
.kcard.ordered { border-left-color: var(--ok); }
.kcard.web { border-left-color: var(--warn); }
.kcard .t { font-weight: 700; }
.kcard[data-href] { cursor: pointer; transition: box-shadow .12s, transform .12s; }
.kcard[data-href]:hover { box-shadow: 0 2px 10px rgba(20, 40, 90, .18); transform: translateY(-1px); }
.kcard .m { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kcard .a { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dots i.e { background: var(--bad); }
.setup { max-width: 760px; margin: 40px auto; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 90%; }
/* ===== Theme: dark icon sidebar, light-gray canvas, white cards, compact tables (Inter) ===== */
:root {
  --bg: #f0f0f2; --panel: #fff; --ink: #1b1f3b; --muted: #7f7f84; --line: #e3e3e8; --line2: #d4d4da;
  --accent: #2563eb; --side: #1e3a8a; --side-ink: #c3cff0;
  --ok: #3f9b1f; --ok-bg: #effbe8; --ok-line: #8fd46b; --warn: #b26a00; --warn-bg: #fff6e5; --warn-line: #f2c46b;
  --bad: #d93a1e; --bad-bg: #fdeeea; --bad-line: #f2a08f; --info-bg: #eaf2ff; --info-line: #9cc0f5;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
body { font: 14.4px/1.45 Inter, system-ui, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); padding-left: 56px; }
main { max-width: 1800px; padding: 18px 28px 60px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 500; letter-spacing: -.01em; margin: 0 0 16px; }
h2 { font-weight: 600; }

/* sidebar: 56px icon rail, opens over the page on hover */
nav.side { position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: 56px; background: var(--side); display: flex; flex-direction: column;
  overflow: hidden; transition: width .15s ease; box-shadow: 1px 0 0 rgba(0,0,0,.2); }
nav.side:hover { width: 228px; box-shadow: 4px 0 24px rgba(0,0,0,.25); }
nav.side a, nav.side .me { display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 18px; color: var(--side-ink); white-space: nowrap; text-decoration: none; position: relative; font-size: 14px; }
nav.side a svg { flex: 0 0 20px; }
nav.side a:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
nav.side a.active { color: #fff; background: rgba(255,255,255,.08); }
nav.side a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #fff; }
nav.side .lbl { opacity: 0; transition: opacity .1s; }
nav.side:hover .lbl { opacity: 1; }
nav.side .brand { height: 64px; padding: 0 12px; color: #fff; font-weight: 700; }
nav.side .brand:hover { background: none; }
nav.side .brand .mark { flex: 0 0 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--side); display: grid; place-items: center; font-size: 13px; font-weight: 800; letter-spacing: -.02em; }
nav.side .brand .lbl { display: flex; flex-direction: column; line-height: 1.2; font-size: 15px; }
nav.side .brand small { color: var(--side-ink); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; white-space: normal; max-width: 160px; }
nav.side .links { flex: 1; overflow-y: auto; overflow-x: hidden; padding-top: 4px; }
nav.side .sep { display: block; height: 1px; background: rgba(255,255,255,.08); margin: 8px 14px; }
nav.side .badge { position: absolute; left: 30px; top: 5px; margin: 0; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; font-size: 10px; }
nav.side:hover .badge { position: static; margin-left: auto; height: 18px; line-height: 18px; font-size: 11px; }
/* menu groups (Fulcrum-style): a heading that opens to show its pages; pages only show while the menu is open (hover) */
nav.side .ghead { display: flex; align-items: center; gap: 14px; width: 100%; height: 40px; padding: 0 18px; border: 0; border-radius: 0; background: none; color: var(--side-ink);
  font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; position: relative; text-align: left; min-width: 0; }
nav.side .ghead svg { flex: 0 0 20px; }
nav.side .ghead:hover { color: #fff; background: rgba(255,255,255,.06); }
nav.side .chev { margin-left: auto; width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s, opacity .1s; flex: 0 0 8px; }
nav.side .ghead .badge + .chev { margin-left: 10px; }
nav.side .grp.open .chev { transform: rotate(45deg); }
nav.side .gitems { display: none; padding: 2px 0 6px; }
nav.side:hover .grp.open .gitems { display: block; }
nav.side .gitems a { height: 34px; padding: 0 14px 0 52px; font-size: 13.5px; }
nav.side .gitems a.active::before { top: 7px; bottom: 7px; }
nav.side .gitems .badge { position: static; margin-left: auto; height: 18px; line-height: 18px; font-size: 11px; }
nav.side .me { height: 56px; padding: 0 14px; font-size: 12.5px; border-top: 1px solid rgba(255,255,255,.08); }
nav.side .avatar { flex: 0 0 28px; height: 28px; border-radius: 50%; background: #3554b3; color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
nav.side .me a.avatar { padding: 0; height: 28px; text-decoration: none; }
nav.side .me .lbl { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
nav.side .me .lbl a.who { padding: 0; height: auto; color: var(--side-ink); overflow: hidden; text-overflow: ellipsis; }
nav.side .me .lbl small { opacity: .65; font-size: 11px; }
nav.side .me form.signout { margin-left: auto; }
nav.side:not(:hover) .me form.signout { display: none; }
nav.side .me form.signout button { background: transparent; border: 1px solid rgba(255,255,255,.25); color: var(--side-ink); padding: 3px 8px; font-size: 11.5px; border-radius: 5px; }
a[data-nolink] { color: inherit; text-decoration: none; cursor: default; }

/* cards */
.panel { background: var(--panel); border: 0; border-radius: 8px; box-shadow: var(--shadow); padding: 16px 18px; }
.panel > h2:first-child, .panel h2[style*="margin-top:0"] { font-size: 17px !important; }
.setup { max-width: 760px; }

/* buttons: black primary, outlined secondary */
.btn, button { font: inherit; font-weight: 500; font-size: 14px; padding: 8px 14px; border-radius: 8px; border: 1px solid #111; background: #111; color: #fff; line-height: 1.35; }
.btn:hover, button:hover { background: #333; border-color: #333; text-decoration: none; }
.btn.secondary, button.secondary { background: #fff; color: var(--ink); border-color: var(--line2); }
.btn.secondary:hover, button.secondary:hover { background: #f6f6f8; border-color: #b9b9c2; }
.btn.small, button.small { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
button.danger, .btn.danger { background: #fff; color: var(--bad); border-color: var(--bad-line); }
button.danger:hover { background: var(--bad-bg); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* inputs */
label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { font-size: 14px; }

/* tables: white, roomy rows, light dividers */
.table-wrap { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.panel .table-wrap, .panel > table { box-shadow: none; }
table { background: #fff; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink); background: #fff; }
tbody tr:hover td { background: #fafafb; }
tbody tr:last-child td { border-bottom: 0; }
td .muted, td.muted { font-size: 13.5px; }
tr.low td { background: var(--warn-bg); }
tr.neg td { background: var(--bad-bg); }

/* status pills: outlined, with a dot */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: #f4f4f5; color: var(--ink); border: 1px solid #c9c9cf; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9a9aa2; }
.pill.sent { background: var(--info-bg); border-color: var(--info-line); } .pill.sent::before { background: var(--accent); }
.pill.quoted { background: #f3edff; border-color: #c7b2f3; color: var(--ink); } .pill.quoted::before { background: #7c4dff; }
.pill.failed, .pill.empty { background: var(--bad-bg); border-color: var(--bad-line); color: var(--ink); } .pill.failed::before, .pill.empty::before { background: var(--bad); }
.pill.pending, .pill.to_order { background: var(--warn-bg); border-color: var(--warn-line); color: var(--ink); } .pill.pending::before, .pill.to_order::before { background: #f59e0b; }
.pill.ordered, .pill.received, .pill.full, .pill.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ink); }
.pill.ordered::before, .pill.received::before, .pill.full::before, .pill.ok::before { background: #52c41a; }
.pill.kanban { background: #f3edff; border-color: #c7b2f3; color: var(--ink); } .pill.kanban::before { background: #7c4dff; }
.pill.count { background: #f4f4f5; }
.badge { background: #f59e0b; border-radius: 9px; }
.badge.bad { background: var(--bad); }

/* tabs: blue underline */
.tabs { border-bottom: 1px solid var(--line2); gap: 18px; }
.tabs a { padding: 8px 2px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.cat { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 7px; }

/* messages */
.flash { border-radius: 8px; border: 1px solid transparent; padding: 10px 14px; }
.flash.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #24600f; }
.flash.error { background: var(--bad-bg); border-color: var(--bad-line); color: #8f2410; }
.flash.info { background: var(--info-bg); border-color: var(--info-line); color: #1d4ed8; }

/* kanban board */
.kcol { background: #e6e6ea; border-radius: 8px; }
.kcard { border: 0; box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.kcol h3 { color: var(--ink); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 14px; }
.chip { border-color: var(--line2); border-radius: 8px; }
code { background: #ececf0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { position: relative; display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 8px 12px 8px 8px; color: var(--ink); min-height: 56px; }
.tile:hover { text-decoration: none; box-shadow: 0 2px 8px rgba(16,24,40,.12); }
.tile .ico { flex: 0 0 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; color: #fff; }
.tile .txt { display: flex; flex-direction: column; line-height: 1.25; }
.tile .tl { font-size: 14px; }
.tile b { font-size: 15px; font-weight: 500; }
.tile .sub { position: absolute; right: 10px; bottom: 7px; font-size: 11.5px; color: var(--ink); }
@media (max-width: 700px) { main { padding: 14px 12px 50px; } }
@media print { nav.side { display: none; } body { padding-left: 0; } }
.tile.on { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
/* item pages open read-only until Edit is clicked */
form.locked .form-actions, form.locked .img-actions .btn, form.locked .img-remove, form.locked input[name=new_vendor], form.locked input[name=new_subcat] { display: none; }
form.locked input:not([type=checkbox]):not([type=radio]), form.locked select, form.locked textarea { background: #f7f8fa; border-color: transparent; color: var(--ink); opacity: 1; box-shadow: none; }
form.locked select { appearance: none; }
form.locked input::placeholder, form.locked textarea::placeholder { color: transparent; }
/* whole row opens the item */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: #f5f8ff; }
/* list rows coloured by order status: red = RFQ needs sending, orange = sent / quoted, yellow = ordered */
.op-tabs { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.op-tabs .btn.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); font-weight: 700; cursor: default; }
.mat-chip.pref { color: #fff; background: var(--c); border-color: var(--c); }
.mat-chip.ok { background: #fff; border-style: dashed; opacity: .85; font-weight: 500; }
.mat3-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 5px 0; white-space: nowrap; }
.mat3-row .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.mat3-row .seg label { margin: 0; cursor: pointer; }
.mat3-row .seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mat3-row .seg span { display: block; padding: 3px 9px; font-size: 12.5px; color: var(--ink); border-left: 1px solid var(--line); }
.mat3-row .seg label:first-child span { border-left: 0; }
.mat3-row .seg input:checked + span { background: var(--accent); color: #fff; }
.mat3-row .seg input[value=ok]:checked + span { background: #667085; }
.mat3-row .seg input[value=""]:checked + span { background: #eef0f3; color: var(--muted); }
form.locked .mat3-row .seg { pointer-events: none; opacity: .7; }
.mat-chip { display: inline-block; padding: 1px 8px; margin: 1px 4px 1px 0; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }
body:has(form.locked) .edit-only { display: none !important; }
body:not(:has(form.locked)) .edit-hint { display: none; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f2f5; flex-wrap: wrap; }
.file-list li form { margin-left: auto; }
.link-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.grid > .link-pair { margin-top: 0; }
@media (max-width: 760px) { .link-pair { grid-template-columns: 1fr; } }
.fit-head, .fit-row { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(110px, 1fr) minmax(150px, 1.4fr) 36px; gap: 8px; align-items: start; }
.fit-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
th.sort-th { cursor: pointer; user-select: none; white-space: nowrap; } th.sort-th:hover { color: var(--accent); }
th.sort-th::after { content: "↕"; opacity: .25; margin-left: 5px; font-size: 11px; } th.sort-th.sorted::after { opacity: .9; color: var(--accent); }
th.sort-th.sorted[data-dir="asc"]::after { content: "▲"; } th.sort-th.sorted[data-dir="desc"]::after { content: "▼"; }
.pageback { margin: -8px 0 8px; } .back-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); font-weight: 500; }
.back-btn:hover { color: var(--accent); text-decoration: none; }
@media print { .pageback { display: none; } }
/* RFQs & POs list (Fulcrum style) */
.po-tools { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.bulk-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; margin-bottom: 10px; border: 1px solid var(--bad, #c0392b); border-radius: 10px; background: #fff6f5; }
.bulk-bar[hidden] { display: none; }
.po-tools input[type=search] { flex: 1; height: 44px; font-size: 15px; }
.po-filter { position: relative; } .po-filter > summary { list-style: none; height: 44px; display: inline-flex; align-items: center; gap: 6px; } .po-filter > summary::-webkit-details-marker { display: none; }
.po-filter-box { position: absolute; right: 0; top: 50px; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.16); padding: 12px; width: 260px; display: grid; gap: 4px; }
.po-filter-box label { margin-top: 6px; }
.po-table td { vertical-align: middle; padding-top: 12px; padding-bottom: 12px; }
.po-table .po-items { max-width: 260px; }
.po-table td:first-child a { color: var(--ink); } .po-table td:first-child a:hover { color: var(--accent); }
.ok-txt { color: var(--ok); font-weight: 600; } .bad-txt { color: var(--bad); font-weight: 600; }
.av-row { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.av { width: 30px; height: 30px; border-radius: 50%; background: #c8f2d8; color: #146c3c; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; flex: 0 0 30px; }
.brand-hit { background: #fff1b8; color: #5a4300; border-radius: 3px; padding: 0 3px; }
/* item # box with the item's name on the same line once one is picked */
.pick-line { display: flex; align-items: center; gap: 10px; }
.pick-line > input { flex: 1 1 auto; min-width: 0; }
.pick-line:has(.pick-label:not(:empty)) > input { flex: 0 0 9.5em; }
.pick-line > .pick-label { flex: 1 1 auto; min-width: 0; font-size: 13px !important; line-height: 1.3; }
.pick-line > .pick-label:empty { display: none; }
.fit-row { margin-bottom: 6px; } .fit-ro { padding-top: 8px; font-size: 14px; } .fit-info { padding-top: 8px; font-size: 13px; }
@media (max-width: 760px) { .fit-head { display: none; } .fit-row { grid-template-columns: 1fr 1fr 36px; } .fit-row > :first-child, .fit-row > .fit-info { grid-column: 1 / -1; } }
.ins-head, .ins-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1.2fr) minmax(200px, 1fr) 36px; gap: 8px; align-items: start; }
.ins-head { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.ins-row { margin-bottom: 6px; }
details.ms { position: relative; }
details.ms > summary { list-style: none; cursor: pointer; min-height: 38px; padding: 6px 28px 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
details.ms > summary::-webkit-details-marker { display: none; }
details.ms > summary::after { content: "▾"; position: absolute; right: 10px; top: 9px; color: var(--muted); }
details.ms .ms-list { position: absolute; z-index: 40; top: calc(100% + 2px); left: 0; min-width: 100%; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.16); padding: 6px 10px; }
details.ms .ms-list label.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; white-space: nowrap; }
form.locked details.ms > summary { background: #f7f8fa; }
@media (max-width: 760px) { .ins-head { display: none; } .ins-row { grid-template-columns: 1fr 36px; } .ins-row > .ins-link, .ins-row > .ins-mat { grid-column: 1; } }
.item-dd { position: fixed; z-index: 50; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.16); font-size: 14px; }
.item-dd .opt { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid #f0f2f5; }
.item-dd .opt.on, .item-dd .opt:hover { background: #eef3ff; }
.item-dd .none { padding: 8px 10px; }
.line-links { display: flex; gap: 12px; font-size: 12.5px; margin-top: 2px; }
.line-links a.lnk { font-weight: 600; }
.line-links a.lnk.muted { font-weight: 400; }
tr.st-send td { background: #fde0de; }
tr.st-sent td { background: #ffe6c7; }
tr.st-ordered td { background: #fff4bf; }
tr.st-send:hover td { background: #fbcfcb; }
tr.st-sent:hover td { background: #ffdbb0; }
tr.st-ordered:hover td { background: #ffee9c; }
/* item pictures */
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid #e3e5ea; background: #fff; display: block; }
.thumb.none { display: inline-block; background: #f3f4f7; border: 1px dashed #dcdfe5; }
.img-panel { float: right; display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px 16px; max-width: 360px; }
.img-panel .img-box { width: 150px; height: 150px; border: 1px solid #e3e5ea; border-radius: 10px; background: #f7f8fa; display: grid; place-items: center; overflow: hidden; flex: 0 0 150px; }
.img-panel .img-box img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.img-panel .img-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
@media (max-width: 760px) { .img-panel { float: none; margin: 0 0 12px; max-width: none; } }
/* Setup sheets */
.ss-sheet { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; max-width: 1150px; }
.ss-sheet table { border-collapse: collapse; width: 100%; }
.ss-head th, .ss-head td { border: 1px solid #b9c0ca; padding: 5px 8px; font-size: 13.5px; }
.ss-head th { background: #eef1f5; color: var(--ink); white-space: nowrap; width: 1%; text-transform: uppercase; font-size: 11.5px; letter-spacing: .03em; }
.ss-mid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; margin: 12px 0; }
.ss-cap { font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; background: #eef1f5; border: 1px solid #b9c0ca; padding: 4px 8px; }
.ss-pics { border: 1px solid #b9c0ca; border-top: 0; padding: 6px; display: grid; gap: 6px; }
.ss-pics figure { margin: 0; } .ss-pics img { width: 100%; height: auto; display: block; border-radius: 4px; }
.ss-pics figcaption { font-size: 12px; color: var(--muted); }
.ss-nopic { padding: 40px; text-align: center; }
.ss-wcs { margin-top: 8px; } .ss-wcs th, .ss-wcs td { border: 1px solid #b9c0ca; padding: 4px 8px; font-size: 13.5px; }
.ss-wcs th { width: 90px; background: #f6f8fa; } .ss-wlabel { font-weight: 700; background: #fafbfc; }
.ss-notes { border: 1px solid #b9c0ca; border-top: 0; padding: 8px; white-space: pre-line; min-height: 110px; font-size: 14px; margin-bottom: 10px; }
.ss-tools th, .ss-tools td, .ss-ops th, .ss-ops td { border: 1px solid #b9c0ca; padding: 4px 6px; font-size: 12.5px; }
.ss-tools th, .ss-ops th { background: #eef1f5; color: var(--ink); }
.ss-tools td.tool_no, .ss-tools td.lib { font-weight: 700; text-align: center; }
.ss-ops { margin-top: 12px; } .ss-total td { font-weight: 700; background: #fafbfc; }
.ss-ops-used { font-size: 11px; }
.ss-h2 { font-size: 16px; margin: 0 0 8px; }
.ss-hgrid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.ss-mid-edit { grid-template-columns: 1fr 1fr; margin: 0; } .ss-mid-edit > .panel { margin-bottom: 16px; }
.ss-etable { width: 100%; border-collapse: collapse; } .ss-etable td, .ss-etable th { padding: 3px 4px; border-bottom: 0; }
.ss-etable input { padding: 5px 6px; font-size: 13px; min-width: 0; width: 100%; }
.ss-etable .w-xs { width: 64px; } .ss-etable .w-s { width: 90px; } .ss-etable .w-m { width: 130px; } .ss-etable .w-l { min-width: 190px; }
.ss-etable input[readonly] { background: #f3f6fa; color: #334; border-color: #e1e6ee; }
.ss-etable tr.lib-miss .lib-in { border-color: var(--bad, #c0392b); background: #fff6f5; }
.ss-move { white-space: nowrap; } button.tiny { padding: 1px 6px; font-size: 11px; line-height: 1.6; }
.ss-pics-edit { display: flex; flex-wrap: wrap; gap: 8px; } .ss-pics-edit figure { margin: 0; width: 180px; }
.ss-pics-edit img { width: 100%; border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 800px) { .ss-mid, .ss-mid-edit { grid-template-columns: 1fr; } .ss-hgrid { grid-template-columns: 1fr 1fr; } }
@media print {
  @page { size: letter portrait; margin: 0.35in; }
  .noprint, .flash, .pageback { display: none !important; }
  main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .ss-sheet { border: 0; padding: 0; max-width: none; }
  .ss-mid { grid-template-columns: 1.15fr 1fr; }
  .ss-tools, .ss-ops { page-break-inside: auto; } .ss-tools tr, .ss-ops tr { page-break-inside: avoid; }
  .ss-tools a { color: inherit; text-decoration: none; }
  html, body { background: #fff !important; }
  .ss-head, .ss-tools, .ss-ops, .ss-wcs { table-layout: fixed; }
  .ss-head th, .ss-head td { font-size: 10.5px; padding: 3px 5px; overflow-wrap: anywhere; }
  .ss-head th { width: auto; white-space: normal; font-size: 9px; }
  .ss-tools th, .ss-tools td, .ss-ops th, .ss-ops td { font-size: 9.5px; padding: 2px 3px; overflow-wrap: anywhere; }
  .ss-notes { font-size: 11.5px; min-height: 80px; }
  .ss-pics img { max-height: 4.6in; object-fit: contain; }
  .ss-head th { width: 10%; } .ss-head td { width: 15%; }
  .ss-tools th:nth-child(1), .ss-tools th:nth-child(2) { width: 5.5%; } .ss-tools th:nth-child(3) { width: 10%; } .ss-tools th:nth-child(4) { width: 20%; }
  .ss-tools th:nth-child(5) { width: 10%; } .ss-tools th:nth-child(11) { width: 11%; } .ss-tools th:nth-child(12) { width: 10%; }
  .ss-wcs th, .ss-wcs td { font-size: 11px; padding: 3px 6px; }
}
