/* Dabrico MRP - own styles. Brand: blue #003FCA, orange #F47F28, Arial. */
:root {
  --blue: #003FCA; --blue-dark: #00309a; --blue-light: #DCE5F9;
  --orange: #F47F28; --orange-dark: #d96a17;
  --gray: #6E6E6E; --line: #dfe3ea; --bg: #f4f6fa; --text: #1f2430;
  --green: #1B7A38; --purple: #6A3FA0; --red: #c0392b; --shop: #E0731F;
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .7rem; }
.muted { color: var(--gray); } .small { font-size: .85rem; } .b { font-weight: bold; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* top bar */
.topbar { background: #fff; border-bottom: 3px solid var(--blue); display: flex; align-items: center; gap: 1rem; padding: .35rem 1rem; position: sticky; top: 0; z-index: 20; }
.brand img { height: 38px; display: block; }
.mainnav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.mainnav > a { text-decoration: none; color: var(--text); font-weight: bold; padding: 0 .9rem; line-height: var(--tap); border-bottom: 3px solid transparent; }
.mainnav > a:hover { color: var(--blue); }
.mainnav > a.on { color: var(--blue); border-bottom-color: var(--orange); }
.mainnav > .nav-soon {
  color: #9aa0aa; font-weight: bold; padding: 0 .9rem; line-height: var(--tap);
  border-bottom: 3px solid transparent; cursor: default; user-select: none;
  display: inline-flex; align-items: center; gap: .35rem; pointer-events: none;
}
.phase-tag {
  font-size: .65rem; font-weight: bold; letter-spacing: .03em; text-transform: uppercase;
  background: #eceef2; color: #6E6E6E; padding: .12rem .35rem; border-radius: 4px; line-height: 1.2;
}
.nav-spacer { flex: 1; }
.menu-toggle { display: none; margin-left: auto; min-height: var(--tap); padding: 0 1rem; border: 1px solid var(--line); background: #fff; border-radius: 6px; font: inherit; font-weight: bold; color: var(--blue); }
details { position: relative; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.usermenu > summary { padding: 0 .6rem; line-height: var(--tap); }
.dropdown { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 200px; padding: .3rem 0; z-index: 30; }
.dropdown a, .dropdown .linklike { display: block; padding: .75rem 1rem; text-decoration: none; color: var(--text); width: 100%; text-align: left; }
.dropdown a:hover, .dropdown .linklike:hover { background: var(--blue-light); }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.demo-banner { background: var(--orange); color: #fff; text-align: center; font-weight: bold; padding: .3rem; letter-spacing: .03em; }

/* layout */
.page { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.pagehead, .cardhead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.eyebrow { color: var(--gray); font-size: .85rem; margin-bottom: .2rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 560px; }
.danger-zone { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: #fafbfd; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: 0 1rem; line-height: var(--tap); text-decoration: none; color: var(--gray); white-space: nowrap; border-bottom: 3px solid transparent; font-weight: bold; }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }
.kpis { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.kpis > div { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: .55rem .9rem; min-width: 150px; }
.kpis span { display: block; color: var(--gray); font-size: .8rem; }
.kpis b { font-size: 1.15rem; }
.callout { background: var(--blue-light); padding: .6rem .8rem; border-radius: 6px; }
.empty { text-align: center; color: var(--gray); padding: 1.5rem !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* flash */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: .8rem; font-weight: bold; }
.flash-ok { background: #e3f3e8; color: #135c2a; border: 1px solid #b9dfc4; }
.flash-error { background: #fdeceb; color: #8e2318; border: 1px solid #f2c1bc; }
.flash-message { background: var(--blue-light); }

/* forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--gray); font-weight: bold; margin-bottom: .6rem; }
label small { font-weight: normal; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--text); min-height: var(--tap); padding: .45rem .6rem; border: 1px solid #c9cfda; border-radius: 6px; background: #fff; width: 100%; }
textarea { min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; accent-color: var(--blue); }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); font-weight: normal; font-size: .95rem; }
label.check.big { font-weight: bold; padding: .5rem 0; }
fieldset.radios { border: 0; padding: 0; margin: 0 0 .6rem; }
fieldset legend { font-size: .85rem; color: var(--gray); font-weight: bold; margin-bottom: .3rem; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
.grid .span2 { grid-column: span 2; } .grid .span3 { grid-column: 1 / -1; }
.formbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.filters input[type=search] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }
.filters label.check { margin: 0; }
.addline { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-top: 1rem; }
.addline label { margin: 0; }
.addline .grow { flex: 1 1 260px; }
.addline input[size] { width: 7rem; }
form.inline { display: inline-flex; gap: .3rem; align-items: center; margin: 0; flex-wrap: wrap; }
form.inline input, form.inline select { width: auto; }
.qtyform input { width: 5rem; text-align: right; }
.lineedit input { width: 5.5rem; text-align: right; }
.bigin { width: 6.5rem; text-align: right; font-size: 18px; }
.stack label { max-width: 560px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 1rem; border-radius: 6px; border: 1px solid #c9cfda; background: #fff; color: var(--text); font: inherit; font-weight: bold; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); color: #fff; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-dark); color: #fff; border-color: var(--orange-dark); }
.btn-danger { color: var(--red); border-color: #e6b0aa; }
.btn-sm { min-height: 36px; padding: 0 .7rem; font-size: .9rem; }
.btn-wide { width: 100%; }
.create > summary.btn { line-height: normal; }

/* tables */
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .8rem; -webkit-overflow-scrolling: touch; }
.card .tablewrap { border: 0; border-radius: 0; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; color: var(--gray); text-transform: uppercase; letter-spacing: .03em; padding: .6rem; border-bottom: 2px solid var(--line); white-space: nowrap; background: #fafbfd; }
table.list td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr:hover { background: #f7f9fe; }
table.list tfoot td { border-top: 2px solid var(--line); border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
.rowact { white-space: nowrap; text-align: right; }
.rowact a { display: inline-block; padding: .4rem .3rem; }
tr.low td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.bom tr.depth-1 td, .bom tr.depth-2 td, .bom tr.depth-3 td { background: #fafbfd; font-size: .93rem; }
.late { color: var(--red); font-weight: bold; }
.receipt { border-top: 1px solid var(--line); padding: .6rem 0; }
.receipt ul { margin: .3rem 0; padding-left: 1.2rem; }
dl.facts { display: grid; grid-template-columns: 180px 1fr; gap: .5rem 1rem; margin: 0; }
dl.facts dt { color: var(--gray); font-weight: bold; } dl.facts dd { margin: 0; }

/* badges */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: bold; white-space: nowrap; }
.st-draft { background: #eceef2; color: #4a4f5a; }
.st-sent { background: var(--blue-light); color: var(--blue); }
.st-partial { background: #fde7d5; color: #a04f0f; }
.st-received { background: #e0f1e5; color: var(--green); }
.st-closed { background: #e3e5e9; color: #2F3B4C; }
.badge.low { background: #fde7d5; color: #a04f0f; }
.badge.late { background: #fdeceb; color: var(--red); }
.kind { font-size: .85rem; }
.dept { display: inline-block; font-size: .78rem; font-weight: bold; padding: .15rem .5rem; border-radius: 4px; color: #fff; }
.dept-assembly { background: var(--green); } .dept-electrical { background: var(--purple); } .dept-manufacturing { background: var(--shop); }
.dept-mechanical { background: var(--blue); } .dept-mechanical-assembly { background: var(--blue); } .dept-electrical-assembly { background: var(--purple); }

/* login */
.login-box { max-width: 380px; margin: 8vh auto; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 10px; padding: 1.5rem; }
.login-logo { width: 100%; max-width: 260px; display: block; margin: 0 auto 1rem; }
.login-box h1 { text-align: center; margin-bottom: 1rem; }
.demo-note { text-align: center; color: var(--orange); font-weight: bold; }

/* dates typed as MM/DD/YYYY, with an optional calendar picker */
.datefield { position: relative; display: flex; align-items: stretch; }
.datefield .date-text { flex: 1; padding-right: calc(var(--tap) + 4px); }
.datefield .date-picker {
  position: absolute; right: 0; top: 0; width: var(--tap); height: var(--tap);
  min-height: var(--tap); opacity: 0; cursor: pointer; border: 0; background: transparent;
}
.datefield:not(.is-disabled)::after {
  content: ""; position: absolute; right: 10px; top: 50%; width: 18px; height: 16px;
  transform: translateY(-50%); pointer-events: none;
  border: 2px solid var(--blue); border-radius: 3px;
  background:
    linear-gradient(var(--blue), var(--blue)) 4px 0 / 2px 4px no-repeat,
    linear-gradient(var(--blue), var(--blue)) 10px 0 / 2px 4px no-repeat,
    linear-gradient(var(--blue-light), var(--blue-light)) 0 6px / 100% 2px no-repeat;
}
.datefield .date-picker::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.date-hint { display: block; font-weight: normal; margin: -.4rem 0 .6rem; }
.phone-total { display: none; }

/* autosave state, status menu, inline line editing */
.savestate { color: var(--gray); font-size: .85rem; align-self: center; margin-left: .4rem; }
.savestate.ok { color: var(--green); font-weight: bold; }
.savestate.bad { color: var(--red); font-weight: bold; }
.cardhead.tight { margin: 0 0 .5rem; }
.statusmenu > summary.btn, .moremenu > summary.btn { padding: 0 .7rem; gap: .35rem; }
.statusmenu .dropdown, .moremenu .dropdown { min-width: 240px; }
.dropdown form { margin: 0; }
.menu-note { padding: .5rem 1rem; font-size: .85rem; color: var(--gray); }
.danger-text { color: var(--red) !important; }
.caret { font-size: .8rem; color: var(--gray); }
.ico { vertical-align: middle; }
.btn .ico + .btn-text { margin-left: .4rem; }
.topgap { margin-top: .8rem; }
details.card > summary { padding: .2rem 0; min-height: var(--tap); display: flex; align-items: center; gap: .5rem; }
.polines input.q { width: 6rem; text-align: right; }
.polines td.input-cell { vertical-align: middle; }
.polines .datefield { min-width: 10.5rem; }
.polines tr.addrow td { background: #fafbfd; }
.polines tr.addrow input[data-itemfield] { min-width: 14rem; }
.polines tfoot td { padding-top: .8rem; }
.inline-edit { width: 6rem; text-align: right; }

form.inline .linkbtn, .linkbtn { background: none; border: 0; padding: .4rem .3rem; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }
.empty-note { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; background: #fff8ef; border: 1px solid #f3d3b0; border-radius: 8px; padding: .6rem .9rem; margin-bottom: .8rem; }
.tag-empty { font-size: .75rem; color: var(--gray); font-weight: normal; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }

.sortlink { color: inherit; text-decoration: none; }
.sortlink:hover { color: var(--blue); }
.topgap-sm { margin-top: .35rem; }
table.list td.input-cell input.q { width: 6rem; text-align: right; }
.stockform { display: inline; }

/* print */
body.print { background: #fff; padding: 1.5rem; }
.printhead { display: flex; gap: 1.5rem; align-items: center; border-bottom: 3px solid var(--blue); padding-bottom: .8rem; margin-bottom: 1rem; }
.printhead img { height: 60px; }
@media print { .noprint { display: none; } body.print { padding: 0; } }

/* tablet */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .span2 { grid-column: 1 / -1; }
}
/* phone */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar { flex-wrap: wrap; padding: .35rem .7rem; }
  .brand img { height: 32px; }
  .menu-toggle { display: inline-block; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: .5rem; }
  .mainnav.open { display: flex; }
  .mainnav > a { border-bottom: 1px solid var(--line); border-left: 4px solid transparent; padding: 0 .8rem; }
  .mainnav > a.on { border-bottom-color: var(--line); border-left-color: var(--orange); }
  .mainnav > .nav-soon { border-bottom: 1px solid var(--line); border-left: 4px solid transparent; padding: 0 .8rem; }
  .nav-spacer { display: none; }
  .mainnav details { margin-top: .5rem; }
  .mainnav .create > summary { width: 100%; }
  .dropdown { position: static; box-shadow: none; margin-top: .3rem; }
  .page { padding: .7rem; }
  .grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .actions { width: 100%; } .actions .btn, .actions form { flex: 1 1 auto; } .actions form .btn { width: 100%; }
  .filters select, .filters .btn { flex: 1 1 45%; }
  dl.facts { grid-template-columns: 1fr; } dl.facts dd { margin-bottom: .4rem; }
  .kpis > div { flex: 1 1 45%; min-width: 0; }
  table.list td, table.list th { padding: .55rem .45rem; }
  .btn-wide-phone { width: 100%; }

  /* list tables become stacked cards so key fields stay on screen */
  .tablewrap:has(table.cards) {
    overflow: visible; border: 0; background: transparent; border-radius: 0;
  }
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards tfoot { display: none; }
  table.cards tbody tr {
    display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: .75rem .9rem; margin-bottom: .65rem; box-shadow: none;
  }
  table.cards tbody tr:hover { background: #fff; }
  table.cards tbody tr.low { box-shadow: inset 4px 0 0 var(--orange); }
  table.cards td {
    display: flex; justify-content: space-between; align-items: baseline; gap: .8rem;
    border: 0; padding: .28rem 0; text-align: left; white-space: normal; width: 100%;
  }
  table.cards td.num { text-align: left; }
  table.cards td.hide-sm { display: none !important; }
  table.cards td.primary { font-weight: bold; }
  table.cards td.primary { padding-left: 0 !important; }
  table.cards tr.depth-1 td.primary { padding-left: .8rem !important; }
  table.cards tr.depth-2 td.primary { padding-left: 1.5rem !important; }
  table.cards tr.depth-3 td.primary { padding-left: 2.2rem !important; }
  table.cards td::before {
    content: attr(data-label); font-size: .75rem; font-weight: bold; color: var(--gray);
    text-transform: uppercase; letter-spacing: .03em; flex: 0 0 42%; max-width: 42%;
  }
  table.cards td.rowact { padding-top: .55rem; justify-content: flex-end; gap: .6rem; align-items: center; }
  table.cards td.rowact:not([data-label])::before { display: none; content: none; }
  table.cards td.rowact .btn, table.cards td.rowact a { min-height: var(--tap); display: inline-flex; align-items: center; }
  table.cards td.input-cell { flex-wrap: wrap; align-items: center; }
  table.cards td.input-cell::before { flex: 0 0 100%; max-width: 100%; margin-bottom: .2rem; }
  table.cards td.input-cell input,
  table.cards td.input-cell .bigin,
  table.cards .qtyform input,
  table.cards .lineedit input {
    width: 100%; max-width: none; flex: 1 1 100%; text-align: left; font-size: 18px;
  }
  table.cards .qtyform, table.cards .lineedit, table.cards td.input-cell form {
    display: flex; flex-wrap: wrap; gap: .4rem; width: 100%; align-items: center;
  }
  table.cards .qtyform .btn, table.cards .lineedit .btn { flex: 0 0 auto; }
  table.cards td.input-cell .date-picker { width: var(--tap); flex: none; }
  .polines .datefield { min-width: 0; width: 100%; }
  .polines tr.addrow input[data-itemfield] { min-width: 0; }
  .statusmenu .dropdown, .moremenu .dropdown { min-width: 0; }
  table.cards td:empty, table.cards td.rowact:empty { display: none; }
  table.cards td.empty, table.cards td.empty::before {
    display: block; content: none; text-align: center; flex: none; max-width: none;
  }
  table.cards tbody tr:has(td.empty) { box-shadow: none; }
  .phone-total { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin: 0 0 .8rem; font-weight: bold; }
  .receive-table tbody tr { padding-bottom: .9rem; }
  .receive-table .bigin { min-height: var(--tap); }
}

/* editable dropdowns ("+ Add new...") */
.pick { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pick > select { flex: 1 1 10rem; min-width: 0; }
.pick-new { display: flex; gap: .4rem; flex: 1 1 100%; }
.pick-new input { flex: 1 1 8rem; min-width: 0; }
.js .pick-new { display: none; }
.js .pick.adding .pick-new { display: flex; }
.js .pick-new [data-pick-add], .js .pick-new [data-pick-cancel] { display: inline-flex; }
.pick-new [data-pick-add], .pick-new [data-pick-cancel] { display: none; }
.pick-err { color: var(--red); flex: 1 1 100%; }
td .pick { display: inline-flex; vertical-align: middle; }
.btn-red { color: var(--red); border-color: #e6b0aa; }

/* Settings > Lists */
.listpage { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: start; }
.sidelist { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.sidelist a { padding: .65rem .9rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.sidelist a:last-child { border-bottom: 0; }
.sidelist a.on { background: var(--blue); color: #fff; font-weight: 600; }
@media (max-width: 760px) {
  .listpage { grid-template-columns: 1fr; }
  .sidelist { flex-direction: row; overflow-x: auto; }
  .sidelist a { border-bottom: 0; border-right: 1px solid var(--line); white-space: nowrap; }
}

/* Stock: views and columns */
.viewbar { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .6rem; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-body { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 260px; max-width: min(92vw, 380px);
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.12); padding: .6rem; }
details.menu .menu-body > a { display: block; padding: .5rem .6rem; border-radius: 6px; color: inherit; text-decoration: none; }
details.menu .menu-body > a:hover { background: #f1f4f8; }
details.menu .menu-body > a.on { font-weight: 700; color: var(--blue); }
details.menu .menu-body hr { border: 0; border-top: 1px solid var(--line); margin: .4rem 0; }
details.menu .menu-body form + form { margin-top: .5rem; }
.colpick ul { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.colpick li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .15rem 0; border-bottom: 1px solid #f0f0f0; }
.colpick .updown { display: inline-flex; gap: .2rem; }
.colpick .updown .btn { min-height: 30px; padding: 0 .5rem; }
.linkbtn.danger { color: var(--red); }
@media (max-width: 760px) { details.menu .menu-body { position: fixed; left: 4vw; right: 4vw; top: auto; max-width: none; } }

/* Print templates */
.note-phase2 { background: #fff4e5; border: 1px solid #f0c27a; color: #7a4b00; border-radius: 6px; padding: .5rem .8rem; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cardhead h2 { margin: 0; }
.tpl-edit { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 1rem; align-items: start; }
.tpl-form label { display: block; margin-bottom: .6rem; }
.tpl-form label.check { display: flex; }
.tpl-form fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 .8rem; padding: .5rem .7rem; }
.tpl-form legend { font-weight: 600; padding: 0 .3rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: end; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.orderlist { list-style: none; margin: 0; padding: 0; }
.orderlist li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .1rem 0; border-bottom: 1px solid #f0f0f0; }
.orderlist label.check { margin: 0; }
.orderlist .updown { display: inline-flex; gap: .2rem; }
.orderlist .updown .btn { min-height: 30px; padding: 0 .5rem; }
.tpl-preview { position: sticky; top: .5rem; }
.tpl-preview iframe { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 6px; background: #e9edf2; }
@media (max-width: 900px) { .tpl-edit { grid-template-columns: 1fr; } .tpl-preview { position: static; } .tpl-preview iframe { height: 70vh; } .grid3 { grid-template-columns: 1fr; } }

/* Label ticks */
.labelbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 .5rem; }
.labelbar .inline-label { display: inline-flex; flex-direction: row; gap: .3rem; align-items: center; margin: 0; }
.labelbar input[name=copies] { width: 3.2rem; }
th.tick-cell, td.tick-cell { width: 2.2rem; text-align: center; }
td.tick-cell input, .labelbar input[type=checkbox] { width: 20px; height: 20px; }
@media (max-width: 760px) { table.cards td.tick-cell { width: auto; text-align: right; } }

/* Scanning */
.scanmsg { display: block; margin-top: .25rem; color: var(--green, #2e7d32); }
.scanmsg.bad { color: var(--red); font-weight: 600; }
.scanbox { display: block; font-weight: 600; }
.scanbox input { margin-top: .3rem; width: 100%; max-width: 420px; font-size: 1.1rem; }
.scancard { padding-bottom: .8rem; }
tr.scanned { outline: 3px solid var(--orange); outline-offset: -3px; }

td.col-no, .stock-no { white-space: nowrap; }
@media (min-width: 761px) { td.col-name { min-width: 11rem; } .list td.rowact { white-space: nowrap; } .list input.q { width: 4.5rem; } }

/* ---------- Phase 2: sell, make, shop floor ---------- */
.mo-not_started, .op-not_started, .so-open { background: #eceef2; color: #4a4f5a; }
.mo-blocked { background: #fbe1de; color: var(--red); }
.mo-in_progress, .op-in_progress { background: var(--blue-light); color: var(--blue); }
.op-paused, .so-partial { background: #fde7d5; color: #a04f0f; }
.mo-done, .op-done, .so-delivered { background: #e0f1e5; color: var(--green); }
.mo-canceled { background: #e3e5e9; color: #2F3B4C; text-decoration: line-through; }
.av { font-weight: bold; white-space: nowrap; }
.av::before { content: ""; display: inline-block; width: .65em; height: .65em; border-radius: 50%; margin-right: .35em; vertical-align: .05em; background: #b6bcc7; }
.av-in_stock { color: var(--green); } .av-in_stock::before { background: var(--green); }
.av-expected { color: #a04f0f; } .av-expected::before { background: var(--orange); }
.av-not_available { color: var(--red); } .av-not_available::before { background: var(--red); }
.av-done, .av-delivered { color: var(--gray); } .av-done::before, .av-delivered::before { background: var(--gray); }
.callout.good { background: #e0f1e5; } .callout.bad { background: #fbe1de; }
.nowrap { white-space: nowrap; }
.note { color: #6b4a00; background: #fff6df; padding: .1rem .3rem; border-radius: 4px; white-space: pre-line; display: inline-block; }
.prewrap { white-space: pre-line; }
.fieldlink { min-height: var(--tap); display: flex; align-items: center; font-weight: bold; }
table.list.opstable td.input-cell input.q { width: 4.2rem; }
.opstable td.primary input { min-width: 8em; }
table.list.opstable td.rowact { white-space: normal; min-width: 9.5em; }
.opstable .rowact .btn-sm { margin: 1px 0; }
.opstable select { min-width: 8em; max-width: 10.5em; }
.rowact form.inline { display: inline; }

/* board */
.board-dept h2 { margin: 1rem 0 .4rem; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.board-col { background: #eef1f6; border-radius: 10px; padding: .5rem; min-height: 4rem; }
.board-col h3 { margin: .1rem .2rem .5rem; font-size: .9rem; }
.board-card { display: block; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; padding: .5rem .6rem; margin-bottom: .45rem; color: var(--text); text-decoration: none; }
.board-card.is-blocked { border-left-color: var(--red); }
.board-empty { color: var(--gray); text-align: center; padding: .4rem; }

/* shop floor: phone and tablet first, big targets */
.floor { max-width: 760px; margin: 0 auto; }
.floor-scan { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; margin-bottom: 1rem; }
.floor-label { font-size: 1rem; color: var(--text); }
.floor-scanrow { display: flex; gap: .5rem; }
.floor-scanrow input { font-size: 1.4rem; min-height: 56px; text-transform: uppercase; }
.floor-h { font-size: 1.5rem; margin: .4rem 0 .8rem; }
.floor-h2 { font-size: 1.2rem; margin: 1.2rem 0 .6rem; }
.floor-card { background: #fff; border: 1px solid var(--line); border-left: 6px solid #b6bcc7; border-radius: 12px; padding: .9rem 1rem; margin-bottom: .8rem; }
.floor-card.st-in_progress { border-left-color: var(--blue); }
.floor-card.st-paused { border-left-color: var(--orange); }
.floor-card.st-done { border-left-color: var(--green); opacity: .85; }
.floor-card.is-blocked { border-left-color: var(--red); }
.floor-card.is-mine { box-shadow: 0 0 0 2px var(--blue-light); }
.floor-mono { display: block; font-size: 2.2rem; font-weight: bold; letter-spacing: .02em; color: var(--blue); text-decoration: none; line-height: 1.1; }
.floor-what { font-size: 1.05rem; margin: .2rem 0; }
.floor-step { font-size: 1.25rem; font-weight: bold; margin: .3rem 0; }
.floor-state { margin: .3rem 0 .6rem; }
.floor-clock { font-size: 1.2rem; font-weight: bold; font-variant-numeric: tabular-nums; }
.floor-btns { display: flex; gap: .6rem; flex-wrap: wrap; }
.floor-btns form { flex: 1 1 140px; }
.btn-big { width: 100%; min-height: 64px; font-size: 1.3rem; border-radius: 10px; }
.btn-go { background: var(--green); border-color: var(--green); color: #fff; }
.btn-go:hover { color: #fff; filter: brightness(1.1); }
.btn-pause { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-pause:hover { color: #fff; background: var(--orange-dark); }
.btn-finish { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-finish:hover { color: #fff; background: var(--blue-dark); }
.floor-notes { display: inline-block; margin-top: .6rem; font-weight: bold; min-height: var(--tap); line-height: var(--tap); }
.floor-note summary { min-height: var(--tap); line-height: var(--tap); color: var(--blue); font-weight: bold; }
.floor-head { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.floor-bigno { font-size: 3rem; font-weight: bold; color: var(--blue); line-height: 1; letter-spacing: .02em; }
.floor-facts { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: .7rem 0; }
.floor-facts span { display: flex; flex-direction: column; }
.floor-facts small { color: var(--gray); }
.floor-facts b { font-size: 1.15rem; }
.floor-done { padding-left: 1.1rem; } .floor-done li { margin-bottom: .4rem; }
@media (max-width: 760px) {
  .board { grid-template-columns: 1fr; }
  .floor-mono { font-size: 2rem; }
  .floor-bigno { font-size: 2.6rem; }
}

/* ---- Round 3: shared type-ahead combo (Katana-style) ---- */
select.combo-select { display: none; }
.combo-input { width: 100%; min-height: var(--tap); }
td.input-cell .combo-input { min-width: 9rem; }
.combo-list { position: fixed; z-index: 60; margin: 0; padding: .25rem 0; list-style: none; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); max-height: 18rem; overflow-y: auto; max-width: min(32rem, 96vw); }
.combo-list[hidden] { display: none; }
.combo-opt, .combo-create, .combo-hint { padding: .6rem .9rem; min-height: 40px; line-height: 1.3; cursor: pointer; }
.combo-opt small { display: block; color: var(--gray); font-size: .8rem; }
.combo-opt.is-blank { color: var(--gray); font-style: italic; }
.combo-opt.on, .combo-opt:hover, .combo-create.on, .combo-create:hover { background: var(--blue-light); }
.combo-create { border-top: 1px solid var(--line); color: var(--blue); font-weight: bold; position: sticky; bottom: -.25rem; background: #fff; }
.combo-hint { color: var(--gray); cursor: default; font-size: .9rem; }
.pick-err { display: block; color: var(--red); }

/* item card header and General info */
.itemhead .eyebrow { color: var(--gray); font-size: .85rem; font-weight: bold; text-transform: uppercase; letter-spacing: .03em; }
.itemhead h1 { margin: .1rem 0 0; }
.generalinfo .usability { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .8rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; align-items: center; }
.generalinfo .usability legend { font-weight: bold; padding: 0 .3rem; }
.generalinfo .usability small { flex: 0 0 100%; color: var(--gray); }
label.check { display: inline-flex; align-items: center; gap: .4rem; min-height: var(--tap); font-weight: bold; }
label.check input { width: 1.2rem; height: 1.2rem; }
.subhead { margin: 1.2rem 0 .5rem; font-size: 1rem; }
table.detailsrow td.input-cell input { width: 100%; }
table.detailsrow .linkbtn { font-size: .85rem; }
.copyfrom { display: inline-flex; gap: .3rem; align-items: center; }
.copyfrom .combo-input { min-width: 13rem; min-height: 36px; }
.cardhead.tight { margin-bottom: .5rem; }
.btn-icon { padding: 0 .7rem; }

/* Katana-style rows: drag handle, delete, step #, totals */
table.kops .col-drag, table.kops .col-del, table.kops .col-step { width: 1%; white-space: nowrap; text-align: center; }
.drag { cursor: grab; border: 0; background: none; color: var(--gray); font-size: 1rem; letter-spacing: -3px; padding: .5rem .4rem; min-height: var(--tap); touch-action: none; }
.drag:focus-visible { outline: 2px solid var(--blue); border-radius: 4px; }
tr.dragging { opacity: .6; background: var(--blue-light); }
.icon-x { border: 0; background: none; color: var(--gray); font-size: 1.3rem; line-height: 1; padding: .4rem .6rem; min-height: var(--tap); cursor: pointer; border-radius: 6px; }
.icon-x:hover { color: var(--red); background: #fdeceb; }
tr.filterrow th { padding: .3rem .5rem; background: #fafbfd; }
tr.filterrow input { width: 100%; max-width: 20rem; font-weight: normal; }
table.kops tfoot td { border-top: 2px solid var(--line); font-weight: bold; }
tr.totalrow td { background: #f7f9fc; font-weight: bold; }
label.rate { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; color: var(--gray); font-size: .85rem; }
input.t { width: 6.5rem; text-align: right; }
.toggle { display: inline-flex; align-items: center; gap: .45rem; font-weight: bold; min-height: var(--tap); cursor: pointer; }
.toggle input { width: 1.2rem; height: 1.2rem; }
.ops-meta { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }

/* operators chips (struck through = removed) */
.chip { display: inline-flex; align-items: center; gap: .15rem; background: var(--blue-light); color: var(--blue-dark); border-radius: 999px; padding: .15rem .25rem .15rem .6rem; margin: .1rem .15rem .1rem 0; font-size: .85rem; font-weight: bold; }
.chip.off { background: #eef0f4; color: var(--gray); padding-right: .6rem; }
.chip-x, .chip-btn { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; padding: .1rem .35rem; border-radius: 999px; min-height: 28px; }
.chip-x:hover { background: rgba(0,0,0,.08); }

/* MO status circles: click to complete, turns into a check */
.op-circle { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #b8c0cc;
  background: #fff; color: #fff; font-weight: bold; cursor: pointer; padding: 0; list-style: none; vertical-align: middle; }
.op-circle::-webkit-details-marker { display: none; }
.op-circle:hover { border-color: var(--green); box-shadow: 0 0 0 4px rgba(27,122,56,.12); }
.op-circle.st-in_progress { border-color: var(--blue); border-style: dashed; }
.op-circle.st-paused { border-color: var(--orange); }
.op-circle.is-done { background: var(--green); border-color: var(--green); }
span.op-circle { cursor: default; }
.op-word { display: block; color: var(--gray); font-size: .78rem; }
td.col-status { position: relative; text-align: center; min-width: 4.5rem; }
details.op-close > summary { list-style: none; }
details.op-close[open] > .finish-close, details.op-close .finish-close { position: absolute; right: 0; top: 100%; z-index: 25; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: .7rem; min-width: 15rem; text-align: left; }
.finish-close label { display: block; font-weight: bold; margin-bottom: .4rem; }
.finish-close input { width: 100%; margin-top: .25rem; }

@media (max-width: 760px) {
  .copyfrom { width: 100%; }
  .copyfrom .combo-input { min-width: 0; flex: 1; }
  table.cards.kops td.col-drag, table.cards.kops td.col-del { display: inline-flex; width: auto; }
  table.cards.kops td.col-step { width: auto; text-align: left; white-space: normal; }
  details.op-close .finish-close { position: static; box-shadow: none; margin-top: .4rem; }
  td.col-status { text-align: left; }
}
label.toggle { flex-direction: row; margin-bottom: 0; color: var(--text); font-size: .9rem; }
#opstable label.rate { flex-direction: row; margin-bottom: 0; }
.cardhead .actions form { margin: 0; }
