/* JIM - lumber inventory for St Wood Products Ltd.
   Charcoal / lime-green accent (dark) and warm off-white / green accent (light), system fonts, 14px base, light + dark, tablet friendly.
   Plain CSS only (CSP: no inline styles, no external assets). */

:root {
  --bg:#f5f6f4; --surface:#ffffff; --surface2:#f0f2ee; --border:#e2e5e0; --border-strong:#cdd2cb;
  --text:#1a201b; --muted:#5f6a62; --accent:#3a8527; --accent-h:#2f6f1f; --accent-soft:#e6f4d9; --on-accent:#ffffff;
  --link:#2f7a1f; --danger:#b42318; --danger-soft:#fdebe9; --warn:#8a5a00; --warn-soft:#fdf2d4; --info:#1d5fa8; --info-soft:#e4effb;
  --ok-soft:#e2f2d4; --sel:#fff6c2; --zebra:#f9faf8; --hover:#eef5e6;
  --side:#1b1f1c; --side-text:#cfd6d0; --side-muted:#8e9890; --side-hover:#2a302b; --side-on:#3a8527; --side-on-text:#ffffff;
  --shadow:0 1px 2px rgba(20,35,26,.06), 0 4px 14px rgba(20,35,26,.05);
  --border-soft:#e8ebe6; --side-2:#1b1f1c; --glass:rgba(245,246,244,.88);
  --page-bg:none; --pill-bg:#ffffff;
  --radius:14px; --r-sm:10px; --row-h:28px;
  --font:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --mono:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0f1113; --surface:#17191c; --surface2:#1f2226; --border:#2a2e33; --border-strong:#3a3f45;
    --text:#e8eaed; --muted:#9aa0a8; --accent:#b8f24a; --accent-h:#cdf77a; --accent-soft:rgba(184,242,74,.14); --on-accent:#11160a;
    --link:#c4f26b; --danger:#ff8b7e; --danger-soft:#331b19; --warn:#f0c15a; --warn-soft:#33290f; --info:#7db4ee; --info-soft:#172536;
    --ok-soft:rgba(184,242,74,.14); --sel:#3f3d12; --zebra:#1a1c1f; --hover:#22262b;
    --side:#121416; --side-text:#c9ced4; --side-muted:#8a919a; --side-hover:#22262b; --side-on:#b8f24a; --side-on-text:#11160a;
    --shadow:0 1px 2px rgba(0,0,0,.35);
    --border-soft:#23272b; --side-2:#121416; --glass:rgba(15,17,19,.85);
    --page-bg:none; --pill-bg:#17191c;
  }
}
:root[data-theme="dark"] {
  --bg:#0f1113; --surface:#17191c; --surface2:#1f2226; --border:#2a2e33; --border-strong:#3a3f45;
  --text:#e8eaed; --muted:#9aa0a8; --accent:#b8f24a; --accent-h:#cdf77a; --accent-soft:rgba(184,242,74,.14); --on-accent:#11160a;
  --link:#c4f26b; --danger:#ff8b7e; --danger-soft:#331b19; --warn:#f0c15a; --warn-soft:#33290f; --info:#7db4ee; --info-soft:#172536;
  --ok-soft:rgba(184,242,74,.14); --sel:#3f3d12; --zebra:#1a1c1f; --hover:#22262b;
  --side:#121416; --side-text:#c9ced4; --side-muted:#8a919a; --side-hover:#22262b; --side-on:#b8f24a; --side-on-text:#11160a;
  --shadow:0 1px 2px rgba(0,0,0,.35);
  --border-soft:#23272b; --side-2:#121416; --glass:rgba(15,17,19,.85);
  --page-bg:none; --pill-bg:#17191c;
}

* { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); background: var(--bg); background-image: var(--page-bg); color: var(--text); }
a { color: var(--link); }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.empty { color: var(--muted); text-align: center; padding: 14px 8px !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
kbd { font: 11px var(--mono); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); background: var(--surface2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; flex: 0 0 232px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; background-image: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); transition: width .15s ease; }
.brand { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px; color: #fff; text-decoration: none; white-space: nowrap; }
.brand { flex-direction: row; align-items: center; gap: 9px; padding: 14px 12px 12px; }
.brand-jim { height: 28px; width: auto; display: block; flex: none; }
.brand-sep { width: 1px; height: 24px; background: var(--side-muted); opacity: .5; flex: none; }
.brand-lockup { height: 26px; width: auto; max-width: 92px; object-fit: contain; object-position: left; opacity: .95; display: block; }
.brand-lockup.lk-WW { height: 34px; max-width: 110px; margin: -4px 0; }
.brand-mark { display: none; width: 28px; height: 28px; }
html.nav-collapsed .brand-jim, html.nav-collapsed .brand-sep, html.nav-collapsed .brand-lockup { display: none; }
html.nav-collapsed .brand-mark { display: block; }
.brand .logo { font-weight: 800; font-size: 20px; letter-spacing: .04em; color: #fff; background: var(--side-on); border-radius: 6px; padding: 0 8px; }
.brand .co { font-size: 11px; color: var(--side-muted); line-height: 1.2; white-space: normal; }
.sidebar nav { flex: 1; padding: 4px 8px; }
.nav-sec { margin-top: 10px; }
.nav-h { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); padding: 4px 10px; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; color: var(--side-text); text-decoration: none; white-space: nowrap;
  background: none; border: 0; font: inherit; width: 100%; cursor: pointer; text-align: left; min-height: 34px; }
.nav-item:hover { background: var(--side-hover); }
.nav-item.on { background: var(--side-on); color: var(--side-on-text); font-weight: 600; }
.nav-collapse { margin: 8px; width: calc(100% - 16px); color: var(--side-muted); }
html.nav-collapsed .sidebar { width: 64px; flex-basis: 64px; }
html.nav-collapsed .nav-sec + .nav-sec { border-top: 1px solid var(--side-hover); margin-top: 8px; padding-top: 8px; }
html.nav-collapsed .sidebar .lbl, html.nav-collapsed .sidebar .co, html.nav-collapsed .sidebar .nav-h { display: none; }
html.nav-collapsed .brand { padding: 14px 8px 10px; justify-content: center; }
html.nav-collapsed .brand .logo { font-size: 13px; padding: 0 5px; }
html.nav-collapsed .nav-item { justify-content: center; padding: 8px 0; }
@media (min-width: 901px) { html.nav-collapsed .nav-item { width: 44px; min-height: 40px; margin: 2px auto; border-radius: 12px; } html.nav-collapsed .nav-collapse { width: 44px; margin: 8px auto; } }
html.nav-collapsed .nav-collapse .ic { transform: rotate(180deg); }
.scrim { display: none; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  background: var(--bg); border-bottom: 1px solid var(--border-soft); }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .topbar { background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
.menu-toggle { display: none; }
.gsearch { position: relative; flex: 0 1 260px; min-width: 150px; display: flex; align-items: center; }
.gsearch > .ic { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.gsearch input { width: 100%; padding: 8px 34px 8px 34px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.gsearch input:focus { background: var(--surface); border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.gsearch .hint { position: absolute; right: 10px; }
.gs-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow-y: auto; z-index: 40; padding: 4px 0; }
.gs-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 14px 2px; }
.gs-item { display: flex; justify-content: space-between; gap: 12px; padding: 7px 14px; color: var(--text); text-decoration: none; }
.gs-item .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item.on, .gs-item:hover { background: var(--accent-soft); }
.gs-all { display: block; padding: 8px 14px; border-top: 1px solid var(--border); margin-top: 4px; font-size: 13px; }
.gs-none { padding: 10px 14px; color: var(--muted); }
.menu { position: relative; }
.pop { position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; z-index: 40; }
.pop.right { left: auto; right: 0; }
.pop.rowmenu { position: fixed; top: 0; left: 0; z-index: 60; min-width: 190px; }
.pop.rowmenu a::after { content: "97"; margin-left: auto; color: var(--muted); font-size: 11px; }
.pop a, .pop button.lnk { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border-radius: 6px; color: var(--text);
  text-decoration: none; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.pop a.on { background: var(--accent-soft); font-weight: 600; }
.pop a:hover, .pop button.lnk:hover, .pop a:focus-visible { background: var(--accent-soft); }
.pop form { margin: 0; }
.pop-h { padding: 6px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; min-height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font: 700 13px/1 var(--font); letter-spacing: .02em; cursor: pointer; }
.user-btn:hover { background: var(--accent-h); }
.content { flex: 1; padding: 16px 20px 40px; min-width: 0; max-width: 1500px; width: 100%; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--link); text-decoration: underline; }
.crumbs .sep { opacity: .6; }
.plainmain { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; flex-direction: column; }
.plainmain > .flash { max-width: 380px; width: 100%; }

/* ---------------------------------------------------------------- top navigation pills (desktop) */
.topnav { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.tn-box { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--pill-bg); border: 1px solid var(--border); border-radius: 999px; }
.tn-box .menu { display: flex; }
.tn-pill { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 4px 13px; border-radius: 999px; border: 0; background: transparent; color: var(--muted);
  font: 500 13px/1.2 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .12s, color .12s; }
.tn-pill:hover { background: var(--surface2); color: var(--text); }
.tn-pill.on, .tn-pill.on:hover { background: var(--accent); color: var(--on-accent); font-weight: 650; }
.tn-pill .ic { width: 12px; height: 12px; opacity: .7; }

/* ---------------------------------------------------------------- page header, cards, stats */
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin: 0 0 14px; }
.ph-title { min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph-title h1 { margin: 0; }
.ph-sub { color: var(--muted); flex-basis: 100%; margin-top: -2px; }
main h1 { font-size: 24px; line-height: 1.2; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
main h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
main h3 { font-size: 14px; margin: 0 0 8px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card > h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.card > h2 .count, h2 .count { font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; margin-left: 4px; font-weight: 600; }
.danger-card { border-color: var(--danger); }
.danger-card h2 { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat.has-ic { display: flex; align-items: center; gap: 12px; }
.stat .si { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.stat .sb { min-width: 0; }
.stat .sv { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat .sp { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.stat .sl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat.big .sv { color: var(--accent); font-size: 28px; }
.stat meter { width: 100%; height: 8px; margin-top: 4px; }
.facts dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 20px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); } .facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.facts dd.pre { white-space: pre-line; }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.dash .card { margin: 0; } .dash .card.wide { grid-column: 1 / -1; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.twocol > .card { margin: 0; min-width: 0; }
table.mini { width: 100%; border-collapse: collapse; }
table.mini th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--border); }
table.mini td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
table.mini tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--border-strong); }
table.mini th.n, table.mini td.n { text-align: right; font-variant-numeric: tabular-nums; }
.more { margin: 8px 0 0; font-size: 13px; }
progress { width: 100%; min-width: 80px; height: 8px; accent-color: var(--accent); }
.recent, .activity, .results, .plainlist { list-style: none; margin: 0; padding: 0; }
.recent li, .activity li { padding: 5px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.recent li:last-child, .activity li:last-child { border-bottom: 0; }
.recent .k { color: var(--muted); font-size: 12px; min-width: 70px; }
.activity .when { color: var(--muted); font-size: 12px; min-width: 76px; font-variant-numeric: tabular-nums; } .activity .who { font-weight: 600; }
.plainlist li { padding: 5px 0; }
.results li a { display: flex; justify-content: space-between; gap: 16px; padding: 8px 6px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.results li a:hover { background: var(--hover); } .r-main { font-weight: 600; } .r-sub { color: var(--muted); }
.empty-page { color: var(--muted); padding: 30px 0; text-align: center; }
.errbox { text-align: center; padding: 40px 0; }

/* ---------------------------------------------------------------- buttons */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; min-height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.2;
  transition: background-color .12s, border-color .12s, box-shadow .12s; }
button:hover, .btn:hover { background: var(--surface2); }
.btn.primary, button.primary, button[type=submit]:not(.btn):not(.lnk):not(.nav-item):not(.secondary):not(.danger) { background: var(--accent); color: var(--on-accent); border-color: var(--accent); border-radius: 999px; font-weight: 600; box-shadow: none; }
.btn.primary:hover, button.primary:hover, button[type=submit]:not(.btn):not(.lnk):not(.nav-item):not(.secondary):not(.danger):hover { background: var(--accent-h); }
.btn.danger, button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-o { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger-o:hover { background: var(--danger-soft); }
.btn.small, button.small { padding: 2px 10px; min-height: 26px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; padding: 0; background: none; border-color: transparent; }
button.lnk { border: 0; }
form.inline { display: inline-flex; margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.chip { padding: 3px 12px; border-radius: 999px; transition: background-color .12s, border-color .12s, box-shadow .12s; border: 1px solid var(--border-strong); text-decoration: none; color: var(--text); font-size: 13px; background: transparent; }
.chip:hover { background: var(--surface2); } .chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- forms */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 6px 9px; min-height: 34px; max-width: 100%; transition: border-color .12s, box-shadow .12s; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled, select:disabled, textarea:disabled, input.ro { background: var(--surface2); color: var(--muted); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); background: var(--danger-soft); }
.field-error { color: var(--danger); font-size: 12px; margin-top: 2px; }
textarea { min-height: 70px; resize: vertical; width: 100%; }
textarea.csv { min-height: 160px; font-family: var(--mono); font-size: 13px; }
.form .field, .formrow .field { display: flex; flex-direction: column; gap: 3px; min-width: 150px; flex: 1 1 170px; }
.form label, .formrow label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select { width: 100%; }
.field.sm { flex: 0 1 120px; min-width: 90px; } .field.xs { flex: 0 1 84px; min-width: 70px; }
.field.wide { flex: 2 1 260px; } .field.grow { flex: 3 1 240px; } .field.tagno { flex: 1 1 150px; }
.field.act { flex: 0 0 auto; min-width: 0; justify-content: flex-end; }
.field.checks { flex: 0 0 auto; min-width: 0; flex-direction: row; gap: 16px; align-items: center; padding-top: 18px; }
.formrow { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin: 0 0 12px; }
.formrow.tight { gap: 8px; margin-bottom: 8px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-weight: 400 !important; color: var(--text) !important; font-size: 14px !important; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.btnrow { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.actionbar { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--bg);
  padding: 10px 0; margin-top: 4px; border-top: 1px solid var(--border); z-index: 5; }
details.more { margin-top: 4px; } details.more > summary, details.inline-edit > summary { cursor: pointer; color: var(--link); font-size: 13px; padding: 4px 0; }
details.edit-card > summary { cursor: pointer; list-style: none; } details.edit-card > summary h2 { display: inline; }
details.edit-card > summary::before { content: "\25B8  "; } details.edit-card[open] > summary::before { content: "\25BE  "; }
.val { display: inline-block; padding: 6px 9px; background: var(--surface2); border-radius: 6px; min-height: 34px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 14px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); color: var(--accent); border-color: var(--accent); }
.flash.err { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.advgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; align-items: center; }
.advgrid label { font-size: 12px; color: var(--muted); display: block; margin-bottom: -2px; }

/* legacy dialog markup still used by the document / admin pages: same look, labels above-left */
.dlg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 14px; box-shadow: var(--shadow); max-width: 1100px; }
.dlg.win { padding-top: 14px; } .winbar { display: none; }
fieldset { border: 0; margin: 0 0 8px; padding: 0; min-width: 0; }
fieldset.inner { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; align-self: flex-start; }
legend { font-weight: 650; font-size: 15px; padding: 0; margin-bottom: 8px; }
fieldset.inner legend { font-size: 13px; padding: 0 6px; }
.fr { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.fr.top { align-items: flex-start; }
.frow { display: flex; gap: 8px; margin-top: 4px; } .stack { display: flex; flex-direction: column; gap: 4px; }
.lb { width: 140px; flex: 0 0 140px; font-size: 13px; color: var(--muted); }
.lb.s { width: auto; flex: 0 0 auto; margin-left: 8px; }
.split { display: flex; gap: 18px; flex-wrap: wrap; } .split > div { flex: 1; min-width: 300px; }
.i60{width:70px}.i100{width:110px}.i150{width:160px}.i250{width:260px}.i350{width:360px}
.val.i250, .val.i350, .val.i150, .val.i100, .val.i60 { width: auto; min-width: 60px; }
.val.num { text-align: right; font-variant-numeric: tabular-nums; } .val.pre { white-space: pre-line; }
.subbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
.subbar a.cur { font-weight: 700; } .dim { color: var(--muted); }
.note, p.note { color: var(--muted); font-size: 13px; margin: 6px 0; }
.cards { display: flex; gap: 10px; flex-wrap: wrap; } .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; } .row > div { flex: 1; min-width: 140px; }
.row label { display: block; font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; } dt { font-weight: 600; } dd { margin: 0; }
code.pw { font-size: 15px; background: var(--warn-soft); padding: 2px 8px; border-radius: 4px; user-select: all; }
pre { white-space: pre-wrap; margin: 4px 0; }
pre.readme { max-height: 70vh; overflow: auto; background: var(--surface2); padding: 12px; border-radius: var(--radius); }
.big { font-size: 22px; font-weight: 700; color: var(--accent); }
.btnlike { display: inline-flex; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 6px; text-decoration: none; }
.btnlike.off { color: var(--muted); }
details.dlg > summary { cursor: pointer; }
.tally { margin: 2px 0; }

/* ---------------------------------------------------------------- status badges + pills */
.pill, .st { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.st { min-width: 24px; text-align: center; padding: 0 7px; border-radius: 5px; }
.st-i, .pill.in_stock, .pill.posted, .pill.closed, .st-posted, .st-closed { background: var(--ok-soft); color: var(--accent); border-color: transparent; }
.st-s, .pill.shipped, .st-shipped { background: var(--info-soft); color: var(--info); border-color: transparent; }
.st-r, .st-c, .st-consumed { background: var(--surface2); color: var(--muted); }
.st-h, .st-p, .st-o, .pill.reserved, .pill.received_pending, .pill.pending_review, .pill.draft, .pill.open, .st-pending_review, .st-draft, .st-received_pending, .st-open { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-x, .pill.void, .pill.rejected, .st-void, .st-rejected { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------------------------------------------------------------- data grids */
.gridbox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 14px; overflow: hidden; }
.card .gridbox { box-shadow: none; }
.gridtools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.gridtools .gfilter { flex: 1 1 220px; max-width: 360px; min-height: 32px; padding: 4px 14px; border-radius: 999px; background: var(--surface2); border-color: var(--border); }
.gridtools .spacer { flex: 1; }
.gridtools .btn, .gridtools button { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 999px; background: transparent; }
.gridtools .btn:hover, .gridtools button:hover { background: var(--surface2); }
.colpop { position: absolute; z-index: 15; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 12px; max-height: 60vh; overflow: auto; }
.colpop label { display: flex; gap: 8px; align-items: center; padding: 3px 0; white-space: nowrap; font-size: 13px; }
.gridwrap { overflow-x: auto; }
.gridbox > .gridwrap { max-height: calc(100vh - 250px); min-height: 120px; overflow: auto; outline: none; }
table.grid, main table { border-collapse: collapse; width: 100%; }
table.grid th { position: sticky; top: 0; z-index: 2; background: var(--surface2); color: var(--text); font-weight: 650; font-size: 13px; text-align: left; padding: 0 10px; height: 32px;
  white-space: nowrap; border-bottom: 1px solid var(--border); }
table.grid th a { color: inherit; text-decoration: none; display: flex; align-items: center; height: 32px; }
table.grid th.n a { justify-content: flex-end; }
table.grid th.srt { color: var(--accent); }
table.grid th a:hover { color: var(--link); }
table.grid tr.frow-f th { top: 32px; height: 32px; padding: 2px 6px; background: var(--surface); border-bottom: 1px solid var(--border); }
table.grid tr.frow-f input { width: 100%; min-width: 50px; min-height: 26px; padding: 1px 6px; font-size: 12px; border-radius: 4px; font-weight: 400; }
table.grid td { padding: 0 10px; height: var(--row-h); border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.grid tbody tr:nth-child(even) { background: var(--zebra); }
table.grid tbody tr:hover { background: var(--hover); }
table.grid tbody tr[data-href] { cursor: pointer; }
table.grid tbody tr.sel, table.grid tbody tr.sel:hover { background: var(--sel); }
table.grid tr.fill { display: none; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td a { color: var(--link); text-decoration: none; font-weight: 600; } table.grid td a:hover { text-decoration: underline; }
table.grid td.n a { font-weight: 400; }
table.grid tfoot td { font-weight: 700; background: var(--surface2); border-top: 2px solid var(--border-strong); }
table.grid.hide-c0 .c0, table.grid .chid { display: none; }
.gridfoot { display: flex; gap: 18px; padding: 8px 12px; font-size: 13px; border-top: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; align-items: center; }
.gridfoot .cnt { font-weight: 600; } .gridfoot .tot { color: var(--muted); font-variant-numeric: tabular-nums; } .gridfoot .tot b { color: var(--text); }
.gridfoot .printlink { color: var(--muted); font-size: 12px; margin-left: auto; } .gridfoot .printlink + .printlink { margin-left: 0; }
.w44{min-width:44px}.w45{min-width:45px}.w50{min-width:50px}.w55{min-width:55px}.w60{min-width:60px}.w65{min-width:65px}.w70{min-width:70px}.w80{min-width:80px}
.w90{min-width:90px}.w100{min-width:100px}.w110{min-width:110px}.w120{min-width:120px}.w160{min-width:160px}.w200{min-width:200px}.w220{min-width:220px}.w250{min-width:250px}
main > table:not(.grid), main > .card > table:not(.grid):not(.mini) { width: 100%; background: var(--surface); }
main th, main td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }
table.grid th, table.grid td { /* keep grid padding */ }
main th.n, main td.n { text-align: right; }

/* ---------------------------------------------------------------- tag entry (ship / transfer / run) + receive screen */
.screen { max-width: 1250px; }
.entrybar { display: flex; gap: 8px; margin-bottom: 6px; }
.entry-input { flex: 1; font-size: 16px; min-height: 42px; font-family: var(--mono); }
.entry-msg { min-height: 20px; font-size: 13px; margin: 2px 0 8px; color: var(--muted); }
.entry-msg.err { color: var(--danger); font-weight: 600; } .entry-msg.ok { color: var(--accent); }
.entry-table td.x button { padding: 0 8px; min-height: 24px; }
.entryrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 10px; background: var(--surface2); border-radius: var(--radius); margin-bottom: 8px; }
.entryrow .field { min-width: 0; flex: 1 1 90px; }
.entryrow .field.tagno { flex: 1.4 1 130px; } .entryrow .field.grow { flex: 3 1 170px; } .entryrow .field.xs { flex: .6 1 62px; } .entryrow .field.sm { flex: 1 1 82px; }
.entryrow input { font-family: var(--mono); }
.entryopts { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
#recv-table tbody tr { cursor: pointer; }
#recv-table td.tl { font-family: var(--mono); font-size: 13px; }

/* ---------------------------------------------------------------- login */
.logincard { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 28px 22px; }
.logincard h1 { font-size: 20px; margin: 14px 0 14px; }
.logincard label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 4px; }
.logincard input { width: 100%; min-height: 42px; font-size: 16px; }
.logincard .btn { margin-top: 18px; min-height: 44px; font-size: 16px; }
.lc-brand { display: flex; align-items: center; gap: 10px; } .lc-brand .logo { font-weight: 800; font-size: 20px; background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 0 10px; }
.lc-brand .co { color: var(--muted); font-size: 13px; } .lc-foot { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }

/* ---------------------------------------------------------------- print */
.printhint { display: none; }
body.printmode .printhint { display: block; padding: 8px 14px; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); margin-bottom: 10px; }
body.printmode .sidebar, body.printmode .topbar, body.printmode .gridtools { display: none; }
body.printmode .gridbox > .gridwrap { max-height: none; }
@media print {
  .sidebar, .topbar, .topnav, .crumbs, .actions, .gridtools, .actionbar, .scrim, .printlink, .chips, .printhint, button, .btn, form.form .hint { display: none !important; }
  body, .card, .gridbox, .stat, .dlg, .logincard { background: #fff !important; background-image: none !important; color: #000 !important; box-shadow: none !important; }
  .topbar, .sidebar { background-image: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .shell, .main-col { display: block; } .content { padding: 0; max-width: none; }
  .card, .gridbox, .stat { border-color: #999 !important; }
  .gridbox > .gridwrap { max-height: none !important; overflow: visible !important; }
  table.grid th { position: static; background: #eee !important; color: #000 !important; }
  table.grid tbody tr:nth-child(even) { background: #fff !important; }
  table.grid tr.frow-f { display: none; }
  a { color: #000 !important; text-decoration: none !important; }
  .twocol, .dash { display: block; }
}

/* ---------------------------------------------------------------- tablet / phone */
@media (max-width: 1320px) {
  .twocol { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; flex-basis: auto; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
  html.nav-collapsed .sidebar { width: 260px; }
  html.nav-collapsed .sidebar .lbl, html.nav-collapsed .sidebar .co, html.nav-collapsed .sidebar .nav-h { display: revert; }
  html.nav-collapsed .nav-item { justify-content: flex-start; padding: 7px 10px; }
  .nav-collapse { display: none; }
  html.nav-open .sidebar { transform: none; }
  html.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }
  .menu-toggle { display: inline-flex; }
  .topnav { display: none; }
  .gsearch { flex: 1 1 auto; }
  .topbar { padding: 8px 12px; gap: 6px; } .content { padding: 12px 12px 40px; }
  .gridbox > .gridwrap { max-height: calc(100vh - 220px); }
}
@media (pointer: coarse) {
  :root { --row-h: 40px; }
  button, .btn, input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], input[type=search], select { min-height: 42px; }
  .btn.small, button.small { min-height: 34px; }
  .nav-item { min-height: 44px; }
  .pop a, .pop button.lnk, .gs-item { padding-top: 11px; padding-bottom: 11px; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .lb { width: 100%; flex-basis: 100%; }
  .dash { grid-template-columns: 1fr; }
}
th.sortable { cursor: pointer; user-select: none; }
.gridbox { position: relative; }
.gridbox.js .printlink { display: none; }
.gridbox.js .printlink + .printlink { display: inline; }
.gsearch input[type=search] { padding: 8px 34px; }
.danger-card { display: none; }
.danger-card:target { display: block; }
.st { font-size: 12px; }
.gs-item .main { font-weight: 600; }

/* ---- log loads / sawmill runs ---- */
.pill.available, .st-available { background: var(--ok-soft); color: var(--accent); border-color: transparent; }
.pill.partly_used, .st-partly_used { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.consumed { background: var(--surface2); color: var(--muted); }
.logcols { grid-template-columns: minmax(300px, 2fr) minmax(420px, 3fr); }
.logcols h3 { font-size: 14px; margin: 14px 0 6px; }
.logsec { margin: 0 0 14px; }
.logsec:first-of-type h3 { margin-top: 4px; }
.logentry .entryopts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.logstats .stat .proj { color: var(--accent); font-weight: 600; }
table.grid.pick tbody tr[data-load] { cursor: pointer; }
table.grid.pick tbody tr[data-load]:hover td { background: var(--surface2); }
.chips-form { margin-top: 8px; }
@media (max-width: 1100px) { .logcols { grid-template-columns: 1fr; } }

/* phone-view suggestion on small screens (dismissible; shown by app.js) */
.phone-banner { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; background: var(--accent-soft); color: var(--text); border-bottom: 1px solid var(--border, #d5ddd7); }
.phone-banner[hidden] { display: none; }
.phone-banner .lnk { background: none; border: 0; padding: 4px 8px; color: inherit; text-decoration: underline; cursor: pointer; }

/* login card: company lockup logo */
.lc-logo { height: 54px; width: auto; background: #fff; border-radius: 8px; padding: 4px 8px; }

/* login lockup: dark-ink version on light theme, light version on dark theme; no background box */
.lc-logo { height: 56px; width: auto; background: none; border-radius: 0; padding: 0; }
.lc-logo-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lc-logo-dark { display: none; }
  :root:not([data-theme="light"]) .lc-logo-light { display: inline; }
}
:root[data-theme="dark"] .lc-logo-dark { display: none; }
:root[data-theme="dark"] .lc-logo-light { display: inline; }
.lc-jim { height: 44px; width: auto; display: block; margin: 6px 0 10px; }

/* theme swap for login logos (kept last so it wins over the size rules above) */
.lc-jim { display: block; }
.lc-logo-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lc-logo-dark { display: none; }
  :root:not([data-theme="light"]) .lc-logo-light { display: block; }
}
:root[data-theme="dark"] .lc-logo-dark { display: none; }
:root[data-theme="dark"] .lc-logo-light { display: block; }

/* ---- drop a file to auto-fill (dropfill.js) ---- */
.dropfill { padding: 10px 14px; }
.df-zone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 14px 16px; text-align: center; cursor: pointer; color: var(--muted); background: var(--surface2); transition: border-color .12s, background .12s; }
.df-zone:hover, .df-zone:focus-visible, .df-zone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); outline: none; }
.df-zone strong { color: var(--text); }
.df-zone .df-sub { display: block; font-size: 12px; margin-top: 2px; }
.df-actions { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.df-bar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: 8px; }
.df-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.df-bar.busy > span { width: 100% !important; animation: df-pulse 1s ease-in-out infinite; opacity: .5; }
@keyframes df-pulse { 50% { opacity: 1; } }
.df-status { margin-top: 8px; font-size: 13px; }
.df-status.err { color: var(--danger); }
.df-panel { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.df-panel h3 { font-size: 13px; margin: 0 0 4px; }
.df-engine { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--info-soft); color: var(--info); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.df-issues { margin: 4px 0 0; padding-left: 18px; color: var(--warn); font-size: 13px; }
.df-text { max-height: 220px; overflow: auto; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: 12px/1.35 var(--mono); white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; }
.df-files { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.df-panel .df-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.df-auto, select.df-auto, textarea.df-auto { background: #fff7c7; border-color: #d9b83a; }
input.df-low, select.df-low, textarea.df-low { background: #ffe2a8; border-color: #d98a00; }
.df-badge { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #fff1a8; color: #6b5200; border-radius: 4px; padding: 0 5px; vertical-align: 1px; }
.df-badge.low { background: #ffcf7a; color: #6b3d00; }
tr.df-autorow > td { background: #fffbe0; }
td.df-low { background: #ffe2a8 !important; }
tr.df-bad > td { background: var(--danger-soft) !important; }
.df-note { font-size: 11px; color: var(--warn); display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input.df-auto, :root:not([data-theme="light"]) select.df-auto, :root:not([data-theme="light"]) textarea.df-auto { background: #4a4416; border-color: #8c7a1e; }
  :root:not([data-theme="light"]) input.df-low, :root:not([data-theme="light"]) select.df-low, :root:not([data-theme="light"]) textarea.df-low { background: #5a3d0a; border-color: #b87a10; }
  :root:not([data-theme="light"]) tr.df-autorow > td { background: #3a3510; }
  :root:not([data-theme="light"]) td.df-low { background: #5a3d0a !important; }
  :root:not([data-theme="light"]) .df-badge { background: #6b5a14; color: #fff1a8; }
}
:root[data-theme="dark"] input.df-auto, :root[data-theme="dark"] select.df-auto, :root[data-theme="dark"] textarea.df-auto { background: #4a4416; border-color: #8c7a1e; }
:root[data-theme="dark"] input.df-low, :root[data-theme="dark"] select.df-low, :root[data-theme="dark"] textarea.df-low { background: #5a3d0a; border-color: #b87a10; }
:root[data-theme="dark"] tr.df-autorow > td { background: #3a3510; }
:root[data-theme="dark"] td.df-low { background: #5a3d0a !important; }
:root[data-theme="dark"] .df-badge { background: #6b5a14; color: #fff1a8; }
@media (max-width: 760px) { .df-panel { grid-template-columns: 1fr; } }


.st-flagged, .flag-badge { display: inline-block; background: #c0392b; color: #fff; border-radius: 4px; padding: 0 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.flagged-count { background: #c0392b !important; color: #fff !important; }

/* unknown product chooser / yard add box */
.prodchoose { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.prodchoose .pc-label { font-weight: 600; color: var(--danger); margin-right: 2px; }
td.prod-q { background: #fff4d6; }
.warn-card { border-color: #d9a400; }
.warn-card h2 { color: #8a6500; }
.yard-new { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }

/* QuickBooks sales pages (inline SVG charts; colours via classes because of the CSP) */
.qbo-chart { width: 100%; height: auto; max-height: 300px; }
.qbo-chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.qbo-grid { stroke: var(--border); stroke-width: 1; }
.qbo-bar { fill: var(--accent); }
.qbo-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.qbo-filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
.qbo-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; }
.qbo-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.qbo-s0 { fill: #1f6f43; background: #1f6f43; }
.qbo-s1 { fill: #2f7fc1; background: #2f7fc1; }
.qbo-s2 { fill: #d98a1f; background: #d98a1f; }
.qbo-s3 { fill: #8e5bb5; background: #8e5bb5; }
.qbo-s4 { fill: #c2493d; background: #c2493d; }
.qbo-s5 { fill: #3aa6a0; background: #3aa6a0; }
.qbo-s6 { fill: #a3a23a; background: #a3a23a; }
.qbo-s7 { fill: #d1649a; background: #d1649a; }
.qbo-s8 { fill: #6b7f93; background: #6b7f93; }
.qbo-s9 { fill: #9aa39d; background: #9aa39d; }

/* PDF preview page + Summary / Detailed split buttons */
.pvframe { width: 100%; height: calc(100vh - 170px); min-height: 480px; border: 1px solid var(--line, #c8ccd2); border-radius: 6px; background: #fff; }
.pdfsplit { display: inline-flex; gap: 0; }
.pdfsplit .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pdfsplit .btn:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.card.costcard .grid input.num { width: 6.5em; text-align: right; }

/* ---------------------------------------------------------------- run screens: summary panels + stats blocks */
.sumcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; margin: 0 0 14px; }
.sumcols > .card { margin: 0; min-width: 0; }
.sumpanel { position: relative; transition: border-color .12s ease, box-shadow .12s ease; }
.sumpanel .sumhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sumpanel .sumhead h2 { margin: 0; font-size: 16px; }
.sumpanel.clickable:hover, .sumpanel.clickable:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.sumpanel .stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.sumpanel.clickable { cursor: pointer; }
.sumbody h4 { margin: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px 14px; margin: 0; }
dl.kv > div { min-width: 0; }
dl.kv dt { font-size: 11px; color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 16px; overflow-wrap: anywhere; }
dl.kv .hi dd { color: var(--accent); }
.statempty { padding: 6px 0; }
.runinputs > .card { min-width: 0; }
.pkgtoggle { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
table.grid.pkgs td, table.grid.pkgs th { white-space: nowrap; }
.runout-stats { margin-bottom: 14px; }

/* ---------------------------------------------------------------- unknown-product chooser (jimProduct.chooser) */
.prodchoose { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prodchoose .pc-label { font-weight: 700; color: var(--warn); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

/* ---------------------------------------------------------------- tag-entry grid (tagentry.js) */
.tagentry { margin: 6px 0 4px; }
.te-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 8px 10px; background: var(--surface2); border-radius: var(--radius); }
.te-bar .te-total { margin-left: auto; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; align-self: center; }
.te-autonote { color: var(--muted); font-size: 13px; align-self: center; }
.te-msg { margin: 6px 2px; min-height: 20px; }
.te-hint { margin: 6px 2px 0; }
.te-secs { display: grid; gap: 14px; }
.te-sec { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px 8px; }
.te-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; justify-content: space-between; margin-bottom: 8px; }
.te-fields { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; flex: 1 1 520px; }
.te-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 110px; }
.te-f.xs { flex: 0 1 84px; } .te-f.sm { flex: 1 1 110px; max-width: 170px; }
.te-fl { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.te-in { width: 100%; min-height: 32px; padding: 3px 8px; }
.te-nextf { flex: 0 1 190px; }
.te-countup { align-self: center; }
.te-headbtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.te-prods { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.te-chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); }
.te-chip.ok { background: var(--ok-soft); color: var(--accent); border-color: transparent; }
.te-chip.bad { background: var(--warn-soft); color: var(--warn); border-color: transparent; border-radius: 8px; padding: 4px 8px; }
.te-scroll { overflow-x: auto; }
table.te-grid { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.te-grid th { position: static; text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 5px 4px; border-bottom: 2px solid var(--border-strong); white-space: nowrap; background: transparent; }
.te-grid th.n, .te-grid td.n { text-align: right; }
.te-grid td { padding: 2px 3px; border-bottom: 1px solid var(--border); height: 34px; white-space: nowrap; }
.te-grid td.te-idx, .te-grid th.te-idx { width: 28px; color: var(--muted); font-size: 12px; padding-right: 6px; }
.te-grid tbody tr:nth-child(even) { background: var(--zebra); }
.te-grid tbody tr:hover { background: var(--hover); }
.te-grid input.te-c { width: 100%; min-width: 46px; min-height: 28px; padding: 2px 6px; border: 1px solid transparent; background: transparent; border-radius: 4px; font: inherit; font-family: var(--mono); font-size: 13px; color: var(--text); }
.te-grid input.te-c.n { text-align: right; min-width: 52px; }
.te-grid input.te-tag { min-width: 128px; font-weight: 600; }
.te-grid td.te-cell { padding: 1px 2px; }
.te-grid input.te-c:hover { border-color: var(--border-strong); background: var(--surface); }
.te-grid input.te-c:focus { border-color: var(--accent); background: var(--surface); outline: 2px solid var(--accent-soft); }
.te-grid input.te-c:not(:placeholder-shown):not(.te-tag):not(.n) { font-family: var(--font); }
.te-grid input.te-dup, .te-grid input.te-bad { border-color: var(--danger); background: var(--danger-soft); }
.te-grid tr.te-auto td { background: #fff6bf; }
.te-grid tr.te-bad td { background: var(--danger-soft); }
.te-grid td.te-pcs, .te-grid td.te-fbm, .te-grid td.te-m3, .te-grid td.te-pkg { padding: 0 8px; color: var(--text); }
.te-grid td.te-pcs { font-weight: 650; }
.te-grid td.te-rm, .te-grid th.te-rmh { width: 30px; text-align: center; }
.te-grid th.te-lh { min-width: 58px; color: var(--text); font-size: 13px; position: relative; }
.te-grid tfoot td { font-weight: 700; border-top: 2px solid var(--border-strong); border-bottom: 0; background: var(--surface2); padding: 5px 8px; font-size: 13px; }
.te-totlab { color: var(--muted); }
button.te-del, button.te-x { min-height: 22px; width: 22px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; border-radius: 4px; }
button.te-del:hover, button.te-x:hover { background: var(--danger-soft); color: var(--danger); }
button.te-x { position: absolute; top: 1px; right: -2px; width: 16px; min-height: 16px; font-size: 12px; opacity: 0; }
.te-lh:hover button.te-x, button.te-x:focus { opacity: 1; }
button.te-plus { min-height: 24px; padding: 0 8px; }
.te-addlen { min-width: 74px; }
input.te-lenin { width: 84px; min-height: 28px; padding: 2px 6px; }
.te-stats { margin: 6px 2px 2px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .te-grid tr.te-auto td { background: #4a4416; } }
:root[data-theme="dark"] .te-grid tr.te-auto td { background: #4a4416; }

@media (max-width: 900px) {
  .sumcols { grid-template-columns: 1fr; }
  .te-bar .te-total { margin-left: 0; width: 100%; }
}

/* two-factor setup */
.qr { background: #fff; display: inline-block; padding: 8px; border-radius: 8px; line-height: 0; }
.qr svg { width: 220px; height: 220px; }
.recovery-codes { font-size: 1.1rem; line-height: 1.7; letter-spacing: .06em; background: var(--card, #f4f4f4); padding: .75rem 1rem; border-radius: 8px; user-select: all; }
.card.narrow { max-width: 34rem; }
.narrow-form { max-width: 26rem; }

/* ---------------------------------------------------------------- company switcher (sidebar brand) */
.co-switch { display: block; }
.co-switch > summary { list-style: none; cursor: pointer; }
.co-switch > summary::-webkit-details-marker { display: none; }
.co-switch .co-chev { color: var(--side-muted); font-size: 12px; margin-left: auto; }
.co-switch:not([open]) .co-pop { display: none; }
html.nav-collapsed .co-chev { display: none; }
html.nav-collapsed .co-pop { display: none; }
.co-pop { margin: 0 8px 4px; padding: 4px; border-radius: var(--radius); background: rgba(255,255,255,.08); }
.co-pop .pop-h { color: var(--side-muted); border-bottom-color: rgba(255,255,255,.15); padding: 4px 8px; }
.co-form { margin: 0; }
.co-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: none;
  color: var(--side-text); font: inherit; text-align: left; cursor: pointer; white-space: normal; }
.co-opt:hover, .co-opt:focus-visible { background: var(--side-hover); }
.co-opt.on { background: var(--side-on); color: #fff; font-weight: 600; }
.co-code { font: 700 11px var(--mono); letter-spacing: .05em; opacity: .8; flex: none; }
.co-nm { flex: 1; font-size: 12.5px; line-height: 1.25; }
.co-tick { flex: none; }
.co-home { display: block; padding: 5px 8px; font-size: 12px; color: var(--side-muted); text-decoration: none; }
.co-home:hover { color: #fff; }
.co-text { font-weight: 700; color: #fff; }
.pagelinks { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: 13px; }
.ww-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0 0 12px; }
.ww-filters label { display: block; font-size: 12px; color: var(--muted); }
.co-grid td.cb, .co-grid th.cb { text-align: center; }
.low { color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- quick entry on the run outputs page (runout.js) */
.qe [hidden] { display: none !important; }
.qe h2 .qe-toggle { font-size: 12px; font-weight: 500; margin-left: 10px; }
.qe-form { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; padding: 8px 10px; background: var(--surface2); border-radius: var(--radius); }
.qe-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 0 1 auto; width: 104px; max-width: 100%; }
.qe-f select.qe-in { width: 100%; }
.qe-f input.te-dup { border-color: var(--danger); background: var(--danger-soft); }
.qe-opt { flex: 0 0 auto; justify-content: flex-end; } .qe-chk { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.qe-f.qe-xs { flex: 0 1 auto; width: 84px; }
.qe-f.qe-tagf { flex: 1 1 150px; max-width: 220px; }
.qe-in { width: 100%; min-height: 34px; padding: 3px 8px; }
.qe-tagf .qe-in { font-family: var(--mono); font-weight: 700; }
.qe-msg { margin: 6px 2px 0; }
.qe-last { margin: 4px 2px 0; font-variant-numeric: tabular-nums; }
.qe-last b { font-family: var(--mono); }
.qe-form { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.qe-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; }
.qe-f.qe-num { flex: 0 0 auto; width: 84px; }
.qe-f.qe-tagf { flex: 0 0 auto; width: 132px; max-width: none; }
.qe-fbm { background: var(--surface); text-align: right; font-weight: 700; }
.qe-num .qe-in { text-align: right; }
.qe-tagf .qe-in { text-align: left; }

.qe-body { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.qe-body .qe-form { flex: 1 1 520px; min-width: 0; }
.qe-products { flex: 0 1 260px; max-width: 260px; min-width: 200px; font-size: 12.5px; display: flex; flex-direction: column; gap: 1px; }
@media (max-width: 800px) { .qe-products { flex: 1 1 100%; max-width: none; } }
.qe-ph { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.qe-prod { display: flex; gap: 6px; text-align: left; padding: 2px 6px; background: var(--surface2); border: 0; border-radius: var(--radius); cursor: pointer; font: inherit; color: inherit; }
.qe-prod:hover { background: var(--surface); }
.qe-pn { flex: 0 0 1.4em; font-family: var(--mono); font-weight: 700; color: var(--muted); }
.qe-f.qe-chg { flex: 0 0 auto; width: 104px; }
.qe-f.qe-chg small { font-size: 10.5px; white-space: nowrap; }
.qe-f.qe-tallyf { flex: 1 1 150px; }
.qe-tally { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 34px; }
.qe-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px 1px 7px; font: 600 12px var(--mono); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.qe-x { border: 0; background: transparent; padding: 0 3px; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; }
.qe-x:hover { color: var(--danger); }
.qe-f u { text-decoration: underline; }
.qe-head { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.qe-f.qe-lastf { margin-left: auto; flex: 0 0 auto; width: 150px; }
.qe-lasttag { font-family: var(--mono); font-weight: 700; background: var(--surface); }
.qe-mid { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.qe-left { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 10px; }
.qe-x-sep { align-self: flex-end; padding-bottom: 7px; color: var(--muted); }
.qe-f.qe-sp { width: 96px; } .qe-f.qe-gr { width: 90px; } .qe-f.qe-yd { width: 130px; }
.qe-f small.muted { font-size: 10.5px; white-space: nowrap; }
.qe-detail { align-items: flex-start; }
.qe-tallyrow { padding-top: 2px; }
.qe-ro .qe-in { background: var(--surface); }
.qe-form > .qe-tally { padding: 4px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 34px; }
.qe-btns { display: flex; justify-content: flex-end; gap: 8px; }
.qe-ph { display: flex; gap: 6px; padding: 2px 6px; border-bottom: 1px solid var(--border); }
.qe-pn { flex-basis: 2em; }
.sum-h { font-size: 14px; margin: 14px 0 6px; }
.sum-tbl .mono { font-family: var(--mono, ui-monospace, Consolas, monospace); }
.sum-tbl tfoot tr.sum-total td, .sum-tbl tr.sum-total td { background: var(--sel); font-weight: 700; }
#run-summary h2 .btn { margin-left: 10px; font-size: 12px; font-weight: 500; }

.note.unalloc, p.note.unalloc { color: var(--danger); font-weight: 600; }
.note.warn-note, p.note.warn-note { color: #8a6500; }
