:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #1d2330; --muted: #667085; --line: #e3e6ec;
  --brand: #084b97; --brand-ink: #ffffff; --brand-soft: #e6eef8; --orange: #f18700; --anis: #dedc00;
  --ok: #157a46; --ok-soft: #e4f5ec; --warn: #a85a00; --warn-soft: #fff1dc; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131a; --surface: #171c26; --text: #e8ecf3; --muted: #97a1b3; --line: #29303d;
    --brand: #6aa7ff; --brand-ink: #06121f; --brand-soft: #12263f;
    --ok: #52c98a; --ok-soft: #14301f; --warn: #f6a53d; --warn-soft: #33260f; --bad: #ff8a80; --bad-soft: #3a1a18;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13px/1.5 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-weight: 400; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand .dot { width: 22px; height: 22px; border-radius: 6px; background: var(--brand); display: inline-block; }
.mainnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.mainnav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.mainnav a:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.mainnav a.on { background: var(--brand-soft); color: var(--brand); }
.langsw { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langsw a { padding: 5px 10px; color: var(--muted); font-weight: 600; font-size: 12px; }
.langsw a.on { background: var(--brand); color: var(--brand-ink); }
.langsw a:hover { text-decoration: none; }
.subbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.subbar-in { max-width: 1280px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; overflow-x: auto; }
.subbar a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.subbar a:hover { color: var(--text); text-decoration: none; }
.subbar a.on { color: var(--brand); border-bottom-color: var(--brand); }

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); background: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 9px; font-size: 12px; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; }
label { font-weight: 600; font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.field input:not([type=checkbox]), .field select { width: 100%; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { min-width: 260px; }

/* tables */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; background: var(--surface); position: sticky; top: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.thumb { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; border: 1px solid var(--line); background: #fff; display: block; }
.thumb.empty { background: var(--bg); }
.name { font-weight: 600; }
.muted { color: var(--muted); }

/* tags */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.pill.L1 { background: #e5f4ea; color: #17703f; } .pill.L2 { background: #e6eef8; color: #084b97; }
.pill.L3 { background: #f1ecfb; color: #6b3fc2; } .pill.Lx { background: #fff1dc; color: #a85a00; } .pill.Of { background: #eceff3; color: #475467; }
@media (prefers-color-scheme: dark) { .pill.L1 { background: #14301f; color: #52c98a; } .pill.L2 { background: #12263f; color: #6aa7ff; }
  .pill.L3 { background: #271c3f; color: #b79bf5; } .pill.Lx { background: #33260f; color: #f0a04b; } .pill.Of { background: #232a36; color: #aab3c2; } }
.badge-bad { background: var(--bad-soft); color: var(--bad); padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; }
.flash.ok { background: var(--ok-soft); color: var(--ok); } .flash.error { background: var(--bad-soft); color: var(--bad); }
.notice { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabpane { display: none; } .tabpane.on { display: block; }

/* product page */
.prod { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.bigimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.bigimg.empty { display: grid; place-items: center; color: var(--muted); background: var(--bg); }
.kinds { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stat { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; }
.inline-in { width: 110px; text-align: right; }
.inline-in.wide { width: 100%; text-align: left; }
.saved { outline: 2px solid var(--ok) !important; transition: outline .2s; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; color: var(--muted); }

/* autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.18); z-index: 30; max-height: 300px; overflow: auto; }
.ac-list div { padding: 7px 10px; cursor: pointer; }
.ac-list div:hover, .ac-list div.on { background: var(--brand-soft); }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 8px; font-weight: 600; opacity: 0; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: 1; } .toast.err { background: var(--bad); color: #fff; }

@media (max-width: 760px) {
  .grid2, .grid3, .prod { grid-template-columns: 1fr; }
  .filters input[type=search] { min-width: 0; flex: 1; }
}

/* STRADOT charter: Poppins (Light to ExtraBold only), blue + black, the square as graphic element */
.brand { font-weight: 800; }
.brand .dot { position: relative; width: 22px; height: 22px; border-radius: 0; background: var(--brand); }
.brand .dot::after { content: ""; position: absolute; inset: 6px; background: var(--surface); }
h1, h2 { font-weight: 700; }
h1::before, h2::before { content: ""; display: inline-block; width: .5em; height: .5em; background: var(--brand); margin-right: .5em; vertical-align: .05em; }
.pill, .badge-ok, .badge-bad, th, .tabs button, .subbar a, .mainnav a, .btn, label { font-weight: 600; }
.name { font-weight: 600; }
.badge-bad { background: var(--warn-soft); color: var(--warn); }
.btn.primary { border-radius: 8px; }
.subbar a.on { border-bottom-color: var(--brand); }
.langsw a.on { background: var(--brand); }

.usermenu { display: flex; align-items: center; gap: 8px; font-size: 12.5px; white-space: nowrap; }
.usermenu .who { font-weight: 600; }
.usermenu .rolelab { text-transform: capitalize; }
fieldset[disabled] input, fieldset[disabled] select, input:disabled, select:disabled { opacity: .7; cursor: not-allowed; }
@media (max-width: 900px) { .usermenu .rolelab { display: none; } }

/* ---- STRADOT look v2: blue header, tinted page ---- */
:root {
  --bg: #e7eef8; --topbar: #084b97; --subbar: #d6e3f4; --thead: #e9f0fa; --zebra: #f6f9fd; --card-line: #cfdbec;
  --nav-ink: rgba(255,255,255,.82); --nav-on-bg: #ffffff; --nav-on-ink: #084b97;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --topbar: #0a2a52; --subbar: #101c30; --thead: #14233a; --zebra: #141c2a; --card-line: #29303d;
    --nav-on-bg: rgba(255,255,255,.16); --nav-on-ink: #ffffff; }
}
body { background: var(--bg); }

/* header: STRADOT blue */
.topbar { background: var(--topbar); border-bottom: 0; box-shadow: 0 2px 8px rgba(8,75,151,.25); }
.brand { color: #fff; }
.brand .dot { background: #fff; }
.brand .dot::after { background: var(--topbar); }
.mainnav a { color: var(--nav-ink); }
.mainnav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.mainnav a.on { background: var(--nav-on-bg); color: var(--nav-on-ink); }
.usermenu .who { color: #fff; }
.usermenu .rolelab { color: rgba(255,255,255,.7); }
.usermenu .btn.small { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.usermenu .btn.small:hover { background: rgba(255,255,255,.22); }
.langsw { border-color: rgba(255,255,255,.4); }
.langsw a { color: rgba(255,255,255,.85); }
.langsw a.on { background: var(--orange); color: #fff; }

/* sub menu: light blue band with an orange marker */
.subbar { background: var(--subbar); border-bottom: 1px solid var(--card-line); }
.subbar a { color: #3a5a89; }
.subbar a:hover { color: var(--brand); }
.subbar a.on { color: var(--brand); border-bottom-color: var(--orange); border-bottom-width: 3px; }
@media (prefers-color-scheme: dark) { .subbar a { color: #9fb6d6; } }

/* page content */
h1 { color: var(--brand); }
h1::before { background: var(--orange); }
.card { border-color: var(--card-line); }
.card.tablewrap, .tablewrap.card { overflow: hidden; }
th { background: var(--thead); color: var(--brand); border-bottom: 2px solid var(--card-line); }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 80%, transparent); }
.filters { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 10px; }
.stat { background: var(--brand-soft); }
.stat b { color: var(--brand); }
.tabs { border-bottom-color: var(--card-line); }
.tabs button.on { border-bottom-color: var(--orange); }
.btn { border-color: var(--card-line); }
.btn.primary { border-color: var(--brand); }
.notice { border-left: 4px solid var(--orange); }
.flash { border-left: 4px solid currentColor; }

/* login page: full blue with big squares (the charter's square) */
body.login { background: linear-gradient(135deg, #06376f 0%, #084b97 55%, #1a66bd 100%); min-height: 100vh; position: relative; overflow: hidden; }
body.login::before, body.login::after { content: ""; position: absolute; border: 28px solid rgba(255,255,255,.09); pointer-events: none; }
body.login::before { width: 460px; height: 460px; right: -120px; top: -140px; }
body.login::after { width: 300px; height: 300px; left: -90px; bottom: -90px; border-color: rgba(241,135,0,.30); }
body.login main { position: relative; z-index: 1; }
body.login .card { box-shadow: 0 20px 60px rgba(0,0,0,.35); border: 0; border-top: 5px solid var(--orange); }
body.login .brand { color: var(--brand); }
body.login .brand .dot { background: var(--brand); }
body.login .brand .dot::after { background: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--card-line);
  color: var(--brand); font-weight: 600; font-size: 12px; }
.chip b { color: var(--muted); font-weight: 600; }
.chip:hover { background: var(--brand-soft); text-decoration: none; }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip.on b { color: var(--brand-ink); opacity: .8; }
.sortlink { color: inherit; } .sortlink:hover { text-decoration: none; color: var(--orange); } .sortlink.on { color: var(--text); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 96px 120px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 8pt; line-height: 1.35; }   /* History: small text (8 pt) */
.timeline li:last-child { border-bottom: 0; }
.tl-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-who { font-weight: 600; color: var(--brand); }
.tl-what b { text-transform: capitalize; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 760px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

.movedlg { border: 0; border-radius: var(--radius); padding: 22px; width: min(420px, 92vw); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.movedlg::backdrop { background: rgba(8,30,60,.55); }
.movedlg h2 { margin-top: 0; }

/* resizable columns: drag the right edge of a header; the widths are remembered per table in this browser */
table.resizable th { position: sticky; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.resizable.fixed { table-layout: fixed; }
table.resizable.fixed td { overflow: hidden; text-overflow: ellipsis; }
.col-resizer { position: absolute; top: 0; right: 0; bottom: 0; width: 7px; cursor: col-resize; user-select: none; touch-action: none; }
.col-resizer::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 3px; width: 1px; background: var(--card-line); }
.col-resizer:hover::after, .col-resizer.drag::after { background: var(--orange); width: 2px; }
.nowrap { white-space: nowrap; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.resizable.fixed .clip { max-width: none; }
.reset-cols { font-size: 12px; color: var(--muted); cursor: pointer; background: none; border: 0; padding: 0 0 0 8px; text-decoration: underline; }

/* compact, readable line tables (purchase order lines) */
table.lines { font-size: 13px; }
table.lines th, table.lines td { padding: 6px 8px; }
table.lines input, table.lines select { font-size: 13px; padding: 4px 6px; }
table.lines td.num { white-space: nowrap; }
.ghost { background: transparent !important; border-color: transparent !important; }
.ghost:hover:not(:disabled) { border-color: var(--card-line) !important; }
.ghost:disabled { opacity: 1; cursor: default; }
.btn.icon { padding: 4px 7px; line-height: 0; }
.btn.icon:hover { background: var(--bad-soft); }

.brand img { height: 26px; width: auto; display: block; }

.pbar { height: 8px; background: #dfe6f1; border-radius: 5px; overflow: hidden; margin-bottom: 2px; }
.pbar i { display: block; height: 100%; background: var(--brand); }

/* PO page: compact head, the product lines come first and stand out */
.head-compact { margin-bottom: 8px; align-items: center; }
.head-compact h1 { font-size: 19px; margin: 0 0 2px; }
.head-compact .back { color: var(--muted); text-decoration: none; margin-right: 4px; }
.head-compact .kinds { margin: 0; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.card.compact { padding: 12px 14px; background: var(--surface); }
.card.compact .field { margin-bottom: 8px; }
.card.compact label { margin-bottom: 2px; }
.polines { background: var(--brand-soft); border: 1px solid var(--card-line); border-top: 4px solid var(--brand); }
.polines thead th { background: var(--brand-soft); color: var(--brand); border-bottom: 2px solid var(--brand); }
.polines tbody tr:nth-child(even) td { background: rgba(8, 75, 151, .06); }
.polines input.ghost, .polines input.inline-in { background: var(--surface); }
.polines tbody tr td { background: var(--brand-soft); }
.polines tbody tr:nth-child(even) td { background: rgba(8, 75, 151, .06); }
.polines #po-add-row td { background: var(--surface); border-top: 2px solid var(--brand); }
@media (max-width: 900px) { .grid4 { grid-template-columns: 1fr 1fr; } }
.polines input[data-f=description] { font-weight: 600; }
.polines td a.mono { font-weight: 600; }
.polines td.vcode { font-weight: 600; user-select: all; }
.polines td a.mono { font-weight: 400; color: var(--muted); }

/* ---- Manufacturing order page: same look as the old portal ---- */
.mo-page { --mo-purple: #714B67; }
.mo-top { margin-bottom: 10px; }
.mo-back { font-size: 13px; color: #636e72; text-decoration: none; }
.mo-title { font-size: 22px; margin: 2px 0 0; }
.mo-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 8px; }
.mo-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.mo-hleft { display: flex; align-items: center; gap: 16px; }
.mo-img { width: 80px; height: 80px; object-fit: contain; border-radius: 8px; background: #f8f9fa; border: 1px solid #eee; flex-shrink: 0; }
.mo-noimg { background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: #ccc; font-size: 12px; }
.mo-fields { display: grid; grid-template-columns: 1fr; gap: 12px; }
.mo-fl { font-size: 12px; color: #636e72; text-transform: uppercase; font-weight: 600; }
.mo-fv { font-size: 15px; margin-top: 2px; }
.mo-fv.mo-edit { cursor: pointer; }
.mo-hint { font-size: 11px; color: #b2bec3; margin-top: -2px; margin-bottom: 2px; }
.mo-chart { flex: 1; display: flex; justify-content: center; align-items: stretch; min-width: 400px; }
.mo-chartrow { display: flex; align-items: flex-end; gap: 8px; }
.mo-stats { display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; min-width: 110px; }
.mo-sl { font-size: 9px; color: #636e72; text-transform: uppercase; letter-spacing: .5px; }
.mo-sv { font-size: 16px; font-weight: 700; }
.mo-sv small { font-size: 10px; font-weight: 400; color: #636e72; }
.mo-ss { font-size: 9px; color: #b2bec3; }
.mo-hright { display: grid; gap: 6px; align-self: stretch; grid-template-rows: auto auto 1fr; }
.mo-btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.mo-btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; transition: opacity .2s; text-decoration: none; display: inline-block; }
.mo-btn:hover { opacity: .85; }
.mo-btn-sm { padding: 5px 10px; font-size: 12px; }
.mo-btn-primary { background: #0984e3; color: #fff; }
.mo-btn-success { background: #00b894; color: #fff; }
.mo-btn-secondary { background: #636e72; color: #fff; }
.mo-last { min-width: 0; min-height: 0; height: 148px; display: flex; flex-direction: column; background: #f4f6f8; border-radius: 8px; border: 1.5px solid #c8cdd3; }
.mo-lh { flex-shrink: 0; font-size: 10px; font-weight: 700; color: #636e72; text-transform: uppercase; letter-spacing: .8px; padding: 12px 14px 8px; }
.mo-lb { min-height: 0; overflow-y: auto; padding: 0 14px 12px; }
.mo-lrow { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #e0e4e8; }
.mo-lrow:last-child { border-bottom: 0; }
.mo-lop { font-size: 11px; font-weight: 700; color: #0984e3; background: #e8f4fd; border-radius: 4px; padding: 1px 6px; }
.mo-tabs { display: flex; gap: 4px; align-items: flex-end; border-bottom: 0; margin: 14px 0 0; }
.mo-tabs button { display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: 15px; font-weight: 600; cursor: pointer; border: none; border-bottom: 3px solid transparent; color: #636e72; background: #f5f6fa; border-radius: 8px 8px 0 0; white-space: nowrap; flex-shrink: 0; }
.mo-tabs button.on { border-bottom-color: #714B67; color: #714B67; background: #fff; }
.mo-search { position: relative; margin-left: 10px; padding-bottom: 2px; }
.mo-search svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: #b2bec3; pointer-events: none; margin-top: -1px; }
.mo-search input { width: 300px; padding: 6px 10px 6px 28px; font-size: 13px; border: 1px solid #ddd; border-radius: 6px; outline: none; background: #fff; }
.mo-progbox { margin-left: auto; background: #fff; border-radius: 8px 8px 0 0; padding: 8px 20px 10px; border-bottom: 3px solid #714B67; width: 360px; flex-shrink: 0; box-sizing: border-box; }
.mo-pl { font-size: 13px; font-weight: 600; color: #636e72; }
.mo-body { border-top-left-radius: 0; padding: 0 20px 20px; margin-bottom: 0; }
.mo-tablewrap { overflow-x: auto; }
.mo-table { width: 100%; border-collapse: collapse; }
.mo-table th, .mo-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; vertical-align: middle; }
.mo-table th { font-weight: 600; color: #636e72; font-size: 12px; text-transform: uppercase; vertical-align: top; background: #fff; position: sticky; top: 0; z-index: 2; }
.mo-table th .num, .mo-table td.num { text-align: right; }
.mo-opid { color: #999; font-size: 12px; }
.mo-opid span { border-bottom: 1px dashed #ccc; }
.mo-sub { font-size: 11px; color: #b2bec3; margin-top: 1px; }
.mo-ref { font-size: 13px; color: #636e72; }
.mo-prog { display: flex; align-items: center; gap: 6px; }
.mo-prog input[type=range] { flex: 1; min-width: 80px; width: auto; padding: 0; border: 0; background: none; }
.mo-pct { font-size: 12px; font-weight: 600; min-width: 36px; }
.mo-warn { font-size: 11px; color: #d63031; margin-top: 2px; }
.mo-warn a { font-weight: 600; text-decoration: underline; color: inherit; }
.mo-instr a { color: #0984e3; font-size: 13px; }
.mo-actions { white-space: nowrap; }
.mo-ico { cursor: pointer; color: #636e72; display: inline-flex; margin-right: 6px; vertical-align: middle; }
.mo-ico.mo-blue { color: #0984e3; }
.mo-ico.mo-red { color: #e74c3c; }
.mo-qc { cursor: pointer; display: inline-flex; }
.mo-badge { position: absolute; top: -5px; right: -6px; background: #00b894; color: #fff; border-radius: 50%; font-size: 9px; font-weight: 700; width: 13px; height: 13px; display: flex; align-items: center; justify-content: center; line-height: 1; pointer-events: none; }
.mo-addform { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; align-items: center; }
@media (max-width: 900px) { .mo-chart { min-width: 0; overflow-x: auto; justify-content: flex-start; } .mo-search input { width: 180px; } .mo-tabs { flex-wrap: wrap; } .mo-progbox { width: 100%; margin-left: 0; } }
main:has(.mo-page) { max-width: none; }
.mo-grip { color: #bbb; cursor: grab; padding: 4px 2px !important; width: 24px; }
.mo-needs { cursor: pointer; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.mo-needs.ok { background: #eafaf1; color: #00967d; }
.mo-needs.wait { background: #fff4e0; color: #b7791f; }
.casc-caret { border: 0; background: none; cursor: pointer; font-size: 14px; width: 22px; color: var(--brand); padding: 0; }
.casc-caret-gap { display: inline-block; width: 22px; }
/* product picker (suggestions list, attached to the page so no card can cut it off) */
.pick-list { position: fixed; z-index: 2000; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.22); max-height: 340px; overflow: auto; }
.pick-list div { padding: 7px 10px; cursor: pointer; display: flex; gap: 4px; align-items: baseline; }
.pick-list div.on { background: var(--brand-soft); }
.pick-list b { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; white-space: nowrap; }
.pick-list span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pick-cat { color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 10px; }
[hidden] { display: none !important; }   /* a class like .btn must not show an element that is hidden */
/* sortable tables and the Export to Excel bar */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brand); }
.sortmark { opacity: .45; font-size: 11px; }
.tbl-tools { display: flex; justify-content: flex-end; margin: 0 0 6px; }
/* read-only (Viewer): locked fields look locked, and the edit / delete icons are not shown */
.ro input:disabled, .ro select:disabled, .ro textarea:disabled { background: var(--bg); color: var(--text); cursor: not-allowed; opacity: .85; }
.ro [data-edit], .ro [data-del], .ro [data-qc-verify], .ro .mo-grip, .ro [data-line-del], .ro [data-price-del], .ro [data-op-del] { display: none !important; }
.ro .mo-edit { pointer-events: none; cursor: default; }

/* version line */
.appfoot { text-align: center; color: var(--muted, #8a93a0); font-size: 11px; padding: 18px 0 14px; }

/* manufacturing: assembly tree */
.mo-hid { display: none !important; }
.mo-grp td { background: #f1f3f6; border-top: 1px solid #e3e6ea; }
.mo-gcaret { cursor: pointer; display: inline-block; width: 18px; color: #636e72; user-select: none; }
.mo-gimg { width: 34px; height: 34px; object-fit: contain; border: 1px solid #e3e6ea; border-radius: 6px; background: #fff; display: inline-block; vertical-align: middle; margin-right: 8px; }
.mo-gname { display: inline-block; vertical-align: middle; }
.mo-gname .mo-sub { display: block; }
.mo-glink { text-align: right; color: #b2bec3; font-size: 12px; }
.mo-gbar { height: 8px; background: #e9ecef; border-radius: 4px; flex: 1; min-width: 80px; overflow: hidden; }
.mo-gbar > div { height: 100%; background: #fdcb6e; }
.mo-grpbar { margin: 0 0 6px; font-size: 12px; text-align: right; }

/* detailed instructions of a step */
.op-html ul, .op-html ol { margin: 4px 0 4px 20px; padding: 0; }
.op-html img { max-width: 100%; border: 1px solid #e3e6ea; border-radius: 6px; margin: 6px 0; }
.op-html p { margin: 4px 0; }

/* people of a step */
.mo-people { font-size: 12px; }
.mo-people-edit { cursor: pointer; }
.mo-people-edit:hover { background: rgba(8,75,151,.06); }
.mo-chip { display: inline-block; background: #e8f0fb; color: #084b97; border-radius: 10px; padding: 1px 8px; margin: 1px 3px 1px 0; white-space: nowrap; }
.mo-nobody { color: #b2bec3; }

/* Workshop planner (Gantt) */
.pl-wrap { overflow-x: auto; border: 1px solid #dde1e6; border-radius: 8px; background: #fff; }
.pl { min-width: max-content; font-size: 12px; --day: 22px; }
.pl-row { display: flex; border-bottom: 1px solid #e6e9ed; min-height: 27px; }
.pl-row:last-child { border-bottom: none; }
.pl-row.editable { cursor: pointer; }
.pl-row.editable:hover .pl-left, .pl-row.editable:hover .pl-track { background-color: #eef4fc; }
.pl-left { position: sticky; left: 0; z-index: 2; background: #fff; display: flex; align-items: center; width: 380px; flex-shrink: 0; border-right: 2px solid #dde1e6; }
.pl-name { flex: 1; min-width: 0; padding: 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-md { width: 46px; text-align: right; padding-right: 8px; color: #636e72; flex-shrink: 0; }
.pl-row.child .pl-name { padding-left: 26px; }
.pl-row.group .pl-name { font-weight: 700; }
.pl-row.group .pl-left, .pl-row.group .pl-track { background-color: #f4f6f8; }
.pl-head { position: sticky; top: 0; z-index: 3; background: #e7ebf0; font-weight: 600; font-size: 11px; text-transform: uppercase; color: #636e72; }
.pl-head .pl-left { background: #e7ebf0; }
.pl-track { position: relative; flex-shrink: 0;
  background-image: repeating-linear-gradient(90deg, rgba(0,0,0,.06) 0 1px, transparent 1px var(--day)),
                    repeating-linear-gradient(90deg, transparent 0 calc(5 * var(--day)), rgba(0,0,0,.045) calc(5 * var(--day)) calc(7 * var(--day))); }
.pl-weeks { display: flex; } .pl-weeks > div { width: calc(7 * var(--day)); flex-shrink: 0; padding: 3px 4px 0; border-left: 1px solid #c9d0d8; white-space: nowrap; }
.pl-days { display: flex; } .pl-days > div { width: var(--day); flex-shrink: 0; text-align: center; padding-bottom: 2px; }
.pl-days > div.we { color: #a9b2bb; } .pl-days > div.now { color: #fff; background: #ff9a1f; border-radius: 999px; }
.pl-bar { position: absolute; top: 6px; height: 14px; border-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.pl-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; } .pl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pl-label { position: absolute; top: 4px; font-weight: 600; white-space: nowrap; font-size: 11.5px; padding-left: 6px; pointer-events: none; }
.pl-span { position: absolute; top: 9px; height: 5px; background: #4b5560; }
.pl-span::before, .pl-span::after { content: ''; position: absolute; top: 0; width: 2px; height: 11px; background: #4b5560; }
.pl-span::before { left: 0; } .pl-span::after { right: 0; }
.pl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #ff9a1f; opacity: .7; pointer-events: none; }
.pl-off { position: absolute; top: 4px; color: #636e72; font-size: 11.5px; }
.pl-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px 12px; max-height: 11rem; overflow: auto; }
.pl-colors { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pl-colors button { width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.pl-colors button.on { border-color: #2d3436; }
@media (max-width: 760px) { .pl-left { width: 190px; } }

/* editor of the instructions of a BOM step */
.pe-card { border: 1px solid #e3e6ea; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.pe-ttl { width: 100%; font-weight: 600; margin-bottom: 6px; }
.pe-bar { display: flex; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.pe-bar button, .pe-up { border: 1px solid #cfd6dd; background: #f5f7f9; border-radius: 5px; padding: 2px 9px; font-size: 12px; cursor: pointer; }
.pe-text { min-height: 80px; border: 1px solid #cfd6dd; border-radius: 6px; padding: 8px 10px; background: #fff; }
.pe-ws { margin: 8px 0; font-size: 12px; }
.pe-act { display: flex; gap: 6px; }

/* planner cascade */
.pl-caret { display: inline-block; width: 16px; color: #636e72; cursor: pointer; user-select: none; }
.pl-row.section .pl-name { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #084b97; }
.pl-row.sub .pl-name { font-weight: 600; }
.pl-row.section .pl-left, .pl-row.section .pl-track { background-color: #f9fafc; }
.pl-row.sub .pl-left, .pl-row.sub .pl-track { background-color: #fbfcfd; }

/* planner: draggable bars */
.pl-bar.drag { cursor: grab; }
.pl-bar.dragging { cursor: grabbing; opacity: .8; outline: 2px solid rgba(8,75,151,.5); z-index: 3; }
.pl-grip { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: ew-resize; background: rgba(0,0,0,.18); border-radius: 0 3px 3px 0; }

/* planner: task numbers and dependencies */
.pl { position: relative; }
.pl-no { display: inline-block; min-width: 24px; text-align: center; background: #e8f0fb; color: #084b97; border-radius: 9px; padding: 0 5px; margin-right: 6px; font-size: 11px; font-weight: 600; }
.pl-links { position: absolute; pointer-events: none; z-index: 1; overflow: visible; }

.bulkbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--brand, #084b97); border-radius: 10px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: 94vw; }
.bulkbar[hidden] { display: none; }

/* Components of a production order: the cascade of the portal */
.comp-cascade tbody tr[hidden] { display: none; }
.comp-name { display: flex; align-items: center; gap: 8px; }
.comp-chev { border: 0; background: none; padding: 0; cursor: pointer; color: #0984e3; display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; transition: transform .12s; }
.comp-chev.open { transform: rotate(90deg); }
.comp-chev-space { display: inline-block; width: 20px; flex: none; }
.comp-img { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; background: #f8f9fa; flex: none; }
.comp-img.empty { display: inline-block; }
.comp-title { font-weight: 600; }
.comp-title.asm { color: #0984e3; }
.comp-count { font-size: 12px; margin-left: 4px; }
.comp-sub { font-size: 12px; line-height: 1.3; }
.proc-bar { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 6px; }
.proc-bar i { width: 16px; height: 6px; border-radius: 2px; background: #e5e7eb; display: inline-block; }
.proc-bar.not_ordered i:nth-child(1) { background: #fab1a0; }
.proc-bar.ordered i:nth-child(-n+2) { background: #fdcb6e; }
.proc-bar.received i { background: #55efc4; }
.proc-label { font-size: 11px; font-weight: 600; margin-right: 6px; }
.proc-label.not_ordered { color: #d63031; }
.proc-label.ordered { color: #b8860b; }
.proc-label.received { color: #00b894; }

.comp-crumbs { padding: 10px 12px 4px; font-size: 14px; }
.comp-crumbs a { color: #0984e3; text-decoration: none; }
.comp-crumbs .sep { color: #b2bec3; }
.comp-crumbs .cur { font-weight: 600; }
.comp-container td { background: #f5f6f7; cursor: pointer; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid #eee; }
.comp-cont-arrow { display: inline-block; width: 14px; color: #636e72; }
.comp-title.asm { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }

.fast-btn { margin-left: 4px; font-size: 12px; font-weight: 600; color: #fff; background: #00b894; border-radius: 6px; padding: 3px 10px; cursor: pointer; }
.tabs button:not(.on) .fast-btn { display: none; }

.proc-bar.partial i:nth-child(1) { background: #fdcb6e; }
.proc-label.partial { color: #b8860b; }

.find-wrap { position: relative; display: inline-block; min-width: 150px; }
.find-in { width: 100%; }
.find-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 60; background: #fff; border: 1px solid var(--line, #ddd); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 260px; overflow: auto; min-width: 220px; }
.find-item { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.find-item:hover, .find-item.on { background: #e8f0fb; }
.find-item.new { color: #0984e3; font-weight: 600; border-top: 1px solid #eee; }

.btn-pair { display: inline-flex; gap: 0; }
.btn-pair form { display: inline-flex; }
.btn-pair form:first-child .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-pair form:last-child .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }

.mo-drop { position: relative; display: inline-block; }
.mo-drop > summary { list-style: none; cursor: pointer; }
.mo-drop > summary::-webkit-details-marker { display: none; }
.mo-drop-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 70; background: #fff; border: 1px solid var(--line, #ddd); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.16); padding: 12px 14px; width: 420px; max-width: 92vw; text-align: left; }

.save-chip { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; }
.save-chip.ok { background: var(--ok-soft, #e6f6ec); color: var(--ok, #1a7f4b); }
.save-chip.busy { background: #eef2f7; color: #636e72; }
.save-chip.bad { background: #fde8e8; color: #c0392b; }
input.bad, select.bad, textarea.bad { border-color: #d63031 !important; background: #fff5f5; }

.field input[type=radio], .field input[type=checkbox] { width: auto; flex: none; margin: 0; }
.bulkbar .find-wrap { min-width: 220px; }
.bulkbar .find-list { top: auto; bottom: 100%; }
