/* SKU HUB - MIEDECO Cooperative. Light + dark, responsive. */
:root {
  --sh-primary: #0b7a4b;
  --sh-primary-dark: #0b5d3b;
  --sh-primary-soft: #e1f3ea;
  --sh-accent: #f2b705;
  --sh-side-bg: #064e2f;
  --sh-side-text: #d7f0e2;
  --sh-side-active: rgba(255,255,255,.14);
  --sh-bg: #f4f6f5;
  --sh-card: #ffffff;
  --sh-border: #dfe6e2;
  --sh-text: #1c2622;
  --sh-muted: #66746d;
  --sh-side-w: 250px;
  --sh-rail-w: 68px;
  --sh-radius: 16px;
  --bs-primary: var(--sh-primary);
  --bs-primary-rgb: 11, 122, 75;
  --bs-link-color: var(--sh-primary);
  --bs-link-color-rgb: 11, 122, 75;
  --bs-link-hover-color: var(--sh-primary-dark);
}
[data-bs-theme="dark"] {
  --sh-primary: #43b87b;
  --sh-primary-dark: #7ad6a2;
  --sh-primary-soft: #16372a;
  --sh-side-bg: #04301d;
  --sh-side-text: #b4ccbf;
  --sh-side-active: rgba(255,255,255,.12);
  --sh-bg: #0f1713;
  --sh-card: #172119;
  --sh-border: #263329;
  --sh-text: #e3ece7;
  --sh-muted: #8aa095;
  --bs-primary: #43b87b;
  --bs-primary-rgb: 67, 184, 123;
  --bs-link-color: #6fd49c;
  --bs-link-color-rgb: 111, 212, 156;
  --bs-link-hover-color: #9be6bd;
  --bs-body-bg: #0f1713;
  --bs-body-color: #e3ece7;
  --bs-border-color: #263329;
}
html, body { background: var(--sh-bg); color: var(--sh-text); }
body { font-size: .94rem; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--sh-primary); --bs-btn-border-color: var(--sh-primary); --bs-btn-hover-bg: var(--sh-primary-dark); --bs-btn-hover-border-color: var(--sh-primary-dark);
  --bs-btn-active-bg: var(--sh-primary-dark); --bs-btn-active-border-color: var(--sh-primary-dark); --bs-btn-disabled-bg: var(--sh-primary); --bs-btn-disabled-border-color: var(--sh-primary); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #04150c; --bs-btn-hover-color: #04150c; --bs-btn-active-color: #04150c; --bs-btn-disabled-color: #04150c; }
.btn-outline-primary { --bs-btn-color: var(--sh-primary); --bs-btn-border-color: var(--sh-primary); --bs-btn-hover-bg: var(--sh-primary); --bs-btn-hover-border-color: var(--sh-primary); --bs-btn-active-bg: var(--sh-primary); }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-hover-color: #04150c; --bs-btn-active-color: #04150c; }
.form-control:focus, .form-select:focus { border-color: var(--sh-primary); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18); }
.form-check-input:checked { background-color: var(--sh-primary); border-color: var(--sh-primary); }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sh-side-w); background: var(--sh-side-bg); color: var(--sh-side-text); position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column; transition: transform .2s ease, width .2s ease; overflow: hidden; }
.sidebar .brand { padding: 1rem; display: flex; align-items: center; gap: .7rem; font-weight: 800; min-height: 70px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { height: 42px; width: 42px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; flex: none; }
.sidebar .brand-text { line-height: 1.15; overflow: hidden; white-space: nowrap; }
.sidebar .brand-text b { display: block; color: #fff; font-size: 1.02rem; letter-spacing: .3px; }
.sidebar .brand-text small { color: var(--sh-side-text); opacity: .75; font-size: .72rem; font-weight: 500; }
.sidebar nav { overflow-y: auto; overflow-x: hidden; flex: 1; padding: .4rem 0 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; padding: .9rem 1rem .25rem; white-space: nowrap; width: 100%; display: flex; align-items: center; justify-content: space-between; background: none; border: 0; color: var(--sh-side-text); opacity: .65; cursor: pointer; text-align: left; }
.nav-section:hover { opacity: 1; }
.nav-section .caret { font-size: .6rem; transition: transform .2s; }
.nav-group.closed .caret { transform: rotate(-90deg); }
.nav-items { overflow: hidden; }
.nav-group.closed .nav-items { display: none; }
.sidebar .nav-link { color: var(--sh-side-text); padding: .5rem 1rem; display: flex; align-items: center; gap: .7rem; font-size: .92rem; border-left: 3px solid transparent; border-radius: 0; white-space: nowrap; }
.sidebar .nav-link i { width: 1.25rem; text-align: center; flex: none; opacity: .95; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: var(--sh-side-active); color: #fff; border-left-color: var(--sh-accent); font-weight: 600; }
.sidebar .side-foot { padding: .6rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-size: .72rem; opacity: .7; white-space: nowrap; }
.main { flex: 1; margin-left: var(--sh-side-w); min-width: 0; display: flex; flex-direction: column; transition: margin .2s ease; }
.topbar { position: sticky; top: 0; z-index: 1030; background: var(--sh-card); border-bottom: 1px solid var(--sh-border); padding: .6rem 1rem; display: flex; align-items: center; gap: .7rem; }
.topbar .page-title { font-weight: 700; font-size: 1.05rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .clock { font-size: .8rem; color: var(--sh-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.topbar .btn-light { background: var(--sh-bg); border-color: var(--sh-border); color: var(--sh-text); }
.content { padding: 1.25rem 1.25rem 3rem; flex: 1; transition: opacity .12s; }
.content.swapping { opacity: .45; pointer-events: none; }
.footer { padding: .8rem 1.25rem; color: var(--sh-muted); font-size: .78rem; border-top: 1px solid var(--sh-border); }
#navbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--sh-accent); z-index: 3000; opacity: 0; transition: width .25s ease, opacity .2s; pointer-events: none; }
#navbar.on { opacity: 1; }
/* desktop: collapse to an icon rail */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar { width: var(--sh-rail-w); }
  body.sidebar-collapsed .main { margin-left: var(--sh-rail-w); }
  body.sidebar-collapsed .brand { padding: 1rem .65rem; justify-content: center; }
  body.sidebar-collapsed .brand-text, body.sidebar-collapsed .side-foot, body.sidebar-collapsed .nav-link span { display: none; }
  body.sidebar-collapsed .nav-section { font-size: 0; padding: .55rem 0; margin: 0 .9rem; width: auto; border-bottom: 1px solid rgba(255,255,255,.12); opacity: 1; pointer-events: none; display: block; }
  body.sidebar-collapsed .nav-section .caret { display: none; }
  body.sidebar-collapsed .nav-group.closed .nav-items { display: block; }
  body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: .6rem 0; gap: 0; }
  body.sidebar-collapsed .sidebar .nav-link i { font-size: 1.05rem; }
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 30px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
  .content { padding: .9rem .75rem 3rem; }
  .topbar .clock { display: none; }
}

/* ---------- cards / tables ---------- */
.card { background: var(--sh-card); border: 1px solid var(--sh-border); border-radius: var(--sh-radius); box-shadow: 0 1px 2px rgba(16,40,28,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--sh-border); font-weight: 600; }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--sh-border); }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--sh-muted); font-weight: 650; white-space: nowrap; border-bottom-width: 1px; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: rgba(var(--bs-primary-rgb), .06); }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--sh-primary); }
th[data-sort].sorted-asc::after { content: " \25B2"; font-size: .6rem; }
th[data-sort].sorted-desc::after { content: " \25BC"; font-size: .6rem; }
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-loading { position: absolute; inset: 0; background: color-mix(in srgb, var(--sh-card) 70%, transparent); display: none; place-items: center; z-index: 5; }
.table-wrap.loading .table-loading { display: grid; }
.desc-cell { max-width: 380px; min-width: 190px; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--sh-muted); }
.empty-state i { font-size: 2rem; opacity: .5; display: block; margin-bottom: .5rem; }

/* ---------- SKU display ---------- */
.sku-chip { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .02em; background: var(--sh-primary-soft); color: var(--sh-primary-dark); padding: .12rem .5rem; border-radius: 6px; cursor: copy; white-space: nowrap; border: 1px solid transparent; display: inline-block; }
[data-bs-theme="dark"] .sku-chip { color: var(--sh-primary); }
.sku-chip:hover { border-color: var(--sh-primary); }
.sku-chip.copied { background: var(--sh-primary); color: #fff; }
.sku-hero { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .03em; color: var(--sh-primary-dark); line-height: 1.1; }
[data-bs-theme="dark"] .sku-hero { color: var(--sh-primary); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.id-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--sh-muted); font-weight: 650; }
.id-box { border: 1px solid var(--sh-border); border-radius: 10px; padding: .6rem .8rem; background: color-mix(in srgb, var(--sh-card) 92%, var(--sh-primary) 4%); height: 100%; }
.id-box .v { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 650; word-break: break-all; }
.id-box.primary { border-color: var(--sh-primary); background: var(--sh-primary-soft); }
.preview-box { border: 2px dashed var(--sh-primary); border-radius: 12px; padding: .8rem 1rem; background: var(--sh-primary-soft); }
.preview-box .sku-hero { font-size: 1.55rem; }

/* ---------- stat tiles ---------- */
.stat { display: flex; align-items: center; gap: .85rem; padding: .95rem 1rem; border-radius: var(--sh-radius); background: var(--sh-card); border: 1px solid var(--sh-border); border-left: 4px solid var(--sh-primary); height: 100%; color: inherit; transition: transform .12s, border-color .12s; }
a.stat:hover { transform: translateY(-2px); border-color: var(--sh-primary); color: inherit; }
.stat .ico { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.stat .num { font-size: 1.55rem; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.stat .lbl { font-size: .76rem; color: var(--sh-muted); margin-top: .2rem; }
.ico-green { background: #dff3e7; color: #0b7a4b; } .ico-amber { background: #fbefd2; color: #a56800; } .ico-red { background: #fbe0de; color: #b3261e; }
.ico-blue { background: #dcebfb; color: #1d5fa8; } .ico-gray { background: #e8ecea; color: #50625a; } .ico-violet { background: #ebe3fa; color: #6b3fb5; }
[data-bs-theme="dark"] .ico-green { background: #17402b; color: #6fd49c; } [data-bs-theme="dark"] .ico-amber { background: #45340f; color: #f0b94a; }
[data-bs-theme="dark"] .ico-red { background: #4a1f1c; color: #ff8a82; } [data-bs-theme="dark"] .ico-blue { background: #172f4a; color: #7fb6f0; }
[data-bs-theme="dark"] .ico-gray { background: #25302a; color: #aebdb5; } [data-bs-theme="dark"] .ico-violet { background: #2d2347; color: #b79df0; }
.bar { height: 8px; border-radius: 6px; background: var(--sh-border); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--sh-primary); }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--sh-border); }
.timeline li { position: relative; padding: 0 0 1rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.62rem; top: .3rem; width: 11px; height: 11px; border-radius: 50%; background: var(--sh-primary); border: 2px solid var(--sh-card); }
.timeline li.k-sku_issued::before, .timeline li.k-sku_correction::before { background: var(--sh-accent); }
.timeline .t-title { font-weight: 650; }
.timeline .t-meta { color: var(--sh-muted); font-size: .78rem; }

/* ---------- forms ---------- */
.form-label { font-weight: 600; font-size: .84rem; margin-bottom: .25rem; }
.req::after { content: " *"; color: #c0392b; }
.invalid-feedback.d-block { font-size: .8rem; }
.ts-wrapper.is-invalid .ts-control { border-color: var(--bs-danger); }
.ts-control, .ts-dropdown { border-radius: .45rem; }
[data-bs-theme="dark"] .ts-control, [data-bs-theme="dark"] .ts-dropdown, [data-bs-theme="dark"] .ts-control input { background: #121b15; color: var(--sh-text); border-color: var(--sh-border); }
[data-bs-theme="dark"] .ts-dropdown .option:hover, [data-bs-theme="dark"] .ts-dropdown .active { background: #1e3a2b; color: #fff; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #121b15; border-color: var(--sh-border); color: var(--sh-text); }
[data-bs-theme="dark"] .modal-content, [data-bs-theme="dark"] .dropdown-menu { background: var(--sh-card); }
.code-pill { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: color-mix(in srgb, var(--sh-border) 70%, transparent); border-radius: 5px; padding: .05rem .4rem; }

/* ---------- toasts ---------- */
.toast-stack { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .6rem; width: min(380px, calc(100vw - 2rem)); }
.toast { border: 0; box-shadow: 0 6px 22px rgba(0,0,0,.18); }

/* ---------- misc ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(135deg, #064e2f 0%, #0b7a4b 60%, #f2b705 150%); }
.auth-card { width: min(440px, 100%); border-radius: 16px; padding: 2rem; background: var(--sh-card); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--sh-border); color: var(--sh-muted); font-weight: 700; font-size: .8rem; }
.step.active .step-dot { background: var(--sh-primary); color: #fff; }
.step.done .step-dot { background: var(--sh-accent); color: #fff; }
.msg-err { color: #b3261e; } .msg-warn { color: #9a6500; }
[data-bs-theme="dark"] .msg-err { color: #ff8a82; } [data-bs-theme="dark"] .msg-warn { color: #f0b94a; }
.problem-row td { vertical-align: top; }
.sticky-actions { position: sticky; bottom: 0; background: var(--sh-card); border-top: 1px solid var(--sh-border); padding: .75rem 1rem; margin: 1.25rem -1rem -1rem; border-radius: 0 0 12px 12px; z-index: 10; }
.text-muted, .text-body-secondary { color: var(--sh-muted) !important; }
@media (max-width: 575.98px) {
  .sku-hero { font-size: 1.45rem; }
  .table-responsive-stack td, .table-responsive-stack th { white-space: nowrap; }
  .topbar .page-title { font-size: .95rem; }
}
@media print { .sidebar, .topbar, .footer, .no-print { display: none !important; } .main { margin: 0; } }
.sku-chip-lg { font-size: 1.5rem; padding: .2rem .8rem; border-radius: 10px; }

/* ---------- small screens: compact tiles, comfortable touch targets ---------- */
.stat > div:last-child { min-width: 0; }
.stat .lbl { overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
  .stat { padding: .7rem .65rem; gap: .55rem; border-radius: 14px; }
  .stat .ico { width: 34px; height: 34px; font-size: .95rem; border-radius: 9px; }
  .stat .num { font-size: 1.3rem; }
  .stat .lbl { font-size: .7rem; }
  .form-control, .form-select, .ts-control, .ts-control input { font-size: 1rem; }  /* stops iOS zoom-on-focus */
  .btn:not(.btn-sm) { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  .modal-dialog { margin: .5rem; }
  .modal-dialog-scrollable .modal-body, .modal-body { max-height: calc(100vh - 12.5rem); overflow-y: auto; }
  .dropdown-menu { max-width: calc(100vw - 1rem); }
  .content .card-body { padding: .85rem; }
  .sku-hero { word-break: break-all; }
}
.sidebar .nav-link:focus-visible, .nav-section:focus-visible, .btn:focus-visible, .sku-chip:focus-visible { outline: 2px solid var(--sh-accent); outline-offset: 2px; }
.sku-chip { user-select: all; }

/* ---------- Inventory Checker ---------- */
.inv-tile { cursor: pointer; font: inherit; }
.inv-tile.active { border-color: var(--sh-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sh-primary) 25%, transparent); }
.inv-table td, .inv-table th { overflow-wrap: anywhere; }
.inv-note { max-width: 320px; }
.inv-f { display: flex; gap: .6rem; padding: .22rem 0; border-bottom: 1px dashed var(--sh-border); }
.inv-f:last-child { border-bottom: 0; }
.inv-l { flex: 0 0 8.2rem; color: var(--sh-muted); }
.inv-v { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.inv-cand { border: 1px solid var(--sh-border); border-radius: 10px; padding: .75rem .85rem; margin-bottom: .75rem; background: var(--sh-card); }
.inv-cand.chosen { border-color: #198754; box-shadow: 0 0 0 2px rgba(25, 135, 84, .18); }
.inv-steps { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding: 0; margin: 0 0 1rem; font-size: .85rem; color: var(--sh-muted); }
.inv-steps li { display: flex; align-items: center; gap: .4rem; }
.inv-steps li span { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--sh-border); color: var(--sh-muted); font-weight: 700; font-size: .75rem; }
.inv-steps li.on { color: inherit; font-weight: 600; }
.inv-steps li.on span, .inv-steps li.done span { background: #198754; color: #fff; }
@media (max-width: 575.98px) {
  .inv-l { flex-basis: 6rem; }
  .inv-actions { width: 100%; }
  .inv-actions > .btn, .inv-actions > .btn-group { flex: 1 1 auto; }
  #invApp .btn-sm span.d-sm-inline { display: none !important; }
}

/* ---- Inventory Checker: reconciliation, scanning ---- */
.scanbar #scanInput { font-size: 1.15rem; }
.scanbar .sug.active, #scanSuggest .sug.active, #i_suggest .sug.active { background: var(--sh-primary-soft); color: inherit; }
#scanSuggest .sug, #i_suggest .sug { white-space: normal; text-align: left; }
.flex-none { flex: none; }
.recon td, .recon th { vertical-align: middle; }
.recon .res-shortage, .recon .res-overage { font-weight: 700; }
@media (max-width: 767.98px) { #scanPanel .form-control-lg { font-size: 1.25rem; } #scanPanel .btn-lg { padding: .6rem .8rem; } .recon .btn-sm { padding: .3rem .5rem; } }
@media (min-width: 1400px) { .d-xxl-table-cell { display: table-cell !important; } .d-xxl-inline { display: inline !important; } }
.inv-tile .lbl { white-space: normal; overflow-wrap: normal; word-break: normal; }

/* typable dropdowns (TomSelect) */
.ts-dropdown { z-index: 2000; }
.ts-wrapper.form-select, .ts-wrapper.form-control { padding: 0; }
.ts-wrapper.single .ts-control, .ts-wrapper.single.input-active .ts-control { cursor: pointer; }
/* the wrapper IS the visible field (the Tom Select theme blanks the inner control), so it keeps Bootstrap's border, caret and background */
.ts-wrapper.form-select.focus { border-color: var(--bs-primary, #198754); box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb, 25, 135, 84), .2); }
[data-bs-theme="dark"] .ts-wrapper.form-select { background-color: #121b15; border-color: var(--sh-border); }
.ts-dropdown .option { white-space: normal; }
.ts-wrapper.is-invalid .ts-control { border-color: var(--bs-form-invalid-border-color, #dc3545); }
.ts-wrapper.disabled .ts-control { opacity: .65; }

/* whole-row links */
tr[data-href], tr.row-click { cursor: pointer; }
tr[data-href]:hover > *, tr.row-click:hover > * { background-color: rgba(var(--bs-primary-rgb), .06); }


/* Inventory IN section bar: compact underline tabs that wrap instead of scrolling sideways */
.in-sections{display:flex;flex-wrap:wrap;gap:.15rem 1.25rem;border-bottom:1px solid var(--bs-border-color);padding:0}
.in-sections .nav-link{padding:.5rem .1rem;border:0;border-bottom:3px solid transparent;border-radius:0;margin-bottom:-1px;font-size:.9rem;font-weight:500;color:var(--bs-secondary-color);background:none;white-space:nowrap}
.in-sections .nav-link:hover{color:var(--bs-body-color)}
.in-sections .nav-link.active{color:var(--bs-success,#146c43);border-bottom-color:var(--bs-success,#146c43);background:none;font-weight:600}
.in-sections .nav-link i{opacity:.8;font-size:.85em}
@media (max-width:575.98px){.in-sections{gap:.1rem .9rem}.in-sections .nav-link{font-size:.82rem}}

/* Searchable dropdowns: the caret stays on the value's line (no taller box), typing replaces the shown value, and the list is as wide as its longest label */
.ts-wrapper.single .ts-control { flex-wrap: nowrap; overflow: hidden; align-items: center; }
.ts-wrapper.single .ts-control > .item { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-wrapper.single .ts-control > input { flex: 1 1 2px; width: 2px !important; min-width: 2px !important; max-width: 100%; padding: 0; margin: 0; }
.ts-wrapper.single.is-typing .ts-control > .item { display: none; }
.ts-wrapper.single.is-typing .ts-control > input { flex: 1 1 auto; }
.ts-dropdown { width: max-content !important; max-width: min(34rem, 96vw); }
.ts-dropdown .option { white-space: normal; padding: .4rem .75rem; }

/* v1.4.0: global search */
.gs-pop { position: absolute; right: 0; top: calc(100% + 4px); width: min(480px, 92vw); max-height: 70vh; overflow: auto; z-index: 1080; }
.gs-group { padding: .35rem .75rem; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); }
.gs-item { display: block; padding: .45rem .75rem; text-decoration: none; color: inherit; border-top: 1px solid var(--bs-border-color); }
.gs-item:hover, .gs-item:focus { background: var(--bs-tertiary-bg); }

/* v1.4.1 receiving stepper, scan-first phone layout, saved views */
.in-steps{list-style:none;display:flex;gap:0;padding:0;margin:0;overflow-x:auto}
.in-steps li{flex:1 1 0;min-width:84px;display:flex;flex-direction:column;align-items:center;position:relative;font-size:.78rem;color:var(--bs-secondary-color)}
.in-steps li::before{content:"";position:absolute;top:13px;left:-50%;width:100%;height:2px;background:var(--bs-border-color);z-index:0}
.in-steps li:first-child::before{display:none}
.in-steps .dot{width:27px;height:27px;border-radius:50%;display:grid;place-items:center;background:var(--bs-body-bg);border:2px solid var(--bs-border-color);font-weight:600;z-index:1}
.in-steps li.done .dot{background:var(--bs-success);border-color:var(--bs-success);color:#fff}
.in-steps li.done::before,.in-steps li.now::before{background:var(--bs-success)}
.in-steps li.now .dot{border-color:var(--bs-success);color:var(--bs-success)}
.in-steps li.now .lbl{color:var(--bs-body-color);font-weight:600}
@media (max-width:767.98px){
  .in-scan-card{position:sticky;top:56px;z-index:20;box-shadow:0 4px 10px rgba(0,0,0,.08)}
  .in-scan-card #inScan{font-size:1.15rem;min-height:3rem}
  .in-steps li{min-width:64px}
}
.sv-menu .sv-del{padding:.25rem .6rem}
@media (max-width:767.98px){
  #inFilters .btn{padding:.3rem .55rem;font-size:.85rem}
  #inFilters .btn .fa-solid{margin-right:0!important}
  #inFilters .dropdown>.btn.dropdown-toggle,#inFilters #inImportBtn{font-size:0}
  #inFilters .dropdown>.btn.dropdown-toggle .fa-solid,#inFilters #inImportBtn .fa-solid{font-size:.95rem}
  #inFilters #inNewBtn{font-size:.85rem}
  #inFilters #inNewBtn .fa-solid{margin-right:.35rem!important}
}

/* ===== v1.4.2 smart tables ===== */
.table > :not(caption) > * > * { padding: .5rem .6rem; vertical-align: middle; }
.table tbody tr { transition: background-color .12s; }
.table-hover > tbody > tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--bs-primary); }
.table tbody td { font-variant-numeric: tabular-nums; }
[data-table] .table-wrap { max-height: calc(100vh - 215px); min-height: 120px; overflow: auto; overscroll-behavior: contain; }
[data-table] .table thead th { position: sticky; top: 0; z-index: 3; background: var(--sh-card); box-shadow: 0 1px 0 var(--sh-border); }
[data-table] .table td > a:not(.btn):first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
[data-table] .table td .small { max-width: 30ch; }
[data-table] .table td .text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
body.dense [data-table] .table > :not(caption) > * > * { padding: .25rem .55rem; font-size: .84rem; }
body.dense [data-table] .table td .small { font-size: .74rem; }
.tbl-tools { display: inline-flex; gap: .35rem; align-items: center; }
.tbl-tools .btn { --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .5rem; font-size: .8rem; }
.tbl-cols { min-width: 210px; max-height: 340px; overflow: auto; padding: .4rem .7rem; }
.tbl-cols label { display: flex; gap: .5rem; align-items: center; padding: .15rem 0; font-size: .85rem; cursor: pointer; }
/* health: error list */
.err-list { max-height: 420px; overflow: auto; }
.err-item { padding: .6rem 1rem; border-bottom: 1px solid var(--sh-border); }
.err-item.hit { background: rgba(255,193,7,.14); }
.err-meta { display: flex; gap: .6rem; align-items: center; margin-bottom: .15rem; }
.err-ref { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .75rem; font-weight: 700; padding: .05rem .4rem; border-radius: .35rem; background: var(--sh-bg); border: 1px solid var(--sh-border); }
.err-time { font-size: .75rem; color: var(--sh-muted); }
.err-msg { font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
/* phones: each row becomes a card */
@media (max-width: 767.98px) {
  [data-table] .table-wrap { max-height: none; overflow: visible; padding: .35rem .6rem .6rem; }
  [data-table] .table thead, [data-table] .table tr:has(> th) { display: none; }
  [data-table] .table, [data-table] .table tbody, [data-table] .table tr, [data-table] .table td { display: block; width: 100%; }
  [data-table] .table tr { border: 1px solid var(--sh-border); border-radius: .75rem; margin: .5rem 0; padding: .35rem 0; background: var(--sh-card); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
  [data-table] .table td { display: block; text-align: left; border: 0 !important; padding: .3rem .85rem !important; }
  [data-table] .table td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--sh-muted); font-weight: 650; margin-bottom: .1rem; }
  [data-table] .table td:empty { display: none; }
  [data-table] .table td[colspan] { display: block; text-align: center; }
  [data-table] .table td > a:not(.btn):first-child { -webkit-line-clamp: 3; }
  [data-table] .table td .small { max-width: none; }
  [data-table] .table td.text-end { text-align: left !important; }
  [data-table] .table td[data-label=""] { text-align: right !important; }
  [data-table] .table tbody tr:hover > td:first-child { box-shadow: none; }
}
[data-table] .table td { white-space: normal; }
[data-table] .table td .badge, [data-table] .table td .code-pill, [data-table] .table td .btn, [data-table] .table td .sku-chip { white-space: nowrap; }
[data-table] .table td.text-nowrap > div { white-space: normal; max-width: 26ch; }
/* wide report-style tables (more than 9 columns) keep the normal scrolling table on phones */
@media (max-width: 767.98px) {
  [data-table] .table-wrap:has(.tbl-wide) { overflow-x: auto; padding: 0; }
  [data-table] .tbl-wide { display: table; width: 100%; }
  [data-table] .tbl-wide thead { display: table-header-group; }
  [data-table] .tbl-wide tbody { display: table-row-group; }
  [data-table] .tbl-wide tr { display: table-row; border: 0; margin: 0; padding: 0; box-shadow: none; border-radius: 0; background: transparent; }
  [data-table] .tbl-wide td, [data-table] .tbl-wide th { display: table-cell; width: auto; padding: .4rem .6rem !important; white-space: nowrap; }
  [data-table] .tbl-wide td::before { display: none !important; }
  [data-table] .tbl-wide td:empty { display: table-cell; }
}
